+
+## Overview
+
+Rollup is a module bundler for JavaScript which compiles small pieces of code into something larger and more complex, such as a library or application. It uses the standardized ES module format for code, instead of previous idiosyncratic solutions such as CommonJS and AMD. ES modules let you freely and seamlessly combine the most useful individual functions from your favorite libraries. Rollup can optimize ES modules for faster native loading in modern browsers, or output a legacy module format allowing ES module workflows today.
+
+## Quick Start Guide
+
+Install with `npm install --global rollup`. Rollup can be used either through a [command line interface](https://rollupjs.org/command-line-interface/) with an optional configuration file or else through its [JavaScript API](https://rollupjs.org/javascript-api/). Run `rollup --help` to see the available options and parameters. The starter project templates, [rollup-starter-lib](https://github.com/rollup/rollup-starter-lib) and [rollup-starter-app](https://github.com/rollup/rollup-starter-app), demonstrate common configuration options, and more detailed instructions are available throughout the [user guide](https://rollupjs.org/introduction/).
+
+### Commands
+
+These commands assume the entry point to your application is named main.js, and that you'd like all imports compiled into a single file named bundle.js.
+
+For browsers:
+
+```bash
+# compile to a -->
+
+--------------------------------------------------------------------------------
+
+
+
+
+
+## Table of Contents
+
+- [Examples](#examples)
+ - [Consuming a source map](#consuming-a-source-map)
+ - [Generating a source map](#generating-a-source-map)
+ - [With SourceNode (high level API)](#with-sourcenode-high-level-api)
+ - [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api)
+- [API](#api)
+ - [SourceMapConsumer](#sourcemapconsumer)
+ - [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap)
+ - [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans)
+ - [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition)
+ - [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition)
+ - [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition)
+ - [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources)
+ - [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing)
+ - [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order)
+ - [SourceMapGenerator](#sourcemapgenerator)
+ - [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap)
+ - [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer)
+ - [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping)
+ - [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent)
+ - [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath)
+ - [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring)
+ - [SourceNode](#sourcenode)
+ - [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name)
+ - [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath)
+ - [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk)
+ - [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk)
+ - [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent)
+ - [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn)
+ - [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn)
+ - [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep)
+ - [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement)
+ - [SourceNode.prototype.toString()](#sourcenodeprototypetostring)
+ - [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap)
+
+
+
+## Examples
+
+### Consuming a source map
+
+```js
+var rawSourceMap = {
+ version: 3,
+ file: 'min.js',
+ names: ['bar', 'baz', 'n'],
+ sources: ['one.js', 'two.js'],
+ sourceRoot: 'http://example.com/www/js/',
+ mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA'
+};
+
+var smc = new SourceMapConsumer(rawSourceMap);
+
+console.log(smc.sources);
+// [ 'http://example.com/www/js/one.js',
+// 'http://example.com/www/js/two.js' ]
+
+console.log(smc.originalPositionFor({
+ line: 2,
+ column: 28
+}));
+// { source: 'http://example.com/www/js/two.js',
+// line: 2,
+// column: 10,
+// name: 'n' }
+
+console.log(smc.generatedPositionFor({
+ source: 'http://example.com/www/js/two.js',
+ line: 2,
+ column: 10
+}));
+// { line: 2, column: 28 }
+
+smc.eachMapping(function (m) {
+ // ...
+});
+```
+
+### Generating a source map
+
+In depth guide:
+[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/)
+
+#### With SourceNode (high level API)
+
+```js
+function compile(ast) {
+ switch (ast.type) {
+ case 'BinaryExpression':
+ return new SourceNode(
+ ast.location.line,
+ ast.location.column,
+ ast.location.source,
+ [compile(ast.left), " + ", compile(ast.right)]
+ );
+ case 'Literal':
+ return new SourceNode(
+ ast.location.line,
+ ast.location.column,
+ ast.location.source,
+ String(ast.value)
+ );
+ // ...
+ default:
+ throw new Error("Bad AST");
+ }
+}
+
+var ast = parse("40 + 2", "add.js");
+console.log(compile(ast).toStringWithSourceMap({
+ file: 'add.js'
+}));
+// { code: '40 + 2',
+// map: [object SourceMapGenerator] }
+```
+
+#### With SourceMapGenerator (low level API)
+
+```js
+var map = new SourceMapGenerator({
+ file: "source-mapped.js"
+});
+
+map.addMapping({
+ generated: {
+ line: 10,
+ column: 35
+ },
+ source: "foo.js",
+ original: {
+ line: 33,
+ column: 2
+ },
+ name: "christopher"
+});
+
+console.log(map.toString());
+// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}'
+```
+
+## API
+
+Get a reference to the module:
+
+```js
+// Node.js
+var sourceMap = require('source-map');
+
+// Browser builds
+var sourceMap = window.sourceMap;
+
+// Inside Firefox
+const sourceMap = require("devtools/toolkit/sourcemap/source-map.js");
+```
+
+### SourceMapConsumer
+
+A SourceMapConsumer instance represents a parsed source map which we can query
+for information about the original file positions by giving it a file position
+in the generated source.
+
+#### new SourceMapConsumer(rawSourceMap)
+
+The only parameter is the raw source map (either as a string which can be
+`JSON.parse`'d, or an object). According to the spec, source maps have the
+following attributes:
+
+* `version`: Which version of the source map spec this map is following.
+
+* `sources`: An array of URLs to the original source files.
+
+* `names`: An array of identifiers which can be referenced by individual
+ mappings.
+
+* `sourceRoot`: Optional. The URL root from which all sources are relative.
+
+* `sourcesContent`: Optional. An array of contents of the original source files.
+
+* `mappings`: A string of base64 VLQs which contain the actual mappings.
+
+* `file`: Optional. The generated filename this source map is associated with.
+
+```js
+var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData);
+```
+
+#### SourceMapConsumer.prototype.computeColumnSpans()
+
+Compute the last column for each generated mapping. The last column is
+inclusive.
+
+```js
+// Before:
+consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
+// [ { line: 2,
+// column: 1 },
+// { line: 2,
+// column: 10 },
+// { line: 2,
+// column: 20 } ]
+
+consumer.computeColumnSpans();
+
+// After:
+consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
+// [ { line: 2,
+// column: 1,
+// lastColumn: 9 },
+// { line: 2,
+// column: 10,
+// lastColumn: 19 },
+// { line: 2,
+// column: 20,
+// lastColumn: Infinity } ]
+
+```
+
+#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition)
+
+Returns the original source, line, and column information for the generated
+source's line and column positions provided. The only argument is an object with
+the following properties:
+
+* `line`: The line number in the generated source. Line numbers in
+ this library are 1-based (note that the underlying source map
+ specification uses 0-based line numbers -- this library handles the
+ translation).
+
+* `column`: The column number in the generated source. Column numbers
+ in this library are 0-based.
+
+* `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or
+ `SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest
+ element that is smaller than or greater than the one we are searching for,
+ respectively, if the exact element cannot be found. Defaults to
+ `SourceMapConsumer.GREATEST_LOWER_BOUND`.
+
+and an object is returned with the following properties:
+
+* `source`: The original source file, or null if this information is not
+ available.
+
+* `line`: The line number in the original source, or null if this information is
+ not available. The line number is 1-based.
+
+* `column`: The column number in the original source, or null if this
+ information is not available. The column number is 0-based.
+
+* `name`: The original identifier, or null if this information is not available.
+
+```js
+consumer.originalPositionFor({ line: 2, column: 10 })
+// { source: 'foo.coffee',
+// line: 2,
+// column: 2,
+// name: null }
+
+consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 })
+// { source: null,
+// line: null,
+// column: null,
+// name: null }
+```
+
+#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition)
+
+Returns the generated line and column information for the original source,
+line, and column positions provided. The only argument is an object with
+the following properties:
+
+* `source`: The filename of the original source.
+
+* `line`: The line number in the original source. The line number is
+ 1-based.
+
+* `column`: The column number in the original source. The column
+ number is 0-based.
+
+and an object is returned with the following properties:
+
+* `line`: The line number in the generated source, or null. The line
+ number is 1-based.
+
+* `column`: The column number in the generated source, or null. The
+ column number is 0-based.
+
+```js
+consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 })
+// { line: 1,
+// column: 56 }
+```
+
+#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)
+
+Returns all generated line and column information for the original source, line,
+and column provided. If no column is provided, returns all mappings
+corresponding to a either the line we are searching for or the next closest line
+that has any mappings. Otherwise, returns all mappings corresponding to the
+given line and either the column we are searching for or the next closest column
+that has any offsets.
+
+The only argument is an object with the following properties:
+
+* `source`: The filename of the original source.
+
+* `line`: The line number in the original source. The line number is
+ 1-based.
+
+* `column`: Optional. The column number in the original source. The
+ column number is 0-based.
+
+and an array of objects is returned, each with the following properties:
+
+* `line`: The line number in the generated source, or null. The line
+ number is 1-based.
+
+* `column`: The column number in the generated source, or null. The
+ column number is 0-based.
+
+```js
+consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" })
+// [ { line: 2,
+// column: 1 },
+// { line: 2,
+// column: 10 },
+// { line: 2,
+// column: 20 } ]
+```
+
+#### SourceMapConsumer.prototype.hasContentsOfAllSources()
+
+Return true if we have the embedded source content for every source listed in
+the source map, false otherwise.
+
+In other words, if this method returns `true`, then
+`consumer.sourceContentFor(s)` will succeed for every source `s` in
+`consumer.sources`.
+
+```js
+// ...
+if (consumer.hasContentsOfAllSources()) {
+ consumerReadyCallback(consumer);
+} else {
+ fetchSources(consumer, consumerReadyCallback);
+}
+// ...
+```
+
+#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])
+
+Returns the original source content for the source provided. The only
+argument is the URL of the original source file.
+
+If the source content for the given source is not found, then an error is
+thrown. Optionally, pass `true` as the second param to have `null` returned
+instead.
+
+```js
+consumer.sources
+// [ "my-cool-lib.clj" ]
+
+consumer.sourceContentFor("my-cool-lib.clj")
+// "..."
+
+consumer.sourceContentFor("this is not in the source map");
+// Error: "this is not in the source map" is not in the source map
+
+consumer.sourceContentFor("this is not in the source map", true);
+// null
+```
+
+#### SourceMapConsumer.prototype.eachMapping(callback, context, order)
+
+Iterate over each mapping between an original source/line/column and a
+generated line/column in this source map.
+
+* `callback`: The function that is called with each mapping. Mappings have the
+ form `{ source, generatedLine, generatedColumn, originalLine, originalColumn,
+ name }`
+
+* `context`: Optional. If specified, this object will be the value of `this`
+ every time that `callback` is called.
+
+* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or
+ `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over
+ the mappings sorted by the generated file's line/column order or the
+ original's source/line/column order, respectively. Defaults to
+ `SourceMapConsumer.GENERATED_ORDER`.
+
+```js
+consumer.eachMapping(function (m) { console.log(m); })
+// ...
+// { source: 'illmatic.js',
+// generatedLine: 1,
+// generatedColumn: 0,
+// originalLine: 1,
+// originalColumn: 0,
+// name: null }
+// { source: 'illmatic.js',
+// generatedLine: 2,
+// generatedColumn: 0,
+// originalLine: 2,
+// originalColumn: 0,
+// name: null }
+// ...
+```
+### SourceMapGenerator
+
+An instance of the SourceMapGenerator represents a source map which is being
+built incrementally.
+
+#### new SourceMapGenerator([startOfSourceMap])
+
+You may pass an object with the following properties:
+
+* `file`: The filename of the generated source that this source map is
+ associated with.
+
+* `sourceRoot`: A root for all relative URLs in this source map.
+
+* `skipValidation`: Optional. When `true`, disables validation of mappings as
+ they are added. This can improve performance but should be used with
+ discretion, as a last resort. Even then, one should avoid using this flag when
+ running tests, if possible.
+
+```js
+var generator = new sourceMap.SourceMapGenerator({
+ file: "my-generated-javascript-file.js",
+ sourceRoot: "http://example.com/app/js/"
+});
+```
+
+#### SourceMapGenerator.fromSourceMap(sourceMapConsumer)
+
+Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance.
+
+* `sourceMapConsumer` The SourceMap.
+
+```js
+var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer);
+```
+
+#### SourceMapGenerator.prototype.addMapping(mapping)
+
+Add a single mapping from original source line and column to the generated
+source's line and column for this source map being created. The mapping object
+should have the following properties:
+
+* `generated`: An object with the generated line and column positions.
+
+* `original`: An object with the original line and column positions.
+
+* `source`: The original source file (relative to the sourceRoot).
+
+* `name`: An optional original token name for this mapping.
+
+```js
+generator.addMapping({
+ source: "module-one.scm",
+ original: { line: 128, column: 0 },
+ generated: { line: 3, column: 456 }
+})
+```
+
+#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)
+
+Set the source content for an original source file.
+
+* `sourceFile` the URL of the original source file.
+
+* `sourceContent` the content of the source file.
+
+```js
+generator.setSourceContent("module-one.scm",
+ fs.readFileSync("path/to/module-one.scm"))
+```
+
+#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])
+
+Applies a SourceMap for a source file to the SourceMap.
+Each mapping to the supplied source file is rewritten using the
+supplied SourceMap. Note: The resolution for the resulting mappings
+is the minimum of this map and the supplied map.
+
+* `sourceMapConsumer`: The SourceMap to be applied.
+
+* `sourceFile`: Optional. The filename of the source file.
+ If omitted, sourceMapConsumer.file will be used, if it exists.
+ Otherwise an error will be thrown.
+
+* `sourceMapPath`: Optional. The dirname of the path to the SourceMap
+ to be applied. If relative, it is relative to the SourceMap.
+
+ This parameter is needed when the two SourceMaps aren't in the same
+ directory, and the SourceMap to be applied contains relative source
+ paths. If so, those relative source paths need to be rewritten
+ relative to the SourceMap.
+
+ If omitted, it is assumed that both SourceMaps are in the same directory,
+ thus not needing any rewriting. (Supplying `'.'` has the same effect.)
+
+#### SourceMapGenerator.prototype.toString()
+
+Renders the source map being generated to a string.
+
+```js
+generator.toString()
+// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}'
+```
+
+### SourceNode
+
+SourceNodes provide a way to abstract over interpolating and/or concatenating
+snippets of generated JavaScript source code, while maintaining the line and
+column information associated between those snippets and the original source
+code. This is useful as the final intermediate representation a compiler might
+use before outputting the generated JS and source map.
+
+#### new SourceNode([line, column, source[, chunk[, name]]])
+
+* `line`: The original line number associated with this source node, or null if
+ it isn't associated with an original line. The line number is 1-based.
+
+* `column`: The original column number associated with this source node, or null
+ if it isn't associated with an original column. The column number
+ is 0-based.
+
+* `source`: The original source's filename; null if no filename is provided.
+
+* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see
+ below.
+
+* `name`: Optional. The original identifier.
+
+```js
+var node = new SourceNode(1, 2, "a.cpp", [
+ new SourceNode(3, 4, "b.cpp", "extern int status;\n"),
+ new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"),
+ new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"),
+]);
+```
+
+#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])
+
+Creates a SourceNode from generated code and a SourceMapConsumer.
+
+* `code`: The generated code
+
+* `sourceMapConsumer` The SourceMap for the generated code
+
+* `relativePath` The optional path that relative sources in `sourceMapConsumer`
+ should be relative to.
+
+```js
+var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8"));
+var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"),
+ consumer);
+```
+
+#### SourceNode.prototype.add(chunk)
+
+Add a chunk of generated JS to this source node.
+
+* `chunk`: A string snippet of generated JS code, another instance of
+ `SourceNode`, or an array where each member is one of those things.
+
+```js
+node.add(" + ");
+node.add(otherNode);
+node.add([leftHandOperandNode, " + ", rightHandOperandNode]);
+```
+
+#### SourceNode.prototype.prepend(chunk)
+
+Prepend a chunk of generated JS to this source node.
+
+* `chunk`: A string snippet of generated JS code, another instance of
+ `SourceNode`, or an array where each member is one of those things.
+
+```js
+node.prepend("/** Build Id: f783haef86324gf **/\n\n");
+```
+
+#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent)
+
+Set the source content for a source file. This will be added to the
+`SourceMap` in the `sourcesContent` field.
+
+* `sourceFile`: The filename of the source file
+
+* `sourceContent`: The content of the source file
+
+```js
+node.setSourceContent("module-one.scm",
+ fs.readFileSync("path/to/module-one.scm"))
+```
+
+#### SourceNode.prototype.walk(fn)
+
+Walk over the tree of JS snippets in this node and its children. The walking
+function is called once for each snippet of JS and is passed that snippet and
+the its original associated source's line/column location.
+
+* `fn`: The traversal function.
+
+```js
+var node = new SourceNode(1, 2, "a.js", [
+ new SourceNode(3, 4, "b.js", "uno"),
+ "dos",
+ [
+ "tres",
+ new SourceNode(5, 6, "c.js", "quatro")
+ ]
+]);
+
+node.walk(function (code, loc) { console.log("WALK:", code, loc); })
+// WALK: uno { source: 'b.js', line: 3, column: 4, name: null }
+// WALK: dos { source: 'a.js', line: 1, column: 2, name: null }
+// WALK: tres { source: 'a.js', line: 1, column: 2, name: null }
+// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null }
+```
+
+#### SourceNode.prototype.walkSourceContents(fn)
+
+Walk over the tree of SourceNodes. The walking function is called for each
+source file content and is passed the filename and source content.
+
+* `fn`: The traversal function.
+
+```js
+var a = new SourceNode(1, 2, "a.js", "generated from a");
+a.setSourceContent("a.js", "original a");
+var b = new SourceNode(1, 2, "b.js", "generated from b");
+b.setSourceContent("b.js", "original b");
+var c = new SourceNode(1, 2, "c.js", "generated from c");
+c.setSourceContent("c.js", "original c");
+
+var node = new SourceNode(null, null, null, [a, b, c]);
+node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); })
+// WALK: a.js : original a
+// WALK: b.js : original b
+// WALK: c.js : original c
+```
+
+#### SourceNode.prototype.join(sep)
+
+Like `Array.prototype.join` except for SourceNodes. Inserts the separator
+between each of this source node's children.
+
+* `sep`: The separator.
+
+```js
+var lhs = new SourceNode(1, 2, "a.rs", "my_copy");
+var operand = new SourceNode(3, 4, "a.rs", "=");
+var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()");
+
+var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]);
+var joinedNode = node.join(" ");
+```
+
+#### SourceNode.prototype.replaceRight(pattern, replacement)
+
+Call `String.prototype.replace` on the very right-most source snippet. Useful
+for trimming white space from the end of a source node, etc.
+
+* `pattern`: The pattern to replace.
+
+* `replacement`: The thing to replace the pattern with.
+
+```js
+// Trim trailing white space.
+node.replaceRight(/\s*$/, "");
+```
+
+#### SourceNode.prototype.toString()
+
+Return the string representation of this source node. Walks over the tree and
+concatenates all the various snippets together to one string.
+
+```js
+var node = new SourceNode(1, 2, "a.js", [
+ new SourceNode(3, 4, "b.js", "uno"),
+ "dos",
+ [
+ "tres",
+ new SourceNode(5, 6, "c.js", "quatro")
+ ]
+]);
+
+node.toString()
+// 'unodostresquatro'
+```
+
+#### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])
+
+Returns the string representation of this tree of source nodes, plus a
+SourceMapGenerator which contains all the mappings between the generated and
+original sources.
+
+The arguments are the same as those to `new SourceMapGenerator`.
+
+```js
+var node = new SourceNode(1, 2, "a.js", [
+ new SourceNode(3, 4, "b.js", "uno"),
+ "dos",
+ [
+ "tres",
+ new SourceNode(5, 6, "c.js", "quatro")
+ ]
+]);
+
+node.toStringWithSourceMap({ file: "my-output-file.js" })
+// { code: 'unodostresquatro',
+// map: [object SourceMapGenerator] }
+```
diff --git a/node_modules/source-map-js/lib/array-set.js b/node_modules/source-map-js/lib/array-set.js
new file mode 100644
index 0000000..fbd5c81
--- /dev/null
+++ b/node_modules/source-map-js/lib/array-set.js
@@ -0,0 +1,121 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+var util = require('./util');
+var has = Object.prototype.hasOwnProperty;
+var hasNativeMap = typeof Map !== "undefined";
+
+/**
+ * A data structure which is a combination of an array and a set. Adding a new
+ * member is O(1), testing for membership is O(1), and finding the index of an
+ * element is O(1). Removing elements from the set is not supported. Only
+ * strings are supported for membership.
+ */
+function ArraySet() {
+ this._array = [];
+ this._set = hasNativeMap ? new Map() : Object.create(null);
+}
+
+/**
+ * Static method for creating ArraySet instances from an existing array.
+ */
+ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
+ var set = new ArraySet();
+ for (var i = 0, len = aArray.length; i < len; i++) {
+ set.add(aArray[i], aAllowDuplicates);
+ }
+ return set;
+};
+
+/**
+ * Return how many unique items are in this ArraySet. If duplicates have been
+ * added, than those do not count towards the size.
+ *
+ * @returns Number
+ */
+ArraySet.prototype.size = function ArraySet_size() {
+ return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
+};
+
+/**
+ * Add the given string to this set.
+ *
+ * @param String aStr
+ */
+ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
+ var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
+ var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
+ var idx = this._array.length;
+ if (!isDuplicate || aAllowDuplicates) {
+ this._array.push(aStr);
+ }
+ if (!isDuplicate) {
+ if (hasNativeMap) {
+ this._set.set(aStr, idx);
+ } else {
+ this._set[sStr] = idx;
+ }
+ }
+};
+
+/**
+ * Is the given string a member of this set?
+ *
+ * @param String aStr
+ */
+ArraySet.prototype.has = function ArraySet_has(aStr) {
+ if (hasNativeMap) {
+ return this._set.has(aStr);
+ } else {
+ var sStr = util.toSetString(aStr);
+ return has.call(this._set, sStr);
+ }
+};
+
+/**
+ * What is the index of the given string in the array?
+ *
+ * @param String aStr
+ */
+ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
+ if (hasNativeMap) {
+ var idx = this._set.get(aStr);
+ if (idx >= 0) {
+ return idx;
+ }
+ } else {
+ var sStr = util.toSetString(aStr);
+ if (has.call(this._set, sStr)) {
+ return this._set[sStr];
+ }
+ }
+
+ throw new Error('"' + aStr + '" is not in the set.');
+};
+
+/**
+ * What is the element at the given index?
+ *
+ * @param Number aIdx
+ */
+ArraySet.prototype.at = function ArraySet_at(aIdx) {
+ if (aIdx >= 0 && aIdx < this._array.length) {
+ return this._array[aIdx];
+ }
+ throw new Error('No element indexed by ' + aIdx);
+};
+
+/**
+ * Returns the array representation of this set (which has the proper indices
+ * indicated by indexOf). Note that this is a copy of the internal array used
+ * for storing the members so that no one can mess with internal state.
+ */
+ArraySet.prototype.toArray = function ArraySet_toArray() {
+ return this._array.slice();
+};
+
+exports.ArraySet = ArraySet;
diff --git a/node_modules/source-map-js/lib/base64-vlq.js b/node_modules/source-map-js/lib/base64-vlq.js
new file mode 100644
index 0000000..612b404
--- /dev/null
+++ b/node_modules/source-map-js/lib/base64-vlq.js
@@ -0,0 +1,140 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ *
+ * Based on the Base 64 VLQ implementation in Closure Compiler:
+ * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
+ *
+ * Copyright 2011 The Closure Compiler Authors. All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+var base64 = require('./base64');
+
+// A single base 64 digit can contain 6 bits of data. For the base 64 variable
+// length quantities we use in the source map spec, the first bit is the sign,
+// the next four bits are the actual value, and the 6th bit is the
+// continuation bit. The continuation bit tells us whether there are more
+// digits in this value following this digit.
+//
+// Continuation
+// | Sign
+// | |
+// V V
+// 101011
+
+var VLQ_BASE_SHIFT = 5;
+
+// binary: 100000
+var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
+
+// binary: 011111
+var VLQ_BASE_MASK = VLQ_BASE - 1;
+
+// binary: 100000
+var VLQ_CONTINUATION_BIT = VLQ_BASE;
+
+/**
+ * Converts from a two-complement value to a value where the sign bit is
+ * placed in the least significant bit. For example, as decimals:
+ * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
+ * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
+ */
+function toVLQSigned(aValue) {
+ return aValue < 0
+ ? ((-aValue) << 1) + 1
+ : (aValue << 1) + 0;
+}
+
+/**
+ * Converts to a two-complement value from a value where the sign bit is
+ * placed in the least significant bit. For example, as decimals:
+ * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
+ * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
+ */
+function fromVLQSigned(aValue) {
+ var isNegative = (aValue & 1) === 1;
+ var shifted = aValue >> 1;
+ return isNegative
+ ? -shifted
+ : shifted;
+}
+
+/**
+ * Returns the base 64 VLQ encoded value.
+ */
+exports.encode = function base64VLQ_encode(aValue) {
+ var encoded = "";
+ var digit;
+
+ var vlq = toVLQSigned(aValue);
+
+ do {
+ digit = vlq & VLQ_BASE_MASK;
+ vlq >>>= VLQ_BASE_SHIFT;
+ if (vlq > 0) {
+ // There are still more digits in this value, so we must make sure the
+ // continuation bit is marked.
+ digit |= VLQ_CONTINUATION_BIT;
+ }
+ encoded += base64.encode(digit);
+ } while (vlq > 0);
+
+ return encoded;
+};
+
+/**
+ * Decodes the next base 64 VLQ value from the given string and returns the
+ * value and the rest of the string via the out parameter.
+ */
+exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
+ var strLen = aStr.length;
+ var result = 0;
+ var shift = 0;
+ var continuation, digit;
+
+ do {
+ if (aIndex >= strLen) {
+ throw new Error("Expected more digits in base 64 VLQ value.");
+ }
+
+ digit = base64.decode(aStr.charCodeAt(aIndex++));
+ if (digit === -1) {
+ throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
+ }
+
+ continuation = !!(digit & VLQ_CONTINUATION_BIT);
+ digit &= VLQ_BASE_MASK;
+ result = result + (digit << shift);
+ shift += VLQ_BASE_SHIFT;
+ } while (continuation);
+
+ aOutParam.value = fromVLQSigned(result);
+ aOutParam.rest = aIndex;
+};
diff --git a/node_modules/source-map-js/lib/base64.js b/node_modules/source-map-js/lib/base64.js
new file mode 100644
index 0000000..8aa86b3
--- /dev/null
+++ b/node_modules/source-map-js/lib/base64.js
@@ -0,0 +1,67 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
+
+/**
+ * Encode an integer in the range of 0 to 63 to a single base 64 digit.
+ */
+exports.encode = function (number) {
+ if (0 <= number && number < intToCharMap.length) {
+ return intToCharMap[number];
+ }
+ throw new TypeError("Must be between 0 and 63: " + number);
+};
+
+/**
+ * Decode a single base 64 character code digit to an integer. Returns -1 on
+ * failure.
+ */
+exports.decode = function (charCode) {
+ var bigA = 65; // 'A'
+ var bigZ = 90; // 'Z'
+
+ var littleA = 97; // 'a'
+ var littleZ = 122; // 'z'
+
+ var zero = 48; // '0'
+ var nine = 57; // '9'
+
+ var plus = 43; // '+'
+ var slash = 47; // '/'
+
+ var littleOffset = 26;
+ var numberOffset = 52;
+
+ // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
+ if (bigA <= charCode && charCode <= bigZ) {
+ return (charCode - bigA);
+ }
+
+ // 26 - 51: abcdefghijklmnopqrstuvwxyz
+ if (littleA <= charCode && charCode <= littleZ) {
+ return (charCode - littleA + littleOffset);
+ }
+
+ // 52 - 61: 0123456789
+ if (zero <= charCode && charCode <= nine) {
+ return (charCode - zero + numberOffset);
+ }
+
+ // 62: +
+ if (charCode == plus) {
+ return 62;
+ }
+
+ // 63: /
+ if (charCode == slash) {
+ return 63;
+ }
+
+ // Invalid base64 digit.
+ return -1;
+};
diff --git a/node_modules/source-map-js/lib/binary-search.js b/node_modules/source-map-js/lib/binary-search.js
new file mode 100644
index 0000000..010ac94
--- /dev/null
+++ b/node_modules/source-map-js/lib/binary-search.js
@@ -0,0 +1,111 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+exports.GREATEST_LOWER_BOUND = 1;
+exports.LEAST_UPPER_BOUND = 2;
+
+/**
+ * Recursive implementation of binary search.
+ *
+ * @param aLow Indices here and lower do not contain the needle.
+ * @param aHigh Indices here and higher do not contain the needle.
+ * @param aNeedle The element being searched for.
+ * @param aHaystack The non-empty array being searched.
+ * @param aCompare Function which takes two elements and returns -1, 0, or 1.
+ * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
+ * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
+ * closest element that is smaller than or greater than the one we are
+ * searching for, respectively, if the exact element cannot be found.
+ */
+function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
+ // This function terminates when one of the following is true:
+ //
+ // 1. We find the exact element we are looking for.
+ //
+ // 2. We did not find the exact element, but we can return the index of
+ // the next-closest element.
+ //
+ // 3. We did not find the exact element, and there is no next-closest
+ // element than the one we are searching for, so we return -1.
+ var mid = Math.floor((aHigh - aLow) / 2) + aLow;
+ var cmp = aCompare(aNeedle, aHaystack[mid], true);
+ if (cmp === 0) {
+ // Found the element we are looking for.
+ return mid;
+ }
+ else if (cmp > 0) {
+ // Our needle is greater than aHaystack[mid].
+ if (aHigh - mid > 1) {
+ // The element is in the upper half.
+ return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
+ }
+
+ // The exact needle element was not found in this haystack. Determine if
+ // we are in termination case (3) or (2) and return the appropriate thing.
+ if (aBias == exports.LEAST_UPPER_BOUND) {
+ return aHigh < aHaystack.length ? aHigh : -1;
+ } else {
+ return mid;
+ }
+ }
+ else {
+ // Our needle is less than aHaystack[mid].
+ if (mid - aLow > 1) {
+ // The element is in the lower half.
+ return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
+ }
+
+ // we are in termination case (3) or (2) and return the appropriate thing.
+ if (aBias == exports.LEAST_UPPER_BOUND) {
+ return mid;
+ } else {
+ return aLow < 0 ? -1 : aLow;
+ }
+ }
+}
+
+/**
+ * This is an implementation of binary search which will always try and return
+ * the index of the closest element if there is no exact hit. This is because
+ * mappings between original and generated line/col pairs are single points,
+ * and there is an implicit region between each of them, so a miss just means
+ * that you aren't on the very start of a region.
+ *
+ * @param aNeedle The element you are looking for.
+ * @param aHaystack The array that is being searched.
+ * @param aCompare A function which takes the needle and an element in the
+ * array and returns -1, 0, or 1 depending on whether the needle is less
+ * than, equal to, or greater than the element, respectively.
+ * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
+ * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
+ * closest element that is smaller than or greater than the one we are
+ * searching for, respectively, if the exact element cannot be found.
+ * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
+ */
+exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
+ if (aHaystack.length === 0) {
+ return -1;
+ }
+
+ var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
+ aCompare, aBias || exports.GREATEST_LOWER_BOUND);
+ if (index < 0) {
+ return -1;
+ }
+
+ // We have found either the exact element, or the next-closest element than
+ // the one we are searching for. However, there may be more than one such
+ // element. Make sure we always return the smallest of these.
+ while (index - 1 >= 0) {
+ if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
+ break;
+ }
+ --index;
+ }
+
+ return index;
+};
diff --git a/node_modules/source-map-js/lib/mapping-list.js b/node_modules/source-map-js/lib/mapping-list.js
new file mode 100644
index 0000000..06d1274
--- /dev/null
+++ b/node_modules/source-map-js/lib/mapping-list.js
@@ -0,0 +1,79 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2014 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+var util = require('./util');
+
+/**
+ * Determine whether mappingB is after mappingA with respect to generated
+ * position.
+ */
+function generatedPositionAfter(mappingA, mappingB) {
+ // Optimized for most common case
+ var lineA = mappingA.generatedLine;
+ var lineB = mappingB.generatedLine;
+ var columnA = mappingA.generatedColumn;
+ var columnB = mappingB.generatedColumn;
+ return lineB > lineA || lineB == lineA && columnB >= columnA ||
+ util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
+}
+
+/**
+ * A data structure to provide a sorted view of accumulated mappings in a
+ * performance conscious manner. It trades a neglibable overhead in general
+ * case for a large speedup in case of mappings being added in order.
+ */
+function MappingList() {
+ this._array = [];
+ this._sorted = true;
+ // Serves as infimum
+ this._last = {generatedLine: -1, generatedColumn: 0};
+}
+
+/**
+ * Iterate through internal items. This method takes the same arguments that
+ * `Array.prototype.forEach` takes.
+ *
+ * NOTE: The order of the mappings is NOT guaranteed.
+ */
+MappingList.prototype.unsortedForEach =
+ function MappingList_forEach(aCallback, aThisArg) {
+ this._array.forEach(aCallback, aThisArg);
+ };
+
+/**
+ * Add the given source mapping.
+ *
+ * @param Object aMapping
+ */
+MappingList.prototype.add = function MappingList_add(aMapping) {
+ if (generatedPositionAfter(this._last, aMapping)) {
+ this._last = aMapping;
+ this._array.push(aMapping);
+ } else {
+ this._sorted = false;
+ this._array.push(aMapping);
+ }
+};
+
+/**
+ * Returns the flat, sorted array of mappings. The mappings are sorted by
+ * generated position.
+ *
+ * WARNING: This method returns internal data without copying, for
+ * performance. The return value must NOT be mutated, and should be treated as
+ * an immutable borrow. If you want to take ownership, you must make your own
+ * copy.
+ */
+MappingList.prototype.toArray = function MappingList_toArray() {
+ if (!this._sorted) {
+ this._array.sort(util.compareByGeneratedPositionsInflated);
+ this._sorted = true;
+ }
+ return this._array;
+};
+
+exports.MappingList = MappingList;
diff --git a/node_modules/source-map-js/lib/quick-sort.js b/node_modules/source-map-js/lib/quick-sort.js
new file mode 100644
index 0000000..23f9eda
--- /dev/null
+++ b/node_modules/source-map-js/lib/quick-sort.js
@@ -0,0 +1,132 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+// It turns out that some (most?) JavaScript engines don't self-host
+// `Array.prototype.sort`. This makes sense because C++ will likely remain
+// faster than JS when doing raw CPU-intensive sorting. However, when using a
+// custom comparator function, calling back and forth between the VM's C++ and
+// JIT'd JS is rather slow *and* loses JIT type information, resulting in
+// worse generated code for the comparator function than would be optimal. In
+// fact, when sorting with a comparator, these costs outweigh the benefits of
+// sorting in C++. By using our own JS-implemented Quick Sort (below), we get
+// a ~3500ms mean speed-up in `bench/bench.html`.
+
+function SortTemplate(comparator) {
+
+/**
+ * Swap the elements indexed by `x` and `y` in the array `ary`.
+ *
+ * @param {Array} ary
+ * The array.
+ * @param {Number} x
+ * The index of the first item.
+ * @param {Number} y
+ * The index of the second item.
+ */
+function swap(ary, x, y) {
+ var temp = ary[x];
+ ary[x] = ary[y];
+ ary[y] = temp;
+}
+
+/**
+ * Returns a random integer within the range `low .. high` inclusive.
+ *
+ * @param {Number} low
+ * The lower bound on the range.
+ * @param {Number} high
+ * The upper bound on the range.
+ */
+function randomIntInRange(low, high) {
+ return Math.round(low + (Math.random() * (high - low)));
+}
+
+/**
+ * The Quick Sort algorithm.
+ *
+ * @param {Array} ary
+ * An array to sort.
+ * @param {function} comparator
+ * Function to use to compare two items.
+ * @param {Number} p
+ * Start index of the array
+ * @param {Number} r
+ * End index of the array
+ */
+function doQuickSort(ary, comparator, p, r) {
+ // If our lower bound is less than our upper bound, we (1) partition the
+ // array into two pieces and (2) recurse on each half. If it is not, this is
+ // the empty array and our base case.
+
+ if (p < r) {
+ // (1) Partitioning.
+ //
+ // The partitioning chooses a pivot between `p` and `r` and moves all
+ // elements that are less than or equal to the pivot to the before it, and
+ // all the elements that are greater than it after it. The effect is that
+ // once partition is done, the pivot is in the exact place it will be when
+ // the array is put in sorted order, and it will not need to be moved
+ // again. This runs in O(n) time.
+
+ // Always choose a random pivot so that an input array which is reverse
+ // sorted does not cause O(n^2) running time.
+ var pivotIndex = randomIntInRange(p, r);
+ var i = p - 1;
+
+ swap(ary, pivotIndex, r);
+ var pivot = ary[r];
+
+ // Immediately after `j` is incremented in this loop, the following hold
+ // true:
+ //
+ // * Every element in `ary[p .. i]` is less than or equal to the pivot.
+ //
+ // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
+ for (var j = p; j < r; j++) {
+ if (comparator(ary[j], pivot, false) <= 0) {
+ i += 1;
+ swap(ary, i, j);
+ }
+ }
+
+ swap(ary, i + 1, j);
+ var q = i + 1;
+
+ // (2) Recurse on each half.
+
+ doQuickSort(ary, comparator, p, q - 1);
+ doQuickSort(ary, comparator, q + 1, r);
+ }
+}
+
+ return doQuickSort;
+}
+
+function cloneSort(comparator) {
+ let template = SortTemplate.toString();
+ let templateFn = new Function(`return ${template}`)();
+ return templateFn(comparator);
+}
+
+/**
+ * Sort the given array in-place with the given comparator function.
+ *
+ * @param {Array} ary
+ * An array to sort.
+ * @param {function} comparator
+ * Function to use to compare two items.
+ */
+
+let sortCache = new WeakMap();
+exports.quickSort = function (ary, comparator, start = 0) {
+ let doQuickSort = sortCache.get(comparator);
+ if (doQuickSort === void 0) {
+ doQuickSort = cloneSort(comparator);
+ sortCache.set(comparator, doQuickSort);
+ }
+ doQuickSort(ary, comparator, start, ary.length - 1);
+};
diff --git a/node_modules/source-map-js/lib/source-map-consumer.js b/node_modules/source-map-js/lib/source-map-consumer.js
new file mode 100644
index 0000000..4bd7a4a
--- /dev/null
+++ b/node_modules/source-map-js/lib/source-map-consumer.js
@@ -0,0 +1,1184 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+var util = require('./util');
+var binarySearch = require('./binary-search');
+var ArraySet = require('./array-set').ArraySet;
+var base64VLQ = require('./base64-vlq');
+var quickSort = require('./quick-sort').quickSort;
+
+function SourceMapConsumer(aSourceMap, aSourceMapURL) {
+ var sourceMap = aSourceMap;
+ if (typeof aSourceMap === 'string') {
+ sourceMap = util.parseSourceMapInput(aSourceMap);
+ }
+
+ return sourceMap.sections != null
+ ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
+ : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
+}
+
+SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
+ return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
+}
+
+/**
+ * The version of the source mapping spec that we are consuming.
+ */
+SourceMapConsumer.prototype._version = 3;
+
+// `__generatedMappings` and `__originalMappings` are arrays that hold the
+// parsed mapping coordinates from the source map's "mappings" attribute. They
+// are lazily instantiated, accessed via the `_generatedMappings` and
+// `_originalMappings` getters respectively, and we only parse the mappings
+// and create these arrays once queried for a source location. We jump through
+// these hoops because there can be many thousands of mappings, and parsing
+// them is expensive, so we only want to do it if we must.
+//
+// Each object in the arrays is of the form:
+//
+// {
+// generatedLine: The line number in the generated code,
+// generatedColumn: The column number in the generated code,
+// source: The path to the original source file that generated this
+// chunk of code,
+// originalLine: The line number in the original source that
+// corresponds to this chunk of generated code,
+// originalColumn: The column number in the original source that
+// corresponds to this chunk of generated code,
+// name: The name of the original symbol which generated this chunk of
+// code.
+// }
+//
+// All properties except for `generatedLine` and `generatedColumn` can be
+// `null`.
+//
+// `_generatedMappings` is ordered by the generated positions.
+//
+// `_originalMappings` is ordered by the original positions.
+
+SourceMapConsumer.prototype.__generatedMappings = null;
+Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
+ configurable: true,
+ enumerable: true,
+ get: function () {
+ if (!this.__generatedMappings) {
+ this._parseMappings(this._mappings, this.sourceRoot);
+ }
+
+ return this.__generatedMappings;
+ }
+});
+
+SourceMapConsumer.prototype.__originalMappings = null;
+Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
+ configurable: true,
+ enumerable: true,
+ get: function () {
+ if (!this.__originalMappings) {
+ this._parseMappings(this._mappings, this.sourceRoot);
+ }
+
+ return this.__originalMappings;
+ }
+});
+
+SourceMapConsumer.prototype._charIsMappingSeparator =
+ function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
+ var c = aStr.charAt(index);
+ return c === ";" || c === ",";
+ };
+
+/**
+ * Parse the mappings in a string in to a data structure which we can easily
+ * query (the ordered arrays in the `this.__generatedMappings` and
+ * `this.__originalMappings` properties).
+ */
+SourceMapConsumer.prototype._parseMappings =
+ function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
+ throw new Error("Subclasses must implement _parseMappings");
+ };
+
+SourceMapConsumer.GENERATED_ORDER = 1;
+SourceMapConsumer.ORIGINAL_ORDER = 2;
+
+SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
+SourceMapConsumer.LEAST_UPPER_BOUND = 2;
+
+/**
+ * Iterate over each mapping between an original source/line/column and a
+ * generated line/column in this source map.
+ *
+ * @param Function aCallback
+ * The function that is called with each mapping.
+ * @param Object aContext
+ * Optional. If specified, this object will be the value of `this` every
+ * time that `aCallback` is called.
+ * @param aOrder
+ * Either `SourceMapConsumer.GENERATED_ORDER` or
+ * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
+ * iterate over the mappings sorted by the generated file's line/column
+ * order or the original's source/line/column order, respectively. Defaults to
+ * `SourceMapConsumer.GENERATED_ORDER`.
+ */
+SourceMapConsumer.prototype.eachMapping =
+ function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
+ var context = aContext || null;
+ var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
+
+ var mappings;
+ switch (order) {
+ case SourceMapConsumer.GENERATED_ORDER:
+ mappings = this._generatedMappings;
+ break;
+ case SourceMapConsumer.ORIGINAL_ORDER:
+ mappings = this._originalMappings;
+ break;
+ default:
+ throw new Error("Unknown order of iteration.");
+ }
+
+ var sourceRoot = this.sourceRoot;
+ var boundCallback = aCallback.bind(context);
+ var names = this._names;
+ var sources = this._sources;
+ var sourceMapURL = this._sourceMapURL;
+
+ for (var i = 0, n = mappings.length; i < n; i++) {
+ var mapping = mappings[i];
+ var source = mapping.source === null ? null : sources.at(mapping.source);
+ source = util.computeSourceURL(sourceRoot, source, sourceMapURL);
+ boundCallback({
+ source: source,
+ generatedLine: mapping.generatedLine,
+ generatedColumn: mapping.generatedColumn,
+ originalLine: mapping.originalLine,
+ originalColumn: mapping.originalColumn,
+ name: mapping.name === null ? null : names.at(mapping.name)
+ });
+ }
+ };
+
+/**
+ * Returns all generated line and column information for the original source,
+ * line, and column provided. If no column is provided, returns all mappings
+ * corresponding to a either the line we are searching for or the next
+ * closest line that has any mappings. Otherwise, returns all mappings
+ * corresponding to the given line and either the column we are searching for
+ * or the next closest column that has any offsets.
+ *
+ * The only argument is an object with the following properties:
+ *
+ * - source: The filename of the original source.
+ * - line: The line number in the original source. The line number is 1-based.
+ * - column: Optional. the column number in the original source.
+ * The column number is 0-based.
+ *
+ * and an array of objects is returned, each with the following properties:
+ *
+ * - line: The line number in the generated source, or null. The
+ * line number is 1-based.
+ * - column: The column number in the generated source, or null.
+ * The column number is 0-based.
+ */
+SourceMapConsumer.prototype.allGeneratedPositionsFor =
+ function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
+ var line = util.getArg(aArgs, 'line');
+
+ // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
+ // returns the index of the closest mapping less than the needle. By
+ // setting needle.originalColumn to 0, we thus find the last mapping for
+ // the given line, provided such a mapping exists.
+ var needle = {
+ source: util.getArg(aArgs, 'source'),
+ originalLine: line,
+ originalColumn: util.getArg(aArgs, 'column', 0)
+ };
+
+ needle.source = this._findSourceIndex(needle.source);
+ if (needle.source < 0) {
+ return [];
+ }
+
+ var mappings = [];
+
+ var index = this._findMapping(needle,
+ this._originalMappings,
+ "originalLine",
+ "originalColumn",
+ util.compareByOriginalPositions,
+ binarySearch.LEAST_UPPER_BOUND);
+ if (index >= 0) {
+ var mapping = this._originalMappings[index];
+
+ if (aArgs.column === undefined) {
+ var originalLine = mapping.originalLine;
+
+ // Iterate until either we run out of mappings, or we run into
+ // a mapping for a different line than the one we found. Since
+ // mappings are sorted, this is guaranteed to find all mappings for
+ // the line we found.
+ while (mapping && mapping.originalLine === originalLine) {
+ mappings.push({
+ line: util.getArg(mapping, 'generatedLine', null),
+ column: util.getArg(mapping, 'generatedColumn', null),
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
+ });
+
+ mapping = this._originalMappings[++index];
+ }
+ } else {
+ var originalColumn = mapping.originalColumn;
+
+ // Iterate until either we run out of mappings, or we run into
+ // a mapping for a different line than the one we were searching for.
+ // Since mappings are sorted, this is guaranteed to find all mappings for
+ // the line we are searching for.
+ while (mapping &&
+ mapping.originalLine === line &&
+ mapping.originalColumn == originalColumn) {
+ mappings.push({
+ line: util.getArg(mapping, 'generatedLine', null),
+ column: util.getArg(mapping, 'generatedColumn', null),
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
+ });
+
+ mapping = this._originalMappings[++index];
+ }
+ }
+ }
+
+ return mappings;
+ };
+
+exports.SourceMapConsumer = SourceMapConsumer;
+
+/**
+ * A BasicSourceMapConsumer instance represents a parsed source map which we can
+ * query for information about the original file positions by giving it a file
+ * position in the generated source.
+ *
+ * The first parameter is the raw source map (either as a JSON string, or
+ * already parsed to an object). According to the spec, source maps have the
+ * following attributes:
+ *
+ * - version: Which version of the source map spec this map is following.
+ * - sources: An array of URLs to the original source files.
+ * - names: An array of identifiers which can be referrenced by individual mappings.
+ * - sourceRoot: Optional. The URL root from which all sources are relative.
+ * - sourcesContent: Optional. An array of contents of the original source files.
+ * - mappings: A string of base64 VLQs which contain the actual mappings.
+ * - file: Optional. The generated file this source map is associated with.
+ *
+ * Here is an example source map, taken from the source map spec[0]:
+ *
+ * {
+ * version : 3,
+ * file: "out.js",
+ * sourceRoot : "",
+ * sources: ["foo.js", "bar.js"],
+ * names: ["src", "maps", "are", "fun"],
+ * mappings: "AA,AB;;ABCDE;"
+ * }
+ *
+ * The second parameter, if given, is a string whose value is the URL
+ * at which the source map was found. This URL is used to compute the
+ * sources array.
+ *
+ * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
+ */
+function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
+ var sourceMap = aSourceMap;
+ if (typeof aSourceMap === 'string') {
+ sourceMap = util.parseSourceMapInput(aSourceMap);
+ }
+
+ var version = util.getArg(sourceMap, 'version');
+ var sources = util.getArg(sourceMap, 'sources');
+ // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
+ // requires the array) to play nice here.
+ var names = util.getArg(sourceMap, 'names', []);
+ var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
+ var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
+ var mappings = util.getArg(sourceMap, 'mappings');
+ var file = util.getArg(sourceMap, 'file', null);
+
+ // Once again, Sass deviates from the spec and supplies the version as a
+ // string rather than a number, so we use loose equality checking here.
+ if (version != this._version) {
+ throw new Error('Unsupported version: ' + version);
+ }
+
+ if (sourceRoot) {
+ sourceRoot = util.normalize(sourceRoot);
+ }
+
+ sources = sources
+ .map(String)
+ // Some source maps produce relative source paths like "./foo.js" instead of
+ // "foo.js". Normalize these first so that future comparisons will succeed.
+ // See bugzil.la/1090768.
+ .map(util.normalize)
+ // Always ensure that absolute sources are internally stored relative to
+ // the source root, if the source root is absolute. Not doing this would
+ // be particularly problematic when the source root is a prefix of the
+ // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
+ .map(function (source) {
+ return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
+ ? util.relative(sourceRoot, source)
+ : source;
+ });
+
+ // Pass `true` below to allow duplicate names and sources. While source maps
+ // are intended to be compressed and deduplicated, the TypeScript compiler
+ // sometimes generates source maps with duplicates in them. See Github issue
+ // #72 and bugzil.la/889492.
+ this._names = ArraySet.fromArray(names.map(String), true);
+ this._sources = ArraySet.fromArray(sources, true);
+
+ this._absoluteSources = this._sources.toArray().map(function (s) {
+ return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
+ });
+
+ this.sourceRoot = sourceRoot;
+ this.sourcesContent = sourcesContent;
+ this._mappings = mappings;
+ this._sourceMapURL = aSourceMapURL;
+ this.file = file;
+}
+
+BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
+BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
+
+/**
+ * Utility function to find the index of a source. Returns -1 if not
+ * found.
+ */
+BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
+ var relativeSource = aSource;
+ if (this.sourceRoot != null) {
+ relativeSource = util.relative(this.sourceRoot, relativeSource);
+ }
+
+ if (this._sources.has(relativeSource)) {
+ return this._sources.indexOf(relativeSource);
+ }
+
+ // Maybe aSource is an absolute URL as returned by |sources|. In
+ // this case we can't simply undo the transform.
+ var i;
+ for (i = 0; i < this._absoluteSources.length; ++i) {
+ if (this._absoluteSources[i] == aSource) {
+ return i;
+ }
+ }
+
+ return -1;
+};
+
+/**
+ * Create a BasicSourceMapConsumer from a SourceMapGenerator.
+ *
+ * @param SourceMapGenerator aSourceMap
+ * The source map that will be consumed.
+ * @param String aSourceMapURL
+ * The URL at which the source map can be found (optional)
+ * @returns BasicSourceMapConsumer
+ */
+BasicSourceMapConsumer.fromSourceMap =
+ function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
+ var smc = Object.create(BasicSourceMapConsumer.prototype);
+
+ var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
+ var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
+ smc.sourceRoot = aSourceMap._sourceRoot;
+ smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
+ smc.sourceRoot);
+ smc.file = aSourceMap._file;
+ smc._sourceMapURL = aSourceMapURL;
+ smc._absoluteSources = smc._sources.toArray().map(function (s) {
+ return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
+ });
+
+ // Because we are modifying the entries (by converting string sources and
+ // names to indices into the sources and names ArraySets), we have to make
+ // a copy of the entry or else bad things happen. Shared mutable state
+ // strikes again! See github issue #191.
+
+ var generatedMappings = aSourceMap._mappings.toArray().slice();
+ var destGeneratedMappings = smc.__generatedMappings = [];
+ var destOriginalMappings = smc.__originalMappings = [];
+
+ for (var i = 0, length = generatedMappings.length; i < length; i++) {
+ var srcMapping = generatedMappings[i];
+ var destMapping = new Mapping;
+ destMapping.generatedLine = srcMapping.generatedLine;
+ destMapping.generatedColumn = srcMapping.generatedColumn;
+
+ if (srcMapping.source) {
+ destMapping.source = sources.indexOf(srcMapping.source);
+ destMapping.originalLine = srcMapping.originalLine;
+ destMapping.originalColumn = srcMapping.originalColumn;
+
+ if (srcMapping.name) {
+ destMapping.name = names.indexOf(srcMapping.name);
+ }
+
+ destOriginalMappings.push(destMapping);
+ }
+
+ destGeneratedMappings.push(destMapping);
+ }
+
+ quickSort(smc.__originalMappings, util.compareByOriginalPositions);
+
+ return smc;
+ };
+
+/**
+ * The version of the source mapping spec that we are consuming.
+ */
+BasicSourceMapConsumer.prototype._version = 3;
+
+/**
+ * The list of original sources.
+ */
+Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
+ get: function () {
+ return this._absoluteSources.slice();
+ }
+});
+
+/**
+ * Provide the JIT with a nice shape / hidden class.
+ */
+function Mapping() {
+ this.generatedLine = 0;
+ this.generatedColumn = 0;
+ this.source = null;
+ this.originalLine = null;
+ this.originalColumn = null;
+ this.name = null;
+}
+
+/**
+ * Parse the mappings in a string in to a data structure which we can easily
+ * query (the ordered arrays in the `this.__generatedMappings` and
+ * `this.__originalMappings` properties).
+ */
+
+const compareGenerated = util.compareByGeneratedPositionsDeflatedNoLine;
+function sortGenerated(array, start) {
+ let l = array.length;
+ let n = array.length - start;
+ if (n <= 1) {
+ return;
+ } else if (n == 2) {
+ let a = array[start];
+ let b = array[start + 1];
+ if (compareGenerated(a, b) > 0) {
+ array[start] = b;
+ array[start + 1] = a;
+ }
+ } else if (n < 20) {
+ for (let i = start; i < l; i++) {
+ for (let j = i; j > start; j--) {
+ let a = array[j - 1];
+ let b = array[j];
+ if (compareGenerated(a, b) <= 0) {
+ break;
+ }
+ array[j - 1] = b;
+ array[j] = a;
+ }
+ }
+ } else {
+ quickSort(array, compareGenerated, start);
+ }
+}
+BasicSourceMapConsumer.prototype._parseMappings =
+ function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
+ var generatedLine = 1;
+ var previousGeneratedColumn = 0;
+ var previousOriginalLine = 0;
+ var previousOriginalColumn = 0;
+ var previousSource = 0;
+ var previousName = 0;
+ var length = aStr.length;
+ var index = 0;
+ var cachedSegments = {};
+ var temp = {};
+ var originalMappings = [];
+ var generatedMappings = [];
+ var mapping, str, segment, end, value;
+
+ let subarrayStart = 0;
+ while (index < length) {
+ if (aStr.charAt(index) === ';') {
+ generatedLine++;
+ index++;
+ previousGeneratedColumn = 0;
+
+ sortGenerated(generatedMappings, subarrayStart);
+ subarrayStart = generatedMappings.length;
+ }
+ else if (aStr.charAt(index) === ',') {
+ index++;
+ }
+ else {
+ mapping = new Mapping();
+ mapping.generatedLine = generatedLine;
+
+ for (end = index; end < length; end++) {
+ if (this._charIsMappingSeparator(aStr, end)) {
+ break;
+ }
+ }
+ str = aStr.slice(index, end);
+
+ segment = [];
+ while (index < end) {
+ base64VLQ.decode(aStr, index, temp);
+ value = temp.value;
+ index = temp.rest;
+ segment.push(value);
+ }
+
+ if (segment.length === 2) {
+ throw new Error('Found a source, but no line and column');
+ }
+
+ if (segment.length === 3) {
+ throw new Error('Found a source and line, but no column');
+ }
+
+ // Generated column.
+ mapping.generatedColumn = previousGeneratedColumn + segment[0];
+ previousGeneratedColumn = mapping.generatedColumn;
+
+ if (segment.length > 1) {
+ // Original source.
+ mapping.source = previousSource + segment[1];
+ previousSource += segment[1];
+
+ // Original line.
+ mapping.originalLine = previousOriginalLine + segment[2];
+ previousOriginalLine = mapping.originalLine;
+ // Lines are stored 0-based
+ mapping.originalLine += 1;
+
+ // Original column.
+ mapping.originalColumn = previousOriginalColumn + segment[3];
+ previousOriginalColumn = mapping.originalColumn;
+
+ if (segment.length > 4) {
+ // Original name.
+ mapping.name = previousName + segment[4];
+ previousName += segment[4];
+ }
+ }
+
+ generatedMappings.push(mapping);
+ if (typeof mapping.originalLine === 'number') {
+ let currentSource = mapping.source;
+ while (originalMappings.length <= currentSource) {
+ originalMappings.push(null);
+ }
+ if (originalMappings[currentSource] === null) {
+ originalMappings[currentSource] = [];
+ }
+ originalMappings[currentSource].push(mapping);
+ }
+ }
+ }
+
+ sortGenerated(generatedMappings, subarrayStart);
+ this.__generatedMappings = generatedMappings;
+
+ for (var i = 0; i < originalMappings.length; i++) {
+ if (originalMappings[i] != null) {
+ quickSort(originalMappings[i], util.compareByOriginalPositionsNoSource);
+ }
+ }
+ this.__originalMappings = [].concat(...originalMappings);
+ };
+
+/**
+ * Find the mapping that best matches the hypothetical "needle" mapping that
+ * we are searching for in the given "haystack" of mappings.
+ */
+BasicSourceMapConsumer.prototype._findMapping =
+ function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
+ aColumnName, aComparator, aBias) {
+ // To return the position we are searching for, we must first find the
+ // mapping for the given position and then return the opposite position it
+ // points to. Because the mappings are sorted, we can use binary search to
+ // find the best mapping.
+
+ if (aNeedle[aLineName] <= 0) {
+ throw new TypeError('Line must be greater than or equal to 1, got '
+ + aNeedle[aLineName]);
+ }
+ if (aNeedle[aColumnName] < 0) {
+ throw new TypeError('Column must be greater than or equal to 0, got '
+ + aNeedle[aColumnName]);
+ }
+
+ return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
+ };
+
+/**
+ * Compute the last column for each generated mapping. The last column is
+ * inclusive.
+ */
+BasicSourceMapConsumer.prototype.computeColumnSpans =
+ function SourceMapConsumer_computeColumnSpans() {
+ for (var index = 0; index < this._generatedMappings.length; ++index) {
+ var mapping = this._generatedMappings[index];
+
+ // Mappings do not contain a field for the last generated columnt. We
+ // can come up with an optimistic estimate, however, by assuming that
+ // mappings are contiguous (i.e. given two consecutive mappings, the
+ // first mapping ends where the second one starts).
+ if (index + 1 < this._generatedMappings.length) {
+ var nextMapping = this._generatedMappings[index + 1];
+
+ if (mapping.generatedLine === nextMapping.generatedLine) {
+ mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
+ continue;
+ }
+ }
+
+ // The last mapping for each line spans the entire line.
+ mapping.lastGeneratedColumn = Infinity;
+ }
+ };
+
+/**
+ * Returns the original source, line, and column information for the generated
+ * source's line and column positions provided. The only argument is an object
+ * with the following properties:
+ *
+ * - line: The line number in the generated source. The line number
+ * is 1-based.
+ * - column: The column number in the generated source. The column
+ * number is 0-based.
+ * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
+ * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
+ * closest element that is smaller than or greater than the one we are
+ * searching for, respectively, if the exact element cannot be found.
+ * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
+ *
+ * and an object is returned with the following properties:
+ *
+ * - source: The original source file, or null.
+ * - line: The line number in the original source, or null. The
+ * line number is 1-based.
+ * - column: The column number in the original source, or null. The
+ * column number is 0-based.
+ * - name: The original identifier, or null.
+ */
+BasicSourceMapConsumer.prototype.originalPositionFor =
+ function SourceMapConsumer_originalPositionFor(aArgs) {
+ var needle = {
+ generatedLine: util.getArg(aArgs, 'line'),
+ generatedColumn: util.getArg(aArgs, 'column')
+ };
+
+ var index = this._findMapping(
+ needle,
+ this._generatedMappings,
+ "generatedLine",
+ "generatedColumn",
+ util.compareByGeneratedPositionsDeflated,
+ util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
+ );
+
+ if (index >= 0) {
+ var mapping = this._generatedMappings[index];
+
+ if (mapping.generatedLine === needle.generatedLine) {
+ var source = util.getArg(mapping, 'source', null);
+ if (source !== null) {
+ source = this._sources.at(source);
+ source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
+ }
+ var name = util.getArg(mapping, 'name', null);
+ if (name !== null) {
+ name = this._names.at(name);
+ }
+ return {
+ source: source,
+ line: util.getArg(mapping, 'originalLine', null),
+ column: util.getArg(mapping, 'originalColumn', null),
+ name: name
+ };
+ }
+ }
+
+ return {
+ source: null,
+ line: null,
+ column: null,
+ name: null
+ };
+ };
+
+/**
+ * Return true if we have the source content for every source in the source
+ * map, false otherwise.
+ */
+BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
+ function BasicSourceMapConsumer_hasContentsOfAllSources() {
+ if (!this.sourcesContent) {
+ return false;
+ }
+ return this.sourcesContent.length >= this._sources.size() &&
+ !this.sourcesContent.some(function (sc) { return sc == null; });
+ };
+
+/**
+ * Returns the original source content. The only argument is the url of the
+ * original source file. Returns null if no original source content is
+ * available.
+ */
+BasicSourceMapConsumer.prototype.sourceContentFor =
+ function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
+ if (!this.sourcesContent) {
+ return null;
+ }
+
+ var index = this._findSourceIndex(aSource);
+ if (index >= 0) {
+ return this.sourcesContent[index];
+ }
+
+ var relativeSource = aSource;
+ if (this.sourceRoot != null) {
+ relativeSource = util.relative(this.sourceRoot, relativeSource);
+ }
+
+ var url;
+ if (this.sourceRoot != null
+ && (url = util.urlParse(this.sourceRoot))) {
+ // XXX: file:// URIs and absolute paths lead to unexpected behavior for
+ // many users. We can help them out when they expect file:// URIs to
+ // behave like it would if they were running a local HTTP server. See
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
+ var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
+ if (url.scheme == "file"
+ && this._sources.has(fileUriAbsPath)) {
+ return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
+ }
+
+ if ((!url.path || url.path == "/")
+ && this._sources.has("/" + relativeSource)) {
+ return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
+ }
+ }
+
+ // This function is used recursively from
+ // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
+ // don't want to throw if we can't find the source - we just want to
+ // return null, so we provide a flag to exit gracefully.
+ if (nullOnMissing) {
+ return null;
+ }
+ else {
+ throw new Error('"' + relativeSource + '" is not in the SourceMap.');
+ }
+ };
+
+/**
+ * Returns the generated line and column information for the original source,
+ * line, and column positions provided. The only argument is an object with
+ * the following properties:
+ *
+ * - source: The filename of the original source.
+ * - line: The line number in the original source. The line number
+ * is 1-based.
+ * - column: The column number in the original source. The column
+ * number is 0-based.
+ * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
+ * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
+ * closest element that is smaller than or greater than the one we are
+ * searching for, respectively, if the exact element cannot be found.
+ * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
+ *
+ * and an object is returned with the following properties:
+ *
+ * - line: The line number in the generated source, or null. The
+ * line number is 1-based.
+ * - column: The column number in the generated source, or null.
+ * The column number is 0-based.
+ */
+BasicSourceMapConsumer.prototype.generatedPositionFor =
+ function SourceMapConsumer_generatedPositionFor(aArgs) {
+ var source = util.getArg(aArgs, 'source');
+ source = this._findSourceIndex(source);
+ if (source < 0) {
+ return {
+ line: null,
+ column: null,
+ lastColumn: null
+ };
+ }
+
+ var needle = {
+ source: source,
+ originalLine: util.getArg(aArgs, 'line'),
+ originalColumn: util.getArg(aArgs, 'column')
+ };
+
+ var index = this._findMapping(
+ needle,
+ this._originalMappings,
+ "originalLine",
+ "originalColumn",
+ util.compareByOriginalPositions,
+ util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
+ );
+
+ if (index >= 0) {
+ var mapping = this._originalMappings[index];
+
+ if (mapping.source === needle.source) {
+ return {
+ line: util.getArg(mapping, 'generatedLine', null),
+ column: util.getArg(mapping, 'generatedColumn', null),
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
+ };
+ }
+ }
+
+ return {
+ line: null,
+ column: null,
+ lastColumn: null
+ };
+ };
+
+exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
+
+/**
+ * An IndexedSourceMapConsumer instance represents a parsed source map which
+ * we can query for information. It differs from BasicSourceMapConsumer in
+ * that it takes "indexed" source maps (i.e. ones with a "sections" field) as
+ * input.
+ *
+ * The first parameter is a raw source map (either as a JSON string, or already
+ * parsed to an object). According to the spec for indexed source maps, they
+ * have the following attributes:
+ *
+ * - version: Which version of the source map spec this map is following.
+ * - file: Optional. The generated file this source map is associated with.
+ * - sections: A list of section definitions.
+ *
+ * Each value under the "sections" field has two fields:
+ * - offset: The offset into the original specified at which this section
+ * begins to apply, defined as an object with a "line" and "column"
+ * field.
+ * - map: A source map definition. This source map could also be indexed,
+ * but doesn't have to be.
+ *
+ * Instead of the "map" field, it's also possible to have a "url" field
+ * specifying a URL to retrieve a source map from, but that's currently
+ * unsupported.
+ *
+ * Here's an example source map, taken from the source map spec[0], but
+ * modified to omit a section which uses the "url" field.
+ *
+ * {
+ * version : 3,
+ * file: "app.js",
+ * sections: [{
+ * offset: {line:100, column:10},
+ * map: {
+ * version : 3,
+ * file: "section.js",
+ * sources: ["foo.js", "bar.js"],
+ * names: ["src", "maps", "are", "fun"],
+ * mappings: "AAAA,E;;ABCDE;"
+ * }
+ * }],
+ * }
+ *
+ * The second parameter, if given, is a string whose value is the URL
+ * at which the source map was found. This URL is used to compute the
+ * sources array.
+ *
+ * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
+ */
+function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
+ var sourceMap = aSourceMap;
+ if (typeof aSourceMap === 'string') {
+ sourceMap = util.parseSourceMapInput(aSourceMap);
+ }
+
+ var version = util.getArg(sourceMap, 'version');
+ var sections = util.getArg(sourceMap, 'sections');
+
+ if (version != this._version) {
+ throw new Error('Unsupported version: ' + version);
+ }
+
+ this._sources = new ArraySet();
+ this._names = new ArraySet();
+
+ var lastOffset = {
+ line: -1,
+ column: 0
+ };
+ this._sections = sections.map(function (s) {
+ if (s.url) {
+ // The url field will require support for asynchronicity.
+ // See https://github.com/mozilla/source-map/issues/16
+ throw new Error('Support for url field in sections not implemented.');
+ }
+ var offset = util.getArg(s, 'offset');
+ var offsetLine = util.getArg(offset, 'line');
+ var offsetColumn = util.getArg(offset, 'column');
+
+ if (offsetLine < lastOffset.line ||
+ (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
+ throw new Error('Section offsets must be ordered and non-overlapping.');
+ }
+ lastOffset = offset;
+
+ return {
+ generatedOffset: {
+ // The offset fields are 0-based, but we use 1-based indices when
+ // encoding/decoding from VLQ.
+ generatedLine: offsetLine + 1,
+ generatedColumn: offsetColumn + 1
+ },
+ consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)
+ }
+ });
+}
+
+IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
+IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
+
+/**
+ * The version of the source mapping spec that we are consuming.
+ */
+IndexedSourceMapConsumer.prototype._version = 3;
+
+/**
+ * The list of original sources.
+ */
+Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
+ get: function () {
+ var sources = [];
+ for (var i = 0; i < this._sections.length; i++) {
+ for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
+ sources.push(this._sections[i].consumer.sources[j]);
+ }
+ }
+ return sources;
+ }
+});
+
+/**
+ * Returns the original source, line, and column information for the generated
+ * source's line and column positions provided. The only argument is an object
+ * with the following properties:
+ *
+ * - line: The line number in the generated source. The line number
+ * is 1-based.
+ * - column: The column number in the generated source. The column
+ * number is 0-based.
+ *
+ * and an object is returned with the following properties:
+ *
+ * - source: The original source file, or null.
+ * - line: The line number in the original source, or null. The
+ * line number is 1-based.
+ * - column: The column number in the original source, or null. The
+ * column number is 0-based.
+ * - name: The original identifier, or null.
+ */
+IndexedSourceMapConsumer.prototype.originalPositionFor =
+ function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
+ var needle = {
+ generatedLine: util.getArg(aArgs, 'line'),
+ generatedColumn: util.getArg(aArgs, 'column')
+ };
+
+ // Find the section containing the generated position we're trying to map
+ // to an original position.
+ var sectionIndex = binarySearch.search(needle, this._sections,
+ function(needle, section) {
+ var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
+ if (cmp) {
+ return cmp;
+ }
+
+ return (needle.generatedColumn -
+ section.generatedOffset.generatedColumn);
+ });
+ var section = this._sections[sectionIndex];
+
+ if (!section) {
+ return {
+ source: null,
+ line: null,
+ column: null,
+ name: null
+ };
+ }
+
+ return section.consumer.originalPositionFor({
+ line: needle.generatedLine -
+ (section.generatedOffset.generatedLine - 1),
+ column: needle.generatedColumn -
+ (section.generatedOffset.generatedLine === needle.generatedLine
+ ? section.generatedOffset.generatedColumn - 1
+ : 0),
+ bias: aArgs.bias
+ });
+ };
+
+/**
+ * Return true if we have the source content for every source in the source
+ * map, false otherwise.
+ */
+IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
+ function IndexedSourceMapConsumer_hasContentsOfAllSources() {
+ return this._sections.every(function (s) {
+ return s.consumer.hasContentsOfAllSources();
+ });
+ };
+
+/**
+ * Returns the original source content. The only argument is the url of the
+ * original source file. Returns null if no original source content is
+ * available.
+ */
+IndexedSourceMapConsumer.prototype.sourceContentFor =
+ function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
+ for (var i = 0; i < this._sections.length; i++) {
+ var section = this._sections[i];
+
+ var content = section.consumer.sourceContentFor(aSource, true);
+ if (content) {
+ return content;
+ }
+ }
+ if (nullOnMissing) {
+ return null;
+ }
+ else {
+ throw new Error('"' + aSource + '" is not in the SourceMap.');
+ }
+ };
+
+/**
+ * Returns the generated line and column information for the original source,
+ * line, and column positions provided. The only argument is an object with
+ * the following properties:
+ *
+ * - source: The filename of the original source.
+ * - line: The line number in the original source. The line number
+ * is 1-based.
+ * - column: The column number in the original source. The column
+ * number is 0-based.
+ *
+ * and an object is returned with the following properties:
+ *
+ * - line: The line number in the generated source, or null. The
+ * line number is 1-based.
+ * - column: The column number in the generated source, or null.
+ * The column number is 0-based.
+ */
+IndexedSourceMapConsumer.prototype.generatedPositionFor =
+ function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
+ for (var i = 0; i < this._sections.length; i++) {
+ var section = this._sections[i];
+
+ // Only consider this section if the requested source is in the list of
+ // sources of the consumer.
+ if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {
+ continue;
+ }
+ var generatedPosition = section.consumer.generatedPositionFor(aArgs);
+ if (generatedPosition) {
+ var ret = {
+ line: generatedPosition.line +
+ (section.generatedOffset.generatedLine - 1),
+ column: generatedPosition.column +
+ (section.generatedOffset.generatedLine === generatedPosition.line
+ ? section.generatedOffset.generatedColumn - 1
+ : 0)
+ };
+ return ret;
+ }
+ }
+
+ return {
+ line: null,
+ column: null
+ };
+ };
+
+/**
+ * Parse the mappings in a string in to a data structure which we can easily
+ * query (the ordered arrays in the `this.__generatedMappings` and
+ * `this.__originalMappings` properties).
+ */
+IndexedSourceMapConsumer.prototype._parseMappings =
+ function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
+ this.__generatedMappings = [];
+ this.__originalMappings = [];
+ for (var i = 0; i < this._sections.length; i++) {
+ var section = this._sections[i];
+ var sectionMappings = section.consumer._generatedMappings;
+ for (var j = 0; j < sectionMappings.length; j++) {
+ var mapping = sectionMappings[j];
+
+ var source = section.consumer._sources.at(mapping.source);
+ source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
+ this._sources.add(source);
+ source = this._sources.indexOf(source);
+
+ var name = null;
+ if (mapping.name) {
+ name = section.consumer._names.at(mapping.name);
+ this._names.add(name);
+ name = this._names.indexOf(name);
+ }
+
+ // The mappings coming from the consumer for the section have
+ // generated positions relative to the start of the section, so we
+ // need to offset them to be relative to the start of the concatenated
+ // generated file.
+ var adjustedMapping = {
+ source: source,
+ generatedLine: mapping.generatedLine +
+ (section.generatedOffset.generatedLine - 1),
+ generatedColumn: mapping.generatedColumn +
+ (section.generatedOffset.generatedLine === mapping.generatedLine
+ ? section.generatedOffset.generatedColumn - 1
+ : 0),
+ originalLine: mapping.originalLine,
+ originalColumn: mapping.originalColumn,
+ name: name
+ };
+
+ this.__generatedMappings.push(adjustedMapping);
+ if (typeof adjustedMapping.originalLine === 'number') {
+ this.__originalMappings.push(adjustedMapping);
+ }
+ }
+ }
+
+ quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
+ quickSort(this.__originalMappings, util.compareByOriginalPositions);
+ };
+
+exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
diff --git a/node_modules/source-map-js/lib/source-map-generator.js b/node_modules/source-map-js/lib/source-map-generator.js
new file mode 100644
index 0000000..508bcfb
--- /dev/null
+++ b/node_modules/source-map-js/lib/source-map-generator.js
@@ -0,0 +1,425 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+var base64VLQ = require('./base64-vlq');
+var util = require('./util');
+var ArraySet = require('./array-set').ArraySet;
+var MappingList = require('./mapping-list').MappingList;
+
+/**
+ * An instance of the SourceMapGenerator represents a source map which is
+ * being built incrementally. You may pass an object with the following
+ * properties:
+ *
+ * - file: The filename of the generated source.
+ * - sourceRoot: A root for all relative URLs in this source map.
+ */
+function SourceMapGenerator(aArgs) {
+ if (!aArgs) {
+ aArgs = {};
+ }
+ this._file = util.getArg(aArgs, 'file', null);
+ this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
+ this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
+ this._sources = new ArraySet();
+ this._names = new ArraySet();
+ this._mappings = new MappingList();
+ this._sourcesContents = null;
+}
+
+SourceMapGenerator.prototype._version = 3;
+
+/**
+ * Creates a new SourceMapGenerator based on a SourceMapConsumer
+ *
+ * @param aSourceMapConsumer The SourceMap.
+ */
+SourceMapGenerator.fromSourceMap =
+ function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
+ var sourceRoot = aSourceMapConsumer.sourceRoot;
+ var generator = new SourceMapGenerator({
+ file: aSourceMapConsumer.file,
+ sourceRoot: sourceRoot
+ });
+ aSourceMapConsumer.eachMapping(function (mapping) {
+ var newMapping = {
+ generated: {
+ line: mapping.generatedLine,
+ column: mapping.generatedColumn
+ }
+ };
+
+ if (mapping.source != null) {
+ newMapping.source = mapping.source;
+ if (sourceRoot != null) {
+ newMapping.source = util.relative(sourceRoot, newMapping.source);
+ }
+
+ newMapping.original = {
+ line: mapping.originalLine,
+ column: mapping.originalColumn
+ };
+
+ if (mapping.name != null) {
+ newMapping.name = mapping.name;
+ }
+ }
+
+ generator.addMapping(newMapping);
+ });
+ aSourceMapConsumer.sources.forEach(function (sourceFile) {
+ var sourceRelative = sourceFile;
+ if (sourceRoot !== null) {
+ sourceRelative = util.relative(sourceRoot, sourceFile);
+ }
+
+ if (!generator._sources.has(sourceRelative)) {
+ generator._sources.add(sourceRelative);
+ }
+
+ var content = aSourceMapConsumer.sourceContentFor(sourceFile);
+ if (content != null) {
+ generator.setSourceContent(sourceFile, content);
+ }
+ });
+ return generator;
+ };
+
+/**
+ * Add a single mapping from original source line and column to the generated
+ * source's line and column for this source map being created. The mapping
+ * object should have the following properties:
+ *
+ * - generated: An object with the generated line and column positions.
+ * - original: An object with the original line and column positions.
+ * - source: The original source file (relative to the sourceRoot).
+ * - name: An optional original token name for this mapping.
+ */
+SourceMapGenerator.prototype.addMapping =
+ function SourceMapGenerator_addMapping(aArgs) {
+ var generated = util.getArg(aArgs, 'generated');
+ var original = util.getArg(aArgs, 'original', null);
+ var source = util.getArg(aArgs, 'source', null);
+ var name = util.getArg(aArgs, 'name', null);
+
+ if (!this._skipValidation) {
+ this._validateMapping(generated, original, source, name);
+ }
+
+ if (source != null) {
+ source = String(source);
+ if (!this._sources.has(source)) {
+ this._sources.add(source);
+ }
+ }
+
+ if (name != null) {
+ name = String(name);
+ if (!this._names.has(name)) {
+ this._names.add(name);
+ }
+ }
+
+ this._mappings.add({
+ generatedLine: generated.line,
+ generatedColumn: generated.column,
+ originalLine: original != null && original.line,
+ originalColumn: original != null && original.column,
+ source: source,
+ name: name
+ });
+ };
+
+/**
+ * Set the source content for a source file.
+ */
+SourceMapGenerator.prototype.setSourceContent =
+ function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
+ var source = aSourceFile;
+ if (this._sourceRoot != null) {
+ source = util.relative(this._sourceRoot, source);
+ }
+
+ if (aSourceContent != null) {
+ // Add the source content to the _sourcesContents map.
+ // Create a new _sourcesContents map if the property is null.
+ if (!this._sourcesContents) {
+ this._sourcesContents = Object.create(null);
+ }
+ this._sourcesContents[util.toSetString(source)] = aSourceContent;
+ } else if (this._sourcesContents) {
+ // Remove the source file from the _sourcesContents map.
+ // If the _sourcesContents map is empty, set the property to null.
+ delete this._sourcesContents[util.toSetString(source)];
+ if (Object.keys(this._sourcesContents).length === 0) {
+ this._sourcesContents = null;
+ }
+ }
+ };
+
+/**
+ * Applies the mappings of a sub-source-map for a specific source file to the
+ * source map being generated. Each mapping to the supplied source file is
+ * rewritten using the supplied source map. Note: The resolution for the
+ * resulting mappings is the minimium of this map and the supplied map.
+ *
+ * @param aSourceMapConsumer The source map to be applied.
+ * @param aSourceFile Optional. The filename of the source file.
+ * If omitted, SourceMapConsumer's file property will be used.
+ * @param aSourceMapPath Optional. The dirname of the path to the source map
+ * to be applied. If relative, it is relative to the SourceMapConsumer.
+ * This parameter is needed when the two source maps aren't in the same
+ * directory, and the source map to be applied contains relative source
+ * paths. If so, those relative source paths need to be rewritten
+ * relative to the SourceMapGenerator.
+ */
+SourceMapGenerator.prototype.applySourceMap =
+ function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
+ var sourceFile = aSourceFile;
+ // If aSourceFile is omitted, we will use the file property of the SourceMap
+ if (aSourceFile == null) {
+ if (aSourceMapConsumer.file == null) {
+ throw new Error(
+ 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
+ 'or the source map\'s "file" property. Both were omitted.'
+ );
+ }
+ sourceFile = aSourceMapConsumer.file;
+ }
+ var sourceRoot = this._sourceRoot;
+ // Make "sourceFile" relative if an absolute Url is passed.
+ if (sourceRoot != null) {
+ sourceFile = util.relative(sourceRoot, sourceFile);
+ }
+ // Applying the SourceMap can add and remove items from the sources and
+ // the names array.
+ var newSources = new ArraySet();
+ var newNames = new ArraySet();
+
+ // Find mappings for the "sourceFile"
+ this._mappings.unsortedForEach(function (mapping) {
+ if (mapping.source === sourceFile && mapping.originalLine != null) {
+ // Check if it can be mapped by the source map, then update the mapping.
+ var original = aSourceMapConsumer.originalPositionFor({
+ line: mapping.originalLine,
+ column: mapping.originalColumn
+ });
+ if (original.source != null) {
+ // Copy mapping
+ mapping.source = original.source;
+ if (aSourceMapPath != null) {
+ mapping.source = util.join(aSourceMapPath, mapping.source)
+ }
+ if (sourceRoot != null) {
+ mapping.source = util.relative(sourceRoot, mapping.source);
+ }
+ mapping.originalLine = original.line;
+ mapping.originalColumn = original.column;
+ if (original.name != null) {
+ mapping.name = original.name;
+ }
+ }
+ }
+
+ var source = mapping.source;
+ if (source != null && !newSources.has(source)) {
+ newSources.add(source);
+ }
+
+ var name = mapping.name;
+ if (name != null && !newNames.has(name)) {
+ newNames.add(name);
+ }
+
+ }, this);
+ this._sources = newSources;
+ this._names = newNames;
+
+ // Copy sourcesContents of applied map.
+ aSourceMapConsumer.sources.forEach(function (sourceFile) {
+ var content = aSourceMapConsumer.sourceContentFor(sourceFile);
+ if (content != null) {
+ if (aSourceMapPath != null) {
+ sourceFile = util.join(aSourceMapPath, sourceFile);
+ }
+ if (sourceRoot != null) {
+ sourceFile = util.relative(sourceRoot, sourceFile);
+ }
+ this.setSourceContent(sourceFile, content);
+ }
+ }, this);
+ };
+
+/**
+ * A mapping can have one of the three levels of data:
+ *
+ * 1. Just the generated position.
+ * 2. The Generated position, original position, and original source.
+ * 3. Generated and original position, original source, as well as a name
+ * token.
+ *
+ * To maintain consistency, we validate that any new mapping being added falls
+ * in to one of these categories.
+ */
+SourceMapGenerator.prototype._validateMapping =
+ function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
+ aName) {
+ // When aOriginal is truthy but has empty values for .line and .column,
+ // it is most likely a programmer error. In this case we throw a very
+ // specific error message to try to guide them the right way.
+ // For example: https://github.com/Polymer/polymer-bundler/pull/519
+ if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
+ throw new Error(
+ 'original.line and original.column are not numbers -- you probably meant to omit ' +
+ 'the original mapping entirely and only map the generated position. If so, pass ' +
+ 'null for the original mapping instead of an object with empty or null values.'
+ );
+ }
+
+ if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
+ && aGenerated.line > 0 && aGenerated.column >= 0
+ && !aOriginal && !aSource && !aName) {
+ // Case 1.
+ return;
+ }
+ else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
+ && aOriginal && 'line' in aOriginal && 'column' in aOriginal
+ && aGenerated.line > 0 && aGenerated.column >= 0
+ && aOriginal.line > 0 && aOriginal.column >= 0
+ && aSource) {
+ // Cases 2 and 3.
+ return;
+ }
+ else {
+ throw new Error('Invalid mapping: ' + JSON.stringify({
+ generated: aGenerated,
+ source: aSource,
+ original: aOriginal,
+ name: aName
+ }));
+ }
+ };
+
+/**
+ * Serialize the accumulated mappings in to the stream of base 64 VLQs
+ * specified by the source map format.
+ */
+SourceMapGenerator.prototype._serializeMappings =
+ function SourceMapGenerator_serializeMappings() {
+ var previousGeneratedColumn = 0;
+ var previousGeneratedLine = 1;
+ var previousOriginalColumn = 0;
+ var previousOriginalLine = 0;
+ var previousName = 0;
+ var previousSource = 0;
+ var result = '';
+ var next;
+ var mapping;
+ var nameIdx;
+ var sourceIdx;
+
+ var mappings = this._mappings.toArray();
+ for (var i = 0, len = mappings.length; i < len; i++) {
+ mapping = mappings[i];
+ next = ''
+
+ if (mapping.generatedLine !== previousGeneratedLine) {
+ previousGeneratedColumn = 0;
+ while (mapping.generatedLine !== previousGeneratedLine) {
+ next += ';';
+ previousGeneratedLine++;
+ }
+ }
+ else {
+ if (i > 0) {
+ if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
+ continue;
+ }
+ next += ',';
+ }
+ }
+
+ next += base64VLQ.encode(mapping.generatedColumn
+ - previousGeneratedColumn);
+ previousGeneratedColumn = mapping.generatedColumn;
+
+ if (mapping.source != null) {
+ sourceIdx = this._sources.indexOf(mapping.source);
+ next += base64VLQ.encode(sourceIdx - previousSource);
+ previousSource = sourceIdx;
+
+ // lines are stored 0-based in SourceMap spec version 3
+ next += base64VLQ.encode(mapping.originalLine - 1
+ - previousOriginalLine);
+ previousOriginalLine = mapping.originalLine - 1;
+
+ next += base64VLQ.encode(mapping.originalColumn
+ - previousOriginalColumn);
+ previousOriginalColumn = mapping.originalColumn;
+
+ if (mapping.name != null) {
+ nameIdx = this._names.indexOf(mapping.name);
+ next += base64VLQ.encode(nameIdx - previousName);
+ previousName = nameIdx;
+ }
+ }
+
+ result += next;
+ }
+
+ return result;
+ };
+
+SourceMapGenerator.prototype._generateSourcesContent =
+ function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
+ return aSources.map(function (source) {
+ if (!this._sourcesContents) {
+ return null;
+ }
+ if (aSourceRoot != null) {
+ source = util.relative(aSourceRoot, source);
+ }
+ var key = util.toSetString(source);
+ return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
+ ? this._sourcesContents[key]
+ : null;
+ }, this);
+ };
+
+/**
+ * Externalize the source map.
+ */
+SourceMapGenerator.prototype.toJSON =
+ function SourceMapGenerator_toJSON() {
+ var map = {
+ version: this._version,
+ sources: this._sources.toArray(),
+ names: this._names.toArray(),
+ mappings: this._serializeMappings()
+ };
+ if (this._file != null) {
+ map.file = this._file;
+ }
+ if (this._sourceRoot != null) {
+ map.sourceRoot = this._sourceRoot;
+ }
+ if (this._sourcesContents) {
+ map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
+ }
+
+ return map;
+ };
+
+/**
+ * Render the source map being generated to a string.
+ */
+SourceMapGenerator.prototype.toString =
+ function SourceMapGenerator_toString() {
+ return JSON.stringify(this.toJSON());
+ };
+
+exports.SourceMapGenerator = SourceMapGenerator;
diff --git a/node_modules/source-map-js/lib/source-node.js b/node_modules/source-map-js/lib/source-node.js
new file mode 100644
index 0000000..8bcdbe3
--- /dev/null
+++ b/node_modules/source-map-js/lib/source-node.js
@@ -0,0 +1,413 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;
+var util = require('./util');
+
+// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
+// operating systems these days (capturing the result).
+var REGEX_NEWLINE = /(\r?\n)/;
+
+// Newline character code for charCodeAt() comparisons
+var NEWLINE_CODE = 10;
+
+// Private symbol for identifying `SourceNode`s when multiple versions of
+// the source-map library are loaded. This MUST NOT CHANGE across
+// versions!
+var isSourceNode = "$$$isSourceNode$$$";
+
+/**
+ * SourceNodes provide a way to abstract over interpolating/concatenating
+ * snippets of generated JavaScript source code while maintaining the line and
+ * column information associated with the original source code.
+ *
+ * @param aLine The original line number.
+ * @param aColumn The original column number.
+ * @param aSource The original source's filename.
+ * @param aChunks Optional. An array of strings which are snippets of
+ * generated JS, or other SourceNodes.
+ * @param aName The original identifier.
+ */
+function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
+ this.children = [];
+ this.sourceContents = {};
+ this.line = aLine == null ? null : aLine;
+ this.column = aColumn == null ? null : aColumn;
+ this.source = aSource == null ? null : aSource;
+ this.name = aName == null ? null : aName;
+ this[isSourceNode] = true;
+ if (aChunks != null) this.add(aChunks);
+}
+
+/**
+ * Creates a SourceNode from generated code and a SourceMapConsumer.
+ *
+ * @param aGeneratedCode The generated code
+ * @param aSourceMapConsumer The SourceMap for the generated code
+ * @param aRelativePath Optional. The path that relative sources in the
+ * SourceMapConsumer should be relative to.
+ */
+SourceNode.fromStringWithSourceMap =
+ function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
+ // The SourceNode we want to fill with the generated code
+ // and the SourceMap
+ var node = new SourceNode();
+
+ // All even indices of this array are one line of the generated code,
+ // while all odd indices are the newlines between two adjacent lines
+ // (since `REGEX_NEWLINE` captures its match).
+ // Processed fragments are accessed by calling `shiftNextLine`.
+ var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
+ var remainingLinesIndex = 0;
+ var shiftNextLine = function() {
+ var lineContents = getNextLine();
+ // The last line of a file might not have a newline.
+ var newLine = getNextLine() || "";
+ return lineContents + newLine;
+
+ function getNextLine() {
+ return remainingLinesIndex < remainingLines.length ?
+ remainingLines[remainingLinesIndex++] : undefined;
+ }
+ };
+
+ // We need to remember the position of "remainingLines"
+ var lastGeneratedLine = 1, lastGeneratedColumn = 0;
+
+ // The generate SourceNodes we need a code range.
+ // To extract it current and last mapping is used.
+ // Here we store the last mapping.
+ var lastMapping = null;
+
+ aSourceMapConsumer.eachMapping(function (mapping) {
+ if (lastMapping !== null) {
+ // We add the code from "lastMapping" to "mapping":
+ // First check if there is a new line in between.
+ if (lastGeneratedLine < mapping.generatedLine) {
+ // Associate first line with "lastMapping"
+ addMappingWithCode(lastMapping, shiftNextLine());
+ lastGeneratedLine++;
+ lastGeneratedColumn = 0;
+ // The remaining code is added without mapping
+ } else {
+ // There is no new line in between.
+ // Associate the code between "lastGeneratedColumn" and
+ // "mapping.generatedColumn" with "lastMapping"
+ var nextLine = remainingLines[remainingLinesIndex] || '';
+ var code = nextLine.substr(0, mapping.generatedColumn -
+ lastGeneratedColumn);
+ remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
+ lastGeneratedColumn);
+ lastGeneratedColumn = mapping.generatedColumn;
+ addMappingWithCode(lastMapping, code);
+ // No more remaining code, continue
+ lastMapping = mapping;
+ return;
+ }
+ }
+ // We add the generated code until the first mapping
+ // to the SourceNode without any mapping.
+ // Each line is added as separate string.
+ while (lastGeneratedLine < mapping.generatedLine) {
+ node.add(shiftNextLine());
+ lastGeneratedLine++;
+ }
+ if (lastGeneratedColumn < mapping.generatedColumn) {
+ var nextLine = remainingLines[remainingLinesIndex] || '';
+ node.add(nextLine.substr(0, mapping.generatedColumn));
+ remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
+ lastGeneratedColumn = mapping.generatedColumn;
+ }
+ lastMapping = mapping;
+ }, this);
+ // We have processed all mappings.
+ if (remainingLinesIndex < remainingLines.length) {
+ if (lastMapping) {
+ // Associate the remaining code in the current line with "lastMapping"
+ addMappingWithCode(lastMapping, shiftNextLine());
+ }
+ // and add the remaining lines without any mapping
+ node.add(remainingLines.splice(remainingLinesIndex).join(""));
+ }
+
+ // Copy sourcesContent into SourceNode
+ aSourceMapConsumer.sources.forEach(function (sourceFile) {
+ var content = aSourceMapConsumer.sourceContentFor(sourceFile);
+ if (content != null) {
+ if (aRelativePath != null) {
+ sourceFile = util.join(aRelativePath, sourceFile);
+ }
+ node.setSourceContent(sourceFile, content);
+ }
+ });
+
+ return node;
+
+ function addMappingWithCode(mapping, code) {
+ if (mapping === null || mapping.source === undefined) {
+ node.add(code);
+ } else {
+ var source = aRelativePath
+ ? util.join(aRelativePath, mapping.source)
+ : mapping.source;
+ node.add(new SourceNode(mapping.originalLine,
+ mapping.originalColumn,
+ source,
+ code,
+ mapping.name));
+ }
+ }
+ };
+
+/**
+ * Add a chunk of generated JS to this source node.
+ *
+ * @param aChunk A string snippet of generated JS code, another instance of
+ * SourceNode, or an array where each member is one of those things.
+ */
+SourceNode.prototype.add = function SourceNode_add(aChunk) {
+ if (Array.isArray(aChunk)) {
+ aChunk.forEach(function (chunk) {
+ this.add(chunk);
+ }, this);
+ }
+ else if (aChunk[isSourceNode] || typeof aChunk === "string") {
+ if (aChunk) {
+ this.children.push(aChunk);
+ }
+ }
+ else {
+ throw new TypeError(
+ "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
+ );
+ }
+ return this;
+};
+
+/**
+ * Add a chunk of generated JS to the beginning of this source node.
+ *
+ * @param aChunk A string snippet of generated JS code, another instance of
+ * SourceNode, or an array where each member is one of those things.
+ */
+SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
+ if (Array.isArray(aChunk)) {
+ for (var i = aChunk.length-1; i >= 0; i--) {
+ this.prepend(aChunk[i]);
+ }
+ }
+ else if (aChunk[isSourceNode] || typeof aChunk === "string") {
+ this.children.unshift(aChunk);
+ }
+ else {
+ throw new TypeError(
+ "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
+ );
+ }
+ return this;
+};
+
+/**
+ * Walk over the tree of JS snippets in this node and its children. The
+ * walking function is called once for each snippet of JS and is passed that
+ * snippet and the its original associated source's line/column location.
+ *
+ * @param aFn The traversal function.
+ */
+SourceNode.prototype.walk = function SourceNode_walk(aFn) {
+ var chunk;
+ for (var i = 0, len = this.children.length; i < len; i++) {
+ chunk = this.children[i];
+ if (chunk[isSourceNode]) {
+ chunk.walk(aFn);
+ }
+ else {
+ if (chunk !== '') {
+ aFn(chunk, { source: this.source,
+ line: this.line,
+ column: this.column,
+ name: this.name });
+ }
+ }
+ }
+};
+
+/**
+ * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
+ * each of `this.children`.
+ *
+ * @param aSep The separator.
+ */
+SourceNode.prototype.join = function SourceNode_join(aSep) {
+ var newChildren;
+ var i;
+ var len = this.children.length;
+ if (len > 0) {
+ newChildren = [];
+ for (i = 0; i < len-1; i++) {
+ newChildren.push(this.children[i]);
+ newChildren.push(aSep);
+ }
+ newChildren.push(this.children[i]);
+ this.children = newChildren;
+ }
+ return this;
+};
+
+/**
+ * Call String.prototype.replace on the very right-most source snippet. Useful
+ * for trimming whitespace from the end of a source node, etc.
+ *
+ * @param aPattern The pattern to replace.
+ * @param aReplacement The thing to replace the pattern with.
+ */
+SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
+ var lastChild = this.children[this.children.length - 1];
+ if (lastChild[isSourceNode]) {
+ lastChild.replaceRight(aPattern, aReplacement);
+ }
+ else if (typeof lastChild === 'string') {
+ this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
+ }
+ else {
+ this.children.push(''.replace(aPattern, aReplacement));
+ }
+ return this;
+};
+
+/**
+ * Set the source content for a source file. This will be added to the SourceMapGenerator
+ * in the sourcesContent field.
+ *
+ * @param aSourceFile The filename of the source file
+ * @param aSourceContent The content of the source file
+ */
+SourceNode.prototype.setSourceContent =
+ function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
+ this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
+ };
+
+/**
+ * Walk over the tree of SourceNodes. The walking function is called for each
+ * source file content and is passed the filename and source content.
+ *
+ * @param aFn The traversal function.
+ */
+SourceNode.prototype.walkSourceContents =
+ function SourceNode_walkSourceContents(aFn) {
+ for (var i = 0, len = this.children.length; i < len; i++) {
+ if (this.children[i][isSourceNode]) {
+ this.children[i].walkSourceContents(aFn);
+ }
+ }
+
+ var sources = Object.keys(this.sourceContents);
+ for (var i = 0, len = sources.length; i < len; i++) {
+ aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
+ }
+ };
+
+/**
+ * Return the string representation of this source node. Walks over the tree
+ * and concatenates all the various snippets together to one string.
+ */
+SourceNode.prototype.toString = function SourceNode_toString() {
+ var str = "";
+ this.walk(function (chunk) {
+ str += chunk;
+ });
+ return str;
+};
+
+/**
+ * Returns the string representation of this source node along with a source
+ * map.
+ */
+SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
+ var generated = {
+ code: "",
+ line: 1,
+ column: 0
+ };
+ var map = new SourceMapGenerator(aArgs);
+ var sourceMappingActive = false;
+ var lastOriginalSource = null;
+ var lastOriginalLine = null;
+ var lastOriginalColumn = null;
+ var lastOriginalName = null;
+ this.walk(function (chunk, original) {
+ generated.code += chunk;
+ if (original.source !== null
+ && original.line !== null
+ && original.column !== null) {
+ if(lastOriginalSource !== original.source
+ || lastOriginalLine !== original.line
+ || lastOriginalColumn !== original.column
+ || lastOriginalName !== original.name) {
+ map.addMapping({
+ source: original.source,
+ original: {
+ line: original.line,
+ column: original.column
+ },
+ generated: {
+ line: generated.line,
+ column: generated.column
+ },
+ name: original.name
+ });
+ }
+ lastOriginalSource = original.source;
+ lastOriginalLine = original.line;
+ lastOriginalColumn = original.column;
+ lastOriginalName = original.name;
+ sourceMappingActive = true;
+ } else if (sourceMappingActive) {
+ map.addMapping({
+ generated: {
+ line: generated.line,
+ column: generated.column
+ }
+ });
+ lastOriginalSource = null;
+ sourceMappingActive = false;
+ }
+ for (var idx = 0, length = chunk.length; idx < length; idx++) {
+ if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
+ generated.line++;
+ generated.column = 0;
+ // Mappings end at eol
+ if (idx + 1 === length) {
+ lastOriginalSource = null;
+ sourceMappingActive = false;
+ } else if (sourceMappingActive) {
+ map.addMapping({
+ source: original.source,
+ original: {
+ line: original.line,
+ column: original.column
+ },
+ generated: {
+ line: generated.line,
+ column: generated.column
+ },
+ name: original.name
+ });
+ }
+ } else {
+ generated.column++;
+ }
+ }
+ });
+ this.walkSourceContents(function (sourceFile, sourceContent) {
+ map.setSourceContent(sourceFile, sourceContent);
+ });
+
+ return { code: generated.code, map: map };
+};
+
+exports.SourceNode = SourceNode;
diff --git a/node_modules/source-map-js/lib/util.js b/node_modules/source-map-js/lib/util.js
new file mode 100644
index 0000000..430e2d0
--- /dev/null
+++ b/node_modules/source-map-js/lib/util.js
@@ -0,0 +1,594 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+/**
+ * This is a helper function for getting values from parameter/options
+ * objects.
+ *
+ * @param args The object we are extracting values from
+ * @param name The name of the property we are getting.
+ * @param defaultValue An optional value to return if the property is missing
+ * from the object. If this is not specified and the property is missing, an
+ * error will be thrown.
+ */
+function getArg(aArgs, aName, aDefaultValue) {
+ if (aName in aArgs) {
+ return aArgs[aName];
+ } else if (arguments.length === 3) {
+ return aDefaultValue;
+ } else {
+ throw new Error('"' + aName + '" is a required argument.');
+ }
+}
+exports.getArg = getArg;
+
+var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
+var dataUrlRegexp = /^data:.+\,.+$/;
+
+function urlParse(aUrl) {
+ var match = aUrl.match(urlRegexp);
+ if (!match) {
+ return null;
+ }
+ return {
+ scheme: match[1],
+ auth: match[2],
+ host: match[3],
+ port: match[4],
+ path: match[5]
+ };
+}
+exports.urlParse = urlParse;
+
+function urlGenerate(aParsedUrl) {
+ var url = '';
+ if (aParsedUrl.scheme) {
+ url += aParsedUrl.scheme + ':';
+ }
+ url += '//';
+ if (aParsedUrl.auth) {
+ url += aParsedUrl.auth + '@';
+ }
+ if (aParsedUrl.host) {
+ url += aParsedUrl.host;
+ }
+ if (aParsedUrl.port) {
+ url += ":" + aParsedUrl.port
+ }
+ if (aParsedUrl.path) {
+ url += aParsedUrl.path;
+ }
+ return url;
+}
+exports.urlGenerate = urlGenerate;
+
+var MAX_CACHED_INPUTS = 32;
+
+/**
+ * Takes some function `f(input) -> result` and returns a memoized version of
+ * `f`.
+ *
+ * We keep at most `MAX_CACHED_INPUTS` memoized results of `f` alive. The
+ * memoization is a dumb-simple, linear least-recently-used cache.
+ */
+function lruMemoize(f) {
+ var cache = [];
+
+ return function(input) {
+ for (var i = 0; i < cache.length; i++) {
+ if (cache[i].input === input) {
+ var temp = cache[0];
+ cache[0] = cache[i];
+ cache[i] = temp;
+ return cache[0].result;
+ }
+ }
+
+ var result = f(input);
+
+ cache.unshift({
+ input,
+ result,
+ });
+
+ if (cache.length > MAX_CACHED_INPUTS) {
+ cache.pop();
+ }
+
+ return result;
+ };
+}
+
+/**
+ * Normalizes a path, or the path portion of a URL:
+ *
+ * - Replaces consecutive slashes with one slash.
+ * - Removes unnecessary '.' parts.
+ * - Removes unnecessary '/..' parts.
+ *
+ * Based on code in the Node.js 'path' core module.
+ *
+ * @param aPath The path or url to normalize.
+ */
+var normalize = lruMemoize(function normalize(aPath) {
+ var path = aPath;
+ var url = urlParse(aPath);
+ if (url) {
+ if (!url.path) {
+ return aPath;
+ }
+ path = url.path;
+ }
+ var isAbsolute = exports.isAbsolute(path);
+ // Split the path into parts between `/` characters. This is much faster than
+ // using `.split(/\/+/g)`.
+ var parts = [];
+ var start = 0;
+ var i = 0;
+ while (true) {
+ start = i;
+ i = path.indexOf("/", start);
+ if (i === -1) {
+ parts.push(path.slice(start));
+ break;
+ } else {
+ parts.push(path.slice(start, i));
+ while (i < path.length && path[i] === "/") {
+ i++;
+ }
+ }
+ }
+
+ for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
+ part = parts[i];
+ if (part === '.') {
+ parts.splice(i, 1);
+ } else if (part === '..') {
+ up++;
+ } else if (up > 0) {
+ if (part === '') {
+ // The first part is blank if the path is absolute. Trying to go
+ // above the root is a no-op. Therefore we can remove all '..' parts
+ // directly after the root.
+ parts.splice(i + 1, up);
+ up = 0;
+ } else {
+ parts.splice(i, 2);
+ up--;
+ }
+ }
+ }
+ path = parts.join('/');
+
+ if (path === '') {
+ path = isAbsolute ? '/' : '.';
+ }
+
+ if (url) {
+ url.path = path;
+ return urlGenerate(url);
+ }
+ return path;
+});
+exports.normalize = normalize;
+
+/**
+ * Joins two paths/URLs.
+ *
+ * @param aRoot The root path or URL.
+ * @param aPath The path or URL to be joined with the root.
+ *
+ * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
+ * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
+ * first.
+ * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
+ * is updated with the result and aRoot is returned. Otherwise the result
+ * is returned.
+ * - If aPath is absolute, the result is aPath.
+ * - Otherwise the two paths are joined with a slash.
+ * - Joining for example 'http://' and 'www.example.com' is also supported.
+ */
+function join(aRoot, aPath) {
+ if (aRoot === "") {
+ aRoot = ".";
+ }
+ if (aPath === "") {
+ aPath = ".";
+ }
+ var aPathUrl = urlParse(aPath);
+ var aRootUrl = urlParse(aRoot);
+ if (aRootUrl) {
+ aRoot = aRootUrl.path || '/';
+ }
+
+ // `join(foo, '//www.example.org')`
+ if (aPathUrl && !aPathUrl.scheme) {
+ if (aRootUrl) {
+ aPathUrl.scheme = aRootUrl.scheme;
+ }
+ return urlGenerate(aPathUrl);
+ }
+
+ if (aPathUrl || aPath.match(dataUrlRegexp)) {
+ return aPath;
+ }
+
+ // `join('http://', 'www.example.com')`
+ if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
+ aRootUrl.host = aPath;
+ return urlGenerate(aRootUrl);
+ }
+
+ var joined = aPath.charAt(0) === '/'
+ ? aPath
+ : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
+
+ if (aRootUrl) {
+ aRootUrl.path = joined;
+ return urlGenerate(aRootUrl);
+ }
+ return joined;
+}
+exports.join = join;
+
+exports.isAbsolute = function (aPath) {
+ return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
+};
+
+/**
+ * Make a path relative to a URL or another path.
+ *
+ * @param aRoot The root path or URL.
+ * @param aPath The path or URL to be made relative to aRoot.
+ */
+function relative(aRoot, aPath) {
+ if (aRoot === "") {
+ aRoot = ".";
+ }
+
+ aRoot = aRoot.replace(/\/$/, '');
+
+ // It is possible for the path to be above the root. In this case, simply
+ // checking whether the root is a prefix of the path won't work. Instead, we
+ // need to remove components from the root one by one, until either we find
+ // a prefix that fits, or we run out of components to remove.
+ var level = 0;
+ while (aPath.indexOf(aRoot + '/') !== 0) {
+ var index = aRoot.lastIndexOf("/");
+ if (index < 0) {
+ return aPath;
+ }
+
+ // If the only part of the root that is left is the scheme (i.e. http://,
+ // file:///, etc.), one or more slashes (/), or simply nothing at all, we
+ // have exhausted all components, so the path is not relative to the root.
+ aRoot = aRoot.slice(0, index);
+ if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
+ return aPath;
+ }
+
+ ++level;
+ }
+
+ // Make sure we add a "../" for each component we removed from the root.
+ return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
+}
+exports.relative = relative;
+
+var supportsNullProto = (function () {
+ var obj = Object.create(null);
+ return !('__proto__' in obj);
+}());
+
+function identity (s) {
+ return s;
+}
+
+/**
+ * Because behavior goes wacky when you set `__proto__` on objects, we
+ * have to prefix all the strings in our set with an arbitrary character.
+ *
+ * See https://github.com/mozilla/source-map/pull/31 and
+ * https://github.com/mozilla/source-map/issues/30
+ *
+ * @param String aStr
+ */
+function toSetString(aStr) {
+ if (isProtoString(aStr)) {
+ return '$' + aStr;
+ }
+
+ return aStr;
+}
+exports.toSetString = supportsNullProto ? identity : toSetString;
+
+function fromSetString(aStr) {
+ if (isProtoString(aStr)) {
+ return aStr.slice(1);
+ }
+
+ return aStr;
+}
+exports.fromSetString = supportsNullProto ? identity : fromSetString;
+
+function isProtoString(s) {
+ if (!s) {
+ return false;
+ }
+
+ var length = s.length;
+
+ if (length < 9 /* "__proto__".length */) {
+ return false;
+ }
+
+ if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
+ s.charCodeAt(length - 2) !== 95 /* '_' */ ||
+ s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
+ s.charCodeAt(length - 4) !== 116 /* 't' */ ||
+ s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
+ s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
+ s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
+ s.charCodeAt(length - 8) !== 95 /* '_' */ ||
+ s.charCodeAt(length - 9) !== 95 /* '_' */) {
+ return false;
+ }
+
+ for (var i = length - 10; i >= 0; i--) {
+ if (s.charCodeAt(i) !== 36 /* '$' */) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+/**
+ * Comparator between two mappings where the original positions are compared.
+ *
+ * Optionally pass in `true` as `onlyCompareGenerated` to consider two
+ * mappings with the same original source/line/column, but different generated
+ * line and column the same. Useful when searching for a mapping with a
+ * stubbed out mapping.
+ */
+function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
+ var cmp = strcmp(mappingA.source, mappingB.source);
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalLine - mappingB.originalLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
+ if (cmp !== 0 || onlyCompareOriginal) {
+ return cmp;
+ }
+
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.generatedLine - mappingB.generatedLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ return strcmp(mappingA.name, mappingB.name);
+}
+exports.compareByOriginalPositions = compareByOriginalPositions;
+
+function compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) {
+ var cmp
+
+ cmp = mappingA.originalLine - mappingB.originalLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
+ if (cmp !== 0 || onlyCompareOriginal) {
+ return cmp;
+ }
+
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.generatedLine - mappingB.generatedLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ return strcmp(mappingA.name, mappingB.name);
+}
+exports.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource;
+
+/**
+ * Comparator between two mappings with deflated source and name indices where
+ * the generated positions are compared.
+ *
+ * Optionally pass in `true` as `onlyCompareGenerated` to consider two
+ * mappings with the same generated line and column, but different
+ * source/name/original line and column the same. Useful when searching for a
+ * mapping with a stubbed out mapping.
+ */
+function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
+ var cmp = mappingA.generatedLine - mappingB.generatedLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
+ if (cmp !== 0 || onlyCompareGenerated) {
+ return cmp;
+ }
+
+ cmp = strcmp(mappingA.source, mappingB.source);
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalLine - mappingB.originalLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ return strcmp(mappingA.name, mappingB.name);
+}
+exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
+
+function compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) {
+ var cmp = mappingA.generatedColumn - mappingB.generatedColumn;
+ if (cmp !== 0 || onlyCompareGenerated) {
+ return cmp;
+ }
+
+ cmp = strcmp(mappingA.source, mappingB.source);
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalLine - mappingB.originalLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ return strcmp(mappingA.name, mappingB.name);
+}
+exports.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine;
+
+function strcmp(aStr1, aStr2) {
+ if (aStr1 === aStr2) {
+ return 0;
+ }
+
+ if (aStr1 === null) {
+ return 1; // aStr2 !== null
+ }
+
+ if (aStr2 === null) {
+ return -1; // aStr1 !== null
+ }
+
+ if (aStr1 > aStr2) {
+ return 1;
+ }
+
+ return -1;
+}
+
+/**
+ * Comparator between two mappings with inflated source and name strings where
+ * the generated positions are compared.
+ */
+function compareByGeneratedPositionsInflated(mappingA, mappingB) {
+ var cmp = mappingA.generatedLine - mappingB.generatedLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = strcmp(mappingA.source, mappingB.source);
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalLine - mappingB.originalLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ return strcmp(mappingA.name, mappingB.name);
+}
+exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
+
+/**
+ * Strip any JSON XSSI avoidance prefix from the string (as documented
+ * in the source maps specification), and then parse the string as
+ * JSON.
+ */
+function parseSourceMapInput(str) {
+ return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
+}
+exports.parseSourceMapInput = parseSourceMapInput;
+
+/**
+ * Compute the URL of a source given the the source root, the source's
+ * URL, and the source map's URL.
+ */
+function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
+ sourceURL = sourceURL || '';
+
+ if (sourceRoot) {
+ // This follows what Chrome does.
+ if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
+ sourceRoot += '/';
+ }
+ // The spec says:
+ // Line 4: An optional source root, useful for relocating source
+ // files on a server or removing repeated values in the
+ // “sources” entry. This value is prepended to the individual
+ // entries in the “source” field.
+ sourceURL = sourceRoot + sourceURL;
+ }
+
+ // Historically, SourceMapConsumer did not take the sourceMapURL as
+ // a parameter. This mode is still somewhat supported, which is why
+ // this code block is conditional. However, it's preferable to pass
+ // the source map URL to SourceMapConsumer, so that this function
+ // can implement the source URL resolution algorithm as outlined in
+ // the spec. This block is basically the equivalent of:
+ // new URL(sourceURL, sourceMapURL).toString()
+ // ... except it avoids using URL, which wasn't available in the
+ // older releases of node still supported by this library.
+ //
+ // The spec says:
+ // If the sources are not absolute URLs after prepending of the
+ // “sourceRoot”, the sources are resolved relative to the
+ // SourceMap (like resolving script src in a html document).
+ if (sourceMapURL) {
+ var parsed = urlParse(sourceMapURL);
+ if (!parsed) {
+ throw new Error("sourceMapURL could not be parsed");
+ }
+ if (parsed.path) {
+ // Strip the last path component, but keep the "/".
+ var index = parsed.path.lastIndexOf('/');
+ if (index >= 0) {
+ parsed.path = parsed.path.substring(0, index + 1);
+ }
+ }
+ sourceURL = join(urlGenerate(parsed), sourceURL);
+ }
+
+ return normalize(sourceURL);
+}
+exports.computeSourceURL = computeSourceURL;
diff --git a/node_modules/source-map-js/package.json b/node_modules/source-map-js/package.json
new file mode 100644
index 0000000..501fafe
--- /dev/null
+++ b/node_modules/source-map-js/package.json
@@ -0,0 +1,71 @@
+{
+ "name": "source-map-js",
+ "description": "Generates and consumes source maps",
+ "version": "1.0.2",
+ "homepage": "https://github.com/7rulnik/source-map-js",
+ "author": "Valentin 7rulnik Semirulnik ",
+ "contributors": [
+ "Nick Fitzgerald ",
+ "Tobias Koppers ",
+ "Duncan Beevers ",
+ "Stephen Crane ",
+ "Ryan Seddon ",
+ "Miles Elam ",
+ "Mihai Bazon ",
+ "Michael Ficarra ",
+ "Todd Wolfson ",
+ "Alexander Solovyov ",
+ "Felix Gnass ",
+ "Conrad Irwin ",
+ "usrbincc ",
+ "David Glasser ",
+ "Chase Douglas ",
+ "Evan Wallace ",
+ "Heather Arthur ",
+ "Hugh Kennedy ",
+ "David Glasser ",
+ "Simon Lydell ",
+ "Jmeas Smith ",
+ "Michael Z Goddard ",
+ "azu ",
+ "John Gozde ",
+ "Adam Kirkton ",
+ "Chris Montgomery ",
+ "J. Ryan Stinnett ",
+ "Jack Herrington ",
+ "Chris Truter ",
+ "Daniel Espeset ",
+ "Jamie Wong ",
+ "Eddy Bruël ",
+ "Hawken Rives ",
+ "Gilad Peleg ",
+ "djchie ",
+ "Gary Ye ",
+ "Nicolas Lalevée "
+ ],
+ "repository": "7rulnik/source-map-js",
+ "main": "./source-map.js",
+ "files": [
+ "source-map.js",
+ "source-map.d.ts",
+ "lib/"
+ ],
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "license": "BSD-3-Clause",
+ "scripts": {
+ "test": "npm run build && node test/run-tests.js",
+ "build": "webpack --color",
+ "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md"
+ },
+ "devDependencies": {
+ "clean-publish": "^3.1.0",
+ "doctoc": "^0.15.0",
+ "webpack": "^1.12.0"
+ },
+ "clean-publish": {
+ "cleanDocs": true
+ },
+ "typings": "source-map.d.ts"
+}
diff --git a/node_modules/source-map-js/source-map.d.ts b/node_modules/source-map-js/source-map.d.ts
new file mode 100644
index 0000000..9f8a4b3
--- /dev/null
+++ b/node_modules/source-map-js/source-map.d.ts
@@ -0,0 +1,115 @@
+declare module 'source-map-js' {
+ export interface StartOfSourceMap {
+ file?: string;
+ sourceRoot?: string;
+ }
+
+ export interface RawSourceMap extends StartOfSourceMap {
+ version: string;
+ sources: string[];
+ names: string[];
+ sourcesContent?: string[];
+ mappings: string;
+ }
+
+ export interface Position {
+ line: number;
+ column: number;
+ }
+
+ export interface LineRange extends Position {
+ lastColumn: number;
+ }
+
+ export interface FindPosition extends Position {
+ // SourceMapConsumer.GREATEST_LOWER_BOUND or SourceMapConsumer.LEAST_UPPER_BOUND
+ bias?: number;
+ }
+
+ export interface SourceFindPosition extends FindPosition {
+ source: string;
+ }
+
+ export interface MappedPosition extends Position {
+ source: string;
+ name?: string;
+ }
+
+ export interface MappingItem {
+ source: string;
+ generatedLine: number;
+ generatedColumn: number;
+ originalLine: number;
+ originalColumn: number;
+ name: string;
+ }
+
+ export class SourceMapConsumer {
+ static GENERATED_ORDER: number;
+ static ORIGINAL_ORDER: number;
+
+ static GREATEST_LOWER_BOUND: number;
+ static LEAST_UPPER_BOUND: number;
+
+ constructor(rawSourceMap: RawSourceMap);
+ computeColumnSpans(): void;
+ originalPositionFor(generatedPosition: FindPosition): MappedPosition;
+ generatedPositionFor(originalPosition: SourceFindPosition): LineRange;
+ allGeneratedPositionsFor(originalPosition: MappedPosition): Position[];
+ hasContentsOfAllSources(): boolean;
+ sourceContentFor(source: string, returnNullOnMissing?: boolean): string;
+ eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
+ }
+
+ export interface Mapping {
+ generated: Position;
+ original: Position;
+ source: string;
+ name?: string;
+ }
+
+ export class SourceMapGenerator {
+ constructor(startOfSourceMap?: StartOfSourceMap);
+ static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
+ addMapping(mapping: Mapping): void;
+ setSourceContent(sourceFile: string, sourceContent: string): void;
+ applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
+ toString(): string;
+ }
+
+ export interface CodeWithSourceMap {
+ code: string;
+ map: SourceMapGenerator;
+ }
+
+ export class SourceNode {
+ constructor();
+ constructor(line: number, column: number, source: string);
+ constructor(line: number, column: number, source: string, chunk?: string, name?: string);
+ static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode;
+ add(chunk: string): void;
+ prepend(chunk: string): void;
+ setSourceContent(sourceFile: string, sourceContent: string): void;
+ walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
+ walkSourceContents(fn: (file: string, content: string) => void): void;
+ join(sep: string): SourceNode;
+ replaceRight(pattern: string, replacement: string): SourceNode;
+ toString(): string;
+ toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
+ }
+}
+
+declare module 'source-map-js/lib/source-map-generator' {
+ import { SourceMapGenerator } from 'source-map-js'
+ export { SourceMapGenerator }
+}
+
+declare module 'source-map-js/lib/source-map-consumer' {
+ import { SourceMapConsumer } from 'source-map-js'
+ export { SourceMapConsumer }
+}
+
+declare module 'source-map-js/lib/source-node' {
+ import { SourceNode } from 'source-map-js'
+ export { SourceNode }
+}
diff --git a/node_modules/source-map-js/source-map.js b/node_modules/source-map-js/source-map.js
new file mode 100644
index 0000000..bc88fe8
--- /dev/null
+++ b/node_modules/source-map-js/source-map.js
@@ -0,0 +1,8 @@
+/*
+ * Copyright 2009-2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE.txt or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;
+exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;
+exports.SourceNode = require('./lib/source-node').SourceNode;
diff --git a/node_modules/vite/LICENSE.md b/node_modules/vite/LICENSE.md
new file mode 100644
index 0000000..6021274
--- /dev/null
+++ b/node_modules/vite/LICENSE.md
@@ -0,0 +1,3396 @@
+# Vite core license
+Vite is released under the MIT license:
+
+MIT License
+
+Copyright (c) 2019-present, Yuxi (Evan) You and Vite 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.
+
+# Licenses of bundled dependencies
+The published Vite artifact additionally contains code with the following licenses:
+Apache-2.0, BSD-2-Clause, CC0-1.0, ISC, MIT
+
+# Bundled dependencies:
+## @ampproject/remapping
+License: Apache-2.0
+By: Justin Ridgewell
+Repository: git+https://github.com/ampproject/remapping.git
+
+> Apache License
+> Version 2.0, January 2004
+> http://www.apache.org/licenses/
+>
+> TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+>
+> 1. Definitions.
+>
+> "License" shall mean the terms and conditions for use, reproduction,
+> and distribution as defined by Sections 1 through 9 of this document.
+>
+> "Licensor" shall mean the copyright owner or entity authorized by
+> the copyright owner that is granting the License.
+>
+> "Legal Entity" shall mean the union of the acting entity and all
+> other entities that control, are controlled by, or are under common
+> control with that entity. For the purposes of this definition,
+> "control" means (i) the power, direct or indirect, to cause the
+> direction or management of such entity, whether by contract or
+> otherwise, or (ii) ownership of fifty percent (50%) or more of the
+> outstanding shares, or (iii) beneficial ownership of such entity.
+>
+> "You" (or "Your") shall mean an individual or Legal Entity
+> exercising permissions granted by this License.
+>
+> "Source" form shall mean the preferred form for making modifications,
+> including but not limited to software source code, documentation
+> source, and configuration files.
+>
+> "Object" form shall mean any form resulting from mechanical
+> transformation or translation of a Source form, including but
+> not limited to compiled object code, generated documentation,
+> and conversions to other media types.
+>
+> "Work" shall mean the work of authorship, whether in Source or
+> Object form, made available under the License, as indicated by a
+> copyright notice that is included in or attached to the work
+> (an example is provided in the Appendix below).
+>
+> "Derivative Works" shall mean any work, whether in Source or Object
+> form, that is based on (or derived from) the Work and for which the
+> editorial revisions, annotations, elaborations, or other modifications
+> represent, as a whole, an original work of authorship. For the purposes
+> of this License, Derivative Works shall not include works that remain
+> separable from, or merely link (or bind by name) to the interfaces of,
+> the Work and Derivative Works thereof.
+>
+> "Contribution" shall mean any work of authorship, including
+> the original version of the Work and any modifications or additions
+> to that Work or Derivative Works thereof, that is intentionally
+> submitted to Licensor for inclusion in the Work by the copyright owner
+> or by an individual or Legal Entity authorized to submit on behalf of
+> the copyright owner. For the purposes of this definition, "submitted"
+> means any form of electronic, verbal, or written communication sent
+> to the Licensor or its representatives, including but not limited to
+> communication on electronic mailing lists, source code control systems,
+> and issue tracking systems that are managed by, or on behalf of, the
+> Licensor for the purpose of discussing and improving the Work, but
+> excluding communication that is conspicuously marked or otherwise
+> designated in writing by the copyright owner as "Not a Contribution."
+>
+> "Contributor" shall mean Licensor and any individual or Legal Entity
+> on behalf of whom a Contribution has been received by Licensor and
+> subsequently incorporated within the Work.
+>
+> 2. Grant of Copyright License. Subject to the terms and conditions of
+> this License, each Contributor hereby grants to You a perpetual,
+> worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+> copyright license to reproduce, prepare Derivative Works of,
+> publicly display, publicly perform, sublicense, and distribute the
+> Work and such Derivative Works in Source or Object form.
+>
+> 3. Grant of Patent License. Subject to the terms and conditions of
+> this License, each Contributor hereby grants to You a perpetual,
+> worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+> (except as stated in this section) patent license to make, have made,
+> use, offer to sell, sell, import, and otherwise transfer the Work,
+> where such license applies only to those patent claims licensable
+> by such Contributor that are necessarily infringed by their
+> Contribution(s) alone or by combination of their Contribution(s)
+> with the Work to which such Contribution(s) was submitted. If You
+> institute patent litigation against any entity (including a
+> cross-claim or counterclaim in a lawsuit) alleging that the Work
+> or a Contribution incorporated within the Work constitutes direct
+> or contributory patent infringement, then any patent licenses
+> granted to You under this License for that Work shall terminate
+> as of the date such litigation is filed.
+>
+> 4. Redistribution. You may reproduce and distribute copies of the
+> Work or Derivative Works thereof in any medium, with or without
+> modifications, and in Source or Object form, provided that You
+> meet the following conditions:
+>
+> (a) You must give any other recipients of the Work or
+> Derivative Works a copy of this License; and
+>
+> (b) You must cause any modified files to carry prominent notices
+> stating that You changed the files; and
+>
+> (c) You must retain, in the Source form of any Derivative Works
+> that You distribute, all copyright, patent, trademark, and
+> attribution notices from the Source form of the Work,
+> excluding those notices that do not pertain to any part of
+> the Derivative Works; and
+>
+> (d) If the Work includes a "NOTICE" text file as part of its
+> distribution, then any Derivative Works that You distribute must
+> include a readable copy of the attribution notices contained
+> within such NOTICE file, excluding those notices that do not
+> pertain to any part of the Derivative Works, in at least one
+> of the following places: within a NOTICE text file distributed
+> as part of the Derivative Works; within the Source form or
+> documentation, if provided along with the Derivative Works; or,
+> within a display generated by the Derivative Works, if and
+> wherever such third-party notices normally appear. The contents
+> of the NOTICE file are for informational purposes only and
+> do not modify the License. You may add Your own attribution
+> notices within Derivative Works that You distribute, alongside
+> or as an addendum to the NOTICE text from the Work, provided
+> that such additional attribution notices cannot be construed
+> as modifying the License.
+>
+> You may add Your own copyright statement to Your modifications and
+> may provide additional or different license terms and conditions
+> for use, reproduction, or distribution of Your modifications, or
+> for any such Derivative Works as a whole, provided Your use,
+> reproduction, and distribution of the Work otherwise complies with
+> the conditions stated in this License.
+>
+> 5. Submission of Contributions. Unless You explicitly state otherwise,
+> any Contribution intentionally submitted for inclusion in the Work
+> by You to the Licensor shall be under the terms and conditions of
+> this License, without any additional terms or conditions.
+> Notwithstanding the above, nothing herein shall supersede or modify
+> the terms of any separate license agreement you may have executed
+> with Licensor regarding such Contributions.
+>
+> 6. Trademarks. This License does not grant permission to use the trade
+> names, trademarks, service marks, or product names of the Licensor,
+> except as required for reasonable and customary use in describing the
+> origin of the Work and reproducing the content of the NOTICE file.
+>
+> 7. Disclaimer of Warranty. Unless required by applicable law or
+> agreed to in writing, Licensor provides the Work (and each
+> Contributor provides its Contributions) on an "AS IS" BASIS,
+> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+> implied, including, without limitation, any warranties or conditions
+> of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+> PARTICULAR PURPOSE. You are solely responsible for determining the
+> appropriateness of using or redistributing the Work and assume any
+> risks associated with Your exercise of permissions under this License.
+>
+> 8. Limitation of Liability. In no event and under no legal theory,
+> whether in tort (including negligence), contract, or otherwise,
+> unless required by applicable law (such as deliberate and grossly
+> negligent acts) or agreed to in writing, shall any Contributor be
+> liable to You for damages, including any direct, indirect, special,
+> incidental, or consequential damages of any character arising as a
+> result of this License or out of the use or inability to use the
+> Work (including but not limited to damages for loss of goodwill,
+> work stoppage, computer failure or malfunction, or any and all
+> other commercial damages or losses), even if such Contributor
+> has been advised of the possibility of such damages.
+>
+> 9. Accepting Warranty or Additional Liability. While redistributing
+> the Work or Derivative Works thereof, You may choose to offer,
+> and charge a fee for, acceptance of support, warranty, indemnity,
+> or other liability obligations and/or rights consistent with this
+> License. However, in accepting such obligations, You may act only
+> on Your own behalf and on Your sole responsibility, not on behalf
+> of any other Contributor, and only if You agree to indemnify,
+> defend, and hold each Contributor harmless for any liability
+> incurred by, or claims asserted against, such Contributor by reason
+> of your accepting any such warranty or additional liability.
+>
+> END OF TERMS AND CONDITIONS
+>
+> APPENDIX: How to apply the Apache License to your work.
+>
+> To apply the Apache License to your work, attach the following
+> boilerplate notice, with the fields enclosed by brackets "[]"
+> replaced with your own identifying information. (Don't include
+> the brackets!) The text should be enclosed in the appropriate
+> comment syntax for the file format. We also recommend that a
+> file or class name and description of purpose be included on the
+> same "printed page" as the copyright notice for easier
+> identification within third-party archives.
+>
+> Copyright [yyyy] [name of copyright owner]
+>
+> Licensed under the Apache License, Version 2.0 (the "License");
+> you may not use this file except in compliance with the License.
+> You may obtain a copy of the License at
+>
+> http://www.apache.org/licenses/LICENSE-2.0
+>
+> Unless required by applicable law or agreed to in writing, software
+> distributed under the License is distributed on an "AS IS" BASIS,
+> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+> See the License for the specific language governing permissions and
+> limitations under the License.
+
+---------------------------------------
+
+## @jridgewell/gen-mapping
+License: MIT
+By: Justin Ridgewell
+Repository: https://github.com/jridgewell/gen-mapping
+
+> Copyright 2022 Justin Ridgewell
+>
+> 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.
+
+---------------------------------------
+
+## @jridgewell/resolve-uri
+License: MIT
+By: Justin Ridgewell
+Repository: https://github.com/jridgewell/resolve-uri
+
+> Copyright 2019 Justin Ridgewell
+>
+> 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.
+
+---------------------------------------
+
+## @jridgewell/set-array
+License: MIT
+By: Justin Ridgewell
+Repository: https://github.com/jridgewell/set-array
+
+> Copyright 2022 Justin Ridgewell
+>
+> 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.
+
+---------------------------------------
+
+## @jridgewell/sourcemap-codec
+License: MIT
+By: Rich Harris
+Repository: git+https://github.com/jridgewell/sourcemap-codec.git
+
+> The MIT License
+>
+> Copyright (c) 2015 Rich Harris
+>
+> 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.
+
+---------------------------------------
+
+## @jridgewell/trace-mapping
+License: MIT
+By: Justin Ridgewell
+Repository: git+https://github.com/jridgewell/trace-mapping.git
+
+> Copyright 2022 Justin Ridgewell
+>
+> 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.
+
+---------------------------------------
+
+## @nodelib/fs.scandir
+License: MIT
+Repository: https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir
+
+> The MIT License (MIT)
+>
+> Copyright (c) Denis Malinochkin
+>
+> 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.
+
+---------------------------------------
+
+## @nodelib/fs.stat
+License: MIT
+Repository: https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.stat
+
+> The MIT License (MIT)
+>
+> Copyright (c) Denis Malinochkin
+>
+> 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.
+
+---------------------------------------
+
+## @nodelib/fs.walk
+License: MIT
+Repository: https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.walk
+
+> The MIT License (MIT)
+>
+> Copyright (c) Denis Malinochkin
+>
+> 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.
+
+---------------------------------------
+
+## @polka/url
+License: MIT
+By: Luke Edwards
+Repository: lukeed/polka
+
+> The MIT License (MIT)
+>
+> Copyright (c) Luke Edwards (https://lukeed.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.
+
+---------------------------------------
+
+## @rollup/plugin-alias
+License: MIT
+By: Johannes Stein
+Repository: rollup/plugins
+
+---------------------------------------
+
+## @rollup/plugin-commonjs
+License: MIT
+By: Rich Harris
+Repository: rollup/plugins
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/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.
+
+---------------------------------------
+
+## @rollup/plugin-dynamic-import-vars
+License: MIT
+By: LarsDenBakker
+Repository: rollup/plugins
+
+---------------------------------------
+
+## @rollup/pluginutils
+License: MIT
+By: Rich Harris
+Repository: rollup/plugins
+
+---------------------------------------
+
+## acorn
+License: MIT
+By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
+Repository: https://github.com/acornjs/acorn.git
+
+> MIT License
+>
+> Copyright (C) 2012-2022 by various contributors (see AUTHORS)
+>
+> 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.
+
+---------------------------------------
+
+## acorn-walk
+License: MIT
+By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
+Repository: https://github.com/acornjs/acorn.git
+
+> MIT License
+>
+> Copyright (C) 2012-2020 by various contributors (see AUTHORS)
+>
+> 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.
+
+---------------------------------------
+
+## ansi-regex
+License: MIT
+By: Sindre Sorhus
+Repository: chalk/ansi-regex
+
+> 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.
+
+---------------------------------------
+
+## anymatch
+License: ISC
+By: Elan Shanker
+Repository: https://github.com/micromatch/anymatch
+
+> The ISC License
+>
+> Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com)
+>
+> 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.
+
+---------------------------------------
+
+## balanced-match
+License: MIT
+By: Julian Gruber
+Repository: git://github.com/juliangruber/balanced-match.git
+
+> (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.
+
+---------------------------------------
+
+## binary-extensions
+License: MIT
+By: Sindre Sorhus
+Repository: sindresorhus/binary-extensions
+
+> MIT License
+>
+> Copyright (c) 2019 Sindre Sorhus (https://sindresorhus.com), Paul Miller (https://paulmillr.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.
+
+---------------------------------------
+
+## brace-expansion
+License: MIT
+By: Julian Gruber
+Repository: git://github.com/juliangruber/brace-expansion.git
+
+> MIT License
+>
+> Copyright (c) 2013 Julian Gruber
+>
+> 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.
+
+---------------------------------------
+
+## braces
+License: MIT
+By: Jon Schlinkert, Brian Woodward, Elan Shanker, Eugene Sharygin, hemanth.hm
+Repository: micromatch/braces
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2014-2018, Jon Schlinkert.
+>
+> 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.
+
+---------------------------------------
+
+## cac
+License: MIT
+By: egoist
+Repository: egoist/cac
+
+> The MIT License (MIT)
+>
+> Copyright (c) EGOIST <0x142857@gmail.com> (https://github.com/egoist)
+>
+> 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.
+
+---------------------------------------
+
+## chokidar
+License: MIT
+By: Paul Miller, Elan Shanker
+Repository: git+https://github.com/paulmillr/chokidar.git
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2012-2019 Paul Miller (https://paulmillr.com), Elan Shanker
+>
+> 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.
+
+---------------------------------------
+
+## commondir
+License: MIT
+By: James Halliday
+Repository: http://github.com/substack/node-commondir.git
+
+> The MIT License
+>
+> Copyright (c) 2013 James Halliday (mail@substack.net)
+>
+> 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.
+
+---------------------------------------
+
+## connect
+License: MIT
+By: TJ Holowaychuk, Douglas Christopher Wilson, Jonathan Ong, Tim Caswell
+Repository: senchalabs/connect
+
+> (The MIT License)
+>
+> Copyright (c) 2010 Sencha Inc.
+> Copyright (c) 2011 LearnBoost
+> Copyright (c) 2011-2014 TJ Holowaychuk
+> Copyright (c) 2015 Douglas Christopher Wilson
+>
+> Permission is hereby granted, free of charge, to any person obtaining
+> a copy of this software and associated documentation files (the
+> 'Software'), to deal in the Software without restriction, including
+> without limitation the rights to use, copy, modify, merge, publish,
+> distribute, sublicense, and/or sell copies of the Software, and to
+> permit persons to whom the Software is furnished to do so, subject to
+> the following conditions:
+>
+> The above copyright notice and this permission notice shall be
+> included in all copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+---------------------------------------
+
+## connect-history-api-fallback
+License: MIT
+By: Ben Ripkens, Craig Myles
+Repository: http://github.com/bripkens/connect-history-api-fallback.git
+
+> The MIT License
+>
+> Copyright (c) 2022 Ben Blackmore and 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.
+
+---------------------------------------
+
+## convert-source-map
+License: MIT
+By: Thorsten Lorenz
+Repository: git://github.com/thlorenz/convert-source-map.git
+
+> Copyright 2013 Thorsten Lorenz.
+> 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.
+
+---------------------------------------
+
+## cors
+License: MIT
+By: Troy Goode
+Repository: expressjs/cors
+
+> (The MIT License)
+>
+> Copyright (c) 2013 Troy Goode
+>
+> 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.
+
+---------------------------------------
+
+## cross-spawn
+License: MIT
+By: André Cruz
+Repository: git@github.com:moxystudio/node-cross-spawn.git
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2018 Made With MOXY Lda
+>
+> 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.
+
+---------------------------------------
+
+## cssesc
+License: MIT
+By: Mathias Bynens
+Repository: https://github.com/mathiasbynens/cssesc.git
+
+> Copyright Mathias Bynens
+>
+> 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.
+
+---------------------------------------
+
+## debug
+License: MIT
+By: Josh Junon, TJ Holowaychuk, Nathan Rajlich, Andrew Rhyne
+Repository: git://github.com/debug-js/debug.git
+
+> (The MIT License)
+>
+> Copyright (c) 2014-2017 TJ Holowaychuk
+> Copyright (c) 2018-2021 Josh Junon
+>
+> 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.
+
+---------------------------------------
+
+## define-lazy-prop
+License: MIT
+By: Sindre Sorhus
+Repository: sindresorhus/define-lazy-prop
+
+> MIT License
+>
+> Copyright (c) Sindre Sorhus (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.
+
+---------------------------------------
+
+## dotenv
+License: BSD-2-Clause
+Repository: git://github.com/motdotla/dotenv.git
+
+> Copyright (c) 2015, Scott Motte
+> All rights reserved.
+>
+> Redistribution and use in source and binary forms, with or without
+> modification, are permitted provided that the following conditions are met:
+>
+> * Redistributions of source code must retain the above copyright notice, this
+> list of conditions and the following disclaimer.
+>
+> * Redistributions in binary form must reproduce the above copyright notice,
+> this list of conditions and the following disclaimer in the documentation
+> and/or other materials provided with the distribution.
+>
+> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+> AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+> IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+> DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+> FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+> DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+> SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+> OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+> OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+---------------------------------------
+
+## dotenv-expand
+License: BSD-2-Clause
+By: motdotla
+Repository: https://github.com/motdotla/dotenv-expand
+
+> Copyright (c) 2016, Scott Motte
+> All rights reserved.
+>
+> Redistribution and use in source and binary forms, with or without
+> modification, are permitted provided that the following conditions are met:
+>
+> * Redistributions of source code must retain the above copyright notice, this
+> list of conditions and the following disclaimer.
+>
+> * Redistributions in binary form must reproduce the above copyright notice,
+> this list of conditions and the following disclaimer in the documentation
+> and/or other materials provided with the distribution.
+>
+> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+> AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+> IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+> DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+> FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+> DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+> SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+> OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+> OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+---------------------------------------
+
+## ee-first
+License: MIT
+By: Jonathan Ong, Douglas Christopher Wilson
+Repository: jonathanong/ee-first
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2014 Jonathan Ong me@jongleberry.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.
+
+---------------------------------------
+
+## encodeurl
+License: MIT
+By: Douglas Christopher Wilson
+Repository: pillarjs/encodeurl
+
+> (The MIT License)
+>
+> Copyright (c) 2016 Douglas Christopher Wilson
+>
+> Permission is hereby granted, free of charge, to any person obtaining
+> a copy of this software and associated documentation files (the
+> 'Software'), to deal in the Software without restriction, including
+> without limitation the rights to use, copy, modify, merge, publish,
+> distribute, sublicense, and/or sell copies of the Software, and to
+> permit persons to whom the Software is furnished to do so, subject to
+> the following conditions:
+>
+> The above copyright notice and this permission notice shall be
+> included in all copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+---------------------------------------
+
+## entities
+License: BSD-2-Clause
+By: Felix Boehm
+Repository: git://github.com/fb55/entities.git
+
+> Copyright (c) Felix Böhm
+> All rights reserved.
+>
+> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+>
+> Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+>
+> Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+>
+> THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
+> EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+---------------------------------------
+
+## es-module-lexer
+License: MIT
+By: Guy Bedford
+Repository: git+https://github.com/guybedford/es-module-lexer.git
+
+> MIT License
+> -----------
+>
+> Copyright (C) 2018-2022 Guy Bedford
+>
+> 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.
+
+---------------------------------------
+
+## escape-html
+License: MIT
+Repository: component/escape-html
+
+> (The MIT License)
+>
+> Copyright (c) 2012-2013 TJ Holowaychuk
+> Copyright (c) 2015 Andreas Lubbe
+> Copyright (c) 2015 Tiancheng "Timothy" Gu
+>
+> 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.
+
+---------------------------------------
+
+## estree-walker
+License: MIT
+By: Rich Harris
+Repository: https://github.com/Rich-Harris/estree-walker
+
+> Copyright (c) 2015-20 [these people](https://github.com/Rich-Harris/estree-walker/graphs/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.
+
+---------------------------------------
+
+## etag
+License: MIT
+By: Douglas Christopher Wilson, David Björklund
+Repository: jshttp/etag
+
+> (The MIT License)
+>
+> Copyright (c) 2014-2016 Douglas Christopher Wilson
+>
+> Permission is hereby granted, free of charge, to any person obtaining
+> a copy of this software and associated documentation files (the
+> 'Software'), to deal in the Software without restriction, including
+> without limitation the rights to use, copy, modify, merge, publish,
+> distribute, sublicense, and/or sell copies of the Software, and to
+> permit persons to whom the Software is furnished to do so, subject to
+> the following conditions:
+>
+> The above copyright notice and this permission notice shall be
+> included in all copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+---------------------------------------
+
+## eventemitter3
+License: MIT
+By: Arnout Kazemier
+Repository: git://github.com/primus/eventemitter3.git
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2014 Arnout Kazemier
+>
+> 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.
+
+---------------------------------------
+
+## fast-glob
+License: MIT
+By: Denis Malinochkin
+Repository: mrmlnc/fast-glob
+
+> The MIT License (MIT)
+>
+> Copyright (c) Denis Malinochkin
+>
+> 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.
+
+---------------------------------------
+
+## fastq
+License: ISC
+By: Matteo Collina
+Repository: git+https://github.com/mcollina/fastq.git
+
+> Copyright (c) 2015-2020, Matteo Collina
+>
+> 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.
+
+---------------------------------------
+
+## fill-range
+License: MIT
+By: Jon Schlinkert, Edo Rivai, Paul Miller, Rouven Weßling
+Repository: jonschlinkert/fill-range
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2014-present, Jon Schlinkert.
+>
+> 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.
+
+---------------------------------------
+
+## finalhandler
+License: MIT
+By: Douglas Christopher Wilson
+Repository: pillarjs/finalhandler
+
+> (The MIT License)
+>
+> Copyright (c) 2014-2017 Douglas Christopher Wilson
+>
+> Permission is hereby granted, free of charge, to any person obtaining
+> a copy of this software and associated documentation files (the
+> 'Software'), to deal in the Software without restriction, including
+> without limitation the rights to use, copy, modify, merge, publish,
+> distribute, sublicense, and/or sell copies of the Software, and to
+> permit persons to whom the Software is furnished to do so, subject to
+> the following conditions:
+>
+> The above copyright notice and this permission notice shall be
+> included in all copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+---------------------------------------
+
+## follow-redirects
+License: MIT
+By: Ruben Verborgh, Olivier Lalonde, James Talmage
+Repository: git@github.com:follow-redirects/follow-redirects.git
+
+> Copyright 2014–present Olivier Lalonde , James Talmage , Ruben Verborgh
+>
+> 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.
+
+---------------------------------------
+
+## fs.realpath
+License: ISC
+By: Isaac Z. Schlueter
+Repository: git+https://github.com/isaacs/fs.realpath.git
+
+> The ISC License
+>
+> Copyright (c) Isaac Z. Schlueter and Contributors
+>
+> Permission to use, copy, modify, and/or distribute this software for any
+> purpose with or without fee is hereby granted, provided that the above
+> copyright notice and this permission notice appear in all copies.
+>
+> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+>
+> ----
+>
+> This library bundles a version of the `fs.realpath` and `fs.realpathSync`
+> methods from Node.js v0.10 under the terms of the Node.js MIT license.
+>
+> Node's license follows, also included at the header of `old.js` which contains
+> the licensed code:
+>
+> 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.
+
+---------------------------------------
+
+## generic-names
+License: MIT
+By: Alexey Litvinov
+Repository: git+https://github.com/css-modules/generic-names.git
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2015 Alexey Litvinov
+>
+> 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.
+
+---------------------------------------
+
+## glob
+License: ISC
+By: Isaac Z. Schlueter
+Repository: git://github.com/isaacs/node-glob.git
+
+> The ISC License
+>
+> Copyright (c) 2009-2022 Isaac Z. Schlueter and Contributors
+>
+> Permission to use, copy, modify, and/or distribute this software for any
+> purpose with or without fee is hereby granted, provided that the above
+> copyright notice and this permission notice appear in all copies.
+>
+> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+---------------------------------------
+
+## glob-parent
+License: ISC
+By: Gulp Team, Elan Shanker, Blaine Bublitz
+Repository: gulpjs/glob-parent
+
+> The ISC License
+>
+> Copyright (c) 2015, 2019 Elan Shanker
+>
+> 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.
+
+---------------------------------------
+
+## http-proxy
+License: MIT
+By: Charlie Robbins, jcrugzz
+Repository: https://github.com/http-party/node-http-proxy.git
+
+> node-http-proxy
+>
+> Copyright (c) 2010-2016 Charlie Robbins, Jarrett Cruger & the 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.
+
+---------------------------------------
+
+## icss-utils
+License: ISC
+By: Glen Maddern
+Repository: git+https://github.com/css-modules/icss-utils.git
+
+> ISC License (ISC)
+> Copyright 2018 Glen Maddern
+>
+> 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.
+
+---------------------------------------
+
+## inflight
+License: ISC
+By: Isaac Z. Schlueter
+Repository: https://github.com/npm/inflight.git
+
+> The ISC License
+>
+> Copyright (c) Isaac Z. Schlueter
+>
+> 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.
+
+---------------------------------------
+
+## inherits
+License: ISC
+Repository: git://github.com/isaacs/inherits
+
+> The ISC License
+>
+> Copyright (c) Isaac Z. Schlueter
+>
+> 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.
+
+---------------------------------------
+
+## is-binary-path
+License: MIT
+By: Sindre Sorhus
+Repository: sindresorhus/is-binary-path
+
+> MIT License
+>
+> Copyright (c) 2019 Sindre Sorhus (https://sindresorhus.com), Paul Miller (https://paulmillr.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.
+
+---------------------------------------
+
+## is-docker
+License: MIT
+By: Sindre Sorhus
+Repository: sindresorhus/is-docker
+
+> 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.
+
+---------------------------------------
+
+## is-extglob
+License: MIT
+By: Jon Schlinkert
+Repository: jonschlinkert/is-extglob
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2014-2016, Jon Schlinkert
+>
+> 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.
+
+---------------------------------------
+
+## is-glob
+License: MIT
+By: Jon Schlinkert, Brian Woodward, Daniel Perez
+Repository: micromatch/is-glob
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2014-2017, Jon Schlinkert.
+>
+> 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.
+
+---------------------------------------
+
+## is-number
+License: MIT
+By: Jon Schlinkert, Olsten Larck, Rouven Weßling
+Repository: jonschlinkert/is-number
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2014-present, Jon Schlinkert.
+>
+> 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.
+
+---------------------------------------
+
+## is-reference
+License: MIT
+By: Rich Harris
+Repository: git+https://github.com/Rich-Harris/is-reference.git
+
+---------------------------------------
+
+## is-wsl
+License: MIT
+By: Sindre Sorhus
+Repository: sindresorhus/is-wsl
+
+> MIT License
+>
+> Copyright (c) Sindre Sorhus (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.
+
+---------------------------------------
+
+## isexe
+License: ISC
+By: Isaac Z. Schlueter
+Repository: git+https://github.com/isaacs/isexe.git
+
+> The ISC License
+>
+> Copyright (c) Isaac Z. Schlueter and Contributors
+>
+> Permission to use, copy, modify, and/or distribute this software for any
+> purpose with or without fee is hereby granted, provided that the above
+> copyright notice and this permission notice appear in all copies.
+>
+> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+---------------------------------------
+
+## json-stable-stringify
+License: MIT
+By: James Halliday
+Repository: git://github.com/ljharb/json-stable-stringify.git
+
+> This software is released under the MIT license:
+>
+> 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.
+
+---------------------------------------
+
+## launch-editor
+License: MIT
+By: Evan You
+Repository: git+https://github.com/yyx990803/launch-editor.git
+
+---------------------------------------
+
+## launch-editor-middleware
+License: MIT
+By: Evan You
+Repository: git+https://github.com/yyx990803/launch-editor.git
+
+---------------------------------------
+
+## lilconfig
+License: MIT
+By: antonk52
+Repository: https://github.com/antonk52/lilconfig
+
+---------------------------------------
+
+## loader-utils
+License: MIT
+By: Tobias Koppers @sokra
+Repository: https://github.com/webpack/loader-utils.git
+
+> Copyright JS Foundation and other 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.
+
+---------------------------------------
+
+## lodash.camelcase
+License: MIT
+By: John-David Dalton, Blaine Bublitz, Mathias Bynens
+Repository: lodash/lodash
+
+> Copyright jQuery Foundation and other contributors
+>
+> Based on Underscore.js, copyright Jeremy Ashkenas,
+> DocumentCloud and Investigative Reporters & Editors
+>
+> This software consists of voluntary contributions made by many
+> individuals. For exact contribution history, see the revision history
+> available at https://github.com/lodash/lodash
+>
+> The following license applies to all parts of this software except as
+> documented below:
+>
+> ====
+>
+> 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.
+>
+> ====
+>
+> Copyright and related rights for sample code are waived via CC0. Sample
+> code is defined as all source code displayed within the prose of the
+> documentation.
+>
+> CC0: http://creativecommons.org/publicdomain/zero/1.0/
+>
+> ====
+>
+> Files located in the node_modules and vendor directories are externally
+> maintained libraries used by this software which have their own
+> licenses; we recommend you read them, as their terms may differ from the
+> terms above.
+
+---------------------------------------
+
+## magic-string
+License: MIT
+By: Rich Harris
+Repository: https://github.com/rich-harris/magic-string
+
+> Copyright 2018 Rich Harris
+>
+> 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.
+
+---------------------------------------
+
+## merge2
+License: MIT
+Repository: git@github.com:teambition/merge2.git
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2014-2020 Teambition
+>
+> 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.
+
+---------------------------------------
+
+## micromatch
+License: MIT
+By: Jon Schlinkert, Amila Welihinda, Bogdan Chadkin, Brian Woodward, Devon Govett, Elan Shanker, Fabrício Matté, Martin Kolárik, Olsten Larck, Paul Miller, Tom Byrer, Tyler Akins, Peter Bright, Kuba Juszczyk
+Repository: micromatch/micromatch
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2014-present, Jon Schlinkert.
+>
+> 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.
+
+---------------------------------------
+
+## minimatch
+License: ISC
+By: Isaac Z. Schlueter
+Repository: git://github.com/isaacs/minimatch.git
+
+> The ISC License
+>
+> Copyright (c) 2011-2022 Isaac Z. Schlueter and Contributors
+>
+> Permission to use, copy, modify, and/or distribute this software for any
+> purpose with or without fee is hereby granted, provided that the above
+> copyright notice and this permission notice appear in all copies.
+>
+> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+---------------------------------------
+
+## mlly
+License: MIT
+Repository: unjs/mlly
+
+> MIT License
+>
+> Copyright (c) Pooya Parsa
+>
+> Permission is hereby granted, free of charge, to any person obtaining a copy
+> of this software and associated documentation files (the "Software"), to deal
+> in the Software without restriction, including without limitation the rights
+> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+> copies of the Software, and to permit persons to whom the Software is
+> furnished to do so, subject to the following conditions:
+>
+> The above copyright notice and this permission notice shall be included in all
+> copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+> SOFTWARE.
+
+---------------------------------------
+
+## mrmime
+License: MIT
+By: Luke Edwards
+Repository: lukeed/mrmime
+
+> The MIT License (MIT)
+>
+> Copyright (c) Luke Edwards (https://lukeed.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.
+
+---------------------------------------
+
+## ms
+License: MIT
+Repository: zeit/ms
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2016 Zeit, Inc.
+>
+> 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.
+
+---------------------------------------
+
+## normalize-path
+License: MIT
+By: Jon Schlinkert, Blaine Bublitz
+Repository: jonschlinkert/normalize-path
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2014-2018, Jon Schlinkert.
+>
+> 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.
+
+---------------------------------------
+
+## object-assign
+License: MIT
+By: Sindre Sorhus
+Repository: sindresorhus/object-assign
+
+> The MIT License (MIT)
+>
+> Copyright (c) Sindre Sorhus (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.
+
+---------------------------------------
+
+## okie
+License: MIT
+By: Evan You
+Repository: git+https://github.com/yyx990803/okie.git
+
+> MIT License
+>
+> Copyright (c) 2020-present, Yuxi (Evan) You
+>
+> 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.
+
+---------------------------------------
+
+## on-finished
+License: MIT
+By: Douglas Christopher Wilson, Jonathan Ong
+Repository: jshttp/on-finished
+
+> (The MIT License)
+>
+> Copyright (c) 2013 Jonathan Ong
+> Copyright (c) 2014 Douglas Christopher Wilson
+>
+> Permission is hereby granted, free of charge, to any person obtaining
+> a copy of this software and associated documentation files (the
+> 'Software'), to deal in the Software without restriction, including
+> without limitation the rights to use, copy, modify, merge, publish,
+> distribute, sublicense, and/or sell copies of the Software, and to
+> permit persons to whom the Software is furnished to do so, subject to
+> the following conditions:
+>
+> The above copyright notice and this permission notice shall be
+> included in all copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+---------------------------------------
+
+## once
+License: ISC
+By: Isaac Z. Schlueter
+Repository: git://github.com/isaacs/once
+
+> The ISC License
+>
+> Copyright (c) Isaac Z. Schlueter and Contributors
+>
+> Permission to use, copy, modify, and/or distribute this software for any
+> purpose with or without fee is hereby granted, provided that the above
+> copyright notice and this permission notice appear in all copies.
+>
+> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+---------------------------------------
+
+## open
+License: MIT
+By: Sindre Sorhus
+Repository: sindresorhus/open
+
+> 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.
+
+---------------------------------------
+
+## parse5
+License: MIT
+By: Ivan Nikulin, https://github.com/inikulin/parse5/graphs/contributors
+Repository: git://github.com/inikulin/parse5.git
+
+> Copyright (c) 2013-2019 Ivan Nikulin (ifaaan@gmail.com, https://github.com/inikulin)
+>
+> 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.
+
+---------------------------------------
+
+## parseurl
+License: MIT
+By: Douglas Christopher Wilson, Jonathan Ong
+Repository: pillarjs/parseurl
+
+> (The MIT License)
+>
+> Copyright (c) 2014 Jonathan Ong
+> Copyright (c) 2014-2017 Douglas Christopher Wilson
+>
+> Permission is hereby granted, free of charge, to any person obtaining
+> a copy of this software and associated documentation files (the
+> 'Software'), to deal in the Software without restriction, including
+> without limitation the rights to use, copy, modify, merge, publish,
+> distribute, sublicense, and/or sell copies of the Software, and to
+> permit persons to whom the Software is furnished to do so, subject to
+> the following conditions:
+>
+> The above copyright notice and this permission notice shall be
+> included in all copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+---------------------------------------
+
+## path-key
+License: MIT
+By: Sindre Sorhus
+Repository: sindresorhus/path-key
+
+> MIT License
+>
+> Copyright (c) Sindre Sorhus (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.
+
+---------------------------------------
+
+## periscopic
+License: MIT
+Repository: Rich-Harris/periscopic
+
+> Copyright (c) 2019 Rich Harris
+>
+> 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.
+
+---------------------------------------
+
+## picocolors
+License: ISC
+By: Alexey Raspopov
+Repository: alexeyraspopov/picocolors
+
+> ISC License
+>
+> Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov
+>
+> 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.
+
+---------------------------------------
+
+## picomatch
+License: MIT
+By: Jon Schlinkert
+Repository: micromatch/picomatch
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2017-present, Jon Schlinkert.
+>
+> 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.
+
+---------------------------------------
+
+## pify
+License: MIT
+By: Sindre Sorhus
+Repository: sindresorhus/pify
+
+> The MIT License (MIT)
+>
+> Copyright (c) Sindre Sorhus (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.
+
+---------------------------------------
+
+## postcss-import
+License: MIT
+By: Maxime Thirouin
+Repository: https://github.com/postcss/postcss-import.git
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2014 Maxime Thirouin, Jason Campbell & Kevin Mårtensson
+>
+> 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.
+
+---------------------------------------
+
+## postcss-load-config
+License: MIT
+By: Michael Ciniawky, Ryan Dunckel, Mateusz Derks, Dalton Santos, Patrick Gilday, François Wouts
+Repository: postcss/postcss-load-config
+
+> The MIT License (MIT)
+>
+> Copyright Michael Ciniawsky
+>
+> 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.
+
+---------------------------------------
+
+## postcss-modules
+License: MIT
+By: Alexander Madyankin
+Repository: https://github.com/css-modules/postcss-modules.git
+
+> The MIT License (MIT)
+>
+> Copyright 2015-present Alexander Madyankin
+>
+> 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.
+
+---------------------------------------
+
+## postcss-modules-extract-imports
+License: ISC
+By: Glen Maddern
+Repository: https://github.com/css-modules/postcss-modules-extract-imports.git
+
+> Copyright 2015 Glen Maddern
+>
+> 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.
+
+---------------------------------------
+
+## postcss-modules-local-by-default
+License: MIT
+By: Mark Dalgleish
+Repository: https://github.com/css-modules/postcss-modules-local-by-default.git
+
+> The MIT License (MIT)
+>
+> Copyright 2015 Mark Dalgleish
+>
+> 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.
+
+---------------------------------------
+
+## postcss-modules-scope
+License: ISC
+By: Glen Maddern
+Repository: https://github.com/css-modules/postcss-modules-scope.git
+
+> ISC License (ISC)
+>
+> Copyright (c) 2015, Glen Maddern
+>
+> 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.
+
+---------------------------------------
+
+## postcss-modules-values
+License: ISC
+By: Glen Maddern
+Repository: git+https://github.com/css-modules/postcss-modules-values.git
+
+> ISC License (ISC)
+>
+> Copyright (c) 2015, Glen Maddern
+>
+> 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.
+
+---------------------------------------
+
+## postcss-selector-parser
+License: MIT
+By: Ben Briggs, Chris Eppstein
+Repository: postcss/postcss-selector-parser
+
+> Copyright (c) Ben Briggs (http://beneb.info)
+>
+> 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.
+
+---------------------------------------
+
+## postcss-value-parser
+License: MIT
+By: Bogdan Chadkin
+Repository: https://github.com/TrySound/postcss-value-parser.git
+
+> Copyright (c) Bogdan Chadkin
+>
+> 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.
+
+---------------------------------------
+
+## queue-microtask
+License: MIT
+By: Feross Aboukhadijeh
+Repository: git://github.com/feross/queue-microtask.git
+
+> The MIT License (MIT)
+>
+> Copyright (c) Feross Aboukhadijeh
+>
+> Permission is hereby granted, free of charge, to any person obtaining a copy of
+> this software and associated documentation files (the "Software"), to deal in
+> the Software without restriction, including without limitation the rights to
+> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+> the Software, and to permit persons to whom the Software is furnished to do so,
+> subject to the following conditions:
+>
+> The above copyright notice and this permission notice shall be included in all
+> copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+> FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+> COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+> IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+> CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+---------------------------------------
+
+## read-cache
+License: MIT
+By: Bogdan Chadkin
+Repository: git+https://github.com/TrySound/read-cache.git
+
+> The MIT License (MIT)
+>
+> Copyright 2016 Bogdan Chadkin
+>
+> 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.
+
+---------------------------------------
+
+## readdirp
+License: MIT
+By: Thorsten Lorenz, Paul Miller
+Repository: git://github.com/paulmillr/readdirp.git
+
+> MIT License
+>
+> Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller (https://paulmillr.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.
+
+---------------------------------------
+
+## requires-port
+License: MIT
+By: Arnout Kazemier
+Repository: https://github.com/unshiftio/requires-port
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2015 Unshift.io, Arnout Kazemier, the 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.
+
+---------------------------------------
+
+## resolve.exports
+License: MIT
+By: Luke Edwards
+Repository: lukeed/resolve.exports
+
+> The MIT License (MIT)
+>
+> Copyright (c) Luke Edwards (lukeed.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.
+
+---------------------------------------
+
+## reusify
+License: MIT
+By: Matteo Collina
+Repository: git+https://github.com/mcollina/reusify.git
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2015 Matteo Collina
+>
+> 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.
+
+---------------------------------------
+
+## run-parallel
+License: MIT
+By: Feross Aboukhadijeh
+Repository: git://github.com/feross/run-parallel.git
+
+> The MIT License (MIT)
+>
+> Copyright (c) Feross Aboukhadijeh
+>
+> Permission is hereby granted, free of charge, to any person obtaining a copy of
+> this software and associated documentation files (the "Software"), to deal in
+> the Software without restriction, including without limitation the rights to
+> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+> the Software, and to permit persons to whom the Software is furnished to do so,
+> subject to the following conditions:
+>
+> The above copyright notice and this permission notice shall be included in all
+> copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+> FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+> COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+> IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+> CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+---------------------------------------
+
+## shebang-command
+License: MIT
+By: Kevin Mårtensson
+Repository: kevva/shebang-command
+
+> MIT License
+>
+> Copyright (c) Kevin Mårtensson (github.com/kevva)
+>
+> 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.
+
+---------------------------------------
+
+## shebang-regex
+License: MIT
+By: Sindre Sorhus
+Repository: sindresorhus/shebang-regex
+
+> MIT License
+>
+> Copyright (c) Sindre Sorhus (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.
+
+---------------------------------------
+
+## shell-quote
+License: MIT
+By: James Halliday
+Repository: http://github.com/substack/node-shell-quote.git
+
+> The MIT License
+>
+> Copyright (c) 2013 James Halliday (mail@substack.net)
+>
+> 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.
+
+---------------------------------------
+
+## sirv
+License: MIT
+By: Luke Edwards
+Repository: lukeed/sirv
+
+---------------------------------------
+
+## statuses
+License: MIT
+By: Douglas Christopher Wilson, Jonathan Ong
+Repository: jshttp/statuses
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2014 Jonathan Ong
+> Copyright (c) 2016 Douglas Christopher Wilson
+>
+> Permission is hereby granted, free of charge, to any person obtaining a copy
+> of this software and associated documentation files (the "Software"), to deal
+> in the Software without restriction, including without limitation the rights
+> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+> copies of the Software, and to permit persons to whom the Software is
+> furnished to do so, subject to the following conditions:
+>
+> The above copyright notice and this permission notice shall be included in
+> all copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+> THE SOFTWARE.
+
+---------------------------------------
+
+## string-hash
+License: CC0-1.0
+By: The Dark Sky Company
+Repository: git://github.com/darkskyapp/string-hash.git
+
+---------------------------------------
+
+## strip-ansi
+License: MIT
+By: Sindre Sorhus
+Repository: chalk/strip-ansi
+
+> 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.
+
+---------------------------------------
+
+## strip-literal
+License: MIT
+By: Anthony Fu
+Repository: git+https://github.com/antfu/strip-literal.git
+
+> MIT License
+>
+> Copyright (c) 2022 Anthony Fu
+>
+> 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.
+
+---------------------------------------
+
+## to-regex-range
+License: MIT
+By: Jon Schlinkert, Rouven Weßling
+Repository: micromatch/to-regex-range
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2015-present, Jon Schlinkert.
+>
+> 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.
+
+---------------------------------------
+
+## totalist
+License: MIT
+By: Luke Edwards
+Repository: lukeed/totalist
+
+> The MIT License (MIT)
+>
+> Copyright (c) Luke Edwards (lukeed.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.
+
+---------------------------------------
+
+## tsconfck
+License: MIT
+By: dominikg
+Repository: git+https://github.com/dominikg/tsconfck.git
+
+> MIT License
+>
+> Copyright (c) 2021-present dominikg and [contributors](https://github.com/dominikg/tsconfck/graphs/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.
+>
+> -- Licenses for 3rd-party code included in tsconfck --
+>
+> # strip-bom and strip-json-comments
+> 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.
+
+---------------------------------------
+
+## ufo
+License: MIT
+Repository: unjs/ufo
+
+> MIT License
+>
+> Copyright (c) Pooya Parsa
+>
+> Permission is hereby granted, free of charge, to any person obtaining a copy
+> of this software and associated documentation files (the "Software"), to deal
+> in the Software without restriction, including without limitation the rights
+> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+> copies of the Software, and to permit persons to whom the Software is
+> furnished to do so, subject to the following conditions:
+>
+> The above copyright notice and this permission notice shall be included in all
+> copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+> SOFTWARE.
+
+---------------------------------------
+
+## unpipe
+License: MIT
+By: Douglas Christopher Wilson
+Repository: stream-utils/unpipe
+
+> (The MIT License)
+>
+> Copyright (c) 2015 Douglas Christopher Wilson
+>
+> Permission is hereby granted, free of charge, to any person obtaining
+> a copy of this software and associated documentation files (the
+> 'Software'), to deal in the Software without restriction, including
+> without limitation the rights to use, copy, modify, merge, publish,
+> distribute, sublicense, and/or sell copies of the Software, and to
+> permit persons to whom the Software is furnished to do so, subject to
+> the following conditions:
+>
+> The above copyright notice and this permission notice shall be
+> included in all copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+---------------------------------------
+
+## util-deprecate
+License: MIT
+By: Nathan Rajlich
+Repository: git://github.com/TooTallNate/util-deprecate.git
+
+> (The MIT License)
+>
+> Copyright (c) 2014 Nathan Rajlich
+>
+> 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.
+
+---------------------------------------
+
+## utils-merge
+License: MIT
+By: Jared Hanson
+Repository: git://github.com/jaredhanson/utils-merge.git
+
+> The MIT License (MIT)
+>
+> Copyright (c) 2013-2017 Jared Hanson
+>
+> 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.
+
+---------------------------------------
+
+## vary
+License: MIT
+By: Douglas Christopher Wilson
+Repository: jshttp/vary
+
+> (The MIT License)
+>
+> Copyright (c) 2014-2017 Douglas Christopher Wilson
+>
+> Permission is hereby granted, free of charge, to any person obtaining
+> a copy of this software and associated documentation files (the
+> 'Software'), to deal in the Software without restriction, including
+> without limitation the rights to use, copy, modify, merge, publish,
+> distribute, sublicense, and/or sell copies of the Software, and to
+> permit persons to whom the Software is furnished to do so, subject to
+> the following conditions:
+>
+> The above copyright notice and this permission notice shall be
+> included in all copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+---------------------------------------
+
+## which
+License: ISC
+By: Isaac Z. Schlueter
+Repository: git://github.com/isaacs/node-which.git
+
+> The ISC License
+>
+> Copyright (c) Isaac Z. Schlueter and Contributors
+>
+> Permission to use, copy, modify, and/or distribute this software for any
+> purpose with or without fee is hereby granted, provided that the above
+> copyright notice and this permission notice appear in all copies.
+>
+> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+---------------------------------------
+
+## wrappy
+License: ISC
+By: Isaac Z. Schlueter
+Repository: https://github.com/npm/wrappy
+
+> The ISC License
+>
+> Copyright (c) Isaac Z. Schlueter and Contributors
+>
+> Permission to use, copy, modify, and/or distribute this software for any
+> purpose with or without fee is hereby granted, provided that the above
+> copyright notice and this permission notice appear in all copies.
+>
+> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+---------------------------------------
+
+## ws
+License: MIT
+By: Einar Otto Stangvik
+Repository: websockets/ws
+
+> Copyright (c) 2011 Einar Otto Stangvik
+> Copyright (c) 2013 Arnout Kazemier and contributors
+> Copyright (c) 2016 Luigi Pinca and 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.
+
+---------------------------------------
+
+## yaml
+License: ISC
+By: Eemeli Aro
+Repository: github:eemeli/yaml
+
+> Copyright Eemeli Aro
+>
+> Permission to use, copy, modify, and/or distribute this software for any purpose
+> with or without fee is hereby granted, provided that the above copyright notice
+> and this permission notice appear in all copies.
+>
+> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+> OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+> TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+> THIS SOFTWARE.
diff --git a/node_modules/vite/README.md b/node_modules/vite/README.md
new file mode 100644
index 0000000..89490d7
--- /dev/null
+++ b/node_modules/vite/README.md
@@ -0,0 +1,20 @@
+# vite ⚡
+
+> Next Generation Frontend Tooling
+
+- 💡 Instant Server Start
+- ⚡️ Lightning Fast HMR
+- 🛠️ Rich Features
+- 📦 Optimized Build
+- 🔩 Universal Plugin Interface
+- 🔑 Fully Typed APIs
+
+Vite (French word for "fast", pronounced `/vit/`) is a new breed of frontend build tool that significantly improves the frontend development experience. It consists of two major parts:
+
+- A dev server that serves your source files over [native ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules), with [rich built-in features](https://vitejs.dev/guide/features.html) and astonishingly fast [Hot Module Replacement (HMR)](https://vitejs.dev/guide/features.html#hot-module-replacement).
+
+- A [build command](https://vitejs.dev/guide/build.html) that bundles your code with [Rollup](https://rollupjs.org), pre-configured to output highly optimized static assets for production.
+
+In addition, Vite is highly extensible via its [Plugin API](https://vitejs.dev/guide/api-plugin.html) and [JavaScript API](https://vitejs.dev/guide/api-javascript.html) with full typing support.
+
+[Read the Docs to Learn More](https://vitejs.dev).
diff --git a/node_modules/vite/bin/openChrome.applescript b/node_modules/vite/bin/openChrome.applescript
new file mode 100644
index 0000000..9ce2293
--- /dev/null
+++ b/node_modules/vite/bin/openChrome.applescript
@@ -0,0 +1,95 @@
+(*
+Copyright (c) 2015-present, Facebook, Inc.
+
+This source code is licensed under the MIT license found in the
+LICENSE file at
+https://github.com/facebookincubator/create-react-app/blob/master/LICENSE
+*)
+
+property targetTab: null
+property targetTabIndex: -1
+property targetWindow: null
+property theProgram: "Google Chrome"
+
+on run argv
+ set theURL to item 1 of argv
+
+ -- Allow requested program to be optional,
+ -- default to Google Chrome
+ if (count of argv) > 1 then
+ set theProgram to item 2 of argv
+ end if
+
+ using terms from application "Google Chrome"
+ tell application theProgram
+
+ if (count every window) = 0 then
+ make new window
+ end if
+
+ -- 1: Looking for tab running debugger
+ -- then, Reload debugging tab if found
+ -- then return
+ set found to my lookupTabWithUrl(theURL)
+ if found then
+ set targetWindow's active tab index to targetTabIndex
+ tell targetTab to reload
+ tell targetWindow to activate
+ set index of targetWindow to 1
+ return
+ end if
+
+ -- 2: Looking for Empty tab
+ -- In case debugging tab was not found
+ -- We try to find an empty tab instead
+ set found to my lookupTabWithUrl("chrome://newtab/")
+ if found then
+ set targetWindow's active tab index to targetTabIndex
+ set URL of targetTab to theURL
+ tell targetWindow to activate
+ return
+ end if
+
+ -- 3: Create new tab
+ -- both debugging and empty tab were not found
+ -- make a new tab with url
+ tell window 1
+ activate
+ make new tab with properties {URL:theURL}
+ end tell
+ end tell
+ end using terms from
+end run
+
+-- Function:
+-- Lookup tab with given url
+-- if found, store tab, index, and window in properties
+-- (properties were declared on top of file)
+on lookupTabWithUrl(lookupUrl)
+ using terms from application "Google Chrome"
+ tell application theProgram
+ -- Find a tab with the given url
+ set found to false
+ set theTabIndex to -1
+ repeat with theWindow in every window
+ set theTabIndex to 0
+ repeat with theTab in every tab of theWindow
+ set theTabIndex to theTabIndex + 1
+ if (theTab's URL as string) contains lookupUrl then
+ -- assign tab, tab index, and window to properties
+ set targetTab to theTab
+ set targetTabIndex to theTabIndex
+ set targetWindow to theWindow
+ set found to true
+ exit repeat
+ end if
+ end repeat
+
+ if found then
+ exit repeat
+ end if
+ end repeat
+ end tell
+ end using terms from
+ return found
+end lookupTabWithUrl
diff --git a/node_modules/vite/bin/vite.js b/node_modules/vite/bin/vite.js
new file mode 100755
index 0000000..a9bbb9c
--- /dev/null
+++ b/node_modules/vite/bin/vite.js
@@ -0,0 +1,61 @@
+#!/usr/bin/env node
+import { performance } from 'node:perf_hooks'
+
+if (!import.meta.url.includes('node_modules')) {
+ try {
+ // only available as dev dependency
+ await import('source-map-support').then((r) => r.default.install())
+ } catch (e) {}
+}
+
+global.__vite_start_time = performance.now()
+
+// check debug mode first before requiring the CLI.
+const debugIndex = process.argv.findIndex((arg) => /^(?:-d|--debug)$/.test(arg))
+const filterIndex = process.argv.findIndex((arg) =>
+ /^(?:-f|--filter)$/.test(arg),
+)
+const profileIndex = process.argv.indexOf('--profile')
+
+if (debugIndex > 0) {
+ let value = process.argv[debugIndex + 1]
+ if (!value || value.startsWith('-')) {
+ value = 'vite:*'
+ } else {
+ // support debugging multiple flags with comma-separated list
+ value = value
+ .split(',')
+ .map((v) => `vite:${v}`)
+ .join(',')
+ }
+ process.env.DEBUG = `${
+ process.env.DEBUG ? process.env.DEBUG + ',' : ''
+ }${value}`
+
+ if (filterIndex > 0) {
+ const filter = process.argv[filterIndex + 1]
+ if (filter && !filter.startsWith('-')) {
+ process.env.VITE_DEBUG_FILTER = filter
+ }
+ }
+}
+
+function start() {
+ return import('../dist/node/cli.js')
+}
+
+if (profileIndex > 0) {
+ process.argv.splice(profileIndex, 1)
+ const next = process.argv[profileIndex]
+ if (next && !next.startsWith('-')) {
+ process.argv.splice(profileIndex, 1)
+ }
+ const inspector = await import('node:inspector').then((r) => r.default)
+ const session = (global.__vite_profile_session = new inspector.Session())
+ session.connect()
+ session.post('Profiler.enable', () => {
+ session.post('Profiler.start', start)
+ })
+} else {
+ start()
+}
diff --git a/node_modules/vite/client.d.ts b/node_modules/vite/client.d.ts
new file mode 100644
index 0000000..b73389e
--- /dev/null
+++ b/node_modules/vite/client.d.ts
@@ -0,0 +1,281 @@
+///
+
+// CSS modules
+type CSSModuleClasses = { readonly [key: string]: string }
+
+declare module '*.module.css' {
+ const classes: CSSModuleClasses
+ export default classes
+}
+declare module '*.module.scss' {
+ const classes: CSSModuleClasses
+ export default classes
+}
+declare module '*.module.sass' {
+ const classes: CSSModuleClasses
+ export default classes
+}
+declare module '*.module.less' {
+ const classes: CSSModuleClasses
+ export default classes
+}
+declare module '*.module.styl' {
+ const classes: CSSModuleClasses
+ export default classes
+}
+declare module '*.module.stylus' {
+ const classes: CSSModuleClasses
+ export default classes
+}
+declare module '*.module.pcss' {
+ const classes: CSSModuleClasses
+ export default classes
+}
+declare module '*.module.sss' {
+ const classes: CSSModuleClasses
+ export default classes
+}
+
+// CSS
+declare module '*.css' {
+ /**
+ * @deprecated Use `import style from './style.css?inline'` instead.
+ */
+ const css: string
+ export default css
+}
+declare module '*.scss' {
+ /**
+ * @deprecated Use `import style from './style.scss?inline'` instead.
+ */
+ const css: string
+ export default css
+}
+declare module '*.sass' {
+ /**
+ * @deprecated Use `import style from './style.sass?inline'` instead.
+ */
+ const css: string
+ export default css
+}
+declare module '*.less' {
+ /**
+ * @deprecated Use `import style from './style.less?inline'` instead.
+ */
+ const css: string
+ export default css
+}
+declare module '*.styl' {
+ /**
+ * @deprecated Use `import style from './style.styl?inline'` instead.
+ */
+ const css: string
+ export default css
+}
+declare module '*.stylus' {
+ /**
+ * @deprecated Use `import style from './style.stylus?inline'` instead.
+ */
+ const css: string
+ export default css
+}
+declare module '*.pcss' {
+ /**
+ * @deprecated Use `import style from './style.pcss?inline'` instead.
+ */
+ const css: string
+ export default css
+}
+declare module '*.sss' {
+ /**
+ * @deprecated Use `import style from './style.sss?inline'` instead.
+ */
+ const css: string
+ export default css
+}
+
+// Built-in asset types
+// see `src/node/constants.ts`
+
+// images
+declare module '*.apng' {
+ const src: string
+ export default src
+}
+declare module '*.png' {
+ const src: string
+ export default src
+}
+declare module '*.jpg' {
+ const src: string
+ export default src
+}
+declare module '*.jpeg' {
+ const src: string
+ export default src
+}
+declare module '*.jfif' {
+ const src: string
+ export default src
+}
+declare module '*.pjpeg' {
+ const src: string
+ export default src
+}
+declare module '*.pjp' {
+ const src: string
+ export default src
+}
+declare module '*.gif' {
+ const src: string
+ export default src
+}
+declare module '*.svg' {
+ const src: string
+ export default src
+}
+declare module '*.ico' {
+ const src: string
+ export default src
+}
+declare module '*.webp' {
+ const src: string
+ export default src
+}
+declare module '*.avif' {
+ const src: string
+ export default src
+}
+
+// media
+declare module '*.mp4' {
+ const src: string
+ export default src
+}
+declare module '*.webm' {
+ const src: string
+ export default src
+}
+declare module '*.ogg' {
+ const src: string
+ export default src
+}
+declare module '*.mp3' {
+ const src: string
+ export default src
+}
+declare module '*.wav' {
+ const src: string
+ export default src
+}
+declare module '*.flac' {
+ const src: string
+ export default src
+}
+declare module '*.aac' {
+ const src: string
+ export default src
+}
+
+declare module '*.opus' {
+ const src: string
+ export default src
+}
+
+// fonts
+declare module '*.woff' {
+ const src: string
+ export default src
+}
+declare module '*.woff2' {
+ const src: string
+ export default src
+}
+declare module '*.eot' {
+ const src: string
+ export default src
+}
+declare module '*.ttf' {
+ const src: string
+ export default src
+}
+declare module '*.otf' {
+ const src: string
+ export default src
+}
+
+// other
+declare module '*.webmanifest' {
+ const src: string
+ export default src
+}
+declare module '*.pdf' {
+ const src: string
+ export default src
+}
+declare module '*.txt' {
+ const src: string
+ export default src
+}
+
+// wasm?init
+declare module '*.wasm?init' {
+ const initWasm: (
+ options: WebAssembly.Imports,
+ ) => Promise
+ export default initWasm
+}
+
+// web worker
+declare module '*?worker' {
+ const workerConstructor: {
+ new (): Worker
+ }
+ export default workerConstructor
+}
+
+declare module '*?worker&inline' {
+ const workerConstructor: {
+ new (): Worker
+ }
+ export default workerConstructor
+}
+
+declare module '*?worker&url' {
+ const src: string
+ export default src
+}
+
+declare module '*?sharedworker' {
+ const sharedWorkerConstructor: {
+ new (): SharedWorker
+ }
+ export default sharedWorkerConstructor
+}
+
+declare module '*?sharedworker&inline' {
+ const sharedWorkerConstructor: {
+ new (): SharedWorker
+ }
+ export default sharedWorkerConstructor
+}
+
+declare module '*?sharedworker&url' {
+ const src: string
+ export default src
+}
+
+declare module '*?raw' {
+ const src: string
+ export default src
+}
+
+declare module '*?url' {
+ const src: string
+ export default src
+}
+
+declare module '*?inline' {
+ const src: string
+ export default src
+}
diff --git a/node_modules/vite/dist/client/client.mjs b/node_modules/vite/dist/client/client.mjs
new file mode 100644
index 0000000..37c32b4
--- /dev/null
+++ b/node_modules/vite/dist/client/client.mjs
@@ -0,0 +1,724 @@
+import '@vite/env';
+
+const base$1 = __BASE__ || '/';
+// set :host styles to make playwright detect the element as visible
+const template = /*html*/ `
+
+
+
+
+
+
+
+
+ Click outside, press Esc key, or fix the code to dismiss.
+ You can also disable this overlay by setting
+ server.hmr.overlay to false in vite.config.js.
+
+
+
+`;
+const fileRE = /(?:[a-zA-Z]:\\|\/).*?:\d+:\d+/g;
+const codeframeRE = /^(?:>?\s+\d+\s+\|.*|\s+\|\s*\^.*)\r?\n/gm;
+// Allow `ErrorOverlay` to extend `HTMLElement` even in environments where
+// `HTMLElement` was not originally defined.
+const { HTMLElement = class {
+} } = globalThis;
+class ErrorOverlay extends HTMLElement {
+ constructor(err, links = true) {
+ var _a;
+ super();
+ this.root = this.attachShadow({ mode: 'open' });
+ this.root.innerHTML = template;
+ codeframeRE.lastIndex = 0;
+ const hasFrame = err.frame && codeframeRE.test(err.frame);
+ const message = hasFrame
+ ? err.message.replace(codeframeRE, '')
+ : err.message;
+ if (err.plugin) {
+ this.text('.plugin', `[plugin:${err.plugin}] `);
+ }
+ this.text('.message-body', message.trim());
+ const [file] = (((_a = err.loc) === null || _a === void 0 ? void 0 : _a.file) || err.id || 'unknown file').split(`?`);
+ if (err.loc) {
+ this.text('.file', `${file}:${err.loc.line}:${err.loc.column}`, links);
+ }
+ else if (err.id) {
+ this.text('.file', file);
+ }
+ if (hasFrame) {
+ this.text('.frame', err.frame.trim());
+ }
+ this.text('.stack', err.stack, links);
+ this.root.querySelector('.window').addEventListener('click', (e) => {
+ e.stopPropagation();
+ });
+ this.addEventListener('click', () => {
+ this.close();
+ });
+ this.closeOnEsc = (e) => {
+ if (e.key === 'Escape' || e.code === 'Escape') {
+ this.close();
+ }
+ };
+ document.addEventListener('keydown', this.closeOnEsc);
+ }
+ text(selector, text, linkFiles = false) {
+ const el = this.root.querySelector(selector);
+ if (!linkFiles) {
+ el.textContent = text;
+ }
+ else {
+ let curIndex = 0;
+ let match;
+ fileRE.lastIndex = 0;
+ while ((match = fileRE.exec(text))) {
+ const { 0: file, index } = match;
+ if (index != null) {
+ const frag = text.slice(curIndex, index);
+ el.appendChild(document.createTextNode(frag));
+ const link = document.createElement('a');
+ link.textContent = file;
+ link.className = 'file-link';
+ link.onclick = () => {
+ fetch(`${base$1}__open-in-editor?file=` + encodeURIComponent(file));
+ };
+ el.appendChild(link);
+ curIndex += frag.length + file.length;
+ }
+ }
+ }
+ }
+ close() {
+ var _a;
+ (_a = this.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this);
+ document.removeEventListener('keydown', this.closeOnEsc);
+ }
+}
+const overlayId = 'vite-error-overlay';
+const { customElements } = globalThis; // Ensure `customElements` is defined before the next line.
+if (customElements && !customElements.get(overlayId)) {
+ customElements.define(overlayId, ErrorOverlay);
+}
+
+console.debug('[vite] connecting...');
+const importMetaUrl = new URL(import.meta.url);
+// use server configuration, then fallback to inference
+const serverHost = __SERVER_HOST__;
+const socketProtocol = __HMR_PROTOCOL__ || (importMetaUrl.protocol === 'https:' ? 'wss' : 'ws');
+const hmrPort = __HMR_PORT__;
+const socketHost = `${__HMR_HOSTNAME__ || importMetaUrl.hostname}:${hmrPort || importMetaUrl.port}${__HMR_BASE__}`;
+const directSocketHost = __HMR_DIRECT_TARGET__;
+const base = __BASE__ || '/';
+const messageBuffer = [];
+let socket;
+try {
+ let fallback;
+ // only use fallback when port is inferred to prevent confusion
+ if (!hmrPort) {
+ fallback = () => {
+ // fallback to connecting directly to the hmr server
+ // for servers which does not support proxying websocket
+ socket = setupWebSocket(socketProtocol, directSocketHost, () => {
+ const currentScriptHostURL = new URL(import.meta.url);
+ const currentScriptHost = currentScriptHostURL.host +
+ currentScriptHostURL.pathname.replace(/@vite\/client$/, '');
+ console.error('[vite] failed to connect to websocket.\n' +
+ 'your current setup:\n' +
+ ` (browser) ${currentScriptHost} <--[HTTP]--> ${serverHost} (server)\n` +
+ ` (browser) ${socketHost} <--[WebSocket (failing)]--> ${directSocketHost} (server)\n` +
+ 'Check out your Vite / network configuration and https://vitejs.dev/config/server-options.html#server-hmr .');
+ });
+ socket.addEventListener('open', () => {
+ console.info('[vite] Direct websocket connection fallback. Check out https://vitejs.dev/config/server-options.html#server-hmr to remove the previous connection error.');
+ }, { once: true });
+ };
+ }
+ socket = setupWebSocket(socketProtocol, socketHost, fallback);
+}
+catch (error) {
+ console.error(`[vite] failed to connect to websocket (${error}). `);
+}
+function setupWebSocket(protocol, hostAndPath, onCloseWithoutOpen) {
+ const socket = new WebSocket(`${protocol}://${hostAndPath}`, 'vite-hmr');
+ let isOpened = false;
+ socket.addEventListener('open', () => {
+ isOpened = true;
+ notifyListeners('vite:ws:connect', { webSocket: socket });
+ }, { once: true });
+ // Listen for messages
+ socket.addEventListener('message', async ({ data }) => {
+ handleMessage(JSON.parse(data));
+ });
+ // ping server
+ socket.addEventListener('close', async ({ wasClean }) => {
+ if (wasClean)
+ return;
+ if (!isOpened && onCloseWithoutOpen) {
+ onCloseWithoutOpen();
+ return;
+ }
+ notifyListeners('vite:ws:disconnect', { webSocket: socket });
+ console.log(`[vite] server connection lost. polling for restart...`);
+ await waitForSuccessfulPing(protocol, hostAndPath);
+ location.reload();
+ });
+ return socket;
+}
+function warnFailedFetch(err, path) {
+ if (!err.message.match('fetch')) {
+ console.error(err);
+ }
+ console.error(`[hmr] Failed to reload ${path}. ` +
+ `This could be due to syntax errors or importing non-existent ` +
+ `modules. (see errors above)`);
+}
+function cleanUrl(pathname) {
+ const url = new URL(pathname, location.toString());
+ url.searchParams.delete('direct');
+ return url.pathname + url.search;
+}
+let isFirstUpdate = true;
+const outdatedLinkTags = new WeakSet();
+const debounceReload = (time) => {
+ let timer;
+ return () => {
+ if (timer) {
+ clearTimeout(timer);
+ timer = null;
+ }
+ timer = setTimeout(() => {
+ location.reload();
+ }, time);
+ };
+};
+const pageReload = debounceReload(50);
+async function handleMessage(payload) {
+ switch (payload.type) {
+ case 'connected':
+ console.debug(`[vite] connected.`);
+ sendMessageBuffer();
+ // proxy(nginx, docker) hmr ws maybe caused timeout,
+ // so send ping package let ws keep alive.
+ setInterval(() => {
+ if (socket.readyState === socket.OPEN) {
+ socket.send('{"type":"ping"}');
+ }
+ }, __HMR_TIMEOUT__);
+ break;
+ case 'update':
+ notifyListeners('vite:beforeUpdate', payload);
+ // if this is the first update and there's already an error overlay, it
+ // means the page opened with existing server compile error and the whole
+ // module script failed to load (since one of the nested imports is 500).
+ // in this case a normal update won't work and a full reload is needed.
+ if (isFirstUpdate && hasErrorOverlay()) {
+ window.location.reload();
+ return;
+ }
+ else {
+ clearErrorOverlay();
+ isFirstUpdate = false;
+ }
+ await Promise.all(payload.updates.map(async (update) => {
+ if (update.type === 'js-update') {
+ return queueUpdate(fetchUpdate(update));
+ }
+ // css-update
+ // this is only sent when a css file referenced with is updated
+ const { path, timestamp } = update;
+ const searchUrl = cleanUrl(path);
+ // can't use querySelector with `[href*=]` here since the link may be
+ // using relative paths so we need to use link.href to grab the full
+ // URL for the include check.
+ const el = Array.from(document.querySelectorAll('link')).find((e) => !outdatedLinkTags.has(e) && cleanUrl(e.href).includes(searchUrl));
+ if (!el) {
+ return;
+ }
+ const newPath = `${base}${searchUrl.slice(1)}${searchUrl.includes('?') ? '&' : '?'}t=${timestamp}`;
+ // rather than swapping the href on the existing tag, we will
+ // create a new link tag. Once the new stylesheet has loaded we
+ // will remove the existing link tag. This removes a Flash Of
+ // Unstyled Content that can occur when swapping out the tag href
+ // directly, as the new stylesheet has not yet been loaded.
+ return new Promise((resolve) => {
+ const newLinkTag = el.cloneNode();
+ newLinkTag.href = new URL(newPath, el.href).href;
+ const removeOldEl = () => {
+ el.remove();
+ console.debug(`[vite] css hot updated: ${searchUrl}`);
+ resolve();
+ };
+ newLinkTag.addEventListener('load', removeOldEl);
+ newLinkTag.addEventListener('error', removeOldEl);
+ outdatedLinkTags.add(el);
+ el.after(newLinkTag);
+ });
+ }));
+ notifyListeners('vite:afterUpdate', payload);
+ break;
+ case 'custom': {
+ notifyListeners(payload.event, payload.data);
+ break;
+ }
+ case 'full-reload':
+ notifyListeners('vite:beforeFullReload', payload);
+ if (payload.path && payload.path.endsWith('.html')) {
+ // if html file is edited, only reload the page if the browser is
+ // currently on that page.
+ const pagePath = decodeURI(location.pathname);
+ const payloadPath = base + payload.path.slice(1);
+ if (pagePath === payloadPath ||
+ payload.path === '/index.html' ||
+ (pagePath.endsWith('/') && pagePath + 'index.html' === payloadPath)) {
+ pageReload();
+ }
+ return;
+ }
+ else {
+ pageReload();
+ }
+ break;
+ case 'prune':
+ notifyListeners('vite:beforePrune', payload);
+ // After an HMR update, some modules are no longer imported on the page
+ // but they may have left behind side effects that need to be cleaned up
+ // (.e.g style injections)
+ // TODO Trigger their dispose callbacks.
+ payload.paths.forEach((path) => {
+ const fn = pruneMap.get(path);
+ if (fn) {
+ fn(dataMap.get(path));
+ }
+ });
+ break;
+ case 'error': {
+ notifyListeners('vite:error', payload);
+ const err = payload.err;
+ if (enableOverlay) {
+ createErrorOverlay(err);
+ }
+ else {
+ console.error(`[vite] Internal Server Error\n${err.message}\n${err.stack}`);
+ }
+ break;
+ }
+ default: {
+ const check = payload;
+ return check;
+ }
+ }
+}
+function notifyListeners(event, data) {
+ const cbs = customListenersMap.get(event);
+ if (cbs) {
+ cbs.forEach((cb) => cb(data));
+ }
+}
+const enableOverlay = __HMR_ENABLE_OVERLAY__;
+function createErrorOverlay(err) {
+ if (!enableOverlay)
+ return;
+ clearErrorOverlay();
+ document.body.appendChild(new ErrorOverlay(err));
+}
+function clearErrorOverlay() {
+ document
+ .querySelectorAll(overlayId)
+ .forEach((n) => n.close());
+}
+function hasErrorOverlay() {
+ return document.querySelectorAll(overlayId).length;
+}
+let pending = false;
+let queued = [];
+/**
+ * buffer multiple hot updates triggered by the same src change
+ * so that they are invoked in the same order they were sent.
+ * (otherwise the order may be inconsistent because of the http request round trip)
+ */
+async function queueUpdate(p) {
+ queued.push(p);
+ if (!pending) {
+ pending = true;
+ await Promise.resolve();
+ pending = false;
+ const loading = [...queued];
+ queued = [];
+ (await Promise.all(loading)).forEach((fn) => fn && fn());
+ }
+}
+async function waitForSuccessfulPing(socketProtocol, hostAndPath, ms = 1000) {
+ const pingHostProtocol = socketProtocol === 'wss' ? 'https' : 'http';
+ const ping = async () => {
+ // A fetch on a websocket URL will return a successful promise with status 400,
+ // but will reject a networking error.
+ // When running on middleware mode, it returns status 426, and an cors error happens if mode is not no-cors
+ try {
+ await fetch(`${pingHostProtocol}://${hostAndPath}`, {
+ mode: 'no-cors',
+ headers: {
+ // Custom headers won't be included in a request with no-cors so (ab)use one of the
+ // safelisted headers to identify the ping request
+ Accept: 'text/x-vite-ping',
+ },
+ });
+ return true;
+ }
+ catch { }
+ return false;
+ };
+ if (await ping()) {
+ return;
+ }
+ await wait(ms);
+ // eslint-disable-next-line no-constant-condition
+ while (true) {
+ if (document.visibilityState === 'visible') {
+ if (await ping()) {
+ break;
+ }
+ await wait(ms);
+ }
+ else {
+ await waitForWindowShow();
+ }
+ }
+}
+function wait(ms) {
+ return new Promise((resolve) => setTimeout(resolve, ms));
+}
+function waitForWindowShow() {
+ return new Promise((resolve) => {
+ const onChange = async () => {
+ if (document.visibilityState === 'visible') {
+ resolve();
+ document.removeEventListener('visibilitychange', onChange);
+ }
+ };
+ document.addEventListener('visibilitychange', onChange);
+ });
+}
+const sheetsMap = new Map();
+// collect existing style elements that may have been inserted during SSR
+// to avoid FOUC or duplicate styles
+if ('document' in globalThis) {
+ document.querySelectorAll('style[data-vite-dev-id]').forEach((el) => {
+ sheetsMap.set(el.getAttribute('data-vite-dev-id'), el);
+ });
+}
+// all css imports should be inserted at the same position
+// because after build it will be a single css file
+let lastInsertedStyle;
+function updateStyle(id, content) {
+ let style = sheetsMap.get(id);
+ if (!style) {
+ style = document.createElement('style');
+ style.setAttribute('type', 'text/css');
+ style.setAttribute('data-vite-dev-id', id);
+ style.textContent = content;
+ if (!lastInsertedStyle) {
+ document.head.appendChild(style);
+ // reset lastInsertedStyle after async
+ // because dynamically imported css will be splitted into a different file
+ setTimeout(() => {
+ lastInsertedStyle = undefined;
+ }, 0);
+ }
+ else {
+ lastInsertedStyle.insertAdjacentElement('afterend', style);
+ }
+ lastInsertedStyle = style;
+ }
+ else {
+ style.textContent = content;
+ }
+ sheetsMap.set(id, style);
+}
+function removeStyle(id) {
+ const style = sheetsMap.get(id);
+ if (style) {
+ document.head.removeChild(style);
+ sheetsMap.delete(id);
+ }
+}
+async function fetchUpdate({ path, acceptedPath, timestamp, explicitImportRequired, }) {
+ const mod = hotModulesMap.get(path);
+ if (!mod) {
+ // In a code-splitting project,
+ // it is common that the hot-updating module is not loaded yet.
+ // https://github.com/vitejs/vite/issues/721
+ return;
+ }
+ let fetchedModule;
+ const isSelfUpdate = path === acceptedPath;
+ // determine the qualified callbacks before we re-import the modules
+ const qualifiedCallbacks = mod.callbacks.filter(({ deps }) => deps.includes(acceptedPath));
+ if (isSelfUpdate || qualifiedCallbacks.length > 0) {
+ const disposer = disposeMap.get(acceptedPath);
+ if (disposer)
+ await disposer(dataMap.get(acceptedPath));
+ const [acceptedPathWithoutQuery, query] = acceptedPath.split(`?`);
+ try {
+ fetchedModule = await import(
+ /* @vite-ignore */
+ base +
+ acceptedPathWithoutQuery.slice(1) +
+ `?${explicitImportRequired ? 'import&' : ''}t=${timestamp}${query ? `&${query}` : ''}`);
+ }
+ catch (e) {
+ warnFailedFetch(e, acceptedPath);
+ }
+ }
+ return () => {
+ for (const { deps, fn } of qualifiedCallbacks) {
+ fn(deps.map((dep) => (dep === acceptedPath ? fetchedModule : undefined)));
+ }
+ const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
+ console.debug(`[vite] hot updated: ${loggedPath}`);
+ };
+}
+function sendMessageBuffer() {
+ if (socket.readyState === 1) {
+ messageBuffer.forEach((msg) => socket.send(msg));
+ messageBuffer.length = 0;
+ }
+}
+const hotModulesMap = new Map();
+const disposeMap = new Map();
+const pruneMap = new Map();
+const dataMap = new Map();
+const customListenersMap = new Map();
+const ctxToListenersMap = new Map();
+function createHotContext(ownerPath) {
+ if (!dataMap.has(ownerPath)) {
+ dataMap.set(ownerPath, {});
+ }
+ // when a file is hot updated, a new context is created
+ // clear its stale callbacks
+ const mod = hotModulesMap.get(ownerPath);
+ if (mod) {
+ mod.callbacks = [];
+ }
+ // clear stale custom event listeners
+ const staleListeners = ctxToListenersMap.get(ownerPath);
+ if (staleListeners) {
+ for (const [event, staleFns] of staleListeners) {
+ const listeners = customListenersMap.get(event);
+ if (listeners) {
+ customListenersMap.set(event, listeners.filter((l) => !staleFns.includes(l)));
+ }
+ }
+ }
+ const newListeners = new Map();
+ ctxToListenersMap.set(ownerPath, newListeners);
+ function acceptDeps(deps, callback = () => { }) {
+ const mod = hotModulesMap.get(ownerPath) || {
+ id: ownerPath,
+ callbacks: [],
+ };
+ mod.callbacks.push({
+ deps,
+ fn: callback,
+ });
+ hotModulesMap.set(ownerPath, mod);
+ }
+ const hot = {
+ get data() {
+ return dataMap.get(ownerPath);
+ },
+ accept(deps, callback) {
+ if (typeof deps === 'function' || !deps) {
+ // self-accept: hot.accept(() => {})
+ acceptDeps([ownerPath], ([mod]) => deps === null || deps === void 0 ? void 0 : deps(mod));
+ }
+ else if (typeof deps === 'string') {
+ // explicit deps
+ acceptDeps([deps], ([mod]) => callback === null || callback === void 0 ? void 0 : callback(mod));
+ }
+ else if (Array.isArray(deps)) {
+ acceptDeps(deps, callback);
+ }
+ else {
+ throw new Error(`invalid hot.accept() usage.`);
+ }
+ },
+ // export names (first arg) are irrelevant on the client side, they're
+ // extracted in the server for propagation
+ acceptExports(_, callback) {
+ acceptDeps([ownerPath], ([mod]) => callback === null || callback === void 0 ? void 0 : callback(mod));
+ },
+ dispose(cb) {
+ disposeMap.set(ownerPath, cb);
+ },
+ prune(cb) {
+ pruneMap.set(ownerPath, cb);
+ },
+ // Kept for backward compatibility (#11036)
+ // @ts-expect-error untyped
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
+ decline() { },
+ // tell the server to re-perform hmr propagation from this module as root
+ invalidate(message) {
+ notifyListeners('vite:invalidate', { path: ownerPath, message });
+ this.send('vite:invalidate', { path: ownerPath, message });
+ console.debug(`[vite] invalidate ${ownerPath}${message ? `: ${message}` : ''}`);
+ },
+ // custom events
+ on(event, cb) {
+ const addToMap = (map) => {
+ const existing = map.get(event) || [];
+ existing.push(cb);
+ map.set(event, existing);
+ };
+ addToMap(customListenersMap);
+ addToMap(newListeners);
+ },
+ send(event, data) {
+ messageBuffer.push(JSON.stringify({ type: 'custom', event, data }));
+ sendMessageBuffer();
+ },
+ };
+ return hot;
+}
+/**
+ * urls here are dynamic import() urls that couldn't be statically analyzed
+ */
+function injectQuery(url, queryToInject) {
+ // skip urls that won't be handled by vite
+ if (url[0] !== '.' && url[0] !== '/') {
+ return url;
+ }
+ // can't use pathname from URL since it may be relative like ../
+ const pathname = url.replace(/#.*$/, '').replace(/\?.*$/, '');
+ const { search, hash } = new URL(url, 'http://vitejs.dev');
+ return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ''}${hash || ''}`;
+}
+
+export { ErrorOverlay, createHotContext, injectQuery, removeStyle, updateStyle };
+//# sourceMappingURL=client.mjs.map
diff --git a/node_modules/vite/dist/client/client.mjs.map b/node_modules/vite/dist/client/client.mjs.map
new file mode 100644
index 0000000..03a08d2
--- /dev/null
+++ b/node_modules/vite/dist/client/client.mjs.map
@@ -0,0 +1 @@
+{"version":3,"file":"client.mjs","sources":["overlay.ts","client.ts"],"sourcesContent":["import type { ErrorPayload } from 'types/hmrPayload'\n\n// injected by the hmr plugin when served\ndeclare const __BASE__: string\n\nconst base = __BASE__ || '/'\n\n// set :host styles to make playwright detect the element as visible\nconst template = /*html*/ `\n\n
\n
\n
\n \n \n \n
\n Click outside, press Esc key, or fix the code to dismiss. \n You can also disable this overlay by setting\n server.hmr.overlay to false in vite.config.js.\n
\n
\n
\n`\n\nconst fileRE = /(?:[a-zA-Z]:\\\\|\\/).*?:\\d+:\\d+/g\nconst codeframeRE = /^(?:>?\\s+\\d+\\s+\\|.*|\\s+\\|\\s*\\^.*)\\r?\\n/gm\n\n// Allow `ErrorOverlay` to extend `HTMLElement` even in environments where\n// `HTMLElement` was not originally defined.\nconst { HTMLElement = class {} as typeof globalThis.HTMLElement } = globalThis\nexport class ErrorOverlay extends HTMLElement {\n root: ShadowRoot\n closeOnEsc: (e: KeyboardEvent) => void\n\n constructor(err: ErrorPayload['err'], links = true) {\n super()\n this.root = this.attachShadow({ mode: 'open' })\n this.root.innerHTML = template\n\n codeframeRE.lastIndex = 0\n const hasFrame = err.frame && codeframeRE.test(err.frame)\n const message = hasFrame\n ? err.message.replace(codeframeRE, '')\n : err.message\n if (err.plugin) {\n this.text('.plugin', `[plugin:${err.plugin}] `)\n }\n this.text('.message-body', message.trim())\n\n const [file] = (err.loc?.file || err.id || 'unknown file').split(`?`)\n if (err.loc) {\n this.text('.file', `${file}:${err.loc.line}:${err.loc.column}`, links)\n } else if (err.id) {\n this.text('.file', file)\n }\n\n if (hasFrame) {\n this.text('.frame', err.frame!.trim())\n }\n this.text('.stack', err.stack, links)\n\n this.root.querySelector('.window')!.addEventListener('click', (e) => {\n e.stopPropagation()\n })\n\n this.addEventListener('click', () => {\n this.close()\n })\n\n this.closeOnEsc = (e: KeyboardEvent) => {\n if (e.key === 'Escape' || e.code === 'Escape') {\n this.close()\n }\n }\n\n document.addEventListener('keydown', this.closeOnEsc)\n }\n\n text(selector: string, text: string, linkFiles = false): void {\n const el = this.root.querySelector(selector)!\n if (!linkFiles) {\n el.textContent = text\n } else {\n let curIndex = 0\n let match: RegExpExecArray | null\n fileRE.lastIndex = 0\n while ((match = fileRE.exec(text))) {\n const { 0: file, index } = match\n if (index != null) {\n const frag = text.slice(curIndex, index)\n el.appendChild(document.createTextNode(frag))\n const link = document.createElement('a')\n link.textContent = file\n link.className = 'file-link'\n link.onclick = () => {\n fetch(`${base}__open-in-editor?file=` + encodeURIComponent(file))\n }\n el.appendChild(link)\n curIndex += frag.length + file.length\n }\n }\n }\n }\n close(): void {\n this.parentNode?.removeChild(this)\n document.removeEventListener('keydown', this.closeOnEsc)\n }\n}\n\nexport const overlayId = 'vite-error-overlay'\nconst { customElements } = globalThis // Ensure `customElements` is defined before the next line.\nif (customElements && !customElements.get(overlayId)) {\n customElements.define(overlayId, ErrorOverlay)\n}\n","import type { ErrorPayload, HMRPayload, Update } from 'types/hmrPayload'\nimport type { ModuleNamespace, ViteHotContext } from 'types/hot'\nimport type { InferCustomEventPayload } from 'types/customEvent'\nimport { ErrorOverlay, overlayId } from './overlay'\nimport '@vite/env'\n\n// injected by the hmr plugin when served\ndeclare const __BASE__: string\ndeclare const __SERVER_HOST__: string\ndeclare const __HMR_PROTOCOL__: string | null\ndeclare const __HMR_HOSTNAME__: string | null\ndeclare const __HMR_PORT__: number | null\ndeclare const __HMR_DIRECT_TARGET__: string\ndeclare const __HMR_BASE__: string\ndeclare const __HMR_TIMEOUT__: number\ndeclare const __HMR_ENABLE_OVERLAY__: boolean\n\nconsole.debug('[vite] connecting...')\n\nconst importMetaUrl = new URL(import.meta.url)\n\n// use server configuration, then fallback to inference\nconst serverHost = __SERVER_HOST__\nconst socketProtocol =\n __HMR_PROTOCOL__ || (importMetaUrl.protocol === 'https:' ? 'wss' : 'ws')\nconst hmrPort = __HMR_PORT__\nconst socketHost = `${__HMR_HOSTNAME__ || importMetaUrl.hostname}:${\n hmrPort || importMetaUrl.port\n}${__HMR_BASE__}`\nconst directSocketHost = __HMR_DIRECT_TARGET__\nconst base = __BASE__ || '/'\nconst messageBuffer: string[] = []\n\nlet socket: WebSocket\ntry {\n let fallback: (() => void) | undefined\n // only use fallback when port is inferred to prevent confusion\n if (!hmrPort) {\n fallback = () => {\n // fallback to connecting directly to the hmr server\n // for servers which does not support proxying websocket\n socket = setupWebSocket(socketProtocol, directSocketHost, () => {\n const currentScriptHostURL = new URL(import.meta.url)\n const currentScriptHost =\n currentScriptHostURL.host +\n currentScriptHostURL.pathname.replace(/@vite\\/client$/, '')\n console.error(\n '[vite] failed to connect to websocket.\\n' +\n 'your current setup:\\n' +\n ` (browser) ${currentScriptHost} <--[HTTP]--> ${serverHost} (server)\\n` +\n ` (browser) ${socketHost} <--[WebSocket (failing)]--> ${directSocketHost} (server)\\n` +\n 'Check out your Vite / network configuration and https://vitejs.dev/config/server-options.html#server-hmr .',\n )\n })\n socket.addEventListener(\n 'open',\n () => {\n console.info(\n '[vite] Direct websocket connection fallback. Check out https://vitejs.dev/config/server-options.html#server-hmr to remove the previous connection error.',\n )\n },\n { once: true },\n )\n }\n }\n\n socket = setupWebSocket(socketProtocol, socketHost, fallback)\n} catch (error) {\n console.error(`[vite] failed to connect to websocket (${error}). `)\n}\n\nfunction setupWebSocket(\n protocol: string,\n hostAndPath: string,\n onCloseWithoutOpen?: () => void,\n) {\n const socket = new WebSocket(`${protocol}://${hostAndPath}`, 'vite-hmr')\n let isOpened = false\n\n socket.addEventListener(\n 'open',\n () => {\n isOpened = true\n notifyListeners('vite:ws:connect', { webSocket: socket })\n },\n { once: true },\n )\n\n // Listen for messages\n socket.addEventListener('message', async ({ data }) => {\n handleMessage(JSON.parse(data))\n })\n\n // ping server\n socket.addEventListener('close', async ({ wasClean }) => {\n if (wasClean) return\n\n if (!isOpened && onCloseWithoutOpen) {\n onCloseWithoutOpen()\n return\n }\n\n notifyListeners('vite:ws:disconnect', { webSocket: socket })\n\n console.log(`[vite] server connection lost. polling for restart...`)\n await waitForSuccessfulPing(protocol, hostAndPath)\n location.reload()\n })\n\n return socket\n}\n\nfunction warnFailedFetch(err: Error, path: string | string[]) {\n if (!err.message.match('fetch')) {\n console.error(err)\n }\n console.error(\n `[hmr] Failed to reload ${path}. ` +\n `This could be due to syntax errors or importing non-existent ` +\n `modules. (see errors above)`,\n )\n}\n\nfunction cleanUrl(pathname: string): string {\n const url = new URL(pathname, location.toString())\n url.searchParams.delete('direct')\n return url.pathname + url.search\n}\n\nlet isFirstUpdate = true\nconst outdatedLinkTags = new WeakSet()\n\nconst debounceReload = (time: number) => {\n let timer: ReturnType | null\n return () => {\n if (timer) {\n clearTimeout(timer)\n timer = null\n }\n timer = setTimeout(() => {\n location.reload()\n }, time)\n }\n}\nconst pageReload = debounceReload(50)\n\nasync function handleMessage(payload: HMRPayload) {\n switch (payload.type) {\n case 'connected':\n console.debug(`[vite] connected.`)\n sendMessageBuffer()\n // proxy(nginx, docker) hmr ws maybe caused timeout,\n // so send ping package let ws keep alive.\n setInterval(() => {\n if (socket.readyState === socket.OPEN) {\n socket.send('{\"type\":\"ping\"}')\n }\n }, __HMR_TIMEOUT__)\n break\n case 'update':\n notifyListeners('vite:beforeUpdate', payload)\n // if this is the first update and there's already an error overlay, it\n // means the page opened with existing server compile error and the whole\n // module script failed to load (since one of the nested imports is 500).\n // in this case a normal update won't work and a full reload is needed.\n if (isFirstUpdate && hasErrorOverlay()) {\n window.location.reload()\n return\n } else {\n clearErrorOverlay()\n isFirstUpdate = false\n }\n await Promise.all(\n payload.updates.map(async (update): Promise => {\n if (update.type === 'js-update') {\n return queueUpdate(fetchUpdate(update))\n }\n\n // css-update\n // this is only sent when a css file referenced with is updated\n const { path, timestamp } = update\n const searchUrl = cleanUrl(path)\n // can't use querySelector with `[href*=]` here since the link may be\n // using relative paths so we need to use link.href to grab the full\n // URL for the include check.\n const el = Array.from(\n document.querySelectorAll('link'),\n ).find(\n (e) =>\n !outdatedLinkTags.has(e) && cleanUrl(e.href).includes(searchUrl),\n )\n\n if (!el) {\n return\n }\n\n const newPath = `${base}${searchUrl.slice(1)}${\n searchUrl.includes('?') ? '&' : '?'\n }t=${timestamp}`\n\n // rather than swapping the href on the existing tag, we will\n // create a new link tag. Once the new stylesheet has loaded we\n // will remove the existing link tag. This removes a Flash Of\n // Unstyled Content that can occur when swapping out the tag href\n // directly, as the new stylesheet has not yet been loaded.\n return new Promise((resolve) => {\n const newLinkTag = el.cloneNode() as HTMLLinkElement\n newLinkTag.href = new URL(newPath, el.href).href\n const removeOldEl = () => {\n el.remove()\n console.debug(`[vite] css hot updated: ${searchUrl}`)\n resolve()\n }\n newLinkTag.addEventListener('load', removeOldEl)\n newLinkTag.addEventListener('error', removeOldEl)\n outdatedLinkTags.add(el)\n el.after(newLinkTag)\n })\n }),\n )\n notifyListeners('vite:afterUpdate', payload)\n break\n case 'custom': {\n notifyListeners(payload.event, payload.data)\n break\n }\n case 'full-reload':\n notifyListeners('vite:beforeFullReload', payload)\n if (payload.path && payload.path.endsWith('.html')) {\n // if html file is edited, only reload the page if the browser is\n // currently on that page.\n const pagePath = decodeURI(location.pathname)\n const payloadPath = base + payload.path.slice(1)\n if (\n pagePath === payloadPath ||\n payload.path === '/index.html' ||\n (pagePath.endsWith('/') && pagePath + 'index.html' === payloadPath)\n ) {\n pageReload()\n }\n return\n } else {\n pageReload()\n }\n break\n case 'prune':\n notifyListeners('vite:beforePrune', payload)\n // After an HMR update, some modules are no longer imported on the page\n // but they may have left behind side effects that need to be cleaned up\n // (.e.g style injections)\n // TODO Trigger their dispose callbacks.\n payload.paths.forEach((path) => {\n const fn = pruneMap.get(path)\n if (fn) {\n fn(dataMap.get(path))\n }\n })\n break\n case 'error': {\n notifyListeners('vite:error', payload)\n const err = payload.err\n if (enableOverlay) {\n createErrorOverlay(err)\n } else {\n console.error(\n `[vite] Internal Server Error\\n${err.message}\\n${err.stack}`,\n )\n }\n break\n }\n default: {\n const check: never = payload\n return check\n }\n }\n}\n\nfunction notifyListeners(\n event: T,\n data: InferCustomEventPayload,\n): void\nfunction notifyListeners(event: string, data: any): void {\n const cbs = customListenersMap.get(event)\n if (cbs) {\n cbs.forEach((cb) => cb(data))\n }\n}\n\nconst enableOverlay = __HMR_ENABLE_OVERLAY__\n\nfunction createErrorOverlay(err: ErrorPayload['err']) {\n if (!enableOverlay) return\n clearErrorOverlay()\n document.body.appendChild(new ErrorOverlay(err))\n}\n\nfunction clearErrorOverlay() {\n document\n .querySelectorAll(overlayId)\n .forEach((n) => (n as ErrorOverlay).close())\n}\n\nfunction hasErrorOverlay() {\n return document.querySelectorAll(overlayId).length\n}\n\nlet pending = false\nlet queued: Promise<(() => void) | undefined>[] = []\n\n/**\n * buffer multiple hot updates triggered by the same src change\n * so that they are invoked in the same order they were sent.\n * (otherwise the order may be inconsistent because of the http request round trip)\n */\nasync function queueUpdate(p: Promise<(() => void) | undefined>) {\n queued.push(p)\n if (!pending) {\n pending = true\n await Promise.resolve()\n pending = false\n const loading = [...queued]\n queued = []\n ;(await Promise.all(loading)).forEach((fn) => fn && fn())\n }\n}\n\nasync function waitForSuccessfulPing(\n socketProtocol: string,\n hostAndPath: string,\n ms = 1000,\n) {\n const pingHostProtocol = socketProtocol === 'wss' ? 'https' : 'http'\n\n const ping = async () => {\n // A fetch on a websocket URL will return a successful promise with status 400,\n // but will reject a networking error.\n // When running on middleware mode, it returns status 426, and an cors error happens if mode is not no-cors\n try {\n await fetch(`${pingHostProtocol}://${hostAndPath}`, {\n mode: 'no-cors',\n headers: {\n // Custom headers won't be included in a request with no-cors so (ab)use one of the\n // safelisted headers to identify the ping request\n Accept: 'text/x-vite-ping',\n },\n })\n return true\n } catch {}\n return false\n }\n\n if (await ping()) {\n return\n }\n await wait(ms)\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n if (document.visibilityState === 'visible') {\n if (await ping()) {\n break\n }\n await wait(ms)\n } else {\n await waitForWindowShow()\n }\n }\n}\n\nfunction wait(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\nfunction waitForWindowShow() {\n return new Promise((resolve) => {\n const onChange = async () => {\n if (document.visibilityState === 'visible') {\n resolve()\n document.removeEventListener('visibilitychange', onChange)\n }\n }\n document.addEventListener('visibilitychange', onChange)\n })\n}\n\nconst sheetsMap = new Map()\n\n// collect existing style elements that may have been inserted during SSR\n// to avoid FOUC or duplicate styles\nif ('document' in globalThis) {\n document.querySelectorAll('style[data-vite-dev-id]').forEach((el) => {\n sheetsMap.set(el.getAttribute('data-vite-dev-id')!, el as HTMLStyleElement)\n })\n}\n\n// all css imports should be inserted at the same position\n// because after build it will be a single css file\nlet lastInsertedStyle: HTMLStyleElement | undefined\n\nexport function updateStyle(id: string, content: string): void {\n let style = sheetsMap.get(id)\n if (!style) {\n style = document.createElement('style')\n style.setAttribute('type', 'text/css')\n style.setAttribute('data-vite-dev-id', id)\n style.textContent = content\n\n if (!lastInsertedStyle) {\n document.head.appendChild(style)\n\n // reset lastInsertedStyle after async\n // because dynamically imported css will be splitted into a different file\n setTimeout(() => {\n lastInsertedStyle = undefined\n }, 0)\n } else {\n lastInsertedStyle.insertAdjacentElement('afterend', style)\n }\n lastInsertedStyle = style\n } else {\n style.textContent = content\n }\n sheetsMap.set(id, style)\n}\n\nexport function removeStyle(id: string): void {\n const style = sheetsMap.get(id)\n if (style) {\n document.head.removeChild(style)\n sheetsMap.delete(id)\n }\n}\n\nasync function fetchUpdate({\n path,\n acceptedPath,\n timestamp,\n explicitImportRequired,\n}: Update) {\n const mod = hotModulesMap.get(path)\n if (!mod) {\n // In a code-splitting project,\n // it is common that the hot-updating module is not loaded yet.\n // https://github.com/vitejs/vite/issues/721\n return\n }\n\n let fetchedModule: ModuleNamespace | undefined\n const isSelfUpdate = path === acceptedPath\n\n // determine the qualified callbacks before we re-import the modules\n const qualifiedCallbacks = mod.callbacks.filter(({ deps }) =>\n deps.includes(acceptedPath),\n )\n\n if (isSelfUpdate || qualifiedCallbacks.length > 0) {\n const disposer = disposeMap.get(acceptedPath)\n if (disposer) await disposer(dataMap.get(acceptedPath))\n const [acceptedPathWithoutQuery, query] = acceptedPath.split(`?`)\n try {\n fetchedModule = await import(\n /* @vite-ignore */\n base +\n acceptedPathWithoutQuery.slice(1) +\n `?${explicitImportRequired ? 'import&' : ''}t=${timestamp}${\n query ? `&${query}` : ''\n }`\n )\n } catch (e) {\n warnFailedFetch(e, acceptedPath)\n }\n }\n\n return () => {\n for (const { deps, fn } of qualifiedCallbacks) {\n fn(deps.map((dep) => (dep === acceptedPath ? fetchedModule : undefined)))\n }\n const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`\n console.debug(`[vite] hot updated: ${loggedPath}`)\n }\n}\n\nfunction sendMessageBuffer() {\n if (socket.readyState === 1) {\n messageBuffer.forEach((msg) => socket.send(msg))\n messageBuffer.length = 0\n }\n}\n\ninterface HotModule {\n id: string\n callbacks: HotCallback[]\n}\n\ninterface HotCallback {\n // the dependencies must be fetchable paths\n deps: string[]\n fn: (modules: Array) => void\n}\n\ntype CustomListenersMap = Map void)[]>\n\nconst hotModulesMap = new Map()\nconst disposeMap = new Map void | Promise>()\nconst pruneMap = new Map void | Promise>()\nconst dataMap = new Map()\nconst customListenersMap: CustomListenersMap = new Map()\nconst ctxToListenersMap = new Map()\n\nexport function createHotContext(ownerPath: string): ViteHotContext {\n if (!dataMap.has(ownerPath)) {\n dataMap.set(ownerPath, {})\n }\n\n // when a file is hot updated, a new context is created\n // clear its stale callbacks\n const mod = hotModulesMap.get(ownerPath)\n if (mod) {\n mod.callbacks = []\n }\n\n // clear stale custom event listeners\n const staleListeners = ctxToListenersMap.get(ownerPath)\n if (staleListeners) {\n for (const [event, staleFns] of staleListeners) {\n const listeners = customListenersMap.get(event)\n if (listeners) {\n customListenersMap.set(\n event,\n listeners.filter((l) => !staleFns.includes(l)),\n )\n }\n }\n }\n\n const newListeners: CustomListenersMap = new Map()\n ctxToListenersMap.set(ownerPath, newListeners)\n\n function acceptDeps(deps: string[], callback: HotCallback['fn'] = () => {}) {\n const mod: HotModule = hotModulesMap.get(ownerPath) || {\n id: ownerPath,\n callbacks: [],\n }\n mod.callbacks.push({\n deps,\n fn: callback,\n })\n hotModulesMap.set(ownerPath, mod)\n }\n\n const hot: ViteHotContext = {\n get data() {\n return dataMap.get(ownerPath)\n },\n\n accept(deps?: any, callback?: any) {\n if (typeof deps === 'function' || !deps) {\n // self-accept: hot.accept(() => {})\n acceptDeps([ownerPath], ([mod]) => deps?.(mod))\n } else if (typeof deps === 'string') {\n // explicit deps\n acceptDeps([deps], ([mod]) => callback?.(mod))\n } else if (Array.isArray(deps)) {\n acceptDeps(deps, callback)\n } else {\n throw new Error(`invalid hot.accept() usage.`)\n }\n },\n\n // export names (first arg) are irrelevant on the client side, they're\n // extracted in the server for propagation\n acceptExports(_, callback) {\n acceptDeps([ownerPath], ([mod]) => callback?.(mod))\n },\n\n dispose(cb) {\n disposeMap.set(ownerPath, cb)\n },\n\n prune(cb) {\n pruneMap.set(ownerPath, cb)\n },\n\n // Kept for backward compatibility (#11036)\n // @ts-expect-error untyped\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n decline() {},\n\n // tell the server to re-perform hmr propagation from this module as root\n invalidate(message) {\n notifyListeners('vite:invalidate', { path: ownerPath, message })\n this.send('vite:invalidate', { path: ownerPath, message })\n console.debug(\n `[vite] invalidate ${ownerPath}${message ? `: ${message}` : ''}`,\n )\n },\n\n // custom events\n on(event, cb) {\n const addToMap = (map: Map) => {\n const existing = map.get(event) || []\n existing.push(cb)\n map.set(event, existing)\n }\n addToMap(customListenersMap)\n addToMap(newListeners)\n },\n\n send(event, data) {\n messageBuffer.push(JSON.stringify({ type: 'custom', event, data }))\n sendMessageBuffer()\n },\n }\n\n return hot\n}\n\n/**\n * urls here are dynamic import() urls that couldn't be statically analyzed\n */\nexport function injectQuery(url: string, queryToInject: string): string {\n // skip urls that won't be handled by vite\n if (url[0] !== '.' && url[0] !== '/') {\n return url\n }\n\n // can't use pathname from URL since it may be relative like ../\n const pathname = url.replace(/#.*$/, '').replace(/\\?.*$/, '')\n const { search, hash } = new URL(url, 'http://vitejs.dev')\n\n return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ''}${\n hash || ''\n }`\n}\n\nexport { ErrorOverlay }\n"],"names":["base"],"mappings":";;AAKA,MAAMA,MAAI,GAAG,QAAQ,IAAI,GAAG,CAAA;AAE5B;AACA,MAAM,QAAQ,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4IzB,CAAA;AAED,MAAM,MAAM,GAAG,gCAAgC,CAAA;AAC/C,MAAM,WAAW,GAAG,0CAA0C,CAAA;AAE9D;AACA;AACA,MAAM,EAAE,WAAW,GAAG,MAAA;CAAyC,EAAE,GAAG,UAAU,CAAA;AACxE,MAAO,YAAa,SAAQ,WAAW,CAAA;AAI3C,IAAA,WAAA,CAAY,GAAwB,EAAE,KAAK,GAAG,IAAI,EAAA;;AAChD,QAAA,KAAK,EAAE,CAAA;AACP,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;AAC/C,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;AAE9B,QAAA,WAAW,CAAC,SAAS,GAAG,CAAC,CAAA;AACzB,QAAA,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACzD,MAAM,OAAO,GAAG,QAAQ;cACpB,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;AACtC,cAAE,GAAG,CAAC,OAAO,CAAA;QACf,IAAI,GAAG,CAAC,MAAM,EAAE;YACd,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAW,QAAA,EAAA,GAAG,CAAC,MAAM,CAAI,EAAA,CAAA,CAAC,CAAA;AAChD,SAAA;QACD,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;QAE1C,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,CAAA,EAAA,GAAA,GAAG,CAAC,GAAG,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAI,KAAI,GAAG,CAAC,EAAE,IAAI,cAAc,EAAE,KAAK,CAAC,CAAG,CAAA,CAAA,CAAC,CAAA;QACrE,IAAI,GAAG,CAAC,GAAG,EAAE;YACX,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAG,EAAA,IAAI,CAAI,CAAA,EAAA,GAAG,CAAC,GAAG,CAAC,IAAI,CAAA,CAAA,EAAI,GAAG,CAAC,GAAG,CAAC,MAAM,CAAE,CAAA,EAAE,KAAK,CAAC,CAAA;AACvE,SAAA;aAAM,IAAI,GAAG,CAAC,EAAE,EAAE;AACjB,YAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACzB,SAAA;AAED,QAAA,IAAI,QAAQ,EAAE;AACZ,YAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,KAAM,CAAC,IAAI,EAAE,CAAC,CAAA;AACvC,SAAA;QACD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAErC,QAAA,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,KAAI;YAClE,CAAC,CAAC,eAAe,EAAE,CAAA;AACrB,SAAC,CAAC,CAAA;AAEF,QAAA,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAK;YAClC,IAAI,CAAC,KAAK,EAAE,CAAA;AACd,SAAC,CAAC,CAAA;AAEF,QAAA,IAAI,CAAC,UAAU,GAAG,CAAC,CAAgB,KAAI;YACrC,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC7C,IAAI,CAAC,KAAK,EAAE,CAAA;AACb,aAAA;AACH,SAAC,CAAA;QAED,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;KACtD;AAED,IAAA,IAAI,CAAC,QAAgB,EAAE,IAAY,EAAE,SAAS,GAAG,KAAK,EAAA;QACpD,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAE,CAAA;QAC7C,IAAI,CAAC,SAAS,EAAE;AACd,YAAA,EAAE,CAAC,WAAW,GAAG,IAAI,CAAA;AACtB,SAAA;AAAM,aAAA;YACL,IAAI,QAAQ,GAAG,CAAC,CAAA;AAChB,YAAA,IAAI,KAA6B,CAAA;AACjC,YAAA,MAAM,CAAC,SAAS,GAAG,CAAC,CAAA;YACpB,QAAQ,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;gBAClC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,CAAA;gBAChC,IAAI,KAAK,IAAI,IAAI,EAAE;oBACjB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;oBACxC,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAA;oBAC7C,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;AACxC,oBAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;AACvB,oBAAA,IAAI,CAAC,SAAS,GAAG,WAAW,CAAA;AAC5B,oBAAA,IAAI,CAAC,OAAO,GAAG,MAAK;wBAClB,KAAK,CAAC,CAAG,EAAAA,MAAI,CAAwB,sBAAA,CAAA,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAA;AACnE,qBAAC,CAAA;AACD,oBAAA,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;oBACpB,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;AACtC,iBAAA;AACF,aAAA;AACF,SAAA;KACF;IACD,KAAK,GAAA;;QACH,CAAA,EAAA,GAAA,IAAI,CAAC,UAAU,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,WAAW,CAAC,IAAI,CAAC,CAAA;QAClC,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;KACzD;AACF,CAAA;AAEM,MAAM,SAAS,GAAG,oBAAoB,CAAA;AAC7C,MAAM,EAAE,cAAc,EAAE,GAAG,UAAU,CAAA;AACrC,IAAI,cAAc,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;AACpD,IAAA,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,CAAA;AAC/C;;AC9ND,OAAO,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAA;AAErC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;AACA,MAAM,UAAU,GAAG,eAAe,CAAA;AAClC,MAAM,cAAc,GAClB,gBAAgB,KAAK,aAAa,CAAC,QAAQ,KAAK,QAAQ,GAAG,KAAK,GAAG,IAAI,CAAC,CAAA;AAC1E,MAAM,OAAO,GAAG,YAAY,CAAA;AAC5B,MAAM,UAAU,GAAG,CAAA,EAAG,gBAAgB,IAAI,aAAa,CAAC,QAAQ,CAC9D,CAAA,EAAA,OAAO,IAAI,aAAa,CAAC,IAC3B,CAAG,EAAA,YAAY,EAAE,CAAA;AACjB,MAAM,gBAAgB,GAAG,qBAAqB,CAAA;AAC9C,MAAM,IAAI,GAAG,QAAQ,IAAI,GAAG,CAAA;AAC5B,MAAM,aAAa,GAAa,EAAE,CAAA;AAElC,IAAI,MAAiB,CAAA;AACrB,IAAI;AACF,IAAA,IAAI,QAAkC,CAAA;;IAEtC,IAAI,CAAC,OAAO,EAAE;QACZ,QAAQ,GAAG,MAAK;;;YAGd,MAAM,GAAG,cAAc,CAAC,cAAc,EAAE,gBAAgB,EAAE,MAAK;gBAC7D,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACrD,gBAAA,MAAM,iBAAiB,GACrB,oBAAoB,CAAC,IAAI;oBACzB,oBAAoB,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAA;gBAC7D,OAAO,CAAC,KAAK,CACX,0CAA0C;oBACxC,uBAAuB;oBACvB,CAAe,YAAA,EAAA,iBAAiB,CAAiB,cAAA,EAAA,UAAU,CAAa,WAAA,CAAA;oBACxE,CAAe,YAAA,EAAA,UAAU,CAAgC,6BAAA,EAAA,gBAAgB,CAAa,WAAA,CAAA;AACtF,oBAAA,4GAA4G,CAC/G,CAAA;AACH,aAAC,CAAC,CAAA;AACF,YAAA,MAAM,CAAC,gBAAgB,CACrB,MAAM,EACN,MAAK;AACH,gBAAA,OAAO,CAAC,IAAI,CACV,0JAA0J,CAC3J,CAAA;AACH,aAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAA;AACH,SAAC,CAAA;AACF,KAAA;IAED,MAAM,GAAG,cAAc,CAAC,cAAc,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAA;AAC9D,CAAA;AAAC,OAAO,KAAK,EAAE;AACd,IAAA,OAAO,CAAC,KAAK,CAAC,0CAA0C,KAAK,CAAA,GAAA,CAAK,CAAC,CAAA;AACpE,CAAA;AAED,SAAS,cAAc,CACrB,QAAgB,EAChB,WAAmB,EACnB,kBAA+B,EAAA;AAE/B,IAAA,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,CAAA,EAAG,QAAQ,CAAA,GAAA,EAAM,WAAW,CAAA,CAAE,EAAE,UAAU,CAAC,CAAA;IACxE,IAAI,QAAQ,GAAG,KAAK,CAAA;AAEpB,IAAA,MAAM,CAAC,gBAAgB,CACrB,MAAM,EACN,MAAK;QACH,QAAQ,GAAG,IAAI,CAAA;QACf,eAAe,CAAC,iBAAiB,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAA;AAC3D,KAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAA;;IAGD,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,KAAI;QACpD,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;AACjC,KAAC,CAAC,CAAA;;IAGF,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAI;AACtD,QAAA,IAAI,QAAQ;YAAE,OAAM;AAEpB,QAAA,IAAI,CAAC,QAAQ,IAAI,kBAAkB,EAAE;AACnC,YAAA,kBAAkB,EAAE,CAAA;YACpB,OAAM;AACP,SAAA;QAED,eAAe,CAAC,oBAAoB,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAA;AAE5D,QAAA,OAAO,CAAC,GAAG,CAAC,CAAA,qDAAA,CAAuD,CAAC,CAAA;AACpE,QAAA,MAAM,qBAAqB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAA;QAClD,QAAQ,CAAC,MAAM,EAAE,CAAA;AACnB,KAAC,CAAC,CAAA;AAEF,IAAA,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,eAAe,CAAC,GAAU,EAAE,IAAuB,EAAA;IAC1D,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;AAC/B,QAAA,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;AACnB,KAAA;AACD,IAAA,OAAO,CAAC,KAAK,CACX,CAAA,uBAAA,EAA0B,IAAI,CAAI,EAAA,CAAA;QAChC,CAA+D,6DAAA,CAAA;AAC/D,QAAA,CAAA,2BAAA,CAA6B,CAChC,CAAA;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,QAAgB,EAAA;AAChC,IAAA,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;AAClD,IAAA,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACjC,IAAA,OAAO,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAA;AAClC,CAAC;AAED,IAAI,aAAa,GAAG,IAAI,CAAA;AACxB,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAAmB,CAAA;AAEvD,MAAM,cAAc,GAAG,CAAC,IAAY,KAAI;AACtC,IAAA,IAAI,KAA2C,CAAA;AAC/C,IAAA,OAAO,MAAK;AACV,QAAA,IAAI,KAAK,EAAE;YACT,YAAY,CAAC,KAAK,CAAC,CAAA;YACnB,KAAK,GAAG,IAAI,CAAA;AACb,SAAA;AACD,QAAA,KAAK,GAAG,UAAU,CAAC,MAAK;YACtB,QAAQ,CAAC,MAAM,EAAE,CAAA;SAClB,EAAE,IAAI,CAAC,CAAA;AACV,KAAC,CAAA;AACH,CAAC,CAAA;AACD,MAAM,UAAU,GAAG,cAAc,CAAC,EAAE,CAAC,CAAA;AAErC,eAAe,aAAa,CAAC,OAAmB,EAAA;IAC9C,QAAQ,OAAO,CAAC,IAAI;AAClB,QAAA,KAAK,WAAW;AACd,YAAA,OAAO,CAAC,KAAK,CAAC,CAAA,iBAAA,CAAmB,CAAC,CAAA;AAClC,YAAA,iBAAiB,EAAE,CAAA;;;YAGnB,WAAW,CAAC,MAAK;AACf,gBAAA,IAAI,MAAM,CAAC,UAAU,KAAK,MAAM,CAAC,IAAI,EAAE;AACrC,oBAAA,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;AAC/B,iBAAA;aACF,EAAE,eAAe,CAAC,CAAA;YACnB,MAAK;AACP,QAAA,KAAK,QAAQ;AACX,YAAA,eAAe,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAA;;;;;AAK7C,YAAA,IAAI,aAAa,IAAI,eAAe,EAAE,EAAE;AACtC,gBAAA,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAA;gBACxB,OAAM;AACP,aAAA;AAAM,iBAAA;AACL,gBAAA,iBAAiB,EAAE,CAAA;gBACnB,aAAa,GAAG,KAAK,CAAA;AACtB,aAAA;AACD,YAAA,MAAM,OAAO,CAAC,GAAG,CACf,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,MAAM,KAAmB;AAClD,gBAAA,IAAI,MAAM,CAAC,IAAI,KAAK,WAAW,EAAE;AAC/B,oBAAA,OAAO,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;AACxC,iBAAA;;;AAID,gBAAA,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,CAAA;AAClC,gBAAA,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;;;;AAIhC,gBAAA,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CACnB,QAAQ,CAAC,gBAAgB,CAAkB,MAAM,CAAC,CACnD,CAAC,IAAI,CACJ,CAAC,CAAC,KACA,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CACnE,CAAA;gBAED,IAAI,CAAC,EAAE,EAAE;oBACP,OAAM;AACP,iBAAA;AAED,gBAAA,MAAM,OAAO,GAAG,CAAG,EAAA,IAAI,CAAG,EAAA,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA,EAC1C,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,GAClC,CAAK,EAAA,EAAA,SAAS,EAAE,CAAA;;;;;;AAOhB,gBAAA,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAI;AAC7B,oBAAA,MAAM,UAAU,GAAG,EAAE,CAAC,SAAS,EAAqB,CAAA;AACpD,oBAAA,UAAU,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAA;oBAChD,MAAM,WAAW,GAAG,MAAK;wBACvB,EAAE,CAAC,MAAM,EAAE,CAAA;AACX,wBAAA,OAAO,CAAC,KAAK,CAAC,2BAA2B,SAAS,CAAA,CAAE,CAAC,CAAA;AACrD,wBAAA,OAAO,EAAE,CAAA;AACX,qBAAC,CAAA;AACD,oBAAA,UAAU,CAAC,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AAChD,oBAAA,UAAU,CAAC,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;AACjD,oBAAA,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AACxB,oBAAA,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;AACtB,iBAAC,CAAC,CAAA;aACH,CAAC,CACH,CAAA;AACD,YAAA,eAAe,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAA;YAC5C,MAAK;QACP,KAAK,QAAQ,EAAE;YACb,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;YAC5C,MAAK;AACN,SAAA;AACD,QAAA,KAAK,aAAa;AAChB,YAAA,eAAe,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAA;AACjD,YAAA,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;;;gBAGlD,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAC7C,gBAAA,MAAM,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;gBAChD,IACE,QAAQ,KAAK,WAAW;oBACxB,OAAO,CAAC,IAAI,KAAK,aAAa;AAC9B,qBAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,QAAQ,GAAG,YAAY,KAAK,WAAW,CAAC,EACnE;AACA,oBAAA,UAAU,EAAE,CAAA;AACb,iBAAA;gBACD,OAAM;AACP,aAAA;AAAM,iBAAA;AACL,gBAAA,UAAU,EAAE,CAAA;AACb,aAAA;YACD,MAAK;AACP,QAAA,KAAK,OAAO;AACV,YAAA,eAAe,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAA;;;;;YAK5C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;gBAC7B,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAC7B,gBAAA,IAAI,EAAE,EAAE;oBACN,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;AACtB,iBAAA;AACH,aAAC,CAAC,CAAA;YACF,MAAK;QACP,KAAK,OAAO,EAAE;AACZ,YAAA,eAAe,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;AACtC,YAAA,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;AACvB,YAAA,IAAI,aAAa,EAAE;gBACjB,kBAAkB,CAAC,GAAG,CAAC,CAAA;AACxB,aAAA;AAAM,iBAAA;AACL,gBAAA,OAAO,CAAC,KAAK,CACX,CAAA,8BAAA,EAAiC,GAAG,CAAC,OAAO,CAAA,EAAA,EAAK,GAAG,CAAC,KAAK,CAAA,CAAE,CAC7D,CAAA;AACF,aAAA;YACD,MAAK;AACN,SAAA;AACD,QAAA,SAAS;YACP,MAAM,KAAK,GAAU,OAAO,CAAA;AAC5B,YAAA,OAAO,KAAK,CAAA;AACb,SAAA;AACF,KAAA;AACH,CAAC;AAMD,SAAS,eAAe,CAAC,KAAa,EAAE,IAAS,EAAA;IAC/C,MAAM,GAAG,GAAG,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AACzC,IAAA,IAAI,GAAG,EAAE;AACP,QAAA,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;AAC9B,KAAA;AACH,CAAC;AAED,MAAM,aAAa,GAAG,sBAAsB,CAAA;AAE5C,SAAS,kBAAkB,CAAC,GAAwB,EAAA;AAClD,IAAA,IAAI,CAAC,aAAa;QAAE,OAAM;AAC1B,IAAA,iBAAiB,EAAE,CAAA;IACnB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;AAClD,CAAC;AAED,SAAS,iBAAiB,GAAA;IACxB,QAAQ;SACL,gBAAgB,CAAC,SAAS,CAAC;SAC3B,OAAO,CAAC,CAAC,CAAC,KAAM,CAAkB,CAAC,KAAK,EAAE,CAAC,CAAA;AAChD,CAAC;AAED,SAAS,eAAe,GAAA;IACtB,OAAO,QAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAA;AACpD,CAAC;AAED,IAAI,OAAO,GAAG,KAAK,CAAA;AACnB,IAAI,MAAM,GAAwC,EAAE,CAAA;AAEpD;;;;AAIG;AACH,eAAe,WAAW,CAAC,CAAoC,EAAA;AAC7D,IAAA,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACd,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,GAAG,IAAI,CAAA;AACd,QAAA,MAAM,OAAO,CAAC,OAAO,EAAE,CAAA;QACvB,OAAO,GAAG,KAAK,CAAA;AACf,QAAA,MAAM,OAAO,GAAG,CAAC,GAAG,MAAM,CAAC,CAAA;QAC3B,MAAM,GAAG,EAAE,CACV;QAAA,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;AAC1D,KAAA;AACH,CAAC;AAED,eAAe,qBAAqB,CAClC,cAAsB,EACtB,WAAmB,EACnB,EAAE,GAAG,IAAI,EAAA;AAET,IAAA,MAAM,gBAAgB,GAAG,cAAc,KAAK,KAAK,GAAG,OAAO,GAAG,MAAM,CAAA;AAEpE,IAAA,MAAM,IAAI,GAAG,YAAW;;;;QAItB,IAAI;AACF,YAAA,MAAM,KAAK,CAAC,CAAA,EAAG,gBAAgB,CAAM,GAAA,EAAA,WAAW,EAAE,EAAE;AAClD,gBAAA,IAAI,EAAE,SAAS;AACf,gBAAA,OAAO,EAAE;;;AAGP,oBAAA,MAAM,EAAE,kBAAkB;AAC3B,iBAAA;AACF,aAAA,CAAC,CAAA;AACF,YAAA,OAAO,IAAI,CAAA;AACZ,SAAA;AAAC,QAAA,MAAM,GAAE;AACV,QAAA,OAAO,KAAK,CAAA;AACd,KAAC,CAAA;IAED,IAAI,MAAM,IAAI,EAAE,EAAE;QAChB,OAAM;AACP,KAAA;AACD,IAAA,MAAM,IAAI,CAAC,EAAE,CAAC,CAAA;;AAGd,IAAA,OAAO,IAAI,EAAE;AACX,QAAA,IAAI,QAAQ,CAAC,eAAe,KAAK,SAAS,EAAE;YAC1C,IAAI,MAAM,IAAI,EAAE,EAAE;gBAChB,MAAK;AACN,aAAA;AACD,YAAA,MAAM,IAAI,CAAC,EAAE,CAAC,CAAA;AACf,SAAA;AAAM,aAAA;YACL,MAAM,iBAAiB,EAAE,CAAA;AAC1B,SAAA;AACF,KAAA;AACH,CAAC;AAED,SAAS,IAAI,CAAC,EAAU,EAAA;AACtB,IAAA,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAC1D,CAAC;AAED,SAAS,iBAAiB,GAAA;AACxB,IAAA,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,KAAI;AACnC,QAAA,MAAM,QAAQ,GAAG,YAAW;AAC1B,YAAA,IAAI,QAAQ,CAAC,eAAe,KAAK,SAAS,EAAE;AAC1C,gBAAA,OAAO,EAAE,CAAA;AACT,gBAAA,QAAQ,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAA;AAC3D,aAAA;AACH,SAAC,CAAA;AACD,QAAA,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAA;AACzD,KAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,SAAS,GAAG,IAAI,GAAG,EAA4B,CAAA;AAErD;AACA;AACA,IAAI,UAAU,IAAI,UAAU,EAAE;IAC5B,QAAQ,CAAC,gBAAgB,CAAC,yBAAyB,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,KAAI;AAClE,QAAA,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,kBAAkB,CAAE,EAAE,EAAsB,CAAC,CAAA;AAC7E,KAAC,CAAC,CAAA;AACH,CAAA;AAED;AACA;AACA,IAAI,iBAA+C,CAAA;AAEnC,SAAA,WAAW,CAAC,EAAU,EAAE,OAAe,EAAA;IACrD,IAAI,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC7B,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;AACvC,QAAA,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AACtC,QAAA,KAAK,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAA;AAC1C,QAAA,KAAK,CAAC,WAAW,GAAG,OAAO,CAAA;QAE3B,IAAI,CAAC,iBAAiB,EAAE;AACtB,YAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;;;YAIhC,UAAU,CAAC,MAAK;gBACd,iBAAiB,GAAG,SAAS,CAAA;aAC9B,EAAE,CAAC,CAAC,CAAA;AACN,SAAA;AAAM,aAAA;AACL,YAAA,iBAAiB,CAAC,qBAAqB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;AAC3D,SAAA;QACD,iBAAiB,GAAG,KAAK,CAAA;AAC1B,KAAA;AAAM,SAAA;AACL,QAAA,KAAK,CAAC,WAAW,GAAG,OAAO,CAAA;AAC5B,KAAA;AACD,IAAA,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAEK,SAAU,WAAW,CAAC,EAAU,EAAA;IACpC,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AAC/B,IAAA,IAAI,KAAK,EAAE;AACT,QAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;AAChC,QAAA,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AACrB,KAAA;AACH,CAAC;AAED,eAAe,WAAW,CAAC,EACzB,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,sBAAsB,GACf,EAAA;IACP,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACnC,IAAI,CAAC,GAAG,EAAE;;;;QAIR,OAAM;AACP,KAAA;AAED,IAAA,IAAI,aAA0C,CAAA;AAC9C,IAAA,MAAM,YAAY,GAAG,IAAI,KAAK,YAAY,CAAA;;IAG1C,MAAM,kBAAkB,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,KACvD,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAC5B,CAAA;AAED,IAAA,IAAI,YAAY,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;QACjD,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;AAC7C,QAAA,IAAI,QAAQ;YAAE,MAAM,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAA;AACvD,QAAA,MAAM,CAAC,wBAAwB,EAAE,KAAK,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAG,CAAA,CAAA,CAAC,CAAA;QACjE,IAAI;YACF,aAAa,GAAG,MAAM;;YAEpB,IAAI;AACF,gBAAA,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC;gBACjC,CAAI,CAAA,EAAA,sBAAsB,GAAG,SAAS,GAAG,EAAE,CAAA,EAAA,EAAK,SAAS,CAAA,EACvD,KAAK,GAAG,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,GAAG,EACxB,CAAE,CAAA,CACL,CAAA;AACF,SAAA;AAAC,QAAA,OAAO,CAAC,EAAE;AACV,YAAA,eAAe,CAAC,CAAC,EAAE,YAAY,CAAC,CAAA;AACjC,SAAA;AACF,KAAA;AAED,IAAA,OAAO,MAAK;QACV,KAAK,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,kBAAkB,EAAE;YAC7C,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,YAAY,GAAG,aAAa,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;AAC1E,SAAA;AACD,QAAA,MAAM,UAAU,GAAG,YAAY,GAAG,IAAI,GAAG,CAAG,EAAA,YAAY,CAAQ,KAAA,EAAA,IAAI,EAAE,CAAA;AACtE,QAAA,OAAO,CAAC,KAAK,CAAC,uBAAuB,UAAU,CAAA,CAAE,CAAC,CAAA;AACpD,KAAC,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,GAAA;AACxB,IAAA,IAAI,MAAM,CAAC,UAAU,KAAK,CAAC,EAAE;AAC3B,QAAA,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAChD,QAAA,aAAa,CAAC,MAAM,GAAG,CAAC,CAAA;AACzB,KAAA;AACH,CAAC;AAeD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAqB,CAAA;AAClD,MAAM,UAAU,GAAG,IAAI,GAAG,EAA+C,CAAA;AACzE,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA+C,CAAA;AACvE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAe,CAAA;AACtC,MAAM,kBAAkB,GAAuB,IAAI,GAAG,EAAE,CAAA;AACxD,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAA8B,CAAA;AAEzD,SAAU,gBAAgB,CAAC,SAAiB,EAAA;AAChD,IAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;AAC3B,QAAA,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;AAC3B,KAAA;;;IAID,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AACxC,IAAA,IAAI,GAAG,EAAE;AACP,QAAA,GAAG,CAAC,SAAS,GAAG,EAAE,CAAA;AACnB,KAAA;;IAGD,MAAM,cAAc,GAAG,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AACvD,IAAA,IAAI,cAAc,EAAE;QAClB,KAAK,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,cAAc,EAAE;YAC9C,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AAC/C,YAAA,IAAI,SAAS,EAAE;gBACb,kBAAkB,CAAC,GAAG,CACpB,KAAK,EACL,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAC/C,CAAA;AACF,aAAA;AACF,SAAA;AACF,KAAA;AAED,IAAA,MAAM,YAAY,GAAuB,IAAI,GAAG,EAAE,CAAA;AAClD,IAAA,iBAAiB,CAAC,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,CAAA;IAE9C,SAAS,UAAU,CAAC,IAAc,EAAE,WAA8B,SAAQ,EAAA;QACxE,MAAM,GAAG,GAAc,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI;AACrD,YAAA,EAAE,EAAE,SAAS;AACb,YAAA,SAAS,EAAE,EAAE;SACd,CAAA;AACD,QAAA,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;YACjB,IAAI;AACJ,YAAA,EAAE,EAAE,QAAQ;AACb,SAAA,CAAC,CAAA;AACF,QAAA,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;KAClC;AAED,IAAA,MAAM,GAAG,GAAmB;AAC1B,QAAA,IAAI,IAAI,GAAA;AACN,YAAA,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;SAC9B;QAED,MAAM,CAAC,IAAU,EAAE,QAAc,EAAA;AAC/B,YAAA,IAAI,OAAO,IAAI,KAAK,UAAU,IAAI,CAAC,IAAI,EAAE;;gBAEvC,UAAU,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,aAAJ,IAAI,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAJ,IAAI,CAAG,GAAG,CAAC,CAAC,CAAA;AAChD,aAAA;AAAM,iBAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;;gBAEnC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,QAAQ,aAAR,QAAQ,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAR,QAAQ,CAAG,GAAG,CAAC,CAAC,CAAA;AAC/C,aAAA;AAAM,iBAAA,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;AAC9B,gBAAA,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAC3B,aAAA;AAAM,iBAAA;AACL,gBAAA,MAAM,IAAI,KAAK,CAAC,CAAA,2BAAA,CAA6B,CAAC,CAAA;AAC/C,aAAA;SACF;;;QAID,aAAa,CAAC,CAAC,EAAE,QAAQ,EAAA;YACvB,UAAU,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,QAAQ,aAAR,QAAQ,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAR,QAAQ,CAAG,GAAG,CAAC,CAAC,CAAA;SACpD;AAED,QAAA,OAAO,CAAC,EAAE,EAAA;AACR,YAAA,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;SAC9B;AAED,QAAA,KAAK,CAAC,EAAE,EAAA;AACN,YAAA,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;SAC5B;;;;AAKD,QAAA,OAAO,MAAK;;AAGZ,QAAA,UAAU,CAAC,OAAO,EAAA;YAChB,eAAe,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAA;AAChE,YAAA,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAA;AAC1D,YAAA,OAAO,CAAC,KAAK,CACX,qBAAqB,SAAS,CAAA,EAAG,OAAO,GAAG,CAAK,EAAA,EAAA,OAAO,EAAE,GAAG,EAAE,CAAA,CAAE,CACjE,CAAA;SACF;;QAGD,EAAE,CAAC,KAAK,EAAE,EAAE,EAAA;AACV,YAAA,MAAM,QAAQ,GAAG,CAAC,GAAuB,KAAI;gBAC3C,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;AACrC,gBAAA,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACjB,gBAAA,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AAC1B,aAAC,CAAA;YACD,QAAQ,CAAC,kBAAkB,CAAC,CAAA;YAC5B,QAAQ,CAAC,YAAY,CAAC,CAAA;SACvB;QAED,IAAI,CAAC,KAAK,EAAE,IAAI,EAAA;AACd,YAAA,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AACnE,YAAA,iBAAiB,EAAE,CAAA;SACpB;KACF,CAAA;AAED,IAAA,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;AAEG;AACa,SAAA,WAAW,CAAC,GAAW,EAAE,aAAqB,EAAA;;AAE5D,IAAA,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;AACpC,QAAA,OAAO,GAAG,CAAA;AACX,KAAA;;AAGD,IAAA,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;AAC7D,IAAA,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAA;IAE1D,OAAO,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,aAAa,CAAA,EAAG,MAAM,GAAG,CAAG,CAAA,CAAA,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA,EACvE,IAAI,IAAI,EACV,CAAA,CAAE,CAAA;AACJ;;;;","x_google_ignoreList":[0,1]}
\ No newline at end of file
diff --git a/node_modules/vite/dist/client/env.mjs b/node_modules/vite/dist/client/env.mjs
new file mode 100644
index 0000000..1b3a7d2
--- /dev/null
+++ b/node_modules/vite/dist/client/env.mjs
@@ -0,0 +1,30 @@
+const context = (() => {
+ if (typeof globalThis !== 'undefined') {
+ return globalThis;
+ }
+ else if (typeof self !== 'undefined') {
+ return self;
+ }
+ else if (typeof window !== 'undefined') {
+ return window;
+ }
+ else {
+ return Function('return this')();
+ }
+})();
+// assign defines
+const defines = __DEFINES__;
+Object.keys(defines).forEach((key) => {
+ const segments = key.split('.');
+ let target = context;
+ for (let i = 0; i < segments.length; i++) {
+ const segment = segments[i];
+ if (i === segments.length - 1) {
+ target[segment] = defines[key];
+ }
+ else {
+ target = target[segment] || (target[segment] = {});
+ }
+ }
+});
+//# sourceMappingURL=env.mjs.map
diff --git a/node_modules/vite/dist/client/env.mjs.map b/node_modules/vite/dist/client/env.mjs.map
new file mode 100644
index 0000000..95e027d
--- /dev/null
+++ b/node_modules/vite/dist/client/env.mjs.map
@@ -0,0 +1 @@
+{"version":3,"file":"env.mjs","sources":["env.ts"],"sourcesContent":["declare const __MODE__: string\ndeclare const __DEFINES__: Record\n\nconst context = (() => {\n if (typeof globalThis !== 'undefined') {\n return globalThis\n } else if (typeof self !== 'undefined') {\n return self\n } else if (typeof window !== 'undefined') {\n return window\n } else {\n return Function('return this')()\n }\n})()\n\n// assign defines\nconst defines = __DEFINES__\nObject.keys(defines).forEach((key) => {\n const segments = key.split('.')\n let target = context\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i]\n if (i === segments.length - 1) {\n target[segment] = defines[key]\n } else {\n target = target[segment] || (target[segment] = {})\n }\n }\n})\n"],"names":[],"mappings":"AAGA,MAAM,OAAO,GAAG,CAAC,MAAK;AACpB,IAAA,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE;AACrC,QAAA,OAAO,UAAU,CAAA;AAClB,KAAA;AAAM,SAAA,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;AACtC,QAAA,OAAO,IAAI,CAAA;AACZ,KAAA;AAAM,SAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACxC,QAAA,OAAO,MAAM,CAAA;AACd,KAAA;AAAM,SAAA;AACL,QAAA,OAAO,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAA;AACjC,KAAA;AACH,CAAC,GAAG,CAAA;AAEJ;AACA,MAAM,OAAO,GAAG,WAAW,CAAA;AAC3B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,KAAI;IACnC,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC/B,IAAI,MAAM,GAAG,OAAO,CAAA;AACpB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACxC,QAAA,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;AAC3B,QAAA,IAAI,CAAC,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YAC7B,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;AAC/B,SAAA;AAAM,aAAA;AACL,YAAA,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;AACnD,SAAA;AACF,KAAA;AACH,CAAC,CAAC","x_google_ignoreList":[0]}
\ No newline at end of file
diff --git a/node_modules/vite/dist/node-cjs/publicUtils.cjs b/node_modules/vite/dist/node-cjs/publicUtils.cjs
new file mode 100644
index 0000000..fd7d609
--- /dev/null
+++ b/node_modules/vite/dist/node-cjs/publicUtils.cjs
@@ -0,0 +1,4516 @@
+'use strict';
+
+var path$3 = require('node:path');
+var node_url = require('node:url');
+var fs$1 = require('node:fs');
+var esbuild = require('esbuild');
+var rollup = require('rollup');
+var os$1 = require('node:os');
+var node_module = require('node:module');
+var require$$0 = require('tty');
+var require$$1 = require('util');
+var require$$0$1 = require('path');
+var require$$0$2 = require('crypto');
+var fs$2 = require('fs');
+var readline = require('node:readline');
+var require$$2 = require('os');
+
+const { version: version$2 } = JSON.parse(fs$1.readFileSync(new URL('../../package.json', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)))).toString());
+const VERSION = version$2;
+/**
+ * Prefix for resolved fs paths, since windows paths may not be valid as URLs.
+ */
+const FS_PREFIX = `/@fs/`;
+const VITE_PACKAGE_DIR = path$3.resolve(
+// import.meta.url is `dist/node/constants.js` after bundle
+node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href))), '../../..');
+const CLIENT_ENTRY = path$3.resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
+path$3.resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
+path$3.dirname(CLIENT_ENTRY);
+
+const chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+const intToChar$1 = new Uint8Array(64); // 64 possible chars.
+const charToInt$1 = new Uint8Array(128); // z is 122 in ASCII
+for (let i = 0; i < chars$1.length; i++) {
+ const c = chars$1.charCodeAt(i);
+ intToChar$1[i] = c;
+ charToInt$1[c] = i;
+}
+
+// Matches the scheme of a URL, eg "http://"
+var UrlType;
+(function (UrlType) {
+ UrlType[UrlType["Empty"] = 1] = "Empty";
+ UrlType[UrlType["Hash"] = 2] = "Hash";
+ UrlType[UrlType["Query"] = 3] = "Query";
+ UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
+ UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
+ UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
+ UrlType[UrlType["Absolute"] = 7] = "Absolute";
+})(UrlType || (UrlType = {}));
+
+const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+const intToChar = new Uint8Array(64); // 64 possible chars.
+const charToInt = new Uint8Array(128); // z is 122 in ASCII
+for (let i = 0; i < chars.length; i++) {
+ const c = chars.charCodeAt(i);
+ intToChar[i] = c;
+ charToInt[c] = i;
+}
+
+function getDefaultExportFromCjs (x) {
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
+}
+
+var picocolors = {exports: {}};
+
+let tty = require$$0;
+
+let isColorSupported =
+ !("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
+ ("FORCE_COLOR" in process.env ||
+ process.argv.includes("--color") ||
+ process.platform === "win32" ||
+ (tty.isatty(1) && process.env.TERM !== "dumb") ||
+ "CI" in process.env);
+
+let formatter =
+ (open, close, replace = open) =>
+ input => {
+ let string = "" + input;
+ let index = string.indexOf(close, open.length);
+ return ~index
+ ? open + replaceClose(string, close, replace, index) + close
+ : open + string + close
+ };
+
+let replaceClose = (string, close, replace, index) => {
+ let start = string.substring(0, index) + replace;
+ let end = string.substring(index + close.length);
+ let nextIndex = end.indexOf(close);
+ return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
+};
+
+let createColors = (enabled = isColorSupported) => ({
+ isColorSupported: enabled,
+ reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
+ bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
+ dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
+ italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
+ underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
+ inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
+ hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
+ strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
+ black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
+ red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
+ green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
+ yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
+ blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
+ magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
+ cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
+ white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
+ gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
+ bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
+ bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
+ bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
+ bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
+ bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
+ bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
+ bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
+ bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
+});
+
+picocolors.exports = createColors();
+picocolors.exports.createColors = createColors;
+
+var picocolorsExports = picocolors.exports;
+var colors = /*@__PURE__*/getDefaultExportFromCjs(picocolorsExports);
+
+var src = {exports: {}};
+
+var browser$1 = {exports: {}};
+
+/**
+ * Helpers.
+ */
+
+var ms;
+var hasRequiredMs;
+
+function requireMs () {
+ if (hasRequiredMs) return ms;
+ hasRequiredMs = 1;
+ var s = 1000;
+ var m = s * 60;
+ var h = m * 60;
+ var d = h * 24;
+ var w = d * 7;
+ var y = d * 365.25;
+
+ /**
+ * Parse or format the given `val`.
+ *
+ * Options:
+ *
+ * - `long` verbose formatting [false]
+ *
+ * @param {String|Number} val
+ * @param {Object} [options]
+ * @throws {Error} throw an error if val is not a non-empty string or a number
+ * @return {String|Number}
+ * @api public
+ */
+
+ ms = function(val, options) {
+ options = options || {};
+ var type = typeof val;
+ if (type === 'string' && val.length > 0) {
+ return parse(val);
+ } else if (type === 'number' && isFinite(val)) {
+ return options.long ? fmtLong(val) : fmtShort(val);
+ }
+ throw new Error(
+ 'val is not a non-empty string or a valid number. val=' +
+ JSON.stringify(val)
+ );
+ };
+
+ /**
+ * Parse the given `str` and return milliseconds.
+ *
+ * @param {String} str
+ * @return {Number}
+ * @api private
+ */
+
+ function parse(str) {
+ str = String(str);
+ if (str.length > 100) {
+ return;
+ }
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
+ str
+ );
+ if (!match) {
+ return;
+ }
+ var n = parseFloat(match[1]);
+ var type = (match[2] || 'ms').toLowerCase();
+ switch (type) {
+ case 'years':
+ case 'year':
+ case 'yrs':
+ case 'yr':
+ case 'y':
+ return n * y;
+ case 'weeks':
+ case 'week':
+ case 'w':
+ return n * w;
+ case 'days':
+ case 'day':
+ case 'd':
+ return n * d;
+ case 'hours':
+ case 'hour':
+ case 'hrs':
+ case 'hr':
+ case 'h':
+ return n * h;
+ case 'minutes':
+ case 'minute':
+ case 'mins':
+ case 'min':
+ case 'm':
+ return n * m;
+ case 'seconds':
+ case 'second':
+ case 'secs':
+ case 'sec':
+ case 's':
+ return n * s;
+ case 'milliseconds':
+ case 'millisecond':
+ case 'msecs':
+ case 'msec':
+ case 'ms':
+ return n;
+ default:
+ return undefined;
+ }
+ }
+
+ /**
+ * Short format for `ms`.
+ *
+ * @param {Number} ms
+ * @return {String}
+ * @api private
+ */
+
+ function fmtShort(ms) {
+ var msAbs = Math.abs(ms);
+ if (msAbs >= d) {
+ return Math.round(ms / d) + 'd';
+ }
+ if (msAbs >= h) {
+ return Math.round(ms / h) + 'h';
+ }
+ if (msAbs >= m) {
+ return Math.round(ms / m) + 'm';
+ }
+ if (msAbs >= s) {
+ return Math.round(ms / s) + 's';
+ }
+ return ms + 'ms';
+ }
+
+ /**
+ * Long format for `ms`.
+ *
+ * @param {Number} ms
+ * @return {String}
+ * @api private
+ */
+
+ function fmtLong(ms) {
+ var msAbs = Math.abs(ms);
+ if (msAbs >= d) {
+ return plural(ms, msAbs, d, 'day');
+ }
+ if (msAbs >= h) {
+ return plural(ms, msAbs, h, 'hour');
+ }
+ if (msAbs >= m) {
+ return plural(ms, msAbs, m, 'minute');
+ }
+ if (msAbs >= s) {
+ return plural(ms, msAbs, s, 'second');
+ }
+ return ms + ' ms';
+ }
+
+ /**
+ * Pluralization helper.
+ */
+
+ function plural(ms, msAbs, n, name) {
+ var isPlural = msAbs >= n * 1.5;
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
+ }
+ return ms;
+}
+
+var common;
+var hasRequiredCommon;
+
+function requireCommon () {
+ if (hasRequiredCommon) return common;
+ hasRequiredCommon = 1;
+ /**
+ * This is the common logic for both the Node.js and web browser
+ * implementations of `debug()`.
+ */
+
+ function setup(env) {
+ createDebug.debug = createDebug;
+ createDebug.default = createDebug;
+ createDebug.coerce = coerce;
+ createDebug.disable = disable;
+ createDebug.enable = enable;
+ createDebug.enabled = enabled;
+ createDebug.humanize = requireMs();
+ createDebug.destroy = destroy;
+
+ Object.keys(env).forEach(key => {
+ createDebug[key] = env[key];
+ });
+
+ /**
+ * The currently active debug mode names, and names to skip.
+ */
+
+ createDebug.names = [];
+ createDebug.skips = [];
+
+ /**
+ * Map of special "%n" handling functions, for the debug "format" argument.
+ *
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
+ */
+ createDebug.formatters = {};
+
+ /**
+ * Selects a color for a debug namespace
+ * @param {String} namespace The namespace string for the debug instance to be colored
+ * @return {Number|String} An ANSI color code for the given namespace
+ * @api private
+ */
+ function selectColor(namespace) {
+ let hash = 0;
+
+ for (let i = 0; i < namespace.length; i++) {
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
+ hash |= 0; // Convert to 32bit integer
+ }
+
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
+ }
+ createDebug.selectColor = selectColor;
+
+ /**
+ * Create a debugger with the given `namespace`.
+ *
+ * @param {String} namespace
+ * @return {Function}
+ * @api public
+ */
+ function createDebug(namespace) {
+ let prevTime;
+ let enableOverride = null;
+ let namespacesCache;
+ let enabledCache;
+
+ function debug(...args) {
+ // Disabled?
+ if (!debug.enabled) {
+ return;
+ }
+
+ const self = debug;
+
+ // Set `diff` timestamp
+ const curr = Number(new Date());
+ const ms = curr - (prevTime || curr);
+ self.diff = ms;
+ self.prev = prevTime;
+ self.curr = curr;
+ prevTime = curr;
+
+ args[0] = createDebug.coerce(args[0]);
+
+ if (typeof args[0] !== 'string') {
+ // Anything else let's inspect with %O
+ args.unshift('%O');
+ }
+
+ // Apply any `formatters` transformations
+ let index = 0;
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
+ // If we encounter an escaped % then don't increase the array index
+ if (match === '%%') {
+ return '%';
+ }
+ index++;
+ const formatter = createDebug.formatters[format];
+ if (typeof formatter === 'function') {
+ const val = args[index];
+ match = formatter.call(self, val);
+
+ // Now we need to remove `args[index]` since it's inlined in the `format`
+ args.splice(index, 1);
+ index--;
+ }
+ return match;
+ });
+
+ // Apply env-specific formatting (colors, etc.)
+ createDebug.formatArgs.call(self, args);
+
+ const logFn = self.log || createDebug.log;
+ logFn.apply(self, args);
+ }
+
+ debug.namespace = namespace;
+ debug.useColors = createDebug.useColors();
+ debug.color = createDebug.selectColor(namespace);
+ debug.extend = extend;
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
+
+ Object.defineProperty(debug, 'enabled', {
+ enumerable: true,
+ configurable: false,
+ get: () => {
+ if (enableOverride !== null) {
+ return enableOverride;
+ }
+ if (namespacesCache !== createDebug.namespaces) {
+ namespacesCache = createDebug.namespaces;
+ enabledCache = createDebug.enabled(namespace);
+ }
+
+ return enabledCache;
+ },
+ set: v => {
+ enableOverride = v;
+ }
+ });
+
+ // Env-specific initialization logic for debug instances
+ if (typeof createDebug.init === 'function') {
+ createDebug.init(debug);
+ }
+
+ return debug;
+ }
+
+ function extend(namespace, delimiter) {
+ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
+ newDebug.log = this.log;
+ return newDebug;
+ }
+
+ /**
+ * Enables a debug mode by namespaces. This can include modes
+ * separated by a colon and wildcards.
+ *
+ * @param {String} namespaces
+ * @api public
+ */
+ function enable(namespaces) {
+ createDebug.save(namespaces);
+ createDebug.namespaces = namespaces;
+
+ createDebug.names = [];
+ createDebug.skips = [];
+
+ let i;
+ const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
+ const len = split.length;
+
+ for (i = 0; i < len; i++) {
+ if (!split[i]) {
+ // ignore empty strings
+ continue;
+ }
+
+ namespaces = split[i].replace(/\*/g, '.*?');
+
+ if (namespaces[0] === '-') {
+ createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
+ } else {
+ createDebug.names.push(new RegExp('^' + namespaces + '$'));
+ }
+ }
+ }
+
+ /**
+ * Disable debug output.
+ *
+ * @return {String} namespaces
+ * @api public
+ */
+ function disable() {
+ const namespaces = [
+ ...createDebug.names.map(toNamespace),
+ ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
+ ].join(',');
+ createDebug.enable('');
+ return namespaces;
+ }
+
+ /**
+ * Returns true if the given mode name is enabled, false otherwise.
+ *
+ * @param {String} name
+ * @return {Boolean}
+ * @api public
+ */
+ function enabled(name) {
+ if (name[name.length - 1] === '*') {
+ return true;
+ }
+
+ let i;
+ let len;
+
+ for (i = 0, len = createDebug.skips.length; i < len; i++) {
+ if (createDebug.skips[i].test(name)) {
+ return false;
+ }
+ }
+
+ for (i = 0, len = createDebug.names.length; i < len; i++) {
+ if (createDebug.names[i].test(name)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Convert regexp to namespace
+ *
+ * @param {RegExp} regxep
+ * @return {String} namespace
+ * @api private
+ */
+ function toNamespace(regexp) {
+ return regexp.toString()
+ .substring(2, regexp.toString().length - 2)
+ .replace(/\.\*\?$/, '*');
+ }
+
+ /**
+ * Coerce `val`.
+ *
+ * @param {Mixed} val
+ * @return {Mixed}
+ * @api private
+ */
+ function coerce(val) {
+ if (val instanceof Error) {
+ return val.stack || val.message;
+ }
+ return val;
+ }
+
+ /**
+ * XXX DO NOT USE. This is a temporary stub function.
+ * XXX It WILL be removed in the next major release.
+ */
+ function destroy() {
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
+ }
+
+ createDebug.enable(createDebug.load());
+
+ return createDebug;
+ }
+
+ common = setup;
+ return common;
+}
+
+/* eslint-env browser */
+
+var hasRequiredBrowser;
+
+function requireBrowser () {
+ if (hasRequiredBrowser) return browser$1.exports;
+ hasRequiredBrowser = 1;
+ (function (module, exports) {
+ /**
+ * This is the web browser implementation of `debug()`.
+ */
+
+ exports.formatArgs = formatArgs;
+ exports.save = save;
+ exports.load = load;
+ exports.useColors = useColors;
+ exports.storage = localstorage();
+ exports.destroy = (() => {
+ let warned = false;
+
+ return () => {
+ if (!warned) {
+ warned = true;
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
+ }
+ };
+ })();
+
+ /**
+ * Colors.
+ */
+
+ exports.colors = [
+ '#0000CC',
+ '#0000FF',
+ '#0033CC',
+ '#0033FF',
+ '#0066CC',
+ '#0066FF',
+ '#0099CC',
+ '#0099FF',
+ '#00CC00',
+ '#00CC33',
+ '#00CC66',
+ '#00CC99',
+ '#00CCCC',
+ '#00CCFF',
+ '#3300CC',
+ '#3300FF',
+ '#3333CC',
+ '#3333FF',
+ '#3366CC',
+ '#3366FF',
+ '#3399CC',
+ '#3399FF',
+ '#33CC00',
+ '#33CC33',
+ '#33CC66',
+ '#33CC99',
+ '#33CCCC',
+ '#33CCFF',
+ '#6600CC',
+ '#6600FF',
+ '#6633CC',
+ '#6633FF',
+ '#66CC00',
+ '#66CC33',
+ '#9900CC',
+ '#9900FF',
+ '#9933CC',
+ '#9933FF',
+ '#99CC00',
+ '#99CC33',
+ '#CC0000',
+ '#CC0033',
+ '#CC0066',
+ '#CC0099',
+ '#CC00CC',
+ '#CC00FF',
+ '#CC3300',
+ '#CC3333',
+ '#CC3366',
+ '#CC3399',
+ '#CC33CC',
+ '#CC33FF',
+ '#CC6600',
+ '#CC6633',
+ '#CC9900',
+ '#CC9933',
+ '#CCCC00',
+ '#CCCC33',
+ '#FF0000',
+ '#FF0033',
+ '#FF0066',
+ '#FF0099',
+ '#FF00CC',
+ '#FF00FF',
+ '#FF3300',
+ '#FF3333',
+ '#FF3366',
+ '#FF3399',
+ '#FF33CC',
+ '#FF33FF',
+ '#FF6600',
+ '#FF6633',
+ '#FF9900',
+ '#FF9933',
+ '#FFCC00',
+ '#FFCC33'
+ ];
+
+ /**
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
+ * and the Firebug extension (any Firefox version) are known
+ * to support "%c" CSS customizations.
+ *
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
+ */
+
+ // eslint-disable-next-line complexity
+ function useColors() {
+ // NB: In an Electron preload script, document will be defined but not fully
+ // initialized. Since we know we're in Chrome, we'll just detect this case
+ // explicitly
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
+ return true;
+ }
+
+ // Internet Explorer and Edge do not support colors.
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
+ return false;
+ }
+
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
+ // Is firebug? http://stackoverflow.com/a/398120/376773
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
+ // Is firefox >= v31?
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
+ // Double check webkit in userAgent just in case we are in a worker
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
+ }
+
+ /**
+ * Colorize log arguments if enabled.
+ *
+ * @api public
+ */
+
+ function formatArgs(args) {
+ args[0] = (this.useColors ? '%c' : '') +
+ this.namespace +
+ (this.useColors ? ' %c' : ' ') +
+ args[0] +
+ (this.useColors ? '%c ' : ' ') +
+ '+' + module.exports.humanize(this.diff);
+
+ if (!this.useColors) {
+ return;
+ }
+
+ const c = 'color: ' + this.color;
+ args.splice(1, 0, c, 'color: inherit');
+
+ // The final "%c" is somewhat tricky, because there could be other
+ // arguments passed either before or after the %c, so we need to
+ // figure out the correct index to insert the CSS into
+ let index = 0;
+ let lastC = 0;
+ args[0].replace(/%[a-zA-Z%]/g, match => {
+ if (match === '%%') {
+ return;
+ }
+ index++;
+ if (match === '%c') {
+ // We only are interested in the *last* %c
+ // (the user may have provided their own)
+ lastC = index;
+ }
+ });
+
+ args.splice(lastC, 0, c);
+ }
+
+ /**
+ * Invokes `console.debug()` when available.
+ * No-op when `console.debug` is not a "function".
+ * If `console.debug` is not available, falls back
+ * to `console.log`.
+ *
+ * @api public
+ */
+ exports.log = console.debug || console.log || (() => {});
+
+ /**
+ * Save `namespaces`.
+ *
+ * @param {String} namespaces
+ * @api private
+ */
+ function save(namespaces) {
+ try {
+ if (namespaces) {
+ exports.storage.setItem('debug', namespaces);
+ } else {
+ exports.storage.removeItem('debug');
+ }
+ } catch (error) {
+ // Swallow
+ // XXX (@Qix-) should we be logging these?
+ }
+ }
+
+ /**
+ * Load `namespaces`.
+ *
+ * @return {String} returns the previously persisted debug modes
+ * @api private
+ */
+ function load() {
+ let r;
+ try {
+ r = exports.storage.getItem('debug');
+ } catch (error) {
+ // Swallow
+ // XXX (@Qix-) should we be logging these?
+ }
+
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
+ r = process.env.DEBUG;
+ }
+
+ return r;
+ }
+
+ /**
+ * Localstorage attempts to return the localstorage.
+ *
+ * This is necessary because safari throws
+ * when a user disables cookies/localstorage
+ * and you attempt to access it.
+ *
+ * @return {LocalStorage}
+ * @api private
+ */
+
+ function localstorage() {
+ try {
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
+ // The Browser also has localStorage in the global context.
+ return localStorage;
+ } catch (error) {
+ // Swallow
+ // XXX (@Qix-) should we be logging these?
+ }
+ }
+
+ module.exports = requireCommon()(exports);
+
+ const {formatters} = module.exports;
+
+ /**
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
+ */
+
+ formatters.j = function (v) {
+ try {
+ return JSON.stringify(v);
+ } catch (error) {
+ return '[UnexpectedJSONParseError]: ' + error.message;
+ }
+ };
+ } (browser$1, browser$1.exports));
+ return browser$1.exports;
+}
+
+var node = {exports: {}};
+
+/**
+ * Module dependencies.
+ */
+
+var hasRequiredNode;
+
+function requireNode () {
+ if (hasRequiredNode) return node.exports;
+ hasRequiredNode = 1;
+ (function (module, exports) {
+ const tty = require$$0;
+ const util = require$$1;
+
+ /**
+ * This is the Node.js implementation of `debug()`.
+ */
+
+ exports.init = init;
+ exports.log = log;
+ exports.formatArgs = formatArgs;
+ exports.save = save;
+ exports.load = load;
+ exports.useColors = useColors;
+ exports.destroy = util.deprecate(
+ () => {},
+ 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
+ );
+
+ /**
+ * Colors.
+ */
+
+ exports.colors = [6, 2, 3, 4, 5, 1];
+
+ try {
+ // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
+ // eslint-disable-next-line import/no-extraneous-dependencies
+ const supportsColor = require('supports-color');
+
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
+ exports.colors = [
+ 20,
+ 21,
+ 26,
+ 27,
+ 32,
+ 33,
+ 38,
+ 39,
+ 40,
+ 41,
+ 42,
+ 43,
+ 44,
+ 45,
+ 56,
+ 57,
+ 62,
+ 63,
+ 68,
+ 69,
+ 74,
+ 75,
+ 76,
+ 77,
+ 78,
+ 79,
+ 80,
+ 81,
+ 92,
+ 93,
+ 98,
+ 99,
+ 112,
+ 113,
+ 128,
+ 129,
+ 134,
+ 135,
+ 148,
+ 149,
+ 160,
+ 161,
+ 162,
+ 163,
+ 164,
+ 165,
+ 166,
+ 167,
+ 168,
+ 169,
+ 170,
+ 171,
+ 172,
+ 173,
+ 178,
+ 179,
+ 184,
+ 185,
+ 196,
+ 197,
+ 198,
+ 199,
+ 200,
+ 201,
+ 202,
+ 203,
+ 204,
+ 205,
+ 206,
+ 207,
+ 208,
+ 209,
+ 214,
+ 215,
+ 220,
+ 221
+ ];
+ }
+ } catch (error) {
+ // Swallow - we only care if `supports-color` is available; it doesn't have to be.
+ }
+
+ /**
+ * Build up the default `inspectOpts` object from the environment variables.
+ *
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
+ */
+
+ exports.inspectOpts = Object.keys(process.env).filter(key => {
+ return /^debug_/i.test(key);
+ }).reduce((obj, key) => {
+ // Camel-case
+ const prop = key
+ .substring(6)
+ .toLowerCase()
+ .replace(/_([a-z])/g, (_, k) => {
+ return k.toUpperCase();
+ });
+
+ // Coerce string value into JS value
+ let val = process.env[key];
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
+ val = true;
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
+ val = false;
+ } else if (val === 'null') {
+ val = null;
+ } else {
+ val = Number(val);
+ }
+
+ obj[prop] = val;
+ return obj;
+ }, {});
+
+ /**
+ * Is stdout a TTY? Colored output is enabled when `true`.
+ */
+
+ function useColors() {
+ return 'colors' in exports.inspectOpts ?
+ Boolean(exports.inspectOpts.colors) :
+ tty.isatty(process.stderr.fd);
+ }
+
+ /**
+ * Adds ANSI color escape codes if enabled.
+ *
+ * @api public
+ */
+
+ function formatArgs(args) {
+ const {namespace: name, useColors} = this;
+
+ if (useColors) {
+ const c = this.color;
+ const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
+
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
+ args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
+ } else {
+ args[0] = getDate() + name + ' ' + args[0];
+ }
+ }
+
+ function getDate() {
+ if (exports.inspectOpts.hideDate) {
+ return '';
+ }
+ return new Date().toISOString() + ' ';
+ }
+
+ /**
+ * Invokes `util.format()` with the specified arguments and writes to stderr.
+ */
+
+ function log(...args) {
+ return process.stderr.write(util.format(...args) + '\n');
+ }
+
+ /**
+ * Save `namespaces`.
+ *
+ * @param {String} namespaces
+ * @api private
+ */
+ function save(namespaces) {
+ if (namespaces) {
+ process.env.DEBUG = namespaces;
+ } else {
+ // If you set a process.env field to null or undefined, it gets cast to the
+ // string 'null' or 'undefined'. Just delete instead.
+ delete process.env.DEBUG;
+ }
+ }
+
+ /**
+ * Load `namespaces`.
+ *
+ * @return {String} returns the previously persisted debug modes
+ * @api private
+ */
+
+ function load() {
+ return process.env.DEBUG;
+ }
+
+ /**
+ * Init logic for `debug` instances.
+ *
+ * Create a new `inspectOpts` object in case `useColors` is set
+ * differently for a particular `debug` instance.
+ */
+
+ function init(debug) {
+ debug.inspectOpts = {};
+
+ const keys = Object.keys(exports.inspectOpts);
+ for (let i = 0; i < keys.length; i++) {
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
+ }
+ }
+
+ module.exports = requireCommon()(exports);
+
+ const {formatters} = module.exports;
+
+ /**
+ * Map %o to `util.inspect()`, all on a single line.
+ */
+
+ formatters.o = function (v) {
+ this.inspectOpts.colors = this.useColors;
+ return util.inspect(v, this.inspectOpts)
+ .split('\n')
+ .map(str => str.trim())
+ .join(' ');
+ };
+
+ /**
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
+ */
+
+ formatters.O = function (v) {
+ this.inspectOpts.colors = this.useColors;
+ return util.inspect(v, this.inspectOpts);
+ };
+ } (node, node.exports));
+ return node.exports;
+}
+
+/**
+ * Detect Electron renderer / nwjs process, which is node, but we should
+ * treat as a browser.
+ */
+
+if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
+ src.exports = requireBrowser();
+} else {
+ src.exports = requireNode();
+}
+
+var srcExports = src.exports;
+var debug$1 = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
+
+var utils$3 = {};
+
+const path$2 = require$$0$1;
+const WIN_SLASH = '\\\\/';
+const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
+
+/**
+ * Posix glob regex
+ */
+
+const DOT_LITERAL = '\\.';
+const PLUS_LITERAL = '\\+';
+const QMARK_LITERAL = '\\?';
+const SLASH_LITERAL = '\\/';
+const ONE_CHAR = '(?=.)';
+const QMARK = '[^/]';
+const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
+const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
+const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
+const NO_DOT = `(?!${DOT_LITERAL})`;
+const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
+const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
+const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
+const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
+const STAR = `${QMARK}*?`;
+
+const POSIX_CHARS = {
+ DOT_LITERAL,
+ PLUS_LITERAL,
+ QMARK_LITERAL,
+ SLASH_LITERAL,
+ ONE_CHAR,
+ QMARK,
+ END_ANCHOR,
+ DOTS_SLASH,
+ NO_DOT,
+ NO_DOTS,
+ NO_DOT_SLASH,
+ NO_DOTS_SLASH,
+ QMARK_NO_DOT,
+ STAR,
+ START_ANCHOR
+};
+
+/**
+ * Windows glob regex
+ */
+
+const WINDOWS_CHARS = {
+ ...POSIX_CHARS,
+
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
+ QMARK: WIN_NO_SLASH,
+ STAR: `${WIN_NO_SLASH}*?`,
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
+ NO_DOT: `(?!${DOT_LITERAL})`,
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
+};
+
+/**
+ * POSIX Bracket Regex
+ */
+
+const POSIX_REGEX_SOURCE$1 = {
+ alnum: 'a-zA-Z0-9',
+ alpha: 'a-zA-Z',
+ ascii: '\\x00-\\x7F',
+ blank: ' \\t',
+ cntrl: '\\x00-\\x1F\\x7F',
+ digit: '0-9',
+ graph: '\\x21-\\x7E',
+ lower: 'a-z',
+ print: '\\x20-\\x7E ',
+ punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
+ space: ' \\t\\r\\n\\v\\f',
+ upper: 'A-Z',
+ word: 'A-Za-z0-9_',
+ xdigit: 'A-Fa-f0-9'
+};
+
+var constants$2 = {
+ MAX_LENGTH: 1024 * 64,
+ POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
+
+ // regular expressions
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
+
+ // Replace globs with equivalent patterns to reduce parsing time.
+ REPLACEMENTS: {
+ '***': '*',
+ '**/**': '**',
+ '**/**/**': '**'
+ },
+
+ // Digits
+ CHAR_0: 48, /* 0 */
+ CHAR_9: 57, /* 9 */
+
+ // Alphabet chars.
+ CHAR_UPPERCASE_A: 65, /* A */
+ CHAR_LOWERCASE_A: 97, /* a */
+ CHAR_UPPERCASE_Z: 90, /* Z */
+ CHAR_LOWERCASE_Z: 122, /* z */
+
+ CHAR_LEFT_PARENTHESES: 40, /* ( */
+ CHAR_RIGHT_PARENTHESES: 41, /* ) */
+
+ CHAR_ASTERISK: 42, /* * */
+
+ // Non-alphabetic chars.
+ CHAR_AMPERSAND: 38, /* & */
+ CHAR_AT: 64, /* @ */
+ CHAR_BACKWARD_SLASH: 92, /* \ */
+ CHAR_CARRIAGE_RETURN: 13, /* \r */
+ CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
+ CHAR_COLON: 58, /* : */
+ CHAR_COMMA: 44, /* , */
+ CHAR_DOT: 46, /* . */
+ CHAR_DOUBLE_QUOTE: 34, /* " */
+ CHAR_EQUAL: 61, /* = */
+ CHAR_EXCLAMATION_MARK: 33, /* ! */
+ CHAR_FORM_FEED: 12, /* \f */
+ CHAR_FORWARD_SLASH: 47, /* / */
+ CHAR_GRAVE_ACCENT: 96, /* ` */
+ CHAR_HASH: 35, /* # */
+ CHAR_HYPHEN_MINUS: 45, /* - */
+ CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
+ CHAR_LEFT_CURLY_BRACE: 123, /* { */
+ CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
+ CHAR_LINE_FEED: 10, /* \n */
+ CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
+ CHAR_PERCENT: 37, /* % */
+ CHAR_PLUS: 43, /* + */
+ CHAR_QUESTION_MARK: 63, /* ? */
+ CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
+ CHAR_RIGHT_CURLY_BRACE: 125, /* } */
+ CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
+ CHAR_SEMICOLON: 59, /* ; */
+ CHAR_SINGLE_QUOTE: 39, /* ' */
+ CHAR_SPACE: 32, /* */
+ CHAR_TAB: 9, /* \t */
+ CHAR_UNDERSCORE: 95, /* _ */
+ CHAR_VERTICAL_LINE: 124, /* | */
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
+
+ SEP: path$2.sep,
+
+ /**
+ * Create EXTGLOB_CHARS
+ */
+
+ extglobChars(chars) {
+ return {
+ '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
+ '?': { type: 'qmark', open: '(?:', close: ')?' },
+ '+': { type: 'plus', open: '(?:', close: ')+' },
+ '*': { type: 'star', open: '(?:', close: ')*' },
+ '@': { type: 'at', open: '(?:', close: ')' }
+ };
+ },
+
+ /**
+ * Create GLOB_CHARS
+ */
+
+ globChars(win32) {
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
+ }
+};
+
+(function (exports) {
+
+ const path = require$$0$1;
+ const win32 = process.platform === 'win32';
+ const {
+ REGEX_BACKSLASH,
+ REGEX_REMOVE_BACKSLASH,
+ REGEX_SPECIAL_CHARS,
+ REGEX_SPECIAL_CHARS_GLOBAL
+ } = constants$2;
+
+ exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
+ exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
+ exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
+ exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
+ exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
+
+ exports.removeBackslashes = str => {
+ return str.replace(REGEX_REMOVE_BACKSLASH, match => {
+ return match === '\\' ? '' : match;
+ });
+ };
+
+ exports.supportsLookbehinds = () => {
+ const segs = process.version.slice(1).split('.').map(Number);
+ if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
+ return true;
+ }
+ return false;
+ };
+
+ exports.isWindows = options => {
+ if (options && typeof options.windows === 'boolean') {
+ return options.windows;
+ }
+ return win32 === true || path.sep === '\\';
+ };
+
+ exports.escapeLast = (input, char, lastIdx) => {
+ const idx = input.lastIndexOf(char, lastIdx);
+ if (idx === -1) return input;
+ if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
+ };
+
+ exports.removePrefix = (input, state = {}) => {
+ let output = input;
+ if (output.startsWith('./')) {
+ output = output.slice(2);
+ state.prefix = './';
+ }
+ return output;
+ };
+
+ exports.wrapOutput = (input, state = {}, options = {}) => {
+ const prepend = options.contains ? '' : '^';
+ const append = options.contains ? '' : '$';
+
+ let output = `${prepend}(?:${input})${append}`;
+ if (state.negated === true) {
+ output = `(?:^(?!${output}).*$)`;
+ }
+ return output;
+ };
+} (utils$3));
+
+const utils$2 = utils$3;
+const {
+ CHAR_ASTERISK, /* * */
+ CHAR_AT, /* @ */
+ CHAR_BACKWARD_SLASH, /* \ */
+ CHAR_COMMA, /* , */
+ CHAR_DOT, /* . */
+ CHAR_EXCLAMATION_MARK, /* ! */
+ CHAR_FORWARD_SLASH, /* / */
+ CHAR_LEFT_CURLY_BRACE, /* { */
+ CHAR_LEFT_PARENTHESES, /* ( */
+ CHAR_LEFT_SQUARE_BRACKET, /* [ */
+ CHAR_PLUS, /* + */
+ CHAR_QUESTION_MARK, /* ? */
+ CHAR_RIGHT_CURLY_BRACE, /* } */
+ CHAR_RIGHT_PARENTHESES, /* ) */
+ CHAR_RIGHT_SQUARE_BRACKET /* ] */
+} = constants$2;
+
+const isPathSeparator = code => {
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
+};
+
+const depth = token => {
+ if (token.isPrefix !== true) {
+ token.depth = token.isGlobstar ? Infinity : 1;
+ }
+};
+
+/**
+ * Quickly scans a glob pattern and returns an object with a handful of
+ * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
+ * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
+ * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
+ *
+ * ```js
+ * const pm = require('picomatch');
+ * console.log(pm.scan('foo/bar/*.js'));
+ * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
+ * ```
+ * @param {String} `str`
+ * @param {Object} `options`
+ * @return {Object} Returns an object with tokens and regex source string.
+ * @api public
+ */
+
+const scan$1 = (input, options) => {
+ const opts = options || {};
+
+ const length = input.length - 1;
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
+ const slashes = [];
+ const tokens = [];
+ const parts = [];
+
+ let str = input;
+ let index = -1;
+ let start = 0;
+ let lastIndex = 0;
+ let isBrace = false;
+ let isBracket = false;
+ let isGlob = false;
+ let isExtglob = false;
+ let isGlobstar = false;
+ let braceEscaped = false;
+ let backslashes = false;
+ let negated = false;
+ let negatedExtglob = false;
+ let finished = false;
+ let braces = 0;
+ let prev;
+ let code;
+ let token = { value: '', depth: 0, isGlob: false };
+
+ const eos = () => index >= length;
+ const peek = () => str.charCodeAt(index + 1);
+ const advance = () => {
+ prev = code;
+ return str.charCodeAt(++index);
+ };
+
+ while (index < length) {
+ code = advance();
+ let next;
+
+ if (code === CHAR_BACKWARD_SLASH) {
+ backslashes = token.backslashes = true;
+ code = advance();
+
+ if (code === CHAR_LEFT_CURLY_BRACE) {
+ braceEscaped = true;
+ }
+ continue;
+ }
+
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
+ braces++;
+
+ while (eos() !== true && (code = advance())) {
+ if (code === CHAR_BACKWARD_SLASH) {
+ backslashes = token.backslashes = true;
+ advance();
+ continue;
+ }
+
+ if (code === CHAR_LEFT_CURLY_BRACE) {
+ braces++;
+ continue;
+ }
+
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
+ isBrace = token.isBrace = true;
+ isGlob = token.isGlob = true;
+ finished = true;
+
+ if (scanToEnd === true) {
+ continue;
+ }
+
+ break;
+ }
+
+ if (braceEscaped !== true && code === CHAR_COMMA) {
+ isBrace = token.isBrace = true;
+ isGlob = token.isGlob = true;
+ finished = true;
+
+ if (scanToEnd === true) {
+ continue;
+ }
+
+ break;
+ }
+
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
+ braces--;
+
+ if (braces === 0) {
+ braceEscaped = false;
+ isBrace = token.isBrace = true;
+ finished = true;
+ break;
+ }
+ }
+ }
+
+ if (scanToEnd === true) {
+ continue;
+ }
+
+ break;
+ }
+
+ if (code === CHAR_FORWARD_SLASH) {
+ slashes.push(index);
+ tokens.push(token);
+ token = { value: '', depth: 0, isGlob: false };
+
+ if (finished === true) continue;
+ if (prev === CHAR_DOT && index === (start + 1)) {
+ start += 2;
+ continue;
+ }
+
+ lastIndex = index + 1;
+ continue;
+ }
+
+ if (opts.noext !== true) {
+ const isExtglobChar = code === CHAR_PLUS
+ || code === CHAR_AT
+ || code === CHAR_ASTERISK
+ || code === CHAR_QUESTION_MARK
+ || code === CHAR_EXCLAMATION_MARK;
+
+ if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
+ isGlob = token.isGlob = true;
+ isExtglob = token.isExtglob = true;
+ finished = true;
+ if (code === CHAR_EXCLAMATION_MARK && index === start) {
+ negatedExtglob = true;
+ }
+
+ if (scanToEnd === true) {
+ while (eos() !== true && (code = advance())) {
+ if (code === CHAR_BACKWARD_SLASH) {
+ backslashes = token.backslashes = true;
+ code = advance();
+ continue;
+ }
+
+ if (code === CHAR_RIGHT_PARENTHESES) {
+ isGlob = token.isGlob = true;
+ finished = true;
+ break;
+ }
+ }
+ continue;
+ }
+ break;
+ }
+ }
+
+ if (code === CHAR_ASTERISK) {
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
+ isGlob = token.isGlob = true;
+ finished = true;
+
+ if (scanToEnd === true) {
+ continue;
+ }
+ break;
+ }
+
+ if (code === CHAR_QUESTION_MARK) {
+ isGlob = token.isGlob = true;
+ finished = true;
+
+ if (scanToEnd === true) {
+ continue;
+ }
+ break;
+ }
+
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
+ while (eos() !== true && (next = advance())) {
+ if (next === CHAR_BACKWARD_SLASH) {
+ backslashes = token.backslashes = true;
+ advance();
+ continue;
+ }
+
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
+ isBracket = token.isBracket = true;
+ isGlob = token.isGlob = true;
+ finished = true;
+ break;
+ }
+ }
+
+ if (scanToEnd === true) {
+ continue;
+ }
+
+ break;
+ }
+
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
+ negated = token.negated = true;
+ start++;
+ continue;
+ }
+
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
+ isGlob = token.isGlob = true;
+
+ if (scanToEnd === true) {
+ while (eos() !== true && (code = advance())) {
+ if (code === CHAR_LEFT_PARENTHESES) {
+ backslashes = token.backslashes = true;
+ code = advance();
+ continue;
+ }
+
+ if (code === CHAR_RIGHT_PARENTHESES) {
+ finished = true;
+ break;
+ }
+ }
+ continue;
+ }
+ break;
+ }
+
+ if (isGlob === true) {
+ finished = true;
+
+ if (scanToEnd === true) {
+ continue;
+ }
+
+ break;
+ }
+ }
+
+ if (opts.noext === true) {
+ isExtglob = false;
+ isGlob = false;
+ }
+
+ let base = str;
+ let prefix = '';
+ let glob = '';
+
+ if (start > 0) {
+ prefix = str.slice(0, start);
+ str = str.slice(start);
+ lastIndex -= start;
+ }
+
+ if (base && isGlob === true && lastIndex > 0) {
+ base = str.slice(0, lastIndex);
+ glob = str.slice(lastIndex);
+ } else if (isGlob === true) {
+ base = '';
+ glob = str;
+ } else {
+ base = str;
+ }
+
+ if (base && base !== '' && base !== '/' && base !== str) {
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) {
+ base = base.slice(0, -1);
+ }
+ }
+
+ if (opts.unescape === true) {
+ if (glob) glob = utils$2.removeBackslashes(glob);
+
+ if (base && backslashes === true) {
+ base = utils$2.removeBackslashes(base);
+ }
+ }
+
+ const state = {
+ prefix,
+ input,
+ start,
+ base,
+ glob,
+ isBrace,
+ isBracket,
+ isGlob,
+ isExtglob,
+ isGlobstar,
+ negated,
+ negatedExtglob
+ };
+
+ if (opts.tokens === true) {
+ state.maxDepth = 0;
+ if (!isPathSeparator(code)) {
+ tokens.push(token);
+ }
+ state.tokens = tokens;
+ }
+
+ if (opts.parts === true || opts.tokens === true) {
+ let prevIndex;
+
+ for (let idx = 0; idx < slashes.length; idx++) {
+ const n = prevIndex ? prevIndex + 1 : start;
+ const i = slashes[idx];
+ const value = input.slice(n, i);
+ if (opts.tokens) {
+ if (idx === 0 && start !== 0) {
+ tokens[idx].isPrefix = true;
+ tokens[idx].value = prefix;
+ } else {
+ tokens[idx].value = value;
+ }
+ depth(tokens[idx]);
+ state.maxDepth += tokens[idx].depth;
+ }
+ if (idx !== 0 || value !== '') {
+ parts.push(value);
+ }
+ prevIndex = i;
+ }
+
+ if (prevIndex && prevIndex + 1 < input.length) {
+ const value = input.slice(prevIndex + 1);
+ parts.push(value);
+
+ if (opts.tokens) {
+ tokens[tokens.length - 1].value = value;
+ depth(tokens[tokens.length - 1]);
+ state.maxDepth += tokens[tokens.length - 1].depth;
+ }
+ }
+
+ state.slashes = slashes;
+ state.parts = parts;
+ }
+
+ return state;
+};
+
+var scan_1 = scan$1;
+
+const constants$1 = constants$2;
+const utils$1 = utils$3;
+
+/**
+ * Constants
+ */
+
+const {
+ MAX_LENGTH,
+ POSIX_REGEX_SOURCE,
+ REGEX_NON_SPECIAL_CHARS,
+ REGEX_SPECIAL_CHARS_BACKREF,
+ REPLACEMENTS
+} = constants$1;
+
+/**
+ * Helpers
+ */
+
+const expandRange = (args, options) => {
+ if (typeof options.expandRange === 'function') {
+ return options.expandRange(...args, options);
+ }
+
+ args.sort();
+ const value = `[${args.join('-')}]`;
+
+ return value;
+};
+
+/**
+ * Create the message for a syntax error
+ */
+
+const syntaxError = (type, char) => {
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
+};
+
+/**
+ * Parse the given input string.
+ * @param {String} input
+ * @param {Object} options
+ * @return {Object}
+ */
+
+const parse$2 = (input, options) => {
+ if (typeof input !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+
+ input = REPLACEMENTS[input] || input;
+
+ const opts = { ...options };
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
+
+ let len = input.length;
+ if (len > max) {
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
+ }
+
+ const bos = { type: 'bos', value: '', output: opts.prepend || '' };
+ const tokens = [bos];
+
+ const capture = opts.capture ? '' : '?:';
+ const win32 = utils$1.isWindows(options);
+
+ // create constants based on platform, for windows or posix
+ const PLATFORM_CHARS = constants$1.globChars(win32);
+ const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
+
+ const {
+ DOT_LITERAL,
+ PLUS_LITERAL,
+ SLASH_LITERAL,
+ ONE_CHAR,
+ DOTS_SLASH,
+ NO_DOT,
+ NO_DOT_SLASH,
+ NO_DOTS_SLASH,
+ QMARK,
+ QMARK_NO_DOT,
+ STAR,
+ START_ANCHOR
+ } = PLATFORM_CHARS;
+
+ const globstar = opts => {
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
+ };
+
+ const nodot = opts.dot ? '' : NO_DOT;
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
+ let star = opts.bash === true ? globstar(opts) : STAR;
+
+ if (opts.capture) {
+ star = `(${star})`;
+ }
+
+ // minimatch options support
+ if (typeof opts.noext === 'boolean') {
+ opts.noextglob = opts.noext;
+ }
+
+ const state = {
+ input,
+ index: -1,
+ start: 0,
+ dot: opts.dot === true,
+ consumed: '',
+ output: '',
+ prefix: '',
+ backtrack: false,
+ negated: false,
+ brackets: 0,
+ braces: 0,
+ parens: 0,
+ quotes: 0,
+ globstar: false,
+ tokens
+ };
+
+ input = utils$1.removePrefix(input, state);
+ len = input.length;
+
+ const extglobs = [];
+ const braces = [];
+ const stack = [];
+ let prev = bos;
+ let value;
+
+ /**
+ * Tokenizing helpers
+ */
+
+ const eos = () => state.index === len - 1;
+ const peek = state.peek = (n = 1) => input[state.index + n];
+ const advance = state.advance = () => input[++state.index] || '';
+ const remaining = () => input.slice(state.index + 1);
+ const consume = (value = '', num = 0) => {
+ state.consumed += value;
+ state.index += num;
+ };
+
+ const append = token => {
+ state.output += token.output != null ? token.output : token.value;
+ consume(token.value);
+ };
+
+ const negate = () => {
+ let count = 1;
+
+ while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
+ advance();
+ state.start++;
+ count++;
+ }
+
+ if (count % 2 === 0) {
+ return false;
+ }
+
+ state.negated = true;
+ state.start++;
+ return true;
+ };
+
+ const increment = type => {
+ state[type]++;
+ stack.push(type);
+ };
+
+ const decrement = type => {
+ state[type]--;
+ stack.pop();
+ };
+
+ /**
+ * Push tokens onto the tokens array. This helper speeds up
+ * tokenizing by 1) helping us avoid backtracking as much as possible,
+ * and 2) helping us avoid creating extra tokens when consecutive
+ * characters are plain text. This improves performance and simplifies
+ * lookbehinds.
+ */
+
+ const push = tok => {
+ if (prev.type === 'globstar') {
+ const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
+ const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
+
+ if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
+ state.output = state.output.slice(0, -prev.output.length);
+ prev.type = 'star';
+ prev.value = '*';
+ prev.output = star;
+ state.output += prev.output;
+ }
+ }
+
+ if (extglobs.length && tok.type !== 'paren') {
+ extglobs[extglobs.length - 1].inner += tok.value;
+ }
+
+ if (tok.value || tok.output) append(tok);
+ if (prev && prev.type === 'text' && tok.type === 'text') {
+ prev.value += tok.value;
+ prev.output = (prev.output || '') + tok.value;
+ return;
+ }
+
+ tok.prev = prev;
+ tokens.push(tok);
+ prev = tok;
+ };
+
+ const extglobOpen = (type, value) => {
+ const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
+
+ token.prev = prev;
+ token.parens = state.parens;
+ token.output = state.output;
+ const output = (opts.capture ? '(' : '') + token.open;
+
+ increment('parens');
+ push({ type, value, output: state.output ? '' : ONE_CHAR });
+ push({ type: 'paren', extglob: true, value: advance(), output });
+ extglobs.push(token);
+ };
+
+ const extglobClose = token => {
+ let output = token.close + (opts.capture ? ')' : '');
+ let rest;
+
+ if (token.type === 'negate') {
+ let extglobStar = star;
+
+ if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
+ extglobStar = globstar(opts);
+ }
+
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
+ output = token.close = `)$))${extglobStar}`;
+ }
+
+ if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
+ // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
+ // In this case, we need to parse the string and use it in the output of the original pattern.
+ // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
+ //
+ // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
+ const expression = parse$2(rest, { ...options, fastpaths: false }).output;
+
+ output = token.close = `)${expression})${extglobStar})`;
+ }
+
+ if (token.prev.type === 'bos') {
+ state.negatedExtglob = true;
+ }
+ }
+
+ push({ type: 'paren', extglob: true, value, output });
+ decrement('parens');
+ };
+
+ /**
+ * Fast paths
+ */
+
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
+ let backslashes = false;
+
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
+ if (first === '\\') {
+ backslashes = true;
+ return m;
+ }
+
+ if (first === '?') {
+ if (esc) {
+ return esc + first + (rest ? QMARK.repeat(rest.length) : '');
+ }
+ if (index === 0) {
+ return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
+ }
+ return QMARK.repeat(chars.length);
+ }
+
+ if (first === '.') {
+ return DOT_LITERAL.repeat(chars.length);
+ }
+
+ if (first === '*') {
+ if (esc) {
+ return esc + first + (rest ? star : '');
+ }
+ return star;
+ }
+ return esc ? m : `\\${m}`;
+ });
+
+ if (backslashes === true) {
+ if (opts.unescape === true) {
+ output = output.replace(/\\/g, '');
+ } else {
+ output = output.replace(/\\+/g, m => {
+ return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
+ });
+ }
+ }
+
+ if (output === input && opts.contains === true) {
+ state.output = input;
+ return state;
+ }
+
+ state.output = utils$1.wrapOutput(output, state, options);
+ return state;
+ }
+
+ /**
+ * Tokenize input until we reach end-of-string
+ */
+
+ while (!eos()) {
+ value = advance();
+
+ if (value === '\u0000') {
+ continue;
+ }
+
+ /**
+ * Escaped characters
+ */
+
+ if (value === '\\') {
+ const next = peek();
+
+ if (next === '/' && opts.bash !== true) {
+ continue;
+ }
+
+ if (next === '.' || next === ';') {
+ continue;
+ }
+
+ if (!next) {
+ value += '\\';
+ push({ type: 'text', value });
+ continue;
+ }
+
+ // collapse slashes to reduce potential for exploits
+ const match = /^\\+/.exec(remaining());
+ let slashes = 0;
+
+ if (match && match[0].length > 2) {
+ slashes = match[0].length;
+ state.index += slashes;
+ if (slashes % 2 !== 0) {
+ value += '\\';
+ }
+ }
+
+ if (opts.unescape === true) {
+ value = advance();
+ } else {
+ value += advance();
+ }
+
+ if (state.brackets === 0) {
+ push({ type: 'text', value });
+ continue;
+ }
+ }
+
+ /**
+ * If we're inside a regex character class, continue
+ * until we reach the closing bracket.
+ */
+
+ if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
+ if (opts.posix !== false && value === ':') {
+ const inner = prev.value.slice(1);
+ if (inner.includes('[')) {
+ prev.posix = true;
+
+ if (inner.includes(':')) {
+ const idx = prev.value.lastIndexOf('[');
+ const pre = prev.value.slice(0, idx);
+ const rest = prev.value.slice(idx + 2);
+ const posix = POSIX_REGEX_SOURCE[rest];
+ if (posix) {
+ prev.value = pre + posix;
+ state.backtrack = true;
+ advance();
+
+ if (!bos.output && tokens.indexOf(prev) === 1) {
+ bos.output = ONE_CHAR;
+ }
+ continue;
+ }
+ }
+ }
+ }
+
+ if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
+ value = `\\${value}`;
+ }
+
+ if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
+ value = `\\${value}`;
+ }
+
+ if (opts.posix === true && value === '!' && prev.value === '[') {
+ value = '^';
+ }
+
+ prev.value += value;
+ append({ value });
+ continue;
+ }
+
+ /**
+ * If we're inside a quoted string, continue
+ * until we reach the closing double quote.
+ */
+
+ if (state.quotes === 1 && value !== '"') {
+ value = utils$1.escapeRegex(value);
+ prev.value += value;
+ append({ value });
+ continue;
+ }
+
+ /**
+ * Double quotes
+ */
+
+ if (value === '"') {
+ state.quotes = state.quotes === 1 ? 0 : 1;
+ if (opts.keepQuotes === true) {
+ push({ type: 'text', value });
+ }
+ continue;
+ }
+
+ /**
+ * Parentheses
+ */
+
+ if (value === '(') {
+ increment('parens');
+ push({ type: 'paren', value });
+ continue;
+ }
+
+ if (value === ')') {
+ if (state.parens === 0 && opts.strictBrackets === true) {
+ throw new SyntaxError(syntaxError('opening', '('));
+ }
+
+ const extglob = extglobs[extglobs.length - 1];
+ if (extglob && state.parens === extglob.parens + 1) {
+ extglobClose(extglobs.pop());
+ continue;
+ }
+
+ push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
+ decrement('parens');
+ continue;
+ }
+
+ /**
+ * Square brackets
+ */
+
+ if (value === '[') {
+ if (opts.nobracket === true || !remaining().includes(']')) {
+ if (opts.nobracket !== true && opts.strictBrackets === true) {
+ throw new SyntaxError(syntaxError('closing', ']'));
+ }
+
+ value = `\\${value}`;
+ } else {
+ increment('brackets');
+ }
+
+ push({ type: 'bracket', value });
+ continue;
+ }
+
+ if (value === ']') {
+ if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
+ push({ type: 'text', value, output: `\\${value}` });
+ continue;
+ }
+
+ if (state.brackets === 0) {
+ if (opts.strictBrackets === true) {
+ throw new SyntaxError(syntaxError('opening', '['));
+ }
+
+ push({ type: 'text', value, output: `\\${value}` });
+ continue;
+ }
+
+ decrement('brackets');
+
+ const prevValue = prev.value.slice(1);
+ if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
+ value = `/${value}`;
+ }
+
+ prev.value += value;
+ append({ value });
+
+ // when literal brackets are explicitly disabled
+ // assume we should match with a regex character class
+ if (opts.literalBrackets === false || utils$1.hasRegexChars(prevValue)) {
+ continue;
+ }
+
+ const escaped = utils$1.escapeRegex(prev.value);
+ state.output = state.output.slice(0, -prev.value.length);
+
+ // when literal brackets are explicitly enabled
+ // assume we should escape the brackets to match literal characters
+ if (opts.literalBrackets === true) {
+ state.output += escaped;
+ prev.value = escaped;
+ continue;
+ }
+
+ // when the user specifies nothing, try to match both
+ prev.value = `(${capture}${escaped}|${prev.value})`;
+ state.output += prev.value;
+ continue;
+ }
+
+ /**
+ * Braces
+ */
+
+ if (value === '{' && opts.nobrace !== true) {
+ increment('braces');
+
+ const open = {
+ type: 'brace',
+ value,
+ output: '(',
+ outputIndex: state.output.length,
+ tokensIndex: state.tokens.length
+ };
+
+ braces.push(open);
+ push(open);
+ continue;
+ }
+
+ if (value === '}') {
+ const brace = braces[braces.length - 1];
+
+ if (opts.nobrace === true || !brace) {
+ push({ type: 'text', value, output: value });
+ continue;
+ }
+
+ let output = ')';
+
+ if (brace.dots === true) {
+ const arr = tokens.slice();
+ const range = [];
+
+ for (let i = arr.length - 1; i >= 0; i--) {
+ tokens.pop();
+ if (arr[i].type === 'brace') {
+ break;
+ }
+ if (arr[i].type !== 'dots') {
+ range.unshift(arr[i].value);
+ }
+ }
+
+ output = expandRange(range, opts);
+ state.backtrack = true;
+ }
+
+ if (brace.comma !== true && brace.dots !== true) {
+ const out = state.output.slice(0, brace.outputIndex);
+ const toks = state.tokens.slice(brace.tokensIndex);
+ brace.value = brace.output = '\\{';
+ value = output = '\\}';
+ state.output = out;
+ for (const t of toks) {
+ state.output += (t.output || t.value);
+ }
+ }
+
+ push({ type: 'brace', value, output });
+ decrement('braces');
+ braces.pop();
+ continue;
+ }
+
+ /**
+ * Pipes
+ */
+
+ if (value === '|') {
+ if (extglobs.length > 0) {
+ extglobs[extglobs.length - 1].conditions++;
+ }
+ push({ type: 'text', value });
+ continue;
+ }
+
+ /**
+ * Commas
+ */
+
+ if (value === ',') {
+ let output = value;
+
+ const brace = braces[braces.length - 1];
+ if (brace && stack[stack.length - 1] === 'braces') {
+ brace.comma = true;
+ output = '|';
+ }
+
+ push({ type: 'comma', value, output });
+ continue;
+ }
+
+ /**
+ * Slashes
+ */
+
+ if (value === '/') {
+ // if the beginning of the glob is "./", advance the start
+ // to the current index, and don't add the "./" characters
+ // to the state. This greatly simplifies lookbehinds when
+ // checking for BOS characters like "!" and "." (not "./")
+ if (prev.type === 'dot' && state.index === state.start + 1) {
+ state.start = state.index + 1;
+ state.consumed = '';
+ state.output = '';
+ tokens.pop();
+ prev = bos; // reset "prev" to the first token
+ continue;
+ }
+
+ push({ type: 'slash', value, output: SLASH_LITERAL });
+ continue;
+ }
+
+ /**
+ * Dots
+ */
+
+ if (value === '.') {
+ if (state.braces > 0 && prev.type === 'dot') {
+ if (prev.value === '.') prev.output = DOT_LITERAL;
+ const brace = braces[braces.length - 1];
+ prev.type = 'dots';
+ prev.output += value;
+ prev.value += value;
+ brace.dots = true;
+ continue;
+ }
+
+ if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
+ push({ type: 'text', value, output: DOT_LITERAL });
+ continue;
+ }
+
+ push({ type: 'dot', value, output: DOT_LITERAL });
+ continue;
+ }
+
+ /**
+ * Question marks
+ */
+
+ if (value === '?') {
+ const isGroup = prev && prev.value === '(';
+ if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
+ extglobOpen('qmark', value);
+ continue;
+ }
+
+ if (prev && prev.type === 'paren') {
+ const next = peek();
+ let output = value;
+
+ if (next === '<' && !utils$1.supportsLookbehinds()) {
+ throw new Error('Node.js v10 or higher is required for regex lookbehinds');
+ }
+
+ if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
+ output = `\\${value}`;
+ }
+
+ push({ type: 'text', value, output });
+ continue;
+ }
+
+ if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
+ push({ type: 'qmark', value, output: QMARK_NO_DOT });
+ continue;
+ }
+
+ push({ type: 'qmark', value, output: QMARK });
+ continue;
+ }
+
+ /**
+ * Exclamation
+ */
+
+ if (value === '!') {
+ if (opts.noextglob !== true && peek() === '(') {
+ if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
+ extglobOpen('negate', value);
+ continue;
+ }
+ }
+
+ if (opts.nonegate !== true && state.index === 0) {
+ negate();
+ continue;
+ }
+ }
+
+ /**
+ * Plus
+ */
+
+ if (value === '+') {
+ if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
+ extglobOpen('plus', value);
+ continue;
+ }
+
+ if ((prev && prev.value === '(') || opts.regex === false) {
+ push({ type: 'plus', value, output: PLUS_LITERAL });
+ continue;
+ }
+
+ if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
+ push({ type: 'plus', value });
+ continue;
+ }
+
+ push({ type: 'plus', value: PLUS_LITERAL });
+ continue;
+ }
+
+ /**
+ * Plain text
+ */
+
+ if (value === '@') {
+ if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
+ push({ type: 'at', extglob: true, value, output: '' });
+ continue;
+ }
+
+ push({ type: 'text', value });
+ continue;
+ }
+
+ /**
+ * Plain text
+ */
+
+ if (value !== '*') {
+ if (value === '$' || value === '^') {
+ value = `\\${value}`;
+ }
+
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
+ if (match) {
+ value += match[0];
+ state.index += match[0].length;
+ }
+
+ push({ type: 'text', value });
+ continue;
+ }
+
+ /**
+ * Stars
+ */
+
+ if (prev && (prev.type === 'globstar' || prev.star === true)) {
+ prev.type = 'star';
+ prev.star = true;
+ prev.value += value;
+ prev.output = star;
+ state.backtrack = true;
+ state.globstar = true;
+ consume(value);
+ continue;
+ }
+
+ let rest = remaining();
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
+ extglobOpen('star', value);
+ continue;
+ }
+
+ if (prev.type === 'star') {
+ if (opts.noglobstar === true) {
+ consume(value);
+ continue;
+ }
+
+ const prior = prev.prev;
+ const before = prior.prev;
+ const isStart = prior.type === 'slash' || prior.type === 'bos';
+ const afterStar = before && (before.type === 'star' || before.type === 'globstar');
+
+ if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
+ push({ type: 'star', value, output: '' });
+ continue;
+ }
+
+ const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
+ const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
+ if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
+ push({ type: 'star', value, output: '' });
+ continue;
+ }
+
+ // strip consecutive `/**/`
+ while (rest.slice(0, 3) === '/**') {
+ const after = input[state.index + 4];
+ if (after && after !== '/') {
+ break;
+ }
+ rest = rest.slice(3);
+ consume('/**', 3);
+ }
+
+ if (prior.type === 'bos' && eos()) {
+ prev.type = 'globstar';
+ prev.value += value;
+ prev.output = globstar(opts);
+ state.output = prev.output;
+ state.globstar = true;
+ consume(value);
+ continue;
+ }
+
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
+ prior.output = `(?:${prior.output}`;
+
+ prev.type = 'globstar';
+ prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
+ prev.value += value;
+ state.globstar = true;
+ state.output += prior.output + prev.output;
+ consume(value);
+ continue;
+ }
+
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
+ const end = rest[1] !== void 0 ? '|$' : '';
+
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
+ prior.output = `(?:${prior.output}`;
+
+ prev.type = 'globstar';
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
+ prev.value += value;
+
+ state.output += prior.output + prev.output;
+ state.globstar = true;
+
+ consume(value + advance());
+
+ push({ type: 'slash', value: '/', output: '' });
+ continue;
+ }
+
+ if (prior.type === 'bos' && rest[0] === '/') {
+ prev.type = 'globstar';
+ prev.value += value;
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
+ state.output = prev.output;
+ state.globstar = true;
+ consume(value + advance());
+ push({ type: 'slash', value: '/', output: '' });
+ continue;
+ }
+
+ // remove single star from output
+ state.output = state.output.slice(0, -prev.output.length);
+
+ // reset previous token to globstar
+ prev.type = 'globstar';
+ prev.output = globstar(opts);
+ prev.value += value;
+
+ // reset output with globstar
+ state.output += prev.output;
+ state.globstar = true;
+ consume(value);
+ continue;
+ }
+
+ const token = { type: 'star', value, output: star };
+
+ if (opts.bash === true) {
+ token.output = '.*?';
+ if (prev.type === 'bos' || prev.type === 'slash') {
+ token.output = nodot + token.output;
+ }
+ push(token);
+ continue;
+ }
+
+ if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
+ token.output = value;
+ push(token);
+ continue;
+ }
+
+ if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
+ if (prev.type === 'dot') {
+ state.output += NO_DOT_SLASH;
+ prev.output += NO_DOT_SLASH;
+
+ } else if (opts.dot === true) {
+ state.output += NO_DOTS_SLASH;
+ prev.output += NO_DOTS_SLASH;
+
+ } else {
+ state.output += nodot;
+ prev.output += nodot;
+ }
+
+ if (peek() !== '*') {
+ state.output += ONE_CHAR;
+ prev.output += ONE_CHAR;
+ }
+ }
+
+ push(token);
+ }
+
+ while (state.brackets > 0) {
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
+ state.output = utils$1.escapeLast(state.output, '[');
+ decrement('brackets');
+ }
+
+ while (state.parens > 0) {
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
+ state.output = utils$1.escapeLast(state.output, '(');
+ decrement('parens');
+ }
+
+ while (state.braces > 0) {
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
+ state.output = utils$1.escapeLast(state.output, '{');
+ decrement('braces');
+ }
+
+ if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
+ push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
+ }
+
+ // rebuild the output if we had to backtrack at any point
+ if (state.backtrack === true) {
+ state.output = '';
+
+ for (const token of state.tokens) {
+ state.output += token.output != null ? token.output : token.value;
+
+ if (token.suffix) {
+ state.output += token.suffix;
+ }
+ }
+ }
+
+ return state;
+};
+
+/**
+ * Fast paths for creating regular expressions for common glob patterns.
+ * This can significantly speed up processing and has very little downside
+ * impact when none of the fast paths match.
+ */
+
+parse$2.fastpaths = (input, options) => {
+ const opts = { ...options };
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
+ const len = input.length;
+ if (len > max) {
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
+ }
+
+ input = REPLACEMENTS[input] || input;
+ const win32 = utils$1.isWindows(options);
+
+ // create constants based on platform, for windows or posix
+ const {
+ DOT_LITERAL,
+ SLASH_LITERAL,
+ ONE_CHAR,
+ DOTS_SLASH,
+ NO_DOT,
+ NO_DOTS,
+ NO_DOTS_SLASH,
+ STAR,
+ START_ANCHOR
+ } = constants$1.globChars(win32);
+
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
+ const capture = opts.capture ? '' : '?:';
+ const state = { negated: false, prefix: '' };
+ let star = opts.bash === true ? '.*?' : STAR;
+
+ if (opts.capture) {
+ star = `(${star})`;
+ }
+
+ const globstar = opts => {
+ if (opts.noglobstar === true) return star;
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
+ };
+
+ const create = str => {
+ switch (str) {
+ case '*':
+ return `${nodot}${ONE_CHAR}${star}`;
+
+ case '.*':
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
+
+ case '*.*':
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
+
+ case '*/*':
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
+
+ case '**':
+ return nodot + globstar(opts);
+
+ case '**/*':
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
+
+ case '**/*.*':
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
+
+ case '**/.*':
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
+
+ default: {
+ const match = /^(.*?)\.(\w+)$/.exec(str);
+ if (!match) return;
+
+ const source = create(match[1]);
+ if (!source) return;
+
+ return source + DOT_LITERAL + match[2];
+ }
+ }
+ };
+
+ const output = utils$1.removePrefix(input, state);
+ let source = create(output);
+
+ if (source && opts.strictSlashes !== true) {
+ source += `${SLASH_LITERAL}?`;
+ }
+
+ return source;
+};
+
+var parse_1$1 = parse$2;
+
+const path$1 = require$$0$1;
+const scan = scan_1;
+const parse$1 = parse_1$1;
+const utils = utils$3;
+const constants = constants$2;
+const isObject$1 = val => val && typeof val === 'object' && !Array.isArray(val);
+
+/**
+ * Creates a matcher function from one or more glob patterns. The
+ * returned function takes a string to match as its first argument,
+ * and returns true if the string is a match. The returned matcher
+ * function also takes a boolean as the second argument that, when true,
+ * returns an object with additional information.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * // picomatch(glob[, options]);
+ *
+ * const isMatch = picomatch('*.!(*a)');
+ * console.log(isMatch('a.a')); //=> false
+ * console.log(isMatch('a.b')); //=> true
+ * ```
+ * @name picomatch
+ * @param {String|Array} `globs` One or more glob patterns.
+ * @param {Object=} `options`
+ * @return {Function=} Returns a matcher function.
+ * @api public
+ */
+
+const picomatch$1 = (glob, options, returnState = false) => {
+ if (Array.isArray(glob)) {
+ const fns = glob.map(input => picomatch$1(input, options, returnState));
+ const arrayMatcher = str => {
+ for (const isMatch of fns) {
+ const state = isMatch(str);
+ if (state) return state;
+ }
+ return false;
+ };
+ return arrayMatcher;
+ }
+
+ const isState = isObject$1(glob) && glob.tokens && glob.input;
+
+ if (glob === '' || (typeof glob !== 'string' && !isState)) {
+ throw new TypeError('Expected pattern to be a non-empty string');
+ }
+
+ const opts = options || {};
+ const posix = utils.isWindows(options);
+ const regex = isState
+ ? picomatch$1.compileRe(glob, options)
+ : picomatch$1.makeRe(glob, options, false, true);
+
+ const state = regex.state;
+ delete regex.state;
+
+ let isIgnored = () => false;
+ if (opts.ignore) {
+ const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
+ isIgnored = picomatch$1(opts.ignore, ignoreOpts, returnState);
+ }
+
+ const matcher = (input, returnObject = false) => {
+ const { isMatch, match, output } = picomatch$1.test(input, regex, options, { glob, posix });
+ const result = { glob, state, regex, posix, input, output, match, isMatch };
+
+ if (typeof opts.onResult === 'function') {
+ opts.onResult(result);
+ }
+
+ if (isMatch === false) {
+ result.isMatch = false;
+ return returnObject ? result : false;
+ }
+
+ if (isIgnored(input)) {
+ if (typeof opts.onIgnore === 'function') {
+ opts.onIgnore(result);
+ }
+ result.isMatch = false;
+ return returnObject ? result : false;
+ }
+
+ if (typeof opts.onMatch === 'function') {
+ opts.onMatch(result);
+ }
+ return returnObject ? result : true;
+ };
+
+ if (returnState) {
+ matcher.state = state;
+ }
+
+ return matcher;
+};
+
+/**
+ * Test `input` with the given `regex`. This is used by the main
+ * `picomatch()` function to test the input string.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * // picomatch.test(input, regex[, options]);
+ *
+ * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
+ * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
+ * ```
+ * @param {String} `input` String to test.
+ * @param {RegExp} `regex`
+ * @return {Object} Returns an object with matching info.
+ * @api public
+ */
+
+picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
+ if (typeof input !== 'string') {
+ throw new TypeError('Expected input to be a string');
+ }
+
+ if (input === '') {
+ return { isMatch: false, output: '' };
+ }
+
+ const opts = options || {};
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
+ let match = input === glob;
+ let output = (match && format) ? format(input) : input;
+
+ if (match === false) {
+ output = format ? format(input) : input;
+ match = output === glob;
+ }
+
+ if (match === false || opts.capture === true) {
+ if (opts.matchBase === true || opts.basename === true) {
+ match = picomatch$1.matchBase(input, regex, options, posix);
+ } else {
+ match = regex.exec(output);
+ }
+ }
+
+ return { isMatch: Boolean(match), match, output };
+};
+
+/**
+ * Match the basename of a filepath.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * // picomatch.matchBase(input, glob[, options]);
+ * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
+ * ```
+ * @param {String} `input` String to test.
+ * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
+ * @return {Boolean}
+ * @api public
+ */
+
+picomatch$1.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
+ const regex = glob instanceof RegExp ? glob : picomatch$1.makeRe(glob, options);
+ return regex.test(path$1.basename(input));
+};
+
+/**
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * // picomatch.isMatch(string, patterns[, options]);
+ *
+ * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
+ * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
+ * ```
+ * @param {String|Array} str The string to test.
+ * @param {String|Array} patterns One or more glob patterns to use for matching.
+ * @param {Object} [options] See available [options](#options).
+ * @return {Boolean} Returns true if any patterns match `str`
+ * @api public
+ */
+
+picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)(str);
+
+/**
+ * Parse a glob pattern to create the source string for a regular
+ * expression.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * const result = picomatch.parse(pattern[, options]);
+ * ```
+ * @param {String} `pattern`
+ * @param {Object} `options`
+ * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
+ * @api public
+ */
+
+picomatch$1.parse = (pattern, options) => {
+ if (Array.isArray(pattern)) return pattern.map(p => picomatch$1.parse(p, options));
+ return parse$1(pattern, { ...options, fastpaths: false });
+};
+
+/**
+ * Scan a glob pattern to separate the pattern into segments.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * // picomatch.scan(input[, options]);
+ *
+ * const result = picomatch.scan('!./foo/*.js');
+ * console.log(result);
+ * { prefix: '!./',
+ * input: '!./foo/*.js',
+ * start: 3,
+ * base: 'foo',
+ * glob: '*.js',
+ * isBrace: false,
+ * isBracket: false,
+ * isGlob: true,
+ * isExtglob: false,
+ * isGlobstar: false,
+ * negated: true }
+ * ```
+ * @param {String} `input` Glob pattern to scan.
+ * @param {Object} `options`
+ * @return {Object} Returns an object with
+ * @api public
+ */
+
+picomatch$1.scan = (input, options) => scan(input, options);
+
+/**
+ * Compile a regular expression from the `state` object returned by the
+ * [parse()](#parse) method.
+ *
+ * @param {Object} `state`
+ * @param {Object} `options`
+ * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
+ * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
+ * @return {RegExp}
+ * @api public
+ */
+
+picomatch$1.compileRe = (state, options, returnOutput = false, returnState = false) => {
+ if (returnOutput === true) {
+ return state.output;
+ }
+
+ const opts = options || {};
+ const prepend = opts.contains ? '' : '^';
+ const append = opts.contains ? '' : '$';
+
+ let source = `${prepend}(?:${state.output})${append}`;
+ if (state && state.negated === true) {
+ source = `^(?!${source}).*$`;
+ }
+
+ const regex = picomatch$1.toRegex(source, options);
+ if (returnState === true) {
+ regex.state = state;
+ }
+
+ return regex;
+};
+
+/**
+ * Create a regular expression from a parsed glob pattern.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * const state = picomatch.parse('*.js');
+ * // picomatch.compileRe(state[, options]);
+ *
+ * console.log(picomatch.compileRe(state));
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
+ * ```
+ * @param {String} `state` The object returned from the `.parse` method.
+ * @param {Object} `options`
+ * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
+ * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
+ * @return {RegExp} Returns a regex created from the given pattern.
+ * @api public
+ */
+
+picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
+ if (!input || typeof input !== 'string') {
+ throw new TypeError('Expected a non-empty string');
+ }
+
+ let parsed = { negated: false, fastpaths: true };
+
+ if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
+ parsed.output = parse$1.fastpaths(input, options);
+ }
+
+ if (!parsed.output) {
+ parsed = parse$1(input, options);
+ }
+
+ return picomatch$1.compileRe(parsed, options, returnOutput, returnState);
+};
+
+/**
+ * Create a regular expression from the given regex source string.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * // picomatch.toRegex(source[, options]);
+ *
+ * const { output } = picomatch.parse('*.js');
+ * console.log(picomatch.toRegex(output));
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
+ * ```
+ * @param {String} `source` Regular expression source string.
+ * @param {Object} `options`
+ * @return {RegExp}
+ * @api public
+ */
+
+picomatch$1.toRegex = (source, options) => {
+ try {
+ const opts = options || {};
+ return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
+ } catch (err) {
+ if (options && options.debug === true) throw err;
+ return /$^/;
+ }
+};
+
+/**
+ * Picomatch constants.
+ * @return {Object}
+ */
+
+picomatch$1.constants = constants;
+
+/**
+ * Expose "picomatch"
+ */
+
+var picomatch_1 = picomatch$1;
+
+var picomatch = picomatch_1;
+
+var pm = /*@__PURE__*/getDefaultExportFromCjs(picomatch);
+
+// Helper since Typescript can't detect readonly arrays with Array.isArray
+function isArray(arg) {
+ return Array.isArray(arg);
+}
+function ensureArray(thing) {
+ if (isArray(thing))
+ return thing;
+ if (thing == null)
+ return [];
+ return [thing];
+}
+
+const normalizePath$1 = function normalizePath(filename) {
+ return filename.split(require$$0$1.win32.sep).join(require$$0$1.posix.sep);
+};
+
+function getMatcherString(id, resolutionBase) {
+ if (resolutionBase === false || require$$0$1.isAbsolute(id) || id.startsWith('*')) {
+ return normalizePath$1(id);
+ }
+ // resolve('') is valid and will default to process.cwd()
+ const basePath = normalizePath$1(require$$0$1.resolve(resolutionBase || ''))
+ // escape all possible (posix + win) path characters that might interfere with regex
+ .replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
+ // Note that we use posix.join because:
+ // 1. the basePath has been normalized to use /
+ // 2. the incoming glob (id) matcher, also uses /
+ // otherwise Node will force backslash (\) on windows
+ return require$$0$1.posix.join(basePath, normalizePath$1(id));
+}
+const createFilter$1 = function createFilter(include, exclude, options) {
+ const resolutionBase = options && options.resolve;
+ const getMatcher = (id) => id instanceof RegExp
+ ? id
+ : {
+ test: (what) => {
+ // this refactor is a tad overly verbose but makes for easy debugging
+ const pattern = getMatcherString(id, resolutionBase);
+ const fn = pm(pattern, { dot: true });
+ const result = fn(what);
+ return result;
+ }
+ };
+ const includeMatchers = ensureArray(include).map(getMatcher);
+ const excludeMatchers = ensureArray(exclude).map(getMatcher);
+ return function result(id) {
+ if (typeof id !== 'string')
+ return false;
+ if (/\0/.test(id))
+ return false;
+ const pathId = normalizePath$1(id);
+ for (let i = 0; i < excludeMatchers.length; ++i) {
+ const matcher = excludeMatchers[i];
+ if (matcher.test(pathId))
+ return false;
+ }
+ for (let i = 0; i < includeMatchers.length; ++i) {
+ const matcher = includeMatchers[i];
+ if (matcher.test(pathId))
+ return true;
+ }
+ return !includeMatchers.length;
+ };
+};
+
+const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
+const builtins = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
+const forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(' '));
+forbiddenIdentifiers.add('');
+
+if (process.versions.pnp) {
+ try {
+ node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)))('pnpapi');
+ }
+ catch { }
+}
+
+const createFilter = createFilter$1;
+const windowsSlashRE = /\\/g;
+function slash(p) {
+ return p.replace(windowsSlashRE, '/');
+}
+function isInNodeModules(id) {
+ return id.includes('node_modules');
+}
+// TODO: use import()
+const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)));
+// set in bin/vite.js
+const filter = process.env.VITE_DEBUG_FILTER;
+const DEBUG = process.env.DEBUG;
+function createDebugger(namespace, options = {}) {
+ const log = debug$1(namespace);
+ const { onlyWhenFocused } = options;
+ let enabled = log.enabled;
+ if (enabled && onlyWhenFocused) {
+ const ns = typeof onlyWhenFocused === 'string' ? onlyWhenFocused : namespace;
+ enabled = !!DEBUG?.includes(ns);
+ }
+ if (enabled) {
+ return (...args) => {
+ if (!filter || args.some((a) => a?.includes?.(filter))) {
+ log(...args);
+ }
+ };
+ }
+}
+function testCaseInsensitiveFS() {
+ if (!CLIENT_ENTRY.endsWith('client.mjs')) {
+ throw new Error(`cannot test case insensitive FS, CLIENT_ENTRY const doesn't contain client.mjs`);
+ }
+ if (!fs$1.existsSync(CLIENT_ENTRY)) {
+ throw new Error('cannot test case insensitive FS, CLIENT_ENTRY does not point to an existing file: ' +
+ CLIENT_ENTRY);
+ }
+ return fs$1.existsSync(CLIENT_ENTRY.replace('client.mjs', 'cLiEnT.mjs'));
+}
+const isCaseInsensitiveFS = testCaseInsensitiveFS();
+const isWindows = os$1.platform() === 'win32';
+const VOLUME_RE = /^[A-Z]:/i;
+function normalizePath(id) {
+ return path$3.posix.normalize(isWindows ? slash(id) : id);
+}
+function fsPathFromId(id) {
+ const fsPath = normalizePath(id.startsWith(FS_PREFIX) ? id.slice(FS_PREFIX.length) : id);
+ return fsPath[0] === '/' || fsPath.match(VOLUME_RE) ? fsPath : `/${fsPath}`;
+}
+function fsPathFromUrl(url) {
+ return fsPathFromId(cleanUrl(url));
+}
+/**
+ * Check if dir is a parent of file
+ *
+ * Warning: parameters are not validated, only works with normalized absolute paths
+ *
+ * @param dir - normalized absolute path
+ * @param file - normalized absolute path
+ * @returns true if dir is a parent of file
+ */
+function isParentDirectory(dir, file) {
+ if (dir[dir.length - 1] !== '/') {
+ dir = `${dir}/`;
+ }
+ return (file.startsWith(dir) ||
+ (isCaseInsensitiveFS && file.toLowerCase().startsWith(dir.toLowerCase())));
+}
+/**
+ * Check if 2 file name are identical
+ *
+ * Warning: parameters are not validated, only works with normalized absolute paths
+ *
+ * @param file1 - normalized absolute path
+ * @param file2 - normalized absolute path
+ * @returns true if both files url are identical
+ */
+function isSameFileUri(file1, file2) {
+ return (file1 === file2 ||
+ (isCaseInsensitiveFS && file1.toLowerCase() === file2.toLowerCase()));
+}
+const postfixRE = /[?#].*$/s;
+function cleanUrl(url) {
+ return url.replace(postfixRE, '');
+}
+function isObject(value) {
+ return Object.prototype.toString.call(value) === '[object Object]';
+}
+function tryStatSync(file) {
+ try {
+ return fs$1.statSync(file, { throwIfNoEntry: false });
+ }
+ catch {
+ // Ignore errors
+ }
+}
+function isFileReadable(filename) {
+ try {
+ // The "throwIfNoEntry" is a performance optimization for cases where the file does not exist
+ if (!fs$1.statSync(filename, { throwIfNoEntry: false })) {
+ return false;
+ }
+ // Check if current process has read permission to the file
+ fs$1.accessSync(filename, fs$1.constants.R_OK);
+ return true;
+ }
+ catch {
+ return false;
+ }
+}
+function arraify(target) {
+ return Array.isArray(target) ? target : [target];
+}
+// @ts-expect-error jest only exists when running Jest
+const usingDynamicImport = typeof jest === 'undefined';
+/**
+ * Dynamically import files. It will make sure it's not being compiled away by TS/Rollup.
+ *
+ * As a temporary workaround for Jest's lack of stable ESM support, we fallback to require
+ * if we're in a Jest environment.
+ * See https://github.com/vitejs/vite/pull/5197#issuecomment-938054077
+ *
+ * @param file File path to import.
+ */
+usingDynamicImport
+ ? new Function('file', 'return import(file)')
+ : _require;
+path$3.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href))));
+function mergeConfigRecursively(defaults, overrides, rootPath) {
+ const merged = { ...defaults };
+ for (const key in overrides) {
+ const value = overrides[key];
+ if (value == null) {
+ continue;
+ }
+ const existing = merged[key];
+ if (existing == null) {
+ merged[key] = value;
+ continue;
+ }
+ // fields that require special handling
+ if (key === 'alias' && (rootPath === 'resolve' || rootPath === '')) {
+ merged[key] = mergeAlias(existing, value);
+ continue;
+ }
+ else if (key === 'assetsInclude' && rootPath === '') {
+ merged[key] = [].concat(existing, value);
+ continue;
+ }
+ else if (key === 'noExternal' &&
+ rootPath === 'ssr' &&
+ (existing === true || value === true)) {
+ merged[key] = true;
+ continue;
+ }
+ if (Array.isArray(existing) || Array.isArray(value)) {
+ merged[key] = [...arraify(existing ?? []), ...arraify(value ?? [])];
+ continue;
+ }
+ if (isObject(existing) && isObject(value)) {
+ merged[key] = mergeConfigRecursively(existing, value, rootPath ? `${rootPath}.${key}` : key);
+ continue;
+ }
+ merged[key] = value;
+ }
+ return merged;
+}
+function mergeConfig(defaults, overrides, isRoot = true) {
+ if (typeof defaults === 'function' || typeof overrides === 'function') {
+ throw new Error(`Cannot merge config in form of callback`);
+ }
+ return mergeConfigRecursively(defaults, overrides, isRoot ? '' : '.');
+}
+function mergeAlias(a, b) {
+ if (!a)
+ return b;
+ if (!b)
+ return a;
+ if (isObject(a) && isObject(b)) {
+ return { ...a, ...b };
+ }
+ // the order is flipped because the alias is resolved from top-down,
+ // where the later should have higher priority
+ return [...normalizeAlias(b), ...normalizeAlias(a)];
+}
+function normalizeAlias(o = []) {
+ return Array.isArray(o)
+ ? o.map(normalizeSingleAlias)
+ : Object.keys(o).map((find) => normalizeSingleAlias({
+ find,
+ replacement: o[find],
+ }));
+}
+// https://github.com/vitejs/vite/issues/1363
+// work around https://github.com/rollup/plugins/issues/759
+function normalizeSingleAlias({ find, replacement, customResolver, }) {
+ if (typeof find === 'string' &&
+ find[find.length - 1] === '/' &&
+ replacement[replacement.length - 1] === '/') {
+ find = find.slice(0, find.length - 1);
+ replacement = replacement.slice(0, replacement.length - 1);
+ }
+ const alias = {
+ find,
+ replacement,
+ };
+ if (customResolver) {
+ alias.customResolver = customResolver;
+ }
+ return alias;
+}
+
+// This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
+// copy from constants.ts
+const CSS_LANGS_RE =
+// eslint-disable-next-line regexp/no-unused-capturing-group
+/\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
+const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
+// Use splitVendorChunkPlugin() to get the same manualChunks strategy as Vite 2.7
+// We don't recommend using this strategy as a general solution moving forward
+// splitVendorChunk is a simple index/vendor strategy that was used in Vite
+// until v2.8. It is exposed to let people continue to use it in case it was
+// working well for their setups.
+// The cache needs to be reset on buildStart for watch mode to work correctly
+// Don't use this manualChunks strategy for ssr, lib mode, and 'umd' or 'iife'
+class SplitVendorChunkCache {
+ constructor() {
+ this.cache = new Map();
+ }
+ reset() {
+ this.cache = new Map();
+ }
+}
+function splitVendorChunk(options = {}) {
+ const cache = options.cache ?? new SplitVendorChunkCache();
+ return (id, { getModuleInfo }) => {
+ if (isInNodeModules(id) &&
+ !isCSSRequest(id) &&
+ staticImportedByEntry(id, getModuleInfo, cache.cache)) {
+ return 'vendor';
+ }
+ };
+}
+function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
+ if (cache.has(id)) {
+ return cache.get(id);
+ }
+ if (importStack.includes(id)) {
+ // circular deps!
+ cache.set(id, false);
+ return false;
+ }
+ const mod = getModuleInfo(id);
+ if (!mod) {
+ cache.set(id, false);
+ return false;
+ }
+ if (mod.isEntry) {
+ cache.set(id, true);
+ return true;
+ }
+ const someImporterIs = mod.importers.some((importer) => staticImportedByEntry(importer, getModuleInfo, cache, importStack.concat(id)));
+ cache.set(id, someImporterIs);
+ return someImporterIs;
+}
+function splitVendorChunkPlugin() {
+ const caches = [];
+ function createSplitVendorChunk(output, config) {
+ const cache = new SplitVendorChunkCache();
+ caches.push(cache);
+ const build = config.build ?? {};
+ const format = output?.format;
+ if (!build.ssr && !build.lib && format !== 'umd' && format !== 'iife') {
+ return splitVendorChunk({ cache });
+ }
+ }
+ return {
+ name: 'vite:split-vendor-chunk',
+ config(config) {
+ let outputs = config?.build?.rollupOptions?.output;
+ if (outputs) {
+ outputs = Array.isArray(outputs) ? outputs : [outputs];
+ for (const output of outputs) {
+ const viteManualChunks = createSplitVendorChunk(output, config);
+ if (viteManualChunks) {
+ if (output.manualChunks) {
+ if (typeof output.manualChunks === 'function') {
+ const userManualChunks = output.manualChunks;
+ output.manualChunks = (id, api) => {
+ return userManualChunks(id, api) ?? viteManualChunks(id, api);
+ };
+ }
+ else {
+ // else, leave the object form of manualChunks untouched, as
+ // we can't safely replicate rollup handling.
+ // eslint-disable-next-line no-console
+ console.warn("(!) the `splitVendorChunk` plugin doesn't have any effect when using the object form of `build.rollupOptions.output.manualChunks`. Consider using the function form instead.");
+ }
+ }
+ else {
+ output.manualChunks = viteManualChunks;
+ }
+ }
+ }
+ }
+ else {
+ return {
+ build: {
+ rollupOptions: {
+ output: {
+ manualChunks: createSplitVendorChunk({}, config),
+ },
+ },
+ },
+ };
+ }
+ },
+ buildStart() {
+ caches.forEach((cache) => cache.reset());
+ },
+ };
+}
+
+/*!
+ * etag
+ * Copyright(c) 2014-2016 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+/**
+ * Module exports.
+ * @public
+ */
+
+var etag_1 = etag;
+
+/**
+ * Module dependencies.
+ * @private
+ */
+
+var crypto$1 = require$$0$2;
+var Stats = fs$2.Stats;
+
+/**
+ * Module variables.
+ * @private
+ */
+
+var toString = Object.prototype.toString;
+
+/**
+ * Generate an entity tag.
+ *
+ * @param {Buffer|string} entity
+ * @return {string}
+ * @private
+ */
+
+function entitytag (entity) {
+ if (entity.length === 0) {
+ // fast-path empty
+ return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"'
+ }
+
+ // compute hash of entity
+ var hash = crypto$1
+ .createHash('sha1')
+ .update(entity, 'utf8')
+ .digest('base64')
+ .substring(0, 27);
+
+ // compute length of entity
+ var len = typeof entity === 'string'
+ ? Buffer.byteLength(entity, 'utf8')
+ : entity.length;
+
+ return '"' + len.toString(16) + '-' + hash + '"'
+}
+
+/**
+ * Create a simple ETag.
+ *
+ * @param {string|Buffer|Stats} entity
+ * @param {object} [options]
+ * @param {boolean} [options.weak]
+ * @return {String}
+ * @public
+ */
+
+function etag (entity, options) {
+ if (entity == null) {
+ throw new TypeError('argument entity is required')
+ }
+
+ // support fs.Stats object
+ var isStats = isstats(entity);
+ var weak = options && typeof options.weak === 'boolean'
+ ? options.weak
+ : isStats;
+
+ // validate argument
+ if (!isStats && typeof entity !== 'string' && !Buffer.isBuffer(entity)) {
+ throw new TypeError('argument entity must be string, Buffer, or fs.Stats')
+ }
+
+ // generate entity tag
+ var tag = isStats
+ ? stattag(entity)
+ : entitytag(entity);
+
+ return weak
+ ? 'W/' + tag
+ : tag
+}
+
+/**
+ * Determine if object is a Stats object.
+ *
+ * @param {object} obj
+ * @return {boolean}
+ * @api private
+ */
+
+function isstats (obj) {
+ // genuine fs.Stats
+ if (typeof Stats === 'function' && obj instanceof Stats) {
+ return true
+ }
+
+ // quack quack
+ return obj && typeof obj === 'object' &&
+ 'ctime' in obj && toString.call(obj.ctime) === '[object Date]' &&
+ 'mtime' in obj && toString.call(obj.mtime) === '[object Date]' &&
+ 'ino' in obj && typeof obj.ino === 'number' &&
+ 'size' in obj && typeof obj.size === 'number'
+}
+
+/**
+ * Generate a tag for a stat.
+ *
+ * @param {object} stat
+ * @return {string}
+ * @private
+ */
+
+function stattag (stat) {
+ var mtime = stat.mtime.getTime().toString(16);
+ var size = stat.size.toString(16);
+
+ return '"' + size + '-' + mtime + '"'
+}
+
+var getEtag = /*@__PURE__*/getDefaultExportFromCjs(etag_1);
+
+const debug = createDebugger('vite:sourcemap', {
+ onlyWhenFocused: true,
+});
+function genSourceMapUrl(map) {
+ if (typeof map !== 'string') {
+ map = JSON.stringify(map);
+ }
+ return `data:application/json;base64,${Buffer.from(map).toString('base64')}`;
+}
+function getCodeWithSourcemap(type, code, map) {
+ if (debug) {
+ code += `\n/*${JSON.stringify(map, null, 2).replace(/\*\//g, '*\\/')}*/\n`;
+ }
+ if (type === 'js') {
+ code += `\n//# sourceMappingURL=${genSourceMapUrl(map)}`;
+ }
+ else if (type === 'css') {
+ code += `\n/*# sourceMappingURL=${genSourceMapUrl(map)} */`;
+ }
+ return code;
+}
+
+const alias = {
+ js: 'application/javascript',
+ css: 'text/css',
+ html: 'text/html',
+ json: 'application/json',
+};
+function send(req, res, content, type, options) {
+ const { etag = getEtag(content, { weak: true }), cacheControl = 'no-cache', headers, map, } = options;
+ if (res.writableEnded) {
+ return;
+ }
+ if (req.headers['if-none-match'] === etag) {
+ res.statusCode = 304;
+ res.end();
+ return;
+ }
+ res.setHeader('Content-Type', alias[type] || type);
+ res.setHeader('Cache-Control', cacheControl);
+ res.setHeader('Etag', etag);
+ if (headers) {
+ for (const name in headers) {
+ res.setHeader(name, headers[name]);
+ }
+ }
+ // inject source map reference
+ if (map && map.mappings) {
+ if (type === 'js' || type === 'css') {
+ content = getCodeWithSourcemap(type, content.toString(), map);
+ }
+ }
+ res.statusCode = 200;
+ res.end(content);
+ return;
+}
+
+/* eslint no-console: 0 */
+const LogLevels = {
+ silent: 0,
+ error: 1,
+ warn: 2,
+ info: 3,
+};
+let lastType;
+let lastMsg;
+let sameCount = 0;
+function clearScreen() {
+ const repeatCount = process.stdout.rows - 2;
+ const blank = repeatCount > 0 ? '\n'.repeat(repeatCount) : '';
+ console.log(blank);
+ readline.cursorTo(process.stdout, 0, 0);
+ readline.clearScreenDown(process.stdout);
+}
+function createLogger(level = 'info', options = {}) {
+ if (options.customLogger) {
+ return options.customLogger;
+ }
+ const timeFormatter = new Intl.DateTimeFormat(undefined, {
+ hour: 'numeric',
+ minute: 'numeric',
+ second: 'numeric',
+ });
+ const loggedErrors = new WeakSet();
+ const { prefix = '[vite]', allowClearScreen = true } = options;
+ const thresh = LogLevels[level];
+ const canClearScreen = allowClearScreen && process.stdout.isTTY && !process.env.CI;
+ const clear = canClearScreen ? clearScreen : () => { };
+ function output(type, msg, options = {}) {
+ if (thresh >= LogLevels[type]) {
+ const method = type === 'info' ? 'log' : type;
+ const format = () => {
+ if (options.timestamp) {
+ const tag = type === 'info'
+ ? colors.cyan(colors.bold(prefix))
+ : type === 'warn'
+ ? colors.yellow(colors.bold(prefix))
+ : colors.red(colors.bold(prefix));
+ return `${colors.dim(timeFormatter.format(new Date()))} ${tag} ${msg}`;
+ }
+ else {
+ return msg;
+ }
+ };
+ if (options.error) {
+ loggedErrors.add(options.error);
+ }
+ if (canClearScreen) {
+ if (type === lastType && msg === lastMsg) {
+ sameCount++;
+ clear();
+ console[method](format(), colors.yellow(`(x${sameCount + 1})`));
+ }
+ else {
+ sameCount = 0;
+ lastMsg = msg;
+ lastType = type;
+ if (options.clear) {
+ clear();
+ }
+ console[method](format());
+ }
+ }
+ else {
+ console[method](format());
+ }
+ }
+ }
+ const warnedMessages = new Set();
+ const logger = {
+ hasWarned: false,
+ info(msg, opts) {
+ output('info', msg, opts);
+ },
+ warn(msg, opts) {
+ logger.hasWarned = true;
+ output('warn', msg, opts);
+ },
+ warnOnce(msg, opts) {
+ if (warnedMessages.has(msg))
+ return;
+ logger.hasWarned = true;
+ output('warn', msg, opts);
+ warnedMessages.add(msg);
+ },
+ error(msg, opts) {
+ logger.hasWarned = true;
+ output('error', msg, opts);
+ },
+ clearScreen(type) {
+ if (thresh >= LogLevels[type]) {
+ clear();
+ }
+ },
+ hasErrorLogged(error) {
+ return loggedErrors.has(error);
+ },
+ };
+ return logger;
+}
+
+// https://github.com/vitejs/vite/issues/2820#issuecomment-812495079
+const ROOT_FILES = [
+ // '.git',
+ // https://pnpm.io/workspaces/
+ 'pnpm-workspace.yaml',
+ // https://rushjs.io/pages/advanced/config_files/
+ // 'rush.json',
+ // https://nx.dev/latest/react/getting-started/nx-setup
+ // 'workspace.json',
+ // 'nx.json',
+ // https://github.com/lerna/lerna#lernajson
+ 'lerna.json',
+];
+// npm: https://docs.npmjs.com/cli/v7/using-npm/workspaces#installing-workspaces
+// yarn: https://classic.yarnpkg.com/en/docs/workspaces/#toc-how-to-use-it
+function hasWorkspacePackageJSON(root) {
+ const path = path$3.join(root, 'package.json');
+ if (!isFileReadable(path)) {
+ return false;
+ }
+ const content = JSON.parse(fs$1.readFileSync(path, 'utf-8')) || {};
+ return !!content.workspaces;
+}
+function hasRootFile(root) {
+ return ROOT_FILES.some((file) => fs$1.existsSync(path$3.join(root, file)));
+}
+function hasPackageJSON(root) {
+ const path = path$3.join(root, 'package.json');
+ return fs$1.existsSync(path);
+}
+/**
+ * Search up for the nearest `package.json`
+ */
+function searchForPackageRoot(current, root = current) {
+ if (hasPackageJSON(current))
+ return current;
+ const dir = path$3.dirname(current);
+ // reach the fs root
+ if (!dir || dir === current)
+ return root;
+ return searchForPackageRoot(dir, root);
+}
+/**
+ * Search up for the nearest workspace root
+ */
+function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
+ if (hasRootFile(current))
+ return current;
+ if (hasWorkspacePackageJSON(current))
+ return current;
+ const dir = path$3.dirname(current);
+ // reach the fs root
+ if (!dir || dir === current)
+ return root;
+ return searchForWorkspaceRoot(dir, root);
+}
+
+/**
+ * Check if the url is allowed to be served, via the `server.fs` config.
+ */
+function isFileServingAllowed(url, server) {
+ if (!server.config.server.fs.strict)
+ return true;
+ const file = fsPathFromUrl(url);
+ if (server._fsDenyGlob(file))
+ return false;
+ if (server.moduleGraph.safeModulesPath.has(file))
+ return true;
+ if (server.config.server.fs.allow.some((uri) => isSameFileUri(uri, file) || isParentDirectory(uri, file)))
+ return true;
+ return false;
+}
+
+var main$1 = {exports: {}};
+
+var name = "dotenv";
+var version$1 = "16.3.1";
+var description = "Loads environment variables from .env file";
+var main = "lib/main.js";
+var types = "lib/main.d.ts";
+var exports$1 = {
+ ".": {
+ types: "./lib/main.d.ts",
+ require: "./lib/main.js",
+ "default": "./lib/main.js"
+ },
+ "./config": "./config.js",
+ "./config.js": "./config.js",
+ "./lib/env-options": "./lib/env-options.js",
+ "./lib/env-options.js": "./lib/env-options.js",
+ "./lib/cli-options": "./lib/cli-options.js",
+ "./lib/cli-options.js": "./lib/cli-options.js",
+ "./package.json": "./package.json"
+};
+var scripts = {
+ "dts-check": "tsc --project tests/types/tsconfig.json",
+ lint: "standard",
+ "lint-readme": "standard-markdown",
+ pretest: "npm run lint && npm run dts-check",
+ test: "tap tests/*.js --100 -Rspec",
+ prerelease: "npm test",
+ release: "standard-version"
+};
+var repository = {
+ type: "git",
+ url: "git://github.com/motdotla/dotenv.git"
+};
+var funding = "https://github.com/motdotla/dotenv?sponsor=1";
+var keywords = [
+ "dotenv",
+ "env",
+ ".env",
+ "environment",
+ "variables",
+ "config",
+ "settings"
+];
+var readmeFilename = "README.md";
+var license = "BSD-2-Clause";
+var devDependencies = {
+ "@definitelytyped/dtslint": "^0.0.133",
+ "@types/node": "^18.11.3",
+ decache: "^4.6.1",
+ sinon: "^14.0.1",
+ standard: "^17.0.0",
+ "standard-markdown": "^7.1.0",
+ "standard-version": "^9.5.0",
+ tap: "^16.3.0",
+ tar: "^6.1.11",
+ typescript: "^4.8.4"
+};
+var engines = {
+ node: ">=12"
+};
+var browser = {
+ fs: false
+};
+var require$$4 = {
+ name: name,
+ version: version$1,
+ description: description,
+ main: main,
+ types: types,
+ exports: exports$1,
+ scripts: scripts,
+ repository: repository,
+ funding: funding,
+ keywords: keywords,
+ readmeFilename: readmeFilename,
+ license: license,
+ devDependencies: devDependencies,
+ engines: engines,
+ browser: browser
+};
+
+const fs = fs$2;
+const path = require$$0$1;
+const os = require$$2;
+const crypto = require$$0$2;
+const packageJson = require$$4;
+
+const version = packageJson.version;
+
+const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
+
+// Parse src into an Object
+function parse (src) {
+ const obj = {};
+
+ // Convert buffer to string
+ let lines = src.toString();
+
+ // Convert line breaks to same format
+ lines = lines.replace(/\r\n?/mg, '\n');
+
+ let match;
+ while ((match = LINE.exec(lines)) != null) {
+ const key = match[1];
+
+ // Default undefined or null to empty string
+ let value = (match[2] || '');
+
+ // Remove whitespace
+ value = value.trim();
+
+ // Check if double quoted
+ const maybeQuote = value[0];
+
+ // Remove surrounding quotes
+ value = value.replace(/^(['"`])([\s\S]*)\1$/mg, '$2');
+
+ // Expand newlines if double quoted
+ if (maybeQuote === '"') {
+ value = value.replace(/\\n/g, '\n');
+ value = value.replace(/\\r/g, '\r');
+ }
+
+ // Add to object
+ obj[key] = value;
+ }
+
+ return obj
+}
+
+function _parseVault (options) {
+ const vaultPath = _vaultPath(options);
+
+ // Parse .env.vault
+ const result = DotenvModule.configDotenv({ path: vaultPath });
+ if (!result.parsed) {
+ throw new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`)
+ }
+
+ // handle scenario for comma separated keys - for use with key rotation
+ // example: DOTENV_KEY="dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenv.org/vault/.env.vault?environment=prod"
+ const keys = _dotenvKey(options).split(',');
+ const length = keys.length;
+
+ let decrypted;
+ for (let i = 0; i < length; i++) {
+ try {
+ // Get full key
+ const key = keys[i].trim();
+
+ // Get instructions for decrypt
+ const attrs = _instructions(result, key);
+
+ // Decrypt
+ decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
+
+ break
+ } catch (error) {
+ // last key
+ if (i + 1 >= length) {
+ throw error
+ }
+ // try next key
+ }
+ }
+
+ // Parse decrypted .env string
+ return DotenvModule.parse(decrypted)
+}
+
+function _log (message) {
+ console.log(`[dotenv@${version}][INFO] ${message}`);
+}
+
+function _warn (message) {
+ console.log(`[dotenv@${version}][WARN] ${message}`);
+}
+
+function _debug (message) {
+ console.log(`[dotenv@${version}][DEBUG] ${message}`);
+}
+
+function _dotenvKey (options) {
+ // prioritize developer directly setting options.DOTENV_KEY
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
+ return options.DOTENV_KEY
+ }
+
+ // secondary infra already contains a DOTENV_KEY environment variable
+ if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
+ return process.env.DOTENV_KEY
+ }
+
+ // fallback to empty string
+ return ''
+}
+
+function _instructions (result, dotenvKey) {
+ // Parse DOTENV_KEY. Format is a URI
+ let uri;
+ try {
+ uri = new URL(dotenvKey);
+ } catch (error) {
+ if (error.code === 'ERR_INVALID_URL') {
+ throw new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development')
+ }
+
+ throw error
+ }
+
+ // Get decrypt key
+ const key = uri.password;
+ if (!key) {
+ throw new Error('INVALID_DOTENV_KEY: Missing key part')
+ }
+
+ // Get environment
+ const environment = uri.searchParams.get('environment');
+ if (!environment) {
+ throw new Error('INVALID_DOTENV_KEY: Missing environment part')
+ }
+
+ // Get ciphertext payload
+ const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
+ const ciphertext = result.parsed[environmentKey]; // DOTENV_VAULT_PRODUCTION
+ if (!ciphertext) {
+ throw new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`)
+ }
+
+ return { ciphertext, key }
+}
+
+function _vaultPath (options) {
+ let dotenvPath = path.resolve(process.cwd(), '.env');
+
+ if (options && options.path && options.path.length > 0) {
+ dotenvPath = options.path;
+ }
+
+ // Locate .env.vault
+ return dotenvPath.endsWith('.vault') ? dotenvPath : `${dotenvPath}.vault`
+}
+
+function _resolveHome (envPath) {
+ return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath
+}
+
+function _configVault (options) {
+ _log('Loading env from encrypted .env.vault');
+
+ const parsed = DotenvModule._parseVault(options);
+
+ let processEnv = process.env;
+ if (options && options.processEnv != null) {
+ processEnv = options.processEnv;
+ }
+
+ DotenvModule.populate(processEnv, parsed, options);
+
+ return { parsed }
+}
+
+function configDotenv (options) {
+ let dotenvPath = path.resolve(process.cwd(), '.env');
+ let encoding = 'utf8';
+ const debug = Boolean(options && options.debug);
+
+ if (options) {
+ if (options.path != null) {
+ dotenvPath = _resolveHome(options.path);
+ }
+ if (options.encoding != null) {
+ encoding = options.encoding;
+ }
+ }
+
+ try {
+ // Specifying an encoding returns a string instead of a buffer
+ const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }));
+
+ let processEnv = process.env;
+ if (options && options.processEnv != null) {
+ processEnv = options.processEnv;
+ }
+
+ DotenvModule.populate(processEnv, parsed, options);
+
+ return { parsed }
+ } catch (e) {
+ if (debug) {
+ _debug(`Failed to load ${dotenvPath} ${e.message}`);
+ }
+
+ return { error: e }
+ }
+}
+
+// Populates process.env from .env file
+function config (options) {
+ const vaultPath = _vaultPath(options);
+
+ // fallback to original dotenv if DOTENV_KEY is not set
+ if (_dotenvKey(options).length === 0) {
+ return DotenvModule.configDotenv(options)
+ }
+
+ // dotenvKey exists but .env.vault file does not exist
+ if (!fs.existsSync(vaultPath)) {
+ _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
+
+ return DotenvModule.configDotenv(options)
+ }
+
+ return DotenvModule._configVault(options)
+}
+
+function decrypt (encrypted, keyStr) {
+ const key = Buffer.from(keyStr.slice(-64), 'hex');
+ let ciphertext = Buffer.from(encrypted, 'base64');
+
+ const nonce = ciphertext.slice(0, 12);
+ const authTag = ciphertext.slice(-16);
+ ciphertext = ciphertext.slice(12, -16);
+
+ try {
+ const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce);
+ aesgcm.setAuthTag(authTag);
+ return `${aesgcm.update(ciphertext)}${aesgcm.final()}`
+ } catch (error) {
+ const isRange = error instanceof RangeError;
+ const invalidKeyLength = error.message === 'Invalid key length';
+ const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data';
+
+ if (isRange || invalidKeyLength) {
+ const msg = 'INVALID_DOTENV_KEY: It must be 64 characters long (or more)';
+ throw new Error(msg)
+ } else if (decryptionFailed) {
+ const msg = 'DECRYPTION_FAILED: Please check your DOTENV_KEY';
+ throw new Error(msg)
+ } else {
+ console.error('Error: ', error.code);
+ console.error('Error: ', error.message);
+ throw error
+ }
+ }
+}
+
+// Populate process.env with parsed values
+function populate (processEnv, parsed, options = {}) {
+ const debug = Boolean(options && options.debug);
+ const override = Boolean(options && options.override);
+
+ if (typeof parsed !== 'object') {
+ throw new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate')
+ }
+
+ // Set process.env
+ for (const key of Object.keys(parsed)) {
+ if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
+ if (override === true) {
+ processEnv[key] = parsed[key];
+ }
+
+ if (debug) {
+ if (override === true) {
+ _debug(`"${key}" is already defined and WAS overwritten`);
+ } else {
+ _debug(`"${key}" is already defined and was NOT overwritten`);
+ }
+ }
+ } else {
+ processEnv[key] = parsed[key];
+ }
+ }
+}
+
+const DotenvModule = {
+ configDotenv,
+ _configVault,
+ _parseVault,
+ config,
+ decrypt,
+ parse,
+ populate
+};
+
+main$1.exports.configDotenv = DotenvModule.configDotenv;
+main$1.exports._configVault = DotenvModule._configVault;
+main$1.exports._parseVault = DotenvModule._parseVault;
+main$1.exports.config = DotenvModule.config;
+main$1.exports.decrypt = DotenvModule.decrypt;
+var parse_1 = main$1.exports.parse = DotenvModule.parse;
+main$1.exports.populate = DotenvModule.populate;
+
+main$1.exports = DotenvModule;
+
+function _interpolate (envValue, environment, config) {
+ const matches = envValue.match(/(.?\${*[\w]*(?::-[\w/]*)?}*)/g) || [];
+
+ return matches.reduce(function (newEnv, match, index) {
+ const parts = /(.?)\${*([\w]*(?::-[\w/]*)?)?}*/g.exec(match);
+ if (!parts || parts.length === 0) {
+ return newEnv
+ }
+
+ const prefix = parts[1];
+
+ let value, replacePart;
+
+ if (prefix === '\\') {
+ replacePart = parts[0];
+ value = replacePart.replace('\\$', '$');
+ } else {
+ // PATCH: compatible with env variables ended with unescaped $
+ if(!parts[2]) {
+ return newEnv
+ }
+ const keyParts = parts[2].split(':-');
+ const key = keyParts[0];
+ replacePart = parts[0].substring(prefix.length);
+ // process.env value 'wins' over .env file's value
+ value = Object.prototype.hasOwnProperty.call(environment, key)
+ ? environment[key]
+ : (config.parsed[key] || keyParts[1] || '');
+
+ // If the value is found, remove nested expansions.
+ if (keyParts.length > 1 && value) {
+ const replaceNested = matches[index + 1];
+ matches[index + 1] = '';
+
+ newEnv = newEnv.replace(replaceNested, '');
+ }
+ // Resolve recursive interpolations
+ value = _interpolate(value, environment, config);
+ }
+
+ return newEnv.replace(replacePart, value)
+ }, envValue)
+}
+
+function expand (config) {
+ // if ignoring process.env, use a blank object
+ const environment = config.ignoreProcessEnv ? {} : process.env;
+
+ for (const configKey in config.parsed) {
+ const value = Object.prototype.hasOwnProperty.call(environment, configKey) ? environment[configKey] : config.parsed[configKey];
+
+ config.parsed[configKey] = _interpolate(value, environment, config);
+ }
+
+ // PATCH: don't write to process.env
+ // for (const processKey in config.parsed) {
+ // environment[processKey] = config.parsed[processKey]
+ // }
+
+ return config
+}
+
+var expand_1 = expand;
+
+function loadEnv(mode, envDir, prefixes = 'VITE_') {
+ if (mode === 'local') {
+ throw new Error(`"local" cannot be used as a mode name because it conflicts with ` +
+ `the .local postfix for .env files.`);
+ }
+ prefixes = arraify(prefixes);
+ const env = {};
+ const envFiles = [
+ /** default file */ `.env`,
+ /** local file */ `.env.local`,
+ /** mode file */ `.env.${mode}`,
+ /** mode local file */ `.env.${mode}.local`,
+ ];
+ const parsed = Object.fromEntries(envFiles.flatMap((file) => {
+ const filePath = path$3.join(envDir, file);
+ if (!tryStatSync(filePath)?.isFile())
+ return [];
+ return Object.entries(parse_1(fs$1.readFileSync(filePath)));
+ }));
+ // test NODE_ENV override before expand as otherwise process.env.NODE_ENV would override this
+ if (parsed.NODE_ENV && process.env.VITE_USER_NODE_ENV === undefined) {
+ process.env.VITE_USER_NODE_ENV = parsed.NODE_ENV;
+ }
+ // support BROWSER and BROWSER_ARGS env variables
+ if (parsed.BROWSER && process.env.BROWSER === undefined) {
+ process.env.BROWSER = parsed.BROWSER;
+ }
+ if (parsed.BROWSER_ARGS && process.env.BROWSER_ARGS === undefined) {
+ process.env.BROWSER_ARGS = parsed.BROWSER_ARGS;
+ }
+ // let environment variables use each other
+ // `expand` patched in patches/dotenv-expand@9.0.0.patch
+ expand_1({ parsed });
+ // only keys that start with prefix are exposed to client
+ for (const [key, value] of Object.entries(parsed)) {
+ if (prefixes.some((prefix) => key.startsWith(prefix))) {
+ env[key] = value;
+ }
+ }
+ // check if there are actual env variables starting with VITE_*
+ // these are typically provided inline and should be prioritized
+ for (const key in process.env) {
+ if (prefixes.some((prefix) => key.startsWith(prefix))) {
+ env[key] = process.env[key];
+ }
+ }
+ return env;
+}
+function resolveEnvPrefix({ envPrefix = 'VITE_', }) {
+ envPrefix = arraify(envPrefix);
+ if (envPrefix.some((prefix) => prefix === '')) {
+ throw new Error(`envPrefix option contains value '', which could lead unexpected exposure of sensitive information.`);
+ }
+ return envPrefix;
+}
+
+exports.esbuildVersion = esbuild.version;
+exports.rollupVersion = rollup.VERSION;
+exports.createFilter = createFilter;
+exports.createLogger = createLogger;
+exports.isCSSRequest = isCSSRequest;
+exports.isFileServingAllowed = isFileServingAllowed;
+exports.loadEnv = loadEnv;
+exports.mergeAlias = mergeAlias;
+exports.mergeConfig = mergeConfig;
+exports.normalizePath = normalizePath;
+exports.resolveEnvPrefix = resolveEnvPrefix;
+exports.searchForWorkspaceRoot = searchForWorkspaceRoot;
+exports.send = send;
+exports.splitVendorChunk = splitVendorChunk;
+exports.splitVendorChunkPlugin = splitVendorChunkPlugin;
+exports.version = VERSION;
diff --git a/node_modules/vite/dist/node/chunks/dep-73522cdf.js b/node_modules/vite/dist/node/chunks/dep-73522cdf.js
new file mode 100644
index 0000000..a2deaf6
--- /dev/null
+++ b/node_modules/vite/dist/node/chunks/dep-73522cdf.js
@@ -0,0 +1,7646 @@
+import { F as commonjsGlobal, E as getDefaultExportFromCjs } from './dep-df561101.js';
+import require$$0__default from 'fs';
+import require$$0 from 'postcss';
+import require$$0$1 from 'path';
+import require$$3 from 'crypto';
+import require$$0$2 from 'util';
+import { l as lib } from './dep-c423598f.js';
+
+import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
+import { dirname as __cjs_dirname } from 'node:path';
+import { createRequire as __cjs_createRequire } from 'node:module';
+
+const __filename = __cjs_fileURLToPath(import.meta.url);
+const __dirname = __cjs_dirname(__filename);
+const require = __cjs_createRequire(import.meta.url);
+const __require = require;
+function _mergeNamespaces(n, m) {
+ for (var i = 0; i < m.length; i++) {
+ var e = m[i];
+ if (typeof e !== 'string' && !Array.isArray(e)) { for (var k in e) {
+ if (k !== 'default' && !(k in n)) {
+ n[k] = e[k];
+ }
+ } }
+ }
+ return n;
+}
+
+var build = {exports: {}};
+
+var fs = {};
+
+Object.defineProperty(fs, "__esModule", {
+ value: true
+});
+fs.getFileSystem = getFileSystem;
+fs.setFileSystem = setFileSystem;
+let fileSystem = {
+ readFile: () => {
+ throw Error("readFile not implemented");
+ },
+ writeFile: () => {
+ throw Error("writeFile not implemented");
+ }
+};
+
+function setFileSystem(fs) {
+ fileSystem.readFile = fs.readFile;
+ fileSystem.writeFile = fs.writeFile;
+}
+
+function getFileSystem() {
+ return fileSystem;
+}
+
+var pluginFactory = {};
+
+var unquote$1 = {};
+
+Object.defineProperty(unquote$1, "__esModule", {
+ value: true
+});
+unquote$1.default = unquote;
+// copied from https://github.com/lakenen/node-unquote
+const reg = /['"]/;
+
+function unquote(str) {
+ if (!str) {
+ return "";
+ }
+
+ if (reg.test(str.charAt(0))) {
+ str = str.substr(1);
+ }
+
+ if (reg.test(str.charAt(str.length - 1))) {
+ str = str.substr(0, str.length - 1);
+ }
+
+ return str;
+}
+
+var Parser$1 = {};
+
+const matchValueName = /[$]?[\w-]+/g;
+
+const replaceValueSymbols$2 = (value, replacements) => {
+ let matches;
+
+ while ((matches = matchValueName.exec(value))) {
+ const replacement = replacements[matches[0]];
+
+ if (replacement) {
+ value =
+ value.slice(0, matches.index) +
+ replacement +
+ value.slice(matchValueName.lastIndex);
+
+ matchValueName.lastIndex -= matches[0].length - replacement.length;
+ }
+ }
+
+ return value;
+};
+
+var replaceValueSymbols_1 = replaceValueSymbols$2;
+
+const replaceValueSymbols$1 = replaceValueSymbols_1;
+
+const replaceSymbols$1 = (css, replacements) => {
+ css.walk((node) => {
+ if (node.type === "decl" && node.value) {
+ node.value = replaceValueSymbols$1(node.value.toString(), replacements);
+ } else if (node.type === "rule" && node.selector) {
+ node.selector = replaceValueSymbols$1(
+ node.selector.toString(),
+ replacements
+ );
+ } else if (node.type === "atrule" && node.params) {
+ node.params = replaceValueSymbols$1(node.params.toString(), replacements);
+ }
+ });
+};
+
+var replaceSymbols_1 = replaceSymbols$1;
+
+const importPattern = /^:import\(("[^"]*"|'[^']*'|[^"']+)\)$/;
+const balancedQuotes = /^("[^"]*"|'[^']*'|[^"']+)$/;
+
+const getDeclsObject = (rule) => {
+ const object = {};
+
+ rule.walkDecls((decl) => {
+ const before = decl.raws.before ? decl.raws.before.trim() : "";
+
+ object[before + decl.prop] = decl.value;
+ });
+
+ return object;
+};
+/**
+ *
+ * @param {string} css
+ * @param {boolean} removeRules
+ * @param {'auto' | 'rule' | 'at-rule'} mode
+ */
+const extractICSS$2 = (css, removeRules = true, mode = "auto") => {
+ const icssImports = {};
+ const icssExports = {};
+
+ function addImports(node, path) {
+ const unquoted = path.replace(/'|"/g, "");
+ icssImports[unquoted] = Object.assign(
+ icssImports[unquoted] || {},
+ getDeclsObject(node)
+ );
+
+ if (removeRules) {
+ node.remove();
+ }
+ }
+
+ function addExports(node) {
+ Object.assign(icssExports, getDeclsObject(node));
+ if (removeRules) {
+ node.remove();
+ }
+ }
+
+ css.each((node) => {
+ if (node.type === "rule" && mode !== "at-rule") {
+ if (node.selector.slice(0, 7) === ":import") {
+ const matches = importPattern.exec(node.selector);
+
+ if (matches) {
+ addImports(node, matches[1]);
+ }
+ }
+
+ if (node.selector === ":export") {
+ addExports(node);
+ }
+ }
+
+ if (node.type === "atrule" && mode !== "rule") {
+ if (node.name === "icss-import") {
+ const matches = balancedQuotes.exec(node.params);
+
+ if (matches) {
+ addImports(node, matches[1]);
+ }
+ }
+ if (node.name === "icss-export") {
+ addExports(node);
+ }
+ }
+ });
+
+ return { icssImports, icssExports };
+};
+
+var extractICSS_1 = extractICSS$2;
+
+const createImports = (imports, postcss, mode = "rule") => {
+ return Object.keys(imports).map((path) => {
+ const aliases = imports[path];
+ const declarations = Object.keys(aliases).map((key) =>
+ postcss.decl({
+ prop: key,
+ value: aliases[key],
+ raws: { before: "\n " },
+ })
+ );
+
+ const hasDeclarations = declarations.length > 0;
+
+ const rule =
+ mode === "rule"
+ ? postcss.rule({
+ selector: `:import('${path}')`,
+ raws: { after: hasDeclarations ? "\n" : "" },
+ })
+ : postcss.atRule({
+ name: "icss-import",
+ params: `'${path}'`,
+ raws: { after: hasDeclarations ? "\n" : "" },
+ });
+
+ if (hasDeclarations) {
+ rule.append(declarations);
+ }
+
+ return rule;
+ });
+};
+
+const createExports = (exports, postcss, mode = "rule") => {
+ const declarations = Object.keys(exports).map((key) =>
+ postcss.decl({
+ prop: key,
+ value: exports[key],
+ raws: { before: "\n " },
+ })
+ );
+
+ if (declarations.length === 0) {
+ return [];
+ }
+ const rule =
+ mode === "rule"
+ ? postcss.rule({
+ selector: `:export`,
+ raws: { after: "\n" },
+ })
+ : postcss.atRule({
+ name: "icss-export",
+ raws: { after: "\n" },
+ });
+
+ rule.append(declarations);
+
+ return [rule];
+};
+
+const createICSSRules$1 = (imports, exports, postcss, mode) => [
+ ...createImports(imports, postcss, mode),
+ ...createExports(exports, postcss, mode),
+];
+
+var createICSSRules_1 = createICSSRules$1;
+
+const replaceValueSymbols = replaceValueSymbols_1;
+const replaceSymbols = replaceSymbols_1;
+const extractICSS$1 = extractICSS_1;
+const createICSSRules = createICSSRules_1;
+
+var src$4 = {
+ replaceValueSymbols,
+ replaceSymbols,
+ extractICSS: extractICSS$1,
+ createICSSRules,
+};
+
+Object.defineProperty(Parser$1, "__esModule", {
+ value: true
+});
+Parser$1.default = void 0;
+
+var _icssUtils = src$4;
+
+// Initially copied from https://github.com/css-modules/css-modules-loader-core
+const importRegexp = /^:import\((.+)\)$/;
+
+class Parser {
+ constructor(pathFetcher, trace) {
+ this.pathFetcher = pathFetcher;
+ this.plugin = this.plugin.bind(this);
+ this.exportTokens = {};
+ this.translations = {};
+ this.trace = trace;
+ }
+
+ plugin() {
+ const parser = this;
+ return {
+ postcssPlugin: "css-modules-parser",
+
+ async OnceExit(css) {
+ await Promise.all(parser.fetchAllImports(css));
+ parser.linkImportedSymbols(css);
+ return parser.extractExports(css);
+ }
+
+ };
+ }
+
+ fetchAllImports(css) {
+ let imports = [];
+ css.each(node => {
+ if (node.type == "rule" && node.selector.match(importRegexp)) {
+ imports.push(this.fetchImport(node, css.source.input.from, imports.length));
+ }
+ });
+ return imports;
+ }
+
+ linkImportedSymbols(css) {
+ (0, _icssUtils.replaceSymbols)(css, this.translations);
+ }
+
+ extractExports(css) {
+ css.each(node => {
+ if (node.type == "rule" && node.selector == ":export") this.handleExport(node);
+ });
+ }
+
+ handleExport(exportNode) {
+ exportNode.each(decl => {
+ if (decl.type == "decl") {
+ Object.keys(this.translations).forEach(translation => {
+ decl.value = decl.value.replace(translation, this.translations[translation]);
+ });
+ this.exportTokens[decl.prop] = decl.value;
+ }
+ });
+ exportNode.remove();
+ }
+
+ async fetchImport(importNode, relativeTo, depNr) {
+ const file = importNode.selector.match(importRegexp)[1];
+ const depTrace = this.trace + String.fromCharCode(depNr);
+ const exports = await this.pathFetcher(file, relativeTo, depTrace);
+
+ try {
+ importNode.each(decl => {
+ if (decl.type == "decl") {
+ this.translations[decl.prop] = exports[decl.value];
+ }
+ });
+ importNode.remove();
+ } catch (err) {
+ console.log(err);
+ }
+ }
+
+}
+
+Parser$1.default = Parser;
+
+var saveJSON$1 = {};
+
+Object.defineProperty(saveJSON$1, "__esModule", {
+ value: true
+});
+saveJSON$1.default = saveJSON;
+
+var _fs$2 = fs;
+
+function saveJSON(cssFile, json) {
+ return new Promise((resolve, reject) => {
+ const {
+ writeFile
+ } = (0, _fs$2.getFileSystem)();
+ writeFile(`${cssFile}.json`, JSON.stringify(json), e => e ? reject(e) : resolve(json));
+ });
+}
+
+var localsConvention = {};
+
+/**
+ * lodash (Custom Build)
+ * Build: `lodash modularize exports="npm" -o ./`
+ * Copyright jQuery Foundation and other contributors
+ * Released under MIT license
+ * Based on Underscore.js 1.8.3
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ */
+
+/** Used as references for various `Number` constants. */
+var INFINITY = 1 / 0;
+
+/** `Object#toString` result references. */
+var symbolTag = '[object Symbol]';
+
+/** Used to match words composed of alphanumeric characters. */
+var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
+
+/** Used to match Latin Unicode letters (excluding mathematical operators). */
+var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
+
+/** Used to compose unicode character classes. */
+var rsAstralRange = '\\ud800-\\udfff',
+ rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
+ rsComboSymbolsRange = '\\u20d0-\\u20f0',
+ rsDingbatRange = '\\u2700-\\u27bf',
+ rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
+ rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
+ rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
+ rsPunctuationRange = '\\u2000-\\u206f',
+ rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
+ rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
+ rsVarRange = '\\ufe0e\\ufe0f',
+ rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
+
+/** Used to compose unicode capture groups. */
+var rsApos = "['\u2019]",
+ rsAstral = '[' + rsAstralRange + ']',
+ rsBreak = '[' + rsBreakRange + ']',
+ rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
+ rsDigits = '\\d+',
+ rsDingbat = '[' + rsDingbatRange + ']',
+ rsLower = '[' + rsLowerRange + ']',
+ rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
+ rsFitz = '\\ud83c[\\udffb-\\udfff]',
+ rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
+ rsNonAstral = '[^' + rsAstralRange + ']',
+ rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
+ rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
+ rsUpper = '[' + rsUpperRange + ']',
+ rsZWJ = '\\u200d';
+
+/** Used to compose unicode regexes. */
+var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
+ rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
+ rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
+ rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
+ reOptMod = rsModifier + '?',
+ rsOptVar = '[' + rsVarRange + ']?',
+ rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
+ rsSeq = rsOptVar + reOptMod + rsOptJoin,
+ rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
+ rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
+
+/** Used to match apostrophes. */
+var reApos = RegExp(rsApos, 'g');
+
+/**
+ * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
+ * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
+ */
+var reComboMark = RegExp(rsCombo, 'g');
+
+/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
+var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
+
+/** Used to match complex or compound words. */
+var reUnicodeWord = RegExp([
+ rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
+ rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
+ rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
+ rsUpper + '+' + rsOptUpperContr,
+ rsDigits,
+ rsEmoji
+].join('|'), 'g');
+
+/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
+var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
+
+/** Used to detect strings that need a more robust regexp to match words. */
+var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
+
+/** Used to map Latin Unicode letters to basic Latin letters. */
+var deburredLetters = {
+ // Latin-1 Supplement block.
+ '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
+ '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
+ '\xc7': 'C', '\xe7': 'c',
+ '\xd0': 'D', '\xf0': 'd',
+ '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
+ '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
+ '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
+ '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
+ '\xd1': 'N', '\xf1': 'n',
+ '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
+ '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
+ '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
+ '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
+ '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
+ '\xc6': 'Ae', '\xe6': 'ae',
+ '\xde': 'Th', '\xfe': 'th',
+ '\xdf': 'ss',
+ // Latin Extended-A block.
+ '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
+ '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
+ '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
+ '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
+ '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
+ '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
+ '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
+ '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
+ '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
+ '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
+ '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
+ '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
+ '\u0134': 'J', '\u0135': 'j',
+ '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
+ '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
+ '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
+ '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
+ '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
+ '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
+ '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
+ '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
+ '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
+ '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
+ '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
+ '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
+ '\u0163': 't', '\u0165': 't', '\u0167': 't',
+ '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
+ '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
+ '\u0174': 'W', '\u0175': 'w',
+ '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
+ '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
+ '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
+ '\u0132': 'IJ', '\u0133': 'ij',
+ '\u0152': 'Oe', '\u0153': 'oe',
+ '\u0149': "'n", '\u017f': 'ss'
+};
+
+/** Detect free variable `global` from Node.js. */
+var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
+
+/** Detect free variable `self`. */
+var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
+
+/** Used as a reference to the global object. */
+var root$2 = freeGlobal || freeSelf || Function('return this')();
+
+/**
+ * A specialized version of `_.reduce` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {*} [accumulator] The initial value.
+ * @param {boolean} [initAccum] Specify using the first element of `array` as
+ * the initial value.
+ * @returns {*} Returns the accumulated value.
+ */
+function arrayReduce(array, iteratee, accumulator, initAccum) {
+ var index = -1,
+ length = array ? array.length : 0;
+
+ if (initAccum && length) {
+ accumulator = array[++index];
+ }
+ while (++index < length) {
+ accumulator = iteratee(accumulator, array[index], index, array);
+ }
+ return accumulator;
+}
+
+/**
+ * Converts an ASCII `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+function asciiToArray(string) {
+ return string.split('');
+}
+
+/**
+ * Splits an ASCII `string` into an array of its words.
+ *
+ * @private
+ * @param {string} The string to inspect.
+ * @returns {Array} Returns the words of `string`.
+ */
+function asciiWords(string) {
+ return string.match(reAsciiWord) || [];
+}
+
+/**
+ * The base implementation of `_.propertyOf` without support for deep paths.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Function} Returns the new accessor function.
+ */
+function basePropertyOf(object) {
+ return function(key) {
+ return object == null ? undefined : object[key];
+ };
+}
+
+/**
+ * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
+ * letters to basic Latin letters.
+ *
+ * @private
+ * @param {string} letter The matched letter to deburr.
+ * @returns {string} Returns the deburred letter.
+ */
+var deburrLetter = basePropertyOf(deburredLetters);
+
+/**
+ * Checks if `string` contains Unicode symbols.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {boolean} Returns `true` if a symbol is found, else `false`.
+ */
+function hasUnicode(string) {
+ return reHasUnicode.test(string);
+}
+
+/**
+ * Checks if `string` contains a word composed of Unicode symbols.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {boolean} Returns `true` if a word is found, else `false`.
+ */
+function hasUnicodeWord(string) {
+ return reHasUnicodeWord.test(string);
+}
+
+/**
+ * Converts `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+function stringToArray(string) {
+ return hasUnicode(string)
+ ? unicodeToArray(string)
+ : asciiToArray(string);
+}
+
+/**
+ * Converts a Unicode `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+function unicodeToArray(string) {
+ return string.match(reUnicode) || [];
+}
+
+/**
+ * Splits a Unicode `string` into an array of its words.
+ *
+ * @private
+ * @param {string} The string to inspect.
+ * @returns {Array} Returns the words of `string`.
+ */
+function unicodeWords(string) {
+ return string.match(reUnicodeWord) || [];
+}
+
+/** Used for built-in method references. */
+var objectProto = Object.prototype;
+
+/**
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+var objectToString = objectProto.toString;
+
+/** Built-in value references. */
+var Symbol$1 = root$2.Symbol;
+
+/** Used to convert symbols to primitives and strings. */
+var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
+ symbolToString = symbolProto ? symbolProto.toString : undefined;
+
+/**
+ * The base implementation of `_.slice` without an iteratee call guard.
+ *
+ * @private
+ * @param {Array} array The array to slice.
+ * @param {number} [start=0] The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns the slice of `array`.
+ */
+function baseSlice(array, start, end) {
+ var index = -1,
+ length = array.length;
+
+ if (start < 0) {
+ start = -start > length ? 0 : (length + start);
+ }
+ end = end > length ? length : end;
+ if (end < 0) {
+ end += length;
+ }
+ length = start > end ? 0 : ((end - start) >>> 0);
+ start >>>= 0;
+
+ var result = Array(length);
+ while (++index < length) {
+ result[index] = array[index + start];
+ }
+ return result;
+}
+
+/**
+ * The base implementation of `_.toString` which doesn't convert nullish
+ * values to empty strings.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {string} Returns the string.
+ */
+function baseToString(value) {
+ // Exit early for strings to avoid a performance hit in some environments.
+ if (typeof value == 'string') {
+ return value;
+ }
+ if (isSymbol(value)) {
+ return symbolToString ? symbolToString.call(value) : '';
+ }
+ var result = (value + '');
+ return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
+}
+
+/**
+ * Casts `array` to a slice if it's needed.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {number} start The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns the cast slice.
+ */
+function castSlice(array, start, end) {
+ var length = array.length;
+ end = end === undefined ? length : end;
+ return (!start && end >= length) ? array : baseSlice(array, start, end);
+}
+
+/**
+ * Creates a function like `_.lowerFirst`.
+ *
+ * @private
+ * @param {string} methodName The name of the `String` case method to use.
+ * @returns {Function} Returns the new case function.
+ */
+function createCaseFirst(methodName) {
+ return function(string) {
+ string = toString(string);
+
+ var strSymbols = hasUnicode(string)
+ ? stringToArray(string)
+ : undefined;
+
+ var chr = strSymbols
+ ? strSymbols[0]
+ : string.charAt(0);
+
+ var trailing = strSymbols
+ ? castSlice(strSymbols, 1).join('')
+ : string.slice(1);
+
+ return chr[methodName]() + trailing;
+ };
+}
+
+/**
+ * Creates a function like `_.camelCase`.
+ *
+ * @private
+ * @param {Function} callback The function to combine each word.
+ * @returns {Function} Returns the new compounder function.
+ */
+function createCompounder(callback) {
+ return function(string) {
+ return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
+ };
+}
+
+/**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+function isObjectLike(value) {
+ return !!value && typeof value == 'object';
+}
+
+/**
+ * Checks if `value` is classified as a `Symbol` primitive or object.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
+ * @example
+ *
+ * _.isSymbol(Symbol.iterator);
+ * // => true
+ *
+ * _.isSymbol('abc');
+ * // => false
+ */
+function isSymbol(value) {
+ return typeof value == 'symbol' ||
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
+}
+
+/**
+ * Converts `value` to a string. An empty string is returned for `null`
+ * and `undefined` values. The sign of `-0` is preserved.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to process.
+ * @returns {string} Returns the string.
+ * @example
+ *
+ * _.toString(null);
+ * // => ''
+ *
+ * _.toString(-0);
+ * // => '-0'
+ *
+ * _.toString([1, 2, 3]);
+ * // => '1,2,3'
+ */
+function toString(value) {
+ return value == null ? '' : baseToString(value);
+}
+
+/**
+ * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the camel cased string.
+ * @example
+ *
+ * _.camelCase('Foo Bar');
+ * // => 'fooBar'
+ *
+ * _.camelCase('--foo-bar--');
+ * // => 'fooBar'
+ *
+ * _.camelCase('__FOO_BAR__');
+ * // => 'fooBar'
+ */
+var camelCase = createCompounder(function(result, word, index) {
+ word = word.toLowerCase();
+ return result + (index ? capitalize(word) : word);
+});
+
+/**
+ * Converts the first character of `string` to upper case and the remaining
+ * to lower case.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to capitalize.
+ * @returns {string} Returns the capitalized string.
+ * @example
+ *
+ * _.capitalize('FRED');
+ * // => 'Fred'
+ */
+function capitalize(string) {
+ return upperFirst(toString(string).toLowerCase());
+}
+
+/**
+ * Deburrs `string` by converting
+ * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
+ * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
+ * letters to basic Latin letters and removing
+ * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to deburr.
+ * @returns {string} Returns the deburred string.
+ * @example
+ *
+ * _.deburr('déjà vu');
+ * // => 'deja vu'
+ */
+function deburr(string) {
+ string = toString(string);
+ return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
+}
+
+/**
+ * Converts the first character of `string` to upper case.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the converted string.
+ * @example
+ *
+ * _.upperFirst('fred');
+ * // => 'Fred'
+ *
+ * _.upperFirst('FRED');
+ * // => 'FRED'
+ */
+var upperFirst = createCaseFirst('toUpperCase');
+
+/**
+ * Splits `string` into an array of its words.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to inspect.
+ * @param {RegExp|string} [pattern] The pattern to match words.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {Array} Returns the words of `string`.
+ * @example
+ *
+ * _.words('fred, barney, & pebbles');
+ * // => ['fred', 'barney', 'pebbles']
+ *
+ * _.words('fred, barney, & pebbles', /[^, ]+/g);
+ * // => ['fred', 'barney', '&', 'pebbles']
+ */
+function words(string, pattern, guard) {
+ string = toString(string);
+ pattern = guard ? undefined : pattern;
+
+ if (pattern === undefined) {
+ return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
+ }
+ return string.match(pattern) || [];
+}
+
+var lodash_camelcase = camelCase;
+
+Object.defineProperty(localsConvention, "__esModule", {
+ value: true
+});
+localsConvention.makeLocalsConventionReducer = makeLocalsConventionReducer;
+
+var _lodash = _interopRequireDefault$5(lodash_camelcase);
+
+function _interopRequireDefault$5(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function dashesCamelCase(string) {
+ return string.replace(/-+(\w)/g, (_, firstLetter) => firstLetter.toUpperCase());
+}
+
+function makeLocalsConventionReducer(localsConvention, inputFile) {
+ const isFunc = typeof localsConvention === "function";
+ return (tokens, [className, value]) => {
+ if (isFunc) {
+ const convention = localsConvention(className, value, inputFile);
+ tokens[convention] = value;
+ return tokens;
+ }
+
+ switch (localsConvention) {
+ case "camelCase":
+ tokens[className] = value;
+ tokens[(0, _lodash.default)(className)] = value;
+ break;
+
+ case "camelCaseOnly":
+ tokens[(0, _lodash.default)(className)] = value;
+ break;
+
+ case "dashes":
+ tokens[className] = value;
+ tokens[dashesCamelCase(className)] = value;
+ break;
+
+ case "dashesOnly":
+ tokens[dashesCamelCase(className)] = value;
+ break;
+ }
+
+ return tokens;
+ };
+}
+
+var FileSystemLoader$1 = {};
+
+Object.defineProperty(FileSystemLoader$1, "__esModule", {
+ value: true
+});
+FileSystemLoader$1.default = void 0;
+
+var _postcss$1 = _interopRequireDefault$4(require$$0);
+
+var _path = _interopRequireDefault$4(require$$0$1);
+
+var _Parser$1 = _interopRequireDefault$4(Parser$1);
+
+var _fs$1 = fs;
+
+function _interopRequireDefault$4(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// Initially copied from https://github.com/css-modules/css-modules-loader-core
+class Core {
+ constructor(plugins) {
+ this.plugins = plugins || Core.defaultPlugins;
+ }
+
+ async load(sourceString, sourcePath, trace, pathFetcher) {
+ const parser = new _Parser$1.default(pathFetcher, trace);
+ const plugins = this.plugins.concat([parser.plugin()]);
+ const result = await (0, _postcss$1.default)(plugins).process(sourceString, {
+ from: sourcePath
+ });
+ return {
+ injectableSource: result.css,
+ exportTokens: parser.exportTokens
+ };
+ }
+
+} // Sorts dependencies in the following way:
+// AAA comes before AA and A
+// AB comes after AA and before A
+// All Bs come after all As
+// This ensures that the files are always returned in the following order:
+// - In the order they were required, except
+// - After all their dependencies
+
+
+const traceKeySorter = (a, b) => {
+ if (a.length < b.length) {
+ return a < b.substring(0, a.length) ? -1 : 1;
+ }
+
+ if (a.length > b.length) {
+ return a.substring(0, b.length) <= b ? -1 : 1;
+ }
+
+ return a < b ? -1 : 1;
+};
+
+class FileSystemLoader {
+ constructor(root, plugins, fileResolve) {
+ if (root === "/" && process.platform === "win32") {
+ const cwdDrive = process.cwd().slice(0, 3);
+
+ if (!/^[A-Za-z]:\\$/.test(cwdDrive)) {
+ throw new Error(`Failed to obtain root from "${process.cwd()}".`);
+ }
+
+ root = cwdDrive;
+ }
+
+ this.root = root;
+ this.fileResolve = fileResolve;
+ this.sources = {};
+ this.traces = {};
+ this.importNr = 0;
+ this.core = new Core(plugins);
+ this.tokensByFile = {};
+ this.fs = (0, _fs$1.getFileSystem)();
+ }
+
+ async fetch(_newPath, relativeTo, _trace) {
+ const newPath = _newPath.replace(/^["']|["']$/g, "");
+
+ const trace = _trace || String.fromCharCode(this.importNr++);
+
+ const useFileResolve = typeof this.fileResolve === "function";
+ const fileResolvedPath = useFileResolve ? await this.fileResolve(newPath, relativeTo) : await Promise.resolve();
+
+ if (fileResolvedPath && !_path.default.isAbsolute(fileResolvedPath)) {
+ throw new Error('The returned path from the "fileResolve" option must be absolute.');
+ }
+
+ const relativeDir = _path.default.dirname(relativeTo);
+
+ const rootRelativePath = fileResolvedPath || _path.default.resolve(relativeDir, newPath);
+
+ let fileRelativePath = fileResolvedPath || _path.default.resolve(_path.default.resolve(this.root, relativeDir), newPath); // if the path is not relative or absolute, try to resolve it in node_modules
+
+
+ if (!useFileResolve && newPath[0] !== "." && !_path.default.isAbsolute(newPath)) {
+ try {
+ fileRelativePath = require.resolve(newPath);
+ } catch (e) {// noop
+ }
+ }
+
+ const tokens = this.tokensByFile[fileRelativePath];
+ if (tokens) return tokens;
+ return new Promise((resolve, reject) => {
+ this.fs.readFile(fileRelativePath, "utf-8", async (err, source) => {
+ if (err) reject(err);
+ const {
+ injectableSource,
+ exportTokens
+ } = await this.core.load(source, rootRelativePath, trace, this.fetch.bind(this));
+ this.sources[fileRelativePath] = injectableSource;
+ this.traces[trace] = fileRelativePath;
+ this.tokensByFile[fileRelativePath] = exportTokens;
+ resolve(exportTokens);
+ });
+ });
+ }
+
+ get finalSource() {
+ const traces = this.traces;
+ const sources = this.sources;
+ let written = new Set();
+ return Object.keys(traces).sort(traceKeySorter).map(key => {
+ const filename = traces[key];
+
+ if (written.has(filename)) {
+ return null;
+ }
+
+ written.add(filename);
+ return sources[filename];
+ }).join("");
+ }
+
+}
+
+FileSystemLoader$1.default = FileSystemLoader;
+
+var scoping = {};
+
+var src$3 = {exports: {}};
+
+const PERMANENT_MARKER = 2;
+const TEMPORARY_MARKER = 1;
+
+function createError(node, graph) {
+ const er = new Error("Nondeterministic import's order");
+
+ const related = graph[node];
+ const relatedNode = related.find(
+ (relatedNode) => graph[relatedNode].indexOf(node) > -1
+ );
+
+ er.nodes = [node, relatedNode];
+
+ return er;
+}
+
+function walkGraph(node, graph, state, result, strict) {
+ if (state[node] === PERMANENT_MARKER) {
+ return;
+ }
+
+ if (state[node] === TEMPORARY_MARKER) {
+ if (strict) {
+ return createError(node, graph);
+ }
+
+ return;
+ }
+
+ state[node] = TEMPORARY_MARKER;
+
+ const children = graph[node];
+ const length = children.length;
+
+ for (let i = 0; i < length; ++i) {
+ const error = walkGraph(children[i], graph, state, result, strict);
+
+ if (error instanceof Error) {
+ return error;
+ }
+ }
+
+ state[node] = PERMANENT_MARKER;
+
+ result.push(node);
+}
+
+function topologicalSort$1(graph, strict) {
+ const result = [];
+ const state = {};
+
+ const nodes = Object.keys(graph);
+ const length = nodes.length;
+
+ for (let i = 0; i < length; ++i) {
+ const er = walkGraph(nodes[i], graph, state, result, strict);
+
+ if (er instanceof Error) {
+ return er;
+ }
+ }
+
+ return result;
+}
+
+var topologicalSort_1 = topologicalSort$1;
+
+const topologicalSort = topologicalSort_1;
+
+const matchImports$1 = /^(.+?)\s+from\s+(?:"([^"]+)"|'([^']+)'|(global))$/;
+const icssImport = /^:import\((?:"([^"]+)"|'([^']+)')\)/;
+
+const VISITED_MARKER = 1;
+
+/**
+ * :import('G') {}
+ *
+ * Rule
+ * composes: ... from 'A'
+ * composes: ... from 'B'
+
+ * Rule
+ * composes: ... from 'A'
+ * composes: ... from 'A'
+ * composes: ... from 'C'
+ *
+ * Results in:
+ *
+ * graph: {
+ * G: [],
+ * A: [],
+ * B: ['A'],
+ * C: ['A'],
+ * }
+ */
+function addImportToGraph(importId, parentId, graph, visited) {
+ const siblingsId = parentId + "_" + "siblings";
+ const visitedId = parentId + "_" + importId;
+
+ if (visited[visitedId] !== VISITED_MARKER) {
+ if (!Array.isArray(visited[siblingsId])) {
+ visited[siblingsId] = [];
+ }
+
+ const siblings = visited[siblingsId];
+
+ if (Array.isArray(graph[importId])) {
+ graph[importId] = graph[importId].concat(siblings);
+ } else {
+ graph[importId] = siblings.slice();
+ }
+
+ visited[visitedId] = VISITED_MARKER;
+
+ siblings.push(importId);
+ }
+}
+
+src$3.exports = (options = {}) => {
+ let importIndex = 0;
+ const createImportedName =
+ typeof options.createImportedName !== "function"
+ ? (importName /*, path*/) =>
+ `i__imported_${importName.replace(/\W/g, "_")}_${importIndex++}`
+ : options.createImportedName;
+ const failOnWrongOrder = options.failOnWrongOrder;
+
+ return {
+ postcssPlugin: "postcss-modules-extract-imports",
+ prepare() {
+ const graph = {};
+ const visited = {};
+ const existingImports = {};
+ const importDecls = {};
+ const imports = {};
+
+ return {
+ Once(root, postcss) {
+ // Check the existing imports order and save refs
+ root.walkRules((rule) => {
+ const matches = icssImport.exec(rule.selector);
+
+ if (matches) {
+ const [, /*match*/ doubleQuotePath, singleQuotePath] = matches;
+ const importPath = doubleQuotePath || singleQuotePath;
+
+ addImportToGraph(importPath, "root", graph, visited);
+
+ existingImports[importPath] = rule;
+ }
+ });
+
+ root.walkDecls(/^composes$/, (declaration) => {
+ const matches = declaration.value.match(matchImports$1);
+
+ if (!matches) {
+ return;
+ }
+
+ let tmpSymbols;
+ let [
+ ,
+ /*match*/ symbols,
+ doubleQuotePath,
+ singleQuotePath,
+ global,
+ ] = matches;
+
+ if (global) {
+ // Composing globals simply means changing these classes to wrap them in global(name)
+ tmpSymbols = symbols.split(/\s+/).map((s) => `global(${s})`);
+ } else {
+ const importPath = doubleQuotePath || singleQuotePath;
+
+ let parent = declaration.parent;
+ let parentIndexes = "";
+
+ while (parent.type !== "root") {
+ parentIndexes =
+ parent.parent.index(parent) + "_" + parentIndexes;
+ parent = parent.parent;
+ }
+
+ const { selector } = declaration.parent;
+ const parentRule = `_${parentIndexes}${selector}`;
+
+ addImportToGraph(importPath, parentRule, graph, visited);
+
+ importDecls[importPath] = declaration;
+ imports[importPath] = imports[importPath] || {};
+
+ tmpSymbols = symbols.split(/\s+/).map((s) => {
+ if (!imports[importPath][s]) {
+ imports[importPath][s] = createImportedName(s, importPath);
+ }
+
+ return imports[importPath][s];
+ });
+ }
+
+ declaration.value = tmpSymbols.join(" ");
+ });
+
+ const importsOrder = topologicalSort(graph, failOnWrongOrder);
+
+ if (importsOrder instanceof Error) {
+ const importPath = importsOrder.nodes.find((importPath) =>
+ // eslint-disable-next-line no-prototype-builtins
+ importDecls.hasOwnProperty(importPath)
+ );
+ const decl = importDecls[importPath];
+
+ throw decl.error(
+ "Failed to resolve order of composed modules " +
+ importsOrder.nodes
+ .map((importPath) => "`" + importPath + "`")
+ .join(", ") +
+ ".",
+ {
+ plugin: "postcss-modules-extract-imports",
+ word: "composes",
+ }
+ );
+ }
+
+ let lastImportRule;
+
+ importsOrder.forEach((path) => {
+ const importedSymbols = imports[path];
+ let rule = existingImports[path];
+
+ if (!rule && importedSymbols) {
+ rule = postcss.rule({
+ selector: `:import("${path}")`,
+ raws: { after: "\n" },
+ });
+
+ if (lastImportRule) {
+ root.insertAfter(lastImportRule, rule);
+ } else {
+ root.prepend(rule);
+ }
+ }
+
+ lastImportRule = rule;
+
+ if (!importedSymbols) {
+ return;
+ }
+
+ Object.keys(importedSymbols).forEach((importedSymbol) => {
+ rule.append(
+ postcss.decl({
+ value: importedSymbol,
+ prop: importedSymbols[importedSymbol],
+ raws: { before: "\n " },
+ })
+ );
+ });
+ });
+ },
+ };
+ },
+ };
+};
+
+src$3.exports.postcss = true;
+
+var srcExports$2 = src$3.exports;
+
+var wasmHash = {exports: {}};
+
+/*
+ MIT License http://www.opensource.org/licenses/mit-license.php
+ Author Tobias Koppers @sokra
+*/
+
+var hasRequiredWasmHash;
+
+function requireWasmHash () {
+ if (hasRequiredWasmHash) return wasmHash.exports;
+ hasRequiredWasmHash = 1;
+
+ // 65536 is the size of a wasm memory page
+ // 64 is the maximum chunk size for every possible wasm hash implementation
+ // 4 is the maximum number of bytes per char for string encoding (max is utf-8)
+ // ~3 makes sure that it's always a block of 4 chars, so avoid partially encoded bytes for base64
+ const MAX_SHORT_STRING = Math.floor((65536 - 64) / 4) & ~3;
+
+ class WasmHash {
+ /**
+ * @param {WebAssembly.Instance} instance wasm instance
+ * @param {WebAssembly.Instance[]} instancesPool pool of instances
+ * @param {number} chunkSize size of data chunks passed to wasm
+ * @param {number} digestSize size of digest returned by wasm
+ */
+ constructor(instance, instancesPool, chunkSize, digestSize) {
+ const exports = /** @type {any} */ (instance.exports);
+
+ exports.init();
+
+ this.exports = exports;
+ this.mem = Buffer.from(exports.memory.buffer, 0, 65536);
+ this.buffered = 0;
+ this.instancesPool = instancesPool;
+ this.chunkSize = chunkSize;
+ this.digestSize = digestSize;
+ }
+
+ reset() {
+ this.buffered = 0;
+ this.exports.init();
+ }
+
+ /**
+ * @param {Buffer | string} data data
+ * @param {BufferEncoding=} encoding encoding
+ * @returns {this} itself
+ */
+ update(data, encoding) {
+ if (typeof data === "string") {
+ while (data.length > MAX_SHORT_STRING) {
+ this._updateWithShortString(data.slice(0, MAX_SHORT_STRING), encoding);
+ data = data.slice(MAX_SHORT_STRING);
+ }
+
+ this._updateWithShortString(data, encoding);
+
+ return this;
+ }
+
+ this._updateWithBuffer(data);
+
+ return this;
+ }
+
+ /**
+ * @param {string} data data
+ * @param {BufferEncoding=} encoding encoding
+ * @returns {void}
+ */
+ _updateWithShortString(data, encoding) {
+ const { exports, buffered, mem, chunkSize } = this;
+
+ let endPos;
+
+ if (data.length < 70) {
+ if (!encoding || encoding === "utf-8" || encoding === "utf8") {
+ endPos = buffered;
+ for (let i = 0; i < data.length; i++) {
+ const cc = data.charCodeAt(i);
+
+ if (cc < 0x80) {
+ mem[endPos++] = cc;
+ } else if (cc < 0x800) {
+ mem[endPos] = (cc >> 6) | 0xc0;
+ mem[endPos + 1] = (cc & 0x3f) | 0x80;
+ endPos += 2;
+ } else {
+ // bail-out for weird chars
+ endPos += mem.write(data.slice(i), endPos, encoding);
+ break;
+ }
+ }
+ } else if (encoding === "latin1") {
+ endPos = buffered;
+
+ for (let i = 0; i < data.length; i++) {
+ const cc = data.charCodeAt(i);
+
+ mem[endPos++] = cc;
+ }
+ } else {
+ endPos = buffered + mem.write(data, buffered, encoding);
+ }
+ } else {
+ endPos = buffered + mem.write(data, buffered, encoding);
+ }
+
+ if (endPos < chunkSize) {
+ this.buffered = endPos;
+ } else {
+ const l = endPos & ~(this.chunkSize - 1);
+
+ exports.update(l);
+
+ const newBuffered = endPos - l;
+
+ this.buffered = newBuffered;
+
+ if (newBuffered > 0) {
+ mem.copyWithin(0, l, endPos);
+ }
+ }
+ }
+
+ /**
+ * @param {Buffer} data data
+ * @returns {void}
+ */
+ _updateWithBuffer(data) {
+ const { exports, buffered, mem } = this;
+ const length = data.length;
+
+ if (buffered + length < this.chunkSize) {
+ data.copy(mem, buffered, 0, length);
+
+ this.buffered += length;
+ } else {
+ const l = (buffered + length) & ~(this.chunkSize - 1);
+
+ if (l > 65536) {
+ let i = 65536 - buffered;
+
+ data.copy(mem, buffered, 0, i);
+ exports.update(65536);
+
+ const stop = l - buffered - 65536;
+
+ while (i < stop) {
+ data.copy(mem, 0, i, i + 65536);
+ exports.update(65536);
+ i += 65536;
+ }
+
+ data.copy(mem, 0, i, l - buffered);
+
+ exports.update(l - buffered - i);
+ } else {
+ data.copy(mem, buffered, 0, l - buffered);
+
+ exports.update(l);
+ }
+
+ const newBuffered = length + buffered - l;
+
+ this.buffered = newBuffered;
+
+ if (newBuffered > 0) {
+ data.copy(mem, 0, length - newBuffered, length);
+ }
+ }
+ }
+
+ digest(type) {
+ const { exports, buffered, mem, digestSize } = this;
+
+ exports.final(buffered);
+
+ this.instancesPool.push(this);
+
+ const hex = mem.toString("latin1", 0, digestSize);
+
+ if (type === "hex") {
+ return hex;
+ }
+
+ if (type === "binary" || !type) {
+ return Buffer.from(hex, "hex");
+ }
+
+ return Buffer.from(hex, "hex").toString(type);
+ }
+ }
+
+ const create = (wasmModule, instancesPool, chunkSize, digestSize) => {
+ if (instancesPool.length > 0) {
+ const old = instancesPool.pop();
+
+ old.reset();
+
+ return old;
+ } else {
+ return new WasmHash(
+ new WebAssembly.Instance(wasmModule),
+ instancesPool,
+ chunkSize,
+ digestSize
+ );
+ }
+ };
+
+ wasmHash.exports = create;
+ wasmHash.exports.MAX_SHORT_STRING = MAX_SHORT_STRING;
+ return wasmHash.exports;
+}
+
+/*
+ MIT License http://www.opensource.org/licenses/mit-license.php
+ Author Tobias Koppers @sokra
+*/
+
+var xxhash64_1;
+var hasRequiredXxhash64;
+
+function requireXxhash64 () {
+ if (hasRequiredXxhash64) return xxhash64_1;
+ hasRequiredXxhash64 = 1;
+
+ const create = requireWasmHash();
+
+ //#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1
+ const xxhash64 = new WebAssembly.Module(
+ Buffer.from(
+ // 1173 bytes
+ "AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrUIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLqwYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEACfyACIAE1AgBCh5Wvr5i23puef36FQheJQs/W077Sx6vZQn5C+fPd8Zn2masWfCECIAFBBGoLIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAiACQh2IhUL5893xmfaZqxZ+IgIgAkIgiIUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL",
+ "base64"
+ )
+ );
+ //#endregion
+
+ xxhash64_1 = create.bind(null, xxhash64, [], 32, 16);
+ return xxhash64_1;
+}
+
+var BatchedHash_1;
+var hasRequiredBatchedHash;
+
+function requireBatchedHash () {
+ if (hasRequiredBatchedHash) return BatchedHash_1;
+ hasRequiredBatchedHash = 1;
+ const MAX_SHORT_STRING = requireWasmHash().MAX_SHORT_STRING;
+
+ class BatchedHash {
+ constructor(hash) {
+ this.string = undefined;
+ this.encoding = undefined;
+ this.hash = hash;
+ }
+
+ /**
+ * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
+ * @param {string|Buffer} data data
+ * @param {string=} inputEncoding data encoding
+ * @returns {this} updated hash
+ */
+ update(data, inputEncoding) {
+ if (this.string !== undefined) {
+ if (
+ typeof data === "string" &&
+ inputEncoding === this.encoding &&
+ this.string.length + data.length < MAX_SHORT_STRING
+ ) {
+ this.string += data;
+
+ return this;
+ }
+
+ this.hash.update(this.string, this.encoding);
+ this.string = undefined;
+ }
+
+ if (typeof data === "string") {
+ if (
+ data.length < MAX_SHORT_STRING &&
+ // base64 encoding is not valid since it may contain padding chars
+ (!inputEncoding || !inputEncoding.startsWith("ba"))
+ ) {
+ this.string = data;
+ this.encoding = inputEncoding;
+ } else {
+ this.hash.update(data, inputEncoding);
+ }
+ } else {
+ this.hash.update(data);
+ }
+
+ return this;
+ }
+
+ /**
+ * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
+ * @param {string=} encoding encoding of the return value
+ * @returns {string|Buffer} digest
+ */
+ digest(encoding) {
+ if (this.string !== undefined) {
+ this.hash.update(this.string, this.encoding);
+ }
+
+ return this.hash.digest(encoding);
+ }
+ }
+
+ BatchedHash_1 = BatchedHash;
+ return BatchedHash_1;
+}
+
+/*
+ MIT License http://www.opensource.org/licenses/mit-license.php
+ Author Tobias Koppers @sokra
+*/
+
+var md4_1;
+var hasRequiredMd4;
+
+function requireMd4 () {
+ if (hasRequiredMd4) return md4_1;
+ hasRequiredMd4 = 1;
+
+ const create = requireWasmHash();
+
+ //#region wasm code: md4 (../../../assembly/hash/md4.asm.ts) --initialMemory 1
+ const md4 = new WebAssembly.Module(
+ Buffer.from(
+ // 2150 bytes
+ "AGFzbQEAAAABCAJgAX8AYAAAAwUEAQAAAAUDAQABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwciBARpbml0AAAGdXBkYXRlAAIFZmluYWwAAwZtZW1vcnkCAAqFEAQmAEGBxpS6BiQBQYnXtv5+JAJB/rnrxXkkA0H2qMmBASQEQQAkAAvMCgEYfyMBIQojAiEGIwMhByMEIQgDQCAAIAVLBEAgBSgCCCINIAcgBiAFKAIEIgsgCCAHIAUoAgAiDCAKIAggBiAHIAhzcXNqakEDdyIDIAYgB3Nxc2pqQQd3IgEgAyAGc3FzampBC3chAiAFKAIUIg8gASACIAUoAhAiCSADIAEgBSgCDCIOIAYgAyACIAEgA3Nxc2pqQRN3IgQgASACc3FzampBA3ciAyACIARzcXNqakEHdyEBIAUoAiAiEiADIAEgBSgCHCIRIAQgAyAFKAIYIhAgAiAEIAEgAyAEc3FzampBC3ciAiABIANzcXNqakETdyIEIAEgAnNxc2pqQQN3IQMgBSgCLCIVIAQgAyAFKAIoIhQgAiAEIAUoAiQiEyABIAIgAyACIARzcXNqakEHdyIBIAMgBHNxc2pqQQt3IgIgASADc3FzampBE3chBCAPIBAgCSAVIBQgEyAFKAI4IhYgAiAEIAUoAjQiFyABIAIgBSgCMCIYIAMgASAEIAEgAnNxc2pqQQN3IgEgAiAEc3FzampBB3ciAiABIARzcXNqakELdyIDIAkgAiAMIAEgBSgCPCIJIAQgASADIAEgAnNxc2pqQRN3IgEgAiADcnEgAiADcXJqakGZ84nUBWpBA3ciAiABIANycSABIANxcmpqQZnzidQFakEFdyIEIAEgAnJxIAEgAnFyaiASakGZ84nUBWpBCXciAyAPIAQgCyACIBggASADIAIgBHJxIAIgBHFyampBmfOJ1AVqQQ13IgEgAyAEcnEgAyAEcXJqakGZ84nUBWpBA3ciAiABIANycSABIANxcmpqQZnzidQFakEFdyIEIAEgAnJxIAEgAnFyampBmfOJ1AVqQQl3IgMgECAEIAIgFyABIAMgAiAEcnEgAiAEcXJqakGZ84nUBWpBDXciASADIARycSADIARxcmogDWpBmfOJ1AVqQQN3IgIgASADcnEgASADcXJqakGZ84nUBWpBBXciBCABIAJycSABIAJxcmpqQZnzidQFakEJdyIDIBEgBCAOIAIgFiABIAMgAiAEcnEgAiAEcXJqakGZ84nUBWpBDXciASADIARycSADIARxcmpqQZnzidQFakEDdyICIAEgA3JxIAEgA3FyampBmfOJ1AVqQQV3IgQgASACcnEgASACcXJqakGZ84nUBWpBCXciAyAMIAIgAyAJIAEgAyACIARycSACIARxcmpqQZnzidQFakENdyIBcyAEc2pqQaHX5/YGakEDdyICIAQgASACcyADc2ogEmpBodfn9gZqQQl3IgRzIAFzampBodfn9gZqQQt3IgMgAiADIBggASADIARzIAJzampBodfn9gZqQQ93IgFzIARzaiANakGh1+f2BmpBA3ciAiAUIAQgASACcyADc2pqQaHX5/YGakEJdyIEcyABc2pqQaHX5/YGakELdyIDIAsgAiADIBYgASADIARzIAJzampBodfn9gZqQQ93IgFzIARzampBodfn9gZqQQN3IgIgEyAEIAEgAnMgA3NqakGh1+f2BmpBCXciBHMgAXNqakGh1+f2BmpBC3chAyAKIA4gAiADIBcgASADIARzIAJzampBodfn9gZqQQ93IgFzIARzampBodfn9gZqQQN3IgJqIQogBiAJIAEgESADIAIgFSAEIAEgAnMgA3NqakGh1+f2BmpBCXciBHMgAXNqakGh1+f2BmpBC3ciAyAEcyACc2pqQaHX5/YGakEPd2ohBiADIAdqIQcgBCAIaiEIIAVBQGshBQwBCwsgCiQBIAYkAiAHJAMgCCQECw0AIAAQASMAIABqJAAL/wQCA38BfiMAIABqrUIDhiEEIABByABqQUBxIgJBCGshAyAAIgFBAWohACABQYABOgAAA0AgACACSUEAIABBB3EbBEAgAEEAOgAAIABBAWohAAwBCwsDQCAAIAJJBEAgAEIANwMAIABBCGohAAwBCwsgAyAENwMAIAIQAUEAIwGtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEIIwKtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEQIwOtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEYIwStIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAAs=",
+ "base64"
+ )
+ );
+ //#endregion
+
+ md4_1 = create.bind(null, md4, [], 64, 32);
+ return md4_1;
+}
+
+var BulkUpdateDecorator_1;
+var hasRequiredBulkUpdateDecorator;
+
+function requireBulkUpdateDecorator () {
+ if (hasRequiredBulkUpdateDecorator) return BulkUpdateDecorator_1;
+ hasRequiredBulkUpdateDecorator = 1;
+ const BULK_SIZE = 2000;
+
+ // We are using an object instead of a Map as this will stay static during the runtime
+ // so access to it can be optimized by v8
+ const digestCaches = {};
+
+ class BulkUpdateDecorator {
+ /**
+ * @param {Hash | function(): Hash} hashOrFactory function to create a hash
+ * @param {string=} hashKey key for caching
+ */
+ constructor(hashOrFactory, hashKey) {
+ this.hashKey = hashKey;
+
+ if (typeof hashOrFactory === "function") {
+ this.hashFactory = hashOrFactory;
+ this.hash = undefined;
+ } else {
+ this.hashFactory = undefined;
+ this.hash = hashOrFactory;
+ }
+
+ this.buffer = "";
+ }
+
+ /**
+ * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
+ * @param {string|Buffer} data data
+ * @param {string=} inputEncoding data encoding
+ * @returns {this} updated hash
+ */
+ update(data, inputEncoding) {
+ if (
+ inputEncoding !== undefined ||
+ typeof data !== "string" ||
+ data.length > BULK_SIZE
+ ) {
+ if (this.hash === undefined) {
+ this.hash = this.hashFactory();
+ }
+
+ if (this.buffer.length > 0) {
+ this.hash.update(this.buffer);
+ this.buffer = "";
+ }
+
+ this.hash.update(data, inputEncoding);
+ } else {
+ this.buffer += data;
+
+ if (this.buffer.length > BULK_SIZE) {
+ if (this.hash === undefined) {
+ this.hash = this.hashFactory();
+ }
+
+ this.hash.update(this.buffer);
+ this.buffer = "";
+ }
+ }
+
+ return this;
+ }
+
+ /**
+ * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
+ * @param {string=} encoding encoding of the return value
+ * @returns {string|Buffer} digest
+ */
+ digest(encoding) {
+ let digestCache;
+
+ const buffer = this.buffer;
+
+ if (this.hash === undefined) {
+ // short data for hash, we can use caching
+ const cacheKey = `${this.hashKey}-${encoding}`;
+
+ digestCache = digestCaches[cacheKey];
+
+ if (digestCache === undefined) {
+ digestCache = digestCaches[cacheKey] = new Map();
+ }
+
+ const cacheEntry = digestCache.get(buffer);
+
+ if (cacheEntry !== undefined) {
+ return cacheEntry;
+ }
+
+ this.hash = this.hashFactory();
+ }
+
+ if (buffer.length > 0) {
+ this.hash.update(buffer);
+ }
+
+ const digestResult = this.hash.digest(encoding);
+
+ if (digestCache !== undefined) {
+ digestCache.set(buffer, digestResult);
+ }
+
+ return digestResult;
+ }
+ }
+
+ BulkUpdateDecorator_1 = BulkUpdateDecorator;
+ return BulkUpdateDecorator_1;
+}
+
+const baseEncodeTables = {
+ 26: "abcdefghijklmnopqrstuvwxyz",
+ 32: "123456789abcdefghjkmnpqrstuvwxyz", // no 0lio
+ 36: "0123456789abcdefghijklmnopqrstuvwxyz",
+ 49: "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ", // no lIO
+ 52: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
+ 58: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ", // no 0lIO
+ 62: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
+ 64: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_",
+};
+
+/**
+ * @param {Uint32Array} uint32Array Treated as a long base-0x100000000 number, little endian
+ * @param {number} divisor The divisor
+ * @return {number} Modulo (remainder) of the division
+ */
+function divmod32(uint32Array, divisor) {
+ let carry = 0;
+ for (let i = uint32Array.length - 1; i >= 0; i--) {
+ const value = carry * 0x100000000 + uint32Array[i];
+ carry = value % divisor;
+ uint32Array[i] = Math.floor(value / divisor);
+ }
+ return carry;
+}
+
+function encodeBufferToBase(buffer, base, length) {
+ const encodeTable = baseEncodeTables[base];
+
+ if (!encodeTable) {
+ throw new Error("Unknown encoding base" + base);
+ }
+
+ // Input bits are only enough to generate this many characters
+ const limit = Math.ceil((buffer.length * 8) / Math.log2(base));
+ length = Math.min(length, limit);
+
+ // Most of the crypto digests (if not all) has length a multiple of 4 bytes.
+ // Fewer numbers in the array means faster math.
+ const uint32Array = new Uint32Array(Math.ceil(buffer.length / 4));
+
+ // Make sure the input buffer data is copied and is not mutated by reference.
+ // divmod32() would corrupt the BulkUpdateDecorator cache otherwise.
+ buffer.copy(Buffer.from(uint32Array.buffer));
+
+ let output = "";
+
+ for (let i = 0; i < length; i++) {
+ output = encodeTable[divmod32(uint32Array, base)] + output;
+ }
+
+ return output;
+}
+
+let crypto = undefined;
+let createXXHash64 = undefined;
+let createMd4 = undefined;
+let BatchedHash = undefined;
+let BulkUpdateDecorator = undefined;
+
+function getHashDigest$1(buffer, algorithm, digestType, maxLength) {
+ algorithm = algorithm || "xxhash64";
+ maxLength = maxLength || 9999;
+
+ let hash;
+
+ if (algorithm === "xxhash64") {
+ if (createXXHash64 === undefined) {
+ createXXHash64 = requireXxhash64();
+
+ if (BatchedHash === undefined) {
+ BatchedHash = requireBatchedHash();
+ }
+ }
+
+ hash = new BatchedHash(createXXHash64());
+ } else if (algorithm === "md4") {
+ if (createMd4 === undefined) {
+ createMd4 = requireMd4();
+
+ if (BatchedHash === undefined) {
+ BatchedHash = requireBatchedHash();
+ }
+ }
+
+ hash = new BatchedHash(createMd4());
+ } else if (algorithm === "native-md4") {
+ if (typeof crypto === "undefined") {
+ crypto = require$$3;
+
+ if (BulkUpdateDecorator === undefined) {
+ BulkUpdateDecorator = requireBulkUpdateDecorator();
+ }
+ }
+
+ hash = new BulkUpdateDecorator(() => crypto.createHash("md4"), "md4");
+ } else {
+ if (typeof crypto === "undefined") {
+ crypto = require$$3;
+
+ if (BulkUpdateDecorator === undefined) {
+ BulkUpdateDecorator = requireBulkUpdateDecorator();
+ }
+ }
+
+ hash = new BulkUpdateDecorator(
+ () => crypto.createHash(algorithm),
+ algorithm
+ );
+ }
+
+ hash.update(buffer);
+
+ if (
+ digestType === "base26" ||
+ digestType === "base32" ||
+ digestType === "base36" ||
+ digestType === "base49" ||
+ digestType === "base52" ||
+ digestType === "base58" ||
+ digestType === "base62"
+ ) {
+ return encodeBufferToBase(hash.digest(), digestType.substr(4), maxLength);
+ } else {
+ return hash.digest(digestType || "hex").substr(0, maxLength);
+ }
+}
+
+var getHashDigest_1 = getHashDigest$1;
+
+const path$1 = require$$0$1;
+const getHashDigest = getHashDigest_1;
+
+function interpolateName$1(loaderContext, name, options = {}) {
+ let filename;
+
+ const hasQuery =
+ loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1;
+
+ if (typeof name === "function") {
+ filename = name(
+ loaderContext.resourcePath,
+ hasQuery ? loaderContext.resourceQuery : undefined
+ );
+ } else {
+ filename = name || "[hash].[ext]";
+ }
+
+ const context = options.context;
+ const content = options.content;
+ const regExp = options.regExp;
+
+ let ext = "bin";
+ let basename = "file";
+ let directory = "";
+ let folder = "";
+ let query = "";
+
+ if (loaderContext.resourcePath) {
+ const parsed = path$1.parse(loaderContext.resourcePath);
+ let resourcePath = loaderContext.resourcePath;
+
+ if (parsed.ext) {
+ ext = parsed.ext.substr(1);
+ }
+
+ if (parsed.dir) {
+ basename = parsed.name;
+ resourcePath = parsed.dir + path$1.sep;
+ }
+
+ if (typeof context !== "undefined") {
+ directory = path$1
+ .relative(context, resourcePath + "_")
+ .replace(/\\/g, "/")
+ .replace(/\.\.(\/)?/g, "_$1");
+ directory = directory.substr(0, directory.length - 1);
+ } else {
+ directory = resourcePath.replace(/\\/g, "/").replace(/\.\.(\/)?/g, "_$1");
+ }
+
+ if (directory.length === 1) {
+ directory = "";
+ } else if (directory.length > 1) {
+ folder = path$1.basename(directory);
+ }
+ }
+
+ if (loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1) {
+ query = loaderContext.resourceQuery;
+
+ const hashIdx = query.indexOf("#");
+
+ if (hashIdx >= 0) {
+ query = query.substr(0, hashIdx);
+ }
+ }
+
+ let url = filename;
+
+ if (content) {
+ // Match hash template
+ url = url
+ // `hash` and `contenthash` are same in `loader-utils` context
+ // let's keep `hash` for backward compatibility
+ .replace(
+ /\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
+ (all, hashType, digestType, maxLength) =>
+ getHashDigest(content, hashType, digestType, parseInt(maxLength, 10))
+ );
+ }
+
+ url = url
+ .replace(/\[ext\]/gi, () => ext)
+ .replace(/\[name\]/gi, () => basename)
+ .replace(/\[path\]/gi, () => directory)
+ .replace(/\[folder\]/gi, () => folder)
+ .replace(/\[query\]/gi, () => query);
+
+ if (regExp && loaderContext.resourcePath) {
+ const match = loaderContext.resourcePath.match(new RegExp(regExp));
+
+ match &&
+ match.forEach((matched, i) => {
+ url = url.replace(new RegExp("\\[" + i + "\\]", "ig"), matched);
+ });
+ }
+
+ if (
+ typeof loaderContext.options === "object" &&
+ typeof loaderContext.options.customInterpolateName === "function"
+ ) {
+ url = loaderContext.options.customInterpolateName.call(
+ loaderContext,
+ url,
+ name,
+ options
+ );
+ }
+
+ return url;
+}
+
+var interpolateName_1 = interpolateName$1;
+
+var interpolateName = interpolateName_1;
+var path = require$$0$1;
+
+/**
+ * @param {string} pattern
+ * @param {object} options
+ * @param {string} options.context
+ * @param {string} options.hashPrefix
+ * @return {function}
+ */
+var genericNames = function createGenerator(pattern, options) {
+ options = options || {};
+ var context =
+ options && typeof options.context === "string"
+ ? options.context
+ : process.cwd();
+ var hashPrefix =
+ options && typeof options.hashPrefix === "string" ? options.hashPrefix : "";
+
+ /**
+ * @param {string} localName Usually a class name
+ * @param {string} filepath Absolute path
+ * @return {string}
+ */
+ return function generate(localName, filepath) {
+ var name = pattern.replace(/\[local\]/gi, localName);
+ var loaderContext = {
+ resourcePath: filepath,
+ };
+
+ var loaderOptions = {
+ content:
+ hashPrefix +
+ path.relative(context, filepath).replace(/\\/g, "/") +
+ "\x00" +
+ localName,
+ context: context,
+ };
+
+ var genericName = interpolateName(loaderContext, name, loaderOptions);
+ return genericName
+ .replace(new RegExp("[^a-zA-Z0-9\\-_\u00A0-\uFFFF]", "g"), "-")
+ .replace(/^((-?[0-9])|--)/, "_$1");
+ };
+};
+
+var src$2 = {exports: {}};
+
+var dist = {exports: {}};
+
+var processor = {exports: {}};
+
+var parser = {exports: {}};
+
+var root$1 = {exports: {}};
+
+var container = {exports: {}};
+
+var node$1 = {exports: {}};
+
+var util = {};
+
+var unesc = {exports: {}};
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = unesc;
+
+ // Many thanks for this post which made this migration much easier.
+ // https://mathiasbynens.be/notes/css-escapes
+
+ /**
+ *
+ * @param {string} str
+ * @returns {[string, number]|undefined}
+ */
+ function gobbleHex(str) {
+ var lower = str.toLowerCase();
+ var hex = '';
+ var spaceTerminated = false;
+
+ for (var i = 0; i < 6 && lower[i] !== undefined; i++) {
+ var code = lower.charCodeAt(i); // check to see if we are dealing with a valid hex char [a-f|0-9]
+
+ var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
+
+ spaceTerminated = code === 32;
+
+ if (!valid) {
+ break;
+ }
+
+ hex += lower[i];
+ }
+
+ if (hex.length === 0) {
+ return undefined;
+ }
+
+ var codePoint = parseInt(hex, 16);
+ var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF; // Add special case for
+ // "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
+ // https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
+
+ if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) {
+ return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
+ }
+
+ return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
+ }
+
+ var CONTAINS_ESCAPE = /\\/;
+
+ function unesc(str) {
+ var needToProcess = CONTAINS_ESCAPE.test(str);
+
+ if (!needToProcess) {
+ return str;
+ }
+
+ var ret = "";
+
+ for (var i = 0; i < str.length; i++) {
+ if (str[i] === "\\") {
+ var gobbled = gobbleHex(str.slice(i + 1, i + 7));
+
+ if (gobbled !== undefined) {
+ ret += gobbled[0];
+ i += gobbled[1];
+ continue;
+ } // Retain a pair of \\ if double escaped `\\\\`
+ // https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
+
+
+ if (str[i + 1] === "\\") {
+ ret += "\\";
+ i++;
+ continue;
+ } // if \\ is at the end of the string retain it
+ // https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
+
+
+ if (str.length === i + 1) {
+ ret += str[i];
+ }
+
+ continue;
+ }
+
+ ret += str[i];
+ }
+
+ return ret;
+ }
+
+ module.exports = exports.default;
+} (unesc, unesc.exports));
+
+var unescExports = unesc.exports;
+
+var getProp = {exports: {}};
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = getProp;
+
+ function getProp(obj) {
+ for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ props[_key - 1] = arguments[_key];
+ }
+
+ while (props.length > 0) {
+ var prop = props.shift();
+
+ if (!obj[prop]) {
+ return undefined;
+ }
+
+ obj = obj[prop];
+ }
+
+ return obj;
+ }
+
+ module.exports = exports.default;
+} (getProp, getProp.exports));
+
+var getPropExports = getProp.exports;
+
+var ensureObject = {exports: {}};
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = ensureObject;
+
+ function ensureObject(obj) {
+ for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ props[_key - 1] = arguments[_key];
+ }
+
+ while (props.length > 0) {
+ var prop = props.shift();
+
+ if (!obj[prop]) {
+ obj[prop] = {};
+ }
+
+ obj = obj[prop];
+ }
+ }
+
+ module.exports = exports.default;
+} (ensureObject, ensureObject.exports));
+
+var ensureObjectExports = ensureObject.exports;
+
+var stripComments = {exports: {}};
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = stripComments;
+
+ function stripComments(str) {
+ var s = "";
+ var commentStart = str.indexOf("/*");
+ var lastEnd = 0;
+
+ while (commentStart >= 0) {
+ s = s + str.slice(lastEnd, commentStart);
+ var commentEnd = str.indexOf("*/", commentStart + 2);
+
+ if (commentEnd < 0) {
+ return s;
+ }
+
+ lastEnd = commentEnd + 2;
+ commentStart = str.indexOf("/*", lastEnd);
+ }
+
+ s = s + str.slice(lastEnd);
+ return s;
+ }
+
+ module.exports = exports.default;
+} (stripComments, stripComments.exports));
+
+var stripCommentsExports = stripComments.exports;
+
+util.__esModule = true;
+util.stripComments = util.ensureObject = util.getProp = util.unesc = void 0;
+
+var _unesc = _interopRequireDefault$3(unescExports);
+
+util.unesc = _unesc["default"];
+
+var _getProp = _interopRequireDefault$3(getPropExports);
+
+util.getProp = _getProp["default"];
+
+var _ensureObject = _interopRequireDefault$3(ensureObjectExports);
+
+util.ensureObject = _ensureObject["default"];
+
+var _stripComments = _interopRequireDefault$3(stripCommentsExports);
+
+util.stripComments = _stripComments["default"];
+
+function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _util = util;
+
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+ var cloneNode = function cloneNode(obj, parent) {
+ if (typeof obj !== 'object' || obj === null) {
+ return obj;
+ }
+
+ var cloned = new obj.constructor();
+
+ for (var i in obj) {
+ if (!obj.hasOwnProperty(i)) {
+ continue;
+ }
+
+ var value = obj[i];
+ var type = typeof value;
+
+ if (i === 'parent' && type === 'object') {
+ if (parent) {
+ cloned[i] = parent;
+ }
+ } else if (value instanceof Array) {
+ cloned[i] = value.map(function (j) {
+ return cloneNode(j, cloned);
+ });
+ } else {
+ cloned[i] = cloneNode(value, cloned);
+ }
+ }
+
+ return cloned;
+ };
+
+ var Node = /*#__PURE__*/function () {
+ function Node(opts) {
+ if (opts === void 0) {
+ opts = {};
+ }
+
+ Object.assign(this, opts);
+ this.spaces = this.spaces || {};
+ this.spaces.before = this.spaces.before || '';
+ this.spaces.after = this.spaces.after || '';
+ }
+
+ var _proto = Node.prototype;
+
+ _proto.remove = function remove() {
+ if (this.parent) {
+ this.parent.removeChild(this);
+ }
+
+ this.parent = undefined;
+ return this;
+ };
+
+ _proto.replaceWith = function replaceWith() {
+ if (this.parent) {
+ for (var index in arguments) {
+ this.parent.insertBefore(this, arguments[index]);
+ }
+
+ this.remove();
+ }
+
+ return this;
+ };
+
+ _proto.next = function next() {
+ return this.parent.at(this.parent.index(this) + 1);
+ };
+
+ _proto.prev = function prev() {
+ return this.parent.at(this.parent.index(this) - 1);
+ };
+
+ _proto.clone = function clone(overrides) {
+ if (overrides === void 0) {
+ overrides = {};
+ }
+
+ var cloned = cloneNode(this);
+
+ for (var name in overrides) {
+ cloned[name] = overrides[name];
+ }
+
+ return cloned;
+ }
+ /**
+ * Some non-standard syntax doesn't follow normal escaping rules for css.
+ * This allows non standard syntax to be appended to an existing property
+ * by specifying the escaped value. By specifying the escaped value,
+ * illegal characters are allowed to be directly inserted into css output.
+ * @param {string} name the property to set
+ * @param {any} value the unescaped value of the property
+ * @param {string} valueEscaped optional. the escaped value of the property.
+ */
+ ;
+
+ _proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
+ if (!this.raws) {
+ this.raws = {};
+ }
+
+ var originalValue = this[name];
+ var originalEscaped = this.raws[name];
+ this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
+
+ if (originalEscaped || valueEscaped !== value) {
+ this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
+ } else {
+ delete this.raws[name]; // delete any escaped value that was created by the setter.
+ }
+ }
+ /**
+ * Some non-standard syntax doesn't follow normal escaping rules for css.
+ * This allows the escaped value to be specified directly, allowing illegal
+ * characters to be directly inserted into css output.
+ * @param {string} name the property to set
+ * @param {any} value the unescaped value of the property
+ * @param {string} valueEscaped the escaped value of the property.
+ */
+ ;
+
+ _proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
+ if (!this.raws) {
+ this.raws = {};
+ }
+
+ this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
+
+ this.raws[name] = valueEscaped;
+ }
+ /**
+ * When you want a value to passed through to CSS directly. This method
+ * deletes the corresponding raw value causing the stringifier to fallback
+ * to the unescaped value.
+ * @param {string} name the property to set.
+ * @param {any} value The value that is both escaped and unescaped.
+ */
+ ;
+
+ _proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
+ this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
+
+ if (this.raws) {
+ delete this.raws[name];
+ }
+ }
+ /**
+ *
+ * @param {number} line The number (starting with 1)
+ * @param {number} column The column number (starting with 1)
+ */
+ ;
+
+ _proto.isAtPosition = function isAtPosition(line, column) {
+ if (this.source && this.source.start && this.source.end) {
+ if (this.source.start.line > line) {
+ return false;
+ }
+
+ if (this.source.end.line < line) {
+ return false;
+ }
+
+ if (this.source.start.line === line && this.source.start.column > column) {
+ return false;
+ }
+
+ if (this.source.end.line === line && this.source.end.column < column) {
+ return false;
+ }
+
+ return true;
+ }
+
+ return undefined;
+ };
+
+ _proto.stringifyProperty = function stringifyProperty(name) {
+ return this.raws && this.raws[name] || this[name];
+ };
+
+ _proto.valueToString = function valueToString() {
+ return String(this.stringifyProperty("value"));
+ };
+
+ _proto.toString = function toString() {
+ return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
+ };
+
+ _createClass(Node, [{
+ key: "rawSpaceBefore",
+ get: function get() {
+ var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
+
+ if (rawSpace === undefined) {
+ rawSpace = this.spaces && this.spaces.before;
+ }
+
+ return rawSpace || "";
+ },
+ set: function set(raw) {
+ (0, _util.ensureObject)(this, "raws", "spaces");
+ this.raws.spaces.before = raw;
+ }
+ }, {
+ key: "rawSpaceAfter",
+ get: function get() {
+ var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
+
+ if (rawSpace === undefined) {
+ rawSpace = this.spaces.after;
+ }
+
+ return rawSpace || "";
+ },
+ set: function set(raw) {
+ (0, _util.ensureObject)(this, "raws", "spaces");
+ this.raws.spaces.after = raw;
+ }
+ }]);
+
+ return Node;
+ }();
+
+ exports["default"] = Node;
+ module.exports = exports.default;
+} (node$1, node$1.exports));
+
+var nodeExports = node$1.exports;
+
+var types = {};
+
+types.__esModule = true;
+types.UNIVERSAL = types.ATTRIBUTE = types.CLASS = types.COMBINATOR = types.COMMENT = types.ID = types.NESTING = types.PSEUDO = types.ROOT = types.SELECTOR = types.STRING = types.TAG = void 0;
+var TAG = 'tag';
+types.TAG = TAG;
+var STRING = 'string';
+types.STRING = STRING;
+var SELECTOR = 'selector';
+types.SELECTOR = SELECTOR;
+var ROOT = 'root';
+types.ROOT = ROOT;
+var PSEUDO = 'pseudo';
+types.PSEUDO = PSEUDO;
+var NESTING = 'nesting';
+types.NESTING = NESTING;
+var ID = 'id';
+types.ID = ID;
+var COMMENT = 'comment';
+types.COMMENT = COMMENT;
+var COMBINATOR = 'combinator';
+types.COMBINATOR = COMBINATOR;
+var CLASS = 'class';
+types.CLASS = CLASS;
+var ATTRIBUTE = 'attribute';
+types.ATTRIBUTE = ATTRIBUTE;
+var UNIVERSAL = 'universal';
+types.UNIVERSAL = UNIVERSAL;
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _node = _interopRequireDefault(nodeExports);
+
+ var types$1 = _interopRequireWildcard(types);
+
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
+
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); }
+
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
+
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
+
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
+
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+ var Container = /*#__PURE__*/function (_Node) {
+ _inheritsLoose(Container, _Node);
+
+ function Container(opts) {
+ var _this;
+
+ _this = _Node.call(this, opts) || this;
+
+ if (!_this.nodes) {
+ _this.nodes = [];
+ }
+
+ return _this;
+ }
+
+ var _proto = Container.prototype;
+
+ _proto.append = function append(selector) {
+ selector.parent = this;
+ this.nodes.push(selector);
+ return this;
+ };
+
+ _proto.prepend = function prepend(selector) {
+ selector.parent = this;
+ this.nodes.unshift(selector);
+ return this;
+ };
+
+ _proto.at = function at(index) {
+ return this.nodes[index];
+ };
+
+ _proto.index = function index(child) {
+ if (typeof child === 'number') {
+ return child;
+ }
+
+ return this.nodes.indexOf(child);
+ };
+
+ _proto.removeChild = function removeChild(child) {
+ child = this.index(child);
+ this.at(child).parent = undefined;
+ this.nodes.splice(child, 1);
+ var index;
+
+ for (var id in this.indexes) {
+ index = this.indexes[id];
+
+ if (index >= child) {
+ this.indexes[id] = index - 1;
+ }
+ }
+
+ return this;
+ };
+
+ _proto.removeAll = function removeAll() {
+ for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {
+ var node = _step.value;
+ node.parent = undefined;
+ }
+
+ this.nodes = [];
+ return this;
+ };
+
+ _proto.empty = function empty() {
+ return this.removeAll();
+ };
+
+ _proto.insertAfter = function insertAfter(oldNode, newNode) {
+ newNode.parent = this;
+ var oldIndex = this.index(oldNode);
+ this.nodes.splice(oldIndex + 1, 0, newNode);
+ newNode.parent = this;
+ var index;
+
+ for (var id in this.indexes) {
+ index = this.indexes[id];
+
+ if (oldIndex <= index) {
+ this.indexes[id] = index + 1;
+ }
+ }
+
+ return this;
+ };
+
+ _proto.insertBefore = function insertBefore(oldNode, newNode) {
+ newNode.parent = this;
+ var oldIndex = this.index(oldNode);
+ this.nodes.splice(oldIndex, 0, newNode);
+ newNode.parent = this;
+ var index;
+
+ for (var id in this.indexes) {
+ index = this.indexes[id];
+
+ if (index <= oldIndex) {
+ this.indexes[id] = index + 1;
+ }
+ }
+
+ return this;
+ };
+
+ _proto._findChildAtPosition = function _findChildAtPosition(line, col) {
+ var found = undefined;
+ this.each(function (node) {
+ if (node.atPosition) {
+ var foundChild = node.atPosition(line, col);
+
+ if (foundChild) {
+ found = foundChild;
+ return false;
+ }
+ } else if (node.isAtPosition(line, col)) {
+ found = node;
+ return false;
+ }
+ });
+ return found;
+ }
+ /**
+ * Return the most specific node at the line and column number given.
+ * The source location is based on the original parsed location, locations aren't
+ * updated as selector nodes are mutated.
+ *
+ * Note that this location is relative to the location of the first character
+ * of the selector, and not the location of the selector in the overall document
+ * when used in conjunction with postcss.
+ *
+ * If not found, returns undefined.
+ * @param {number} line The line number of the node to find. (1-based index)
+ * @param {number} col The column number of the node to find. (1-based index)
+ */
+ ;
+
+ _proto.atPosition = function atPosition(line, col) {
+ if (this.isAtPosition(line, col)) {
+ return this._findChildAtPosition(line, col) || this;
+ } else {
+ return undefined;
+ }
+ };
+
+ _proto._inferEndPosition = function _inferEndPosition() {
+ if (this.last && this.last.source && this.last.source.end) {
+ this.source = this.source || {};
+ this.source.end = this.source.end || {};
+ Object.assign(this.source.end, this.last.source.end);
+ }
+ };
+
+ _proto.each = function each(callback) {
+ if (!this.lastEach) {
+ this.lastEach = 0;
+ }
+
+ if (!this.indexes) {
+ this.indexes = {};
+ }
+
+ this.lastEach++;
+ var id = this.lastEach;
+ this.indexes[id] = 0;
+
+ if (!this.length) {
+ return undefined;
+ }
+
+ var index, result;
+
+ while (this.indexes[id] < this.length) {
+ index = this.indexes[id];
+ result = callback(this.at(index), index);
+
+ if (result === false) {
+ break;
+ }
+
+ this.indexes[id] += 1;
+ }
+
+ delete this.indexes[id];
+
+ if (result === false) {
+ return false;
+ }
+ };
+
+ _proto.walk = function walk(callback) {
+ return this.each(function (node, i) {
+ var result = callback(node, i);
+
+ if (result !== false && node.length) {
+ result = node.walk(callback);
+ }
+
+ if (result === false) {
+ return false;
+ }
+ });
+ };
+
+ _proto.walkAttributes = function walkAttributes(callback) {
+ var _this2 = this;
+
+ return this.walk(function (selector) {
+ if (selector.type === types$1.ATTRIBUTE) {
+ return callback.call(_this2, selector);
+ }
+ });
+ };
+
+ _proto.walkClasses = function walkClasses(callback) {
+ var _this3 = this;
+
+ return this.walk(function (selector) {
+ if (selector.type === types$1.CLASS) {
+ return callback.call(_this3, selector);
+ }
+ });
+ };
+
+ _proto.walkCombinators = function walkCombinators(callback) {
+ var _this4 = this;
+
+ return this.walk(function (selector) {
+ if (selector.type === types$1.COMBINATOR) {
+ return callback.call(_this4, selector);
+ }
+ });
+ };
+
+ _proto.walkComments = function walkComments(callback) {
+ var _this5 = this;
+
+ return this.walk(function (selector) {
+ if (selector.type === types$1.COMMENT) {
+ return callback.call(_this5, selector);
+ }
+ });
+ };
+
+ _proto.walkIds = function walkIds(callback) {
+ var _this6 = this;
+
+ return this.walk(function (selector) {
+ if (selector.type === types$1.ID) {
+ return callback.call(_this6, selector);
+ }
+ });
+ };
+
+ _proto.walkNesting = function walkNesting(callback) {
+ var _this7 = this;
+
+ return this.walk(function (selector) {
+ if (selector.type === types$1.NESTING) {
+ return callback.call(_this7, selector);
+ }
+ });
+ };
+
+ _proto.walkPseudos = function walkPseudos(callback) {
+ var _this8 = this;
+
+ return this.walk(function (selector) {
+ if (selector.type === types$1.PSEUDO) {
+ return callback.call(_this8, selector);
+ }
+ });
+ };
+
+ _proto.walkTags = function walkTags(callback) {
+ var _this9 = this;
+
+ return this.walk(function (selector) {
+ if (selector.type === types$1.TAG) {
+ return callback.call(_this9, selector);
+ }
+ });
+ };
+
+ _proto.walkUniversals = function walkUniversals(callback) {
+ var _this10 = this;
+
+ return this.walk(function (selector) {
+ if (selector.type === types$1.UNIVERSAL) {
+ return callback.call(_this10, selector);
+ }
+ });
+ };
+
+ _proto.split = function split(callback) {
+ var _this11 = this;
+
+ var current = [];
+ return this.reduce(function (memo, node, index) {
+ var split = callback.call(_this11, node);
+ current.push(node);
+
+ if (split) {
+ memo.push(current);
+ current = [];
+ } else if (index === _this11.length - 1) {
+ memo.push(current);
+ }
+
+ return memo;
+ }, []);
+ };
+
+ _proto.map = function map(callback) {
+ return this.nodes.map(callback);
+ };
+
+ _proto.reduce = function reduce(callback, memo) {
+ return this.nodes.reduce(callback, memo);
+ };
+
+ _proto.every = function every(callback) {
+ return this.nodes.every(callback);
+ };
+
+ _proto.some = function some(callback) {
+ return this.nodes.some(callback);
+ };
+
+ _proto.filter = function filter(callback) {
+ return this.nodes.filter(callback);
+ };
+
+ _proto.sort = function sort(callback) {
+ return this.nodes.sort(callback);
+ };
+
+ _proto.toString = function toString() {
+ return this.map(String).join('');
+ };
+
+ _createClass(Container, [{
+ key: "first",
+ get: function get() {
+ return this.at(0);
+ }
+ }, {
+ key: "last",
+ get: function get() {
+ return this.at(this.length - 1);
+ }
+ }, {
+ key: "length",
+ get: function get() {
+ return this.nodes.length;
+ }
+ }]);
+
+ return Container;
+ }(_node["default"]);
+
+ exports["default"] = Container;
+ module.exports = exports.default;
+} (container, container.exports));
+
+var containerExports = container.exports;
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _container = _interopRequireDefault(containerExports);
+
+ var _types = types;
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
+
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+ var Root = /*#__PURE__*/function (_Container) {
+ _inheritsLoose(Root, _Container);
+
+ function Root(opts) {
+ var _this;
+
+ _this = _Container.call(this, opts) || this;
+ _this.type = _types.ROOT;
+ return _this;
+ }
+
+ var _proto = Root.prototype;
+
+ _proto.toString = function toString() {
+ var str = this.reduce(function (memo, selector) {
+ memo.push(String(selector));
+ return memo;
+ }, []).join(',');
+ return this.trailingComma ? str + ',' : str;
+ };
+
+ _proto.error = function error(message, options) {
+ if (this._error) {
+ return this._error(message, options);
+ } else {
+ return new Error(message);
+ }
+ };
+
+ _createClass(Root, [{
+ key: "errorGenerator",
+ set: function set(handler) {
+ this._error = handler;
+ }
+ }]);
+
+ return Root;
+ }(_container["default"]);
+
+ exports["default"] = Root;
+ module.exports = exports.default;
+} (root$1, root$1.exports));
+
+var rootExports = root$1.exports;
+
+var selector$1 = {exports: {}};
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _container = _interopRequireDefault(containerExports);
+
+ var _types = types;
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
+
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+ var Selector = /*#__PURE__*/function (_Container) {
+ _inheritsLoose(Selector, _Container);
+
+ function Selector(opts) {
+ var _this;
+
+ _this = _Container.call(this, opts) || this;
+ _this.type = _types.SELECTOR;
+ return _this;
+ }
+
+ return Selector;
+ }(_container["default"]);
+
+ exports["default"] = Selector;
+ module.exports = exports.default;
+} (selector$1, selector$1.exports));
+
+var selectorExports = selector$1.exports;
+
+var className$1 = {exports: {}};
+
+/*! https://mths.be/cssesc v3.0.0 by @mathias */
+
+var object = {};
+var hasOwnProperty$1 = object.hasOwnProperty;
+var merge = function merge(options, defaults) {
+ if (!options) {
+ return defaults;
+ }
+ var result = {};
+ for (var key in defaults) {
+ // `if (defaults.hasOwnProperty(key) { … }` is not needed here, since
+ // only recognized option names are used.
+ result[key] = hasOwnProperty$1.call(options, key) ? options[key] : defaults[key];
+ }
+ return result;
+};
+
+var regexAnySingleEscape = /[ -,\.\/:-@\[-\^`\{-~]/;
+var regexSingleEscape = /[ -,\.\/:-@\[\]\^`\{-~]/;
+var regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;
+
+// https://mathiasbynens.be/notes/css-escapes#css
+var cssesc = function cssesc(string, options) {
+ options = merge(options, cssesc.options);
+ if (options.quotes != 'single' && options.quotes != 'double') {
+ options.quotes = 'single';
+ }
+ var quote = options.quotes == 'double' ? '"' : '\'';
+ var isIdentifier = options.isIdentifier;
+
+ var firstChar = string.charAt(0);
+ var output = '';
+ var counter = 0;
+ var length = string.length;
+ while (counter < length) {
+ var character = string.charAt(counter++);
+ var codePoint = character.charCodeAt();
+ var value = void 0;
+ // If it’s not a printable ASCII character…
+ if (codePoint < 0x20 || codePoint > 0x7E) {
+ if (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) {
+ // It’s a high surrogate, and there is a next character.
+ var extra = string.charCodeAt(counter++);
+ if ((extra & 0xFC00) == 0xDC00) {
+ // next character is low surrogate
+ codePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000;
+ } else {
+ // It’s an unmatched surrogate; only append this code unit, in case
+ // the next code unit is the high surrogate of a surrogate pair.
+ counter--;
+ }
+ }
+ value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
+ } else {
+ if (options.escapeEverything) {
+ if (regexAnySingleEscape.test(character)) {
+ value = '\\' + character;
+ } else {
+ value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
+ }
+ } else if (/[\t\n\f\r\x0B]/.test(character)) {
+ value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
+ } else if (character == '\\' || !isIdentifier && (character == '"' && quote == character || character == '\'' && quote == character) || isIdentifier && regexSingleEscape.test(character)) {
+ value = '\\' + character;
+ } else {
+ value = character;
+ }
+ }
+ output += value;
+ }
+
+ if (isIdentifier) {
+ if (/^-[-\d]/.test(output)) {
+ output = '\\-' + output.slice(1);
+ } else if (/\d/.test(firstChar)) {
+ output = '\\3' + firstChar + ' ' + output.slice(1);
+ }
+ }
+
+ // Remove spaces after `\HEX` escapes that are not followed by a hex digit,
+ // since they’re redundant. Note that this is only possible if the escape
+ // sequence isn’t preceded by an odd number of backslashes.
+ output = output.replace(regexExcessiveSpaces, function ($0, $1, $2) {
+ if ($1 && $1.length % 2) {
+ // It’s not safe to remove the space, so don’t.
+ return $0;
+ }
+ // Strip the space.
+ return ($1 || '') + $2;
+ });
+
+ if (!isIdentifier && options.wrap) {
+ return quote + output + quote;
+ }
+ return output;
+};
+
+// Expose default options (so they can be overridden globally).
+cssesc.options = {
+ 'escapeEverything': false,
+ 'isIdentifier': false,
+ 'quotes': 'single',
+ 'wrap': false
+};
+
+cssesc.version = '3.0.0';
+
+var cssesc_1 = cssesc;
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _cssesc = _interopRequireDefault(cssesc_1);
+
+ var _util = util;
+
+ var _node = _interopRequireDefault(nodeExports);
+
+ var _types = types;
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
+
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+ var ClassName = /*#__PURE__*/function (_Node) {
+ _inheritsLoose(ClassName, _Node);
+
+ function ClassName(opts) {
+ var _this;
+
+ _this = _Node.call(this, opts) || this;
+ _this.type = _types.CLASS;
+ _this._constructed = true;
+ return _this;
+ }
+
+ var _proto = ClassName.prototype;
+
+ _proto.valueToString = function valueToString() {
+ return '.' + _Node.prototype.valueToString.call(this);
+ };
+
+ _createClass(ClassName, [{
+ key: "value",
+ get: function get() {
+ return this._value;
+ },
+ set: function set(v) {
+ if (this._constructed) {
+ var escaped = (0, _cssesc["default"])(v, {
+ isIdentifier: true
+ });
+
+ if (escaped !== v) {
+ (0, _util.ensureObject)(this, "raws");
+ this.raws.value = escaped;
+ } else if (this.raws) {
+ delete this.raws.value;
+ }
+ }
+
+ this._value = v;
+ }
+ }]);
+
+ return ClassName;
+ }(_node["default"]);
+
+ exports["default"] = ClassName;
+ module.exports = exports.default;
+} (className$1, className$1.exports));
+
+var classNameExports = className$1.exports;
+
+var comment$2 = {exports: {}};
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _node = _interopRequireDefault(nodeExports);
+
+ var _types = types;
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
+
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+ var Comment = /*#__PURE__*/function (_Node) {
+ _inheritsLoose(Comment, _Node);
+
+ function Comment(opts) {
+ var _this;
+
+ _this = _Node.call(this, opts) || this;
+ _this.type = _types.COMMENT;
+ return _this;
+ }
+
+ return Comment;
+ }(_node["default"]);
+
+ exports["default"] = Comment;
+ module.exports = exports.default;
+} (comment$2, comment$2.exports));
+
+var commentExports = comment$2.exports;
+
+var id$1 = {exports: {}};
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _node = _interopRequireDefault(nodeExports);
+
+ var _types = types;
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
+
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+ var ID = /*#__PURE__*/function (_Node) {
+ _inheritsLoose(ID, _Node);
+
+ function ID(opts) {
+ var _this;
+
+ _this = _Node.call(this, opts) || this;
+ _this.type = _types.ID;
+ return _this;
+ }
+
+ var _proto = ID.prototype;
+
+ _proto.valueToString = function valueToString() {
+ return '#' + _Node.prototype.valueToString.call(this);
+ };
+
+ return ID;
+ }(_node["default"]);
+
+ exports["default"] = ID;
+ module.exports = exports.default;
+} (id$1, id$1.exports));
+
+var idExports = id$1.exports;
+
+var tag$1 = {exports: {}};
+
+var namespace = {exports: {}};
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _cssesc = _interopRequireDefault(cssesc_1);
+
+ var _util = util;
+
+ var _node = _interopRequireDefault(nodeExports);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
+
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+ var Namespace = /*#__PURE__*/function (_Node) {
+ _inheritsLoose(Namespace, _Node);
+
+ function Namespace() {
+ return _Node.apply(this, arguments) || this;
+ }
+
+ var _proto = Namespace.prototype;
+
+ _proto.qualifiedName = function qualifiedName(value) {
+ if (this.namespace) {
+ return this.namespaceString + "|" + value;
+ } else {
+ return value;
+ }
+ };
+
+ _proto.valueToString = function valueToString() {
+ return this.qualifiedName(_Node.prototype.valueToString.call(this));
+ };
+
+ _createClass(Namespace, [{
+ key: "namespace",
+ get: function get() {
+ return this._namespace;
+ },
+ set: function set(namespace) {
+ if (namespace === true || namespace === "*" || namespace === "&") {
+ this._namespace = namespace;
+
+ if (this.raws) {
+ delete this.raws.namespace;
+ }
+
+ return;
+ }
+
+ var escaped = (0, _cssesc["default"])(namespace, {
+ isIdentifier: true
+ });
+ this._namespace = namespace;
+
+ if (escaped !== namespace) {
+ (0, _util.ensureObject)(this, "raws");
+ this.raws.namespace = escaped;
+ } else if (this.raws) {
+ delete this.raws.namespace;
+ }
+ }
+ }, {
+ key: "ns",
+ get: function get() {
+ return this._namespace;
+ },
+ set: function set(namespace) {
+ this.namespace = namespace;
+ }
+ }, {
+ key: "namespaceString",
+ get: function get() {
+ if (this.namespace) {
+ var ns = this.stringifyProperty("namespace");
+
+ if (ns === true) {
+ return '';
+ } else {
+ return ns;
+ }
+ } else {
+ return '';
+ }
+ }
+ }]);
+
+ return Namespace;
+ }(_node["default"]);
+
+ exports["default"] = Namespace;
+ module.exports = exports.default;
+} (namespace, namespace.exports));
+
+var namespaceExports = namespace.exports;
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _namespace = _interopRequireDefault(namespaceExports);
+
+ var _types = types;
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
+
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+ var Tag = /*#__PURE__*/function (_Namespace) {
+ _inheritsLoose(Tag, _Namespace);
+
+ function Tag(opts) {
+ var _this;
+
+ _this = _Namespace.call(this, opts) || this;
+ _this.type = _types.TAG;
+ return _this;
+ }
+
+ return Tag;
+ }(_namespace["default"]);
+
+ exports["default"] = Tag;
+ module.exports = exports.default;
+} (tag$1, tag$1.exports));
+
+var tagExports = tag$1.exports;
+
+var string$1 = {exports: {}};
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _node = _interopRequireDefault(nodeExports);
+
+ var _types = types;
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
+
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+ var String = /*#__PURE__*/function (_Node) {
+ _inheritsLoose(String, _Node);
+
+ function String(opts) {
+ var _this;
+
+ _this = _Node.call(this, opts) || this;
+ _this.type = _types.STRING;
+ return _this;
+ }
+
+ return String;
+ }(_node["default"]);
+
+ exports["default"] = String;
+ module.exports = exports.default;
+} (string$1, string$1.exports));
+
+var stringExports = string$1.exports;
+
+var pseudo$1 = {exports: {}};
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _container = _interopRequireDefault(containerExports);
+
+ var _types = types;
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
+
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+ var Pseudo = /*#__PURE__*/function (_Container) {
+ _inheritsLoose(Pseudo, _Container);
+
+ function Pseudo(opts) {
+ var _this;
+
+ _this = _Container.call(this, opts) || this;
+ _this.type = _types.PSEUDO;
+ return _this;
+ }
+
+ var _proto = Pseudo.prototype;
+
+ _proto.toString = function toString() {
+ var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
+ return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join('');
+ };
+
+ return Pseudo;
+ }(_container["default"]);
+
+ exports["default"] = Pseudo;
+ module.exports = exports.default;
+} (pseudo$1, pseudo$1.exports));
+
+var pseudoExports = pseudo$1.exports;
+
+var attribute$1 = {};
+
+/**
+ * For Node.js, simply re-export the core `util.deprecate` function.
+ */
+
+var node = require$$0$2.deprecate;
+
+(function (exports) {
+
+ exports.__esModule = true;
+ exports.unescapeValue = unescapeValue;
+ exports["default"] = void 0;
+
+ var _cssesc = _interopRequireDefault(cssesc_1);
+
+ var _unesc = _interopRequireDefault(unescExports);
+
+ var _namespace = _interopRequireDefault(namespaceExports);
+
+ var _types = types;
+
+ var _CSSESC_QUOTE_OPTIONS;
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
+
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+ var deprecate = node;
+
+ var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/;
+ var warnOfDeprecatedValueAssignment = deprecate(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");
+ var warnOfDeprecatedQuotedAssignment = deprecate(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.");
+ var warnOfDeprecatedConstructor = deprecate(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
+
+ function unescapeValue(value) {
+ var deprecatedUsage = false;
+ var quoteMark = null;
+ var unescaped = value;
+ var m = unescaped.match(WRAPPED_IN_QUOTES);
+
+ if (m) {
+ quoteMark = m[1];
+ unescaped = m[2];
+ }
+
+ unescaped = (0, _unesc["default"])(unescaped);
+
+ if (unescaped !== value) {
+ deprecatedUsage = true;
+ }
+
+ return {
+ deprecatedUsage: deprecatedUsage,
+ unescaped: unescaped,
+ quoteMark: quoteMark
+ };
+ }
+
+ function handleDeprecatedContructorOpts(opts) {
+ if (opts.quoteMark !== undefined) {
+ return opts;
+ }
+
+ if (opts.value === undefined) {
+ return opts;
+ }
+
+ warnOfDeprecatedConstructor();
+
+ var _unescapeValue = unescapeValue(opts.value),
+ quoteMark = _unescapeValue.quoteMark,
+ unescaped = _unescapeValue.unescaped;
+
+ if (!opts.raws) {
+ opts.raws = {};
+ }
+
+ if (opts.raws.value === undefined) {
+ opts.raws.value = opts.value;
+ }
+
+ opts.value = unescaped;
+ opts.quoteMark = quoteMark;
+ return opts;
+ }
+
+ var Attribute = /*#__PURE__*/function (_Namespace) {
+ _inheritsLoose(Attribute, _Namespace);
+
+ function Attribute(opts) {
+ var _this;
+
+ if (opts === void 0) {
+ opts = {};
+ }
+
+ _this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this;
+ _this.type = _types.ATTRIBUTE;
+ _this.raws = _this.raws || {};
+ Object.defineProperty(_this.raws, 'unquoted', {
+ get: deprecate(function () {
+ return _this.value;
+ }, "attr.raws.unquoted is deprecated. Call attr.value instead."),
+ set: deprecate(function () {
+ return _this.value;
+ }, "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.")
+ });
+ _this._constructed = true;
+ return _this;
+ }
+ /**
+ * Returns the Attribute's value quoted such that it would be legal to use
+ * in the value of a css file. The original value's quotation setting
+ * used for stringification is left unchanged. See `setValue(value, options)`
+ * if you want to control the quote settings of a new value for the attribute.
+ *
+ * You can also change the quotation used for the current value by setting quoteMark.
+ *
+ * Options:
+ * * quoteMark {'"' | "'" | null} - Use this value to quote the value. If this
+ * option is not set, the original value for quoteMark will be used. If
+ * indeterminate, a double quote is used. The legal values are:
+ * * `null` - the value will be unquoted and characters will be escaped as necessary.
+ * * `'` - the value will be quoted with a single quote and single quotes are escaped.
+ * * `"` - the value will be quoted with a double quote and double quotes are escaped.
+ * * preferCurrentQuoteMark {boolean} - if true, prefer the source quote mark
+ * over the quoteMark option value.
+ * * smart {boolean} - if true, will select a quote mark based on the value
+ * and the other options specified here. See the `smartQuoteMark()`
+ * method.
+ **/
+
+
+ var _proto = Attribute.prototype;
+
+ _proto.getQuotedValue = function getQuotedValue(options) {
+ if (options === void 0) {
+ options = {};
+ }
+
+ var quoteMark = this._determineQuoteMark(options);
+
+ var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];
+ var escaped = (0, _cssesc["default"])(this._value, cssescopts);
+ return escaped;
+ };
+
+ _proto._determineQuoteMark = function _determineQuoteMark(options) {
+ return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);
+ }
+ /**
+ * Set the unescaped value with the specified quotation options. The value
+ * provided must not include any wrapping quote marks -- those quotes will
+ * be interpreted as part of the value and escaped accordingly.
+ */
+ ;
+
+ _proto.setValue = function setValue(value, options) {
+ if (options === void 0) {
+ options = {};
+ }
+
+ this._value = value;
+ this._quoteMark = this._determineQuoteMark(options);
+
+ this._syncRawValue();
+ }
+ /**
+ * Intelligently select a quoteMark value based on the value's contents. If
+ * the value is a legal CSS ident, it will not be quoted. Otherwise a quote
+ * mark will be picked that minimizes the number of escapes.
+ *
+ * If there's no clear winner, the quote mark from these options is used,
+ * then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
+ * true). If the quoteMark is unspecified, a double quote is used.
+ *
+ * @param options This takes the quoteMark and preferCurrentQuoteMark options
+ * from the quoteValue method.
+ */
+ ;
+
+ _proto.smartQuoteMark = function smartQuoteMark(options) {
+ var v = this.value;
+ var numSingleQuotes = v.replace(/[^']/g, '').length;
+ var numDoubleQuotes = v.replace(/[^"]/g, '').length;
+
+ if (numSingleQuotes + numDoubleQuotes === 0) {
+ var escaped = (0, _cssesc["default"])(v, {
+ isIdentifier: true
+ });
+
+ if (escaped === v) {
+ return Attribute.NO_QUOTE;
+ } else {
+ var pref = this.preferredQuoteMark(options);
+
+ if (pref === Attribute.NO_QUOTE) {
+ // pick a quote mark that isn't none and see if it's smaller
+ var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;
+ var opts = CSSESC_QUOTE_OPTIONS[quote];
+ var quoteValue = (0, _cssesc["default"])(v, opts);
+
+ if (quoteValue.length < escaped.length) {
+ return quote;
+ }
+ }
+
+ return pref;
+ }
+ } else if (numDoubleQuotes === numSingleQuotes) {
+ return this.preferredQuoteMark(options);
+ } else if (numDoubleQuotes < numSingleQuotes) {
+ return Attribute.DOUBLE_QUOTE;
+ } else {
+ return Attribute.SINGLE_QUOTE;
+ }
+ }
+ /**
+ * Selects the preferred quote mark based on the options and the current quote mark value.
+ * If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
+ * instead.
+ */
+ ;
+
+ _proto.preferredQuoteMark = function preferredQuoteMark(options) {
+ var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;
+
+ if (quoteMark === undefined) {
+ quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;
+ }
+
+ if (quoteMark === undefined) {
+ quoteMark = Attribute.DOUBLE_QUOTE;
+ }
+
+ return quoteMark;
+ };
+
+ _proto._syncRawValue = function _syncRawValue() {
+ var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
+
+ if (rawValue === this._value) {
+ if (this.raws) {
+ delete this.raws.value;
+ }
+ } else {
+ this.raws.value = rawValue;
+ }
+ };
+
+ _proto._handleEscapes = function _handleEscapes(prop, value) {
+ if (this._constructed) {
+ var escaped = (0, _cssesc["default"])(value, {
+ isIdentifier: true
+ });
+
+ if (escaped !== value) {
+ this.raws[prop] = escaped;
+ } else {
+ delete this.raws[prop];
+ }
+ }
+ };
+
+ _proto._spacesFor = function _spacesFor(name) {
+ var attrSpaces = {
+ before: '',
+ after: ''
+ };
+ var spaces = this.spaces[name] || {};
+ var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};
+ return Object.assign(attrSpaces, spaces, rawSpaces);
+ };
+
+ _proto._stringFor = function _stringFor(name, spaceName, concat) {
+ if (spaceName === void 0) {
+ spaceName = name;
+ }
+
+ if (concat === void 0) {
+ concat = defaultAttrConcat;
+ }
+
+ var attrSpaces = this._spacesFor(spaceName);
+
+ return concat(this.stringifyProperty(name), attrSpaces);
+ }
+ /**
+ * returns the offset of the attribute part specified relative to the
+ * start of the node of the output string.
+ *
+ * * "ns" - alias for "namespace"
+ * * "namespace" - the namespace if it exists.
+ * * "attribute" - the attribute name
+ * * "attributeNS" - the start of the attribute or its namespace
+ * * "operator" - the match operator of the attribute
+ * * "value" - The value (string or identifier)
+ * * "insensitive" - the case insensitivity flag;
+ * @param part One of the possible values inside an attribute.
+ * @returns -1 if the name is invalid or the value doesn't exist in this attribute.
+ */
+ ;
+
+ _proto.offsetOf = function offsetOf(name) {
+ var count = 1;
+
+ var attributeSpaces = this._spacesFor("attribute");
+
+ count += attributeSpaces.before.length;
+
+ if (name === "namespace" || name === "ns") {
+ return this.namespace ? count : -1;
+ }
+
+ if (name === "attributeNS") {
+ return count;
+ }
+
+ count += this.namespaceString.length;
+
+ if (this.namespace) {
+ count += 1;
+ }
+
+ if (name === "attribute") {
+ return count;
+ }
+
+ count += this.stringifyProperty("attribute").length;
+ count += attributeSpaces.after.length;
+
+ var operatorSpaces = this._spacesFor("operator");
+
+ count += operatorSpaces.before.length;
+ var operator = this.stringifyProperty("operator");
+
+ if (name === "operator") {
+ return operator ? count : -1;
+ }
+
+ count += operator.length;
+ count += operatorSpaces.after.length;
+
+ var valueSpaces = this._spacesFor("value");
+
+ count += valueSpaces.before.length;
+ var value = this.stringifyProperty("value");
+
+ if (name === "value") {
+ return value ? count : -1;
+ }
+
+ count += value.length;
+ count += valueSpaces.after.length;
+
+ var insensitiveSpaces = this._spacesFor("insensitive");
+
+ count += insensitiveSpaces.before.length;
+
+ if (name === "insensitive") {
+ return this.insensitive ? count : -1;
+ }
+
+ return -1;
+ };
+
+ _proto.toString = function toString() {
+ var _this2 = this;
+
+ var selector = [this.rawSpaceBefore, '['];
+ selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
+
+ if (this.operator && (this.value || this.value === '')) {
+ selector.push(this._stringFor('operator'));
+ selector.push(this._stringFor('value'));
+ selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) {
+ if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {
+ attrSpaces.before = " ";
+ }
+
+ return defaultAttrConcat(attrValue, attrSpaces);
+ }));
+ }
+
+ selector.push(']');
+ selector.push(this.rawSpaceAfter);
+ return selector.join('');
+ };
+
+ _createClass(Attribute, [{
+ key: "quoted",
+ get: function get() {
+ var qm = this.quoteMark;
+ return qm === "'" || qm === '"';
+ },
+ set: function set(value) {
+ warnOfDeprecatedQuotedAssignment();
+ }
+ /**
+ * returns a single (`'`) or double (`"`) quote character if the value is quoted.
+ * returns `null` if the value is not quoted.
+ * returns `undefined` if the quotation state is unknown (this can happen when
+ * the attribute is constructed without specifying a quote mark.)
+ */
+
+ }, {
+ key: "quoteMark",
+ get: function get() {
+ return this._quoteMark;
+ }
+ /**
+ * Set the quote mark to be used by this attribute's value.
+ * If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute
+ * value is updated accordingly.
+ *
+ * @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted.
+ */
+ ,
+ set: function set(quoteMark) {
+ if (!this._constructed) {
+ this._quoteMark = quoteMark;
+ return;
+ }
+
+ if (this._quoteMark !== quoteMark) {
+ this._quoteMark = quoteMark;
+
+ this._syncRawValue();
+ }
+ }
+ }, {
+ key: "qualifiedAttribute",
+ get: function get() {
+ return this.qualifiedName(this.raws.attribute || this.attribute);
+ }
+ }, {
+ key: "insensitiveFlag",
+ get: function get() {
+ return this.insensitive ? 'i' : '';
+ }
+ }, {
+ key: "value",
+ get: function get() {
+ return this._value;
+ },
+ set:
+ /**
+ * Before 3.0, the value had to be set to an escaped value including any wrapped
+ * quote marks. In 3.0, the semantics of `Attribute.value` changed so that the value
+ * is unescaped during parsing and any quote marks are removed.
+ *
+ * Because the ambiguity of this semantic change, if you set `attr.value = newValue`,
+ * a deprecation warning is raised when the new value contains any characters that would
+ * require escaping (including if it contains wrapped quotes).
+ *
+ * Instead, you should call `attr.setValue(newValue, opts)` and pass options that describe
+ * how the new value is quoted.
+ */
+ function set(v) {
+ if (this._constructed) {
+ var _unescapeValue2 = unescapeValue(v),
+ deprecatedUsage = _unescapeValue2.deprecatedUsage,
+ unescaped = _unescapeValue2.unescaped,
+ quoteMark = _unescapeValue2.quoteMark;
+
+ if (deprecatedUsage) {
+ warnOfDeprecatedValueAssignment();
+ }
+
+ if (unescaped === this._value && quoteMark === this._quoteMark) {
+ return;
+ }
+
+ this._value = unescaped;
+ this._quoteMark = quoteMark;
+
+ this._syncRawValue();
+ } else {
+ this._value = v;
+ }
+ }
+ }, {
+ key: "insensitive",
+ get: function get() {
+ return this._insensitive;
+ }
+ /**
+ * Set the case insensitive flag.
+ * If the case insensitive flag changes, the raw (escaped) value at `attr.raws.insensitiveFlag`
+ * of the attribute is updated accordingly.
+ *
+ * @param {true | false} insensitive true if the attribute should match case-insensitively.
+ */
+ ,
+ set: function set(insensitive) {
+ if (!insensitive) {
+ this._insensitive = false; // "i" and "I" can be used in "this.raws.insensitiveFlag" to store the original notation.
+ // When setting `attr.insensitive = false` both should be erased to ensure correct serialization.
+
+ if (this.raws && (this.raws.insensitiveFlag === 'I' || this.raws.insensitiveFlag === 'i')) {
+ this.raws.insensitiveFlag = undefined;
+ }
+ }
+
+ this._insensitive = insensitive;
+ }
+ }, {
+ key: "attribute",
+ get: function get() {
+ return this._attribute;
+ },
+ set: function set(name) {
+ this._handleEscapes("attribute", name);
+
+ this._attribute = name;
+ }
+ }]);
+
+ return Attribute;
+ }(_namespace["default"]);
+
+ exports["default"] = Attribute;
+ Attribute.NO_QUOTE = null;
+ Attribute.SINGLE_QUOTE = "'";
+ Attribute.DOUBLE_QUOTE = '"';
+ var CSSESC_QUOTE_OPTIONS = (_CSSESC_QUOTE_OPTIONS = {
+ "'": {
+ quotes: 'single',
+ wrap: true
+ },
+ '"': {
+ quotes: 'double',
+ wrap: true
+ }
+ }, _CSSESC_QUOTE_OPTIONS[null] = {
+ isIdentifier: true
+ }, _CSSESC_QUOTE_OPTIONS);
+
+ function defaultAttrConcat(attrValue, attrSpaces) {
+ return "" + attrSpaces.before + attrValue + attrSpaces.after;
+ }
+} (attribute$1));
+
+var universal$1 = {exports: {}};
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _namespace = _interopRequireDefault(namespaceExports);
+
+ var _types = types;
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
+
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+ var Universal = /*#__PURE__*/function (_Namespace) {
+ _inheritsLoose(Universal, _Namespace);
+
+ function Universal(opts) {
+ var _this;
+
+ _this = _Namespace.call(this, opts) || this;
+ _this.type = _types.UNIVERSAL;
+ _this.value = '*';
+ return _this;
+ }
+
+ return Universal;
+ }(_namespace["default"]);
+
+ exports["default"] = Universal;
+ module.exports = exports.default;
+} (universal$1, universal$1.exports));
+
+var universalExports = universal$1.exports;
+
+var combinator$2 = {exports: {}};
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _node = _interopRequireDefault(nodeExports);
+
+ var _types = types;
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
+
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+ var Combinator = /*#__PURE__*/function (_Node) {
+ _inheritsLoose(Combinator, _Node);
+
+ function Combinator(opts) {
+ var _this;
+
+ _this = _Node.call(this, opts) || this;
+ _this.type = _types.COMBINATOR;
+ return _this;
+ }
+
+ return Combinator;
+ }(_node["default"]);
+
+ exports["default"] = Combinator;
+ module.exports = exports.default;
+} (combinator$2, combinator$2.exports));
+
+var combinatorExports = combinator$2.exports;
+
+var nesting$1 = {exports: {}};
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _node = _interopRequireDefault(nodeExports);
+
+ var _types = types;
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
+
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+ var Nesting = /*#__PURE__*/function (_Node) {
+ _inheritsLoose(Nesting, _Node);
+
+ function Nesting(opts) {
+ var _this;
+
+ _this = _Node.call(this, opts) || this;
+ _this.type = _types.NESTING;
+ _this.value = '&';
+ return _this;
+ }
+
+ return Nesting;
+ }(_node["default"]);
+
+ exports["default"] = Nesting;
+ module.exports = exports.default;
+} (nesting$1, nesting$1.exports));
+
+var nestingExports = nesting$1.exports;
+
+var sortAscending = {exports: {}};
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = sortAscending;
+
+ function sortAscending(list) {
+ return list.sort(function (a, b) {
+ return a - b;
+ });
+ }
+ module.exports = exports.default;
+} (sortAscending, sortAscending.exports));
+
+var sortAscendingExports = sortAscending.exports;
+
+var tokenize = {};
+
+var tokenTypes = {};
+
+tokenTypes.__esModule = true;
+tokenTypes.combinator = tokenTypes.word = tokenTypes.comment = tokenTypes.str = tokenTypes.tab = tokenTypes.newline = tokenTypes.feed = tokenTypes.cr = tokenTypes.backslash = tokenTypes.bang = tokenTypes.slash = tokenTypes.doubleQuote = tokenTypes.singleQuote = tokenTypes.space = tokenTypes.greaterThan = tokenTypes.pipe = tokenTypes.equals = tokenTypes.plus = tokenTypes.caret = tokenTypes.tilde = tokenTypes.dollar = tokenTypes.closeSquare = tokenTypes.openSquare = tokenTypes.closeParenthesis = tokenTypes.openParenthesis = tokenTypes.semicolon = tokenTypes.colon = tokenTypes.comma = tokenTypes.at = tokenTypes.asterisk = tokenTypes.ampersand = void 0;
+var ampersand = 38; // `&`.charCodeAt(0);
+
+tokenTypes.ampersand = ampersand;
+var asterisk = 42; // `*`.charCodeAt(0);
+
+tokenTypes.asterisk = asterisk;
+var at = 64; // `@`.charCodeAt(0);
+
+tokenTypes.at = at;
+var comma = 44; // `,`.charCodeAt(0);
+
+tokenTypes.comma = comma;
+var colon = 58; // `:`.charCodeAt(0);
+
+tokenTypes.colon = colon;
+var semicolon = 59; // `;`.charCodeAt(0);
+
+tokenTypes.semicolon = semicolon;
+var openParenthesis = 40; // `(`.charCodeAt(0);
+
+tokenTypes.openParenthesis = openParenthesis;
+var closeParenthesis = 41; // `)`.charCodeAt(0);
+
+tokenTypes.closeParenthesis = closeParenthesis;
+var openSquare = 91; // `[`.charCodeAt(0);
+
+tokenTypes.openSquare = openSquare;
+var closeSquare = 93; // `]`.charCodeAt(0);
+
+tokenTypes.closeSquare = closeSquare;
+var dollar = 36; // `$`.charCodeAt(0);
+
+tokenTypes.dollar = dollar;
+var tilde = 126; // `~`.charCodeAt(0);
+
+tokenTypes.tilde = tilde;
+var caret = 94; // `^`.charCodeAt(0);
+
+tokenTypes.caret = caret;
+var plus = 43; // `+`.charCodeAt(0);
+
+tokenTypes.plus = plus;
+var equals = 61; // `=`.charCodeAt(0);
+
+tokenTypes.equals = equals;
+var pipe = 124; // `|`.charCodeAt(0);
+
+tokenTypes.pipe = pipe;
+var greaterThan = 62; // `>`.charCodeAt(0);
+
+tokenTypes.greaterThan = greaterThan;
+var space = 32; // ` `.charCodeAt(0);
+
+tokenTypes.space = space;
+var singleQuote = 39; // `'`.charCodeAt(0);
+
+tokenTypes.singleQuote = singleQuote;
+var doubleQuote = 34; // `"`.charCodeAt(0);
+
+tokenTypes.doubleQuote = doubleQuote;
+var slash = 47; // `/`.charCodeAt(0);
+
+tokenTypes.slash = slash;
+var bang = 33; // `!`.charCodeAt(0);
+
+tokenTypes.bang = bang;
+var backslash = 92; // '\\'.charCodeAt(0);
+
+tokenTypes.backslash = backslash;
+var cr = 13; // '\r'.charCodeAt(0);
+
+tokenTypes.cr = cr;
+var feed = 12; // '\f'.charCodeAt(0);
+
+tokenTypes.feed = feed;
+var newline = 10; // '\n'.charCodeAt(0);
+
+tokenTypes.newline = newline;
+var tab = 9; // '\t'.charCodeAt(0);
+// Expose aliases primarily for readability.
+
+tokenTypes.tab = tab;
+var str = singleQuote; // No good single character representation!
+
+tokenTypes.str = str;
+var comment$1 = -1;
+tokenTypes.comment = comment$1;
+var word = -2;
+tokenTypes.word = word;
+var combinator$1 = -3;
+tokenTypes.combinator = combinator$1;
+
+(function (exports) {
+
+ exports.__esModule = true;
+ exports["default"] = tokenize;
+ exports.FIELDS = void 0;
+
+ var t = _interopRequireWildcard(tokenTypes);
+
+ var _unescapable, _wordDelimiters;
+
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
+
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+ var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);
+ var wordDelimiters = (_wordDelimiters = {}, _wordDelimiters[t.space] = true, _wordDelimiters[t.tab] = true, _wordDelimiters[t.newline] = true, _wordDelimiters[t.cr] = true, _wordDelimiters[t.feed] = true, _wordDelimiters[t.ampersand] = true, _wordDelimiters[t.asterisk] = true, _wordDelimiters[t.bang] = true, _wordDelimiters[t.comma] = true, _wordDelimiters[t.colon] = true, _wordDelimiters[t.semicolon] = true, _wordDelimiters[t.openParenthesis] = true, _wordDelimiters[t.closeParenthesis] = true, _wordDelimiters[t.openSquare] = true, _wordDelimiters[t.closeSquare] = true, _wordDelimiters[t.singleQuote] = true, _wordDelimiters[t.doubleQuote] = true, _wordDelimiters[t.plus] = true, _wordDelimiters[t.pipe] = true, _wordDelimiters[t.tilde] = true, _wordDelimiters[t.greaterThan] = true, _wordDelimiters[t.equals] = true, _wordDelimiters[t.dollar] = true, _wordDelimiters[t.caret] = true, _wordDelimiters[t.slash] = true, _wordDelimiters);
+ var hex = {};
+ var hexChars = "0123456789abcdefABCDEF";
+
+ for (var i = 0; i < hexChars.length; i++) {
+ hex[hexChars.charCodeAt(i)] = true;
+ }
+ /**
+ * Returns the last index of the bar css word
+ * @param {string} css The string in which the word begins
+ * @param {number} start The index into the string where word's first letter occurs
+ */
+
+
+ function consumeWord(css, start) {
+ var next = start;
+ var code;
+
+ do {
+ code = css.charCodeAt(next);
+
+ if (wordDelimiters[code]) {
+ return next - 1;
+ } else if (code === t.backslash) {
+ next = consumeEscape(css, next) + 1;
+ } else {
+ // All other characters are part of the word
+ next++;
+ }
+ } while (next < css.length);
+
+ return next - 1;
+ }
+ /**
+ * Returns the last index of the escape sequence
+ * @param {string} css The string in which the sequence begins
+ * @param {number} start The index into the string where escape character (`\`) occurs.
+ */
+
+
+ function consumeEscape(css, start) {
+ var next = start;
+ var code = css.charCodeAt(next + 1);
+
+ if (unescapable[code]) ; else if (hex[code]) {
+ var hexDigits = 0; // consume up to 6 hex chars
+
+ do {
+ next++;
+ hexDigits++;
+ code = css.charCodeAt(next + 1);
+ } while (hex[code] && hexDigits < 6); // if fewer than 6 hex chars, a trailing space ends the escape
+
+
+ if (hexDigits < 6 && code === t.space) {
+ next++;
+ }
+ } else {
+ // the next char is part of the current word
+ next++;
+ }
+
+ return next;
+ }
+
+ var FIELDS = {
+ TYPE: 0,
+ START_LINE: 1,
+ START_COL: 2,
+ END_LINE: 3,
+ END_COL: 4,
+ START_POS: 5,
+ END_POS: 6
+ };
+ exports.FIELDS = FIELDS;
+
+ function tokenize(input) {
+ var tokens = [];
+ var css = input.css.valueOf();
+ var _css = css,
+ length = _css.length;
+ var offset = -1;
+ var line = 1;
+ var start = 0;
+ var end = 0;
+ var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType;
+
+ function unclosed(what, fix) {
+ if (input.safe) {
+ // fyi: this is never set to true.
+ css += fix;
+ next = css.length - 1;
+ } else {
+ throw input.error('Unclosed ' + what, line, start - offset, start);
+ }
+ }
+
+ while (start < length) {
+ code = css.charCodeAt(start);
+
+ if (code === t.newline) {
+ offset = start;
+ line += 1;
+ }
+
+ switch (code) {
+ case t.space:
+ case t.tab:
+ case t.newline:
+ case t.cr:
+ case t.feed:
+ next = start;
+
+ do {
+ next += 1;
+ code = css.charCodeAt(next);
+
+ if (code === t.newline) {
+ offset = next;
+ line += 1;
+ }
+ } while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
+
+ tokenType = t.space;
+ endLine = line;
+ endColumn = next - offset - 1;
+ end = next;
+ break;
+
+ case t.plus:
+ case t.greaterThan:
+ case t.tilde:
+ case t.pipe:
+ next = start;
+
+ do {
+ next += 1;
+ code = css.charCodeAt(next);
+ } while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
+
+ tokenType = t.combinator;
+ endLine = line;
+ endColumn = start - offset;
+ end = next;
+ break;
+ // Consume these characters as single tokens.
+
+ case t.asterisk:
+ case t.ampersand:
+ case t.bang:
+ case t.comma:
+ case t.equals:
+ case t.dollar:
+ case t.caret:
+ case t.openSquare:
+ case t.closeSquare:
+ case t.colon:
+ case t.semicolon:
+ case t.openParenthesis:
+ case t.closeParenthesis:
+ next = start;
+ tokenType = code;
+ endLine = line;
+ endColumn = start - offset;
+ end = next + 1;
+ break;
+
+ case t.singleQuote:
+ case t.doubleQuote:
+ quote = code === t.singleQuote ? "'" : '"';
+ next = start;
+
+ do {
+ escaped = false;
+ next = css.indexOf(quote, next + 1);
+
+ if (next === -1) {
+ unclosed('quote', quote);
+ }
+
+ escapePos = next;
+
+ while (css.charCodeAt(escapePos - 1) === t.backslash) {
+ escapePos -= 1;
+ escaped = !escaped;
+ }
+ } while (escaped);
+
+ tokenType = t.str;
+ endLine = line;
+ endColumn = start - offset;
+ end = next + 1;
+ break;
+
+ default:
+ if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {
+ next = css.indexOf('*/', start + 2) + 1;
+
+ if (next === 0) {
+ unclosed('comment', '*/');
+ }
+
+ content = css.slice(start, next + 1);
+ lines = content.split('\n');
+ last = lines.length - 1;
+
+ if (last > 0) {
+ nextLine = line + last;
+ nextOffset = next - lines[last].length;
+ } else {
+ nextLine = line;
+ nextOffset = offset;
+ }
+
+ tokenType = t.comment;
+ line = nextLine;
+ endLine = nextLine;
+ endColumn = next - nextOffset;
+ } else if (code === t.slash) {
+ next = start;
+ tokenType = code;
+ endLine = line;
+ endColumn = start - offset;
+ end = next + 1;
+ } else {
+ next = consumeWord(css, start);
+ tokenType = t.word;
+ endLine = line;
+ endColumn = next - offset;
+ }
+
+ end = next + 1;
+ break;
+ } // Ensure that the token structure remains consistent
+
+
+ tokens.push([tokenType, // [0] Token type
+ line, // [1] Starting line
+ start - offset, // [2] Starting column
+ endLine, // [3] Ending line
+ endColumn, // [4] Ending column
+ start, // [5] Start position / Source index
+ end // [6] End position
+ ]); // Reset offset for the next token
+
+ if (nextOffset) {
+ offset = nextOffset;
+ nextOffset = null;
+ }
+
+ start = end;
+ }
+
+ return tokens;
+ }
+} (tokenize));
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _root = _interopRequireDefault(rootExports);
+
+ var _selector = _interopRequireDefault(selectorExports);
+
+ var _className = _interopRequireDefault(classNameExports);
+
+ var _comment = _interopRequireDefault(commentExports);
+
+ var _id = _interopRequireDefault(idExports);
+
+ var _tag = _interopRequireDefault(tagExports);
+
+ var _string = _interopRequireDefault(stringExports);
+
+ var _pseudo = _interopRequireDefault(pseudoExports);
+
+ var _attribute = _interopRequireWildcard(attribute$1);
+
+ var _universal = _interopRequireDefault(universalExports);
+
+ var _combinator = _interopRequireDefault(combinatorExports);
+
+ var _nesting = _interopRequireDefault(nestingExports);
+
+ var _sortAscending = _interopRequireDefault(sortAscendingExports);
+
+ var _tokenize = _interopRequireWildcard(tokenize);
+
+ var tokens = _interopRequireWildcard(tokenTypes);
+
+ var types$1 = _interopRequireWildcard(types);
+
+ var _util = util;
+
+ var _WHITESPACE_TOKENS, _Object$assign;
+
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
+
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+ var WHITESPACE_TOKENS = (_WHITESPACE_TOKENS = {}, _WHITESPACE_TOKENS[tokens.space] = true, _WHITESPACE_TOKENS[tokens.cr] = true, _WHITESPACE_TOKENS[tokens.feed] = true, _WHITESPACE_TOKENS[tokens.newline] = true, _WHITESPACE_TOKENS[tokens.tab] = true, _WHITESPACE_TOKENS);
+ var WHITESPACE_EQUIV_TOKENS = Object.assign({}, WHITESPACE_TOKENS, (_Object$assign = {}, _Object$assign[tokens.comment] = true, _Object$assign));
+
+ function tokenStart(token) {
+ return {
+ line: token[_tokenize.FIELDS.START_LINE],
+ column: token[_tokenize.FIELDS.START_COL]
+ };
+ }
+
+ function tokenEnd(token) {
+ return {
+ line: token[_tokenize.FIELDS.END_LINE],
+ column: token[_tokenize.FIELDS.END_COL]
+ };
+ }
+
+ function getSource(startLine, startColumn, endLine, endColumn) {
+ return {
+ start: {
+ line: startLine,
+ column: startColumn
+ },
+ end: {
+ line: endLine,
+ column: endColumn
+ }
+ };
+ }
+
+ function getTokenSource(token) {
+ return getSource(token[_tokenize.FIELDS.START_LINE], token[_tokenize.FIELDS.START_COL], token[_tokenize.FIELDS.END_LINE], token[_tokenize.FIELDS.END_COL]);
+ }
+
+ function getTokenSourceSpan(startToken, endToken) {
+ if (!startToken) {
+ return undefined;
+ }
+
+ return getSource(startToken[_tokenize.FIELDS.START_LINE], startToken[_tokenize.FIELDS.START_COL], endToken[_tokenize.FIELDS.END_LINE], endToken[_tokenize.FIELDS.END_COL]);
+ }
+
+ function unescapeProp(node, prop) {
+ var value = node[prop];
+
+ if (typeof value !== "string") {
+ return;
+ }
+
+ if (value.indexOf("\\") !== -1) {
+ (0, _util.ensureObject)(node, 'raws');
+ node[prop] = (0, _util.unesc)(value);
+
+ if (node.raws[prop] === undefined) {
+ node.raws[prop] = value;
+ }
+ }
+
+ return node;
+ }
+
+ function indexesOf(array, item) {
+ var i = -1;
+ var indexes = [];
+
+ while ((i = array.indexOf(item, i + 1)) !== -1) {
+ indexes.push(i);
+ }
+
+ return indexes;
+ }
+
+ function uniqs() {
+ var list = Array.prototype.concat.apply([], arguments);
+ return list.filter(function (item, i) {
+ return i === list.indexOf(item);
+ });
+ }
+
+ var Parser = /*#__PURE__*/function () {
+ function Parser(rule, options) {
+ if (options === void 0) {
+ options = {};
+ }
+
+ this.rule = rule;
+ this.options = Object.assign({
+ lossy: false,
+ safe: false
+ }, options);
+ this.position = 0;
+ this.css = typeof this.rule === 'string' ? this.rule : this.rule.selector;
+ this.tokens = (0, _tokenize["default"])({
+ css: this.css,
+ error: this._errorGenerator(),
+ safe: this.options.safe
+ });
+ var rootSource = getTokenSourceSpan(this.tokens[0], this.tokens[this.tokens.length - 1]);
+ this.root = new _root["default"]({
+ source: rootSource
+ });
+ this.root.errorGenerator = this._errorGenerator();
+ var selector = new _selector["default"]({
+ source: {
+ start: {
+ line: 1,
+ column: 1
+ }
+ }
+ });
+ this.root.append(selector);
+ this.current = selector;
+ this.loop();
+ }
+
+ var _proto = Parser.prototype;
+
+ _proto._errorGenerator = function _errorGenerator() {
+ var _this = this;
+
+ return function (message, errorOptions) {
+ if (typeof _this.rule === 'string') {
+ return new Error(message);
+ }
+
+ return _this.rule.error(message, errorOptions);
+ };
+ };
+
+ _proto.attribute = function attribute() {
+ var attr = [];
+ var startingToken = this.currToken;
+ this.position++;
+
+ while (this.position < this.tokens.length && this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
+ attr.push(this.currToken);
+ this.position++;
+ }
+
+ if (this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
+ return this.expected('closing square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
+ }
+
+ var len = attr.length;
+ var node = {
+ source: getSource(startingToken[1], startingToken[2], this.currToken[3], this.currToken[4]),
+ sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
+ };
+
+ if (len === 1 && !~[tokens.word].indexOf(attr[0][_tokenize.FIELDS.TYPE])) {
+ return this.expected('attribute', attr[0][_tokenize.FIELDS.START_POS]);
+ }
+
+ var pos = 0;
+ var spaceBefore = '';
+ var commentBefore = '';
+ var lastAdded = null;
+ var spaceAfterMeaningfulToken = false;
+
+ while (pos < len) {
+ var token = attr[pos];
+ var content = this.content(token);
+ var next = attr[pos + 1];
+
+ switch (token[_tokenize.FIELDS.TYPE]) {
+ case tokens.space:
+ // if (
+ // len === 1 ||
+ // pos === 0 && this.content(next) === '|'
+ // ) {
+ // return this.expected('attribute', token[TOKEN.START_POS], content);
+ // }
+ spaceAfterMeaningfulToken = true;
+
+ if (this.options.lossy) {
+ break;
+ }
+
+ if (lastAdded) {
+ (0, _util.ensureObject)(node, 'spaces', lastAdded);
+ var prevContent = node.spaces[lastAdded].after || '';
+ node.spaces[lastAdded].after = prevContent + content;
+ var existingComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || null;
+
+ if (existingComment) {
+ node.raws.spaces[lastAdded].after = existingComment + content;
+ }
+ } else {
+ spaceBefore = spaceBefore + content;
+ commentBefore = commentBefore + content;
+ }
+
+ break;
+
+ case tokens.asterisk:
+ if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
+ node.operator = content;
+ lastAdded = 'operator';
+ } else if ((!node.namespace || lastAdded === "namespace" && !spaceAfterMeaningfulToken) && next) {
+ if (spaceBefore) {
+ (0, _util.ensureObject)(node, 'spaces', 'attribute');
+ node.spaces.attribute.before = spaceBefore;
+ spaceBefore = '';
+ }
+
+ if (commentBefore) {
+ (0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute');
+ node.raws.spaces.attribute.before = spaceBefore;
+ commentBefore = '';
+ }
+
+ node.namespace = (node.namespace || "") + content;
+ var rawValue = (0, _util.getProp)(node, 'raws', 'namespace') || null;
+
+ if (rawValue) {
+ node.raws.namespace += content;
+ }
+
+ lastAdded = 'namespace';
+ }
+
+ spaceAfterMeaningfulToken = false;
+ break;
+
+ case tokens.dollar:
+ if (lastAdded === "value") {
+ var oldRawValue = (0, _util.getProp)(node, 'raws', 'value');
+ node.value += "$";
+
+ if (oldRawValue) {
+ node.raws.value = oldRawValue + "$";
+ }
+
+ break;
+ }
+
+ // Falls through
+
+ case tokens.caret:
+ if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
+ node.operator = content;
+ lastAdded = 'operator';
+ }
+
+ spaceAfterMeaningfulToken = false;
+ break;
+
+ case tokens.combinator:
+ if (content === '~' && next[_tokenize.FIELDS.TYPE] === tokens.equals) {
+ node.operator = content;
+ lastAdded = 'operator';
+ }
+
+ if (content !== '|') {
+ spaceAfterMeaningfulToken = false;
+ break;
+ }
+
+ if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
+ node.operator = content;
+ lastAdded = 'operator';
+ } else if (!node.namespace && !node.attribute) {
+ node.namespace = true;
+ }
+
+ spaceAfterMeaningfulToken = false;
+ break;
+
+ case tokens.word:
+ if (next && this.content(next) === '|' && attr[pos + 2] && attr[pos + 2][_tokenize.FIELDS.TYPE] !== tokens.equals && // this look-ahead probably fails with comment nodes involved.
+ !node.operator && !node.namespace) {
+ node.namespace = content;
+ lastAdded = 'namespace';
+ } else if (!node.attribute || lastAdded === "attribute" && !spaceAfterMeaningfulToken) {
+ if (spaceBefore) {
+ (0, _util.ensureObject)(node, 'spaces', 'attribute');
+ node.spaces.attribute.before = spaceBefore;
+ spaceBefore = '';
+ }
+
+ if (commentBefore) {
+ (0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute');
+ node.raws.spaces.attribute.before = commentBefore;
+ commentBefore = '';
+ }
+
+ node.attribute = (node.attribute || "") + content;
+
+ var _rawValue = (0, _util.getProp)(node, 'raws', 'attribute') || null;
+
+ if (_rawValue) {
+ node.raws.attribute += content;
+ }
+
+ lastAdded = 'attribute';
+ } else if (!node.value && node.value !== "" || lastAdded === "value" && !(spaceAfterMeaningfulToken || node.quoteMark)) {
+ var _unescaped = (0, _util.unesc)(content);
+
+ var _oldRawValue = (0, _util.getProp)(node, 'raws', 'value') || '';
+
+ var oldValue = node.value || '';
+ node.value = oldValue + _unescaped;
+ node.quoteMark = null;
+
+ if (_unescaped !== content || _oldRawValue) {
+ (0, _util.ensureObject)(node, 'raws');
+ node.raws.value = (_oldRawValue || oldValue) + content;
+ }
+
+ lastAdded = 'value';
+ } else {
+ var insensitive = content === 'i' || content === "I";
+
+ if ((node.value || node.value === '') && (node.quoteMark || spaceAfterMeaningfulToken)) {
+ node.insensitive = insensitive;
+
+ if (!insensitive || content === "I") {
+ (0, _util.ensureObject)(node, 'raws');
+ node.raws.insensitiveFlag = content;
+ }
+
+ lastAdded = 'insensitive';
+
+ if (spaceBefore) {
+ (0, _util.ensureObject)(node, 'spaces', 'insensitive');
+ node.spaces.insensitive.before = spaceBefore;
+ spaceBefore = '';
+ }
+
+ if (commentBefore) {
+ (0, _util.ensureObject)(node, 'raws', 'spaces', 'insensitive');
+ node.raws.spaces.insensitive.before = commentBefore;
+ commentBefore = '';
+ }
+ } else if (node.value || node.value === '') {
+ lastAdded = 'value';
+ node.value += content;
+
+ if (node.raws.value) {
+ node.raws.value += content;
+ }
+ }
+ }
+
+ spaceAfterMeaningfulToken = false;
+ break;
+
+ case tokens.str:
+ if (!node.attribute || !node.operator) {
+ return this.error("Expected an attribute followed by an operator preceding the string.", {
+ index: token[_tokenize.FIELDS.START_POS]
+ });
+ }
+
+ var _unescapeValue = (0, _attribute.unescapeValue)(content),
+ unescaped = _unescapeValue.unescaped,
+ quoteMark = _unescapeValue.quoteMark;
+
+ node.value = unescaped;
+ node.quoteMark = quoteMark;
+ lastAdded = 'value';
+ (0, _util.ensureObject)(node, 'raws');
+ node.raws.value = content;
+ spaceAfterMeaningfulToken = false;
+ break;
+
+ case tokens.equals:
+ if (!node.attribute) {
+ return this.expected('attribute', token[_tokenize.FIELDS.START_POS], content);
+ }
+
+ if (node.value) {
+ return this.error('Unexpected "=" found; an operator was already defined.', {
+ index: token[_tokenize.FIELDS.START_POS]
+ });
+ }
+
+ node.operator = node.operator ? node.operator + content : content;
+ lastAdded = 'operator';
+ spaceAfterMeaningfulToken = false;
+ break;
+
+ case tokens.comment:
+ if (lastAdded) {
+ if (spaceAfterMeaningfulToken || next && next[_tokenize.FIELDS.TYPE] === tokens.space || lastAdded === 'insensitive') {
+ var lastComment = (0, _util.getProp)(node, 'spaces', lastAdded, 'after') || '';
+ var rawLastComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || lastComment;
+ (0, _util.ensureObject)(node, 'raws', 'spaces', lastAdded);
+ node.raws.spaces[lastAdded].after = rawLastComment + content;
+ } else {
+ var lastValue = node[lastAdded] || '';
+ var rawLastValue = (0, _util.getProp)(node, 'raws', lastAdded) || lastValue;
+ (0, _util.ensureObject)(node, 'raws');
+ node.raws[lastAdded] = rawLastValue + content;
+ }
+ } else {
+ commentBefore = commentBefore + content;
+ }
+
+ break;
+
+ default:
+ return this.error("Unexpected \"" + content + "\" found.", {
+ index: token[_tokenize.FIELDS.START_POS]
+ });
+ }
+
+ pos++;
+ }
+
+ unescapeProp(node, "attribute");
+ unescapeProp(node, "namespace");
+ this.newNode(new _attribute["default"](node));
+ this.position++;
+ }
+ /**
+ * return a node containing meaningless garbage up to (but not including) the specified token position.
+ * if the token position is negative, all remaining tokens are consumed.
+ *
+ * This returns an array containing a single string node if all whitespace,
+ * otherwise an array of comment nodes with space before and after.
+ *
+ * These tokens are not added to the current selector, the caller can add them or use them to amend
+ * a previous node's space metadata.
+ *
+ * In lossy mode, this returns only comments.
+ */
+ ;
+
+ _proto.parseWhitespaceEquivalentTokens = function parseWhitespaceEquivalentTokens(stopPosition) {
+ if (stopPosition < 0) {
+ stopPosition = this.tokens.length;
+ }
+
+ var startPosition = this.position;
+ var nodes = [];
+ var space = "";
+ var lastComment = undefined;
+
+ do {
+ if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {
+ if (!this.options.lossy) {
+ space += this.content();
+ }
+ } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.comment) {
+ var spaces = {};
+
+ if (space) {
+ spaces.before = space;
+ space = "";
+ }
+
+ lastComment = new _comment["default"]({
+ value: this.content(),
+ source: getTokenSource(this.currToken),
+ sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
+ spaces: spaces
+ });
+ nodes.push(lastComment);
+ }
+ } while (++this.position < stopPosition);
+
+ if (space) {
+ if (lastComment) {
+ lastComment.spaces.after = space;
+ } else if (!this.options.lossy) {
+ var firstToken = this.tokens[startPosition];
+ var lastToken = this.tokens[this.position - 1];
+ nodes.push(new _string["default"]({
+ value: '',
+ source: getSource(firstToken[_tokenize.FIELDS.START_LINE], firstToken[_tokenize.FIELDS.START_COL], lastToken[_tokenize.FIELDS.END_LINE], lastToken[_tokenize.FIELDS.END_COL]),
+ sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
+ spaces: {
+ before: space,
+ after: ''
+ }
+ }));
+ }
+ }
+
+ return nodes;
+ }
+ /**
+ *
+ * @param {*} nodes
+ */
+ ;
+
+ _proto.convertWhitespaceNodesToSpace = function convertWhitespaceNodesToSpace(nodes, requiredSpace) {
+ var _this2 = this;
+
+ if (requiredSpace === void 0) {
+ requiredSpace = false;
+ }
+
+ var space = "";
+ var rawSpace = "";
+ nodes.forEach(function (n) {
+ var spaceBefore = _this2.lossySpace(n.spaces.before, requiredSpace);
+
+ var rawSpaceBefore = _this2.lossySpace(n.rawSpaceBefore, requiredSpace);
+
+ space += spaceBefore + _this2.lossySpace(n.spaces.after, requiredSpace && spaceBefore.length === 0);
+ rawSpace += spaceBefore + n.value + _this2.lossySpace(n.rawSpaceAfter, requiredSpace && rawSpaceBefore.length === 0);
+ });
+
+ if (rawSpace === space) {
+ rawSpace = undefined;
+ }
+
+ var result = {
+ space: space,
+ rawSpace: rawSpace
+ };
+ return result;
+ };
+
+ _proto.isNamedCombinator = function isNamedCombinator(position) {
+ if (position === void 0) {
+ position = this.position;
+ }
+
+ return this.tokens[position + 0] && this.tokens[position + 0][_tokenize.FIELDS.TYPE] === tokens.slash && this.tokens[position + 1] && this.tokens[position + 1][_tokenize.FIELDS.TYPE] === tokens.word && this.tokens[position + 2] && this.tokens[position + 2][_tokenize.FIELDS.TYPE] === tokens.slash;
+ };
+
+ _proto.namedCombinator = function namedCombinator() {
+ if (this.isNamedCombinator()) {
+ var nameRaw = this.content(this.tokens[this.position + 1]);
+ var name = (0, _util.unesc)(nameRaw).toLowerCase();
+ var raws = {};
+
+ if (name !== nameRaw) {
+ raws.value = "/" + nameRaw + "/";
+ }
+
+ var node = new _combinator["default"]({
+ value: "/" + name + "/",
+ source: getSource(this.currToken[_tokenize.FIELDS.START_LINE], this.currToken[_tokenize.FIELDS.START_COL], this.tokens[this.position + 2][_tokenize.FIELDS.END_LINE], this.tokens[this.position + 2][_tokenize.FIELDS.END_COL]),
+ sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
+ raws: raws
+ });
+ this.position = this.position + 3;
+ return node;
+ } else {
+ this.unexpected();
+ }
+ };
+
+ _proto.combinator = function combinator() {
+ var _this3 = this;
+
+ if (this.content() === '|') {
+ return this.namespace();
+ } // We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector.
+
+
+ var nextSigTokenPos = this.locateNextMeaningfulToken(this.position);
+
+ if (nextSigTokenPos < 0 || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.comma) {
+ var nodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
+
+ if (nodes.length > 0) {
+ var last = this.current.last;
+
+ if (last) {
+ var _this$convertWhitespa = this.convertWhitespaceNodesToSpace(nodes),
+ space = _this$convertWhitespa.space,
+ rawSpace = _this$convertWhitespa.rawSpace;
+
+ if (rawSpace !== undefined) {
+ last.rawSpaceAfter += rawSpace;
+ }
+
+ last.spaces.after += space;
+ } else {
+ nodes.forEach(function (n) {
+ return _this3.newNode(n);
+ });
+ }
+ }
+
+ return;
+ }
+
+ var firstToken = this.currToken;
+ var spaceOrDescendantSelectorNodes = undefined;
+
+ if (nextSigTokenPos > this.position) {
+ spaceOrDescendantSelectorNodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
+ }
+
+ var node;
+
+ if (this.isNamedCombinator()) {
+ node = this.namedCombinator();
+ } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.combinator) {
+ node = new _combinator["default"]({
+ value: this.content(),
+ source: getTokenSource(this.currToken),
+ sourceIndex: this.currToken[_tokenize.FIELDS.START_POS]
+ });
+ this.position++;
+ } else if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) ; else if (!spaceOrDescendantSelectorNodes) {
+ this.unexpected();
+ }
+
+ if (node) {
+ if (spaceOrDescendantSelectorNodes) {
+ var _this$convertWhitespa2 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes),
+ _space = _this$convertWhitespa2.space,
+ _rawSpace = _this$convertWhitespa2.rawSpace;
+
+ node.spaces.before = _space;
+ node.rawSpaceBefore = _rawSpace;
+ }
+ } else {
+ // descendant combinator
+ var _this$convertWhitespa3 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes, true),
+ _space2 = _this$convertWhitespa3.space,
+ _rawSpace2 = _this$convertWhitespa3.rawSpace;
+
+ if (!_rawSpace2) {
+ _rawSpace2 = _space2;
+ }
+
+ var spaces = {};
+ var raws = {
+ spaces: {}
+ };
+
+ if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) {
+ spaces.before = _space2.slice(0, _space2.length - 1);
+ raws.spaces.before = _rawSpace2.slice(0, _rawSpace2.length - 1);
+ } else if (_space2.startsWith(' ') && _rawSpace2.startsWith(' ')) {
+ spaces.after = _space2.slice(1);
+ raws.spaces.after = _rawSpace2.slice(1);
+ } else {
+ raws.value = _rawSpace2;
+ }
+
+ node = new _combinator["default"]({
+ value: ' ',
+ source: getTokenSourceSpan(firstToken, this.tokens[this.position - 1]),
+ sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
+ spaces: spaces,
+ raws: raws
+ });
+ }
+
+ if (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.space) {
+ node.spaces.after = this.optionalSpace(this.content());
+ this.position++;
+ }
+
+ return this.newNode(node);
+ };
+
+ _proto.comma = function comma() {
+ if (this.position === this.tokens.length - 1) {
+ this.root.trailingComma = true;
+ this.position++;
+ return;
+ }
+
+ this.current._inferEndPosition();
+
+ var selector = new _selector["default"]({
+ source: {
+ start: tokenStart(this.tokens[this.position + 1])
+ }
+ });
+ this.current.parent.append(selector);
+ this.current = selector;
+ this.position++;
+ };
+
+ _proto.comment = function comment() {
+ var current = this.currToken;
+ this.newNode(new _comment["default"]({
+ value: this.content(),
+ source: getTokenSource(current),
+ sourceIndex: current[_tokenize.FIELDS.START_POS]
+ }));
+ this.position++;
+ };
+
+ _proto.error = function error(message, opts) {
+ throw this.root.error(message, opts);
+ };
+
+ _proto.missingBackslash = function missingBackslash() {
+ return this.error('Expected a backslash preceding the semicolon.', {
+ index: this.currToken[_tokenize.FIELDS.START_POS]
+ });
+ };
+
+ _proto.missingParenthesis = function missingParenthesis() {
+ return this.expected('opening parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
+ };
+
+ _proto.missingSquareBracket = function missingSquareBracket() {
+ return this.expected('opening square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
+ };
+
+ _proto.unexpected = function unexpected() {
+ return this.error("Unexpected '" + this.content() + "'. Escaping special characters with \\ may help.", this.currToken[_tokenize.FIELDS.START_POS]);
+ };
+
+ _proto.namespace = function namespace() {
+ var before = this.prevToken && this.content(this.prevToken) || true;
+
+ if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) {
+ this.position++;
+ return this.word(before);
+ } else if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.asterisk) {
+ this.position++;
+ return this.universal(before);
+ }
+ };
+
+ _proto.nesting = function nesting() {
+ if (this.nextToken) {
+ var nextContent = this.content(this.nextToken);
+
+ if (nextContent === "|") {
+ this.position++;
+ return;
+ }
+ }
+
+ var current = this.currToken;
+ this.newNode(new _nesting["default"]({
+ value: this.content(),
+ source: getTokenSource(current),
+ sourceIndex: current[_tokenize.FIELDS.START_POS]
+ }));
+ this.position++;
+ };
+
+ _proto.parentheses = function parentheses() {
+ var last = this.current.last;
+ var unbalanced = 1;
+ this.position++;
+
+ if (last && last.type === types$1.PSEUDO) {
+ var selector = new _selector["default"]({
+ source: {
+ start: tokenStart(this.tokens[this.position - 1])
+ }
+ });
+ var cache = this.current;
+ last.append(selector);
+ this.current = selector;
+
+ while (this.position < this.tokens.length && unbalanced) {
+ if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
+ unbalanced++;
+ }
+
+ if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
+ unbalanced--;
+ }
+
+ if (unbalanced) {
+ this.parse();
+ } else {
+ this.current.source.end = tokenEnd(this.currToken);
+ this.current.parent.source.end = tokenEnd(this.currToken);
+ this.position++;
+ }
+ }
+
+ this.current = cache;
+ } else {
+ // I think this case should be an error. It's used to implement a basic parse of media queries
+ // but I don't think it's a good idea.
+ var parenStart = this.currToken;
+ var parenValue = "(";
+ var parenEnd;
+
+ while (this.position < this.tokens.length && unbalanced) {
+ if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
+ unbalanced++;
+ }
+
+ if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
+ unbalanced--;
+ }
+
+ parenEnd = this.currToken;
+ parenValue += this.parseParenthesisToken(this.currToken);
+ this.position++;
+ }
+
+ if (last) {
+ last.appendToPropertyAndEscape("value", parenValue, parenValue);
+ } else {
+ this.newNode(new _string["default"]({
+ value: parenValue,
+ source: getSource(parenStart[_tokenize.FIELDS.START_LINE], parenStart[_tokenize.FIELDS.START_COL], parenEnd[_tokenize.FIELDS.END_LINE], parenEnd[_tokenize.FIELDS.END_COL]),
+ sourceIndex: parenStart[_tokenize.FIELDS.START_POS]
+ }));
+ }
+ }
+
+ if (unbalanced) {
+ return this.expected('closing parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
+ }
+ };
+
+ _proto.pseudo = function pseudo() {
+ var _this4 = this;
+
+ var pseudoStr = '';
+ var startingToken = this.currToken;
+
+ while (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.colon) {
+ pseudoStr += this.content();
+ this.position++;
+ }
+
+ if (!this.currToken) {
+ return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1);
+ }
+
+ if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.word) {
+ this.splitWord(false, function (first, length) {
+ pseudoStr += first;
+
+ _this4.newNode(new _pseudo["default"]({
+ value: pseudoStr,
+ source: getTokenSourceSpan(startingToken, _this4.currToken),
+ sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
+ }));
+
+ if (length > 1 && _this4.nextToken && _this4.nextToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
+ _this4.error('Misplaced parenthesis.', {
+ index: _this4.nextToken[_tokenize.FIELDS.START_POS]
+ });
+ }
+ });
+ } else {
+ return this.expected(['pseudo-class', 'pseudo-element'], this.currToken[_tokenize.FIELDS.START_POS]);
+ }
+ };
+
+ _proto.space = function space() {
+ var content = this.content(); // Handle space before and after the selector
+
+ if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) {
+ return node.type === 'comment';
+ })) {
+ this.spaces = this.optionalSpace(content);
+ this.position++;
+ } else if (this.position === this.tokens.length - 1 || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
+ this.current.last.spaces.after = this.optionalSpace(content);
+ this.position++;
+ } else {
+ this.combinator();
+ }
+ };
+
+ _proto.string = function string() {
+ var current = this.currToken;
+ this.newNode(new _string["default"]({
+ value: this.content(),
+ source: getTokenSource(current),
+ sourceIndex: current[_tokenize.FIELDS.START_POS]
+ }));
+ this.position++;
+ };
+
+ _proto.universal = function universal(namespace) {
+ var nextToken = this.nextToken;
+
+ if (nextToken && this.content(nextToken) === '|') {
+ this.position++;
+ return this.namespace();
+ }
+
+ var current = this.currToken;
+ this.newNode(new _universal["default"]({
+ value: this.content(),
+ source: getTokenSource(current),
+ sourceIndex: current[_tokenize.FIELDS.START_POS]
+ }), namespace);
+ this.position++;
+ };
+
+ _proto.splitWord = function splitWord(namespace, firstCallback) {
+ var _this5 = this;
+
+ var nextToken = this.nextToken;
+ var word = this.content();
+
+ while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[_tokenize.FIELDS.TYPE])) {
+ this.position++;
+ var current = this.content();
+ word += current;
+
+ if (current.lastIndexOf('\\') === current.length - 1) {
+ var next = this.nextToken;
+
+ if (next && next[_tokenize.FIELDS.TYPE] === tokens.space) {
+ word += this.requiredSpace(this.content(next));
+ this.position++;
+ }
+ }
+
+ nextToken = this.nextToken;
+ }
+
+ var hasClass = indexesOf(word, '.').filter(function (i) {
+ // Allow escaped dot within class name
+ var escapedDot = word[i - 1] === '\\'; // Allow decimal numbers percent in @keyframes
+
+ var isKeyframesPercent = /^\d+\.\d+%$/.test(word);
+ return !escapedDot && !isKeyframesPercent;
+ });
+ var hasId = indexesOf(word, '#').filter(function (i) {
+ return word[i - 1] !== '\\';
+ }); // Eliminate Sass interpolations from the list of id indexes
+
+ var interpolations = indexesOf(word, '#{');
+
+ if (interpolations.length) {
+ hasId = hasId.filter(function (hashIndex) {
+ return !~interpolations.indexOf(hashIndex);
+ });
+ }
+
+ var indices = (0, _sortAscending["default"])(uniqs([0].concat(hasClass, hasId)));
+ indices.forEach(function (ind, i) {
+ var index = indices[i + 1] || word.length;
+ var value = word.slice(ind, index);
+
+ if (i === 0 && firstCallback) {
+ return firstCallback.call(_this5, value, indices.length);
+ }
+
+ var node;
+ var current = _this5.currToken;
+ var sourceIndex = current[_tokenize.FIELDS.START_POS] + indices[i];
+ var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));
+
+ if (~hasClass.indexOf(ind)) {
+ var classNameOpts = {
+ value: value.slice(1),
+ source: source,
+ sourceIndex: sourceIndex
+ };
+ node = new _className["default"](unescapeProp(classNameOpts, "value"));
+ } else if (~hasId.indexOf(ind)) {
+ var idOpts = {
+ value: value.slice(1),
+ source: source,
+ sourceIndex: sourceIndex
+ };
+ node = new _id["default"](unescapeProp(idOpts, "value"));
+ } else {
+ var tagOpts = {
+ value: value,
+ source: source,
+ sourceIndex: sourceIndex
+ };
+ unescapeProp(tagOpts, "value");
+ node = new _tag["default"](tagOpts);
+ }
+
+ _this5.newNode(node, namespace); // Ensure that the namespace is used only once
+
+
+ namespace = null;
+ });
+ this.position++;
+ };
+
+ _proto.word = function word(namespace) {
+ var nextToken = this.nextToken;
+
+ if (nextToken && this.content(nextToken) === '|') {
+ this.position++;
+ return this.namespace();
+ }
+
+ return this.splitWord(namespace);
+ };
+
+ _proto.loop = function loop() {
+ while (this.position < this.tokens.length) {
+ this.parse(true);
+ }
+
+ this.current._inferEndPosition();
+
+ return this.root;
+ };
+
+ _proto.parse = function parse(throwOnParenthesis) {
+ switch (this.currToken[_tokenize.FIELDS.TYPE]) {
+ case tokens.space:
+ this.space();
+ break;
+
+ case tokens.comment:
+ this.comment();
+ break;
+
+ case tokens.openParenthesis:
+ this.parentheses();
+ break;
+
+ case tokens.closeParenthesis:
+ if (throwOnParenthesis) {
+ this.missingParenthesis();
+ }
+
+ break;
+
+ case tokens.openSquare:
+ this.attribute();
+ break;
+
+ case tokens.dollar:
+ case tokens.caret:
+ case tokens.equals:
+ case tokens.word:
+ this.word();
+ break;
+
+ case tokens.colon:
+ this.pseudo();
+ break;
+
+ case tokens.comma:
+ this.comma();
+ break;
+
+ case tokens.asterisk:
+ this.universal();
+ break;
+
+ case tokens.ampersand:
+ this.nesting();
+ break;
+
+ case tokens.slash:
+ case tokens.combinator:
+ this.combinator();
+ break;
+
+ case tokens.str:
+ this.string();
+ break;
+ // These cases throw; no break needed.
+
+ case tokens.closeSquare:
+ this.missingSquareBracket();
+
+ case tokens.semicolon:
+ this.missingBackslash();
+
+ default:
+ this.unexpected();
+ }
+ }
+ /**
+ * Helpers
+ */
+ ;
+
+ _proto.expected = function expected(description, index, found) {
+ if (Array.isArray(description)) {
+ var last = description.pop();
+ description = description.join(', ') + " or " + last;
+ }
+
+ var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a';
+
+ if (!found) {
+ return this.error("Expected " + an + " " + description + ".", {
+ index: index
+ });
+ }
+
+ return this.error("Expected " + an + " " + description + ", found \"" + found + "\" instead.", {
+ index: index
+ });
+ };
+
+ _proto.requiredSpace = function requiredSpace(space) {
+ return this.options.lossy ? ' ' : space;
+ };
+
+ _proto.optionalSpace = function optionalSpace(space) {
+ return this.options.lossy ? '' : space;
+ };
+
+ _proto.lossySpace = function lossySpace(space, required) {
+ if (this.options.lossy) {
+ return required ? ' ' : '';
+ } else {
+ return space;
+ }
+ };
+
+ _proto.parseParenthesisToken = function parseParenthesisToken(token) {
+ var content = this.content(token);
+
+ if (token[_tokenize.FIELDS.TYPE] === tokens.space) {
+ return this.requiredSpace(content);
+ } else {
+ return content;
+ }
+ };
+
+ _proto.newNode = function newNode(node, namespace) {
+ if (namespace) {
+ if (/^ +$/.test(namespace)) {
+ if (!this.options.lossy) {
+ this.spaces = (this.spaces || '') + namespace;
+ }
+
+ namespace = true;
+ }
+
+ node.namespace = namespace;
+ unescapeProp(node, "namespace");
+ }
+
+ if (this.spaces) {
+ node.spaces.before = this.spaces;
+ this.spaces = '';
+ }
+
+ return this.current.append(node);
+ };
+
+ _proto.content = function content(token) {
+ if (token === void 0) {
+ token = this.currToken;
+ }
+
+ return this.css.slice(token[_tokenize.FIELDS.START_POS], token[_tokenize.FIELDS.END_POS]);
+ };
+
+ /**
+ * returns the index of the next non-whitespace, non-comment token.
+ * returns -1 if no meaningful token is found.
+ */
+ _proto.locateNextMeaningfulToken = function locateNextMeaningfulToken(startPosition) {
+ if (startPosition === void 0) {
+ startPosition = this.position + 1;
+ }
+
+ var searchPosition = startPosition;
+
+ while (searchPosition < this.tokens.length) {
+ if (WHITESPACE_EQUIV_TOKENS[this.tokens[searchPosition][_tokenize.FIELDS.TYPE]]) {
+ searchPosition++;
+ continue;
+ } else {
+ return searchPosition;
+ }
+ }
+
+ return -1;
+ };
+
+ _createClass(Parser, [{
+ key: "currToken",
+ get: function get() {
+ return this.tokens[this.position];
+ }
+ }, {
+ key: "nextToken",
+ get: function get() {
+ return this.tokens[this.position + 1];
+ }
+ }, {
+ key: "prevToken",
+ get: function get() {
+ return this.tokens[this.position - 1];
+ }
+ }]);
+
+ return Parser;
+ }();
+
+ exports["default"] = Parser;
+ module.exports = exports.default;
+} (parser, parser.exports));
+
+var parserExports = parser.exports;
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _parser = _interopRequireDefault(parserExports);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var Processor = /*#__PURE__*/function () {
+ function Processor(func, options) {
+ this.func = func || function noop() {};
+
+ this.funcRes = null;
+ this.options = options;
+ }
+
+ var _proto = Processor.prototype;
+
+ _proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) {
+ if (options === void 0) {
+ options = {};
+ }
+
+ var merged = Object.assign({}, this.options, options);
+
+ if (merged.updateSelector === false) {
+ return false;
+ } else {
+ return typeof rule !== "string";
+ }
+ };
+
+ _proto._isLossy = function _isLossy(options) {
+ if (options === void 0) {
+ options = {};
+ }
+
+ var merged = Object.assign({}, this.options, options);
+
+ if (merged.lossless === false) {
+ return true;
+ } else {
+ return false;
+ }
+ };
+
+ _proto._root = function _root(rule, options) {
+ if (options === void 0) {
+ options = {};
+ }
+
+ var parser = new _parser["default"](rule, this._parseOptions(options));
+ return parser.root;
+ };
+
+ _proto._parseOptions = function _parseOptions(options) {
+ return {
+ lossy: this._isLossy(options)
+ };
+ };
+
+ _proto._run = function _run(rule, options) {
+ var _this = this;
+
+ if (options === void 0) {
+ options = {};
+ }
+
+ return new Promise(function (resolve, reject) {
+ try {
+ var root = _this._root(rule, options);
+
+ Promise.resolve(_this.func(root)).then(function (transform) {
+ var string = undefined;
+
+ if (_this._shouldUpdateSelector(rule, options)) {
+ string = root.toString();
+ rule.selector = string;
+ }
+
+ return {
+ transform: transform,
+ root: root,
+ string: string
+ };
+ }).then(resolve, reject);
+ } catch (e) {
+ reject(e);
+ return;
+ }
+ });
+ };
+
+ _proto._runSync = function _runSync(rule, options) {
+ if (options === void 0) {
+ options = {};
+ }
+
+ var root = this._root(rule, options);
+
+ var transform = this.func(root);
+
+ if (transform && typeof transform.then === "function") {
+ throw new Error("Selector processor returned a promise to a synchronous call.");
+ }
+
+ var string = undefined;
+
+ if (options.updateSelector && typeof rule !== "string") {
+ string = root.toString();
+ rule.selector = string;
+ }
+
+ return {
+ transform: transform,
+ root: root,
+ string: string
+ };
+ }
+ /**
+ * Process rule into a selector AST.
+ *
+ * @param rule {postcss.Rule | string} The css selector to be processed
+ * @param options The options for processing
+ * @returns {Promise} The AST of the selector after processing it.
+ */
+ ;
+
+ _proto.ast = function ast(rule, options) {
+ return this._run(rule, options).then(function (result) {
+ return result.root;
+ });
+ }
+ /**
+ * Process rule into a selector AST synchronously.
+ *
+ * @param rule {postcss.Rule | string} The css selector to be processed
+ * @param options The options for processing
+ * @returns {parser.Root} The AST of the selector after processing it.
+ */
+ ;
+
+ _proto.astSync = function astSync(rule, options) {
+ return this._runSync(rule, options).root;
+ }
+ /**
+ * Process a selector into a transformed value asynchronously
+ *
+ * @param rule {postcss.Rule | string} The css selector to be processed
+ * @param options The options for processing
+ * @returns {Promise} The value returned by the processor.
+ */
+ ;
+
+ _proto.transform = function transform(rule, options) {
+ return this._run(rule, options).then(function (result) {
+ return result.transform;
+ });
+ }
+ /**
+ * Process a selector into a transformed value synchronously.
+ *
+ * @param rule {postcss.Rule | string} The css selector to be processed
+ * @param options The options for processing
+ * @returns {any} The value returned by the processor.
+ */
+ ;
+
+ _proto.transformSync = function transformSync(rule, options) {
+ return this._runSync(rule, options).transform;
+ }
+ /**
+ * Process a selector into a new selector string asynchronously.
+ *
+ * @param rule {postcss.Rule | string} The css selector to be processed
+ * @param options The options for processing
+ * @returns {string} the selector after processing.
+ */
+ ;
+
+ _proto.process = function process(rule, options) {
+ return this._run(rule, options).then(function (result) {
+ return result.string || result.root.toString();
+ });
+ }
+ /**
+ * Process a selector into a new selector string synchronously.
+ *
+ * @param rule {postcss.Rule | string} The css selector to be processed
+ * @param options The options for processing
+ * @returns {string} the selector after processing.
+ */
+ ;
+
+ _proto.processSync = function processSync(rule, options) {
+ var result = this._runSync(rule, options);
+
+ return result.string || result.root.toString();
+ };
+
+ return Processor;
+ }();
+
+ exports["default"] = Processor;
+ module.exports = exports.default;
+} (processor, processor.exports));
+
+var processorExports = processor.exports;
+
+var selectors = {};
+
+var constructors = {};
+
+constructors.__esModule = true;
+constructors.universal = constructors.tag = constructors.string = constructors.selector = constructors.root = constructors.pseudo = constructors.nesting = constructors.id = constructors.comment = constructors.combinator = constructors.className = constructors.attribute = void 0;
+
+var _attribute = _interopRequireDefault$2(attribute$1);
+
+var _className = _interopRequireDefault$2(classNameExports);
+
+var _combinator = _interopRequireDefault$2(combinatorExports);
+
+var _comment = _interopRequireDefault$2(commentExports);
+
+var _id = _interopRequireDefault$2(idExports);
+
+var _nesting = _interopRequireDefault$2(nestingExports);
+
+var _pseudo = _interopRequireDefault$2(pseudoExports);
+
+var _root = _interopRequireDefault$2(rootExports);
+
+var _selector = _interopRequireDefault$2(selectorExports);
+
+var _string = _interopRequireDefault$2(stringExports);
+
+var _tag = _interopRequireDefault$2(tagExports);
+
+var _universal = _interopRequireDefault$2(universalExports);
+
+function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+var attribute = function attribute(opts) {
+ return new _attribute["default"](opts);
+};
+
+constructors.attribute = attribute;
+
+var className = function className(opts) {
+ return new _className["default"](opts);
+};
+
+constructors.className = className;
+
+var combinator = function combinator(opts) {
+ return new _combinator["default"](opts);
+};
+
+constructors.combinator = combinator;
+
+var comment = function comment(opts) {
+ return new _comment["default"](opts);
+};
+
+constructors.comment = comment;
+
+var id = function id(opts) {
+ return new _id["default"](opts);
+};
+
+constructors.id = id;
+
+var nesting = function nesting(opts) {
+ return new _nesting["default"](opts);
+};
+
+constructors.nesting = nesting;
+
+var pseudo = function pseudo(opts) {
+ return new _pseudo["default"](opts);
+};
+
+constructors.pseudo = pseudo;
+
+var root = function root(opts) {
+ return new _root["default"](opts);
+};
+
+constructors.root = root;
+
+var selector = function selector(opts) {
+ return new _selector["default"](opts);
+};
+
+constructors.selector = selector;
+
+var string = function string(opts) {
+ return new _string["default"](opts);
+};
+
+constructors.string = string;
+
+var tag = function tag(opts) {
+ return new _tag["default"](opts);
+};
+
+constructors.tag = tag;
+
+var universal = function universal(opts) {
+ return new _universal["default"](opts);
+};
+
+constructors.universal = universal;
+
+var guards = {};
+
+guards.__esModule = true;
+guards.isNode = isNode;
+guards.isPseudoElement = isPseudoElement;
+guards.isPseudoClass = isPseudoClass;
+guards.isContainer = isContainer;
+guards.isNamespace = isNamespace;
+guards.isUniversal = guards.isTag = guards.isString = guards.isSelector = guards.isRoot = guards.isPseudo = guards.isNesting = guards.isIdentifier = guards.isComment = guards.isCombinator = guards.isClassName = guards.isAttribute = void 0;
+
+var _types = types;
+
+var _IS_TYPE;
+
+var IS_TYPE = (_IS_TYPE = {}, _IS_TYPE[_types.ATTRIBUTE] = true, _IS_TYPE[_types.CLASS] = true, _IS_TYPE[_types.COMBINATOR] = true, _IS_TYPE[_types.COMMENT] = true, _IS_TYPE[_types.ID] = true, _IS_TYPE[_types.NESTING] = true, _IS_TYPE[_types.PSEUDO] = true, _IS_TYPE[_types.ROOT] = true, _IS_TYPE[_types.SELECTOR] = true, _IS_TYPE[_types.STRING] = true, _IS_TYPE[_types.TAG] = true, _IS_TYPE[_types.UNIVERSAL] = true, _IS_TYPE);
+
+function isNode(node) {
+ return typeof node === "object" && IS_TYPE[node.type];
+}
+
+function isNodeType(type, node) {
+ return isNode(node) && node.type === type;
+}
+
+var isAttribute = isNodeType.bind(null, _types.ATTRIBUTE);
+guards.isAttribute = isAttribute;
+var isClassName = isNodeType.bind(null, _types.CLASS);
+guards.isClassName = isClassName;
+var isCombinator = isNodeType.bind(null, _types.COMBINATOR);
+guards.isCombinator = isCombinator;
+var isComment = isNodeType.bind(null, _types.COMMENT);
+guards.isComment = isComment;
+var isIdentifier = isNodeType.bind(null, _types.ID);
+guards.isIdentifier = isIdentifier;
+var isNesting = isNodeType.bind(null, _types.NESTING);
+guards.isNesting = isNesting;
+var isPseudo = isNodeType.bind(null, _types.PSEUDO);
+guards.isPseudo = isPseudo;
+var isRoot = isNodeType.bind(null, _types.ROOT);
+guards.isRoot = isRoot;
+var isSelector = isNodeType.bind(null, _types.SELECTOR);
+guards.isSelector = isSelector;
+var isString = isNodeType.bind(null, _types.STRING);
+guards.isString = isString;
+var isTag = isNodeType.bind(null, _types.TAG);
+guards.isTag = isTag;
+var isUniversal = isNodeType.bind(null, _types.UNIVERSAL);
+guards.isUniversal = isUniversal;
+
+function isPseudoElement(node) {
+ return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value.toLowerCase() === ":before" || node.value.toLowerCase() === ":after" || node.value.toLowerCase() === ":first-letter" || node.value.toLowerCase() === ":first-line");
+}
+
+function isPseudoClass(node) {
+ return isPseudo(node) && !isPseudoElement(node);
+}
+
+function isContainer(node) {
+ return !!(isNode(node) && node.walk);
+}
+
+function isNamespace(node) {
+ return isAttribute(node) || isTag(node);
+}
+
+(function (exports) {
+
+ exports.__esModule = true;
+
+ var _types = types;
+
+ Object.keys(_types).forEach(function (key) {
+ if (key === "default" || key === "__esModule") return;
+ if (key in exports && exports[key] === _types[key]) return;
+ exports[key] = _types[key];
+ });
+
+ var _constructors = constructors;
+
+ Object.keys(_constructors).forEach(function (key) {
+ if (key === "default" || key === "__esModule") return;
+ if (key in exports && exports[key] === _constructors[key]) return;
+ exports[key] = _constructors[key];
+ });
+
+ var _guards = guards;
+
+ Object.keys(_guards).forEach(function (key) {
+ if (key === "default" || key === "__esModule") return;
+ if (key in exports && exports[key] === _guards[key]) return;
+ exports[key] = _guards[key];
+ });
+} (selectors));
+
+(function (module, exports) {
+
+ exports.__esModule = true;
+ exports["default"] = void 0;
+
+ var _processor = _interopRequireDefault(processorExports);
+
+ var selectors$1 = _interopRequireWildcard(selectors);
+
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
+
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var parser = function parser(processor) {
+ return new _processor["default"](processor);
+ };
+
+ Object.assign(parser, selectors$1);
+ delete parser.__esModule;
+ var _default = parser;
+ exports["default"] = _default;
+ module.exports = exports.default;
+} (dist, dist.exports));
+
+var distExports = dist.exports;
+
+const selectorParser$1 = distExports;
+const valueParser = lib;
+const { extractICSS } = src$4;
+
+const isSpacing = (node) => node.type === "combinator" && node.value === " ";
+
+function normalizeNodeArray(nodes) {
+ const array = [];
+
+ nodes.forEach((x) => {
+ if (Array.isArray(x)) {
+ normalizeNodeArray(x).forEach((item) => {
+ array.push(item);
+ });
+ } else if (x) {
+ array.push(x);
+ }
+ });
+
+ if (array.length > 0 && isSpacing(array[array.length - 1])) {
+ array.pop();
+ }
+ return array;
+}
+
+function localizeNode(rule, mode, localAliasMap) {
+ const transform = (node, context) => {
+ if (context.ignoreNextSpacing && !isSpacing(node)) {
+ throw new Error("Missing whitespace after " + context.ignoreNextSpacing);
+ }
+
+ if (context.enforceNoSpacing && isSpacing(node)) {
+ throw new Error("Missing whitespace before " + context.enforceNoSpacing);
+ }
+
+ let newNodes;
+
+ switch (node.type) {
+ case "root": {
+ let resultingGlobal;
+
+ context.hasPureGlobals = false;
+
+ newNodes = node.nodes.map((n) => {
+ const nContext = {
+ global: context.global,
+ lastWasSpacing: true,
+ hasLocals: false,
+ explicit: false,
+ };
+
+ n = transform(n, nContext);
+
+ if (typeof resultingGlobal === "undefined") {
+ resultingGlobal = nContext.global;
+ } else if (resultingGlobal !== nContext.global) {
+ throw new Error(
+ 'Inconsistent rule global/local result in rule "' +
+ node +
+ '" (multiple selectors must result in the same mode for the rule)'
+ );
+ }
+
+ if (!nContext.hasLocals) {
+ context.hasPureGlobals = true;
+ }
+
+ return n;
+ });
+
+ context.global = resultingGlobal;
+
+ node.nodes = normalizeNodeArray(newNodes);
+ break;
+ }
+ case "selector": {
+ newNodes = node.map((childNode) => transform(childNode, context));
+
+ node = node.clone();
+ node.nodes = normalizeNodeArray(newNodes);
+ break;
+ }
+ case "combinator": {
+ if (isSpacing(node)) {
+ if (context.ignoreNextSpacing) {
+ context.ignoreNextSpacing = false;
+ context.lastWasSpacing = false;
+ context.enforceNoSpacing = false;
+ return null;
+ }
+ context.lastWasSpacing = true;
+ return node;
+ }
+ break;
+ }
+ case "pseudo": {
+ let childContext;
+ const isNested = !!node.length;
+ const isScoped = node.value === ":local" || node.value === ":global";
+ const isImportExport =
+ node.value === ":import" || node.value === ":export";
+
+ if (isImportExport) {
+ context.hasLocals = true;
+ // :local(.foo)
+ } else if (isNested) {
+ if (isScoped) {
+ if (node.nodes.length === 0) {
+ throw new Error(`${node.value}() can't be empty`);
+ }
+
+ if (context.inside) {
+ throw new Error(
+ `A ${node.value} is not allowed inside of a ${context.inside}(...)`
+ );
+ }
+
+ childContext = {
+ global: node.value === ":global",
+ inside: node.value,
+ hasLocals: false,
+ explicit: true,
+ };
+
+ newNodes = node
+ .map((childNode) => transform(childNode, childContext))
+ .reduce((acc, next) => acc.concat(next.nodes), []);
+
+ if (newNodes.length) {
+ const { before, after } = node.spaces;
+
+ const first = newNodes[0];
+ const last = newNodes[newNodes.length - 1];
+
+ first.spaces = { before, after: first.spaces.after };
+ last.spaces = { before: last.spaces.before, after };
+ }
+
+ node = newNodes;
+
+ break;
+ } else {
+ childContext = {
+ global: context.global,
+ inside: context.inside,
+ lastWasSpacing: true,
+ hasLocals: false,
+ explicit: context.explicit,
+ };
+ newNodes = node.map((childNode) =>
+ transform(childNode, childContext)
+ );
+
+ node = node.clone();
+ node.nodes = normalizeNodeArray(newNodes);
+
+ if (childContext.hasLocals) {
+ context.hasLocals = true;
+ }
+ }
+ break;
+
+ //:local .foo .bar
+ } else if (isScoped) {
+ if (context.inside) {
+ throw new Error(
+ `A ${node.value} is not allowed inside of a ${context.inside}(...)`
+ );
+ }
+
+ const addBackSpacing = !!node.spaces.before;
+
+ context.ignoreNextSpacing = context.lastWasSpacing
+ ? node.value
+ : false;
+
+ context.enforceNoSpacing = context.lastWasSpacing
+ ? false
+ : node.value;
+
+ context.global = node.value === ":global";
+ context.explicit = true;
+
+ // because this node has spacing that is lost when we remove it
+ // we make up for it by adding an extra combinator in since adding
+ // spacing on the parent selector doesn't work
+ return addBackSpacing
+ ? selectorParser$1.combinator({ value: " " })
+ : null;
+ }
+ break;
+ }
+ case "id":
+ case "class": {
+ if (!node.value) {
+ throw new Error("Invalid class or id selector syntax");
+ }
+
+ if (context.global) {
+ break;
+ }
+
+ const isImportedValue = localAliasMap.has(node.value);
+ const isImportedWithExplicitScope = isImportedValue && context.explicit;
+
+ if (!isImportedValue || isImportedWithExplicitScope) {
+ const innerNode = node.clone();
+ innerNode.spaces = { before: "", after: "" };
+
+ node = selectorParser$1.pseudo({
+ value: ":local",
+ nodes: [innerNode],
+ spaces: node.spaces,
+ });
+
+ context.hasLocals = true;
+ }
+
+ break;
+ }
+ }
+
+ context.lastWasSpacing = false;
+ context.ignoreNextSpacing = false;
+ context.enforceNoSpacing = false;
+
+ return node;
+ };
+
+ const rootContext = {
+ global: mode === "global",
+ hasPureGlobals: false,
+ };
+
+ rootContext.selector = selectorParser$1((root) => {
+ transform(root, rootContext);
+ }).processSync(rule, { updateSelector: false, lossless: true });
+
+ return rootContext;
+}
+
+function localizeDeclNode(node, context) {
+ switch (node.type) {
+ case "word":
+ if (context.localizeNextItem) {
+ if (!context.localAliasMap.has(node.value)) {
+ node.value = ":local(" + node.value + ")";
+ context.localizeNextItem = false;
+ }
+ }
+ break;
+
+ case "function":
+ if (
+ context.options &&
+ context.options.rewriteUrl &&
+ node.value.toLowerCase() === "url"
+ ) {
+ node.nodes.map((nestedNode) => {
+ if (nestedNode.type !== "string" && nestedNode.type !== "word") {
+ return;
+ }
+
+ let newUrl = context.options.rewriteUrl(
+ context.global,
+ nestedNode.value
+ );
+
+ switch (nestedNode.type) {
+ case "string":
+ if (nestedNode.quote === "'") {
+ newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/'/g, "\\'");
+ }
+
+ if (nestedNode.quote === '"') {
+ newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/"/g, '\\"');
+ }
+
+ break;
+ case "word":
+ newUrl = newUrl.replace(/("|'|\)|\\)/g, "\\$1");
+ break;
+ }
+
+ nestedNode.value = newUrl;
+ });
+ }
+ break;
+ }
+ return node;
+}
+
+function isWordAFunctionArgument(wordNode, functionNode) {
+ return functionNode
+ ? functionNode.nodes.some(
+ (functionNodeChild) =>
+ functionNodeChild.sourceIndex === wordNode.sourceIndex
+ )
+ : false;
+}
+
+function localizeDeclarationValues(localize, declaration, context) {
+ const valueNodes = valueParser(declaration.value);
+
+ valueNodes.walk((node, index, nodes) => {
+ const subContext = {
+ options: context.options,
+ global: context.global,
+ localizeNextItem: localize && !context.global,
+ localAliasMap: context.localAliasMap,
+ };
+ nodes[index] = localizeDeclNode(node, subContext);
+ });
+
+ declaration.value = valueNodes.toString();
+}
+
+function localizeDeclaration(declaration, context) {
+ const isAnimation = /animation$/i.test(declaration.prop);
+
+ if (isAnimation) {
+ const validIdent = /^-?[_a-z][_a-z0-9-]*$/i;
+
+ /*
+ The spec defines some keywords that you can use to describe properties such as the timing
+ function. These are still valid animation names, so as long as there is a property that accepts
+ a keyword, it is given priority. Only when all the properties that can take a keyword are
+ exhausted can the animation name be set to the keyword. I.e.
+
+ animation: infinite infinite;
+
+ The animation will repeat an infinite number of times from the first argument, and will have an
+ animation name of infinite from the second.
+ */
+ const animationKeywords = {
+ $alternate: 1,
+ "$alternate-reverse": 1,
+ $backwards: 1,
+ $both: 1,
+ $ease: 1,
+ "$ease-in": 1,
+ "$ease-in-out": 1,
+ "$ease-out": 1,
+ $forwards: 1,
+ $infinite: 1,
+ $linear: 1,
+ $none: Infinity, // No matter how many times you write none, it will never be an animation name
+ $normal: 1,
+ $paused: 1,
+ $reverse: 1,
+ $running: 1,
+ "$step-end": 1,
+ "$step-start": 1,
+ $initial: Infinity,
+ $inherit: Infinity,
+ $unset: Infinity,
+ };
+ let parsedAnimationKeywords = {};
+ let stepsFunctionNode = null;
+ const valueNodes = valueParser(declaration.value).walk((node) => {
+ /* If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. */
+ if (node.type === "div") {
+ parsedAnimationKeywords = {};
+ }
+ if (node.type === "function" && node.value.toLowerCase() === "steps") {
+ stepsFunctionNode = node;
+ }
+ const value =
+ node.type === "word" &&
+ !isWordAFunctionArgument(node, stepsFunctionNode)
+ ? node.value.toLowerCase()
+ : null;
+
+ let shouldParseAnimationName = false;
+
+ if (value && validIdent.test(value)) {
+ if ("$" + value in animationKeywords) {
+ parsedAnimationKeywords["$" + value] =
+ "$" + value in parsedAnimationKeywords
+ ? parsedAnimationKeywords["$" + value] + 1
+ : 0;
+
+ shouldParseAnimationName =
+ parsedAnimationKeywords["$" + value] >=
+ animationKeywords["$" + value];
+ } else {
+ shouldParseAnimationName = true;
+ }
+ }
+
+ const subContext = {
+ options: context.options,
+ global: context.global,
+ localizeNextItem: shouldParseAnimationName && !context.global,
+ localAliasMap: context.localAliasMap,
+ };
+ return localizeDeclNode(node, subContext);
+ });
+
+ declaration.value = valueNodes.toString();
+
+ return;
+ }
+
+ const isAnimationName = /animation(-name)?$/i.test(declaration.prop);
+
+ if (isAnimationName) {
+ return localizeDeclarationValues(true, declaration, context);
+ }
+
+ const hasUrl = /url\(/i.test(declaration.value);
+
+ if (hasUrl) {
+ return localizeDeclarationValues(false, declaration, context);
+ }
+}
+
+src$2.exports = (options = {}) => {
+ if (
+ options &&
+ options.mode &&
+ options.mode !== "global" &&
+ options.mode !== "local" &&
+ options.mode !== "pure"
+ ) {
+ throw new Error(
+ 'options.mode must be either "global", "local" or "pure" (default "local")'
+ );
+ }
+
+ const pureMode = options && options.mode === "pure";
+ const globalMode = options && options.mode === "global";
+
+ return {
+ postcssPlugin: "postcss-modules-local-by-default",
+ prepare() {
+ const localAliasMap = new Map();
+
+ return {
+ Once(root) {
+ const { icssImports } = extractICSS(root, false);
+
+ Object.keys(icssImports).forEach((key) => {
+ Object.keys(icssImports[key]).forEach((prop) => {
+ localAliasMap.set(prop, icssImports[key][prop]);
+ });
+ });
+
+ root.walkAtRules((atRule) => {
+ if (/keyframes$/i.test(atRule.name)) {
+ const globalMatch = /^\s*:global\s*\((.+)\)\s*$/.exec(
+ atRule.params
+ );
+ const localMatch = /^\s*:local\s*\((.+)\)\s*$/.exec(
+ atRule.params
+ );
+
+ let globalKeyframes = globalMode;
+
+ if (globalMatch) {
+ if (pureMode) {
+ throw atRule.error(
+ "@keyframes :global(...) is not allowed in pure mode"
+ );
+ }
+ atRule.params = globalMatch[1];
+ globalKeyframes = true;
+ } else if (localMatch) {
+ atRule.params = localMatch[0];
+ globalKeyframes = false;
+ } else if (!globalMode) {
+ if (atRule.params && !localAliasMap.has(atRule.params)) {
+ atRule.params = ":local(" + atRule.params + ")";
+ }
+ }
+
+ atRule.walkDecls((declaration) => {
+ localizeDeclaration(declaration, {
+ localAliasMap,
+ options: options,
+ global: globalKeyframes,
+ });
+ });
+ } else if (atRule.nodes) {
+ atRule.nodes.forEach((declaration) => {
+ if (declaration.type === "decl") {
+ localizeDeclaration(declaration, {
+ localAliasMap,
+ options: options,
+ global: globalMode,
+ });
+ }
+ });
+ }
+ });
+
+ root.walkRules((rule) => {
+ if (
+ rule.parent &&
+ rule.parent.type === "atrule" &&
+ /keyframes$/i.test(rule.parent.name)
+ ) {
+ // ignore keyframe rules
+ return;
+ }
+
+ const context = localizeNode(rule, options.mode, localAliasMap);
+
+ context.options = options;
+ context.localAliasMap = localAliasMap;
+
+ if (pureMode && context.hasPureGlobals) {
+ throw rule.error(
+ 'Selector "' +
+ rule.selector +
+ '" is not pure ' +
+ "(pure selectors must contain at least one local class or id)"
+ );
+ }
+
+ rule.selector = context.selector;
+
+ // Less-syntax mixins parse as rules with no nodes
+ if (rule.nodes) {
+ rule.nodes.forEach((declaration) =>
+ localizeDeclaration(declaration, context)
+ );
+ }
+ });
+ },
+ };
+ },
+ };
+};
+src$2.exports.postcss = true;
+
+var srcExports$1 = src$2.exports;
+
+const selectorParser = distExports;
+
+const hasOwnProperty = Object.prototype.hasOwnProperty;
+
+function getSingleLocalNamesForComposes(root) {
+ return root.nodes.map((node) => {
+ if (node.type !== "selector" || node.nodes.length !== 1) {
+ throw new Error(
+ `composition is only allowed when selector is single :local class name not in "${root}"`
+ );
+ }
+
+ node = node.nodes[0];
+
+ if (
+ node.type !== "pseudo" ||
+ node.value !== ":local" ||
+ node.nodes.length !== 1
+ ) {
+ throw new Error(
+ 'composition is only allowed when selector is single :local class name not in "' +
+ root +
+ '", "' +
+ node +
+ '" is weird'
+ );
+ }
+
+ node = node.first;
+
+ if (node.type !== "selector" || node.length !== 1) {
+ throw new Error(
+ 'composition is only allowed when selector is single :local class name not in "' +
+ root +
+ '", "' +
+ node +
+ '" is weird'
+ );
+ }
+
+ node = node.first;
+
+ if (node.type !== "class") {
+ // 'id' is not possible, because you can't compose ids
+ throw new Error(
+ 'composition is only allowed when selector is single :local class name not in "' +
+ root +
+ '", "' +
+ node +
+ '" is weird'
+ );
+ }
+
+ return node.value;
+ });
+}
+
+const whitespace = "[\\x20\\t\\r\\n\\f]";
+const unescapeRegExp = new RegExp(
+ "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)",
+ "ig"
+);
+
+function unescape(str) {
+ return str.replace(unescapeRegExp, (_, escaped, escapedWhitespace) => {
+ const high = "0x" + escaped - 0x10000;
+
+ // NaN means non-codepoint
+ // Workaround erroneous numeric interpretation of +"0x"
+ return high !== high || escapedWhitespace
+ ? escaped
+ : high < 0
+ ? // BMP codepoint
+ String.fromCharCode(high + 0x10000)
+ : // Supplemental Plane codepoint (surrogate pair)
+ String.fromCharCode((high >> 10) | 0xd800, (high & 0x3ff) | 0xdc00);
+ });
+}
+
+const plugin = (options = {}) => {
+ const generateScopedName =
+ (options && options.generateScopedName) || plugin.generateScopedName;
+ const generateExportEntry =
+ (options && options.generateExportEntry) || plugin.generateExportEntry;
+ const exportGlobals = options && options.exportGlobals;
+
+ return {
+ postcssPlugin: "postcss-modules-scope",
+ Once(root, { rule }) {
+ const exports = Object.create(null);
+
+ function exportScopedName(name, rawName) {
+ const scopedName = generateScopedName(
+ rawName ? rawName : name,
+ root.source.input.from,
+ root.source.input.css
+ );
+ const exportEntry = generateExportEntry(
+ rawName ? rawName : name,
+ scopedName,
+ root.source.input.from,
+ root.source.input.css
+ );
+ const { key, value } = exportEntry;
+
+ exports[key] = exports[key] || [];
+
+ if (exports[key].indexOf(value) < 0) {
+ exports[key].push(value);
+ }
+
+ return scopedName;
+ }
+
+ function localizeNode(node) {
+ switch (node.type) {
+ case "selector":
+ node.nodes = node.map(localizeNode);
+ return node;
+ case "class":
+ return selectorParser.className({
+ value: exportScopedName(
+ node.value,
+ node.raws && node.raws.value ? node.raws.value : null
+ ),
+ });
+ case "id": {
+ return selectorParser.id({
+ value: exportScopedName(
+ node.value,
+ node.raws && node.raws.value ? node.raws.value : null
+ ),
+ });
+ }
+ }
+
+ throw new Error(
+ `${node.type} ("${node}") is not allowed in a :local block`
+ );
+ }
+
+ function traverseNode(node) {
+ switch (node.type) {
+ case "pseudo":
+ if (node.value === ":local") {
+ if (node.nodes.length !== 1) {
+ throw new Error('Unexpected comma (",") in :local block');
+ }
+
+ const selector = localizeNode(node.first);
+ // move the spaces that were around the psuedo selector to the first
+ // non-container node
+ selector.first.spaces = node.spaces;
+
+ const nextNode = node.next();
+
+ if (
+ nextNode &&
+ nextNode.type === "combinator" &&
+ nextNode.value === " " &&
+ /\\[A-F0-9]{1,6}$/.test(selector.last.value)
+ ) {
+ selector.last.spaces.after = " ";
+ }
+
+ node.replaceWith(selector);
+
+ return;
+ }
+ /* falls through */
+ case "root":
+ case "selector": {
+ node.each(traverseNode);
+ break;
+ }
+ case "id":
+ case "class":
+ if (exportGlobals) {
+ exports[node.value] = [node.value];
+ }
+ break;
+ }
+ return node;
+ }
+
+ // Find any :import and remember imported names
+ const importedNames = {};
+
+ root.walkRules(/^:import\(.+\)$/, (rule) => {
+ rule.walkDecls((decl) => {
+ importedNames[decl.prop] = true;
+ });
+ });
+
+ // Find any :local selectors
+ root.walkRules((rule) => {
+ let parsedSelector = selectorParser().astSync(rule);
+
+ rule.selector = traverseNode(parsedSelector.clone()).toString();
+
+ rule.walkDecls(/composes|compose-with/i, (decl) => {
+ const localNames = getSingleLocalNamesForComposes(parsedSelector);
+ const classes = decl.value.split(/\s+/);
+
+ classes.forEach((className) => {
+ const global = /^global\(([^)]+)\)$/.exec(className);
+
+ if (global) {
+ localNames.forEach((exportedName) => {
+ exports[exportedName].push(global[1]);
+ });
+ } else if (hasOwnProperty.call(importedNames, className)) {
+ localNames.forEach((exportedName) => {
+ exports[exportedName].push(className);
+ });
+ } else if (hasOwnProperty.call(exports, className)) {
+ localNames.forEach((exportedName) => {
+ exports[className].forEach((item) => {
+ exports[exportedName].push(item);
+ });
+ });
+ } else {
+ throw decl.error(
+ `referenced class name "${className}" in ${decl.prop} not found`
+ );
+ }
+ });
+
+ decl.remove();
+ });
+
+ // Find any :local values
+ rule.walkDecls((decl) => {
+ if (!/:local\s*\((.+?)\)/.test(decl.value)) {
+ return;
+ }
+
+ let tokens = decl.value.split(/(,|'[^']*'|"[^"]*")/);
+
+ tokens = tokens.map((token, idx) => {
+ if (idx === 0 || tokens[idx - 1] === ",") {
+ let result = token;
+
+ const localMatch = /:local\s*\((.+?)\)/.exec(token);
+
+ if (localMatch) {
+ const input = localMatch.input;
+ const matchPattern = localMatch[0];
+ const matchVal = localMatch[1];
+ const newVal = exportScopedName(matchVal);
+
+ result = input.replace(matchPattern, newVal);
+ } else {
+ return token;
+ }
+
+ return result;
+ } else {
+ return token;
+ }
+ });
+
+ decl.value = tokens.join("");
+ });
+ });
+
+ // Find any :local keyframes
+ root.walkAtRules(/keyframes$/i, (atRule) => {
+ const localMatch = /^\s*:local\s*\((.+?)\)\s*$/.exec(atRule.params);
+
+ if (!localMatch) {
+ return;
+ }
+
+ atRule.params = exportScopedName(localMatch[1]);
+ });
+
+ // If we found any :locals, insert an :export rule
+ const exportedNames = Object.keys(exports);
+
+ if (exportedNames.length > 0) {
+ const exportRule = rule({ selector: ":export" });
+
+ exportedNames.forEach((exportedName) =>
+ exportRule.append({
+ prop: exportedName,
+ value: exports[exportedName].join(" "),
+ raws: { before: "\n " },
+ })
+ );
+
+ root.append(exportRule);
+ }
+ },
+ };
+};
+
+plugin.postcss = true;
+
+plugin.generateScopedName = function (name, path) {
+ const sanitisedPath = path
+ .replace(/\.[^./\\]+$/, "")
+ .replace(/[\W_]+/g, "_")
+ .replace(/^_|_$/g, "");
+
+ return `_${sanitisedPath}__${name}`.trim();
+};
+
+plugin.generateExportEntry = function (name, scopedName) {
+ return {
+ key: unescape(name),
+ value: unescape(scopedName),
+ };
+};
+
+var src$1 = plugin;
+
+function hash(str) {
+ var hash = 5381,
+ i = str.length;
+
+ while(i) {
+ hash = (hash * 33) ^ str.charCodeAt(--i);
+ }
+
+ /* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
+ * integers. Since we want the results to be always positive, convert the
+ * signed int to an unsigned by doing an unsigned bitshift. */
+ return hash >>> 0;
+}
+
+var stringHash = hash;
+
+var src = {exports: {}};
+
+const ICSSUtils = src$4;
+
+const matchImports = /^(.+?|\([\s\S]+?\))\s+from\s+("[^"]*"|'[^']*'|[\w-]+)$/;
+const matchValueDefinition = /(?:\s+|^)([\w-]+):?(.*?)$/;
+const matchImport = /^([\w-]+)(?:\s+as\s+([\w-]+))?/;
+
+src.exports = (options) => {
+ let importIndex = 0;
+ const createImportedName =
+ (options && options.createImportedName) ||
+ ((importName /*, path*/) =>
+ `i__const_${importName.replace(/\W/g, "_")}_${importIndex++}`);
+
+ return {
+ postcssPlugin: "postcss-modules-values",
+ prepare(result) {
+ const importAliases = [];
+ const definitions = {};
+
+ return {
+ Once(root, postcss) {
+ root.walkAtRules(/value/i, (atRule) => {
+ const matches = atRule.params.match(matchImports);
+
+ if (matches) {
+ let [, /*match*/ aliases, path] = matches;
+
+ // We can use constants for path names
+ if (definitions[path]) {
+ path = definitions[path];
+ }
+
+ const imports = aliases
+ .replace(/^\(\s*([\s\S]+)\s*\)$/, "$1")
+ .split(/\s*,\s*/)
+ .map((alias) => {
+ const tokens = matchImport.exec(alias);
+
+ if (tokens) {
+ const [, /*match*/ theirName, myName = theirName] = tokens;
+ const importedName = createImportedName(myName);
+ definitions[myName] = importedName;
+ return { theirName, importedName };
+ } else {
+ throw new Error(`@import statement "${alias}" is invalid!`);
+ }
+ });
+
+ importAliases.push({ path, imports });
+
+ atRule.remove();
+
+ return;
+ }
+
+ if (atRule.params.indexOf("@value") !== -1) {
+ result.warn("Invalid value definition: " + atRule.params);
+ }
+
+ let [, key, value] = `${atRule.params}${atRule.raws.between}`.match(
+ matchValueDefinition
+ );
+
+ const normalizedValue = value.replace(/\/\*((?!\*\/).*?)\*\//g, "");
+
+ if (normalizedValue.length === 0) {
+ result.warn("Invalid value definition: " + atRule.params);
+ atRule.remove();
+
+ return;
+ }
+
+ let isOnlySpace = /^\s+$/.test(normalizedValue);
+
+ if (!isOnlySpace) {
+ value = value.trim();
+ }
+
+ // Add to the definitions, knowing that values can refer to each other
+ definitions[key] = ICSSUtils.replaceValueSymbols(
+ value,
+ definitions
+ );
+
+ atRule.remove();
+ });
+
+ /* If we have no definitions, don't continue */
+ if (!Object.keys(definitions).length) {
+ return;
+ }
+
+ /* Perform replacements */
+ ICSSUtils.replaceSymbols(root, definitions);
+
+ /* We want to export anything defined by now, but don't add it to the CSS yet or it well get picked up by the replacement stuff */
+ const exportDeclarations = Object.keys(definitions).map((key) =>
+ postcss.decl({
+ value: definitions[key],
+ prop: key,
+ raws: { before: "\n " },
+ })
+ );
+
+ /* Add export rules if any */
+ if (exportDeclarations.length > 0) {
+ const exportRule = postcss.rule({
+ selector: ":export",
+ raws: { after: "\n" },
+ });
+
+ exportRule.append(exportDeclarations);
+
+ root.prepend(exportRule);
+ }
+
+ /* Add import rules */
+ importAliases.reverse().forEach(({ path, imports }) => {
+ const importRule = postcss.rule({
+ selector: `:import(${path})`,
+ raws: { after: "\n" },
+ });
+
+ imports.forEach(({ theirName, importedName }) => {
+ importRule.append({
+ value: theirName,
+ prop: importedName,
+ raws: { before: "\n " },
+ });
+ });
+
+ root.prepend(importRule);
+ });
+ },
+ };
+ },
+ };
+};
+
+src.exports.postcss = true;
+
+var srcExports = src.exports;
+
+Object.defineProperty(scoping, "__esModule", {
+ value: true
+});
+scoping.behaviours = void 0;
+scoping.getDefaultPlugins = getDefaultPlugins;
+scoping.getDefaultScopeBehaviour = getDefaultScopeBehaviour;
+scoping.getScopedNameGenerator = getScopedNameGenerator;
+
+var _postcssModulesExtractImports = _interopRequireDefault$1(srcExports$2);
+
+var _genericNames = _interopRequireDefault$1(genericNames);
+
+var _postcssModulesLocalByDefault = _interopRequireDefault$1(srcExports$1);
+
+var _postcssModulesScope = _interopRequireDefault$1(src$1);
+
+var _stringHash = _interopRequireDefault$1(stringHash);
+
+var _postcssModulesValues = _interopRequireDefault$1(srcExports);
+
+function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+const behaviours = {
+ LOCAL: "local",
+ GLOBAL: "global"
+};
+scoping.behaviours = behaviours;
+
+function getDefaultPlugins({
+ behaviour,
+ generateScopedName,
+ exportGlobals
+}) {
+ const scope = (0, _postcssModulesScope.default)({
+ generateScopedName,
+ exportGlobals
+ });
+ const plugins = {
+ [behaviours.LOCAL]: [_postcssModulesValues.default, (0, _postcssModulesLocalByDefault.default)({
+ mode: "local"
+ }), _postcssModulesExtractImports.default, scope],
+ [behaviours.GLOBAL]: [_postcssModulesValues.default, (0, _postcssModulesLocalByDefault.default)({
+ mode: "global"
+ }), _postcssModulesExtractImports.default, scope]
+ };
+ return plugins[behaviour];
+}
+
+function isValidBehaviour(behaviour) {
+ return Object.keys(behaviours).map(key => behaviours[key]).indexOf(behaviour) > -1;
+}
+
+function getDefaultScopeBehaviour(scopeBehaviour) {
+ return scopeBehaviour && isValidBehaviour(scopeBehaviour) ? scopeBehaviour : behaviours.LOCAL;
+}
+
+function generateScopedNameDefault(name, filename, css) {
+ const i = css.indexOf(`.${name}`);
+ const lineNumber = css.substr(0, i).split(/[\r\n]/).length;
+ const hash = (0, _stringHash.default)(css).toString(36).substr(0, 5);
+ return `_${name}_${hash}_${lineNumber}`;
+}
+
+function getScopedNameGenerator(generateScopedName, hashPrefix) {
+ const scopedNameGenerator = generateScopedName || generateScopedNameDefault;
+
+ if (typeof scopedNameGenerator === "function") {
+ return scopedNameGenerator;
+ }
+
+ return (0, _genericNames.default)(scopedNameGenerator, {
+ context: process.cwd(),
+ hashPrefix: hashPrefix
+ });
+}
+
+Object.defineProperty(pluginFactory, "__esModule", {
+ value: true
+});
+pluginFactory.makePlugin = makePlugin;
+
+var _postcss = _interopRequireDefault(require$$0);
+
+var _unquote = _interopRequireDefault(unquote$1);
+
+var _Parser = _interopRequireDefault(Parser$1);
+
+var _saveJSON = _interopRequireDefault(saveJSON$1);
+
+var _localsConvention = localsConvention;
+
+var _FileSystemLoader = _interopRequireDefault(FileSystemLoader$1);
+
+var _scoping = scoping;
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+const PLUGIN_NAME = "postcss-modules";
+
+function isGlobalModule(globalModules, inputFile) {
+ return globalModules.some(regex => inputFile.match(regex));
+}
+
+function getDefaultPluginsList(opts, inputFile) {
+ const globalModulesList = opts.globalModulePaths || null;
+ const exportGlobals = opts.exportGlobals || false;
+ const defaultBehaviour = (0, _scoping.getDefaultScopeBehaviour)(opts.scopeBehaviour);
+ const generateScopedName = (0, _scoping.getScopedNameGenerator)(opts.generateScopedName, opts.hashPrefix);
+
+ if (globalModulesList && isGlobalModule(globalModulesList, inputFile)) {
+ return (0, _scoping.getDefaultPlugins)({
+ behaviour: _scoping.behaviours.GLOBAL,
+ generateScopedName,
+ exportGlobals
+ });
+ }
+
+ return (0, _scoping.getDefaultPlugins)({
+ behaviour: defaultBehaviour,
+ generateScopedName,
+ exportGlobals
+ });
+}
+
+function getLoader(opts, plugins) {
+ const root = typeof opts.root === "undefined" ? "/" : opts.root;
+ return typeof opts.Loader === "function" ? new opts.Loader(root, plugins, opts.resolve) : new _FileSystemLoader.default(root, plugins, opts.resolve);
+}
+
+function isOurPlugin(plugin) {
+ return plugin.postcssPlugin === PLUGIN_NAME;
+}
+
+function makePlugin(opts) {
+ return {
+ postcssPlugin: PLUGIN_NAME,
+
+ async OnceExit(css, {
+ result
+ }) {
+ const getJSON = opts.getJSON || _saveJSON.default;
+ const inputFile = css.source.input.file;
+ const pluginList = getDefaultPluginsList(opts, inputFile);
+ const resultPluginIndex = result.processor.plugins.findIndex(plugin => isOurPlugin(plugin));
+
+ if (resultPluginIndex === -1) {
+ throw new Error("Plugin missing from options.");
+ }
+
+ const earlierPlugins = result.processor.plugins.slice(0, resultPluginIndex);
+ const loaderPlugins = [...earlierPlugins, ...pluginList];
+ const loader = getLoader(opts, loaderPlugins);
+
+ const fetcher = async (file, relativeTo, depTrace) => {
+ const unquoteFile = (0, _unquote.default)(file);
+ return loader.fetch.call(loader, unquoteFile, relativeTo, depTrace);
+ };
+
+ const parser = new _Parser.default(fetcher);
+ await (0, _postcss.default)([...pluginList, parser.plugin()]).process(css, {
+ from: inputFile
+ });
+ const out = loader.finalSource;
+ if (out) css.prepend(out);
+
+ if (opts.localsConvention) {
+ const reducer = (0, _localsConvention.makeLocalsConventionReducer)(opts.localsConvention, inputFile);
+ parser.exportTokens = Object.entries(parser.exportTokens).reduce(reducer, {});
+ }
+
+ result.messages.push({
+ type: "export",
+ plugin: "postcss-modules",
+ exportTokens: parser.exportTokens
+ }); // getJSON may return a promise
+
+ return getJSON(css.source.input.file, parser.exportTokens, result.opts.to);
+ }
+
+ };
+}
+
+var _fs = require$$0__default;
+
+var _fs2 = fs;
+
+var _pluginFactory = pluginFactory;
+
+(0, _fs2.setFileSystem)({
+ readFile: _fs.readFile,
+ writeFile: _fs.writeFile
+});
+
+build.exports = (opts = {}) => (0, _pluginFactory.makePlugin)(opts);
+
+var postcss = build.exports.postcss = true;
+
+var buildExports = build.exports;
+var index = /*@__PURE__*/getDefaultExportFromCjs(buildExports);
+
+var index$1 = /*#__PURE__*/_mergeNamespaces({
+ __proto__: null,
+ default: index,
+ postcss: postcss
+}, [buildExports]);
+
+export { index$1 as i };
diff --git a/node_modules/vite/dist/node/chunks/dep-c423598f.js b/node_modules/vite/dist/node/chunks/dep-c423598f.js
new file mode 100644
index 0000000..b471e60
--- /dev/null
+++ b/node_modules/vite/dist/node/chunks/dep-c423598f.js
@@ -0,0 +1,561 @@
+import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
+import { dirname as __cjs_dirname } from 'node:path';
+import { createRequire as __cjs_createRequire } from 'node:module';
+
+const __filename = __cjs_fileURLToPath(import.meta.url);
+const __dirname = __cjs_dirname(__filename);
+const require = __cjs_createRequire(import.meta.url);
+const __require = require;
+var openParentheses = "(".charCodeAt(0);
+var closeParentheses = ")".charCodeAt(0);
+var singleQuote = "'".charCodeAt(0);
+var doubleQuote = '"'.charCodeAt(0);
+var backslash = "\\".charCodeAt(0);
+var slash = "/".charCodeAt(0);
+var comma = ",".charCodeAt(0);
+var colon = ":".charCodeAt(0);
+var star = "*".charCodeAt(0);
+var uLower = "u".charCodeAt(0);
+var uUpper = "U".charCodeAt(0);
+var plus = "+".charCodeAt(0);
+var isUnicodeRange = /^[a-f0-9?-]+$/i;
+
+var parse$1 = function(input) {
+ var tokens = [];
+ var value = input;
+
+ var next,
+ quote,
+ prev,
+ token,
+ escape,
+ escapePos,
+ whitespacePos,
+ parenthesesOpenPos;
+ var pos = 0;
+ var code = value.charCodeAt(pos);
+ var max = value.length;
+ var stack = [{ nodes: tokens }];
+ var balanced = 0;
+ var parent;
+
+ var name = "";
+ var before = "";
+ var after = "";
+
+ while (pos < max) {
+ // Whitespaces
+ if (code <= 32) {
+ next = pos;
+ do {
+ next += 1;
+ code = value.charCodeAt(next);
+ } while (code <= 32);
+ token = value.slice(pos, next);
+
+ prev = tokens[tokens.length - 1];
+ if (code === closeParentheses && balanced) {
+ after = token;
+ } else if (prev && prev.type === "div") {
+ prev.after = token;
+ prev.sourceEndIndex += token.length;
+ } else if (
+ code === comma ||
+ code === colon ||
+ (code === slash &&
+ value.charCodeAt(next + 1) !== star &&
+ (!parent ||
+ (parent && parent.type === "function" && parent.value !== "calc")))
+ ) {
+ before = token;
+ } else {
+ tokens.push({
+ type: "space",
+ sourceIndex: pos,
+ sourceEndIndex: next,
+ value: token
+ });
+ }
+
+ pos = next;
+
+ // Quotes
+ } else if (code === singleQuote || code === doubleQuote) {
+ next = pos;
+ quote = code === singleQuote ? "'" : '"';
+ token = {
+ type: "string",
+ sourceIndex: pos,
+ quote: quote
+ };
+ do {
+ escape = false;
+ next = value.indexOf(quote, next + 1);
+ if (~next) {
+ escapePos = next;
+ while (value.charCodeAt(escapePos - 1) === backslash) {
+ escapePos -= 1;
+ escape = !escape;
+ }
+ } else {
+ value += quote;
+ next = value.length - 1;
+ token.unclosed = true;
+ }
+ } while (escape);
+ token.value = value.slice(pos + 1, next);
+ token.sourceEndIndex = token.unclosed ? next : next + 1;
+ tokens.push(token);
+ pos = next + 1;
+ code = value.charCodeAt(pos);
+
+ // Comments
+ } else if (code === slash && value.charCodeAt(pos + 1) === star) {
+ next = value.indexOf("*/", pos);
+
+ token = {
+ type: "comment",
+ sourceIndex: pos,
+ sourceEndIndex: next + 2
+ };
+
+ if (next === -1) {
+ token.unclosed = true;
+ next = value.length;
+ token.sourceEndIndex = next;
+ }
+
+ token.value = value.slice(pos + 2, next);
+ tokens.push(token);
+
+ pos = next + 2;
+ code = value.charCodeAt(pos);
+
+ // Operation within calc
+ } else if (
+ (code === slash || code === star) &&
+ parent &&
+ parent.type === "function" &&
+ parent.value === "calc"
+ ) {
+ token = value[pos];
+ tokens.push({
+ type: "word",
+ sourceIndex: pos - before.length,
+ sourceEndIndex: pos + token.length,
+ value: token
+ });
+ pos += 1;
+ code = value.charCodeAt(pos);
+
+ // Dividers
+ } else if (code === slash || code === comma || code === colon) {
+ token = value[pos];
+
+ tokens.push({
+ type: "div",
+ sourceIndex: pos - before.length,
+ sourceEndIndex: pos + token.length,
+ value: token,
+ before: before,
+ after: ""
+ });
+ before = "";
+
+ pos += 1;
+ code = value.charCodeAt(pos);
+
+ // Open parentheses
+ } else if (openParentheses === code) {
+ // Whitespaces after open parentheses
+ next = pos;
+ do {
+ next += 1;
+ code = value.charCodeAt(next);
+ } while (code <= 32);
+ parenthesesOpenPos = pos;
+ token = {
+ type: "function",
+ sourceIndex: pos - name.length,
+ value: name,
+ before: value.slice(parenthesesOpenPos + 1, next)
+ };
+ pos = next;
+
+ if (name === "url" && code !== singleQuote && code !== doubleQuote) {
+ next -= 1;
+ do {
+ escape = false;
+ next = value.indexOf(")", next + 1);
+ if (~next) {
+ escapePos = next;
+ while (value.charCodeAt(escapePos - 1) === backslash) {
+ escapePos -= 1;
+ escape = !escape;
+ }
+ } else {
+ value += ")";
+ next = value.length - 1;
+ token.unclosed = true;
+ }
+ } while (escape);
+ // Whitespaces before closed
+ whitespacePos = next;
+ do {
+ whitespacePos -= 1;
+ code = value.charCodeAt(whitespacePos);
+ } while (code <= 32);
+ if (parenthesesOpenPos < whitespacePos) {
+ if (pos !== whitespacePos + 1) {
+ token.nodes = [
+ {
+ type: "word",
+ sourceIndex: pos,
+ sourceEndIndex: whitespacePos + 1,
+ value: value.slice(pos, whitespacePos + 1)
+ }
+ ];
+ } else {
+ token.nodes = [];
+ }
+ if (token.unclosed && whitespacePos + 1 !== next) {
+ token.after = "";
+ token.nodes.push({
+ type: "space",
+ sourceIndex: whitespacePos + 1,
+ sourceEndIndex: next,
+ value: value.slice(whitespacePos + 1, next)
+ });
+ } else {
+ token.after = value.slice(whitespacePos + 1, next);
+ token.sourceEndIndex = next;
+ }
+ } else {
+ token.after = "";
+ token.nodes = [];
+ }
+ pos = next + 1;
+ token.sourceEndIndex = token.unclosed ? next : pos;
+ code = value.charCodeAt(pos);
+ tokens.push(token);
+ } else {
+ balanced += 1;
+ token.after = "";
+ token.sourceEndIndex = pos + 1;
+ tokens.push(token);
+ stack.push(token);
+ tokens = token.nodes = [];
+ parent = token;
+ }
+ name = "";
+
+ // Close parentheses
+ } else if (closeParentheses === code && balanced) {
+ pos += 1;
+ code = value.charCodeAt(pos);
+
+ parent.after = after;
+ parent.sourceEndIndex += after.length;
+ after = "";
+ balanced -= 1;
+ stack[stack.length - 1].sourceEndIndex = pos;
+ stack.pop();
+ parent = stack[balanced];
+ tokens = parent.nodes;
+
+ // Words
+ } else {
+ next = pos;
+ do {
+ if (code === backslash) {
+ next += 1;
+ }
+ next += 1;
+ code = value.charCodeAt(next);
+ } while (
+ next < max &&
+ !(
+ code <= 32 ||
+ code === singleQuote ||
+ code === doubleQuote ||
+ code === comma ||
+ code === colon ||
+ code === slash ||
+ code === openParentheses ||
+ (code === star &&
+ parent &&
+ parent.type === "function" &&
+ parent.value === "calc") ||
+ (code === slash &&
+ parent.type === "function" &&
+ parent.value === "calc") ||
+ (code === closeParentheses && balanced)
+ )
+ );
+ token = value.slice(pos, next);
+
+ if (openParentheses === code) {
+ name = token;
+ } else if (
+ (uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) &&
+ plus === token.charCodeAt(1) &&
+ isUnicodeRange.test(token.slice(2))
+ ) {
+ tokens.push({
+ type: "unicode-range",
+ sourceIndex: pos,
+ sourceEndIndex: next,
+ value: token
+ });
+ } else {
+ tokens.push({
+ type: "word",
+ sourceIndex: pos,
+ sourceEndIndex: next,
+ value: token
+ });
+ }
+
+ pos = next;
+ }
+ }
+
+ for (pos = stack.length - 1; pos; pos -= 1) {
+ stack[pos].unclosed = true;
+ stack[pos].sourceEndIndex = value.length;
+ }
+
+ return stack[0].nodes;
+};
+
+var walk$1 = function walk(nodes, cb, bubble) {
+ var i, max, node, result;
+
+ for (i = 0, max = nodes.length; i < max; i += 1) {
+ node = nodes[i];
+ if (!bubble) {
+ result = cb(node, i, nodes);
+ }
+
+ if (
+ result !== false &&
+ node.type === "function" &&
+ Array.isArray(node.nodes)
+ ) {
+ walk(node.nodes, cb, bubble);
+ }
+
+ if (bubble) {
+ cb(node, i, nodes);
+ }
+ }
+};
+
+function stringifyNode(node, custom) {
+ var type = node.type;
+ var value = node.value;
+ var buf;
+ var customResult;
+
+ if (custom && (customResult = custom(node)) !== undefined) {
+ return customResult;
+ } else if (type === "word" || type === "space") {
+ return value;
+ } else if (type === "string") {
+ buf = node.quote || "";
+ return buf + value + (node.unclosed ? "" : buf);
+ } else if (type === "comment") {
+ return "/*" + value + (node.unclosed ? "" : "*/");
+ } else if (type === "div") {
+ return (node.before || "") + value + (node.after || "");
+ } else if (Array.isArray(node.nodes)) {
+ buf = stringify$1(node.nodes, custom);
+ if (type !== "function") {
+ return buf;
+ }
+ return (
+ value +
+ "(" +
+ (node.before || "") +
+ buf +
+ (node.after || "") +
+ (node.unclosed ? "" : ")")
+ );
+ }
+ return value;
+}
+
+function stringify$1(nodes, custom) {
+ var result, i;
+
+ if (Array.isArray(nodes)) {
+ result = "";
+ for (i = nodes.length - 1; ~i; i -= 1) {
+ result = stringifyNode(nodes[i], custom) + result;
+ }
+ return result;
+ }
+ return stringifyNode(nodes, custom);
+}
+
+var stringify_1 = stringify$1;
+
+var unit;
+var hasRequiredUnit;
+
+function requireUnit () {
+ if (hasRequiredUnit) return unit;
+ hasRequiredUnit = 1;
+ var minus = "-".charCodeAt(0);
+ var plus = "+".charCodeAt(0);
+ var dot = ".".charCodeAt(0);
+ var exp = "e".charCodeAt(0);
+ var EXP = "E".charCodeAt(0);
+
+ // Check if three code points would start a number
+ // https://www.w3.org/TR/css-syntax-3/#starts-with-a-number
+ function likeNumber(value) {
+ var code = value.charCodeAt(0);
+ var nextCode;
+
+ if (code === plus || code === minus) {
+ nextCode = value.charCodeAt(1);
+
+ if (nextCode >= 48 && nextCode <= 57) {
+ return true;
+ }
+
+ var nextNextCode = value.charCodeAt(2);
+
+ if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) {
+ return true;
+ }
+
+ return false;
+ }
+
+ if (code === dot) {
+ nextCode = value.charCodeAt(1);
+
+ if (nextCode >= 48 && nextCode <= 57) {
+ return true;
+ }
+
+ return false;
+ }
+
+ if (code >= 48 && code <= 57) {
+ return true;
+ }
+
+ return false;
+ }
+
+ // Consume a number
+ // https://www.w3.org/TR/css-syntax-3/#consume-number
+ unit = function(value) {
+ var pos = 0;
+ var length = value.length;
+ var code;
+ var nextCode;
+ var nextNextCode;
+
+ if (length === 0 || !likeNumber(value)) {
+ return false;
+ }
+
+ code = value.charCodeAt(pos);
+
+ if (code === plus || code === minus) {
+ pos++;
+ }
+
+ while (pos < length) {
+ code = value.charCodeAt(pos);
+
+ if (code < 48 || code > 57) {
+ break;
+ }
+
+ pos += 1;
+ }
+
+ code = value.charCodeAt(pos);
+ nextCode = value.charCodeAt(pos + 1);
+
+ if (code === dot && nextCode >= 48 && nextCode <= 57) {
+ pos += 2;
+
+ while (pos < length) {
+ code = value.charCodeAt(pos);
+
+ if (code < 48 || code > 57) {
+ break;
+ }
+
+ pos += 1;
+ }
+ }
+
+ code = value.charCodeAt(pos);
+ nextCode = value.charCodeAt(pos + 1);
+ nextNextCode = value.charCodeAt(pos + 2);
+
+ if (
+ (code === exp || code === EXP) &&
+ ((nextCode >= 48 && nextCode <= 57) ||
+ ((nextCode === plus || nextCode === minus) &&
+ nextNextCode >= 48 &&
+ nextNextCode <= 57))
+ ) {
+ pos += nextCode === plus || nextCode === minus ? 3 : 2;
+
+ while (pos < length) {
+ code = value.charCodeAt(pos);
+
+ if (code < 48 || code > 57) {
+ break;
+ }
+
+ pos += 1;
+ }
+ }
+
+ return {
+ number: value.slice(0, pos),
+ unit: value.slice(pos)
+ };
+ };
+ return unit;
+}
+
+var parse = parse$1;
+var walk = walk$1;
+var stringify = stringify_1;
+
+function ValueParser(value) {
+ if (this instanceof ValueParser) {
+ this.nodes = parse(value);
+ return this;
+ }
+ return new ValueParser(value);
+}
+
+ValueParser.prototype.toString = function() {
+ return Array.isArray(this.nodes) ? stringify(this.nodes) : "";
+};
+
+ValueParser.prototype.walk = function(cb, bubble) {
+ walk(this.nodes, cb, bubble);
+ return this;
+};
+
+ValueParser.unit = requireUnit();
+
+ValueParser.walk = walk;
+
+ValueParser.stringify = stringify;
+
+var lib = ValueParser;
+
+export { lib as l };
diff --git a/node_modules/vite/dist/node/chunks/dep-df561101.js b/node_modules/vite/dist/node/chunks/dep-df561101.js
new file mode 100644
index 0000000..1bc8674
--- /dev/null
+++ b/node_modules/vite/dist/node/chunks/dep-df561101.js
@@ -0,0 +1,66291 @@
+import fs$l from 'node:fs';
+import fsp from 'node:fs/promises';
+import path$o, { dirname as dirname$2, join as join$2, posix as posix$1, isAbsolute as isAbsolute$2, relative as relative$2, basename as basename$2, extname as extname$1 } from 'node:path';
+import { fileURLToPath, URL as URL$3, URLSearchParams, parse as parse$i, pathToFileURL } from 'node:url';
+import { promisify as promisify$4, format as format$2, inspect } from 'node:util';
+import { performance } from 'node:perf_hooks';
+import { createRequire as createRequire$1, builtinModules } from 'node:module';
+import require$$0$3 from 'tty';
+import esbuild, { transform as transform$1, formatMessages, build as build$3 } from 'esbuild';
+import require$$0$4, { win32, posix, isAbsolute as isAbsolute$1, resolve as resolve$3, relative as relative$1, basename as basename$1, extname, dirname as dirname$1, join as join$1, sep as sep$1, normalize } from 'path';
+import * as require$$0$2 from 'fs';
+import require$$0__default, { existsSync, readFileSync, statSync as statSync$1, promises as promises$1, readdir as readdir$4, readdirSync } from 'fs';
+import require$$0$5 from 'events';
+import require$$5 from 'assert';
+import require$$0$6 from 'util';
+import require$$3$2 from 'net';
+import require$$0$9 from 'url';
+import require$$1$1 from 'http';
+import require$$0$7 from 'stream';
+import require$$2 from 'os';
+import require$$2$1 from 'child_process';
+import os$4 from 'node:os';
+import { exec } from 'node:child_process';
+import { createHash as createHash$2 } from 'node:crypto';
+import { promises } from 'node:dns';
+import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEP_VERSION_RE, DEFAULT_MAIN_FIELDS, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, SPECIAL_QUERY_RE, CSS_LANGS_RE, ESBUILD_MODULES_TARGET, KNOWN_ASSET_TYPES, CLIENT_DIR, JS_TYPES_RE, VERSION as VERSION$1, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
+import require$$3$1 from 'crypto';
+import { Buffer as Buffer$1 } from 'node:buffer';
+import require$$0$8, { createRequire as createRequire$2 } from 'module';
+import assert$1 from 'node:assert';
+import process$1 from 'node:process';
+import v8 from 'node:v8';
+import { VERSION } from 'rollup';
+import require$$1 from 'worker_threads';
+import { createServer as createServer$3, STATUS_CODES } from 'node:http';
+import { createServer as createServer$2 } from 'node:https';
+import require$$0$a from 'zlib';
+import require$$0$b from 'buffer';
+import require$$1$2 from 'https';
+import require$$4$1 from 'tls';
+import * as qs from 'querystring';
+import readline from 'node:readline';
+import zlib$1, { gzip } from 'node:zlib';
+
+import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
+import { dirname as __cjs_dirname } from 'node:path';
+import { createRequire as __cjs_createRequire } from 'node:module';
+
+const __filename = __cjs_fileURLToPath(import.meta.url);
+const __dirname = __cjs_dirname(__filename);
+const require = __cjs_createRequire(import.meta.url);
+const __require = require;
+var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
+
+function getDefaultExportFromCjs (x) {
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
+}
+
+function getAugmentedNamespace(n) {
+ if (n.__esModule) return n;
+ var f = n.default;
+ if (typeof f == "function") {
+ var a = function a () {
+ if (this instanceof a) {
+ return Reflect.construct(f, arguments, this.constructor);
+ }
+ return f.apply(this, arguments);
+ };
+ a.prototype = f.prototype;
+ } else a = {};
+ Object.defineProperty(a, '__esModule', {value: true});
+ Object.keys(n).forEach(function (k) {
+ var d = Object.getOwnPropertyDescriptor(n, k);
+ Object.defineProperty(a, k, d.get ? d : {
+ enumerable: true,
+ get: function () {
+ return n[k];
+ }
+ });
+ });
+ return a;
+}
+
+var picocolors = {exports: {}};
+
+let tty = require$$0$3;
+
+let isColorSupported =
+ !("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
+ ("FORCE_COLOR" in process.env ||
+ process.argv.includes("--color") ||
+ process.platform === "win32" ||
+ (tty.isatty(1) && process.env.TERM !== "dumb") ||
+ "CI" in process.env);
+
+let formatter =
+ (open, close, replace = open) =>
+ input => {
+ let string = "" + input;
+ let index = string.indexOf(close, open.length);
+ return ~index
+ ? open + replaceClose(string, close, replace, index) + close
+ : open + string + close
+ };
+
+let replaceClose = (string, close, replace, index) => {
+ let start = string.substring(0, index) + replace;
+ let end = string.substring(index + close.length);
+ let nextIndex = end.indexOf(close);
+ return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
+};
+
+let createColors = (enabled = isColorSupported) => ({
+ isColorSupported: enabled,
+ reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
+ bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
+ dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
+ italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
+ underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
+ inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
+ hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
+ strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
+ black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
+ red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
+ green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
+ yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
+ blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
+ magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
+ cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
+ white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
+ gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
+ bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
+ bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
+ bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
+ bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
+ bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
+ bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
+ bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
+ bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
+});
+
+picocolors.exports = createColors();
+picocolors.exports.createColors = createColors;
+
+var picocolorsExports = picocolors.exports;
+var colors$1 = /*@__PURE__*/getDefaultExportFromCjs(picocolorsExports);
+
+function matches$1(pattern, importee) {
+ if (pattern instanceof RegExp) {
+ return pattern.test(importee);
+ }
+ if (importee.length < pattern.length) {
+ return false;
+ }
+ if (importee === pattern) {
+ return true;
+ }
+ // eslint-disable-next-line prefer-template
+ return importee.startsWith(pattern + '/');
+}
+function getEntries({ entries, customResolver }) {
+ if (!entries) {
+ return [];
+ }
+ const resolverFunctionFromOptions = resolveCustomResolver(customResolver);
+ if (Array.isArray(entries)) {
+ return entries.map((entry) => {
+ return {
+ find: entry.find,
+ replacement: entry.replacement,
+ resolverFunction: resolveCustomResolver(entry.customResolver) || resolverFunctionFromOptions
+ };
+ });
+ }
+ return Object.entries(entries).map(([key, value]) => {
+ return { find: key, replacement: value, resolverFunction: resolverFunctionFromOptions };
+ });
+}
+function getHookFunction(hook) {
+ if (typeof hook === 'function') {
+ return hook;
+ }
+ if (hook && 'handler' in hook && typeof hook.handler === 'function') {
+ return hook.handler;
+ }
+ return null;
+}
+function resolveCustomResolver(customResolver) {
+ if (typeof customResolver === 'function') {
+ return customResolver;
+ }
+ if (customResolver) {
+ return getHookFunction(customResolver.resolveId);
+ }
+ return null;
+}
+function alias$1(options = {}) {
+ const entries = getEntries(options);
+ if (entries.length === 0) {
+ return {
+ name: 'alias',
+ resolveId: () => null
+ };
+ }
+ return {
+ name: 'alias',
+ async buildStart(inputOptions) {
+ await Promise.all([...(Array.isArray(options.entries) ? options.entries : []), options].map(({ customResolver }) => { var _a; return customResolver && ((_a = getHookFunction(customResolver.buildStart)) === null || _a === void 0 ? void 0 : _a.call(this, inputOptions)); }));
+ },
+ resolveId(importee, importer, resolveOptions) {
+ if (!importer) {
+ return null;
+ }
+ // First match is supposed to be the correct one
+ const matchedEntry = entries.find((entry) => matches$1(entry.find, importee));
+ if (!matchedEntry) {
+ return null;
+ }
+ const updatedId = importee.replace(matchedEntry.find, matchedEntry.replacement);
+ if (matchedEntry.resolverFunction) {
+ return matchedEntry.resolverFunction.call(this, updatedId, importer, resolveOptions);
+ }
+ return this.resolve(updatedId, importer, Object.assign({ skipSelf: true }, resolveOptions)).then((resolved) => resolved || { id: updatedId });
+ }
+ };
+}
+
+// @ts-check
+/** @typedef { import('estree').BaseNode} BaseNode */
+
+/** @typedef {{
+ skip: () => void;
+ remove: () => void;
+ replace: (node: BaseNode) => void;
+}} WalkerContext */
+
+let WalkerBase$1 = class WalkerBase {
+ constructor() {
+ /** @type {boolean} */
+ this.should_skip = false;
+
+ /** @type {boolean} */
+ this.should_remove = false;
+
+ /** @type {BaseNode | null} */
+ this.replacement = null;
+
+ /** @type {WalkerContext} */
+ this.context = {
+ skip: () => (this.should_skip = true),
+ remove: () => (this.should_remove = true),
+ replace: (node) => (this.replacement = node)
+ };
+ }
+
+ /**
+ *
+ * @param {any} parent
+ * @param {string} prop
+ * @param {number} index
+ * @param {BaseNode} node
+ */
+ replace(parent, prop, index, node) {
+ if (parent) {
+ if (index !== null) {
+ parent[prop][index] = node;
+ } else {
+ parent[prop] = node;
+ }
+ }
+ }
+
+ /**
+ *
+ * @param {any} parent
+ * @param {string} prop
+ * @param {number} index
+ */
+ remove(parent, prop, index) {
+ if (parent) {
+ if (index !== null) {
+ parent[prop].splice(index, 1);
+ } else {
+ delete parent[prop];
+ }
+ }
+ }
+};
+
+// @ts-check
+
+/** @typedef { import('estree').BaseNode} BaseNode */
+/** @typedef { import('./walker.js').WalkerContext} WalkerContext */
+
+/** @typedef {(
+ * this: WalkerContext,
+ * node: BaseNode,
+ * parent: BaseNode,
+ * key: string,
+ * index: number
+ * ) => void} SyncHandler */
+
+let SyncWalker$1 = class SyncWalker extends WalkerBase$1 {
+ /**
+ *
+ * @param {SyncHandler} enter
+ * @param {SyncHandler} leave
+ */
+ constructor(enter, leave) {
+ super();
+
+ /** @type {SyncHandler} */
+ this.enter = enter;
+
+ /** @type {SyncHandler} */
+ this.leave = leave;
+ }
+
+ /**
+ *
+ * @param {BaseNode} node
+ * @param {BaseNode} parent
+ * @param {string} [prop]
+ * @param {number} [index]
+ * @returns {BaseNode}
+ */
+ visit(node, parent, prop, index) {
+ if (node) {
+ if (this.enter) {
+ const _should_skip = this.should_skip;
+ const _should_remove = this.should_remove;
+ const _replacement = this.replacement;
+ this.should_skip = false;
+ this.should_remove = false;
+ this.replacement = null;
+
+ this.enter.call(this.context, node, parent, prop, index);
+
+ if (this.replacement) {
+ node = this.replacement;
+ this.replace(parent, prop, index, node);
+ }
+
+ if (this.should_remove) {
+ this.remove(parent, prop, index);
+ }
+
+ const skipped = this.should_skip;
+ const removed = this.should_remove;
+
+ this.should_skip = _should_skip;
+ this.should_remove = _should_remove;
+ this.replacement = _replacement;
+
+ if (skipped) return node;
+ if (removed) return null;
+ }
+
+ for (const key in node) {
+ const value = node[key];
+
+ if (typeof value !== "object") {
+ continue;
+ } else if (Array.isArray(value)) {
+ for (let i = 0; i < value.length; i += 1) {
+ if (value[i] !== null && typeof value[i].type === 'string') {
+ if (!this.visit(value[i], node, key, i)) {
+ // removed
+ i--;
+ }
+ }
+ }
+ } else if (value !== null && typeof value.type === "string") {
+ this.visit(value, node, key, null);
+ }
+ }
+
+ if (this.leave) {
+ const _replacement = this.replacement;
+ const _should_remove = this.should_remove;
+ this.replacement = null;
+ this.should_remove = false;
+
+ this.leave.call(this.context, node, parent, prop, index);
+
+ if (this.replacement) {
+ node = this.replacement;
+ this.replace(parent, prop, index, node);
+ }
+
+ if (this.should_remove) {
+ this.remove(parent, prop, index);
+ }
+
+ const removed = this.should_remove;
+
+ this.replacement = _replacement;
+ this.should_remove = _should_remove;
+
+ if (removed) return null;
+ }
+ }
+
+ return node;
+ }
+};
+
+// @ts-check
+
+/** @typedef { import('estree').BaseNode} BaseNode */
+/** @typedef { import('./sync.js').SyncHandler} SyncHandler */
+/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */
+
+/**
+ *
+ * @param {BaseNode} ast
+ * @param {{
+ * enter?: SyncHandler
+ * leave?: SyncHandler
+ * }} walker
+ * @returns {BaseNode}
+ */
+function walk$4(ast, { enter, leave }) {
+ const instance = new SyncWalker$1(enter, leave);
+ return instance.visit(ast, null);
+}
+
+var utils$k = {};
+
+const path$n = require$$0$4;
+const WIN_SLASH = '\\\\/';
+const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
+
+/**
+ * Posix glob regex
+ */
+
+const DOT_LITERAL = '\\.';
+const PLUS_LITERAL = '\\+';
+const QMARK_LITERAL = '\\?';
+const SLASH_LITERAL = '\\/';
+const ONE_CHAR = '(?=.)';
+const QMARK = '[^/]';
+const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
+const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
+const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
+const NO_DOT = `(?!${DOT_LITERAL})`;
+const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
+const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
+const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
+const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
+const STAR$1 = `${QMARK}*?`;
+
+const POSIX_CHARS = {
+ DOT_LITERAL,
+ PLUS_LITERAL,
+ QMARK_LITERAL,
+ SLASH_LITERAL,
+ ONE_CHAR,
+ QMARK,
+ END_ANCHOR,
+ DOTS_SLASH,
+ NO_DOT,
+ NO_DOTS,
+ NO_DOT_SLASH,
+ NO_DOTS_SLASH,
+ QMARK_NO_DOT,
+ STAR: STAR$1,
+ START_ANCHOR
+};
+
+/**
+ * Windows glob regex
+ */
+
+const WINDOWS_CHARS = {
+ ...POSIX_CHARS,
+
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
+ QMARK: WIN_NO_SLASH,
+ STAR: `${WIN_NO_SLASH}*?`,
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
+ NO_DOT: `(?!${DOT_LITERAL})`,
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
+};
+
+/**
+ * POSIX Bracket Regex
+ */
+
+const POSIX_REGEX_SOURCE$1 = {
+ alnum: 'a-zA-Z0-9',
+ alpha: 'a-zA-Z',
+ ascii: '\\x00-\\x7F',
+ blank: ' \\t',
+ cntrl: '\\x00-\\x1F\\x7F',
+ digit: '0-9',
+ graph: '\\x21-\\x7E',
+ lower: 'a-z',
+ print: '\\x20-\\x7E ',
+ punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
+ space: ' \\t\\r\\n\\v\\f',
+ upper: 'A-Z',
+ word: 'A-Za-z0-9_',
+ xdigit: 'A-Fa-f0-9'
+};
+
+var constants$6 = {
+ MAX_LENGTH: 1024 * 64,
+ POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
+
+ // regular expressions
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
+
+ // Replace globs with equivalent patterns to reduce parsing time.
+ REPLACEMENTS: {
+ '***': '*',
+ '**/**': '**',
+ '**/**/**': '**'
+ },
+
+ // Digits
+ CHAR_0: 48, /* 0 */
+ CHAR_9: 57, /* 9 */
+
+ // Alphabet chars.
+ CHAR_UPPERCASE_A: 65, /* A */
+ CHAR_LOWERCASE_A: 97, /* a */
+ CHAR_UPPERCASE_Z: 90, /* Z */
+ CHAR_LOWERCASE_Z: 122, /* z */
+
+ CHAR_LEFT_PARENTHESES: 40, /* ( */
+ CHAR_RIGHT_PARENTHESES: 41, /* ) */
+
+ CHAR_ASTERISK: 42, /* * */
+
+ // Non-alphabetic chars.
+ CHAR_AMPERSAND: 38, /* & */
+ CHAR_AT: 64, /* @ */
+ CHAR_BACKWARD_SLASH: 92, /* \ */
+ CHAR_CARRIAGE_RETURN: 13, /* \r */
+ CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
+ CHAR_COLON: 58, /* : */
+ CHAR_COMMA: 44, /* , */
+ CHAR_DOT: 46, /* . */
+ CHAR_DOUBLE_QUOTE: 34, /* " */
+ CHAR_EQUAL: 61, /* = */
+ CHAR_EXCLAMATION_MARK: 33, /* ! */
+ CHAR_FORM_FEED: 12, /* \f */
+ CHAR_FORWARD_SLASH: 47, /* / */
+ CHAR_GRAVE_ACCENT: 96, /* ` */
+ CHAR_HASH: 35, /* # */
+ CHAR_HYPHEN_MINUS: 45, /* - */
+ CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
+ CHAR_LEFT_CURLY_BRACE: 123, /* { */
+ CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
+ CHAR_LINE_FEED: 10, /* \n */
+ CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
+ CHAR_PERCENT: 37, /* % */
+ CHAR_PLUS: 43, /* + */
+ CHAR_QUESTION_MARK: 63, /* ? */
+ CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
+ CHAR_RIGHT_CURLY_BRACE: 125, /* } */
+ CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
+ CHAR_SEMICOLON: 59, /* ; */
+ CHAR_SINGLE_QUOTE: 39, /* ' */
+ CHAR_SPACE: 32, /* */
+ CHAR_TAB: 9, /* \t */
+ CHAR_UNDERSCORE: 95, /* _ */
+ CHAR_VERTICAL_LINE: 124, /* | */
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
+
+ SEP: path$n.sep,
+
+ /**
+ * Create EXTGLOB_CHARS
+ */
+
+ extglobChars(chars) {
+ return {
+ '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
+ '?': { type: 'qmark', open: '(?:', close: ')?' },
+ '+': { type: 'plus', open: '(?:', close: ')+' },
+ '*': { type: 'star', open: '(?:', close: ')*' },
+ '@': { type: 'at', open: '(?:', close: ')' }
+ };
+ },
+
+ /**
+ * Create GLOB_CHARS
+ */
+
+ globChars(win32) {
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
+ }
+};
+
+(function (exports) {
+
+ const path = require$$0$4;
+ const win32 = process.platform === 'win32';
+ const {
+ REGEX_BACKSLASH,
+ REGEX_REMOVE_BACKSLASH,
+ REGEX_SPECIAL_CHARS,
+ REGEX_SPECIAL_CHARS_GLOBAL
+ } = constants$6;
+
+ exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
+ exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
+ exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
+ exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
+ exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
+
+ exports.removeBackslashes = str => {
+ return str.replace(REGEX_REMOVE_BACKSLASH, match => {
+ return match === '\\' ? '' : match;
+ });
+ };
+
+ exports.supportsLookbehinds = () => {
+ const segs = process.version.slice(1).split('.').map(Number);
+ if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
+ return true;
+ }
+ return false;
+ };
+
+ exports.isWindows = options => {
+ if (options && typeof options.windows === 'boolean') {
+ return options.windows;
+ }
+ return win32 === true || path.sep === '\\';
+ };
+
+ exports.escapeLast = (input, char, lastIdx) => {
+ const idx = input.lastIndexOf(char, lastIdx);
+ if (idx === -1) return input;
+ if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
+ };
+
+ exports.removePrefix = (input, state = {}) => {
+ let output = input;
+ if (output.startsWith('./')) {
+ output = output.slice(2);
+ state.prefix = './';
+ }
+ return output;
+ };
+
+ exports.wrapOutput = (input, state = {}, options = {}) => {
+ const prepend = options.contains ? '' : '^';
+ const append = options.contains ? '' : '$';
+
+ let output = `${prepend}(?:${input})${append}`;
+ if (state.negated === true) {
+ output = `(?:^(?!${output}).*$)`;
+ }
+ return output;
+ };
+} (utils$k));
+
+const utils$j = utils$k;
+const {
+ CHAR_ASTERISK, /* * */
+ CHAR_AT, /* @ */
+ CHAR_BACKWARD_SLASH, /* \ */
+ CHAR_COMMA: CHAR_COMMA$1, /* , */
+ CHAR_DOT: CHAR_DOT$1, /* . */
+ CHAR_EXCLAMATION_MARK, /* ! */
+ CHAR_FORWARD_SLASH, /* / */
+ CHAR_LEFT_CURLY_BRACE: CHAR_LEFT_CURLY_BRACE$1, /* { */
+ CHAR_LEFT_PARENTHESES: CHAR_LEFT_PARENTHESES$1, /* ( */
+ CHAR_LEFT_SQUARE_BRACKET: CHAR_LEFT_SQUARE_BRACKET$1, /* [ */
+ CHAR_PLUS, /* + */
+ CHAR_QUESTION_MARK, /* ? */
+ CHAR_RIGHT_CURLY_BRACE: CHAR_RIGHT_CURLY_BRACE$1, /* } */
+ CHAR_RIGHT_PARENTHESES: CHAR_RIGHT_PARENTHESES$1, /* ) */
+ CHAR_RIGHT_SQUARE_BRACKET: CHAR_RIGHT_SQUARE_BRACKET$1 /* ] */
+} = constants$6;
+
+const isPathSeparator = code => {
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
+};
+
+const depth = token => {
+ if (token.isPrefix !== true) {
+ token.depth = token.isGlobstar ? Infinity : 1;
+ }
+};
+
+/**
+ * Quickly scans a glob pattern and returns an object with a handful of
+ * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
+ * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
+ * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
+ *
+ * ```js
+ * const pm = require('picomatch');
+ * console.log(pm.scan('foo/bar/*.js'));
+ * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
+ * ```
+ * @param {String} `str`
+ * @param {Object} `options`
+ * @return {Object} Returns an object with tokens and regex source string.
+ * @api public
+ */
+
+const scan$2 = (input, options) => {
+ const opts = options || {};
+
+ const length = input.length - 1;
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
+ const slashes = [];
+ const tokens = [];
+ const parts = [];
+
+ let str = input;
+ let index = -1;
+ let start = 0;
+ let lastIndex = 0;
+ let isBrace = false;
+ let isBracket = false;
+ let isGlob = false;
+ let isExtglob = false;
+ let isGlobstar = false;
+ let braceEscaped = false;
+ let backslashes = false;
+ let negated = false;
+ let negatedExtglob = false;
+ let finished = false;
+ let braces = 0;
+ let prev;
+ let code;
+ let token = { value: '', depth: 0, isGlob: false };
+
+ const eos = () => index >= length;
+ const peek = () => str.charCodeAt(index + 1);
+ const advance = () => {
+ prev = code;
+ return str.charCodeAt(++index);
+ };
+
+ while (index < length) {
+ code = advance();
+ let next;
+
+ if (code === CHAR_BACKWARD_SLASH) {
+ backslashes = token.backslashes = true;
+ code = advance();
+
+ if (code === CHAR_LEFT_CURLY_BRACE$1) {
+ braceEscaped = true;
+ }
+ continue;
+ }
+
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE$1) {
+ braces++;
+
+ while (eos() !== true && (code = advance())) {
+ if (code === CHAR_BACKWARD_SLASH) {
+ backslashes = token.backslashes = true;
+ advance();
+ continue;
+ }
+
+ if (code === CHAR_LEFT_CURLY_BRACE$1) {
+ braces++;
+ continue;
+ }
+
+ if (braceEscaped !== true && code === CHAR_DOT$1 && (code = advance()) === CHAR_DOT$1) {
+ isBrace = token.isBrace = true;
+ isGlob = token.isGlob = true;
+ finished = true;
+
+ if (scanToEnd === true) {
+ continue;
+ }
+
+ break;
+ }
+
+ if (braceEscaped !== true && code === CHAR_COMMA$1) {
+ isBrace = token.isBrace = true;
+ isGlob = token.isGlob = true;
+ finished = true;
+
+ if (scanToEnd === true) {
+ continue;
+ }
+
+ break;
+ }
+
+ if (code === CHAR_RIGHT_CURLY_BRACE$1) {
+ braces--;
+
+ if (braces === 0) {
+ braceEscaped = false;
+ isBrace = token.isBrace = true;
+ finished = true;
+ break;
+ }
+ }
+ }
+
+ if (scanToEnd === true) {
+ continue;
+ }
+
+ break;
+ }
+
+ if (code === CHAR_FORWARD_SLASH) {
+ slashes.push(index);
+ tokens.push(token);
+ token = { value: '', depth: 0, isGlob: false };
+
+ if (finished === true) continue;
+ if (prev === CHAR_DOT$1 && index === (start + 1)) {
+ start += 2;
+ continue;
+ }
+
+ lastIndex = index + 1;
+ continue;
+ }
+
+ if (opts.noext !== true) {
+ const isExtglobChar = code === CHAR_PLUS
+ || code === CHAR_AT
+ || code === CHAR_ASTERISK
+ || code === CHAR_QUESTION_MARK
+ || code === CHAR_EXCLAMATION_MARK;
+
+ if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES$1) {
+ isGlob = token.isGlob = true;
+ isExtglob = token.isExtglob = true;
+ finished = true;
+ if (code === CHAR_EXCLAMATION_MARK && index === start) {
+ negatedExtglob = true;
+ }
+
+ if (scanToEnd === true) {
+ while (eos() !== true && (code = advance())) {
+ if (code === CHAR_BACKWARD_SLASH) {
+ backslashes = token.backslashes = true;
+ code = advance();
+ continue;
+ }
+
+ if (code === CHAR_RIGHT_PARENTHESES$1) {
+ isGlob = token.isGlob = true;
+ finished = true;
+ break;
+ }
+ }
+ continue;
+ }
+ break;
+ }
+ }
+
+ if (code === CHAR_ASTERISK) {
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
+ isGlob = token.isGlob = true;
+ finished = true;
+
+ if (scanToEnd === true) {
+ continue;
+ }
+ break;
+ }
+
+ if (code === CHAR_QUESTION_MARK) {
+ isGlob = token.isGlob = true;
+ finished = true;
+
+ if (scanToEnd === true) {
+ continue;
+ }
+ break;
+ }
+
+ if (code === CHAR_LEFT_SQUARE_BRACKET$1) {
+ while (eos() !== true && (next = advance())) {
+ if (next === CHAR_BACKWARD_SLASH) {
+ backslashes = token.backslashes = true;
+ advance();
+ continue;
+ }
+
+ if (next === CHAR_RIGHT_SQUARE_BRACKET$1) {
+ isBracket = token.isBracket = true;
+ isGlob = token.isGlob = true;
+ finished = true;
+ break;
+ }
+ }
+
+ if (scanToEnd === true) {
+ continue;
+ }
+
+ break;
+ }
+
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
+ negated = token.negated = true;
+ start++;
+ continue;
+ }
+
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES$1) {
+ isGlob = token.isGlob = true;
+
+ if (scanToEnd === true) {
+ while (eos() !== true && (code = advance())) {
+ if (code === CHAR_LEFT_PARENTHESES$1) {
+ backslashes = token.backslashes = true;
+ code = advance();
+ continue;
+ }
+
+ if (code === CHAR_RIGHT_PARENTHESES$1) {
+ finished = true;
+ break;
+ }
+ }
+ continue;
+ }
+ break;
+ }
+
+ if (isGlob === true) {
+ finished = true;
+
+ if (scanToEnd === true) {
+ continue;
+ }
+
+ break;
+ }
+ }
+
+ if (opts.noext === true) {
+ isExtglob = false;
+ isGlob = false;
+ }
+
+ let base = str;
+ let prefix = '';
+ let glob = '';
+
+ if (start > 0) {
+ prefix = str.slice(0, start);
+ str = str.slice(start);
+ lastIndex -= start;
+ }
+
+ if (base && isGlob === true && lastIndex > 0) {
+ base = str.slice(0, lastIndex);
+ glob = str.slice(lastIndex);
+ } else if (isGlob === true) {
+ base = '';
+ glob = str;
+ } else {
+ base = str;
+ }
+
+ if (base && base !== '' && base !== '/' && base !== str) {
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) {
+ base = base.slice(0, -1);
+ }
+ }
+
+ if (opts.unescape === true) {
+ if (glob) glob = utils$j.removeBackslashes(glob);
+
+ if (base && backslashes === true) {
+ base = utils$j.removeBackslashes(base);
+ }
+ }
+
+ const state = {
+ prefix,
+ input,
+ start,
+ base,
+ glob,
+ isBrace,
+ isBracket,
+ isGlob,
+ isExtglob,
+ isGlobstar,
+ negated,
+ negatedExtglob
+ };
+
+ if (opts.tokens === true) {
+ state.maxDepth = 0;
+ if (!isPathSeparator(code)) {
+ tokens.push(token);
+ }
+ state.tokens = tokens;
+ }
+
+ if (opts.parts === true || opts.tokens === true) {
+ let prevIndex;
+
+ for (let idx = 0; idx < slashes.length; idx++) {
+ const n = prevIndex ? prevIndex + 1 : start;
+ const i = slashes[idx];
+ const value = input.slice(n, i);
+ if (opts.tokens) {
+ if (idx === 0 && start !== 0) {
+ tokens[idx].isPrefix = true;
+ tokens[idx].value = prefix;
+ } else {
+ tokens[idx].value = value;
+ }
+ depth(tokens[idx]);
+ state.maxDepth += tokens[idx].depth;
+ }
+ if (idx !== 0 || value !== '') {
+ parts.push(value);
+ }
+ prevIndex = i;
+ }
+
+ if (prevIndex && prevIndex + 1 < input.length) {
+ const value = input.slice(prevIndex + 1);
+ parts.push(value);
+
+ if (opts.tokens) {
+ tokens[tokens.length - 1].value = value;
+ depth(tokens[tokens.length - 1]);
+ state.maxDepth += tokens[tokens.length - 1].depth;
+ }
+ }
+
+ state.slashes = slashes;
+ state.parts = parts;
+ }
+
+ return state;
+};
+
+var scan_1 = scan$2;
+
+const constants$5 = constants$6;
+const utils$i = utils$k;
+
+/**
+ * Constants
+ */
+
+const {
+ MAX_LENGTH: MAX_LENGTH$1,
+ POSIX_REGEX_SOURCE,
+ REGEX_NON_SPECIAL_CHARS,
+ REGEX_SPECIAL_CHARS_BACKREF,
+ REPLACEMENTS
+} = constants$5;
+
+/**
+ * Helpers
+ */
+
+const expandRange = (args, options) => {
+ if (typeof options.expandRange === 'function') {
+ return options.expandRange(...args, options);
+ }
+
+ args.sort();
+ const value = `[${args.join('-')}]`;
+
+ return value;
+};
+
+/**
+ * Create the message for a syntax error
+ */
+
+const syntaxError = (type, char) => {
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
+};
+
+/**
+ * Parse the given input string.
+ * @param {String} input
+ * @param {Object} options
+ * @return {Object}
+ */
+
+const parse$h = (input, options) => {
+ if (typeof input !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+
+ input = REPLACEMENTS[input] || input;
+
+ const opts = { ...options };
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$1, opts.maxLength) : MAX_LENGTH$1;
+
+ let len = input.length;
+ if (len > max) {
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
+ }
+
+ const bos = { type: 'bos', value: '', output: opts.prepend || '' };
+ const tokens = [bos];
+
+ const capture = opts.capture ? '' : '?:';
+ const win32 = utils$i.isWindows(options);
+
+ // create constants based on platform, for windows or posix
+ const PLATFORM_CHARS = constants$5.globChars(win32);
+ const EXTGLOB_CHARS = constants$5.extglobChars(PLATFORM_CHARS);
+
+ const {
+ DOT_LITERAL,
+ PLUS_LITERAL,
+ SLASH_LITERAL,
+ ONE_CHAR,
+ DOTS_SLASH,
+ NO_DOT,
+ NO_DOT_SLASH,
+ NO_DOTS_SLASH,
+ QMARK,
+ QMARK_NO_DOT,
+ STAR,
+ START_ANCHOR
+ } = PLATFORM_CHARS;
+
+ const globstar = opts => {
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
+ };
+
+ const nodot = opts.dot ? '' : NO_DOT;
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
+ let star = opts.bash === true ? globstar(opts) : STAR;
+
+ if (opts.capture) {
+ star = `(${star})`;
+ }
+
+ // minimatch options support
+ if (typeof opts.noext === 'boolean') {
+ opts.noextglob = opts.noext;
+ }
+
+ const state = {
+ input,
+ index: -1,
+ start: 0,
+ dot: opts.dot === true,
+ consumed: '',
+ output: '',
+ prefix: '',
+ backtrack: false,
+ negated: false,
+ brackets: 0,
+ braces: 0,
+ parens: 0,
+ quotes: 0,
+ globstar: false,
+ tokens
+ };
+
+ input = utils$i.removePrefix(input, state);
+ len = input.length;
+
+ const extglobs = [];
+ const braces = [];
+ const stack = [];
+ let prev = bos;
+ let value;
+
+ /**
+ * Tokenizing helpers
+ */
+
+ const eos = () => state.index === len - 1;
+ const peek = state.peek = (n = 1) => input[state.index + n];
+ const advance = state.advance = () => input[++state.index] || '';
+ const remaining = () => input.slice(state.index + 1);
+ const consume = (value = '', num = 0) => {
+ state.consumed += value;
+ state.index += num;
+ };
+
+ const append = token => {
+ state.output += token.output != null ? token.output : token.value;
+ consume(token.value);
+ };
+
+ const negate = () => {
+ let count = 1;
+
+ while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
+ advance();
+ state.start++;
+ count++;
+ }
+
+ if (count % 2 === 0) {
+ return false;
+ }
+
+ state.negated = true;
+ state.start++;
+ return true;
+ };
+
+ const increment = type => {
+ state[type]++;
+ stack.push(type);
+ };
+
+ const decrement = type => {
+ state[type]--;
+ stack.pop();
+ };
+
+ /**
+ * Push tokens onto the tokens array. This helper speeds up
+ * tokenizing by 1) helping us avoid backtracking as much as possible,
+ * and 2) helping us avoid creating extra tokens when consecutive
+ * characters are plain text. This improves performance and simplifies
+ * lookbehinds.
+ */
+
+ const push = tok => {
+ if (prev.type === 'globstar') {
+ const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
+ const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
+
+ if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
+ state.output = state.output.slice(0, -prev.output.length);
+ prev.type = 'star';
+ prev.value = '*';
+ prev.output = star;
+ state.output += prev.output;
+ }
+ }
+
+ if (extglobs.length && tok.type !== 'paren') {
+ extglobs[extglobs.length - 1].inner += tok.value;
+ }
+
+ if (tok.value || tok.output) append(tok);
+ if (prev && prev.type === 'text' && tok.type === 'text') {
+ prev.value += tok.value;
+ prev.output = (prev.output || '') + tok.value;
+ return;
+ }
+
+ tok.prev = prev;
+ tokens.push(tok);
+ prev = tok;
+ };
+
+ const extglobOpen = (type, value) => {
+ const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
+
+ token.prev = prev;
+ token.parens = state.parens;
+ token.output = state.output;
+ const output = (opts.capture ? '(' : '') + token.open;
+
+ increment('parens');
+ push({ type, value, output: state.output ? '' : ONE_CHAR });
+ push({ type: 'paren', extglob: true, value: advance(), output });
+ extglobs.push(token);
+ };
+
+ const extglobClose = token => {
+ let output = token.close + (opts.capture ? ')' : '');
+ let rest;
+
+ if (token.type === 'negate') {
+ let extglobStar = star;
+
+ if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
+ extglobStar = globstar(opts);
+ }
+
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
+ output = token.close = `)$))${extglobStar}`;
+ }
+
+ if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
+ // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
+ // In this case, we need to parse the string and use it in the output of the original pattern.
+ // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
+ //
+ // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
+ const expression = parse$h(rest, { ...options, fastpaths: false }).output;
+
+ output = token.close = `)${expression})${extglobStar})`;
+ }
+
+ if (token.prev.type === 'bos') {
+ state.negatedExtglob = true;
+ }
+ }
+
+ push({ type: 'paren', extglob: true, value, output });
+ decrement('parens');
+ };
+
+ /**
+ * Fast paths
+ */
+
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
+ let backslashes = false;
+
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
+ if (first === '\\') {
+ backslashes = true;
+ return m;
+ }
+
+ if (first === '?') {
+ if (esc) {
+ return esc + first + (rest ? QMARK.repeat(rest.length) : '');
+ }
+ if (index === 0) {
+ return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
+ }
+ return QMARK.repeat(chars.length);
+ }
+
+ if (first === '.') {
+ return DOT_LITERAL.repeat(chars.length);
+ }
+
+ if (first === '*') {
+ if (esc) {
+ return esc + first + (rest ? star : '');
+ }
+ return star;
+ }
+ return esc ? m : `\\${m}`;
+ });
+
+ if (backslashes === true) {
+ if (opts.unescape === true) {
+ output = output.replace(/\\/g, '');
+ } else {
+ output = output.replace(/\\+/g, m => {
+ return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
+ });
+ }
+ }
+
+ if (output === input && opts.contains === true) {
+ state.output = input;
+ return state;
+ }
+
+ state.output = utils$i.wrapOutput(output, state, options);
+ return state;
+ }
+
+ /**
+ * Tokenize input until we reach end-of-string
+ */
+
+ while (!eos()) {
+ value = advance();
+
+ if (value === '\u0000') {
+ continue;
+ }
+
+ /**
+ * Escaped characters
+ */
+
+ if (value === '\\') {
+ const next = peek();
+
+ if (next === '/' && opts.bash !== true) {
+ continue;
+ }
+
+ if (next === '.' || next === ';') {
+ continue;
+ }
+
+ if (!next) {
+ value += '\\';
+ push({ type: 'text', value });
+ continue;
+ }
+
+ // collapse slashes to reduce potential for exploits
+ const match = /^\\+/.exec(remaining());
+ let slashes = 0;
+
+ if (match && match[0].length > 2) {
+ slashes = match[0].length;
+ state.index += slashes;
+ if (slashes % 2 !== 0) {
+ value += '\\';
+ }
+ }
+
+ if (opts.unescape === true) {
+ value = advance();
+ } else {
+ value += advance();
+ }
+
+ if (state.brackets === 0) {
+ push({ type: 'text', value });
+ continue;
+ }
+ }
+
+ /**
+ * If we're inside a regex character class, continue
+ * until we reach the closing bracket.
+ */
+
+ if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
+ if (opts.posix !== false && value === ':') {
+ const inner = prev.value.slice(1);
+ if (inner.includes('[')) {
+ prev.posix = true;
+
+ if (inner.includes(':')) {
+ const idx = prev.value.lastIndexOf('[');
+ const pre = prev.value.slice(0, idx);
+ const rest = prev.value.slice(idx + 2);
+ const posix = POSIX_REGEX_SOURCE[rest];
+ if (posix) {
+ prev.value = pre + posix;
+ state.backtrack = true;
+ advance();
+
+ if (!bos.output && tokens.indexOf(prev) === 1) {
+ bos.output = ONE_CHAR;
+ }
+ continue;
+ }
+ }
+ }
+ }
+
+ if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
+ value = `\\${value}`;
+ }
+
+ if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
+ value = `\\${value}`;
+ }
+
+ if (opts.posix === true && value === '!' && prev.value === '[') {
+ value = '^';
+ }
+
+ prev.value += value;
+ append({ value });
+ continue;
+ }
+
+ /**
+ * If we're inside a quoted string, continue
+ * until we reach the closing double quote.
+ */
+
+ if (state.quotes === 1 && value !== '"') {
+ value = utils$i.escapeRegex(value);
+ prev.value += value;
+ append({ value });
+ continue;
+ }
+
+ /**
+ * Double quotes
+ */
+
+ if (value === '"') {
+ state.quotes = state.quotes === 1 ? 0 : 1;
+ if (opts.keepQuotes === true) {
+ push({ type: 'text', value });
+ }
+ continue;
+ }
+
+ /**
+ * Parentheses
+ */
+
+ if (value === '(') {
+ increment('parens');
+ push({ type: 'paren', value });
+ continue;
+ }
+
+ if (value === ')') {
+ if (state.parens === 0 && opts.strictBrackets === true) {
+ throw new SyntaxError(syntaxError('opening', '('));
+ }
+
+ const extglob = extglobs[extglobs.length - 1];
+ if (extglob && state.parens === extglob.parens + 1) {
+ extglobClose(extglobs.pop());
+ continue;
+ }
+
+ push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
+ decrement('parens');
+ continue;
+ }
+
+ /**
+ * Square brackets
+ */
+
+ if (value === '[') {
+ if (opts.nobracket === true || !remaining().includes(']')) {
+ if (opts.nobracket !== true && opts.strictBrackets === true) {
+ throw new SyntaxError(syntaxError('closing', ']'));
+ }
+
+ value = `\\${value}`;
+ } else {
+ increment('brackets');
+ }
+
+ push({ type: 'bracket', value });
+ continue;
+ }
+
+ if (value === ']') {
+ if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
+ push({ type: 'text', value, output: `\\${value}` });
+ continue;
+ }
+
+ if (state.brackets === 0) {
+ if (opts.strictBrackets === true) {
+ throw new SyntaxError(syntaxError('opening', '['));
+ }
+
+ push({ type: 'text', value, output: `\\${value}` });
+ continue;
+ }
+
+ decrement('brackets');
+
+ const prevValue = prev.value.slice(1);
+ if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
+ value = `/${value}`;
+ }
+
+ prev.value += value;
+ append({ value });
+
+ // when literal brackets are explicitly disabled
+ // assume we should match with a regex character class
+ if (opts.literalBrackets === false || utils$i.hasRegexChars(prevValue)) {
+ continue;
+ }
+
+ const escaped = utils$i.escapeRegex(prev.value);
+ state.output = state.output.slice(0, -prev.value.length);
+
+ // when literal brackets are explicitly enabled
+ // assume we should escape the brackets to match literal characters
+ if (opts.literalBrackets === true) {
+ state.output += escaped;
+ prev.value = escaped;
+ continue;
+ }
+
+ // when the user specifies nothing, try to match both
+ prev.value = `(${capture}${escaped}|${prev.value})`;
+ state.output += prev.value;
+ continue;
+ }
+
+ /**
+ * Braces
+ */
+
+ if (value === '{' && opts.nobrace !== true) {
+ increment('braces');
+
+ const open = {
+ type: 'brace',
+ value,
+ output: '(',
+ outputIndex: state.output.length,
+ tokensIndex: state.tokens.length
+ };
+
+ braces.push(open);
+ push(open);
+ continue;
+ }
+
+ if (value === '}') {
+ const brace = braces[braces.length - 1];
+
+ if (opts.nobrace === true || !brace) {
+ push({ type: 'text', value, output: value });
+ continue;
+ }
+
+ let output = ')';
+
+ if (brace.dots === true) {
+ const arr = tokens.slice();
+ const range = [];
+
+ for (let i = arr.length - 1; i >= 0; i--) {
+ tokens.pop();
+ if (arr[i].type === 'brace') {
+ break;
+ }
+ if (arr[i].type !== 'dots') {
+ range.unshift(arr[i].value);
+ }
+ }
+
+ output = expandRange(range, opts);
+ state.backtrack = true;
+ }
+
+ if (brace.comma !== true && brace.dots !== true) {
+ const out = state.output.slice(0, brace.outputIndex);
+ const toks = state.tokens.slice(brace.tokensIndex);
+ brace.value = brace.output = '\\{';
+ value = output = '\\}';
+ state.output = out;
+ for (const t of toks) {
+ state.output += (t.output || t.value);
+ }
+ }
+
+ push({ type: 'brace', value, output });
+ decrement('braces');
+ braces.pop();
+ continue;
+ }
+
+ /**
+ * Pipes
+ */
+
+ if (value === '|') {
+ if (extglobs.length > 0) {
+ extglobs[extglobs.length - 1].conditions++;
+ }
+ push({ type: 'text', value });
+ continue;
+ }
+
+ /**
+ * Commas
+ */
+
+ if (value === ',') {
+ let output = value;
+
+ const brace = braces[braces.length - 1];
+ if (brace && stack[stack.length - 1] === 'braces') {
+ brace.comma = true;
+ output = '|';
+ }
+
+ push({ type: 'comma', value, output });
+ continue;
+ }
+
+ /**
+ * Slashes
+ */
+
+ if (value === '/') {
+ // if the beginning of the glob is "./", advance the start
+ // to the current index, and don't add the "./" characters
+ // to the state. This greatly simplifies lookbehinds when
+ // checking for BOS characters like "!" and "." (not "./")
+ if (prev.type === 'dot' && state.index === state.start + 1) {
+ state.start = state.index + 1;
+ state.consumed = '';
+ state.output = '';
+ tokens.pop();
+ prev = bos; // reset "prev" to the first token
+ continue;
+ }
+
+ push({ type: 'slash', value, output: SLASH_LITERAL });
+ continue;
+ }
+
+ /**
+ * Dots
+ */
+
+ if (value === '.') {
+ if (state.braces > 0 && prev.type === 'dot') {
+ if (prev.value === '.') prev.output = DOT_LITERAL;
+ const brace = braces[braces.length - 1];
+ prev.type = 'dots';
+ prev.output += value;
+ prev.value += value;
+ brace.dots = true;
+ continue;
+ }
+
+ if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
+ push({ type: 'text', value, output: DOT_LITERAL });
+ continue;
+ }
+
+ push({ type: 'dot', value, output: DOT_LITERAL });
+ continue;
+ }
+
+ /**
+ * Question marks
+ */
+
+ if (value === '?') {
+ const isGroup = prev && prev.value === '(';
+ if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
+ extglobOpen('qmark', value);
+ continue;
+ }
+
+ if (prev && prev.type === 'paren') {
+ const next = peek();
+ let output = value;
+
+ if (next === '<' && !utils$i.supportsLookbehinds()) {
+ throw new Error('Node.js v10 or higher is required for regex lookbehinds');
+ }
+
+ if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
+ output = `\\${value}`;
+ }
+
+ push({ type: 'text', value, output });
+ continue;
+ }
+
+ if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
+ push({ type: 'qmark', value, output: QMARK_NO_DOT });
+ continue;
+ }
+
+ push({ type: 'qmark', value, output: QMARK });
+ continue;
+ }
+
+ /**
+ * Exclamation
+ */
+
+ if (value === '!') {
+ if (opts.noextglob !== true && peek() === '(') {
+ if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
+ extglobOpen('negate', value);
+ continue;
+ }
+ }
+
+ if (opts.nonegate !== true && state.index === 0) {
+ negate();
+ continue;
+ }
+ }
+
+ /**
+ * Plus
+ */
+
+ if (value === '+') {
+ if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
+ extglobOpen('plus', value);
+ continue;
+ }
+
+ if ((prev && prev.value === '(') || opts.regex === false) {
+ push({ type: 'plus', value, output: PLUS_LITERAL });
+ continue;
+ }
+
+ if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
+ push({ type: 'plus', value });
+ continue;
+ }
+
+ push({ type: 'plus', value: PLUS_LITERAL });
+ continue;
+ }
+
+ /**
+ * Plain text
+ */
+
+ if (value === '@') {
+ if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
+ push({ type: 'at', extglob: true, value, output: '' });
+ continue;
+ }
+
+ push({ type: 'text', value });
+ continue;
+ }
+
+ /**
+ * Plain text
+ */
+
+ if (value !== '*') {
+ if (value === '$' || value === '^') {
+ value = `\\${value}`;
+ }
+
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
+ if (match) {
+ value += match[0];
+ state.index += match[0].length;
+ }
+
+ push({ type: 'text', value });
+ continue;
+ }
+
+ /**
+ * Stars
+ */
+
+ if (prev && (prev.type === 'globstar' || prev.star === true)) {
+ prev.type = 'star';
+ prev.star = true;
+ prev.value += value;
+ prev.output = star;
+ state.backtrack = true;
+ state.globstar = true;
+ consume(value);
+ continue;
+ }
+
+ let rest = remaining();
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
+ extglobOpen('star', value);
+ continue;
+ }
+
+ if (prev.type === 'star') {
+ if (opts.noglobstar === true) {
+ consume(value);
+ continue;
+ }
+
+ const prior = prev.prev;
+ const before = prior.prev;
+ const isStart = prior.type === 'slash' || prior.type === 'bos';
+ const afterStar = before && (before.type === 'star' || before.type === 'globstar');
+
+ if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
+ push({ type: 'star', value, output: '' });
+ continue;
+ }
+
+ const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
+ const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
+ if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
+ push({ type: 'star', value, output: '' });
+ continue;
+ }
+
+ // strip consecutive `/**/`
+ while (rest.slice(0, 3) === '/**') {
+ const after = input[state.index + 4];
+ if (after && after !== '/') {
+ break;
+ }
+ rest = rest.slice(3);
+ consume('/**', 3);
+ }
+
+ if (prior.type === 'bos' && eos()) {
+ prev.type = 'globstar';
+ prev.value += value;
+ prev.output = globstar(opts);
+ state.output = prev.output;
+ state.globstar = true;
+ consume(value);
+ continue;
+ }
+
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
+ prior.output = `(?:${prior.output}`;
+
+ prev.type = 'globstar';
+ prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
+ prev.value += value;
+ state.globstar = true;
+ state.output += prior.output + prev.output;
+ consume(value);
+ continue;
+ }
+
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
+ const end = rest[1] !== void 0 ? '|$' : '';
+
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
+ prior.output = `(?:${prior.output}`;
+
+ prev.type = 'globstar';
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
+ prev.value += value;
+
+ state.output += prior.output + prev.output;
+ state.globstar = true;
+
+ consume(value + advance());
+
+ push({ type: 'slash', value: '/', output: '' });
+ continue;
+ }
+
+ if (prior.type === 'bos' && rest[0] === '/') {
+ prev.type = 'globstar';
+ prev.value += value;
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
+ state.output = prev.output;
+ state.globstar = true;
+ consume(value + advance());
+ push({ type: 'slash', value: '/', output: '' });
+ continue;
+ }
+
+ // remove single star from output
+ state.output = state.output.slice(0, -prev.output.length);
+
+ // reset previous token to globstar
+ prev.type = 'globstar';
+ prev.output = globstar(opts);
+ prev.value += value;
+
+ // reset output with globstar
+ state.output += prev.output;
+ state.globstar = true;
+ consume(value);
+ continue;
+ }
+
+ const token = { type: 'star', value, output: star };
+
+ if (opts.bash === true) {
+ token.output = '.*?';
+ if (prev.type === 'bos' || prev.type === 'slash') {
+ token.output = nodot + token.output;
+ }
+ push(token);
+ continue;
+ }
+
+ if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
+ token.output = value;
+ push(token);
+ continue;
+ }
+
+ if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
+ if (prev.type === 'dot') {
+ state.output += NO_DOT_SLASH;
+ prev.output += NO_DOT_SLASH;
+
+ } else if (opts.dot === true) {
+ state.output += NO_DOTS_SLASH;
+ prev.output += NO_DOTS_SLASH;
+
+ } else {
+ state.output += nodot;
+ prev.output += nodot;
+ }
+
+ if (peek() !== '*') {
+ state.output += ONE_CHAR;
+ prev.output += ONE_CHAR;
+ }
+ }
+
+ push(token);
+ }
+
+ while (state.brackets > 0) {
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
+ state.output = utils$i.escapeLast(state.output, '[');
+ decrement('brackets');
+ }
+
+ while (state.parens > 0) {
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
+ state.output = utils$i.escapeLast(state.output, '(');
+ decrement('parens');
+ }
+
+ while (state.braces > 0) {
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
+ state.output = utils$i.escapeLast(state.output, '{');
+ decrement('braces');
+ }
+
+ if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
+ push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
+ }
+
+ // rebuild the output if we had to backtrack at any point
+ if (state.backtrack === true) {
+ state.output = '';
+
+ for (const token of state.tokens) {
+ state.output += token.output != null ? token.output : token.value;
+
+ if (token.suffix) {
+ state.output += token.suffix;
+ }
+ }
+ }
+
+ return state;
+};
+
+/**
+ * Fast paths for creating regular expressions for common glob patterns.
+ * This can significantly speed up processing and has very little downside
+ * impact when none of the fast paths match.
+ */
+
+parse$h.fastpaths = (input, options) => {
+ const opts = { ...options };
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$1, opts.maxLength) : MAX_LENGTH$1;
+ const len = input.length;
+ if (len > max) {
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
+ }
+
+ input = REPLACEMENTS[input] || input;
+ const win32 = utils$i.isWindows(options);
+
+ // create constants based on platform, for windows or posix
+ const {
+ DOT_LITERAL,
+ SLASH_LITERAL,
+ ONE_CHAR,
+ DOTS_SLASH,
+ NO_DOT,
+ NO_DOTS,
+ NO_DOTS_SLASH,
+ STAR,
+ START_ANCHOR
+ } = constants$5.globChars(win32);
+
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
+ const capture = opts.capture ? '' : '?:';
+ const state = { negated: false, prefix: '' };
+ let star = opts.bash === true ? '.*?' : STAR;
+
+ if (opts.capture) {
+ star = `(${star})`;
+ }
+
+ const globstar = opts => {
+ if (opts.noglobstar === true) return star;
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
+ };
+
+ const create = str => {
+ switch (str) {
+ case '*':
+ return `${nodot}${ONE_CHAR}${star}`;
+
+ case '.*':
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
+
+ case '*.*':
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
+
+ case '*/*':
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
+
+ case '**':
+ return nodot + globstar(opts);
+
+ case '**/*':
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
+
+ case '**/*.*':
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
+
+ case '**/.*':
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
+
+ default: {
+ const match = /^(.*?)\.(\w+)$/.exec(str);
+ if (!match) return;
+
+ const source = create(match[1]);
+ if (!source) return;
+
+ return source + DOT_LITERAL + match[2];
+ }
+ }
+ };
+
+ const output = utils$i.removePrefix(input, state);
+ let source = create(output);
+
+ if (source && opts.strictSlashes !== true) {
+ source += `${SLASH_LITERAL}?`;
+ }
+
+ return source;
+};
+
+var parse_1$3 = parse$h;
+
+const path$m = require$$0$4;
+const scan$1 = scan_1;
+const parse$g = parse_1$3;
+const utils$h = utils$k;
+const constants$4 = constants$6;
+const isObject$4 = val => val && typeof val === 'object' && !Array.isArray(val);
+
+/**
+ * Creates a matcher function from one or more glob patterns. The
+ * returned function takes a string to match as its first argument,
+ * and returns true if the string is a match. The returned matcher
+ * function also takes a boolean as the second argument that, when true,
+ * returns an object with additional information.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * // picomatch(glob[, options]);
+ *
+ * const isMatch = picomatch('*.!(*a)');
+ * console.log(isMatch('a.a')); //=> false
+ * console.log(isMatch('a.b')); //=> true
+ * ```
+ * @name picomatch
+ * @param {String|Array} `globs` One or more glob patterns.
+ * @param {Object=} `options`
+ * @return {Function=} Returns a matcher function.
+ * @api public
+ */
+
+const picomatch$5 = (glob, options, returnState = false) => {
+ if (Array.isArray(glob)) {
+ const fns = glob.map(input => picomatch$5(input, options, returnState));
+ const arrayMatcher = str => {
+ for (const isMatch of fns) {
+ const state = isMatch(str);
+ if (state) return state;
+ }
+ return false;
+ };
+ return arrayMatcher;
+ }
+
+ const isState = isObject$4(glob) && glob.tokens && glob.input;
+
+ if (glob === '' || (typeof glob !== 'string' && !isState)) {
+ throw new TypeError('Expected pattern to be a non-empty string');
+ }
+
+ const opts = options || {};
+ const posix = utils$h.isWindows(options);
+ const regex = isState
+ ? picomatch$5.compileRe(glob, options)
+ : picomatch$5.makeRe(glob, options, false, true);
+
+ const state = regex.state;
+ delete regex.state;
+
+ let isIgnored = () => false;
+ if (opts.ignore) {
+ const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
+ isIgnored = picomatch$5(opts.ignore, ignoreOpts, returnState);
+ }
+
+ const matcher = (input, returnObject = false) => {
+ const { isMatch, match, output } = picomatch$5.test(input, regex, options, { glob, posix });
+ const result = { glob, state, regex, posix, input, output, match, isMatch };
+
+ if (typeof opts.onResult === 'function') {
+ opts.onResult(result);
+ }
+
+ if (isMatch === false) {
+ result.isMatch = false;
+ return returnObject ? result : false;
+ }
+
+ if (isIgnored(input)) {
+ if (typeof opts.onIgnore === 'function') {
+ opts.onIgnore(result);
+ }
+ result.isMatch = false;
+ return returnObject ? result : false;
+ }
+
+ if (typeof opts.onMatch === 'function') {
+ opts.onMatch(result);
+ }
+ return returnObject ? result : true;
+ };
+
+ if (returnState) {
+ matcher.state = state;
+ }
+
+ return matcher;
+};
+
+/**
+ * Test `input` with the given `regex`. This is used by the main
+ * `picomatch()` function to test the input string.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * // picomatch.test(input, regex[, options]);
+ *
+ * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
+ * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
+ * ```
+ * @param {String} `input` String to test.
+ * @param {RegExp} `regex`
+ * @return {Object} Returns an object with matching info.
+ * @api public
+ */
+
+picomatch$5.test = (input, regex, options, { glob, posix } = {}) => {
+ if (typeof input !== 'string') {
+ throw new TypeError('Expected input to be a string');
+ }
+
+ if (input === '') {
+ return { isMatch: false, output: '' };
+ }
+
+ const opts = options || {};
+ const format = opts.format || (posix ? utils$h.toPosixSlashes : null);
+ let match = input === glob;
+ let output = (match && format) ? format(input) : input;
+
+ if (match === false) {
+ output = format ? format(input) : input;
+ match = output === glob;
+ }
+
+ if (match === false || opts.capture === true) {
+ if (opts.matchBase === true || opts.basename === true) {
+ match = picomatch$5.matchBase(input, regex, options, posix);
+ } else {
+ match = regex.exec(output);
+ }
+ }
+
+ return { isMatch: Boolean(match), match, output };
+};
+
+/**
+ * Match the basename of a filepath.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * // picomatch.matchBase(input, glob[, options]);
+ * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
+ * ```
+ * @param {String} `input` String to test.
+ * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
+ * @return {Boolean}
+ * @api public
+ */
+
+picomatch$5.matchBase = (input, glob, options, posix = utils$h.isWindows(options)) => {
+ const regex = glob instanceof RegExp ? glob : picomatch$5.makeRe(glob, options);
+ return regex.test(path$m.basename(input));
+};
+
+/**
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * // picomatch.isMatch(string, patterns[, options]);
+ *
+ * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
+ * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
+ * ```
+ * @param {String|Array} str The string to test.
+ * @param {String|Array} patterns One or more glob patterns to use for matching.
+ * @param {Object} [options] See available [options](#options).
+ * @return {Boolean} Returns true if any patterns match `str`
+ * @api public
+ */
+
+picomatch$5.isMatch = (str, patterns, options) => picomatch$5(patterns, options)(str);
+
+/**
+ * Parse a glob pattern to create the source string for a regular
+ * expression.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * const result = picomatch.parse(pattern[, options]);
+ * ```
+ * @param {String} `pattern`
+ * @param {Object} `options`
+ * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
+ * @api public
+ */
+
+picomatch$5.parse = (pattern, options) => {
+ if (Array.isArray(pattern)) return pattern.map(p => picomatch$5.parse(p, options));
+ return parse$g(pattern, { ...options, fastpaths: false });
+};
+
+/**
+ * Scan a glob pattern to separate the pattern into segments.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * // picomatch.scan(input[, options]);
+ *
+ * const result = picomatch.scan('!./foo/*.js');
+ * console.log(result);
+ * { prefix: '!./',
+ * input: '!./foo/*.js',
+ * start: 3,
+ * base: 'foo',
+ * glob: '*.js',
+ * isBrace: false,
+ * isBracket: false,
+ * isGlob: true,
+ * isExtglob: false,
+ * isGlobstar: false,
+ * negated: true }
+ * ```
+ * @param {String} `input` Glob pattern to scan.
+ * @param {Object} `options`
+ * @return {Object} Returns an object with
+ * @api public
+ */
+
+picomatch$5.scan = (input, options) => scan$1(input, options);
+
+/**
+ * Compile a regular expression from the `state` object returned by the
+ * [parse()](#parse) method.
+ *
+ * @param {Object} `state`
+ * @param {Object} `options`
+ * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
+ * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
+ * @return {RegExp}
+ * @api public
+ */
+
+picomatch$5.compileRe = (state, options, returnOutput = false, returnState = false) => {
+ if (returnOutput === true) {
+ return state.output;
+ }
+
+ const opts = options || {};
+ const prepend = opts.contains ? '' : '^';
+ const append = opts.contains ? '' : '$';
+
+ let source = `${prepend}(?:${state.output})${append}`;
+ if (state && state.negated === true) {
+ source = `^(?!${source}).*$`;
+ }
+
+ const regex = picomatch$5.toRegex(source, options);
+ if (returnState === true) {
+ regex.state = state;
+ }
+
+ return regex;
+};
+
+/**
+ * Create a regular expression from a parsed glob pattern.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * const state = picomatch.parse('*.js');
+ * // picomatch.compileRe(state[, options]);
+ *
+ * console.log(picomatch.compileRe(state));
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
+ * ```
+ * @param {String} `state` The object returned from the `.parse` method.
+ * @param {Object} `options`
+ * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
+ * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
+ * @return {RegExp} Returns a regex created from the given pattern.
+ * @api public
+ */
+
+picomatch$5.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
+ if (!input || typeof input !== 'string') {
+ throw new TypeError('Expected a non-empty string');
+ }
+
+ let parsed = { negated: false, fastpaths: true };
+
+ if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
+ parsed.output = parse$g.fastpaths(input, options);
+ }
+
+ if (!parsed.output) {
+ parsed = parse$g(input, options);
+ }
+
+ return picomatch$5.compileRe(parsed, options, returnOutput, returnState);
+};
+
+/**
+ * Create a regular expression from the given regex source string.
+ *
+ * ```js
+ * const picomatch = require('picomatch');
+ * // picomatch.toRegex(source[, options]);
+ *
+ * const { output } = picomatch.parse('*.js');
+ * console.log(picomatch.toRegex(output));
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
+ * ```
+ * @param {String} `source` Regular expression source string.
+ * @param {Object} `options`
+ * @return {RegExp}
+ * @api public
+ */
+
+picomatch$5.toRegex = (source, options) => {
+ try {
+ const opts = options || {};
+ return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
+ } catch (err) {
+ if (options && options.debug === true) throw err;
+ return /$^/;
+ }
+};
+
+/**
+ * Picomatch constants.
+ * @return {Object}
+ */
+
+picomatch$5.constants = constants$4;
+
+/**
+ * Expose "picomatch"
+ */
+
+var picomatch_1 = picomatch$5;
+
+var picomatch$3 = picomatch_1;
+
+var picomatch$4 = /*@__PURE__*/getDefaultExportFromCjs(picomatch$3);
+
+const extractors = {
+ ArrayPattern(names, param) {
+ for (const element of param.elements) {
+ if (element)
+ extractors[element.type](names, element);
+ }
+ },
+ AssignmentPattern(names, param) {
+ extractors[param.left.type](names, param.left);
+ },
+ Identifier(names, param) {
+ names.push(param.name);
+ },
+ MemberExpression() { },
+ ObjectPattern(names, param) {
+ for (const prop of param.properties) {
+ // @ts-ignore Typescript reports that this is not a valid type
+ if (prop.type === 'RestElement') {
+ extractors.RestElement(names, prop);
+ }
+ else {
+ extractors[prop.value.type](names, prop.value);
+ }
+ }
+ },
+ RestElement(names, param) {
+ extractors[param.argument.type](names, param.argument);
+ }
+};
+const extractAssignedNames = function extractAssignedNames(param) {
+ const names = [];
+ extractors[param.type](names, param);
+ return names;
+};
+
+const blockDeclarations = {
+ const: true,
+ let: true
+};
+let Scope$1 = class Scope {
+ constructor(options = {}) {
+ this.parent = options.parent;
+ this.isBlockScope = !!options.block;
+ this.declarations = Object.create(null);
+ if (options.params) {
+ options.params.forEach((param) => {
+ extractAssignedNames(param).forEach((name) => {
+ this.declarations[name] = true;
+ });
+ });
+ }
+ }
+ addDeclaration(node, isBlockDeclaration, isVar) {
+ if (!isBlockDeclaration && this.isBlockScope) {
+ // it's a `var` or function node, and this
+ // is a block scope, so we need to go up
+ this.parent.addDeclaration(node, isBlockDeclaration, isVar);
+ }
+ else if (node.id) {
+ extractAssignedNames(node.id).forEach((name) => {
+ this.declarations[name] = true;
+ });
+ }
+ }
+ contains(name) {
+ return this.declarations[name] || (this.parent ? this.parent.contains(name) : false);
+ }
+};
+const attachScopes = function attachScopes(ast, propertyName = 'scope') {
+ let scope = new Scope$1();
+ walk$4(ast, {
+ enter(n, parent) {
+ const node = n;
+ // function foo () {...}
+ // class Foo {...}
+ if (/(Function|Class)Declaration/.test(node.type)) {
+ scope.addDeclaration(node, false, false);
+ }
+ // var foo = 1
+ if (node.type === 'VariableDeclaration') {
+ const { kind } = node;
+ const isBlockDeclaration = blockDeclarations[kind];
+ node.declarations.forEach((declaration) => {
+ scope.addDeclaration(declaration, isBlockDeclaration, true);
+ });
+ }
+ let newScope;
+ // create new function scope
+ if (/Function/.test(node.type)) {
+ const func = node;
+ newScope = new Scope$1({
+ parent: scope,
+ block: false,
+ params: func.params
+ });
+ // named function expressions - the name is considered
+ // part of the function's scope
+ if (func.type === 'FunctionExpression' && func.id) {
+ newScope.addDeclaration(func, false, false);
+ }
+ }
+ // create new for scope
+ if (/For(In|Of)?Statement/.test(node.type)) {
+ newScope = new Scope$1({
+ parent: scope,
+ block: true
+ });
+ }
+ // create new block scope
+ if (node.type === 'BlockStatement' && !/Function/.test(parent.type)) {
+ newScope = new Scope$1({
+ parent: scope,
+ block: true
+ });
+ }
+ // catch clause has its own block scope
+ if (node.type === 'CatchClause') {
+ newScope = new Scope$1({
+ parent: scope,
+ params: node.param ? [node.param] : [],
+ block: true
+ });
+ }
+ if (newScope) {
+ Object.defineProperty(node, propertyName, {
+ value: newScope,
+ configurable: true
+ });
+ scope = newScope;
+ }
+ },
+ leave(n) {
+ const node = n;
+ if (node[propertyName])
+ scope = scope.parent;
+ }
+ });
+ return scope;
+};
+
+// Helper since Typescript can't detect readonly arrays with Array.isArray
+function isArray$2(arg) {
+ return Array.isArray(arg);
+}
+function ensureArray(thing) {
+ if (isArray$2(thing))
+ return thing;
+ if (thing == null)
+ return [];
+ return [thing];
+}
+
+const normalizePath$5 = function normalizePath(filename) {
+ return filename.split(win32.sep).join(posix.sep);
+};
+
+function getMatcherString(id, resolutionBase) {
+ if (resolutionBase === false || isAbsolute$1(id) || id.startsWith('*')) {
+ return normalizePath$5(id);
+ }
+ // resolve('') is valid and will default to process.cwd()
+ const basePath = normalizePath$5(resolve$3(resolutionBase || ''))
+ // escape all possible (posix + win) path characters that might interfere with regex
+ .replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
+ // Note that we use posix.join because:
+ // 1. the basePath has been normalized to use /
+ // 2. the incoming glob (id) matcher, also uses /
+ // otherwise Node will force backslash (\) on windows
+ return posix.join(basePath, normalizePath$5(id));
+}
+const createFilter$1 = function createFilter(include, exclude, options) {
+ const resolutionBase = options && options.resolve;
+ const getMatcher = (id) => id instanceof RegExp
+ ? id
+ : {
+ test: (what) => {
+ // this refactor is a tad overly verbose but makes for easy debugging
+ const pattern = getMatcherString(id, resolutionBase);
+ const fn = picomatch$4(pattern, { dot: true });
+ const result = fn(what);
+ return result;
+ }
+ };
+ const includeMatchers = ensureArray(include).map(getMatcher);
+ const excludeMatchers = ensureArray(exclude).map(getMatcher);
+ return function result(id) {
+ if (typeof id !== 'string')
+ return false;
+ if (/\0/.test(id))
+ return false;
+ const pathId = normalizePath$5(id);
+ for (let i = 0; i < excludeMatchers.length; ++i) {
+ const matcher = excludeMatchers[i];
+ if (matcher.test(pathId))
+ return false;
+ }
+ for (let i = 0; i < includeMatchers.length; ++i) {
+ const matcher = includeMatchers[i];
+ if (matcher.test(pathId))
+ return true;
+ }
+ return !includeMatchers.length;
+ };
+};
+
+const reservedWords$1 = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
+const builtins$1 = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
+const forbiddenIdentifiers = new Set(`${reservedWords$1} ${builtins$1}`.split(' '));
+forbiddenIdentifiers.add('');
+const makeLegalIdentifier = function makeLegalIdentifier(str) {
+ let identifier = str
+ .replace(/-(\w)/g, (_, letter) => letter.toUpperCase())
+ .replace(/[^$_a-zA-Z0-9]/g, '_');
+ if (/\d/.test(identifier[0]) || forbiddenIdentifiers.has(identifier)) {
+ identifier = `_${identifier}`;
+ }
+ return identifier || '_';
+};
+
+function stringify$8(obj) {
+ return (JSON.stringify(obj) || 'undefined').replace(/[\u2028\u2029]/g, (char) => `\\u${`000${char.charCodeAt(0).toString(16)}`.slice(-4)}`);
+}
+function serializeArray(arr, indent, baseIndent) {
+ let output = '[';
+ const separator = indent ? `\n${baseIndent}${indent}` : '';
+ for (let i = 0; i < arr.length; i++) {
+ const key = arr[i];
+ output += `${i > 0 ? ',' : ''}${separator}${serialize(key, indent, baseIndent + indent)}`;
+ }
+ return `${output}${indent ? `\n${baseIndent}` : ''}]`;
+}
+function serializeObject(obj, indent, baseIndent) {
+ let output = '{';
+ const separator = indent ? `\n${baseIndent}${indent}` : '';
+ const entries = Object.entries(obj);
+ for (let i = 0; i < entries.length; i++) {
+ const [key, value] = entries[i];
+ const stringKey = makeLegalIdentifier(key) === key ? key : stringify$8(key);
+ output += `${i > 0 ? ',' : ''}${separator}${stringKey}:${indent ? ' ' : ''}${serialize(value, indent, baseIndent + indent)}`;
+ }
+ return `${output}${indent ? `\n${baseIndent}` : ''}}`;
+}
+function serialize(obj, indent, baseIndent) {
+ if (typeof obj === 'object' && obj !== null) {
+ if (Array.isArray(obj))
+ return serializeArray(obj, indent, baseIndent);
+ if (obj instanceof Date)
+ return `new Date(${obj.getTime()})`;
+ if (obj instanceof RegExp)
+ return obj.toString();
+ return serializeObject(obj, indent, baseIndent);
+ }
+ if (typeof obj === 'number') {
+ if (obj === Infinity)
+ return 'Infinity';
+ if (obj === -Infinity)
+ return '-Infinity';
+ if (obj === 0)
+ return 1 / obj === Infinity ? '0' : '-0';
+ if (obj !== obj)
+ return 'NaN'; // eslint-disable-line no-self-compare
+ }
+ if (typeof obj === 'symbol') {
+ const key = Symbol.keyFor(obj);
+ // eslint-disable-next-line no-undefined
+ if (key !== undefined)
+ return `Symbol.for(${stringify$8(key)})`;
+ }
+ if (typeof obj === 'bigint')
+ return `${obj}n`;
+ return stringify$8(obj);
+}
+const dataToEsm = function dataToEsm(data, options = {}) {
+ const t = options.compact ? '' : 'indent' in options ? options.indent : '\t';
+ const _ = options.compact ? '' : ' ';
+ const n = options.compact ? '' : '\n';
+ const declarationType = options.preferConst ? 'const' : 'var';
+ if (options.namedExports === false ||
+ typeof data !== 'object' ||
+ Array.isArray(data) ||
+ data instanceof Date ||
+ data instanceof RegExp ||
+ data === null) {
+ const code = serialize(data, options.compact ? null : t, '');
+ const magic = _ || (/^[{[\-\/]/.test(code) ? '' : ' '); // eslint-disable-line no-useless-escape
+ return `export default${magic}${code};`;
+ }
+ let namedExportCode = '';
+ const defaultExportRows = [];
+ for (const [key, value] of Object.entries(data)) {
+ if (key === makeLegalIdentifier(key)) {
+ if (options.objectShorthand)
+ defaultExportRows.push(key);
+ else
+ defaultExportRows.push(`${key}:${_}${key}`);
+ namedExportCode += `export ${declarationType} ${key}${_}=${_}${serialize(value, options.compact ? null : t, '')};${n}`;
+ }
+ else {
+ defaultExportRows.push(`${stringify$8(key)}:${_}${serialize(value, options.compact ? null : t, '')}`);
+ }
+ }
+ return `${namedExportCode}export default${_}{${n}${t}${defaultExportRows.join(`,${n}${t}`)}${n}};${n}`;
+};
+
+var path$l = require$$0$4;
+
+var commondir = function (basedir, relfiles) {
+ if (relfiles) {
+ var files = relfiles.map(function (r) {
+ return path$l.resolve(basedir, r);
+ });
+ }
+ else {
+ var files = basedir;
+ }
+
+ var res = files.slice(1).reduce(function (ps, file) {
+ if (!file.match(/^([A-Za-z]:)?\/|\\/)) {
+ throw new Error('relative path without a basedir');
+ }
+
+ var xs = file.split(/\/+|\\+/);
+ for (
+ var i = 0;
+ ps[i] === xs[i] && i < Math.min(ps.length, xs.length);
+ i++
+ );
+ return ps.slice(0, i);
+ }, files[0].split(/\/+|\\+/));
+
+ // Windows correctly handles paths with forward-slashes
+ return res.length > 1 ? res.join('/') : '/'
+};
+
+var getCommonDir = /*@__PURE__*/getDefaultExportFromCjs(commondir);
+
+var old$1 = {};
+
+// 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.
+
+var pathModule = require$$0$4;
+var isWindows$6 = process.platform === 'win32';
+var fs$k = require$$0__default;
+
+// JavaScript implementation of realpath, ported from node pre-v6
+
+var DEBUG$1 = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
+
+function rethrow() {
+ // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and
+ // is fairly slow to generate.
+ var callback;
+ if (DEBUG$1) {
+ var backtrace = new Error;
+ callback = debugCallback;
+ } else
+ callback = missingCallback;
+
+ return callback;
+
+ function debugCallback(err) {
+ if (err) {
+ backtrace.message = err.message;
+ err = backtrace;
+ missingCallback(err);
+ }
+ }
+
+ function missingCallback(err) {
+ if (err) {
+ if (process.throwDeprecation)
+ throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs
+ else if (!process.noDeprecation) {
+ var msg = 'fs: missing callback ' + (err.stack || err.message);
+ if (process.traceDeprecation)
+ console.trace(msg);
+ else
+ console.error(msg);
+ }
+ }
+ }
+}
+
+function maybeCallback(cb) {
+ return typeof cb === 'function' ? cb : rethrow();
+}
+
+// Regexp that finds the next partion of a (partial) path
+// result is [base_with_slash, base], e.g. ['somedir/', 'somedir']
+if (isWindows$6) {
+ var nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
+} else {
+ var nextPartRe = /(.*?)(?:[\/]+|$)/g;
+}
+
+// Regex to find the device root, including trailing slash. E.g. 'c:\\'.
+if (isWindows$6) {
+ var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
+} else {
+ var splitRootRe = /^[\/]*/;
+}
+
+old$1.realpathSync = function realpathSync(p, cache) {
+ // make p is absolute
+ p = pathModule.resolve(p);
+
+ if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
+ return cache[p];
+ }
+
+ var original = p,
+ seenLinks = {},
+ knownHard = {};
+
+ // current character position in p
+ var pos;
+ // the partial path so far, including a trailing slash if any
+ var current;
+ // the partial path without a trailing slash (except when pointing at a root)
+ var base;
+ // the partial path scanned in the previous round, with slash
+ var previous;
+
+ start();
+
+ function start() {
+ // Skip over roots
+ var m = splitRootRe.exec(p);
+ pos = m[0].length;
+ current = m[0];
+ base = m[0];
+ previous = '';
+
+ // On windows, check that the root exists. On unix there is no need.
+ if (isWindows$6 && !knownHard[base]) {
+ fs$k.lstatSync(base);
+ knownHard[base] = true;
+ }
+ }
+
+ // walk down the path, swapping out linked pathparts for their real
+ // values
+ // NB: p.length changes.
+ while (pos < p.length) {
+ // find the next part
+ nextPartRe.lastIndex = pos;
+ var result = nextPartRe.exec(p);
+ previous = current;
+ current += result[0];
+ base = previous + result[1];
+ pos = nextPartRe.lastIndex;
+
+ // continue if not a symlink
+ if (knownHard[base] || (cache && cache[base] === base)) {
+ continue;
+ }
+
+ var resolvedLink;
+ if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
+ // some known symbolic link. no need to stat again.
+ resolvedLink = cache[base];
+ } else {
+ var stat = fs$k.lstatSync(base);
+ if (!stat.isSymbolicLink()) {
+ knownHard[base] = true;
+ if (cache) cache[base] = base;
+ continue;
+ }
+
+ // read the link if it wasn't read before
+ // dev/ino always return 0 on windows, so skip the check.
+ var linkTarget = null;
+ if (!isWindows$6) {
+ var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
+ if (seenLinks.hasOwnProperty(id)) {
+ linkTarget = seenLinks[id];
+ }
+ }
+ if (linkTarget === null) {
+ fs$k.statSync(base);
+ linkTarget = fs$k.readlinkSync(base);
+ }
+ resolvedLink = pathModule.resolve(previous, linkTarget);
+ // track this, if given a cache.
+ if (cache) cache[base] = resolvedLink;
+ if (!isWindows$6) seenLinks[id] = linkTarget;
+ }
+
+ // resolve the link, then start over
+ p = pathModule.resolve(resolvedLink, p.slice(pos));
+ start();
+ }
+
+ if (cache) cache[original] = p;
+
+ return p;
+};
+
+
+old$1.realpath = function realpath(p, cache, cb) {
+ if (typeof cb !== 'function') {
+ cb = maybeCallback(cache);
+ cache = null;
+ }
+
+ // make p is absolute
+ p = pathModule.resolve(p);
+
+ if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
+ return process.nextTick(cb.bind(null, null, cache[p]));
+ }
+
+ var original = p,
+ seenLinks = {},
+ knownHard = {};
+
+ // current character position in p
+ var pos;
+ // the partial path so far, including a trailing slash if any
+ var current;
+ // the partial path without a trailing slash (except when pointing at a root)
+ var base;
+ // the partial path scanned in the previous round, with slash
+ var previous;
+
+ start();
+
+ function start() {
+ // Skip over roots
+ var m = splitRootRe.exec(p);
+ pos = m[0].length;
+ current = m[0];
+ base = m[0];
+ previous = '';
+
+ // On windows, check that the root exists. On unix there is no need.
+ if (isWindows$6 && !knownHard[base]) {
+ fs$k.lstat(base, function(err) {
+ if (err) return cb(err);
+ knownHard[base] = true;
+ LOOP();
+ });
+ } else {
+ process.nextTick(LOOP);
+ }
+ }
+
+ // walk down the path, swapping out linked pathparts for their real
+ // values
+ function LOOP() {
+ // stop if scanned past end of path
+ if (pos >= p.length) {
+ if (cache) cache[original] = p;
+ return cb(null, p);
+ }
+
+ // find the next part
+ nextPartRe.lastIndex = pos;
+ var result = nextPartRe.exec(p);
+ previous = current;
+ current += result[0];
+ base = previous + result[1];
+ pos = nextPartRe.lastIndex;
+
+ // continue if not a symlink
+ if (knownHard[base] || (cache && cache[base] === base)) {
+ return process.nextTick(LOOP);
+ }
+
+ if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
+ // known symbolic link. no need to stat again.
+ return gotResolvedLink(cache[base]);
+ }
+
+ return fs$k.lstat(base, gotStat);
+ }
+
+ function gotStat(err, stat) {
+ if (err) return cb(err);
+
+ // if not a symlink, skip to the next path part
+ if (!stat.isSymbolicLink()) {
+ knownHard[base] = true;
+ if (cache) cache[base] = base;
+ return process.nextTick(LOOP);
+ }
+
+ // stat & read the link if not read before
+ // call gotTarget as soon as the link target is known
+ // dev/ino always return 0 on windows, so skip the check.
+ if (!isWindows$6) {
+ var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
+ if (seenLinks.hasOwnProperty(id)) {
+ return gotTarget(null, seenLinks[id], base);
+ }
+ }
+ fs$k.stat(base, function(err) {
+ if (err) return cb(err);
+
+ fs$k.readlink(base, function(err, target) {
+ if (!isWindows$6) seenLinks[id] = target;
+ gotTarget(err, target);
+ });
+ });
+ }
+
+ function gotTarget(err, target, base) {
+ if (err) return cb(err);
+
+ var resolvedLink = pathModule.resolve(previous, target);
+ if (cache) cache[base] = resolvedLink;
+ gotResolvedLink(resolvedLink);
+ }
+
+ function gotResolvedLink(resolvedLink) {
+ // resolve the link, then start over
+ p = pathModule.resolve(resolvedLink, p.slice(pos));
+ start();
+ }
+};
+
+var fs_realpath = realpath$2;
+realpath$2.realpath = realpath$2;
+realpath$2.sync = realpathSync;
+realpath$2.realpathSync = realpathSync;
+realpath$2.monkeypatch = monkeypatch;
+realpath$2.unmonkeypatch = unmonkeypatch;
+
+var fs$j = require$$0__default;
+var origRealpath = fs$j.realpath;
+var origRealpathSync = fs$j.realpathSync;
+
+var version$4 = process.version;
+var ok = /^v[0-5]\./.test(version$4);
+var old = old$1;
+
+function newError (er) {
+ return er && er.syscall === 'realpath' && (
+ er.code === 'ELOOP' ||
+ er.code === 'ENOMEM' ||
+ er.code === 'ENAMETOOLONG'
+ )
+}
+
+function realpath$2 (p, cache, cb) {
+ if (ok) {
+ return origRealpath(p, cache, cb)
+ }
+
+ if (typeof cache === 'function') {
+ cb = cache;
+ cache = null;
+ }
+ origRealpath(p, cache, function (er, result) {
+ if (newError(er)) {
+ old.realpath(p, cache, cb);
+ } else {
+ cb(er, result);
+ }
+ });
+}
+
+function realpathSync (p, cache) {
+ if (ok) {
+ return origRealpathSync(p, cache)
+ }
+
+ try {
+ return origRealpathSync(p, cache)
+ } catch (er) {
+ if (newError(er)) {
+ return old.realpathSync(p, cache)
+ } else {
+ throw er
+ }
+ }
+}
+
+function monkeypatch () {
+ fs$j.realpath = realpath$2;
+ fs$j.realpathSync = realpathSync;
+}
+
+function unmonkeypatch () {
+ fs$j.realpath = origRealpath;
+ fs$j.realpathSync = origRealpathSync;
+}
+
+const isWindows$5 = typeof process === 'object' &&
+ process &&
+ process.platform === 'win32';
+var path$k = isWindows$5 ? { sep: '\\' } : { sep: '/' };
+
+var balancedMatch = balanced$1;
+function balanced$1(a, b, str) {
+ if (a instanceof RegExp) a = maybeMatch(a, str);
+ if (b instanceof RegExp) b = maybeMatch(b, str);
+
+ var r = range$1(a, b, str);
+
+ return r && {
+ start: r[0],
+ end: r[1],
+ pre: str.slice(0, r[0]),
+ body: str.slice(r[0] + a.length, r[1]),
+ post: str.slice(r[1] + b.length)
+ };
+}
+
+function maybeMatch(reg, str) {
+ var m = str.match(reg);
+ return m ? m[0] : null;
+}
+
+balanced$1.range = range$1;
+function range$1(a, b, str) {
+ var begs, beg, left, right, result;
+ var ai = str.indexOf(a);
+ var bi = str.indexOf(b, ai + 1);
+ var i = ai;
+
+ if (ai >= 0 && bi > 0) {
+ if(a===b) {
+ return [ai, bi];
+ }
+ begs = [];
+ left = str.length;
+
+ while (i >= 0 && !result) {
+ if (i == ai) {
+ begs.push(i);
+ ai = str.indexOf(a, i + 1);
+ } else if (begs.length == 1) {
+ result = [ begs.pop(), bi ];
+ } else {
+ beg = begs.pop();
+ if (beg < left) {
+ left = beg;
+ right = bi;
+ }
+
+ bi = str.indexOf(b, i + 1);
+ }
+
+ i = ai < bi && ai >= 0 ? ai : bi;
+ }
+
+ if (begs.length) {
+ result = [ left, right ];
+ }
+ }
+
+ return result;
+}
+
+var balanced = balancedMatch;
+
+var braceExpansion = expandTop;
+
+var escSlash = '\0SLASH'+Math.random()+'\0';
+var escOpen = '\0OPEN'+Math.random()+'\0';
+var escClose = '\0CLOSE'+Math.random()+'\0';
+var escComma = '\0COMMA'+Math.random()+'\0';
+var escPeriod = '\0PERIOD'+Math.random()+'\0';
+
+function numeric(str) {
+ return parseInt(str, 10) == str
+ ? parseInt(str, 10)
+ : str.charCodeAt(0);
+}
+
+function escapeBraces(str) {
+ return str.split('\\\\').join(escSlash)
+ .split('\\{').join(escOpen)
+ .split('\\}').join(escClose)
+ .split('\\,').join(escComma)
+ .split('\\.').join(escPeriod);
+}
+
+function unescapeBraces(str) {
+ return str.split(escSlash).join('\\')
+ .split(escOpen).join('{')
+ .split(escClose).join('}')
+ .split(escComma).join(',')
+ .split(escPeriod).join('.');
+}
+
+
+// Basically just str.split(","), but handling cases
+// where we have nested braced sections, which should be
+// treated as individual members, like {a,{b,c},d}
+function parseCommaParts(str) {
+ if (!str)
+ return [''];
+
+ var parts = [];
+ var m = balanced('{', '}', str);
+
+ if (!m)
+ return str.split(',');
+
+ var pre = m.pre;
+ var body = m.body;
+ var post = m.post;
+ var p = pre.split(',');
+
+ p[p.length-1] += '{' + body + '}';
+ var postParts = parseCommaParts(post);
+ if (post.length) {
+ p[p.length-1] += postParts.shift();
+ p.push.apply(p, postParts);
+ }
+
+ parts.push.apply(parts, p);
+
+ return parts;
+}
+
+function expandTop(str) {
+ if (!str)
+ return [];
+
+ // I don't know why Bash 4.3 does this, but it does.
+ // Anything starting with {} will have the first two bytes preserved
+ // but *only* at the top level, so {},a}b will not expand to anything,
+ // but a{},b}c will be expanded to [a}c,abc].
+ // One could argue that this is a bug in Bash, but since the goal of
+ // this module is to match Bash's rules, we escape a leading {}
+ if (str.substr(0, 2) === '{}') {
+ str = '\\{\\}' + str.substr(2);
+ }
+
+ return expand$4(escapeBraces(str), true).map(unescapeBraces);
+}
+
+function embrace(str) {
+ return '{' + str + '}';
+}
+function isPadded(el) {
+ return /^-?0\d/.test(el);
+}
+
+function lte(i, y) {
+ return i <= y;
+}
+function gte(i, y) {
+ return i >= y;
+}
+
+function expand$4(str, isTop) {
+ var expansions = [];
+
+ var m = balanced('{', '}', str);
+ if (!m) return [str];
+
+ // no need to expand pre, since it is guaranteed to be free of brace-sets
+ var pre = m.pre;
+ var post = m.post.length
+ ? expand$4(m.post, false)
+ : [''];
+
+ if (/\$$/.test(m.pre)) {
+ for (var k = 0; k < post.length; k++) {
+ var expansion = pre+ '{' + m.body + '}' + post[k];
+ expansions.push(expansion);
+ }
+ } else {
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
+ var isSequence = isNumericSequence || isAlphaSequence;
+ var isOptions = m.body.indexOf(',') >= 0;
+ if (!isSequence && !isOptions) {
+ // {a},b}
+ if (m.post.match(/,.*\}/)) {
+ str = m.pre + '{' + m.body + escClose + m.post;
+ return expand$4(str);
+ }
+ return [str];
+ }
+
+ var n;
+ if (isSequence) {
+ n = m.body.split(/\.\./);
+ } else {
+ n = parseCommaParts(m.body);
+ if (n.length === 1) {
+ // x{{a,b}}y ==> x{a}y x{b}y
+ n = expand$4(n[0], false).map(embrace);
+ if (n.length === 1) {
+ return post.map(function(p) {
+ return m.pre + n[0] + p;
+ });
+ }
+ }
+ }
+
+ // at this point, n is the parts, and we know it's not a comma set
+ // with a single entry.
+ var N;
+
+ if (isSequence) {
+ var x = numeric(n[0]);
+ var y = numeric(n[1]);
+ var width = Math.max(n[0].length, n[1].length);
+ var incr = n.length == 3
+ ? Math.abs(numeric(n[2]))
+ : 1;
+ var test = lte;
+ var reverse = y < x;
+ if (reverse) {
+ incr *= -1;
+ test = gte;
+ }
+ var pad = n.some(isPadded);
+
+ N = [];
+
+ for (var i = x; test(i, y); i += incr) {
+ var c;
+ if (isAlphaSequence) {
+ c = String.fromCharCode(i);
+ if (c === '\\')
+ c = '';
+ } else {
+ c = String(i);
+ if (pad) {
+ var need = width - c.length;
+ if (need > 0) {
+ var z = new Array(need + 1).join('0');
+ if (i < 0)
+ c = '-' + z + c.slice(1);
+ else
+ c = z + c;
+ }
+ }
+ }
+ N.push(c);
+ }
+ } else {
+ N = [];
+
+ for (var j = 0; j < n.length; j++) {
+ N.push.apply(N, expand$4(n[j], false));
+ }
+ }
+
+ for (var j = 0; j < N.length; j++) {
+ for (var k = 0; k < post.length; k++) {
+ var expansion = pre + N[j] + post[k];
+ if (!isTop || isSequence || expansion)
+ expansions.push(expansion);
+ }
+ }
+ }
+
+ return expansions;
+}
+
+const minimatch$1 = minimatch_1 = (p, pattern, options = {}) => {
+ assertValidPattern(pattern);
+
+ // shortcut: comments match nothing.
+ if (!options.nocomment && pattern.charAt(0) === '#') {
+ return false
+ }
+
+ return new Minimatch$1(pattern, options).match(p)
+};
+
+var minimatch_1 = minimatch$1;
+
+const path$j = path$k;
+minimatch$1.sep = path$j.sep;
+
+const GLOBSTAR$2 = Symbol('globstar **');
+minimatch$1.GLOBSTAR = GLOBSTAR$2;
+const expand$3 = braceExpansion;
+
+const plTypes = {
+ '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
+ '?': { open: '(?:', close: ')?' },
+ '+': { open: '(?:', close: ')+' },
+ '*': { open: '(?:', close: ')*' },
+ '@': { open: '(?:', close: ')' }
+};
+
+// any single thing other than /
+// don't need to escape / when using new RegExp()
+const qmark = '[^/]';
+
+// * => any number of characters
+const star = qmark + '*?';
+
+// ** when dots are allowed. Anything goes, except .. and .
+// not (^ or / followed by one or two dots followed by $ or /),
+// followed by anything, any number of times.
+const twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?';
+
+// not a ^ or / followed by a dot,
+// followed by anything, any number of times.
+const twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?';
+
+// "abc" -> { a:true, b:true, c:true }
+const charSet = s => s.split('').reduce((set, c) => {
+ set[c] = true;
+ return set
+}, {});
+
+// characters that need to be escaped in RegExp.
+const reSpecials = charSet('().*{}+?[]^$\\!');
+
+// characters that indicate we have to add the pattern start
+const addPatternStartSet = charSet('[.(');
+
+// normalizes slashes.
+const slashSplit = /\/+/;
+
+minimatch$1.filter = (pattern, options = {}) =>
+ (p, i, list) => minimatch$1(p, pattern, options);
+
+const ext = (a, b = {}) => {
+ const t = {};
+ Object.keys(a).forEach(k => t[k] = a[k]);
+ Object.keys(b).forEach(k => t[k] = b[k]);
+ return t
+};
+
+minimatch$1.defaults = def => {
+ if (!def || typeof def !== 'object' || !Object.keys(def).length) {
+ return minimatch$1
+ }
+
+ const orig = minimatch$1;
+
+ const m = (p, pattern, options) => orig(p, pattern, ext(def, options));
+ m.Minimatch = class Minimatch extends orig.Minimatch {
+ constructor (pattern, options) {
+ super(pattern, ext(def, options));
+ }
+ };
+ m.Minimatch.defaults = options => orig.defaults(ext(def, options)).Minimatch;
+ m.filter = (pattern, options) => orig.filter(pattern, ext(def, options));
+ m.defaults = options => orig.defaults(ext(def, options));
+ m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options));
+ m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options));
+ m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options));
+
+ return m
+};
+
+
+
+
+
+// Brace expansion:
+// a{b,c}d -> abd acd
+// a{b,}c -> abc ac
+// a{0..3}d -> a0d a1d a2d a3d
+// a{b,c{d,e}f}g -> abg acdfg acefg
+// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
+//
+// Invalid sets are not expanded.
+// a{2..}b -> a{2..}b
+// a{b}c -> a{b}c
+minimatch$1.braceExpand = (pattern, options) => braceExpand(pattern, options);
+
+const braceExpand = (pattern, options = {}) => {
+ assertValidPattern(pattern);
+
+ // Thanks to Yeting Li for
+ // improving this regexp to avoid a ReDOS vulnerability.
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
+ // shortcut. no need to expand.
+ return [pattern]
+ }
+
+ return expand$3(pattern)
+};
+
+const MAX_PATTERN_LENGTH = 1024 * 64;
+const assertValidPattern = pattern => {
+ if (typeof pattern !== 'string') {
+ throw new TypeError('invalid pattern')
+ }
+
+ if (pattern.length > MAX_PATTERN_LENGTH) {
+ throw new TypeError('pattern is too long')
+ }
+};
+
+// parse a component of the expanded set.
+// At this point, no pattern may contain "/" in it
+// so we're going to return a 2d array, where each entry is the full
+// pattern, split on '/', and then turned into a regular expression.
+// A regexp is made at the end which joins each array with an
+// escaped /, and another full one which joins each regexp with |.
+//
+// Following the lead of Bash 4.1, note that "**" only has special meaning
+// when it is the *only* thing in a path portion. Otherwise, any series
+// of * is equivalent to a single *. Globstar behavior is enabled by
+// default, and can be disabled by setting options.noglobstar.
+const SUBPARSE = Symbol('subparse');
+
+minimatch$1.makeRe = (pattern, options) =>
+ new Minimatch$1(pattern, options || {}).makeRe();
+
+minimatch$1.match = (list, pattern, options = {}) => {
+ const mm = new Minimatch$1(pattern, options);
+ list = list.filter(f => mm.match(f));
+ if (mm.options.nonull && !list.length) {
+ list.push(pattern);
+ }
+ return list
+};
+
+// replace stuff like \* with *
+const globUnescape = s => s.replace(/\\(.)/g, '$1');
+const regExpEscape = s => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
+
+let Minimatch$1 = class Minimatch {
+ constructor (pattern, options) {
+ assertValidPattern(pattern);
+
+ if (!options) options = {};
+
+ this.options = options;
+ this.set = [];
+ this.pattern = pattern;
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape ||
+ options.allowWindowsEscape === false;
+ if (this.windowsPathsNoEscape) {
+ this.pattern = this.pattern.replace(/\\/g, '/');
+ }
+ this.regexp = null;
+ this.negate = false;
+ this.comment = false;
+ this.empty = false;
+ this.partial = !!options.partial;
+
+ // make the set of regexps etc.
+ this.make();
+ }
+
+ debug () {}
+
+ make () {
+ const pattern = this.pattern;
+ const options = this.options;
+
+ // empty patterns and comments match nothing.
+ if (!options.nocomment && pattern.charAt(0) === '#') {
+ this.comment = true;
+ return
+ }
+ if (!pattern) {
+ this.empty = true;
+ return
+ }
+
+ // step 1: figure out negation, etc.
+ this.parseNegate();
+
+ // step 2: expand braces
+ let set = this.globSet = this.braceExpand();
+
+ if (options.debug) this.debug = (...args) => console.error(...args);
+
+ this.debug(this.pattern, set);
+
+ // step 3: now we have a set, so turn each one into a series of path-portion
+ // matching patterns.
+ // These will be regexps, except in the case of "**", which is
+ // set to the GLOBSTAR object for globstar behavior,
+ // and will not contain any / characters
+ set = this.globParts = set.map(s => s.split(slashSplit));
+
+ this.debug(this.pattern, set);
+
+ // glob --> regexps
+ set = set.map((s, si, set) => s.map(this.parse, this));
+
+ this.debug(this.pattern, set);
+
+ // filter out everything that didn't compile properly.
+ set = set.filter(s => s.indexOf(false) === -1);
+
+ this.debug(this.pattern, set);
+
+ this.set = set;
+ }
+
+ parseNegate () {
+ if (this.options.nonegate) return
+
+ const pattern = this.pattern;
+ let negate = false;
+ let negateOffset = 0;
+
+ for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) {
+ negate = !negate;
+ negateOffset++;
+ }
+
+ if (negateOffset) this.pattern = pattern.substr(negateOffset);
+ this.negate = negate;
+ }
+
+ // set partial to true to test if, for example,
+ // "/a/b" matches the start of "/*/b/*/d"
+ // Partial means, if you run out of file before you run
+ // out of pattern, then that's fine, as long as all
+ // the parts match.
+ matchOne (file, pattern, partial) {
+ var options = this.options;
+
+ this.debug('matchOne',
+ { 'this': this, file: file, pattern: pattern });
+
+ this.debug('matchOne', file.length, pattern.length);
+
+ for (var fi = 0,
+ pi = 0,
+ fl = file.length,
+ pl = pattern.length
+ ; (fi < fl) && (pi < pl)
+ ; fi++, pi++) {
+ this.debug('matchOne loop');
+ var p = pattern[pi];
+ var f = file[fi];
+
+ this.debug(pattern, p, f);
+
+ // should be impossible.
+ // some invalid regexp stuff in the set.
+ /* istanbul ignore if */
+ if (p === false) return false
+
+ if (p === GLOBSTAR$2) {
+ this.debug('GLOBSTAR', [pattern, p, f]);
+
+ // "**"
+ // a/**/b/**/c would match the following:
+ // a/b/x/y/z/c
+ // a/x/y/z/b/c
+ // a/b/x/b/x/c
+ // a/b/c
+ // To do this, take the rest of the pattern after
+ // the **, and see if it would match the file remainder.
+ // If so, return success.
+ // If not, the ** "swallows" a segment, and try again.
+ // This is recursively awful.
+ //
+ // a/**/b/**/c matching a/b/x/y/z/c
+ // - a matches a
+ // - doublestar
+ // - matchOne(b/x/y/z/c, b/**/c)
+ // - b matches b
+ // - doublestar
+ // - matchOne(x/y/z/c, c) -> no
+ // - matchOne(y/z/c, c) -> no
+ // - matchOne(z/c, c) -> no
+ // - matchOne(c, c) yes, hit
+ var fr = fi;
+ var pr = pi + 1;
+ if (pr === pl) {
+ this.debug('** at the end');
+ // a ** at the end will just swallow the rest.
+ // We have found a match.
+ // however, it will not swallow /.x, unless
+ // options.dot is set.
+ // . and .. are *never* matched by **, for explosively
+ // exponential reasons.
+ for (; fi < fl; fi++) {
+ if (file[fi] === '.' || file[fi] === '..' ||
+ (!options.dot && file[fi].charAt(0) === '.')) return false
+ }
+ return true
+ }
+
+ // ok, let's see if we can swallow whatever we can.
+ while (fr < fl) {
+ var swallowee = file[fr];
+
+ this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
+
+ // XXX remove this slice. Just pass the start index.
+ if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
+ this.debug('globstar found match!', fr, fl, swallowee);
+ // found a match.
+ return true
+ } else {
+ // can't swallow "." or ".." ever.
+ // can only swallow ".foo" when explicitly asked.
+ if (swallowee === '.' || swallowee === '..' ||
+ (!options.dot && swallowee.charAt(0) === '.')) {
+ this.debug('dot detected!', file, fr, pattern, pr);
+ break
+ }
+
+ // ** swallows a segment, and continue.
+ this.debug('globstar swallow a segment, and continue');
+ fr++;
+ }
+ }
+
+ // no match was found.
+ // However, in partial mode, we can't say this is necessarily over.
+ // If there's more *pattern* left, then
+ /* istanbul ignore if */
+ if (partial) {
+ // ran out of file
+ this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
+ if (fr === fl) return true
+ }
+ return false
+ }
+
+ // something other than **
+ // non-magic patterns just have to match exactly
+ // patterns with magic have been turned into regexps.
+ var hit;
+ if (typeof p === 'string') {
+ hit = f === p;
+ this.debug('string match', p, f, hit);
+ } else {
+ hit = f.match(p);
+ this.debug('pattern match', p, f, hit);
+ }
+
+ if (!hit) return false
+ }
+
+ // Note: ending in / means that we'll get a final ""
+ // at the end of the pattern. This can only match a
+ // corresponding "" at the end of the file.
+ // If the file ends in /, then it can only match a
+ // a pattern that ends in /, unless the pattern just
+ // doesn't have any more for it. But, a/b/ should *not*
+ // match "a/b/*", even though "" matches against the
+ // [^/]*? pattern, except in partial mode, where it might
+ // simply not be reached yet.
+ // However, a/b/ should still satisfy a/*
+
+ // now either we fell off the end of the pattern, or we're done.
+ if (fi === fl && pi === pl) {
+ // ran out of pattern and filename at the same time.
+ // an exact hit!
+ return true
+ } else if (fi === fl) {
+ // ran out of file, but still had pattern left.
+ // this is ok if we're doing the match as part of
+ // a glob fs traversal.
+ return partial
+ } else /* istanbul ignore else */ if (pi === pl) {
+ // ran out of pattern, still have file left.
+ // this is only acceptable if we're on the very last
+ // empty segment of a file with a trailing slash.
+ // a/* should match a/b/
+ return (fi === fl - 1) && (file[fi] === '')
+ }
+
+ // should be unreachable.
+ /* istanbul ignore next */
+ throw new Error('wtf?')
+ }
+
+ braceExpand () {
+ return braceExpand(this.pattern, this.options)
+ }
+
+ parse (pattern, isSub) {
+ assertValidPattern(pattern);
+
+ const options = this.options;
+
+ // shortcuts
+ if (pattern === '**') {
+ if (!options.noglobstar)
+ return GLOBSTAR$2
+ else
+ pattern = '*';
+ }
+ if (pattern === '') return ''
+
+ let re = '';
+ let hasMagic = !!options.nocase;
+ let escaping = false;
+ // ? => one single character
+ const patternListStack = [];
+ const negativeLists = [];
+ let stateChar;
+ let inClass = false;
+ let reClassStart = -1;
+ let classStart = -1;
+ let cs;
+ let pl;
+ let sp;
+ // . and .. never match anything that doesn't start with .,
+ // even when options.dot is set.
+ const patternStart = pattern.charAt(0) === '.' ? '' // anything
+ // not (start or / followed by . or .. followed by / or end)
+ : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
+ : '(?!\\.)';
+
+ const clearStateChar = () => {
+ if (stateChar) {
+ // we had some state-tracking character
+ // that wasn't consumed by this pass.
+ switch (stateChar) {
+ case '*':
+ re += star;
+ hasMagic = true;
+ break
+ case '?':
+ re += qmark;
+ hasMagic = true;
+ break
+ default:
+ re += '\\' + stateChar;
+ break
+ }
+ this.debug('clearStateChar %j %j', stateChar, re);
+ stateChar = false;
+ }
+ };
+
+ for (let i = 0, c; (i < pattern.length) && (c = pattern.charAt(i)); i++) {
+ this.debug('%s\t%s %s %j', pattern, i, re, c);
+
+ // skip over any that are escaped.
+ if (escaping) {
+ /* istanbul ignore next - completely not allowed, even escaped. */
+ if (c === '/') {
+ return false
+ }
+
+ if (reSpecials[c]) {
+ re += '\\';
+ }
+ re += c;
+ escaping = false;
+ continue
+ }
+
+ switch (c) {
+ /* istanbul ignore next */
+ case '/': {
+ // Should already be path-split by now.
+ return false
+ }
+
+ case '\\':
+ clearStateChar();
+ escaping = true;
+ continue
+
+ // the various stateChar values
+ // for the "extglob" stuff.
+ case '?':
+ case '*':
+ case '+':
+ case '@':
+ case '!':
+ this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c);
+
+ // all of those are literals inside a class, except that
+ // the glob [!a] means [^a] in regexp
+ if (inClass) {
+ this.debug(' in class');
+ if (c === '!' && i === classStart + 1) c = '^';
+ re += c;
+ continue
+ }
+
+ // if we already have a stateChar, then it means
+ // that there was something like ** or +? in there.
+ // Handle the stateChar, then proceed with this one.
+ this.debug('call clearStateChar %j', stateChar);
+ clearStateChar();
+ stateChar = c;
+ // if extglob is disabled, then +(asdf|foo) isn't a thing.
+ // just clear the statechar *now*, rather than even diving into
+ // the patternList stuff.
+ if (options.noext) clearStateChar();
+ continue
+
+ case '(':
+ if (inClass) {
+ re += '(';
+ continue
+ }
+
+ if (!stateChar) {
+ re += '\\(';
+ continue
+ }
+
+ patternListStack.push({
+ type: stateChar,
+ start: i - 1,
+ reStart: re.length,
+ open: plTypes[stateChar].open,
+ close: plTypes[stateChar].close
+ });
+ // negation is (?:(?!js)[^/]*)
+ re += stateChar === '!' ? '(?:(?!(?:' : '(?:';
+ this.debug('plType %j %j', stateChar, re);
+ stateChar = false;
+ continue
+
+ case ')':
+ if (inClass || !patternListStack.length) {
+ re += '\\)';
+ continue
+ }
+
+ clearStateChar();
+ hasMagic = true;
+ pl = patternListStack.pop();
+ // negation is (?:(?!js)[^/]*)
+ // The others are (?:)
+ re += pl.close;
+ if (pl.type === '!') {
+ negativeLists.push(pl);
+ }
+ pl.reEnd = re.length;
+ continue
+
+ case '|':
+ if (inClass || !patternListStack.length) {
+ re += '\\|';
+ continue
+ }
+
+ clearStateChar();
+ re += '|';
+ continue
+
+ // these are mostly the same in regexp and glob
+ case '[':
+ // swallow any state-tracking char before the [
+ clearStateChar();
+
+ if (inClass) {
+ re += '\\' + c;
+ continue
+ }
+
+ inClass = true;
+ classStart = i;
+ reClassStart = re.length;
+ re += c;
+ continue
+
+ case ']':
+ // a right bracket shall lose its special
+ // meaning and represent itself in
+ // a bracket expression if it occurs
+ // first in the list. -- POSIX.2 2.8.3.2
+ if (i === classStart + 1 || !inClass) {
+ re += '\\' + c;
+ continue
+ }
+
+ // handle the case where we left a class open.
+ // "[z-a]" is valid, equivalent to "\[z-a\]"
+ // split where the last [ was, make sure we don't have
+ // an invalid re. if so, re-walk the contents of the
+ // would-be class to re-translate any characters that
+ // were passed through as-is
+ // TODO: It would probably be faster to determine this
+ // without a try/catch and a new RegExp, but it's tricky
+ // to do safely. For now, this is safe and works.
+ cs = pattern.substring(classStart + 1, i);
+
+ // finish up the class.
+ hasMagic = true;
+ inClass = false;
+ re += c;
+ continue
+
+ default:
+ // swallow any state char that wasn't consumed
+ clearStateChar();
+
+ if (reSpecials[c] && !(c === '^' && inClass)) {
+ re += '\\';
+ }
+
+ re += c;
+ break
+
+ } // switch
+ } // for
+
+ // handle the case where we left a class open.
+ // "[abc" is valid, equivalent to "\[abc"
+ if (inClass) {
+ // split where the last [ was, and escape it
+ // this is a huge pita. We now have to re-walk
+ // the contents of the would-be class to re-translate
+ // any characters that were passed through as-is
+ cs = pattern.substr(classStart + 1);
+ sp = this.parse(cs, SUBPARSE);
+ re = re.substr(0, reClassStart) + '\\[' + sp[0];
+ hasMagic = hasMagic || sp[1];
+ }
+
+ // handle the case where we had a +( thing at the *end*
+ // of the pattern.
+ // each pattern list stack adds 3 chars, and we need to go through
+ // and escape any | chars that were passed through as-is for the regexp.
+ // Go through and escape them, taking care not to double-escape any
+ // | chars that were already escaped.
+ for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
+ let tail;
+ tail = re.slice(pl.reStart + pl.open.length);
+ this.debug('setting tail', re, pl);
+ // maybe some even number of \, then maybe 1 \, followed by a |
+ tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => {
+ /* istanbul ignore else - should already be done */
+ if (!$2) {
+ // the | isn't already escaped, so escape it.
+ $2 = '\\';
+ }
+
+ // need to escape all those slashes *again*, without escaping the
+ // one that we need for escaping the | character. As it works out,
+ // escaping an even number of slashes can be done by simply repeating
+ // it exactly after itself. That's why this trick works.
+ //
+ // I am sorry that you have to see this.
+ return $1 + $1 + $2 + '|'
+ });
+
+ this.debug('tail=%j\n %s', tail, tail, pl, re);
+ const t = pl.type === '*' ? star
+ : pl.type === '?' ? qmark
+ : '\\' + pl.type;
+
+ hasMagic = true;
+ re = re.slice(0, pl.reStart) + t + '\\(' + tail;
+ }
+
+ // handle trailing things that only matter at the very end.
+ clearStateChar();
+ if (escaping) {
+ // trailing \\
+ re += '\\\\';
+ }
+
+ // only need to apply the nodot start if the re starts with
+ // something that could conceivably capture a dot
+ const addPatternStart = addPatternStartSet[re.charAt(0)];
+
+ // Hack to work around lack of negative lookbehind in JS
+ // A pattern like: *.!(x).!(y|z) needs to ensure that a name
+ // like 'a.xyz.yz' doesn't match. So, the first negative
+ // lookahead, has to look ALL the way ahead, to the end of
+ // the pattern.
+ for (let n = negativeLists.length - 1; n > -1; n--) {
+ const nl = negativeLists[n];
+
+ const nlBefore = re.slice(0, nl.reStart);
+ const nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
+ let nlAfter = re.slice(nl.reEnd);
+ const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter;
+
+ // Handle nested stuff like *(*.js|!(*.json)), where open parens
+ // mean that we should *not* include the ) in the bit that is considered
+ // "after" the negated section.
+ const openParensBefore = nlBefore.split('(').length - 1;
+ let cleanAfter = nlAfter;
+ for (let i = 0; i < openParensBefore; i++) {
+ cleanAfter = cleanAfter.replace(/\)[+*?]?/, '');
+ }
+ nlAfter = cleanAfter;
+
+ const dollar = nlAfter === '' && isSub !== SUBPARSE ? '$' : '';
+ re = nlBefore + nlFirst + nlAfter + dollar + nlLast;
+ }
+
+ // if the re is not "" at this point, then we need to make sure
+ // it doesn't match against an empty path part.
+ // Otherwise a/* will match a/, which it should not.
+ if (re !== '' && hasMagic) {
+ re = '(?=.)' + re;
+ }
+
+ if (addPatternStart) {
+ re = patternStart + re;
+ }
+
+ // parsing just a piece of a larger pattern.
+ if (isSub === SUBPARSE) {
+ return [re, hasMagic]
+ }
+
+ // skip the regexp for non-magical patterns
+ // unescape anything in it, though, so that it'll be
+ // an exact match against a file etc.
+ if (!hasMagic) {
+ return globUnescape(pattern)
+ }
+
+ const flags = options.nocase ? 'i' : '';
+ try {
+ return Object.assign(new RegExp('^' + re + '$', flags), {
+ _glob: pattern,
+ _src: re,
+ })
+ } catch (er) /* istanbul ignore next - should be impossible */ {
+ // If it was an invalid regular expression, then it can't match
+ // anything. This trick looks for a character after the end of
+ // the string, which is of course impossible, except in multi-line
+ // mode, but it's not a /m regex.
+ return new RegExp('$.')
+ }
+ }
+
+ makeRe () {
+ if (this.regexp || this.regexp === false) return this.regexp
+
+ // at this point, this.set is a 2d array of partial
+ // pattern strings, or "**".
+ //
+ // It's better to use .match(). This function shouldn't
+ // be used, really, but it's pretty convenient sometimes,
+ // when you just want to work with a regex.
+ const set = this.set;
+
+ if (!set.length) {
+ this.regexp = false;
+ return this.regexp
+ }
+ const options = this.options;
+
+ const twoStar = options.noglobstar ? star
+ : options.dot ? twoStarDot
+ : twoStarNoDot;
+ const flags = options.nocase ? 'i' : '';
+
+ // coalesce globstars and regexpify non-globstar patterns
+ // if it's the only item, then we just do one twoStar
+ // if it's the first, and there are more, prepend (\/|twoStar\/)? to next
+ // if it's the last, append (\/twoStar|) to previous
+ // if it's in the middle, append (\/|\/twoStar\/) to previous
+ // then filter out GLOBSTAR symbols
+ let re = set.map(pattern => {
+ pattern = pattern.map(p =>
+ typeof p === 'string' ? regExpEscape(p)
+ : p === GLOBSTAR$2 ? GLOBSTAR$2
+ : p._src
+ ).reduce((set, p) => {
+ if (!(set[set.length - 1] === GLOBSTAR$2 && p === GLOBSTAR$2)) {
+ set.push(p);
+ }
+ return set
+ }, []);
+ pattern.forEach((p, i) => {
+ if (p !== GLOBSTAR$2 || pattern[i-1] === GLOBSTAR$2) {
+ return
+ }
+ if (i === 0) {
+ if (pattern.length > 1) {
+ pattern[i+1] = '(?:\\\/|' + twoStar + '\\\/)?' + pattern[i+1];
+ } else {
+ pattern[i] = twoStar;
+ }
+ } else if (i === pattern.length - 1) {
+ pattern[i-1] += '(?:\\\/|' + twoStar + ')?';
+ } else {
+ pattern[i-1] += '(?:\\\/|\\\/' + twoStar + '\\\/)' + pattern[i+1];
+ pattern[i+1] = GLOBSTAR$2;
+ }
+ });
+ return pattern.filter(p => p !== GLOBSTAR$2).join('/')
+ }).join('|');
+
+ // must match entire pattern
+ // ending in a * or ** will make it less strict.
+ re = '^(?:' + re + ')$';
+
+ // can match anything, as long as it's not this.
+ if (this.negate) re = '^(?!' + re + ').*$';
+
+ try {
+ this.regexp = new RegExp(re, flags);
+ } catch (ex) /* istanbul ignore next - should be impossible */ {
+ this.regexp = false;
+ }
+ return this.regexp
+ }
+
+ match (f, partial = this.partial) {
+ this.debug('match', f, this.pattern);
+ // short-circuit in the case of busted things.
+ // comments, etc.
+ if (this.comment) return false
+ if (this.empty) return f === ''
+
+ if (f === '/' && partial) return true
+
+ const options = this.options;
+
+ // windows: need to use /, not \
+ if (path$j.sep !== '/') {
+ f = f.split(path$j.sep).join('/');
+ }
+
+ // treat the test path as a set of pathparts.
+ f = f.split(slashSplit);
+ this.debug(this.pattern, 'split', f);
+
+ // just ONE of the pattern sets in this.set needs to match
+ // in order for it to be valid. If negating, then just one
+ // match means that we have failed.
+ // Either way, return on the first hit.
+
+ const set = this.set;
+ this.debug(this.pattern, 'set', set);
+
+ // Find the basename of the path by looking for the last non-empty segment
+ let filename;
+ for (let i = f.length - 1; i >= 0; i--) {
+ filename = f[i];
+ if (filename) break
+ }
+
+ for (let i = 0; i < set.length; i++) {
+ const pattern = set[i];
+ let file = f;
+ if (options.matchBase && pattern.length === 1) {
+ file = [filename];
+ }
+ const hit = this.matchOne(file, pattern, partial);
+ if (hit) {
+ if (options.flipNegate) return true
+ return !this.negate
+ }
+ }
+
+ // didn't get any hits. this is success if it's a negative
+ // pattern, failure otherwise.
+ if (options.flipNegate) return false
+ return this.negate
+ }
+
+ static defaults (def) {
+ return minimatch$1.defaults(def).Minimatch
+ }
+};
+
+minimatch$1.Minimatch = Minimatch$1;
+
+var inherits = {exports: {}};
+
+var inherits_browser = {exports: {}};
+
+var hasRequiredInherits_browser;
+
+function requireInherits_browser () {
+ if (hasRequiredInherits_browser) return inherits_browser.exports;
+ hasRequiredInherits_browser = 1;
+ if (typeof Object.create === 'function') {
+ // implementation from standard node.js 'util' module
+ inherits_browser.exports = function inherits(ctor, superCtor) {
+ if (superCtor) {
+ ctor.super_ = superCtor;
+ ctor.prototype = Object.create(superCtor.prototype, {
+ constructor: {
+ value: ctor,
+ enumerable: false,
+ writable: true,
+ configurable: true
+ }
+ });
+ }
+ };
+ } else {
+ // old school shim for old browsers
+ inherits_browser.exports = function inherits(ctor, superCtor) {
+ if (superCtor) {
+ ctor.super_ = superCtor;
+ var TempCtor = function () {};
+ TempCtor.prototype = superCtor.prototype;
+ ctor.prototype = new TempCtor();
+ ctor.prototype.constructor = ctor;
+ }
+ };
+ }
+ return inherits_browser.exports;
+}
+
+try {
+ var util$2 = require('util');
+ /* istanbul ignore next */
+ if (typeof util$2.inherits !== 'function') throw '';
+ inherits.exports = util$2.inherits;
+} catch (e) {
+ /* istanbul ignore next */
+ inherits.exports = requireInherits_browser();
+}
+
+var inheritsExports = inherits.exports;
+
+var common$c = {};
+
+common$c.setopts = setopts;
+common$c.ownProp = ownProp;
+common$c.makeAbs = makeAbs;
+common$c.finish = finish;
+common$c.mark = mark;
+common$c.isIgnored = isIgnored;
+common$c.childrenIgnored = childrenIgnored;
+
+function ownProp (obj, field) {
+ return Object.prototype.hasOwnProperty.call(obj, field)
+}
+
+var fs$i = require$$0__default;
+var path$i = require$$0$4;
+var minimatch = minimatch_1;
+var isAbsolute = require$$0$4.isAbsolute;
+var Minimatch = minimatch.Minimatch;
+
+function alphasort (a, b) {
+ return a.localeCompare(b, 'en')
+}
+
+function setupIgnores (self, options) {
+ self.ignore = options.ignore || [];
+
+ if (!Array.isArray(self.ignore))
+ self.ignore = [self.ignore];
+
+ if (self.ignore.length) {
+ self.ignore = self.ignore.map(ignoreMap);
+ }
+}
+
+// ignore patterns are always in dot:true mode.
+function ignoreMap (pattern) {
+ var gmatcher = null;
+ if (pattern.slice(-3) === '/**') {
+ var gpattern = pattern.replace(/(\/\*\*)+$/, '');
+ gmatcher = new Minimatch(gpattern, { dot: true });
+ }
+
+ return {
+ matcher: new Minimatch(pattern, { dot: true }),
+ gmatcher: gmatcher
+ }
+}
+
+function setopts (self, pattern, options) {
+ if (!options)
+ options = {};
+
+ // base-matching: just use globstar for that.
+ if (options.matchBase && -1 === pattern.indexOf("/")) {
+ if (options.noglobstar) {
+ throw new Error("base matching requires globstar")
+ }
+ pattern = "**/" + pattern;
+ }
+
+ self.silent = !!options.silent;
+ self.pattern = pattern;
+ self.strict = options.strict !== false;
+ self.realpath = !!options.realpath;
+ self.realpathCache = options.realpathCache || Object.create(null);
+ self.follow = !!options.follow;
+ self.dot = !!options.dot;
+ self.mark = !!options.mark;
+ self.nodir = !!options.nodir;
+ if (self.nodir)
+ self.mark = true;
+ self.sync = !!options.sync;
+ self.nounique = !!options.nounique;
+ self.nonull = !!options.nonull;
+ self.nosort = !!options.nosort;
+ self.nocase = !!options.nocase;
+ self.stat = !!options.stat;
+ self.noprocess = !!options.noprocess;
+ self.absolute = !!options.absolute;
+ self.fs = options.fs || fs$i;
+
+ self.maxLength = options.maxLength || Infinity;
+ self.cache = options.cache || Object.create(null);
+ self.statCache = options.statCache || Object.create(null);
+ self.symlinks = options.symlinks || Object.create(null);
+
+ setupIgnores(self, options);
+
+ self.changedCwd = false;
+ var cwd = process.cwd();
+ if (!ownProp(options, "cwd"))
+ self.cwd = path$i.resolve(cwd);
+ else {
+ self.cwd = path$i.resolve(options.cwd);
+ self.changedCwd = self.cwd !== cwd;
+ }
+
+ self.root = options.root || path$i.resolve(self.cwd, "/");
+ self.root = path$i.resolve(self.root);
+
+ // TODO: is an absolute `cwd` supposed to be resolved against `root`?
+ // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
+ self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd);
+ self.nomount = !!options.nomount;
+
+ if (process.platform === "win32") {
+ self.root = self.root.replace(/\\/g, "/");
+ self.cwd = self.cwd.replace(/\\/g, "/");
+ self.cwdAbs = self.cwdAbs.replace(/\\/g, "/");
+ }
+
+ // disable comments and negation in Minimatch.
+ // Note that they are not supported in Glob itself anyway.
+ options.nonegate = true;
+ options.nocomment = true;
+ // always treat \ in patterns as escapes, not path separators
+ options.allowWindowsEscape = true;
+
+ self.minimatch = new Minimatch(pattern, options);
+ self.options = self.minimatch.options;
+}
+
+function finish (self) {
+ var nou = self.nounique;
+ var all = nou ? [] : Object.create(null);
+
+ for (var i = 0, l = self.matches.length; i < l; i ++) {
+ var matches = self.matches[i];
+ if (!matches || Object.keys(matches).length === 0) {
+ if (self.nonull) {
+ // do like the shell, and spit out the literal glob
+ var literal = self.minimatch.globSet[i];
+ if (nou)
+ all.push(literal);
+ else
+ all[literal] = true;
+ }
+ } else {
+ // had matches
+ var m = Object.keys(matches);
+ if (nou)
+ all.push.apply(all, m);
+ else
+ m.forEach(function (m) {
+ all[m] = true;
+ });
+ }
+ }
+
+ if (!nou)
+ all = Object.keys(all);
+
+ if (!self.nosort)
+ all = all.sort(alphasort);
+
+ // at *some* point we statted all of these
+ if (self.mark) {
+ for (var i = 0; i < all.length; i++) {
+ all[i] = self._mark(all[i]);
+ }
+ if (self.nodir) {
+ all = all.filter(function (e) {
+ var notDir = !(/\/$/.test(e));
+ var c = self.cache[e] || self.cache[makeAbs(self, e)];
+ if (notDir && c)
+ notDir = c !== 'DIR' && !Array.isArray(c);
+ return notDir
+ });
+ }
+ }
+
+ if (self.ignore.length)
+ all = all.filter(function(m) {
+ return !isIgnored(self, m)
+ });
+
+ self.found = all;
+}
+
+function mark (self, p) {
+ var abs = makeAbs(self, p);
+ var c = self.cache[abs];
+ var m = p;
+ if (c) {
+ var isDir = c === 'DIR' || Array.isArray(c);
+ var slash = p.slice(-1) === '/';
+
+ if (isDir && !slash)
+ m += '/';
+ else if (!isDir && slash)
+ m = m.slice(0, -1);
+
+ if (m !== p) {
+ var mabs = makeAbs(self, m);
+ self.statCache[mabs] = self.statCache[abs];
+ self.cache[mabs] = self.cache[abs];
+ }
+ }
+
+ return m
+}
+
+// lotta situps...
+function makeAbs (self, f) {
+ var abs = f;
+ if (f.charAt(0) === '/') {
+ abs = path$i.join(self.root, f);
+ } else if (isAbsolute(f) || f === '') {
+ abs = f;
+ } else if (self.changedCwd) {
+ abs = path$i.resolve(self.cwd, f);
+ } else {
+ abs = path$i.resolve(f);
+ }
+
+ if (process.platform === 'win32')
+ abs = abs.replace(/\\/g, '/');
+
+ return abs
+}
+
+
+// Return true, if pattern ends with globstar '**', for the accompanying parent directory.
+// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
+function isIgnored (self, path) {
+ if (!self.ignore.length)
+ return false
+
+ return self.ignore.some(function(item) {
+ return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
+ })
+}
+
+function childrenIgnored (self, path) {
+ if (!self.ignore.length)
+ return false
+
+ return self.ignore.some(function(item) {
+ return !!(item.gmatcher && item.gmatcher.match(path))
+ })
+}
+
+var sync$9;
+var hasRequiredSync;
+
+function requireSync () {
+ if (hasRequiredSync) return sync$9;
+ hasRequiredSync = 1;
+ sync$9 = globSync;
+ globSync.GlobSync = GlobSync;
+
+ var rp = fs_realpath;
+ var minimatch = minimatch_1;
+ requireGlob().Glob;
+ var path = require$$0$4;
+ var assert = require$$5;
+ var isAbsolute = require$$0$4.isAbsolute;
+ var common = common$c;
+ var setopts = common.setopts;
+ var ownProp = common.ownProp;
+ var childrenIgnored = common.childrenIgnored;
+ var isIgnored = common.isIgnored;
+
+ function globSync (pattern, options) {
+ if (typeof options === 'function' || arguments.length === 3)
+ throw new TypeError('callback provided to sync glob\n'+
+ 'See: https://github.com/isaacs/node-glob/issues/167')
+
+ return new GlobSync(pattern, options).found
+ }
+
+ function GlobSync (pattern, options) {
+ if (!pattern)
+ throw new Error('must provide pattern')
+
+ if (typeof options === 'function' || arguments.length === 3)
+ throw new TypeError('callback provided to sync glob\n'+
+ 'See: https://github.com/isaacs/node-glob/issues/167')
+
+ if (!(this instanceof GlobSync))
+ return new GlobSync(pattern, options)
+
+ setopts(this, pattern, options);
+
+ if (this.noprocess)
+ return this
+
+ var n = this.minimatch.set.length;
+ this.matches = new Array(n);
+ for (var i = 0; i < n; i ++) {
+ this._process(this.minimatch.set[i], i, false);
+ }
+ this._finish();
+ }
+
+ GlobSync.prototype._finish = function () {
+ assert.ok(this instanceof GlobSync);
+ if (this.realpath) {
+ var self = this;
+ this.matches.forEach(function (matchset, index) {
+ var set = self.matches[index] = Object.create(null);
+ for (var p in matchset) {
+ try {
+ p = self._makeAbs(p);
+ var real = rp.realpathSync(p, self.realpathCache);
+ set[real] = true;
+ } catch (er) {
+ if (er.syscall === 'stat')
+ set[self._makeAbs(p)] = true;
+ else
+ throw er
+ }
+ }
+ });
+ }
+ common.finish(this);
+ };
+
+
+ GlobSync.prototype._process = function (pattern, index, inGlobStar) {
+ assert.ok(this instanceof GlobSync);
+
+ // Get the first [n] parts of pattern that are all strings.
+ var n = 0;
+ while (typeof pattern[n] === 'string') {
+ n ++;
+ }
+ // now n is the index of the first one that is *not* a string.
+
+ // See if there's anything else
+ var prefix;
+ switch (n) {
+ // if not, then this is rather simple
+ case pattern.length:
+ this._processSimple(pattern.join('/'), index);
+ return
+
+ case 0:
+ // pattern *starts* with some non-trivial item.
+ // going to readdir(cwd), but not include the prefix in matches.
+ prefix = null;
+ break
+
+ default:
+ // pattern has some string bits in the front.
+ // whatever it starts with, whether that's 'absolute' like /foo/bar,
+ // or 'relative' like '../baz'
+ prefix = pattern.slice(0, n).join('/');
+ break
+ }
+
+ var remain = pattern.slice(n);
+
+ // get the list of entries.
+ var read;
+ if (prefix === null)
+ read = '.';
+ else if (isAbsolute(prefix) ||
+ isAbsolute(pattern.map(function (p) {
+ return typeof p === 'string' ? p : '[*]'
+ }).join('/'))) {
+ if (!prefix || !isAbsolute(prefix))
+ prefix = '/' + prefix;
+ read = prefix;
+ } else
+ read = prefix;
+
+ var abs = this._makeAbs(read);
+
+ //if ignored, skip processing
+ if (childrenIgnored(this, read))
+ return
+
+ var isGlobStar = remain[0] === minimatch.GLOBSTAR;
+ if (isGlobStar)
+ this._processGlobStar(prefix, read, abs, remain, index, inGlobStar);
+ else
+ this._processReaddir(prefix, read, abs, remain, index, inGlobStar);
+ };
+
+
+ GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
+ var entries = this._readdir(abs, inGlobStar);
+
+ // if the abs isn't a dir, then nothing can match!
+ if (!entries)
+ return
+
+ // It will only match dot entries if it starts with a dot, or if
+ // dot is set. Stuff like @(.foo|.bar) isn't allowed.
+ var pn = remain[0];
+ var negate = !!this.minimatch.negate;
+ var rawGlob = pn._glob;
+ var dotOk = this.dot || rawGlob.charAt(0) === '.';
+
+ var matchedEntries = [];
+ for (var i = 0; i < entries.length; i++) {
+ var e = entries[i];
+ if (e.charAt(0) !== '.' || dotOk) {
+ var m;
+ if (negate && !prefix) {
+ m = !e.match(pn);
+ } else {
+ m = e.match(pn);
+ }
+ if (m)
+ matchedEntries.push(e);
+ }
+ }
+
+ var len = matchedEntries.length;
+ // If there are no matched entries, then nothing matches.
+ if (len === 0)
+ return
+
+ // if this is the last remaining pattern bit, then no need for
+ // an additional stat *unless* the user has specified mark or
+ // stat explicitly. We know they exist, since readdir returned
+ // them.
+
+ if (remain.length === 1 && !this.mark && !this.stat) {
+ if (!this.matches[index])
+ this.matches[index] = Object.create(null);
+
+ for (var i = 0; i < len; i ++) {
+ var e = matchedEntries[i];
+ if (prefix) {
+ if (prefix.slice(-1) !== '/')
+ e = prefix + '/' + e;
+ else
+ e = prefix + e;
+ }
+
+ if (e.charAt(0) === '/' && !this.nomount) {
+ e = path.join(this.root, e);
+ }
+ this._emitMatch(index, e);
+ }
+ // This was the last one, and no stats were needed
+ return
+ }
+
+ // now test all matched entries as stand-ins for that part
+ // of the pattern.
+ remain.shift();
+ for (var i = 0; i < len; i ++) {
+ var e = matchedEntries[i];
+ var newPattern;
+ if (prefix)
+ newPattern = [prefix, e];
+ else
+ newPattern = [e];
+ this._process(newPattern.concat(remain), index, inGlobStar);
+ }
+ };
+
+
+ GlobSync.prototype._emitMatch = function (index, e) {
+ if (isIgnored(this, e))
+ return
+
+ var abs = this._makeAbs(e);
+
+ if (this.mark)
+ e = this._mark(e);
+
+ if (this.absolute) {
+ e = abs;
+ }
+
+ if (this.matches[index][e])
+ return
+
+ if (this.nodir) {
+ var c = this.cache[abs];
+ if (c === 'DIR' || Array.isArray(c))
+ return
+ }
+
+ this.matches[index][e] = true;
+
+ if (this.stat)
+ this._stat(e);
+ };
+
+
+ GlobSync.prototype._readdirInGlobStar = function (abs) {
+ // follow all symlinked directories forever
+ // just proceed as if this is a non-globstar situation
+ if (this.follow)
+ return this._readdir(abs, false)
+
+ var entries;
+ var lstat;
+ try {
+ lstat = this.fs.lstatSync(abs);
+ } catch (er) {
+ if (er.code === 'ENOENT') {
+ // lstat failed, doesn't exist
+ return null
+ }
+ }
+
+ var isSym = lstat && lstat.isSymbolicLink();
+ this.symlinks[abs] = isSym;
+
+ // If it's not a symlink or a dir, then it's definitely a regular file.
+ // don't bother doing a readdir in that case.
+ if (!isSym && lstat && !lstat.isDirectory())
+ this.cache[abs] = 'FILE';
+ else
+ entries = this._readdir(abs, false);
+
+ return entries
+ };
+
+ GlobSync.prototype._readdir = function (abs, inGlobStar) {
+
+ if (inGlobStar && !ownProp(this.symlinks, abs))
+ return this._readdirInGlobStar(abs)
+
+ if (ownProp(this.cache, abs)) {
+ var c = this.cache[abs];
+ if (!c || c === 'FILE')
+ return null
+
+ if (Array.isArray(c))
+ return c
+ }
+
+ try {
+ return this._readdirEntries(abs, this.fs.readdirSync(abs))
+ } catch (er) {
+ this._readdirError(abs, er);
+ return null
+ }
+ };
+
+ GlobSync.prototype._readdirEntries = function (abs, entries) {
+ // if we haven't asked to stat everything, then just
+ // assume that everything in there exists, so we can avoid
+ // having to stat it a second time.
+ if (!this.mark && !this.stat) {
+ for (var i = 0; i < entries.length; i ++) {
+ var e = entries[i];
+ if (abs === '/')
+ e = abs + e;
+ else
+ e = abs + '/' + e;
+ this.cache[e] = true;
+ }
+ }
+
+ this.cache[abs] = entries;
+
+ // mark and cache dir-ness
+ return entries
+ };
+
+ GlobSync.prototype._readdirError = function (f, er) {
+ // handle errors, and cache the information
+ switch (er.code) {
+ case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
+ case 'ENOTDIR': // totally normal. means it *does* exist.
+ var abs = this._makeAbs(f);
+ this.cache[abs] = 'FILE';
+ if (abs === this.cwdAbs) {
+ var error = new Error(er.code + ' invalid cwd ' + this.cwd);
+ error.path = this.cwd;
+ error.code = er.code;
+ throw error
+ }
+ break
+
+ case 'ENOENT': // not terribly unusual
+ case 'ELOOP':
+ case 'ENAMETOOLONG':
+ case 'UNKNOWN':
+ this.cache[this._makeAbs(f)] = false;
+ break
+
+ default: // some unusual error. Treat as failure.
+ this.cache[this._makeAbs(f)] = false;
+ if (this.strict)
+ throw er
+ if (!this.silent)
+ console.error('glob error', er);
+ break
+ }
+ };
+
+ GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
+
+ var entries = this._readdir(abs, inGlobStar);
+
+ // no entries means not a dir, so it can never have matches
+ // foo.txt/** doesn't match foo.txt
+ if (!entries)
+ return
+
+ // test without the globstar, and with every child both below
+ // and replacing the globstar.
+ var remainWithoutGlobStar = remain.slice(1);
+ var gspref = prefix ? [ prefix ] : [];
+ var noGlobStar = gspref.concat(remainWithoutGlobStar);
+
+ // the noGlobStar pattern exits the inGlobStar state
+ this._process(noGlobStar, index, false);
+
+ var len = entries.length;
+ var isSym = this.symlinks[abs];
+
+ // If it's a symlink, and we're in a globstar, then stop
+ if (isSym && inGlobStar)
+ return
+
+ for (var i = 0; i < len; i++) {
+ var e = entries[i];
+ if (e.charAt(0) === '.' && !this.dot)
+ continue
+
+ // these two cases enter the inGlobStar state
+ var instead = gspref.concat(entries[i], remainWithoutGlobStar);
+ this._process(instead, index, true);
+
+ var below = gspref.concat(entries[i], remain);
+ this._process(below, index, true);
+ }
+ };
+
+ GlobSync.prototype._processSimple = function (prefix, index) {
+ // XXX review this. Shouldn't it be doing the mounting etc
+ // before doing stat? kinda weird?
+ var exists = this._stat(prefix);
+
+ if (!this.matches[index])
+ this.matches[index] = Object.create(null);
+
+ // If it doesn't exist, then just mark the lack of results
+ if (!exists)
+ return
+
+ if (prefix && isAbsolute(prefix) && !this.nomount) {
+ var trail = /[\/\\]$/.test(prefix);
+ if (prefix.charAt(0) === '/') {
+ prefix = path.join(this.root, prefix);
+ } else {
+ prefix = path.resolve(this.root, prefix);
+ if (trail)
+ prefix += '/';
+ }
+ }
+
+ if (process.platform === 'win32')
+ prefix = prefix.replace(/\\/g, '/');
+
+ // Mark this as a match
+ this._emitMatch(index, prefix);
+ };
+
+ // Returns either 'DIR', 'FILE', or false
+ GlobSync.prototype._stat = function (f) {
+ var abs = this._makeAbs(f);
+ var needDir = f.slice(-1) === '/';
+
+ if (f.length > this.maxLength)
+ return false
+
+ if (!this.stat && ownProp(this.cache, abs)) {
+ var c = this.cache[abs];
+
+ if (Array.isArray(c))
+ c = 'DIR';
+
+ // It exists, but maybe not how we need it
+ if (!needDir || c === 'DIR')
+ return c
+
+ if (needDir && c === 'FILE')
+ return false
+
+ // otherwise we have to stat, because maybe c=true
+ // if we know it exists, but not what it is.
+ }
+ var stat = this.statCache[abs];
+ if (!stat) {
+ var lstat;
+ try {
+ lstat = this.fs.lstatSync(abs);
+ } catch (er) {
+ if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
+ this.statCache[abs] = false;
+ return false
+ }
+ }
+
+ if (lstat && lstat.isSymbolicLink()) {
+ try {
+ stat = this.fs.statSync(abs);
+ } catch (er) {
+ stat = lstat;
+ }
+ } else {
+ stat = lstat;
+ }
+ }
+
+ this.statCache[abs] = stat;
+
+ var c = true;
+ if (stat)
+ c = stat.isDirectory() ? 'DIR' : 'FILE';
+
+ this.cache[abs] = this.cache[abs] || c;
+
+ if (needDir && c === 'FILE')
+ return false
+
+ return c
+ };
+
+ GlobSync.prototype._mark = function (p) {
+ return common.mark(this, p)
+ };
+
+ GlobSync.prototype._makeAbs = function (f) {
+ return common.makeAbs(this, f)
+ };
+ return sync$9;
+}
+
+// Returns a wrapper function that returns a wrapped callback
+// The wrapper function should do some stuff, and return a
+// presumably different callback function.
+// This makes sure that own properties are retained, so that
+// decorations and such are not lost along the way.
+var wrappy_1 = wrappy$2;
+function wrappy$2 (fn, cb) {
+ if (fn && cb) return wrappy$2(fn)(cb)
+
+ if (typeof fn !== 'function')
+ throw new TypeError('need wrapper function')
+
+ Object.keys(fn).forEach(function (k) {
+ wrapper[k] = fn[k];
+ });
+
+ return wrapper
+
+ function wrapper() {
+ var args = new Array(arguments.length);
+ for (var i = 0; i < args.length; i++) {
+ args[i] = arguments[i];
+ }
+ var ret = fn.apply(this, args);
+ var cb = args[args.length-1];
+ if (typeof ret === 'function' && ret !== cb) {
+ Object.keys(cb).forEach(function (k) {
+ ret[k] = cb[k];
+ });
+ }
+ return ret
+ }
+}
+
+var once$2 = {exports: {}};
+
+var wrappy$1 = wrappy_1;
+once$2.exports = wrappy$1(once$1);
+once$2.exports.strict = wrappy$1(onceStrict);
+
+once$1.proto = once$1(function () {
+ Object.defineProperty(Function.prototype, 'once', {
+ value: function () {
+ return once$1(this)
+ },
+ configurable: true
+ });
+
+ Object.defineProperty(Function.prototype, 'onceStrict', {
+ value: function () {
+ return onceStrict(this)
+ },
+ configurable: true
+ });
+});
+
+function once$1 (fn) {
+ var f = function () {
+ if (f.called) return f.value
+ f.called = true;
+ return f.value = fn.apply(this, arguments)
+ };
+ f.called = false;
+ return f
+}
+
+function onceStrict (fn) {
+ var f = function () {
+ if (f.called)
+ throw new Error(f.onceError)
+ f.called = true;
+ return f.value = fn.apply(this, arguments)
+ };
+ var name = fn.name || 'Function wrapped with `once`';
+ f.onceError = name + " shouldn't be called more than once";
+ f.called = false;
+ return f
+}
+
+var onceExports = once$2.exports;
+
+var wrappy = wrappy_1;
+var reqs = Object.create(null);
+var once = onceExports;
+
+var inflight_1 = wrappy(inflight);
+
+function inflight (key, cb) {
+ if (reqs[key]) {
+ reqs[key].push(cb);
+ return null
+ } else {
+ reqs[key] = [cb];
+ return makeres(key)
+ }
+}
+
+function makeres (key) {
+ return once(function RES () {
+ var cbs = reqs[key];
+ var len = cbs.length;
+ var args = slice$1(arguments);
+
+ // XXX It's somewhat ambiguous whether a new callback added in this
+ // pass should be queued for later execution if something in the
+ // list of callbacks throws, or if it should just be discarded.
+ // However, it's such an edge case that it hardly matters, and either
+ // choice is likely as surprising as the other.
+ // As it happens, we do go ahead and schedule it for later execution.
+ try {
+ for (var i = 0; i < len; i++) {
+ cbs[i].apply(null, args);
+ }
+ } finally {
+ if (cbs.length > len) {
+ // added more in the interim.
+ // de-zalgo, just in case, but don't call again.
+ cbs.splice(0, len);
+ process.nextTick(function () {
+ RES.apply(null, args);
+ });
+ } else {
+ delete reqs[key];
+ }
+ }
+ })
+}
+
+function slice$1 (args) {
+ var length = args.length;
+ var array = [];
+
+ for (var i = 0; i < length; i++) array[i] = args[i];
+ return array
+}
+
+var glob_1;
+var hasRequiredGlob;
+
+function requireGlob () {
+ if (hasRequiredGlob) return glob_1;
+ hasRequiredGlob = 1;
+ // Approach:
+ //
+ // 1. Get the minimatch set
+ // 2. For each pattern in the set, PROCESS(pattern, false)
+ // 3. Store matches per-set, then uniq them
+ //
+ // PROCESS(pattern, inGlobStar)
+ // Get the first [n] items from pattern that are all strings
+ // Join these together. This is PREFIX.
+ // If there is no more remaining, then stat(PREFIX) and
+ // add to matches if it succeeds. END.
+ //
+ // If inGlobStar and PREFIX is symlink and points to dir
+ // set ENTRIES = []
+ // else readdir(PREFIX) as ENTRIES
+ // If fail, END
+ //
+ // with ENTRIES
+ // If pattern[n] is GLOBSTAR
+ // // handle the case where the globstar match is empty
+ // // by pruning it out, and testing the resulting pattern
+ // PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
+ // // handle other cases.
+ // for ENTRY in ENTRIES (not dotfiles)
+ // // attach globstar + tail onto the entry
+ // // Mark that this entry is a globstar match
+ // PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
+ //
+ // else // not globstar
+ // for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
+ // Test ENTRY against pattern[n]
+ // If fails, continue
+ // If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
+ //
+ // Caveat:
+ // Cache all stats and readdirs results to minimize syscall. Since all
+ // we ever care about is existence and directory-ness, we can just keep
+ // `true` for files, and [children,...] for directories, or `false` for
+ // things that don't exist.
+
+ glob_1 = glob;
+
+ var rp = fs_realpath;
+ var minimatch = minimatch_1;
+ var inherits = inheritsExports;
+ var EE = require$$0$5.EventEmitter;
+ var path = require$$0$4;
+ var assert = require$$5;
+ var isAbsolute = require$$0$4.isAbsolute;
+ var globSync = requireSync();
+ var common = common$c;
+ var setopts = common.setopts;
+ var ownProp = common.ownProp;
+ var inflight = inflight_1;
+ var childrenIgnored = common.childrenIgnored;
+ var isIgnored = common.isIgnored;
+
+ var once = onceExports;
+
+ function glob (pattern, options, cb) {
+ if (typeof options === 'function') cb = options, options = {};
+ if (!options) options = {};
+
+ if (options.sync) {
+ if (cb)
+ throw new TypeError('callback provided to sync glob')
+ return globSync(pattern, options)
+ }
+
+ return new Glob(pattern, options, cb)
+ }
+
+ glob.sync = globSync;
+ var GlobSync = glob.GlobSync = globSync.GlobSync;
+
+ // old api surface
+ glob.glob = glob;
+
+ function extend (origin, add) {
+ if (add === null || typeof add !== 'object') {
+ return origin
+ }
+
+ var keys = Object.keys(add);
+ var i = keys.length;
+ while (i--) {
+ origin[keys[i]] = add[keys[i]];
+ }
+ return origin
+ }
+
+ glob.hasMagic = function (pattern, options_) {
+ var options = extend({}, options_);
+ options.noprocess = true;
+
+ var g = new Glob(pattern, options);
+ var set = g.minimatch.set;
+
+ if (!pattern)
+ return false
+
+ if (set.length > 1)
+ return true
+
+ for (var j = 0; j < set[0].length; j++) {
+ if (typeof set[0][j] !== 'string')
+ return true
+ }
+
+ return false
+ };
+
+ glob.Glob = Glob;
+ inherits(Glob, EE);
+ function Glob (pattern, options, cb) {
+ if (typeof options === 'function') {
+ cb = options;
+ options = null;
+ }
+
+ if (options && options.sync) {
+ if (cb)
+ throw new TypeError('callback provided to sync glob')
+ return new GlobSync(pattern, options)
+ }
+
+ if (!(this instanceof Glob))
+ return new Glob(pattern, options, cb)
+
+ setopts(this, pattern, options);
+ this._didRealPath = false;
+
+ // process each pattern in the minimatch set
+ var n = this.minimatch.set.length;
+
+ // The matches are stored as {: true,...} so that
+ // duplicates are automagically pruned.
+ // Later, we do an Object.keys() on these.
+ // Keep them as a list so we can fill in when nonull is set.
+ this.matches = new Array(n);
+
+ if (typeof cb === 'function') {
+ cb = once(cb);
+ this.on('error', cb);
+ this.on('end', function (matches) {
+ cb(null, matches);
+ });
+ }
+
+ var self = this;
+ this._processing = 0;
+
+ this._emitQueue = [];
+ this._processQueue = [];
+ this.paused = false;
+
+ if (this.noprocess)
+ return this
+
+ if (n === 0)
+ return done()
+
+ var sync = true;
+ for (var i = 0; i < n; i ++) {
+ this._process(this.minimatch.set[i], i, false, done);
+ }
+ sync = false;
+
+ function done () {
+ --self._processing;
+ if (self._processing <= 0) {
+ if (sync) {
+ process.nextTick(function () {
+ self._finish();
+ });
+ } else {
+ self._finish();
+ }
+ }
+ }
+ }
+
+ Glob.prototype._finish = function () {
+ assert(this instanceof Glob);
+ if (this.aborted)
+ return
+
+ if (this.realpath && !this._didRealpath)
+ return this._realpath()
+
+ common.finish(this);
+ this.emit('end', this.found);
+ };
+
+ Glob.prototype._realpath = function () {
+ if (this._didRealpath)
+ return
+
+ this._didRealpath = true;
+
+ var n = this.matches.length;
+ if (n === 0)
+ return this._finish()
+
+ var self = this;
+ for (var i = 0; i < this.matches.length; i++)
+ this._realpathSet(i, next);
+
+ function next () {
+ if (--n === 0)
+ self._finish();
+ }
+ };
+
+ Glob.prototype._realpathSet = function (index, cb) {
+ var matchset = this.matches[index];
+ if (!matchset)
+ return cb()
+
+ var found = Object.keys(matchset);
+ var self = this;
+ var n = found.length;
+
+ if (n === 0)
+ return cb()
+
+ var set = this.matches[index] = Object.create(null);
+ found.forEach(function (p, i) {
+ // If there's a problem with the stat, then it means that
+ // one or more of the links in the realpath couldn't be
+ // resolved. just return the abs value in that case.
+ p = self._makeAbs(p);
+ rp.realpath(p, self.realpathCache, function (er, real) {
+ if (!er)
+ set[real] = true;
+ else if (er.syscall === 'stat')
+ set[p] = true;
+ else
+ self.emit('error', er); // srsly wtf right here
+
+ if (--n === 0) {
+ self.matches[index] = set;
+ cb();
+ }
+ });
+ });
+ };
+
+ Glob.prototype._mark = function (p) {
+ return common.mark(this, p)
+ };
+
+ Glob.prototype._makeAbs = function (f) {
+ return common.makeAbs(this, f)
+ };
+
+ Glob.prototype.abort = function () {
+ this.aborted = true;
+ this.emit('abort');
+ };
+
+ Glob.prototype.pause = function () {
+ if (!this.paused) {
+ this.paused = true;
+ this.emit('pause');
+ }
+ };
+
+ Glob.prototype.resume = function () {
+ if (this.paused) {
+ this.emit('resume');
+ this.paused = false;
+ if (this._emitQueue.length) {
+ var eq = this._emitQueue.slice(0);
+ this._emitQueue.length = 0;
+ for (var i = 0; i < eq.length; i ++) {
+ var e = eq[i];
+ this._emitMatch(e[0], e[1]);
+ }
+ }
+ if (this._processQueue.length) {
+ var pq = this._processQueue.slice(0);
+ this._processQueue.length = 0;
+ for (var i = 0; i < pq.length; i ++) {
+ var p = pq[i];
+ this._processing--;
+ this._process(p[0], p[1], p[2], p[3]);
+ }
+ }
+ }
+ };
+
+ Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
+ assert(this instanceof Glob);
+ assert(typeof cb === 'function');
+
+ if (this.aborted)
+ return
+
+ this._processing++;
+ if (this.paused) {
+ this._processQueue.push([pattern, index, inGlobStar, cb]);
+ return
+ }
+
+ //console.error('PROCESS %d', this._processing, pattern)
+
+ // Get the first [n] parts of pattern that are all strings.
+ var n = 0;
+ while (typeof pattern[n] === 'string') {
+ n ++;
+ }
+ // now n is the index of the first one that is *not* a string.
+
+ // see if there's anything else
+ var prefix;
+ switch (n) {
+ // if not, then this is rather simple
+ case pattern.length:
+ this._processSimple(pattern.join('/'), index, cb);
+ return
+
+ case 0:
+ // pattern *starts* with some non-trivial item.
+ // going to readdir(cwd), but not include the prefix in matches.
+ prefix = null;
+ break
+
+ default:
+ // pattern has some string bits in the front.
+ // whatever it starts with, whether that's 'absolute' like /foo/bar,
+ // or 'relative' like '../baz'
+ prefix = pattern.slice(0, n).join('/');
+ break
+ }
+
+ var remain = pattern.slice(n);
+
+ // get the list of entries.
+ var read;
+ if (prefix === null)
+ read = '.';
+ else if (isAbsolute(prefix) ||
+ isAbsolute(pattern.map(function (p) {
+ return typeof p === 'string' ? p : '[*]'
+ }).join('/'))) {
+ if (!prefix || !isAbsolute(prefix))
+ prefix = '/' + prefix;
+ read = prefix;
+ } else
+ read = prefix;
+
+ var abs = this._makeAbs(read);
+
+ //if ignored, skip _processing
+ if (childrenIgnored(this, read))
+ return cb()
+
+ var isGlobStar = remain[0] === minimatch.GLOBSTAR;
+ if (isGlobStar)
+ this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb);
+ else
+ this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb);
+ };
+
+ Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
+ var self = this;
+ this._readdir(abs, inGlobStar, function (er, entries) {
+ return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
+ });
+ };
+
+ Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
+
+ // if the abs isn't a dir, then nothing can match!
+ if (!entries)
+ return cb()
+
+ // It will only match dot entries if it starts with a dot, or if
+ // dot is set. Stuff like @(.foo|.bar) isn't allowed.
+ var pn = remain[0];
+ var negate = !!this.minimatch.negate;
+ var rawGlob = pn._glob;
+ var dotOk = this.dot || rawGlob.charAt(0) === '.';
+
+ var matchedEntries = [];
+ for (var i = 0; i < entries.length; i++) {
+ var e = entries[i];
+ if (e.charAt(0) !== '.' || dotOk) {
+ var m;
+ if (negate && !prefix) {
+ m = !e.match(pn);
+ } else {
+ m = e.match(pn);
+ }
+ if (m)
+ matchedEntries.push(e);
+ }
+ }
+
+ //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
+
+ var len = matchedEntries.length;
+ // If there are no matched entries, then nothing matches.
+ if (len === 0)
+ return cb()
+
+ // if this is the last remaining pattern bit, then no need for
+ // an additional stat *unless* the user has specified mark or
+ // stat explicitly. We know they exist, since readdir returned
+ // them.
+
+ if (remain.length === 1 && !this.mark && !this.stat) {
+ if (!this.matches[index])
+ this.matches[index] = Object.create(null);
+
+ for (var i = 0; i < len; i ++) {
+ var e = matchedEntries[i];
+ if (prefix) {
+ if (prefix !== '/')
+ e = prefix + '/' + e;
+ else
+ e = prefix + e;
+ }
+
+ if (e.charAt(0) === '/' && !this.nomount) {
+ e = path.join(this.root, e);
+ }
+ this._emitMatch(index, e);
+ }
+ // This was the last one, and no stats were needed
+ return cb()
+ }
+
+ // now test all matched entries as stand-ins for that part
+ // of the pattern.
+ remain.shift();
+ for (var i = 0; i < len; i ++) {
+ var e = matchedEntries[i];
+ if (prefix) {
+ if (prefix !== '/')
+ e = prefix + '/' + e;
+ else
+ e = prefix + e;
+ }
+ this._process([e].concat(remain), index, inGlobStar, cb);
+ }
+ cb();
+ };
+
+ Glob.prototype._emitMatch = function (index, e) {
+ if (this.aborted)
+ return
+
+ if (isIgnored(this, e))
+ return
+
+ if (this.paused) {
+ this._emitQueue.push([index, e]);
+ return
+ }
+
+ var abs = isAbsolute(e) ? e : this._makeAbs(e);
+
+ if (this.mark)
+ e = this._mark(e);
+
+ if (this.absolute)
+ e = abs;
+
+ if (this.matches[index][e])
+ return
+
+ if (this.nodir) {
+ var c = this.cache[abs];
+ if (c === 'DIR' || Array.isArray(c))
+ return
+ }
+
+ this.matches[index][e] = true;
+
+ var st = this.statCache[abs];
+ if (st)
+ this.emit('stat', e, st);
+
+ this.emit('match', e);
+ };
+
+ Glob.prototype._readdirInGlobStar = function (abs, cb) {
+ if (this.aborted)
+ return
+
+ // follow all symlinked directories forever
+ // just proceed as if this is a non-globstar situation
+ if (this.follow)
+ return this._readdir(abs, false, cb)
+
+ var lstatkey = 'lstat\0' + abs;
+ var self = this;
+ var lstatcb = inflight(lstatkey, lstatcb_);
+
+ if (lstatcb)
+ self.fs.lstat(abs, lstatcb);
+
+ function lstatcb_ (er, lstat) {
+ if (er && er.code === 'ENOENT')
+ return cb()
+
+ var isSym = lstat && lstat.isSymbolicLink();
+ self.symlinks[abs] = isSym;
+
+ // If it's not a symlink or a dir, then it's definitely a regular file.
+ // don't bother doing a readdir in that case.
+ if (!isSym && lstat && !lstat.isDirectory()) {
+ self.cache[abs] = 'FILE';
+ cb();
+ } else
+ self._readdir(abs, false, cb);
+ }
+ };
+
+ Glob.prototype._readdir = function (abs, inGlobStar, cb) {
+ if (this.aborted)
+ return
+
+ cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb);
+ if (!cb)
+ return
+
+ //console.error('RD %j %j', +inGlobStar, abs)
+ if (inGlobStar && !ownProp(this.symlinks, abs))
+ return this._readdirInGlobStar(abs, cb)
+
+ if (ownProp(this.cache, abs)) {
+ var c = this.cache[abs];
+ if (!c || c === 'FILE')
+ return cb()
+
+ if (Array.isArray(c))
+ return cb(null, c)
+ }
+
+ var self = this;
+ self.fs.readdir(abs, readdirCb(this, abs, cb));
+ };
+
+ function readdirCb (self, abs, cb) {
+ return function (er, entries) {
+ if (er)
+ self._readdirError(abs, er, cb);
+ else
+ self._readdirEntries(abs, entries, cb);
+ }
+ }
+
+ Glob.prototype._readdirEntries = function (abs, entries, cb) {
+ if (this.aborted)
+ return
+
+ // if we haven't asked to stat everything, then just
+ // assume that everything in there exists, so we can avoid
+ // having to stat it a second time.
+ if (!this.mark && !this.stat) {
+ for (var i = 0; i < entries.length; i ++) {
+ var e = entries[i];
+ if (abs === '/')
+ e = abs + e;
+ else
+ e = abs + '/' + e;
+ this.cache[e] = true;
+ }
+ }
+
+ this.cache[abs] = entries;
+ return cb(null, entries)
+ };
+
+ Glob.prototype._readdirError = function (f, er, cb) {
+ if (this.aborted)
+ return
+
+ // handle errors, and cache the information
+ switch (er.code) {
+ case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
+ case 'ENOTDIR': // totally normal. means it *does* exist.
+ var abs = this._makeAbs(f);
+ this.cache[abs] = 'FILE';
+ if (abs === this.cwdAbs) {
+ var error = new Error(er.code + ' invalid cwd ' + this.cwd);
+ error.path = this.cwd;
+ error.code = er.code;
+ this.emit('error', error);
+ this.abort();
+ }
+ break
+
+ case 'ENOENT': // not terribly unusual
+ case 'ELOOP':
+ case 'ENAMETOOLONG':
+ case 'UNKNOWN':
+ this.cache[this._makeAbs(f)] = false;
+ break
+
+ default: // some unusual error. Treat as failure.
+ this.cache[this._makeAbs(f)] = false;
+ if (this.strict) {
+ this.emit('error', er);
+ // If the error is handled, then we abort
+ // if not, we threw out of here
+ this.abort();
+ }
+ if (!this.silent)
+ console.error('glob error', er);
+ break
+ }
+
+ return cb()
+ };
+
+ Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
+ var self = this;
+ this._readdir(abs, inGlobStar, function (er, entries) {
+ self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
+ });
+ };
+
+
+ Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
+ //console.error('pgs2', prefix, remain[0], entries)
+
+ // no entries means not a dir, so it can never have matches
+ // foo.txt/** doesn't match foo.txt
+ if (!entries)
+ return cb()
+
+ // test without the globstar, and with every child both below
+ // and replacing the globstar.
+ var remainWithoutGlobStar = remain.slice(1);
+ var gspref = prefix ? [ prefix ] : [];
+ var noGlobStar = gspref.concat(remainWithoutGlobStar);
+
+ // the noGlobStar pattern exits the inGlobStar state
+ this._process(noGlobStar, index, false, cb);
+
+ var isSym = this.symlinks[abs];
+ var len = entries.length;
+
+ // If it's a symlink, and we're in a globstar, then stop
+ if (isSym && inGlobStar)
+ return cb()
+
+ for (var i = 0; i < len; i++) {
+ var e = entries[i];
+ if (e.charAt(0) === '.' && !this.dot)
+ continue
+
+ // these two cases enter the inGlobStar state
+ var instead = gspref.concat(entries[i], remainWithoutGlobStar);
+ this._process(instead, index, true, cb);
+
+ var below = gspref.concat(entries[i], remain);
+ this._process(below, index, true, cb);
+ }
+
+ cb();
+ };
+
+ Glob.prototype._processSimple = function (prefix, index, cb) {
+ // XXX review this. Shouldn't it be doing the mounting etc
+ // before doing stat? kinda weird?
+ var self = this;
+ this._stat(prefix, function (er, exists) {
+ self._processSimple2(prefix, index, er, exists, cb);
+ });
+ };
+ Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
+
+ //console.error('ps2', prefix, exists)
+
+ if (!this.matches[index])
+ this.matches[index] = Object.create(null);
+
+ // If it doesn't exist, then just mark the lack of results
+ if (!exists)
+ return cb()
+
+ if (prefix && isAbsolute(prefix) && !this.nomount) {
+ var trail = /[\/\\]$/.test(prefix);
+ if (prefix.charAt(0) === '/') {
+ prefix = path.join(this.root, prefix);
+ } else {
+ prefix = path.resolve(this.root, prefix);
+ if (trail)
+ prefix += '/';
+ }
+ }
+
+ if (process.platform === 'win32')
+ prefix = prefix.replace(/\\/g, '/');
+
+ // Mark this as a match
+ this._emitMatch(index, prefix);
+ cb();
+ };
+
+ // Returns either 'DIR', 'FILE', or false
+ Glob.prototype._stat = function (f, cb) {
+ var abs = this._makeAbs(f);
+ var needDir = f.slice(-1) === '/';
+
+ if (f.length > this.maxLength)
+ return cb()
+
+ if (!this.stat && ownProp(this.cache, abs)) {
+ var c = this.cache[abs];
+
+ if (Array.isArray(c))
+ c = 'DIR';
+
+ // It exists, but maybe not how we need it
+ if (!needDir || c === 'DIR')
+ return cb(null, c)
+
+ if (needDir && c === 'FILE')
+ return cb()
+
+ // otherwise we have to stat, because maybe c=true
+ // if we know it exists, but not what it is.
+ }
+ var stat = this.statCache[abs];
+ if (stat !== undefined) {
+ if (stat === false)
+ return cb(null, stat)
+ else {
+ var type = stat.isDirectory() ? 'DIR' : 'FILE';
+ if (needDir && type === 'FILE')
+ return cb()
+ else
+ return cb(null, type, stat)
+ }
+ }
+
+ var self = this;
+ var statcb = inflight('stat\0' + abs, lstatcb_);
+ if (statcb)
+ self.fs.lstat(abs, statcb);
+
+ function lstatcb_ (er, lstat) {
+ if (lstat && lstat.isSymbolicLink()) {
+ // If it's a symlink, then treat it as the target, unless
+ // the target does not exist, then treat it as a file.
+ return self.fs.stat(abs, function (er, stat) {
+ if (er)
+ self._stat2(f, abs, null, lstat, cb);
+ else
+ self._stat2(f, abs, er, stat, cb);
+ })
+ } else {
+ self._stat2(f, abs, er, lstat, cb);
+ }
+ }
+ };
+
+ Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
+ if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
+ this.statCache[abs] = false;
+ return cb()
+ }
+
+ var needDir = f.slice(-1) === '/';
+ this.statCache[abs] = stat;
+
+ if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
+ return cb(null, false, stat)
+
+ var c = true;
+ if (stat)
+ c = stat.isDirectory() ? 'DIR' : 'FILE';
+ this.cache[abs] = this.cache[abs] || c;
+
+ if (needDir && c === 'FILE')
+ return cb()
+
+ return cb(null, c, stat)
+ };
+ return glob_1;
+}
+
+var globExports = requireGlob();
+var glob$1 = /*@__PURE__*/getDefaultExportFromCjs(globExports);
+
+const comma$1 = ','.charCodeAt(0);
+const semicolon = ';'.charCodeAt(0);
+const chars$2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+const intToChar$1 = new Uint8Array(64); // 64 possible chars.
+const charToInt$1 = new Uint8Array(128); // z is 122 in ASCII
+for (let i = 0; i < chars$2.length; i++) {
+ const c = chars$2.charCodeAt(i);
+ intToChar$1[i] = c;
+ charToInt$1[c] = i;
+}
+// Provide a fallback for older environments.
+const td = typeof TextDecoder !== 'undefined'
+ ? /* #__PURE__ */ new TextDecoder()
+ : typeof Buffer !== 'undefined'
+ ? {
+ decode(buf) {
+ const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
+ return out.toString();
+ },
+ }
+ : {
+ decode(buf) {
+ let out = '';
+ for (let i = 0; i < buf.length; i++) {
+ out += String.fromCharCode(buf[i]);
+ }
+ return out;
+ },
+ };
+function encode$1(decoded) {
+ const state = new Int32Array(5);
+ const bufLength = 1024 * 16;
+ const subLength = bufLength - 36;
+ const buf = new Uint8Array(bufLength);
+ const sub = buf.subarray(0, subLength);
+ let pos = 0;
+ let out = '';
+ for (let i = 0; i < decoded.length; i++) {
+ const line = decoded[i];
+ if (i > 0) {
+ if (pos === bufLength) {
+ out += td.decode(buf);
+ pos = 0;
+ }
+ buf[pos++] = semicolon;
+ }
+ if (line.length === 0)
+ continue;
+ state[0] = 0;
+ for (let j = 0; j < line.length; j++) {
+ const segment = line[j];
+ // We can push up to 5 ints, each int can take at most 7 chars, and we
+ // may push a comma.
+ if (pos > subLength) {
+ out += td.decode(sub);
+ buf.copyWithin(0, subLength, pos);
+ pos -= subLength;
+ }
+ if (j > 0)
+ buf[pos++] = comma$1;
+ pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
+ if (segment.length === 1)
+ continue;
+ pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
+ pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
+ pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
+ if (segment.length === 4)
+ continue;
+ pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
+ }
+ }
+ return out + td.decode(buf.subarray(0, pos));
+}
+function encodeInteger(buf, pos, state, segment, j) {
+ const next = segment[j];
+ let num = next - state[j];
+ state[j] = next;
+ num = num < 0 ? (-num << 1) | 1 : num << 1;
+ do {
+ let clamped = num & 0b011111;
+ num >>>= 5;
+ if (num > 0)
+ clamped |= 0b100000;
+ buf[pos++] = intToChar$1[clamped];
+ } while (num > 0);
+ return pos;
+}
+
+let BitSet$1 = class BitSet {
+ constructor(arg) {
+ this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
+ }
+
+ add(n) {
+ this.bits[n >> 5] |= 1 << (n & 31);
+ }
+
+ has(n) {
+ return !!(this.bits[n >> 5] & (1 << (n & 31)));
+ }
+};
+
+let Chunk$1 = class Chunk {
+ constructor(start, end, content) {
+ this.start = start;
+ this.end = end;
+ this.original = content;
+
+ this.intro = '';
+ this.outro = '';
+
+ this.content = content;
+ this.storeName = false;
+ this.edited = false;
+
+ {
+ this.previous = null;
+ this.next = null;
+ }
+ }
+
+ appendLeft(content) {
+ this.outro += content;
+ }
+
+ appendRight(content) {
+ this.intro = this.intro + content;
+ }
+
+ clone() {
+ const chunk = new Chunk(this.start, this.end, this.original);
+
+ chunk.intro = this.intro;
+ chunk.outro = this.outro;
+ chunk.content = this.content;
+ chunk.storeName = this.storeName;
+ chunk.edited = this.edited;
+
+ return chunk;
+ }
+
+ contains(index) {
+ return this.start < index && index < this.end;
+ }
+
+ eachNext(fn) {
+ let chunk = this;
+ while (chunk) {
+ fn(chunk);
+ chunk = chunk.next;
+ }
+ }
+
+ eachPrevious(fn) {
+ let chunk = this;
+ while (chunk) {
+ fn(chunk);
+ chunk = chunk.previous;
+ }
+ }
+
+ edit(content, storeName, contentOnly) {
+ this.content = content;
+ if (!contentOnly) {
+ this.intro = '';
+ this.outro = '';
+ }
+ this.storeName = storeName;
+
+ this.edited = true;
+
+ return this;
+ }
+
+ prependLeft(content) {
+ this.outro = content + this.outro;
+ }
+
+ prependRight(content) {
+ this.intro = content + this.intro;
+ }
+
+ split(index) {
+ const sliceIndex = index - this.start;
+
+ const originalBefore = this.original.slice(0, sliceIndex);
+ const originalAfter = this.original.slice(sliceIndex);
+
+ this.original = originalBefore;
+
+ const newChunk = new Chunk(index, this.end, originalAfter);
+ newChunk.outro = this.outro;
+ this.outro = '';
+
+ this.end = index;
+
+ if (this.edited) {
+ // TODO is this block necessary?...
+ newChunk.edit('', false);
+ this.content = '';
+ } else {
+ this.content = originalBefore;
+ }
+
+ newChunk.next = this.next;
+ if (newChunk.next) newChunk.next.previous = newChunk;
+ newChunk.previous = this;
+ this.next = newChunk;
+
+ return newChunk;
+ }
+
+ toString() {
+ return this.intro + this.content + this.outro;
+ }
+
+ trimEnd(rx) {
+ this.outro = this.outro.replace(rx, '');
+ if (this.outro.length) return true;
+
+ const trimmed = this.content.replace(rx, '');
+
+ if (trimmed.length) {
+ if (trimmed !== this.content) {
+ this.split(this.start + trimmed.length).edit('', undefined, true);
+ }
+ return true;
+ } else {
+ this.edit('', undefined, true);
+
+ this.intro = this.intro.replace(rx, '');
+ if (this.intro.length) return true;
+ }
+ }
+
+ trimStart(rx) {
+ this.intro = this.intro.replace(rx, '');
+ if (this.intro.length) return true;
+
+ const trimmed = this.content.replace(rx, '');
+
+ if (trimmed.length) {
+ if (trimmed !== this.content) {
+ this.split(this.end - trimmed.length);
+ this.edit('', undefined, true);
+ }
+ return true;
+ } else {
+ this.edit('', undefined, true);
+
+ this.outro = this.outro.replace(rx, '');
+ if (this.outro.length) return true;
+ }
+ }
+};
+
+function getBtoa$1 () {
+ if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
+ return (str) => window.btoa(unescape(encodeURIComponent(str)));
+ } else if (typeof Buffer === 'function') {
+ return (str) => Buffer.from(str, 'utf-8').toString('base64');
+ } else {
+ return () => {
+ throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
+ };
+ }
+}
+
+const btoa$2 = /*#__PURE__*/ getBtoa$1();
+
+let SourceMap$2 = class SourceMap {
+ constructor(properties) {
+ this.version = 3;
+ this.file = properties.file;
+ this.sources = properties.sources;
+ this.sourcesContent = properties.sourcesContent;
+ this.names = properties.names;
+ this.mappings = encode$1(properties.mappings);
+ }
+
+ toString() {
+ return JSON.stringify(this);
+ }
+
+ toUrl() {
+ return 'data:application/json;charset=utf-8;base64,' + btoa$2(this.toString());
+ }
+};
+
+function guessIndent$1(code) {
+ const lines = code.split('\n');
+
+ const tabbed = lines.filter((line) => /^\t+/.test(line));
+ const spaced = lines.filter((line) => /^ {2,}/.test(line));
+
+ if (tabbed.length === 0 && spaced.length === 0) {
+ return null;
+ }
+
+ // More lines tabbed than spaced? Assume tabs, and
+ // default to tabs in the case of a tie (or nothing
+ // to go on)
+ if (tabbed.length >= spaced.length) {
+ return '\t';
+ }
+
+ // Otherwise, we need to guess the multiple
+ const min = spaced.reduce((previous, current) => {
+ const numSpaces = /^ +/.exec(current)[0].length;
+ return Math.min(numSpaces, previous);
+ }, Infinity);
+
+ return new Array(min + 1).join(' ');
+}
+
+function getRelativePath$1(from, to) {
+ const fromParts = from.split(/[/\\]/);
+ const toParts = to.split(/[/\\]/);
+
+ fromParts.pop(); // get dirname
+
+ while (fromParts[0] === toParts[0]) {
+ fromParts.shift();
+ toParts.shift();
+ }
+
+ if (fromParts.length) {
+ let i = fromParts.length;
+ while (i--) fromParts[i] = '..';
+ }
+
+ return fromParts.concat(toParts).join('/');
+}
+
+const toString$3 = Object.prototype.toString;
+
+function isObject$3(thing) {
+ return toString$3.call(thing) === '[object Object]';
+}
+
+function getLocator$1(source) {
+ const originalLines = source.split('\n');
+ const lineOffsets = [];
+
+ for (let i = 0, pos = 0; i < originalLines.length; i++) {
+ lineOffsets.push(pos);
+ pos += originalLines[i].length + 1;
+ }
+
+ return function locate(index) {
+ let i = 0;
+ let j = lineOffsets.length;
+ while (i < j) {
+ const m = (i + j) >> 1;
+ if (index < lineOffsets[m]) {
+ j = m;
+ } else {
+ i = m + 1;
+ }
+ }
+ const line = i - 1;
+ const column = index - lineOffsets[line];
+ return { line, column };
+ };
+}
+
+let Mappings$1 = class Mappings {
+ constructor(hires) {
+ this.hires = hires;
+ this.generatedCodeLine = 0;
+ this.generatedCodeColumn = 0;
+ this.raw = [];
+ this.rawSegments = this.raw[this.generatedCodeLine] = [];
+ this.pending = null;
+ }
+
+ addEdit(sourceIndex, content, loc, nameIndex) {
+ if (content.length) {
+ const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
+ if (nameIndex >= 0) {
+ segment.push(nameIndex);
+ }
+ this.rawSegments.push(segment);
+ } else if (this.pending) {
+ this.rawSegments.push(this.pending);
+ }
+
+ this.advance(content);
+ this.pending = null;
+ }
+
+ addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
+ let originalCharIndex = chunk.start;
+ let first = true;
+
+ while (originalCharIndex < chunk.end) {
+ if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
+ this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
+ }
+
+ if (original[originalCharIndex] === '\n') {
+ loc.line += 1;
+ loc.column = 0;
+ this.generatedCodeLine += 1;
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
+ this.generatedCodeColumn = 0;
+ first = true;
+ } else {
+ loc.column += 1;
+ this.generatedCodeColumn += 1;
+ first = false;
+ }
+
+ originalCharIndex += 1;
+ }
+
+ this.pending = null;
+ }
+
+ advance(str) {
+ if (!str) return;
+
+ const lines = str.split('\n');
+
+ if (lines.length > 1) {
+ for (let i = 0; i < lines.length - 1; i++) {
+ this.generatedCodeLine++;
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
+ }
+ this.generatedCodeColumn = 0;
+ }
+
+ this.generatedCodeColumn += lines[lines.length - 1].length;
+ }
+};
+
+const n$2 = '\n';
+
+const warned$1 = {
+ insertLeft: false,
+ insertRight: false,
+ storeName: false,
+};
+
+let MagicString$1 = class MagicString {
+ constructor(string, options = {}) {
+ const chunk = new Chunk$1(0, string.length, string);
+
+ Object.defineProperties(this, {
+ original: { writable: true, value: string },
+ outro: { writable: true, value: '' },
+ intro: { writable: true, value: '' },
+ firstChunk: { writable: true, value: chunk },
+ lastChunk: { writable: true, value: chunk },
+ lastSearchedChunk: { writable: true, value: chunk },
+ byStart: { writable: true, value: {} },
+ byEnd: { writable: true, value: {} },
+ filename: { writable: true, value: options.filename },
+ indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
+ sourcemapLocations: { writable: true, value: new BitSet$1() },
+ storedNames: { writable: true, value: {} },
+ indentStr: { writable: true, value: undefined },
+ });
+
+ this.byStart[0] = chunk;
+ this.byEnd[string.length] = chunk;
+ }
+
+ addSourcemapLocation(char) {
+ this.sourcemapLocations.add(char);
+ }
+
+ append(content) {
+ if (typeof content !== 'string') throw new TypeError('outro content must be a string');
+
+ this.outro += content;
+ return this;
+ }
+
+ appendLeft(index, content) {
+ if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
+
+ this._split(index);
+
+ const chunk = this.byEnd[index];
+
+ if (chunk) {
+ chunk.appendLeft(content);
+ } else {
+ this.intro += content;
+ }
+ return this;
+ }
+
+ appendRight(index, content) {
+ if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
+
+ this._split(index);
+
+ const chunk = this.byStart[index];
+
+ if (chunk) {
+ chunk.appendRight(content);
+ } else {
+ this.outro += content;
+ }
+ return this;
+ }
+
+ clone() {
+ const cloned = new MagicString(this.original, { filename: this.filename });
+
+ let originalChunk = this.firstChunk;
+ let clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
+
+ while (originalChunk) {
+ cloned.byStart[clonedChunk.start] = clonedChunk;
+ cloned.byEnd[clonedChunk.end] = clonedChunk;
+
+ const nextOriginalChunk = originalChunk.next;
+ const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
+
+ if (nextClonedChunk) {
+ clonedChunk.next = nextClonedChunk;
+ nextClonedChunk.previous = clonedChunk;
+
+ clonedChunk = nextClonedChunk;
+ }
+
+ originalChunk = nextOriginalChunk;
+ }
+
+ cloned.lastChunk = clonedChunk;
+
+ if (this.indentExclusionRanges) {
+ cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
+ }
+
+ cloned.sourcemapLocations = new BitSet$1(this.sourcemapLocations);
+
+ cloned.intro = this.intro;
+ cloned.outro = this.outro;
+
+ return cloned;
+ }
+
+ generateDecodedMap(options) {
+ options = options || {};
+
+ const sourceIndex = 0;
+ const names = Object.keys(this.storedNames);
+ const mappings = new Mappings$1(options.hires);
+
+ const locate = getLocator$1(this.original);
+
+ if (this.intro) {
+ mappings.advance(this.intro);
+ }
+
+ this.firstChunk.eachNext((chunk) => {
+ const loc = locate(chunk.start);
+
+ if (chunk.intro.length) mappings.advance(chunk.intro);
+
+ if (chunk.edited) {
+ mappings.addEdit(
+ sourceIndex,
+ chunk.content,
+ loc,
+ chunk.storeName ? names.indexOf(chunk.original) : -1
+ );
+ } else {
+ mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
+ }
+
+ if (chunk.outro.length) mappings.advance(chunk.outro);
+ });
+
+ return {
+ file: options.file ? options.file.split(/[/\\]/).pop() : null,
+ sources: [options.source ? getRelativePath$1(options.file || '', options.source) : null],
+ sourcesContent: options.includeContent ? [this.original] : [null],
+ names,
+ mappings: mappings.raw,
+ };
+ }
+
+ generateMap(options) {
+ return new SourceMap$2(this.generateDecodedMap(options));
+ }
+
+ _ensureindentStr() {
+ if (this.indentStr === undefined) {
+ this.indentStr = guessIndent$1(this.original);
+ }
+ }
+
+ _getRawIndentString() {
+ this._ensureindentStr();
+ return this.indentStr;
+ }
+
+ getIndentString() {
+ this._ensureindentStr();
+ return this.indentStr === null ? '\t' : this.indentStr;
+ }
+
+ indent(indentStr, options) {
+ const pattern = /^[^\r\n]/gm;
+
+ if (isObject$3(indentStr)) {
+ options = indentStr;
+ indentStr = undefined;
+ }
+
+ if (indentStr === undefined) {
+ this._ensureindentStr();
+ indentStr = this.indentStr || '\t';
+ }
+
+ if (indentStr === '') return this; // noop
+
+ options = options || {};
+
+ // Process exclusion ranges
+ const isExcluded = {};
+
+ if (options.exclude) {
+ const exclusions =
+ typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
+ exclusions.forEach((exclusion) => {
+ for (let i = exclusion[0]; i < exclusion[1]; i += 1) {
+ isExcluded[i] = true;
+ }
+ });
+ }
+
+ let shouldIndentNextCharacter = options.indentStart !== false;
+ const replacer = (match) => {
+ if (shouldIndentNextCharacter) return `${indentStr}${match}`;
+ shouldIndentNextCharacter = true;
+ return match;
+ };
+
+ this.intro = this.intro.replace(pattern, replacer);
+
+ let charIndex = 0;
+ let chunk = this.firstChunk;
+
+ while (chunk) {
+ const end = chunk.end;
+
+ if (chunk.edited) {
+ if (!isExcluded[charIndex]) {
+ chunk.content = chunk.content.replace(pattern, replacer);
+
+ if (chunk.content.length) {
+ shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n';
+ }
+ }
+ } else {
+ charIndex = chunk.start;
+
+ while (charIndex < end) {
+ if (!isExcluded[charIndex]) {
+ const char = this.original[charIndex];
+
+ if (char === '\n') {
+ shouldIndentNextCharacter = true;
+ } else if (char !== '\r' && shouldIndentNextCharacter) {
+ shouldIndentNextCharacter = false;
+
+ if (charIndex === chunk.start) {
+ chunk.prependRight(indentStr);
+ } else {
+ this._splitChunk(chunk, charIndex);
+ chunk = chunk.next;
+ chunk.prependRight(indentStr);
+ }
+ }
+ }
+
+ charIndex += 1;
+ }
+ }
+
+ charIndex = chunk.end;
+ chunk = chunk.next;
+ }
+
+ this.outro = this.outro.replace(pattern, replacer);
+
+ return this;
+ }
+
+ insert() {
+ throw new Error(
+ 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)'
+ );
+ }
+
+ insertLeft(index, content) {
+ if (!warned$1.insertLeft) {
+ console.warn(
+ 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'
+ ); // eslint-disable-line no-console
+ warned$1.insertLeft = true;
+ }
+
+ return this.appendLeft(index, content);
+ }
+
+ insertRight(index, content) {
+ if (!warned$1.insertRight) {
+ console.warn(
+ 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'
+ ); // eslint-disable-line no-console
+ warned$1.insertRight = true;
+ }
+
+ return this.prependRight(index, content);
+ }
+
+ move(start, end, index) {
+ if (index >= start && index <= end) throw new Error('Cannot move a selection inside itself');
+
+ this._split(start);
+ this._split(end);
+ this._split(index);
+
+ const first = this.byStart[start];
+ const last = this.byEnd[end];
+
+ const oldLeft = first.previous;
+ const oldRight = last.next;
+
+ const newRight = this.byStart[index];
+ if (!newRight && last === this.lastChunk) return this;
+ const newLeft = newRight ? newRight.previous : this.lastChunk;
+
+ if (oldLeft) oldLeft.next = oldRight;
+ if (oldRight) oldRight.previous = oldLeft;
+
+ if (newLeft) newLeft.next = first;
+ if (newRight) newRight.previous = last;
+
+ if (!first.previous) this.firstChunk = last.next;
+ if (!last.next) {
+ this.lastChunk = first.previous;
+ this.lastChunk.next = null;
+ }
+
+ first.previous = newLeft;
+ last.next = newRight || null;
+
+ if (!newLeft) this.firstChunk = first;
+ if (!newRight) this.lastChunk = last;
+ return this;
+ }
+
+ overwrite(start, end, content, options) {
+ options = options || {};
+ return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
+ }
+
+ update(start, end, content, options) {
+ if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
+
+ while (start < 0) start += this.original.length;
+ while (end < 0) end += this.original.length;
+
+ if (end > this.original.length) throw new Error('end is out of bounds');
+ if (start === end)
+ throw new Error(
+ 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead'
+ );
+
+ this._split(start);
+ this._split(end);
+
+ if (options === true) {
+ if (!warned$1.storeName) {
+ console.warn(
+ 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'
+ ); // eslint-disable-line no-console
+ warned$1.storeName = true;
+ }
+
+ options = { storeName: true };
+ }
+ const storeName = options !== undefined ? options.storeName : false;
+ const overwrite = options !== undefined ? options.overwrite : false;
+
+ if (storeName) {
+ const original = this.original.slice(start, end);
+ Object.defineProperty(this.storedNames, original, {
+ writable: true,
+ value: true,
+ enumerable: true,
+ });
+ }
+
+ const first = this.byStart[start];
+ const last = this.byEnd[end];
+
+ if (first) {
+ let chunk = first;
+ while (chunk !== last) {
+ if (chunk.next !== this.byStart[chunk.end]) {
+ throw new Error('Cannot overwrite across a split point');
+ }
+ chunk = chunk.next;
+ chunk.edit('', false);
+ }
+
+ first.edit(content, storeName, !overwrite);
+ } else {
+ // must be inserting at the end
+ const newChunk = new Chunk$1(start, end, '').edit(content, storeName);
+
+ // TODO last chunk in the array may not be the last chunk, if it's moved...
+ last.next = newChunk;
+ newChunk.previous = last;
+ }
+ return this;
+ }
+
+ prepend(content) {
+ if (typeof content !== 'string') throw new TypeError('outro content must be a string');
+
+ this.intro = content + this.intro;
+ return this;
+ }
+
+ prependLeft(index, content) {
+ if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
+
+ this._split(index);
+
+ const chunk = this.byEnd[index];
+
+ if (chunk) {
+ chunk.prependLeft(content);
+ } else {
+ this.intro = content + this.intro;
+ }
+ return this;
+ }
+
+ prependRight(index, content) {
+ if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
+
+ this._split(index);
+
+ const chunk = this.byStart[index];
+
+ if (chunk) {
+ chunk.prependRight(content);
+ } else {
+ this.outro = content + this.outro;
+ }
+ return this;
+ }
+
+ remove(start, end) {
+ while (start < 0) start += this.original.length;
+ while (end < 0) end += this.original.length;
+
+ if (start === end) return this;
+
+ if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');
+ if (start > end) throw new Error('end must be greater than start');
+
+ this._split(start);
+ this._split(end);
+
+ let chunk = this.byStart[start];
+
+ while (chunk) {
+ chunk.intro = '';
+ chunk.outro = '';
+ chunk.edit('');
+
+ chunk = end > chunk.end ? this.byStart[chunk.end] : null;
+ }
+ return this;
+ }
+
+ lastChar() {
+ if (this.outro.length) return this.outro[this.outro.length - 1];
+ let chunk = this.lastChunk;
+ do {
+ if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];
+ if (chunk.content.length) return chunk.content[chunk.content.length - 1];
+ if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];
+ } while ((chunk = chunk.previous));
+ if (this.intro.length) return this.intro[this.intro.length - 1];
+ return '';
+ }
+
+ lastLine() {
+ let lineIndex = this.outro.lastIndexOf(n$2);
+ if (lineIndex !== -1) return this.outro.substr(lineIndex + 1);
+ let lineStr = this.outro;
+ let chunk = this.lastChunk;
+ do {
+ if (chunk.outro.length > 0) {
+ lineIndex = chunk.outro.lastIndexOf(n$2);
+ if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;
+ lineStr = chunk.outro + lineStr;
+ }
+
+ if (chunk.content.length > 0) {
+ lineIndex = chunk.content.lastIndexOf(n$2);
+ if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;
+ lineStr = chunk.content + lineStr;
+ }
+
+ if (chunk.intro.length > 0) {
+ lineIndex = chunk.intro.lastIndexOf(n$2);
+ if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;
+ lineStr = chunk.intro + lineStr;
+ }
+ } while ((chunk = chunk.previous));
+ lineIndex = this.intro.lastIndexOf(n$2);
+ if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;
+ return this.intro + lineStr;
+ }
+
+ slice(start = 0, end = this.original.length) {
+ while (start < 0) start += this.original.length;
+ while (end < 0) end += this.original.length;
+
+ let result = '';
+
+ // find start chunk
+ let chunk = this.firstChunk;
+ while (chunk && (chunk.start > start || chunk.end <= start)) {
+ // found end chunk before start
+ if (chunk.start < end && chunk.end >= end) {
+ return result;
+ }
+
+ chunk = chunk.next;
+ }
+
+ if (chunk && chunk.edited && chunk.start !== start)
+ throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
+
+ const startChunk = chunk;
+ while (chunk) {
+ if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
+ result += chunk.intro;
+ }
+
+ const containsEnd = chunk.start < end && chunk.end >= end;
+ if (containsEnd && chunk.edited && chunk.end !== end)
+ throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
+
+ const sliceStart = startChunk === chunk ? start - chunk.start : 0;
+ const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
+
+ result += chunk.content.slice(sliceStart, sliceEnd);
+
+ if (chunk.outro && (!containsEnd || chunk.end === end)) {
+ result += chunk.outro;
+ }
+
+ if (containsEnd) {
+ break;
+ }
+
+ chunk = chunk.next;
+ }
+
+ return result;
+ }
+
+ // TODO deprecate this? not really very useful
+ snip(start, end) {
+ const clone = this.clone();
+ clone.remove(0, start);
+ clone.remove(end, clone.original.length);
+
+ return clone;
+ }
+
+ _split(index) {
+ if (this.byStart[index] || this.byEnd[index]) return;
+
+ let chunk = this.lastSearchedChunk;
+ const searchForward = index > chunk.end;
+
+ while (chunk) {
+ if (chunk.contains(index)) return this._splitChunk(chunk, index);
+
+ chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
+ }
+ }
+
+ _splitChunk(chunk, index) {
+ if (chunk.edited && chunk.content.length) {
+ // zero-length edited chunks are a special case (overlapping replacements)
+ const loc = getLocator$1(this.original)(index);
+ throw new Error(
+ `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`
+ );
+ }
+
+ const newChunk = chunk.split(index);
+
+ this.byEnd[index] = chunk;
+ this.byStart[index] = newChunk;
+ this.byEnd[newChunk.end] = newChunk;
+
+ if (chunk === this.lastChunk) this.lastChunk = newChunk;
+
+ this.lastSearchedChunk = chunk;
+ return true;
+ }
+
+ toString() {
+ let str = this.intro;
+
+ let chunk = this.firstChunk;
+ while (chunk) {
+ str += chunk.toString();
+ chunk = chunk.next;
+ }
+
+ return str + this.outro;
+ }
+
+ isEmpty() {
+ let chunk = this.firstChunk;
+ do {
+ if (
+ (chunk.intro.length && chunk.intro.trim()) ||
+ (chunk.content.length && chunk.content.trim()) ||
+ (chunk.outro.length && chunk.outro.trim())
+ )
+ return false;
+ } while ((chunk = chunk.next));
+ return true;
+ }
+
+ length() {
+ let chunk = this.firstChunk;
+ let length = 0;
+ do {
+ length += chunk.intro.length + chunk.content.length + chunk.outro.length;
+ } while ((chunk = chunk.next));
+ return length;
+ }
+
+ trimLines() {
+ return this.trim('[\\r\\n]');
+ }
+
+ trim(charType) {
+ return this.trimStart(charType).trimEnd(charType);
+ }
+
+ trimEndAborted(charType) {
+ const rx = new RegExp((charType || '\\s') + '+$');
+
+ this.outro = this.outro.replace(rx, '');
+ if (this.outro.length) return true;
+
+ let chunk = this.lastChunk;
+
+ do {
+ const end = chunk.end;
+ const aborted = chunk.trimEnd(rx);
+
+ // if chunk was trimmed, we have a new lastChunk
+ if (chunk.end !== end) {
+ if (this.lastChunk === chunk) {
+ this.lastChunk = chunk.next;
+ }
+
+ this.byEnd[chunk.end] = chunk;
+ this.byStart[chunk.next.start] = chunk.next;
+ this.byEnd[chunk.next.end] = chunk.next;
+ }
+
+ if (aborted) return true;
+ chunk = chunk.previous;
+ } while (chunk);
+
+ return false;
+ }
+
+ trimEnd(charType) {
+ this.trimEndAborted(charType);
+ return this;
+ }
+ trimStartAborted(charType) {
+ const rx = new RegExp('^' + (charType || '\\s') + '+');
+
+ this.intro = this.intro.replace(rx, '');
+ if (this.intro.length) return true;
+
+ let chunk = this.firstChunk;
+
+ do {
+ const end = chunk.end;
+ const aborted = chunk.trimStart(rx);
+
+ if (chunk.end !== end) {
+ // special case...
+ if (chunk === this.lastChunk) this.lastChunk = chunk.next;
+
+ this.byEnd[chunk.end] = chunk;
+ this.byStart[chunk.next.start] = chunk.next;
+ this.byEnd[chunk.next.end] = chunk.next;
+ }
+
+ if (aborted) return true;
+ chunk = chunk.next;
+ } while (chunk);
+
+ return false;
+ }
+
+ trimStart(charType) {
+ this.trimStartAborted(charType);
+ return this;
+ }
+
+ hasChanged() {
+ return this.original !== this.toString();
+ }
+
+ _replaceRegexp(searchValue, replacement) {
+ function getReplacement(match, str) {
+ if (typeof replacement === 'string') {
+ return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter
+ if (i === '$') return '$';
+ if (i === '&') return match[0];
+ const num = +i;
+ if (num < match.length) return match[+i];
+ return `$${i}`;
+ });
+ } else {
+ return replacement(...match, match.index, str, match.groups);
+ }
+ }
+ function matchAll(re, str) {
+ let match;
+ const matches = [];
+ while ((match = re.exec(str))) {
+ matches.push(match);
+ }
+ return matches;
+ }
+ if (searchValue.global) {
+ const matches = matchAll(searchValue, this.original);
+ matches.forEach((match) => {
+ if (match.index != null)
+ this.overwrite(
+ match.index,
+ match.index + match[0].length,
+ getReplacement(match, this.original)
+ );
+ });
+ } else {
+ const match = this.original.match(searchValue);
+ if (match && match.index != null)
+ this.overwrite(
+ match.index,
+ match.index + match[0].length,
+ getReplacement(match, this.original)
+ );
+ }
+ return this;
+ }
+
+ _replaceString(string, replacement) {
+ const { original } = this;
+ const index = original.indexOf(string);
+
+ if (index !== -1) {
+ this.overwrite(index, index + string.length, replacement);
+ }
+
+ return this;
+ }
+
+ replace(searchValue, replacement) {
+ if (typeof searchValue === 'string') {
+ return this._replaceString(searchValue, replacement);
+ }
+
+ return this._replaceRegexp(searchValue, replacement);
+ }
+
+ _replaceAllString(string, replacement) {
+ const { original } = this;
+ const stringLength = string.length;
+ for (
+ let index = original.indexOf(string);
+ index !== -1;
+ index = original.indexOf(string, index + stringLength)
+ ) {
+ this.overwrite(index, index + stringLength, replacement);
+ }
+
+ return this;
+ }
+
+ replaceAll(searchValue, replacement) {
+ if (typeof searchValue === 'string') {
+ return this._replaceAllString(searchValue, replacement);
+ }
+
+ if (!searchValue.global) {
+ throw new TypeError(
+ 'MagicString.prototype.replaceAll called with a non-global RegExp argument'
+ );
+ }
+
+ return this._replaceRegexp(searchValue, replacement);
+ }
+};
+
+function isReference(node, parent) {
+ if (node.type === 'MemberExpression') {
+ return !node.computed && isReference(node.object, node);
+ }
+ if (node.type === 'Identifier') {
+ if (!parent)
+ return true;
+ switch (parent.type) {
+ // disregard `bar` in `foo.bar`
+ case 'MemberExpression': return parent.computed || node === parent.object;
+ // disregard the `foo` in `class {foo(){}}` but keep it in `class {[foo](){}}`
+ case 'MethodDefinition': return parent.computed;
+ // disregard the `foo` in `class {foo=bar}` but keep it in `class {[foo]=bar}` and `class {bar=foo}`
+ case 'FieldDefinition': return parent.computed || node === parent.value;
+ // disregard the `bar` in `{ bar: foo }`, but keep it in `{ [bar]: foo }`
+ case 'Property': return parent.computed || node === parent.value;
+ // disregard the `bar` in `export { foo as bar }` or
+ // the foo in `import { foo as bar }`
+ case 'ExportSpecifier':
+ case 'ImportSpecifier': return node === parent.local;
+ // disregard the `foo` in `foo: while (...) { ... break foo; ... continue foo;}`
+ case 'LabeledStatement':
+ case 'BreakStatement':
+ case 'ContinueStatement': return false;
+ default: return true;
+ }
+ }
+ return false;
+}
+
+var version$3 = "25.0.3";
+var peerDependencies = {
+ rollup: "^2.68.0||^3.0.0"
+};
+
+function tryParse(parse, code, id) {
+ try {
+ return parse(code, { allowReturnOutsideFunction: true });
+ } catch (err) {
+ err.message += ` in ${id}`;
+ throw err;
+ }
+}
+
+const firstpassGlobal = /\b(?:require|module|exports|global)\b/;
+
+const firstpassNoGlobal = /\b(?:require|module|exports)\b/;
+
+function hasCjsKeywords(code, ignoreGlobal) {
+ const firstpass = ignoreGlobal ? firstpassNoGlobal : firstpassGlobal;
+ return firstpass.test(code);
+}
+
+/* eslint-disable no-underscore-dangle */
+
+function analyzeTopLevelStatements(parse, code, id) {
+ const ast = tryParse(parse, code, id);
+
+ let isEsModule = false;
+ let hasDefaultExport = false;
+ let hasNamedExports = false;
+
+ for (const node of ast.body) {
+ switch (node.type) {
+ case 'ExportDefaultDeclaration':
+ isEsModule = true;
+ hasDefaultExport = true;
+ break;
+ case 'ExportNamedDeclaration':
+ isEsModule = true;
+ if (node.declaration) {
+ hasNamedExports = true;
+ } else {
+ for (const specifier of node.specifiers) {
+ if (specifier.exported.name === 'default') {
+ hasDefaultExport = true;
+ } else {
+ hasNamedExports = true;
+ }
+ }
+ }
+ break;
+ case 'ExportAllDeclaration':
+ isEsModule = true;
+ if (node.exported && node.exported.name === 'default') {
+ hasDefaultExport = true;
+ } else {
+ hasNamedExports = true;
+ }
+ break;
+ case 'ImportDeclaration':
+ isEsModule = true;
+ break;
+ }
+ }
+
+ return { isEsModule, hasDefaultExport, hasNamedExports, ast };
+}
+
+/* eslint-disable import/prefer-default-export */
+
+function deconflict(scopes, globals, identifier) {
+ let i = 1;
+ let deconflicted = makeLegalIdentifier(identifier);
+ const hasConflicts = () =>
+ scopes.some((scope) => scope.contains(deconflicted)) || globals.has(deconflicted);
+
+ while (hasConflicts()) {
+ deconflicted = makeLegalIdentifier(`${identifier}_${i}`);
+ i += 1;
+ }
+
+ for (const scope of scopes) {
+ scope.declarations[deconflicted] = true;
+ }
+
+ return deconflicted;
+}
+
+function getName(id) {
+ const name = makeLegalIdentifier(basename$1(id, extname(id)));
+ if (name !== 'index') {
+ return name;
+ }
+ return makeLegalIdentifier(basename$1(dirname$1(id)));
+}
+
+function normalizePathSlashes(path) {
+ return path.replace(/\\/g, '/');
+}
+
+const getVirtualPathForDynamicRequirePath = (path, commonDir) =>
+ `/${normalizePathSlashes(relative$1(commonDir, path))}`;
+
+function capitalize(name) {
+ return name[0].toUpperCase() + name.slice(1);
+}
+
+function getStrictRequiresFilter({ strictRequires }) {
+ switch (strictRequires) {
+ case true:
+ return { strictRequiresFilter: () => true, detectCyclesAndConditional: false };
+ // eslint-disable-next-line no-undefined
+ case undefined:
+ case 'auto':
+ case 'debug':
+ case null:
+ return { strictRequiresFilter: () => false, detectCyclesAndConditional: true };
+ case false:
+ return { strictRequiresFilter: () => false, detectCyclesAndConditional: false };
+ default:
+ if (typeof strictRequires === 'string' || Array.isArray(strictRequires)) {
+ return {
+ strictRequiresFilter: createFilter$1(strictRequires),
+ detectCyclesAndConditional: false
+ };
+ }
+ throw new Error('Unexpected value for "strictRequires" option.');
+ }
+}
+
+function getPackageEntryPoint(dirPath) {
+ let entryPoint = 'index.js';
+
+ try {
+ if (existsSync(join$1(dirPath, 'package.json'))) {
+ entryPoint =
+ JSON.parse(readFileSync(join$1(dirPath, 'package.json'), { encoding: 'utf8' })).main ||
+ entryPoint;
+ }
+ } catch (ignored) {
+ // ignored
+ }
+
+ return entryPoint;
+}
+
+function isDirectory(path) {
+ try {
+ if (statSync$1(path).isDirectory()) return true;
+ } catch (ignored) {
+ // Nothing to do here
+ }
+ return false;
+}
+
+function getDynamicRequireModules(patterns, dynamicRequireRoot) {
+ const dynamicRequireModules = new Map();
+ const dirNames = new Set();
+ for (const pattern of !patterns || Array.isArray(patterns) ? patterns || [] : [patterns]) {
+ const isNegated = pattern.startsWith('!');
+ const modifyMap = (targetPath, resolvedPath) =>
+ isNegated
+ ? dynamicRequireModules.delete(targetPath)
+ : dynamicRequireModules.set(targetPath, resolvedPath);
+ for (const path of glob$1.sync(isNegated ? pattern.substr(1) : pattern)) {
+ const resolvedPath = resolve$3(path);
+ const requirePath = normalizePathSlashes(resolvedPath);
+ if (isDirectory(resolvedPath)) {
+ dirNames.add(resolvedPath);
+ const modulePath = resolve$3(join$1(resolvedPath, getPackageEntryPoint(path)));
+ modifyMap(requirePath, modulePath);
+ modifyMap(normalizePathSlashes(modulePath), modulePath);
+ } else {
+ dirNames.add(dirname$1(resolvedPath));
+ modifyMap(requirePath, resolvedPath);
+ }
+ }
+ }
+ return {
+ commonDir: dirNames.size ? getCommonDir([...dirNames, dynamicRequireRoot]) : null,
+ dynamicRequireModules
+ };
+}
+
+const FAILED_REQUIRE_ERROR = `throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');`;
+
+const COMMONJS_REQUIRE_EXPORT = 'commonjsRequire';
+const CREATE_COMMONJS_REQUIRE_EXPORT = 'createCommonjsRequire';
+
+function getDynamicModuleRegistry(
+ isDynamicRequireModulesEnabled,
+ dynamicRequireModules,
+ commonDir,
+ ignoreDynamicRequires
+) {
+ if (!isDynamicRequireModulesEnabled) {
+ return `export function ${COMMONJS_REQUIRE_EXPORT}(path) {
+ ${FAILED_REQUIRE_ERROR}
+}`;
+ }
+ const dynamicModuleImports = [...dynamicRequireModules.values()]
+ .map(
+ (id, index) =>
+ `import ${
+ id.endsWith('.json') ? `json${index}` : `{ __require as require${index} }`
+ } from ${JSON.stringify(id)};`
+ )
+ .join('\n');
+ const dynamicModuleProps = [...dynamicRequireModules.keys()]
+ .map(
+ (id, index) =>
+ `\t\t${JSON.stringify(getVirtualPathForDynamicRequirePath(id, commonDir))}: ${
+ id.endsWith('.json') ? `function () { return json${index}; }` : `require${index}`
+ }`
+ )
+ .join(',\n');
+ return `${dynamicModuleImports}
+
+var dynamicModules;
+
+function getDynamicModules() {
+ return dynamicModules || (dynamicModules = {
+${dynamicModuleProps}
+ });
+}
+
+export function ${CREATE_COMMONJS_REQUIRE_EXPORT}(originalModuleDir) {
+ function handleRequire(path) {
+ var resolvedPath = commonjsResolve(path, originalModuleDir);
+ if (resolvedPath !== null) {
+ return getDynamicModules()[resolvedPath]();
+ }
+ ${ignoreDynamicRequires ? 'return require(path);' : FAILED_REQUIRE_ERROR}
+ }
+ handleRequire.resolve = function (path) {
+ var resolvedPath = commonjsResolve(path, originalModuleDir);
+ if (resolvedPath !== null) {
+ return resolvedPath;
+ }
+ return require.resolve(path);
+ }
+ return handleRequire;
+}
+
+function commonjsResolve (path, originalModuleDir) {
+ var shouldTryNodeModules = isPossibleNodeModulesPath(path);
+ path = normalize(path);
+ var relPath;
+ if (path[0] === '/') {
+ originalModuleDir = '';
+ }
+ var modules = getDynamicModules();
+ var checkedExtensions = ['', '.js', '.json'];
+ while (true) {
+ if (!shouldTryNodeModules) {
+ relPath = normalize(originalModuleDir + '/' + path);
+ } else {
+ relPath = normalize(originalModuleDir + '/node_modules/' + path);
+ }
+
+ if (relPath.endsWith('/..')) {
+ break; // Travelled too far up, avoid infinite loop
+ }
+
+ for (var extensionIndex = 0; extensionIndex < checkedExtensions.length; extensionIndex++) {
+ var resolvedPath = relPath + checkedExtensions[extensionIndex];
+ if (modules[resolvedPath]) {
+ return resolvedPath;
+ }
+ }
+ if (!shouldTryNodeModules) break;
+ var nextDir = normalize(originalModuleDir + '/..');
+ if (nextDir === originalModuleDir) break;
+ originalModuleDir = nextDir;
+ }
+ return null;
+}
+
+function isPossibleNodeModulesPath (modulePath) {
+ var c0 = modulePath[0];
+ if (c0 === '/' || c0 === '\\\\') return false;
+ var c1 = modulePath[1], c2 = modulePath[2];
+ if ((c0 === '.' && (!c1 || c1 === '/' || c1 === '\\\\')) ||
+ (c0 === '.' && c1 === '.' && (!c2 || c2 === '/' || c2 === '\\\\'))) return false;
+ if (c1 === ':' && (c2 === '/' || c2 === '\\\\')) return false;
+ return true;
+}
+
+function normalize (path) {
+ path = path.replace(/\\\\/g, '/');
+ var parts = path.split('/');
+ var slashed = parts[0] === '';
+ for (var i = 1; i < parts.length; i++) {
+ if (parts[i] === '.' || parts[i] === '') {
+ parts.splice(i--, 1);
+ }
+ }
+ for (var i = 1; i < parts.length; i++) {
+ if (parts[i] !== '..') continue;
+ if (i > 0 && parts[i - 1] !== '..' && parts[i - 1] !== '.') {
+ parts.splice(--i, 2);
+ i--;
+ }
+ }
+ path = parts.join('/');
+ if (slashed && path[0] !== '/') path = '/' + path;
+ else if (path.length === 0) path = '.';
+ return path;
+}`;
+}
+
+const isWrappedId = (id, suffix) => id.endsWith(suffix);
+const wrapId$1 = (id, suffix) => `\0${id}${suffix}`;
+const unwrapId$1 = (wrappedId, suffix) => wrappedId.slice(1, -suffix.length);
+
+const PROXY_SUFFIX = '?commonjs-proxy';
+const WRAPPED_SUFFIX = '?commonjs-wrapped';
+const EXTERNAL_SUFFIX = '?commonjs-external';
+const EXPORTS_SUFFIX = '?commonjs-exports';
+const MODULE_SUFFIX = '?commonjs-module';
+const ENTRY_SUFFIX = '?commonjs-entry';
+const ES_IMPORT_SUFFIX = '?commonjs-es-import';
+
+const DYNAMIC_MODULES_ID = '\0commonjs-dynamic-modules';
+const HELPERS_ID = '\0commonjsHelpers.js';
+
+const IS_WRAPPED_COMMONJS = 'withRequireFunction';
+
+// `x['default']` is used instead of `x.default` for backward compatibility with ES3 browsers.
+// Minifiers like uglify will usually transpile it back if compatibility with ES3 is not enabled.
+// This could be improved by inspecting Rollup's "generatedCode" option
+
+const HELPERS = `
+export var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
+
+export function getDefaultExportFromCjs (x) {
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
+}
+
+export function getDefaultExportFromNamespaceIfPresent (n) {
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
+}
+
+export function getDefaultExportFromNamespaceIfNotNamed (n) {
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
+}
+
+export function getAugmentedNamespace(n) {
+ if (n.__esModule) return n;
+ var f = n.default;
+ if (typeof f == "function") {
+ var a = function a () {
+ if (this instanceof a) {
+ return Reflect.construct(f, arguments, this.constructor);
+ }
+ return f.apply(this, arguments);
+ };
+ a.prototype = f.prototype;
+ } else a = {};
+ Object.defineProperty(a, '__esModule', {value: true});
+ Object.keys(n).forEach(function (k) {
+ var d = Object.getOwnPropertyDescriptor(n, k);
+ Object.defineProperty(a, k, d.get ? d : {
+ enumerable: true,
+ get: function () {
+ return n[k];
+ }
+ });
+ });
+ return a;
+}
+`;
+
+function getHelpersModule() {
+ return HELPERS;
+}
+
+function getUnknownRequireProxy(id, requireReturnsDefault) {
+ if (requireReturnsDefault === true || id.endsWith('.json')) {
+ return `export { default } from ${JSON.stringify(id)};`;
+ }
+ const name = getName(id);
+ const exported =
+ requireReturnsDefault === 'auto'
+ ? `import { getDefaultExportFromNamespaceIfNotNamed } from "${HELPERS_ID}"; export default /*@__PURE__*/getDefaultExportFromNamespaceIfNotNamed(${name});`
+ : requireReturnsDefault === 'preferred'
+ ? `import { getDefaultExportFromNamespaceIfPresent } from "${HELPERS_ID}"; export default /*@__PURE__*/getDefaultExportFromNamespaceIfPresent(${name});`
+ : !requireReturnsDefault
+ ? `import { getAugmentedNamespace } from "${HELPERS_ID}"; export default /*@__PURE__*/getAugmentedNamespace(${name});`
+ : `export default ${name};`;
+ return `import * as ${name} from ${JSON.stringify(id)}; ${exported}`;
+}
+
+async function getStaticRequireProxy(id, requireReturnsDefault, loadModule) {
+ const name = getName(id);
+ const {
+ meta: { commonjs: commonjsMeta }
+ } = await loadModule({ id });
+ if (!commonjsMeta) {
+ return getUnknownRequireProxy(id, requireReturnsDefault);
+ }
+ if (commonjsMeta.isCommonJS) {
+ return `export { __moduleExports as default } from ${JSON.stringify(id)};`;
+ }
+ if (!requireReturnsDefault) {
+ return `import { getAugmentedNamespace } from "${HELPERS_ID}"; import * as ${name} from ${JSON.stringify(
+ id
+ )}; export default /*@__PURE__*/getAugmentedNamespace(${name});`;
+ }
+ if (
+ requireReturnsDefault !== true &&
+ (requireReturnsDefault === 'namespace' ||
+ !commonjsMeta.hasDefaultExport ||
+ (requireReturnsDefault === 'auto' && commonjsMeta.hasNamedExports))
+ ) {
+ return `import * as ${name} from ${JSON.stringify(id)}; export default ${name};`;
+ }
+ return `export { default } from ${JSON.stringify(id)};`;
+}
+
+function getEntryProxy(id, defaultIsModuleExports, getModuleInfo) {
+ const {
+ meta: { commonjs: commonjsMeta },
+ hasDefaultExport
+ } = getModuleInfo(id);
+ if (!commonjsMeta || commonjsMeta.isCommonJS !== IS_WRAPPED_COMMONJS) {
+ const stringifiedId = JSON.stringify(id);
+ let code = `export * from ${stringifiedId};`;
+ if (hasDefaultExport) {
+ code += `export { default } from ${stringifiedId};`;
+ }
+ return code;
+ }
+ return getEsImportProxy(id, defaultIsModuleExports);
+}
+
+function getEsImportProxy(id, defaultIsModuleExports) {
+ const name = getName(id);
+ const exportsName = `${name}Exports`;
+ const requireModule = `require${capitalize(name)}`;
+ let code =
+ `import { getDefaultExportFromCjs } from "${HELPERS_ID}";\n` +
+ `import { __require as ${requireModule} } from ${JSON.stringify(id)};\n` +
+ `var ${exportsName} = ${requireModule}();\n` +
+ `export { ${exportsName} as __moduleExports };`;
+ if (defaultIsModuleExports === true) {
+ code += `\nexport { ${exportsName} as default };`;
+ } else {
+ code += `export default /*@__PURE__*/getDefaultExportFromCjs(${exportsName});`;
+ }
+ return {
+ code,
+ syntheticNamedExports: '__moduleExports'
+ };
+}
+
+/* eslint-disable no-param-reassign, no-undefined */
+
+function getCandidatesForExtension(resolved, extension) {
+ return [resolved + extension, `${resolved}${sep$1}index${extension}`];
+}
+
+function getCandidates(resolved, extensions) {
+ return extensions.reduce(
+ (paths, extension) => paths.concat(getCandidatesForExtension(resolved, extension)),
+ [resolved]
+ );
+}
+
+function resolveExtensions(importee, importer, extensions) {
+ // not our problem
+ if (importee[0] !== '.' || !importer) return undefined;
+
+ const resolved = resolve$3(dirname$1(importer), importee);
+ const candidates = getCandidates(resolved, extensions);
+
+ for (let i = 0; i < candidates.length; i += 1) {
+ try {
+ const stats = statSync$1(candidates[i]);
+ if (stats.isFile()) return { id: candidates[i] };
+ } catch (err) {
+ /* noop */
+ }
+ }
+
+ return undefined;
+}
+
+function getResolveId(extensions, isPossibleCjsId) {
+ const currentlyResolving = new Map();
+
+ return {
+ /**
+ * This is a Maps of importers to Sets of require sources being resolved at
+ * the moment by resolveRequireSourcesAndUpdateMeta
+ */
+ currentlyResolving,
+ async resolveId(importee, importer, resolveOptions) {
+ const customOptions = resolveOptions.custom;
+ // All logic below is specific to ES imports.
+ // Also, if we do not skip this logic for requires that are resolved while
+ // transforming a commonjs file, it can easily lead to deadlocks.
+ if (
+ customOptions &&
+ customOptions['node-resolve'] &&
+ customOptions['node-resolve'].isRequire
+ ) {
+ return null;
+ }
+ const currentlyResolvingForParent = currentlyResolving.get(importer);
+ if (currentlyResolvingForParent && currentlyResolvingForParent.has(importee)) {
+ this.warn({
+ code: 'THIS_RESOLVE_WITHOUT_OPTIONS',
+ message:
+ 'It appears a plugin has implemented a "resolveId" hook that uses "this.resolve" without forwarding the third "options" parameter of "resolveId". This is problematic as it can lead to wrong module resolutions especially for the node-resolve plugin and in certain cases cause early exit errors for the commonjs plugin.\nIn rare cases, this warning can appear if the same file is both imported and required from the same mixed ES/CommonJS module, in which case it can be ignored.',
+ url: 'https://rollupjs.org/guide/en/#resolveid'
+ });
+ return null;
+ }
+
+ if (isWrappedId(importee, WRAPPED_SUFFIX)) {
+ return unwrapId$1(importee, WRAPPED_SUFFIX);
+ }
+
+ if (
+ importee.endsWith(ENTRY_SUFFIX) ||
+ isWrappedId(importee, MODULE_SUFFIX) ||
+ isWrappedId(importee, EXPORTS_SUFFIX) ||
+ isWrappedId(importee, PROXY_SUFFIX) ||
+ isWrappedId(importee, ES_IMPORT_SUFFIX) ||
+ isWrappedId(importee, EXTERNAL_SUFFIX) ||
+ importee.startsWith(HELPERS_ID) ||
+ importee === DYNAMIC_MODULES_ID
+ ) {
+ return importee;
+ }
+
+ if (importer) {
+ if (
+ importer === DYNAMIC_MODULES_ID ||
+ // Proxies are only importing resolved ids, no need to resolve again
+ isWrappedId(importer, PROXY_SUFFIX) ||
+ isWrappedId(importer, ES_IMPORT_SUFFIX) ||
+ importer.endsWith(ENTRY_SUFFIX)
+ ) {
+ return importee;
+ }
+ if (isWrappedId(importer, EXTERNAL_SUFFIX)) {
+ // We need to return null for unresolved imports so that the proper warning is shown
+ if (
+ !(await this.resolve(
+ importee,
+ importer,
+ Object.assign({ skipSelf: true }, resolveOptions)
+ ))
+ ) {
+ return null;
+ }
+ // For other external imports, we need to make sure they are handled as external
+ return { id: importee, external: true };
+ }
+ }
+
+ if (importee.startsWith('\0')) {
+ return null;
+ }
+
+ // If this is an entry point or ESM import, we need to figure out if the importee is wrapped and
+ // if that is the case, we need to add a proxy.
+ const resolved =
+ (await this.resolve(
+ importee,
+ importer,
+ Object.assign({ skipSelf: true }, resolveOptions)
+ )) || resolveExtensions(importee, importer, extensions);
+ // Make sure that even if other plugins resolve again, we ignore our own proxies
+ if (
+ !resolved ||
+ resolved.external ||
+ resolved.id.endsWith(ENTRY_SUFFIX) ||
+ isWrappedId(resolved.id, ES_IMPORT_SUFFIX) ||
+ !isPossibleCjsId(resolved.id)
+ ) {
+ return resolved;
+ }
+ const moduleInfo = await this.load(resolved);
+ const {
+ meta: { commonjs: commonjsMeta }
+ } = moduleInfo;
+ if (commonjsMeta) {
+ const { isCommonJS } = commonjsMeta;
+ if (isCommonJS) {
+ if (resolveOptions.isEntry) {
+ moduleInfo.moduleSideEffects = true;
+ // We must not precede entry proxies with a `\0` as that will mess up relative external resolution
+ return resolved.id + ENTRY_SUFFIX;
+ }
+ if (isCommonJS === IS_WRAPPED_COMMONJS) {
+ return { id: wrapId$1(resolved.id, ES_IMPORT_SUFFIX), meta: { commonjs: { resolved } } };
+ }
+ }
+ }
+ return resolved;
+ }
+ };
+}
+
+function getRequireResolver(extensions, detectCyclesAndConditional, currentlyResolving) {
+ const knownCjsModuleTypes = Object.create(null);
+ const requiredIds = Object.create(null);
+ const unconditionallyRequiredIds = Object.create(null);
+ const dependencies = Object.create(null);
+ const getDependencies = (id) => dependencies[id] || (dependencies[id] = new Set());
+
+ const isCyclic = (id) => {
+ const dependenciesToCheck = new Set(getDependencies(id));
+ for (const dependency of dependenciesToCheck) {
+ if (dependency === id) {
+ return true;
+ }
+ for (const childDependency of getDependencies(dependency)) {
+ dependenciesToCheck.add(childDependency);
+ }
+ }
+ return false;
+ };
+
+ // Once a module is listed here, its type (wrapped or not) is fixed and may
+ // not change for the rest of the current build, to not break already
+ // transformed modules.
+ const fullyAnalyzedModules = Object.create(null);
+
+ const getTypeForFullyAnalyzedModule = (id) => {
+ const knownType = knownCjsModuleTypes[id];
+ if (knownType !== true || !detectCyclesAndConditional || fullyAnalyzedModules[id]) {
+ return knownType;
+ }
+ if (isCyclic(id)) {
+ return (knownCjsModuleTypes[id] = IS_WRAPPED_COMMONJS);
+ }
+ return knownType;
+ };
+
+ const setInitialParentType = (id, initialCommonJSType) => {
+ // Fully analyzed modules may never change type
+ if (fullyAnalyzedModules[id]) {
+ return;
+ }
+ knownCjsModuleTypes[id] = initialCommonJSType;
+ if (
+ detectCyclesAndConditional &&
+ knownCjsModuleTypes[id] === true &&
+ requiredIds[id] &&
+ !unconditionallyRequiredIds[id]
+ ) {
+ knownCjsModuleTypes[id] = IS_WRAPPED_COMMONJS;
+ }
+ };
+
+ const analyzeRequiredModule = async (parentId, resolved, isConditional, loadModule) => {
+ const childId = resolved.id;
+ requiredIds[childId] = true;
+ if (!(isConditional || knownCjsModuleTypes[parentId] === IS_WRAPPED_COMMONJS)) {
+ unconditionallyRequiredIds[childId] = true;
+ }
+
+ getDependencies(parentId).add(childId);
+ if (!isCyclic(childId)) {
+ // This makes sure the current transform handler waits for all direct
+ // dependencies to be loaded and transformed and therefore for all
+ // transitive CommonJS dependencies to be loaded as well so that all
+ // cycles have been found and knownCjsModuleTypes is reliable.
+ await loadModule(resolved);
+ }
+ };
+
+ const getTypeForImportedModule = async (resolved, loadModule) => {
+ if (resolved.id in knownCjsModuleTypes) {
+ // This handles cyclic ES dependencies
+ return knownCjsModuleTypes[resolved.id];
+ }
+ const {
+ meta: { commonjs }
+ } = await loadModule(resolved);
+ return (commonjs && commonjs.isCommonJS) || false;
+ };
+
+ return {
+ getWrappedIds: () =>
+ Object.keys(knownCjsModuleTypes).filter(
+ (id) => knownCjsModuleTypes[id] === IS_WRAPPED_COMMONJS
+ ),
+ isRequiredId: (id) => requiredIds[id],
+ async shouldTransformCachedModule({
+ id: parentId,
+ resolvedSources,
+ meta: { commonjs: parentMeta }
+ }) {
+ // We explicitly track ES modules to handle circular imports
+ if (!(parentMeta && parentMeta.isCommonJS)) knownCjsModuleTypes[parentId] = false;
+ if (isWrappedId(parentId, ES_IMPORT_SUFFIX)) return false;
+ const parentRequires = parentMeta && parentMeta.requires;
+ if (parentRequires) {
+ setInitialParentType(parentId, parentMeta.initialCommonJSType);
+ await Promise.all(
+ parentRequires.map(({ resolved, isConditional }) =>
+ analyzeRequiredModule(parentId, resolved, isConditional, this.load)
+ )
+ );
+ if (getTypeForFullyAnalyzedModule(parentId) !== parentMeta.isCommonJS) {
+ return true;
+ }
+ for (const {
+ resolved: { id }
+ } of parentRequires) {
+ if (getTypeForFullyAnalyzedModule(id) !== parentMeta.isRequiredCommonJS[id]) {
+ return true;
+ }
+ }
+ // Now that we decided to go with the cached copy, neither the parent
+ // module nor any of its children may change types anymore
+ fullyAnalyzedModules[parentId] = true;
+ for (const {
+ resolved: { id }
+ } of parentRequires) {
+ fullyAnalyzedModules[id] = true;
+ }
+ }
+ const parentRequireSet = new Set((parentRequires || []).map(({ resolved: { id } }) => id));
+ return (
+ await Promise.all(
+ Object.keys(resolvedSources)
+ .map((source) => resolvedSources[source])
+ .filter(({ id, external }) => !(external || parentRequireSet.has(id)))
+ .map(async (resolved) => {
+ if (isWrappedId(resolved.id, ES_IMPORT_SUFFIX)) {
+ return (
+ (await getTypeForImportedModule(
+ (
+ await this.load({ id: resolved.id })
+ ).meta.commonjs.resolved,
+ this.load
+ )) !== IS_WRAPPED_COMMONJS
+ );
+ }
+ return (await getTypeForImportedModule(resolved, this.load)) === IS_WRAPPED_COMMONJS;
+ })
+ )
+ ).some((shouldTransform) => shouldTransform);
+ },
+ /* eslint-disable no-param-reassign */
+ resolveRequireSourcesAndUpdateMeta:
+ (rollupContext) => async (parentId, isParentCommonJS, parentMeta, sources) => {
+ parentMeta.initialCommonJSType = isParentCommonJS;
+ parentMeta.requires = [];
+ parentMeta.isRequiredCommonJS = Object.create(null);
+ setInitialParentType(parentId, isParentCommonJS);
+ const currentlyResolvingForParent = currentlyResolving.get(parentId) || new Set();
+ currentlyResolving.set(parentId, currentlyResolvingForParent);
+ const requireTargets = await Promise.all(
+ sources.map(async ({ source, isConditional }) => {
+ // Never analyze or proxy internal modules
+ if (source.startsWith('\0')) {
+ return { id: source, allowProxy: false };
+ }
+ currentlyResolvingForParent.add(source);
+ const resolved =
+ (await rollupContext.resolve(source, parentId, {
+ custom: { 'node-resolve': { isRequire: true } }
+ })) || resolveExtensions(source, parentId, extensions);
+ currentlyResolvingForParent.delete(source);
+ if (!resolved) {
+ return { id: wrapId$1(source, EXTERNAL_SUFFIX), allowProxy: false };
+ }
+ const childId = resolved.id;
+ if (resolved.external) {
+ return { id: wrapId$1(childId, EXTERNAL_SUFFIX), allowProxy: false };
+ }
+ parentMeta.requires.push({ resolved, isConditional });
+ await analyzeRequiredModule(parentId, resolved, isConditional, rollupContext.load);
+ return { id: childId, allowProxy: true };
+ })
+ );
+ parentMeta.isCommonJS = getTypeForFullyAnalyzedModule(parentId);
+ fullyAnalyzedModules[parentId] = true;
+ return requireTargets.map(({ id: dependencyId, allowProxy }, index) => {
+ // eslint-disable-next-line no-multi-assign
+ const isCommonJS = (parentMeta.isRequiredCommonJS[dependencyId] =
+ getTypeForFullyAnalyzedModule(dependencyId));
+ fullyAnalyzedModules[dependencyId] = true;
+ return {
+ source: sources[index].source,
+ id: allowProxy
+ ? isCommonJS === IS_WRAPPED_COMMONJS
+ ? wrapId$1(dependencyId, WRAPPED_SUFFIX)
+ : wrapId$1(dependencyId, PROXY_SUFFIX)
+ : dependencyId,
+ isCommonJS
+ };
+ });
+ },
+ isCurrentlyResolving(source, parentId) {
+ const currentlyResolvingForParent = currentlyResolving.get(parentId);
+ return currentlyResolvingForParent && currentlyResolvingForParent.has(source);
+ }
+ };
+}
+
+function validateVersion(actualVersion, peerDependencyVersion, name) {
+ const versionRegexp = /\^(\d+\.\d+\.\d+)/g;
+ let minMajor = Infinity;
+ let minMinor = Infinity;
+ let minPatch = Infinity;
+ let foundVersion;
+ // eslint-disable-next-line no-cond-assign
+ while ((foundVersion = versionRegexp.exec(peerDependencyVersion))) {
+ const [foundMajor, foundMinor, foundPatch] = foundVersion[1].split('.').map(Number);
+ if (foundMajor < minMajor) {
+ minMajor = foundMajor;
+ minMinor = foundMinor;
+ minPatch = foundPatch;
+ }
+ }
+ if (!actualVersion) {
+ throw new Error(
+ `Insufficient ${name} version: "@rollup/plugin-commonjs" requires at least ${name}@${minMajor}.${minMinor}.${minPatch}.`
+ );
+ }
+ const [major, minor, patch] = actualVersion.split('.').map(Number);
+ if (
+ major < minMajor ||
+ (major === minMajor && (minor < minMinor || (minor === minMinor && patch < minPatch)))
+ ) {
+ throw new Error(
+ `Insufficient ${name} version: "@rollup/plugin-commonjs" requires at least ${name}@${minMajor}.${minMinor}.${minPatch} but found ${name}@${actualVersion}.`
+ );
+ }
+}
+
+const operators = {
+ '==': (x) => equals(x.left, x.right, false),
+
+ '!=': (x) => not(operators['=='](x)),
+
+ '===': (x) => equals(x.left, x.right, true),
+
+ '!==': (x) => not(operators['==='](x)),
+
+ '!': (x) => isFalsy(x.argument),
+
+ '&&': (x) => isTruthy(x.left) && isTruthy(x.right),
+
+ '||': (x) => isTruthy(x.left) || isTruthy(x.right)
+};
+
+function not(value) {
+ return value === null ? value : !value;
+}
+
+function equals(a, b, strict) {
+ if (a.type !== b.type) return null;
+ // eslint-disable-next-line eqeqeq
+ if (a.type === 'Literal') return strict ? a.value === b.value : a.value == b.value;
+ return null;
+}
+
+function isTruthy(node) {
+ if (!node) return false;
+ if (node.type === 'Literal') return !!node.value;
+ if (node.type === 'ParenthesizedExpression') return isTruthy(node.expression);
+ if (node.operator in operators) return operators[node.operator](node);
+ return null;
+}
+
+function isFalsy(node) {
+ return not(isTruthy(node));
+}
+
+function getKeypath(node) {
+ const parts = [];
+
+ while (node.type === 'MemberExpression') {
+ if (node.computed) return null;
+
+ parts.unshift(node.property.name);
+ // eslint-disable-next-line no-param-reassign
+ node = node.object;
+ }
+
+ if (node.type !== 'Identifier') return null;
+
+ const { name } = node;
+ parts.unshift(name);
+
+ return { name, keypath: parts.join('.') };
+}
+
+const KEY_COMPILED_ESM = '__esModule';
+
+function getDefineCompiledEsmType(node) {
+ const definedPropertyWithExports = getDefinePropertyCallName(node, 'exports');
+ const definedProperty =
+ definedPropertyWithExports || getDefinePropertyCallName(node, 'module.exports');
+ if (definedProperty && definedProperty.key === KEY_COMPILED_ESM) {
+ return isTruthy(definedProperty.value)
+ ? definedPropertyWithExports
+ ? 'exports'
+ : 'module'
+ : false;
+ }
+ return false;
+}
+
+function getDefinePropertyCallName(node, targetName) {
+ const {
+ callee: { object, property }
+ } = node;
+ if (!object || object.type !== 'Identifier' || object.name !== 'Object') return;
+ if (!property || property.type !== 'Identifier' || property.name !== 'defineProperty') return;
+ if (node.arguments.length !== 3) return;
+
+ const targetNames = targetName.split('.');
+ const [target, key, value] = node.arguments;
+ if (targetNames.length === 1) {
+ if (target.type !== 'Identifier' || target.name !== targetNames[0]) {
+ return;
+ }
+ }
+
+ if (targetNames.length === 2) {
+ if (
+ target.type !== 'MemberExpression' ||
+ target.object.name !== targetNames[0] ||
+ target.property.name !== targetNames[1]
+ ) {
+ return;
+ }
+ }
+
+ if (value.type !== 'ObjectExpression' || !value.properties) return;
+
+ const valueProperty = value.properties.find((p) => p.key && p.key.name === 'value');
+ if (!valueProperty || !valueProperty.value) return;
+
+ // eslint-disable-next-line consistent-return
+ return { key: key.value, value: valueProperty.value };
+}
+
+function isShorthandProperty(parent) {
+ return parent && parent.type === 'Property' && parent.shorthand;
+}
+
+function wrapCode(magicString, uses, moduleName, exportsName, indentExclusionRanges) {
+ const args = [];
+ const passedArgs = [];
+ if (uses.module) {
+ args.push('module');
+ passedArgs.push(moduleName);
+ }
+ if (uses.exports) {
+ args.push('exports');
+ passedArgs.push(uses.module ? `${moduleName}.exports` : exportsName);
+ }
+ magicString
+ .trim()
+ .indent('\t', { exclude: indentExclusionRanges })
+ .prepend(`(function (${args.join(', ')}) {\n`)
+ // For some reason, this line is only indented correctly when using a
+ // require-wrapper if we have this leading space
+ .append(` \n} (${passedArgs.join(', ')}));`);
+}
+
+function rewriteExportsAndGetExportsBlock(
+ magicString,
+ moduleName,
+ exportsName,
+ exportedExportsName,
+ wrapped,
+ moduleExportsAssignments,
+ firstTopLevelModuleExportsAssignment,
+ exportsAssignmentsByName,
+ topLevelAssignments,
+ defineCompiledEsmExpressions,
+ deconflictedExportNames,
+ code,
+ HELPERS_NAME,
+ exportMode,
+ defaultIsModuleExports,
+ usesRequireWrapper,
+ requireName
+) {
+ const exports = [];
+ const exportDeclarations = [];
+
+ if (usesRequireWrapper) {
+ getExportsWhenUsingRequireWrapper(
+ magicString,
+ wrapped,
+ exportMode,
+ exports,
+ moduleExportsAssignments,
+ exportsAssignmentsByName,
+ moduleName,
+ exportsName,
+ requireName,
+ defineCompiledEsmExpressions
+ );
+ } else if (exportMode === 'replace') {
+ getExportsForReplacedModuleExports(
+ magicString,
+ exports,
+ exportDeclarations,
+ moduleExportsAssignments,
+ firstTopLevelModuleExportsAssignment,
+ exportsName,
+ defaultIsModuleExports,
+ HELPERS_NAME
+ );
+ } else {
+ if (exportMode === 'module') {
+ exportDeclarations.push(`var ${exportedExportsName} = ${moduleName}.exports`);
+ exports.push(`${exportedExportsName} as __moduleExports`);
+ } else {
+ exports.push(`${exportsName} as __moduleExports`);
+ }
+ if (wrapped) {
+ exportDeclarations.push(
+ getDefaultExportDeclaration(exportedExportsName, defaultIsModuleExports, HELPERS_NAME)
+ );
+ } else {
+ getExports(
+ magicString,
+ exports,
+ exportDeclarations,
+ moduleExportsAssignments,
+ exportsAssignmentsByName,
+ deconflictedExportNames,
+ topLevelAssignments,
+ moduleName,
+ exportsName,
+ exportedExportsName,
+ defineCompiledEsmExpressions,
+ HELPERS_NAME,
+ defaultIsModuleExports,
+ exportMode
+ );
+ }
+ }
+ if (exports.length) {
+ exportDeclarations.push(`export { ${exports.join(', ')} }`);
+ }
+
+ return `\n\n${exportDeclarations.join(';\n')};`;
+}
+
+function getExportsWhenUsingRequireWrapper(
+ magicString,
+ wrapped,
+ exportMode,
+ exports,
+ moduleExportsAssignments,
+ exportsAssignmentsByName,
+ moduleName,
+ exportsName,
+ requireName,
+ defineCompiledEsmExpressions
+) {
+ exports.push(`${requireName} as __require`);
+ if (wrapped) return;
+ if (exportMode === 'replace') {
+ rewriteModuleExportsAssignments(magicString, moduleExportsAssignments, exportsName);
+ } else {
+ rewriteModuleExportsAssignments(magicString, moduleExportsAssignments, `${moduleName}.exports`);
+ // Collect and rewrite named exports
+ for (const [exportName, { nodes }] of exportsAssignmentsByName) {
+ for (const { node, type } of nodes) {
+ magicString.overwrite(
+ node.start,
+ node.left.end,
+ `${
+ exportMode === 'module' && type === 'module' ? `${moduleName}.exports` : exportsName
+ }.${exportName}`
+ );
+ }
+ }
+ replaceDefineCompiledEsmExpressionsAndGetIfRestorable(
+ defineCompiledEsmExpressions,
+ magicString,
+ exportMode,
+ moduleName,
+ exportsName
+ );
+ }
+}
+
+function getExportsForReplacedModuleExports(
+ magicString,
+ exports,
+ exportDeclarations,
+ moduleExportsAssignments,
+ firstTopLevelModuleExportsAssignment,
+ exportsName,
+ defaultIsModuleExports,
+ HELPERS_NAME
+) {
+ for (const { left } of moduleExportsAssignments) {
+ magicString.overwrite(left.start, left.end, exportsName);
+ }
+ magicString.prependRight(firstTopLevelModuleExportsAssignment.left.start, 'var ');
+ exports.push(`${exportsName} as __moduleExports`);
+ exportDeclarations.push(
+ getDefaultExportDeclaration(exportsName, defaultIsModuleExports, HELPERS_NAME)
+ );
+}
+
+function getDefaultExportDeclaration(exportedExportsName, defaultIsModuleExports, HELPERS_NAME) {
+ return `export default ${
+ defaultIsModuleExports === true
+ ? exportedExportsName
+ : defaultIsModuleExports === false
+ ? `${exportedExportsName}.default`
+ : `/*@__PURE__*/${HELPERS_NAME}.getDefaultExportFromCjs(${exportedExportsName})`
+ }`;
+}
+
+function getExports(
+ magicString,
+ exports,
+ exportDeclarations,
+ moduleExportsAssignments,
+ exportsAssignmentsByName,
+ deconflictedExportNames,
+ topLevelAssignments,
+ moduleName,
+ exportsName,
+ exportedExportsName,
+ defineCompiledEsmExpressions,
+ HELPERS_NAME,
+ defaultIsModuleExports,
+ exportMode
+) {
+ let deconflictedDefaultExportName;
+ // Collect and rewrite module.exports assignments
+ for (const { left } of moduleExportsAssignments) {
+ magicString.overwrite(left.start, left.end, `${moduleName}.exports`);
+ }
+
+ // Collect and rewrite named exports
+ for (const [exportName, { nodes }] of exportsAssignmentsByName) {
+ const deconflicted = deconflictedExportNames[exportName];
+ let needsDeclaration = true;
+ for (const { node, type } of nodes) {
+ let replacement = `${deconflicted} = ${
+ exportMode === 'module' && type === 'module' ? `${moduleName}.exports` : exportsName
+ }.${exportName}`;
+ if (needsDeclaration && topLevelAssignments.has(node)) {
+ replacement = `var ${replacement}`;
+ needsDeclaration = false;
+ }
+ magicString.overwrite(node.start, node.left.end, replacement);
+ }
+ if (needsDeclaration) {
+ magicString.prepend(`var ${deconflicted};\n`);
+ }
+
+ if (exportName === 'default') {
+ deconflictedDefaultExportName = deconflicted;
+ } else {
+ exports.push(exportName === deconflicted ? exportName : `${deconflicted} as ${exportName}`);
+ }
+ }
+
+ const isRestorableCompiledEsm = replaceDefineCompiledEsmExpressionsAndGetIfRestorable(
+ defineCompiledEsmExpressions,
+ magicString,
+ exportMode,
+ moduleName,
+ exportsName
+ );
+
+ if (
+ defaultIsModuleExports === false ||
+ (defaultIsModuleExports === 'auto' &&
+ isRestorableCompiledEsm &&
+ moduleExportsAssignments.length === 0)
+ ) {
+ // If there is no deconflictedDefaultExportName, then we use the namespace as
+ // fallback because there can be no "default" property on the namespace
+ exports.push(`${deconflictedDefaultExportName || exportedExportsName} as default`);
+ } else if (
+ defaultIsModuleExports === true ||
+ (!isRestorableCompiledEsm && moduleExportsAssignments.length === 0)
+ ) {
+ exports.push(`${exportedExportsName} as default`);
+ } else {
+ exportDeclarations.push(
+ getDefaultExportDeclaration(exportedExportsName, defaultIsModuleExports, HELPERS_NAME)
+ );
+ }
+}
+
+function rewriteModuleExportsAssignments(magicString, moduleExportsAssignments, exportsName) {
+ for (const { left } of moduleExportsAssignments) {
+ magicString.overwrite(left.start, left.end, exportsName);
+ }
+}
+
+function replaceDefineCompiledEsmExpressionsAndGetIfRestorable(
+ defineCompiledEsmExpressions,
+ magicString,
+ exportMode,
+ moduleName,
+ exportsName
+) {
+ let isRestorableCompiledEsm = false;
+ for (const { node, type } of defineCompiledEsmExpressions) {
+ isRestorableCompiledEsm = true;
+ const moduleExportsExpression =
+ node.type === 'CallExpression' ? node.arguments[0] : node.left.object;
+ magicString.overwrite(
+ moduleExportsExpression.start,
+ moduleExportsExpression.end,
+ exportMode === 'module' && type === 'module' ? `${moduleName}.exports` : exportsName
+ );
+ }
+ return isRestorableCompiledEsm;
+}
+
+function isRequireExpression(node, scope) {
+ if (!node) return false;
+ if (node.type !== 'CallExpression') return false;
+
+ // Weird case of `require()` or `module.require()` without arguments
+ if (node.arguments.length === 0) return false;
+
+ return isRequire(node.callee, scope);
+}
+
+function isRequire(node, scope) {
+ return (
+ (node.type === 'Identifier' && node.name === 'require' && !scope.contains('require')) ||
+ (node.type === 'MemberExpression' && isModuleRequire(node, scope))
+ );
+}
+
+function isModuleRequire({ object, property }, scope) {
+ return (
+ object.type === 'Identifier' &&
+ object.name === 'module' &&
+ property.type === 'Identifier' &&
+ property.name === 'require' &&
+ !scope.contains('module')
+ );
+}
+
+function hasDynamicArguments(node) {
+ return (
+ node.arguments.length > 1 ||
+ (node.arguments[0].type !== 'Literal' &&
+ (node.arguments[0].type !== 'TemplateLiteral' || node.arguments[0].expressions.length > 0))
+ );
+}
+
+const reservedMethod = { resolve: true, cache: true, main: true };
+
+function isNodeRequirePropertyAccess(parent) {
+ return parent && parent.property && reservedMethod[parent.property.name];
+}
+
+function getRequireStringArg(node) {
+ return node.arguments[0].type === 'Literal'
+ ? node.arguments[0].value
+ : node.arguments[0].quasis[0].value.cooked;
+}
+
+function getRequireHandlers() {
+ const requireExpressions = [];
+
+ function addRequireExpression(
+ sourceId,
+ node,
+ scope,
+ usesReturnValue,
+ isInsideTryBlock,
+ isInsideConditional,
+ toBeRemoved
+ ) {
+ requireExpressions.push({
+ sourceId,
+ node,
+ scope,
+ usesReturnValue,
+ isInsideTryBlock,
+ isInsideConditional,
+ toBeRemoved
+ });
+ }
+
+ async function rewriteRequireExpressionsAndGetImportBlock(
+ magicString,
+ topLevelDeclarations,
+ reassignedNames,
+ helpersName,
+ dynamicRequireName,
+ moduleName,
+ exportsName,
+ id,
+ exportMode,
+ resolveRequireSourcesAndUpdateMeta,
+ needsRequireWrapper,
+ isEsModule,
+ isDynamicRequireModulesEnabled,
+ getIgnoreTryCatchRequireStatementMode,
+ commonjsMeta
+ ) {
+ const imports = [];
+ imports.push(`import * as ${helpersName} from "${HELPERS_ID}"`);
+ if (dynamicRequireName) {
+ imports.push(
+ `import { ${
+ isDynamicRequireModulesEnabled ? CREATE_COMMONJS_REQUIRE_EXPORT : COMMONJS_REQUIRE_EXPORT
+ } as ${dynamicRequireName} } from "${DYNAMIC_MODULES_ID}"`
+ );
+ }
+ if (exportMode === 'module') {
+ imports.push(
+ `import { __module as ${moduleName} } from ${JSON.stringify(wrapId$1(id, MODULE_SUFFIX))}`,
+ `var ${exportsName} = ${moduleName}.exports`
+ );
+ } else if (exportMode === 'exports') {
+ imports.push(
+ `import { __exports as ${exportsName} } from ${JSON.stringify(wrapId$1(id, EXPORTS_SUFFIX))}`
+ );
+ }
+ const requiresBySource = collectSources(requireExpressions);
+ const requireTargets = await resolveRequireSourcesAndUpdateMeta(
+ id,
+ needsRequireWrapper ? IS_WRAPPED_COMMONJS : !isEsModule,
+ commonjsMeta,
+ Object.keys(requiresBySource).map((source) => {
+ return {
+ source,
+ isConditional: requiresBySource[source].every((require) => require.isInsideConditional)
+ };
+ })
+ );
+ processRequireExpressions(
+ imports,
+ requireTargets,
+ requiresBySource,
+ getIgnoreTryCatchRequireStatementMode,
+ magicString
+ );
+ return imports.length ? `${imports.join(';\n')};\n\n` : '';
+ }
+
+ return {
+ addRequireExpression,
+ rewriteRequireExpressionsAndGetImportBlock
+ };
+}
+
+function collectSources(requireExpressions) {
+ const requiresBySource = Object.create(null);
+ for (const requireExpression of requireExpressions) {
+ const { sourceId } = requireExpression;
+ if (!requiresBySource[sourceId]) {
+ requiresBySource[sourceId] = [];
+ }
+ const requires = requiresBySource[sourceId];
+ requires.push(requireExpression);
+ }
+ return requiresBySource;
+}
+
+function processRequireExpressions(
+ imports,
+ requireTargets,
+ requiresBySource,
+ getIgnoreTryCatchRequireStatementMode,
+ magicString
+) {
+ const generateRequireName = getGenerateRequireName();
+ for (const { source, id: resolvedId, isCommonJS } of requireTargets) {
+ const requires = requiresBySource[source];
+ const name = generateRequireName(requires);
+ let usesRequired = false;
+ let needsImport = false;
+ for (const { node, usesReturnValue, toBeRemoved, isInsideTryBlock } of requires) {
+ const { canConvertRequire, shouldRemoveRequire } =
+ isInsideTryBlock && isWrappedId(resolvedId, EXTERNAL_SUFFIX)
+ ? getIgnoreTryCatchRequireStatementMode(source)
+ : { canConvertRequire: true, shouldRemoveRequire: false };
+ if (shouldRemoveRequire) {
+ if (usesReturnValue) {
+ magicString.overwrite(node.start, node.end, 'undefined');
+ } else {
+ magicString.remove(toBeRemoved.start, toBeRemoved.end);
+ }
+ } else if (canConvertRequire) {
+ needsImport = true;
+ if (isCommonJS === IS_WRAPPED_COMMONJS) {
+ magicString.overwrite(node.start, node.end, `${name}()`);
+ } else if (usesReturnValue) {
+ usesRequired = true;
+ magicString.overwrite(node.start, node.end, name);
+ } else {
+ magicString.remove(toBeRemoved.start, toBeRemoved.end);
+ }
+ }
+ }
+ if (needsImport) {
+ if (isCommonJS === IS_WRAPPED_COMMONJS) {
+ imports.push(`import { __require as ${name} } from ${JSON.stringify(resolvedId)}`);
+ } else {
+ imports.push(`import ${usesRequired ? `${name} from ` : ''}${JSON.stringify(resolvedId)}`);
+ }
+ }
+ }
+}
+
+function getGenerateRequireName() {
+ let uid = 0;
+ return (requires) => {
+ let name;
+ const hasNameConflict = ({ scope }) => scope.contains(name);
+ do {
+ name = `require$$${uid}`;
+ uid += 1;
+ } while (requires.some(hasNameConflict));
+ return name;
+ };
+}
+
+/* eslint-disable no-param-reassign, no-shadow, no-underscore-dangle, no-continue */
+
+const exportsPattern = /^(?:module\.)?exports(?:\.([a-zA-Z_$][a-zA-Z_$0-9]*))?$/;
+
+const functionType = /^(?:FunctionDeclaration|FunctionExpression|ArrowFunctionExpression)$/;
+
+// There are three different types of CommonJS modules, described by their
+// "exportMode":
+// - exports: Only assignments to (module.)exports properties
+// - replace: A single assignment to module.exports itself
+// - module: Anything else
+// Special cases:
+// - usesRequireWrapper
+// - isWrapped
+async function transformCommonjs(
+ parse,
+ code,
+ id,
+ isEsModule,
+ ignoreGlobal,
+ ignoreRequire,
+ ignoreDynamicRequires,
+ getIgnoreTryCatchRequireStatementMode,
+ sourceMap,
+ isDynamicRequireModulesEnabled,
+ dynamicRequireModules,
+ commonDir,
+ astCache,
+ defaultIsModuleExports,
+ needsRequireWrapper,
+ resolveRequireSourcesAndUpdateMeta,
+ isRequired,
+ checkDynamicRequire,
+ commonjsMeta
+) {
+ const ast = astCache || tryParse(parse, code, id);
+ const magicString = new MagicString$1(code);
+ const uses = {
+ module: false,
+ exports: false,
+ global: false,
+ require: false
+ };
+ const virtualDynamicRequirePath =
+ isDynamicRequireModulesEnabled && getVirtualPathForDynamicRequirePath(dirname$1(id), commonDir);
+ let scope = attachScopes(ast, 'scope');
+ let lexicalDepth = 0;
+ let programDepth = 0;
+ let classBodyDepth = 0;
+ let currentTryBlockEnd = null;
+ let shouldWrap = false;
+
+ const globals = new Set();
+ // A conditionalNode is a node for which execution is not guaranteed. If such a node is a require
+ // or contains nested requires, those should be handled as function calls unless there is an
+ // unconditional require elsewhere.
+ let currentConditionalNodeEnd = null;
+ const conditionalNodes = new Set();
+ const { addRequireExpression, rewriteRequireExpressionsAndGetImportBlock } = getRequireHandlers();
+
+ // See which names are assigned to. This is necessary to prevent
+ // illegally replacing `var foo = require('foo')` with `import foo from 'foo'`,
+ // where `foo` is later reassigned. (This happens in the wild. CommonJS, sigh)
+ const reassignedNames = new Set();
+ const topLevelDeclarations = [];
+ const skippedNodes = new Set();
+ const moduleAccessScopes = new Set([scope]);
+ const exportsAccessScopes = new Set([scope]);
+ const moduleExportsAssignments = [];
+ let firstTopLevelModuleExportsAssignment = null;
+ const exportsAssignmentsByName = new Map();
+ const topLevelAssignments = new Set();
+ const topLevelDefineCompiledEsmExpressions = [];
+ const replacedGlobal = [];
+ const replacedDynamicRequires = [];
+ const importedVariables = new Set();
+ const indentExclusionRanges = [];
+
+ walk$4(ast, {
+ enter(node, parent) {
+ if (skippedNodes.has(node)) {
+ this.skip();
+ return;
+ }
+
+ if (currentTryBlockEnd !== null && node.start > currentTryBlockEnd) {
+ currentTryBlockEnd = null;
+ }
+ if (currentConditionalNodeEnd !== null && node.start > currentConditionalNodeEnd) {
+ currentConditionalNodeEnd = null;
+ }
+ if (currentConditionalNodeEnd === null && conditionalNodes.has(node)) {
+ currentConditionalNodeEnd = node.end;
+ }
+
+ programDepth += 1;
+ if (node.scope) ({ scope } = node);
+ if (functionType.test(node.type)) lexicalDepth += 1;
+ if (sourceMap) {
+ magicString.addSourcemapLocation(node.start);
+ magicString.addSourcemapLocation(node.end);
+ }
+
+ // eslint-disable-next-line default-case
+ switch (node.type) {
+ case 'AssignmentExpression':
+ if (node.left.type === 'MemberExpression') {
+ const flattened = getKeypath(node.left);
+ if (!flattened || scope.contains(flattened.name)) return;
+
+ const exportsPatternMatch = exportsPattern.exec(flattened.keypath);
+ if (!exportsPatternMatch || flattened.keypath === 'exports') return;
+
+ const [, exportName] = exportsPatternMatch;
+ uses[flattened.name] = true;
+
+ // we're dealing with `module.exports = ...` or `[module.]exports.foo = ...` –
+ if (flattened.keypath === 'module.exports') {
+ moduleExportsAssignments.push(node);
+ if (programDepth > 3) {
+ moduleAccessScopes.add(scope);
+ } else if (!firstTopLevelModuleExportsAssignment) {
+ firstTopLevelModuleExportsAssignment = node;
+ }
+ } else if (exportName === KEY_COMPILED_ESM) {
+ if (programDepth > 3) {
+ shouldWrap = true;
+ } else {
+ // The "type" is either "module" or "exports" to discern
+ // assignments to module.exports vs exports if needed
+ topLevelDefineCompiledEsmExpressions.push({ node, type: flattened.name });
+ }
+ } else {
+ const exportsAssignments = exportsAssignmentsByName.get(exportName) || {
+ nodes: [],
+ scopes: new Set()
+ };
+ exportsAssignments.nodes.push({ node, type: flattened.name });
+ exportsAssignments.scopes.add(scope);
+ exportsAccessScopes.add(scope);
+ exportsAssignmentsByName.set(exportName, exportsAssignments);
+ if (programDepth <= 3) {
+ topLevelAssignments.add(node);
+ }
+ }
+
+ skippedNodes.add(node.left);
+ } else {
+ for (const name of extractAssignedNames(node.left)) {
+ reassignedNames.add(name);
+ }
+ }
+ return;
+ case 'CallExpression': {
+ const defineCompiledEsmType = getDefineCompiledEsmType(node);
+ if (defineCompiledEsmType) {
+ if (programDepth === 3 && parent.type === 'ExpressionStatement') {
+ // skip special handling for [module.]exports until we know we render this
+ skippedNodes.add(node.arguments[0]);
+ topLevelDefineCompiledEsmExpressions.push({ node, type: defineCompiledEsmType });
+ } else {
+ shouldWrap = true;
+ }
+ return;
+ }
+
+ // Transform require.resolve
+ if (
+ isDynamicRequireModulesEnabled &&
+ node.callee.object &&
+ isRequire(node.callee.object, scope) &&
+ node.callee.property.name === 'resolve'
+ ) {
+ checkDynamicRequire(node.start);
+ uses.require = true;
+ const requireNode = node.callee.object;
+ replacedDynamicRequires.push(requireNode);
+ skippedNodes.add(node.callee);
+ return;
+ }
+
+ if (!isRequireExpression(node, scope)) {
+ const keypath = getKeypath(node.callee);
+ if (keypath && importedVariables.has(keypath.name)) {
+ // Heuristic to deoptimize requires after a required function has been called
+ currentConditionalNodeEnd = Infinity;
+ }
+ return;
+ }
+
+ skippedNodes.add(node.callee);
+ uses.require = true;
+
+ if (hasDynamicArguments(node)) {
+ if (isDynamicRequireModulesEnabled) {
+ checkDynamicRequire(node.start);
+ }
+ if (!ignoreDynamicRequires) {
+ replacedDynamicRequires.push(node.callee);
+ }
+ return;
+ }
+
+ const requireStringArg = getRequireStringArg(node);
+ if (!ignoreRequire(requireStringArg)) {
+ const usesReturnValue = parent.type !== 'ExpressionStatement';
+ const toBeRemoved =
+ parent.type === 'ExpressionStatement' &&
+ (!currentConditionalNodeEnd ||
+ // We should completely remove requires directly in a try-catch
+ // so that Rollup can remove up the try-catch
+ (currentTryBlockEnd !== null && currentTryBlockEnd < currentConditionalNodeEnd))
+ ? parent
+ : node;
+ addRequireExpression(
+ requireStringArg,
+ node,
+ scope,
+ usesReturnValue,
+ currentTryBlockEnd !== null,
+ currentConditionalNodeEnd !== null,
+ toBeRemoved
+ );
+ if (parent.type === 'VariableDeclarator' && parent.id.type === 'Identifier') {
+ for (const name of extractAssignedNames(parent.id)) {
+ importedVariables.add(name);
+ }
+ }
+ }
+ return;
+ }
+ case 'ClassBody':
+ classBodyDepth += 1;
+ return;
+ case 'ConditionalExpression':
+ case 'IfStatement':
+ // skip dead branches
+ if (isFalsy(node.test)) {
+ skippedNodes.add(node.consequent);
+ } else if (isTruthy(node.test)) {
+ if (node.alternate) {
+ skippedNodes.add(node.alternate);
+ }
+ } else {
+ conditionalNodes.add(node.consequent);
+ if (node.alternate) {
+ conditionalNodes.add(node.alternate);
+ }
+ }
+ return;
+ case 'ArrowFunctionExpression':
+ case 'FunctionDeclaration':
+ case 'FunctionExpression':
+ // requires in functions should be conditional unless it is an IIFE
+ if (
+ currentConditionalNodeEnd === null &&
+ !(parent.type === 'CallExpression' && parent.callee === node)
+ ) {
+ currentConditionalNodeEnd = node.end;
+ }
+ return;
+ case 'Identifier': {
+ const { name } = node;
+ if (!isReference(node, parent) || scope.contains(name)) return;
+ switch (name) {
+ case 'require':
+ uses.require = true;
+ if (isNodeRequirePropertyAccess(parent)) {
+ return;
+ }
+ if (!ignoreDynamicRequires) {
+ if (isShorthandProperty(parent)) {
+ magicString.prependRight(node.start, 'require: ');
+ }
+ replacedDynamicRequires.push(node);
+ }
+ return;
+ case 'module':
+ case 'exports':
+ shouldWrap = true;
+ uses[name] = true;
+ return;
+ case 'global':
+ uses.global = true;
+ if (!ignoreGlobal) {
+ replacedGlobal.push(node);
+ }
+ return;
+ case 'define':
+ magicString.overwrite(node.start, node.end, 'undefined', {
+ storeName: true
+ });
+ return;
+ default:
+ globals.add(name);
+ return;
+ }
+ }
+ case 'LogicalExpression':
+ // skip dead branches
+ if (node.operator === '&&') {
+ if (isFalsy(node.left)) {
+ skippedNodes.add(node.right);
+ } else if (!isTruthy(node.left)) {
+ conditionalNodes.add(node.right);
+ }
+ } else if (node.operator === '||') {
+ if (isTruthy(node.left)) {
+ skippedNodes.add(node.right);
+ } else if (!isFalsy(node.left)) {
+ conditionalNodes.add(node.right);
+ }
+ }
+ return;
+ case 'MemberExpression':
+ if (!isDynamicRequireModulesEnabled && isModuleRequire(node, scope)) {
+ uses.require = true;
+ replacedDynamicRequires.push(node);
+ skippedNodes.add(node.object);
+ skippedNodes.add(node.property);
+ }
+ return;
+ case 'ReturnStatement':
+ // if top-level return, we need to wrap it
+ if (lexicalDepth === 0) {
+ shouldWrap = true;
+ }
+ return;
+ case 'ThisExpression':
+ // rewrite top-level `this` as `commonjsHelpers.commonjsGlobal`
+ if (lexicalDepth === 0 && !classBodyDepth) {
+ uses.global = true;
+ if (!ignoreGlobal) {
+ replacedGlobal.push(node);
+ }
+ }
+ return;
+ case 'TryStatement':
+ if (currentTryBlockEnd === null) {
+ currentTryBlockEnd = node.block.end;
+ }
+ if (currentConditionalNodeEnd === null) {
+ currentConditionalNodeEnd = node.end;
+ }
+ return;
+ case 'UnaryExpression':
+ // rewrite `typeof module`, `typeof module.exports` and `typeof exports` (https://github.com/rollup/rollup-plugin-commonjs/issues/151)
+ if (node.operator === 'typeof') {
+ const flattened = getKeypath(node.argument);
+ if (!flattened) return;
+
+ if (scope.contains(flattened.name)) return;
+
+ if (
+ !isEsModule &&
+ (flattened.keypath === 'module.exports' ||
+ flattened.keypath === 'module' ||
+ flattened.keypath === 'exports')
+ ) {
+ magicString.overwrite(node.start, node.end, `'object'`, {
+ storeName: false
+ });
+ }
+ }
+ return;
+ case 'VariableDeclaration':
+ if (!scope.parent) {
+ topLevelDeclarations.push(node);
+ }
+ return;
+ case 'TemplateElement':
+ if (node.value.raw.includes('\n')) {
+ indentExclusionRanges.push([node.start, node.end]);
+ }
+ }
+ },
+
+ leave(node) {
+ programDepth -= 1;
+ if (node.scope) scope = scope.parent;
+ if (functionType.test(node.type)) lexicalDepth -= 1;
+ if (node.type === 'ClassBody') classBodyDepth -= 1;
+ }
+ });
+
+ const nameBase = getName(id);
+ const exportsName = deconflict([...exportsAccessScopes], globals, nameBase);
+ const moduleName = deconflict([...moduleAccessScopes], globals, `${nameBase}Module`);
+ const requireName = deconflict([scope], globals, `require${capitalize(nameBase)}`);
+ const isRequiredName = deconflict([scope], globals, `hasRequired${capitalize(nameBase)}`);
+ const helpersName = deconflict([scope], globals, 'commonjsHelpers');
+ const dynamicRequireName =
+ replacedDynamicRequires.length > 0 &&
+ deconflict(
+ [scope],
+ globals,
+ isDynamicRequireModulesEnabled ? CREATE_COMMONJS_REQUIRE_EXPORT : COMMONJS_REQUIRE_EXPORT
+ );
+ const deconflictedExportNames = Object.create(null);
+ for (const [exportName, { scopes }] of exportsAssignmentsByName) {
+ deconflictedExportNames[exportName] = deconflict([...scopes], globals, exportName);
+ }
+
+ for (const node of replacedGlobal) {
+ magicString.overwrite(node.start, node.end, `${helpersName}.commonjsGlobal`, {
+ storeName: true
+ });
+ }
+ for (const node of replacedDynamicRequires) {
+ magicString.overwrite(
+ node.start,
+ node.end,
+ isDynamicRequireModulesEnabled
+ ? `${dynamicRequireName}(${JSON.stringify(virtualDynamicRequirePath)})`
+ : dynamicRequireName,
+ {
+ contentOnly: true,
+ storeName: true
+ }
+ );
+ }
+
+ // We cannot wrap ES/mixed modules
+ shouldWrap = !isEsModule && (shouldWrap || (uses.exports && moduleExportsAssignments.length > 0));
+
+ if (
+ !(
+ shouldWrap ||
+ isRequired ||
+ needsRequireWrapper ||
+ uses.module ||
+ uses.exports ||
+ uses.require ||
+ topLevelDefineCompiledEsmExpressions.length > 0
+ ) &&
+ (ignoreGlobal || !uses.global)
+ ) {
+ return { meta: { commonjs: { isCommonJS: false } } };
+ }
+
+ let leadingComment = '';
+ if (code.startsWith('/*')) {
+ const commentEnd = code.indexOf('*/', 2) + 2;
+ leadingComment = `${code.slice(0, commentEnd)}\n`;
+ magicString.remove(0, commentEnd).trim();
+ }
+
+ const exportMode = isEsModule
+ ? 'none'
+ : shouldWrap
+ ? uses.module
+ ? 'module'
+ : 'exports'
+ : firstTopLevelModuleExportsAssignment
+ ? exportsAssignmentsByName.size === 0 && topLevelDefineCompiledEsmExpressions.length === 0
+ ? 'replace'
+ : 'module'
+ : moduleExportsAssignments.length === 0
+ ? 'exports'
+ : 'module';
+
+ const exportedExportsName =
+ exportMode === 'module' ? deconflict([], globals, `${nameBase}Exports`) : exportsName;
+
+ const importBlock = await rewriteRequireExpressionsAndGetImportBlock(
+ magicString,
+ topLevelDeclarations,
+ reassignedNames,
+ helpersName,
+ dynamicRequireName,
+ moduleName,
+ exportsName,
+ id,
+ exportMode,
+ resolveRequireSourcesAndUpdateMeta,
+ needsRequireWrapper,
+ isEsModule,
+ isDynamicRequireModulesEnabled,
+ getIgnoreTryCatchRequireStatementMode,
+ commonjsMeta
+ );
+ const usesRequireWrapper = commonjsMeta.isCommonJS === IS_WRAPPED_COMMONJS;
+ const exportBlock = isEsModule
+ ? ''
+ : rewriteExportsAndGetExportsBlock(
+ magicString,
+ moduleName,
+ exportsName,
+ exportedExportsName,
+ shouldWrap,
+ moduleExportsAssignments,
+ firstTopLevelModuleExportsAssignment,
+ exportsAssignmentsByName,
+ topLevelAssignments,
+ topLevelDefineCompiledEsmExpressions,
+ deconflictedExportNames,
+ code,
+ helpersName,
+ exportMode,
+ defaultIsModuleExports,
+ usesRequireWrapper,
+ requireName
+ );
+
+ if (shouldWrap) {
+ wrapCode(magicString, uses, moduleName, exportsName, indentExclusionRanges);
+ }
+
+ if (usesRequireWrapper) {
+ magicString.trim().indent('\t', {
+ exclude: indentExclusionRanges
+ });
+ const exported = exportMode === 'module' ? `${moduleName}.exports` : exportsName;
+ magicString.prepend(
+ `var ${isRequiredName};
+
+function ${requireName} () {
+\tif (${isRequiredName}) return ${exported};
+\t${isRequiredName} = 1;
+`
+ ).append(`
+\treturn ${exported};
+}`);
+ if (exportMode === 'replace') {
+ magicString.prepend(`var ${exportsName};\n`);
+ }
+ }
+
+ magicString
+ .trim()
+ .prepend(leadingComment + importBlock)
+ .append(exportBlock);
+
+ return {
+ code: magicString.toString(),
+ map: sourceMap ? magicString.generateMap() : null,
+ syntheticNamedExports: isEsModule || usesRequireWrapper ? false : '__moduleExports',
+ meta: { commonjs: commonjsMeta }
+ };
+}
+
+const PLUGIN_NAME = 'commonjs';
+
+function commonjs(options = {}) {
+ const {
+ ignoreGlobal,
+ ignoreDynamicRequires,
+ requireReturnsDefault: requireReturnsDefaultOption,
+ defaultIsModuleExports: defaultIsModuleExportsOption,
+ esmExternals
+ } = options;
+ const extensions = options.extensions || ['.js'];
+ const filter = createFilter$1(options.include, options.exclude);
+ const isPossibleCjsId = (id) => {
+ const extName = extname(id);
+ return extName === '.cjs' || (extensions.includes(extName) && filter(id));
+ };
+
+ const { strictRequiresFilter, detectCyclesAndConditional } = getStrictRequiresFilter(options);
+
+ const getRequireReturnsDefault =
+ typeof requireReturnsDefaultOption === 'function'
+ ? requireReturnsDefaultOption
+ : () => requireReturnsDefaultOption;
+
+ let esmExternalIds;
+ const isEsmExternal =
+ typeof esmExternals === 'function'
+ ? esmExternals
+ : Array.isArray(esmExternals)
+ ? ((esmExternalIds = new Set(esmExternals)), (id) => esmExternalIds.has(id))
+ : () => esmExternals;
+
+ const getDefaultIsModuleExports =
+ typeof defaultIsModuleExportsOption === 'function'
+ ? defaultIsModuleExportsOption
+ : () =>
+ typeof defaultIsModuleExportsOption === 'boolean' ? defaultIsModuleExportsOption : 'auto';
+
+ const dynamicRequireRoot =
+ typeof options.dynamicRequireRoot === 'string'
+ ? resolve$3(options.dynamicRequireRoot)
+ : process.cwd();
+ const { commonDir, dynamicRequireModules } = getDynamicRequireModules(
+ options.dynamicRequireTargets,
+ dynamicRequireRoot
+ );
+ const isDynamicRequireModulesEnabled = dynamicRequireModules.size > 0;
+
+ const ignoreRequire =
+ typeof options.ignore === 'function'
+ ? options.ignore
+ : Array.isArray(options.ignore)
+ ? (id) => options.ignore.includes(id)
+ : () => false;
+
+ const getIgnoreTryCatchRequireStatementMode = (id) => {
+ const mode =
+ typeof options.ignoreTryCatch === 'function'
+ ? options.ignoreTryCatch(id)
+ : Array.isArray(options.ignoreTryCatch)
+ ? options.ignoreTryCatch.includes(id)
+ : typeof options.ignoreTryCatch !== 'undefined'
+ ? options.ignoreTryCatch
+ : true;
+
+ return {
+ canConvertRequire: mode !== 'remove' && mode !== true,
+ shouldRemoveRequire: mode === 'remove'
+ };
+ };
+
+ const { currentlyResolving, resolveId } = getResolveId(extensions, isPossibleCjsId);
+
+ const sourceMap = options.sourceMap !== false;
+
+ // Initialized in buildStart
+ let requireResolver;
+
+ function transformAndCheckExports(code, id) {
+ const normalizedId = normalizePathSlashes(id);
+ const { isEsModule, hasDefaultExport, hasNamedExports, ast } = analyzeTopLevelStatements(
+ this.parse,
+ code,
+ id
+ );
+
+ const commonjsMeta = this.getModuleInfo(id).meta.commonjs || {};
+ if (hasDefaultExport) {
+ commonjsMeta.hasDefaultExport = true;
+ }
+ if (hasNamedExports) {
+ commonjsMeta.hasNamedExports = true;
+ }
+
+ if (
+ !dynamicRequireModules.has(normalizedId) &&
+ (!(hasCjsKeywords(code, ignoreGlobal) || requireResolver.isRequiredId(id)) ||
+ (isEsModule && !options.transformMixedEsModules))
+ ) {
+ commonjsMeta.isCommonJS = false;
+ return { meta: { commonjs: commonjsMeta } };
+ }
+
+ const needsRequireWrapper =
+ !isEsModule && (dynamicRequireModules.has(normalizedId) || strictRequiresFilter(id));
+
+ const checkDynamicRequire = (position) => {
+ const normalizedDynamicRequireRoot = normalizePathSlashes(dynamicRequireRoot);
+
+ if (normalizedId.indexOf(normalizedDynamicRequireRoot) !== 0) {
+ this.error(
+ {
+ code: 'DYNAMIC_REQUIRE_OUTSIDE_ROOT',
+ normalizedId,
+ normalizedDynamicRequireRoot,
+ message: `"${normalizedId}" contains dynamic require statements but it is not within the current dynamicRequireRoot "${normalizedDynamicRequireRoot}". You should set dynamicRequireRoot to "${dirname$1(
+ normalizedId
+ )}" or one of its parent directories.`
+ },
+ position
+ );
+ }
+ };
+
+ return transformCommonjs(
+ this.parse,
+ code,
+ id,
+ isEsModule,
+ ignoreGlobal || isEsModule,
+ ignoreRequire,
+ ignoreDynamicRequires && !isDynamicRequireModulesEnabled,
+ getIgnoreTryCatchRequireStatementMode,
+ sourceMap,
+ isDynamicRequireModulesEnabled,
+ dynamicRequireModules,
+ commonDir,
+ ast,
+ getDefaultIsModuleExports(id),
+ needsRequireWrapper,
+ requireResolver.resolveRequireSourcesAndUpdateMeta(this),
+ requireResolver.isRequiredId(id),
+ checkDynamicRequire,
+ commonjsMeta
+ );
+ }
+
+ return {
+ name: PLUGIN_NAME,
+
+ version: version$3,
+
+ options(rawOptions) {
+ // We inject the resolver in the beginning so that "catch-all-resolver" like node-resolver
+ // do not prevent our plugin from resolving entry points ot proxies.
+ const plugins = Array.isArray(rawOptions.plugins)
+ ? [...rawOptions.plugins]
+ : rawOptions.plugins
+ ? [rawOptions.plugins]
+ : [];
+ plugins.unshift({
+ name: 'commonjs--resolver',
+ resolveId
+ });
+ return { ...rawOptions, plugins };
+ },
+
+ buildStart({ plugins }) {
+ validateVersion(this.meta.rollupVersion, peerDependencies.rollup, 'rollup');
+ const nodeResolve = plugins.find(({ name }) => name === 'node-resolve');
+ if (nodeResolve) {
+ validateVersion(nodeResolve.version, '^13.0.6', '@rollup/plugin-node-resolve');
+ }
+ if (options.namedExports != null) {
+ this.warn(
+ 'The namedExports option from "@rollup/plugin-commonjs" is deprecated. Named exports are now handled automatically.'
+ );
+ }
+ requireResolver = getRequireResolver(
+ extensions,
+ detectCyclesAndConditional,
+ currentlyResolving
+ );
+ },
+
+ buildEnd() {
+ if (options.strictRequires === 'debug') {
+ const wrappedIds = requireResolver.getWrappedIds();
+ if (wrappedIds.length) {
+ this.warn({
+ code: 'WRAPPED_IDS',
+ ids: wrappedIds,
+ message: `The commonjs plugin automatically wrapped the following files:\n[\n${wrappedIds
+ .map((id) => `\t${JSON.stringify(relative$1(process.cwd(), id))}`)
+ .join(',\n')}\n]`
+ });
+ } else {
+ this.warn({
+ code: 'WRAPPED_IDS',
+ ids: wrappedIds,
+ message: 'The commonjs plugin did not wrap any files.'
+ });
+ }
+ }
+ },
+
+ load(id) {
+ if (id === HELPERS_ID) {
+ return getHelpersModule();
+ }
+
+ if (isWrappedId(id, MODULE_SUFFIX)) {
+ const name = getName(unwrapId$1(id, MODULE_SUFFIX));
+ return {
+ code: `var ${name} = {exports: {}}; export {${name} as __module}`,
+ meta: { commonjs: { isCommonJS: false } }
+ };
+ }
+
+ if (isWrappedId(id, EXPORTS_SUFFIX)) {
+ const name = getName(unwrapId$1(id, EXPORTS_SUFFIX));
+ return {
+ code: `var ${name} = {}; export {${name} as __exports}`,
+ meta: { commonjs: { isCommonJS: false } }
+ };
+ }
+
+ if (isWrappedId(id, EXTERNAL_SUFFIX)) {
+ const actualId = unwrapId$1(id, EXTERNAL_SUFFIX);
+ return getUnknownRequireProxy(
+ actualId,
+ isEsmExternal(actualId) ? getRequireReturnsDefault(actualId) : true
+ );
+ }
+
+ // entry suffix is just appended to not mess up relative external resolution
+ if (id.endsWith(ENTRY_SUFFIX)) {
+ const acutalId = id.slice(0, -ENTRY_SUFFIX.length);
+ return getEntryProxy(acutalId, getDefaultIsModuleExports(acutalId), this.getModuleInfo);
+ }
+
+ if (isWrappedId(id, ES_IMPORT_SUFFIX)) {
+ const actualId = unwrapId$1(id, ES_IMPORT_SUFFIX);
+ return getEsImportProxy(actualId, getDefaultIsModuleExports(actualId));
+ }
+
+ if (id === DYNAMIC_MODULES_ID) {
+ return getDynamicModuleRegistry(
+ isDynamicRequireModulesEnabled,
+ dynamicRequireModules,
+ commonDir,
+ ignoreDynamicRequires
+ );
+ }
+
+ if (isWrappedId(id, PROXY_SUFFIX)) {
+ const actualId = unwrapId$1(id, PROXY_SUFFIX);
+ return getStaticRequireProxy(actualId, getRequireReturnsDefault(actualId), this.load);
+ }
+
+ return null;
+ },
+
+ shouldTransformCachedModule(...args) {
+ return requireResolver.shouldTransformCachedModule.call(this, ...args);
+ },
+
+ transform(code, id) {
+ if (!isPossibleCjsId(id)) return null;
+
+ try {
+ return transformAndCheckExports.call(this, code, id);
+ } catch (err) {
+ return this.error(err, err.loc);
+ }
+ }
+ };
+}
+
+const comma = ','.charCodeAt(0);
+const chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+const intToChar = new Uint8Array(64); // 64 possible chars.
+const charToInt = new Uint8Array(128); // z is 122 in ASCII
+for (let i = 0; i < chars$1.length; i++) {
+ const c = chars$1.charCodeAt(i);
+ intToChar[i] = c;
+ charToInt[c] = i;
+}
+function decode(mappings) {
+ const state = new Int32Array(5);
+ const decoded = [];
+ let index = 0;
+ do {
+ const semi = indexOf(mappings, index);
+ const line = [];
+ let sorted = true;
+ let lastCol = 0;
+ state[0] = 0;
+ for (let i = index; i < semi; i++) {
+ let seg;
+ i = decodeInteger(mappings, i, state, 0); // genColumn
+ const col = state[0];
+ if (col < lastCol)
+ sorted = false;
+ lastCol = col;
+ if (hasMoreVlq(mappings, i, semi)) {
+ i = decodeInteger(mappings, i, state, 1); // sourcesIndex
+ i = decodeInteger(mappings, i, state, 2); // sourceLine
+ i = decodeInteger(mappings, i, state, 3); // sourceColumn
+ if (hasMoreVlq(mappings, i, semi)) {
+ i = decodeInteger(mappings, i, state, 4); // namesIndex
+ seg = [col, state[1], state[2], state[3], state[4]];
+ }
+ else {
+ seg = [col, state[1], state[2], state[3]];
+ }
+ }
+ else {
+ seg = [col];
+ }
+ line.push(seg);
+ }
+ if (!sorted)
+ sort(line);
+ decoded.push(line);
+ index = semi + 1;
+ } while (index <= mappings.length);
+ return decoded;
+}
+function indexOf(mappings, index) {
+ const idx = mappings.indexOf(';', index);
+ return idx === -1 ? mappings.length : idx;
+}
+function decodeInteger(mappings, pos, state, j) {
+ let value = 0;
+ let shift = 0;
+ let integer = 0;
+ do {
+ const c = mappings.charCodeAt(pos++);
+ integer = charToInt[c];
+ value |= (integer & 31) << shift;
+ shift += 5;
+ } while (integer & 32);
+ const shouldNegate = value & 1;
+ value >>>= 1;
+ if (shouldNegate) {
+ value = -0x80000000 | -value;
+ }
+ state[j] += value;
+ return pos;
+}
+function hasMoreVlq(mappings, i, length) {
+ if (i >= length)
+ return false;
+ return mappings.charCodeAt(i) !== comma;
+}
+function sort(line) {
+ line.sort(sortComparator$1);
+}
+function sortComparator$1(a, b) {
+ return a[0] - b[0];
+}
+
+// Matches the scheme of a URL, eg "http://"
+const schemeRegex = /^[\w+.-]+:\/\//;
+/**
+ * Matches the parts of a URL:
+ * 1. Scheme, including ":", guaranteed.
+ * 2. User/password, including "@", optional.
+ * 3. Host, guaranteed.
+ * 4. Port, including ":", optional.
+ * 5. Path, including "/", optional.
+ * 6. Query, including "?", optional.
+ * 7. Hash, including "#", optional.
+ */
+const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
+/**
+ * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
+ * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
+ *
+ * 1. Host, optional.
+ * 2. Path, which may include "/", guaranteed.
+ * 3. Query, including "?", optional.
+ * 4. Hash, including "#", optional.
+ */
+const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
+var UrlType;
+(function (UrlType) {
+ UrlType[UrlType["Empty"] = 1] = "Empty";
+ UrlType[UrlType["Hash"] = 2] = "Hash";
+ UrlType[UrlType["Query"] = 3] = "Query";
+ UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
+ UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
+ UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
+ UrlType[UrlType["Absolute"] = 7] = "Absolute";
+})(UrlType || (UrlType = {}));
+function isAbsoluteUrl(input) {
+ return schemeRegex.test(input);
+}
+function isSchemeRelativeUrl(input) {
+ return input.startsWith('//');
+}
+function isAbsolutePath(input) {
+ return input.startsWith('/');
+}
+function isFileUrl(input) {
+ return input.startsWith('file:');
+}
+function isRelative(input) {
+ return /^[.?#]/.test(input);
+}
+function parseAbsoluteUrl(input) {
+ const match = urlRegex.exec(input);
+ return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
+}
+function parseFileUrl(input) {
+ const match = fileRegex.exec(input);
+ const path = match[2];
+ return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
+}
+function makeUrl(scheme, user, host, port, path, query, hash) {
+ return {
+ scheme,
+ user,
+ host,
+ port,
+ path,
+ query,
+ hash,
+ type: UrlType.Absolute,
+ };
+}
+function parseUrl$2(input) {
+ if (isSchemeRelativeUrl(input)) {
+ const url = parseAbsoluteUrl('http:' + input);
+ url.scheme = '';
+ url.type = UrlType.SchemeRelative;
+ return url;
+ }
+ if (isAbsolutePath(input)) {
+ const url = parseAbsoluteUrl('http://foo.com' + input);
+ url.scheme = '';
+ url.host = '';
+ url.type = UrlType.AbsolutePath;
+ return url;
+ }
+ if (isFileUrl(input))
+ return parseFileUrl(input);
+ if (isAbsoluteUrl(input))
+ return parseAbsoluteUrl(input);
+ const url = parseAbsoluteUrl('http://foo.com/' + input);
+ url.scheme = '';
+ url.host = '';
+ url.type = input
+ ? input.startsWith('?')
+ ? UrlType.Query
+ : input.startsWith('#')
+ ? UrlType.Hash
+ : UrlType.RelativePath
+ : UrlType.Empty;
+ return url;
+}
+function stripPathFilename(path) {
+ // If a path ends with a parent directory "..", then it's a relative path with excess parent
+ // paths. It's not a file, so we can't strip it.
+ if (path.endsWith('/..'))
+ return path;
+ const index = path.lastIndexOf('/');
+ return path.slice(0, index + 1);
+}
+function mergePaths(url, base) {
+ normalizePath$4(base, base.type);
+ // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
+ // path).
+ if (url.path === '/') {
+ url.path = base.path;
+ }
+ else {
+ // Resolution happens relative to the base path's directory, not the file.
+ url.path = stripPathFilename(base.path) + url.path;
+ }
+}
+/**
+ * The path can have empty directories "//", unneeded parents "foo/..", or current directory
+ * "foo/.". We need to normalize to a standard representation.
+ */
+function normalizePath$4(url, type) {
+ const rel = type <= UrlType.RelativePath;
+ const pieces = url.path.split('/');
+ // We need to preserve the first piece always, so that we output a leading slash. The item at
+ // pieces[0] is an empty string.
+ let pointer = 1;
+ // Positive is the number of real directories we've output, used for popping a parent directory.
+ // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo".
+ let positive = 0;
+ // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will
+ // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a
+ // real directory, we won't need to append, unless the other conditions happen again.
+ let addTrailingSlash = false;
+ for (let i = 1; i < pieces.length; i++) {
+ const piece = pieces[i];
+ // An empty directory, could be a trailing slash, or just a double "//" in the path.
+ if (!piece) {
+ addTrailingSlash = true;
+ continue;
+ }
+ // If we encounter a real directory, then we don't need to append anymore.
+ addTrailingSlash = false;
+ // A current directory, which we can always drop.
+ if (piece === '.')
+ continue;
+ // A parent directory, we need to see if there are any real directories we can pop. Else, we
+ // have an excess of parents, and we'll need to keep the "..".
+ if (piece === '..') {
+ if (positive) {
+ addTrailingSlash = true;
+ positive--;
+ pointer--;
+ }
+ else if (rel) {
+ // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
+ // URL, protocol relative URL, or an absolute path, we don't need to keep excess.
+ pieces[pointer++] = piece;
+ }
+ continue;
+ }
+ // We've encountered a real directory. Move it to the next insertion pointer, which accounts for
+ // any popped or dropped directories.
+ pieces[pointer++] = piece;
+ positive++;
+ }
+ let path = '';
+ for (let i = 1; i < pointer; i++) {
+ path += '/' + pieces[i];
+ }
+ if (!path || (addTrailingSlash && !path.endsWith('/..'))) {
+ path += '/';
+ }
+ url.path = path;
+}
+/**
+ * Attempts to resolve `input` URL/path relative to `base`.
+ */
+function resolve$2(input, base) {
+ if (!input && !base)
+ return '';
+ const url = parseUrl$2(input);
+ let inputType = url.type;
+ if (base && inputType !== UrlType.Absolute) {
+ const baseUrl = parseUrl$2(base);
+ const baseType = baseUrl.type;
+ switch (inputType) {
+ case UrlType.Empty:
+ url.hash = baseUrl.hash;
+ // fall through
+ case UrlType.Hash:
+ url.query = baseUrl.query;
+ // fall through
+ case UrlType.Query:
+ case UrlType.RelativePath:
+ mergePaths(url, baseUrl);
+ // fall through
+ case UrlType.AbsolutePath:
+ // The host, user, and port are joined, you can't copy one without the others.
+ url.user = baseUrl.user;
+ url.host = baseUrl.host;
+ url.port = baseUrl.port;
+ // fall through
+ case UrlType.SchemeRelative:
+ // The input doesn't have a schema at least, so we need to copy at least that over.
+ url.scheme = baseUrl.scheme;
+ }
+ if (baseType > inputType)
+ inputType = baseType;
+ }
+ normalizePath$4(url, inputType);
+ const queryHash = url.query + url.hash;
+ switch (inputType) {
+ // This is impossible, because of the empty checks at the start of the function.
+ // case UrlType.Empty:
+ case UrlType.Hash:
+ case UrlType.Query:
+ return queryHash;
+ case UrlType.RelativePath: {
+ // The first char is always a "/", and we need it to be relative.
+ const path = url.path.slice(1);
+ if (!path)
+ return queryHash || '.';
+ if (isRelative(base || input) && !isRelative(path)) {
+ // If base started with a leading ".", or there is no base and input started with a ".",
+ // then we need to ensure that the relative path starts with a ".". We don't know if
+ // relative starts with a "..", though, so check before prepending.
+ return './' + path + queryHash;
+ }
+ return path + queryHash;
+ }
+ case UrlType.AbsolutePath:
+ return url.path + queryHash;
+ default:
+ return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
+ }
+}
+
+function resolve$1(input, base) {
+ // The base is always treated as a directory, if it's not empty.
+ // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327
+ // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401
+ if (base && !base.endsWith('/'))
+ base += '/';
+ return resolve$2(input, base);
+}
+
+/**
+ * Removes everything after the last "/", but leaves the slash.
+ */
+function stripFilename(path) {
+ if (!path)
+ return '';
+ const index = path.lastIndexOf('/');
+ return path.slice(0, index + 1);
+}
+
+const COLUMN$1 = 0;
+const SOURCES_INDEX$1 = 1;
+const SOURCE_LINE$1 = 2;
+const SOURCE_COLUMN$1 = 3;
+const NAMES_INDEX$1 = 4;
+
+function maybeSort(mappings, owned) {
+ const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
+ if (unsortedIndex === mappings.length)
+ return mappings;
+ // If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If
+ // not, we do not want to modify the consumer's input array.
+ if (!owned)
+ mappings = mappings.slice();
+ for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
+ mappings[i] = sortSegments(mappings[i], owned);
+ }
+ return mappings;
+}
+function nextUnsortedSegmentLine(mappings, start) {
+ for (let i = start; i < mappings.length; i++) {
+ if (!isSorted(mappings[i]))
+ return i;
+ }
+ return mappings.length;
+}
+function isSorted(line) {
+ for (let j = 1; j < line.length; j++) {
+ if (line[j][COLUMN$1] < line[j - 1][COLUMN$1]) {
+ return false;
+ }
+ }
+ return true;
+}
+function sortSegments(line, owned) {
+ if (!owned)
+ line = line.slice();
+ return line.sort(sortComparator);
+}
+function sortComparator(a, b) {
+ return a[COLUMN$1] - b[COLUMN$1];
+}
+
+let found = false;
+/**
+ * A binary search implementation that returns the index if a match is found.
+ * If no match is found, then the left-index (the index associated with the item that comes just
+ * before the desired index) is returned. To maintain proper sort order, a splice would happen at
+ * the next index:
+ *
+ * ```js
+ * const array = [1, 3];
+ * const needle = 2;
+ * const index = binarySearch(array, needle, (item, needle) => item - needle);
+ *
+ * assert.equal(index, 0);
+ * array.splice(index + 1, 0, needle);
+ * assert.deepEqual(array, [1, 2, 3]);
+ * ```
+ */
+function binarySearch(haystack, needle, low, high) {
+ while (low <= high) {
+ const mid = low + ((high - low) >> 1);
+ const cmp = haystack[mid][COLUMN$1] - needle;
+ if (cmp === 0) {
+ found = true;
+ return mid;
+ }
+ if (cmp < 0) {
+ low = mid + 1;
+ }
+ else {
+ high = mid - 1;
+ }
+ }
+ found = false;
+ return low - 1;
+}
+function upperBound(haystack, needle, index) {
+ for (let i = index + 1; i < haystack.length; index = i++) {
+ if (haystack[i][COLUMN$1] !== needle)
+ break;
+ }
+ return index;
+}
+function lowerBound(haystack, needle, index) {
+ for (let i = index - 1; i >= 0; index = i--) {
+ if (haystack[i][COLUMN$1] !== needle)
+ break;
+ }
+ return index;
+}
+function memoizedState() {
+ return {
+ lastKey: -1,
+ lastNeedle: -1,
+ lastIndex: -1,
+ };
+}
+/**
+ * This overly complicated beast is just to record the last tested line/column and the resulting
+ * index, allowing us to skip a few tests if mappings are monotonically increasing.
+ */
+function memoizedBinarySearch(haystack, needle, state, key) {
+ const { lastKey, lastNeedle, lastIndex } = state;
+ let low = 0;
+ let high = haystack.length - 1;
+ if (key === lastKey) {
+ if (needle === lastNeedle) {
+ found = lastIndex !== -1 && haystack[lastIndex][COLUMN$1] === needle;
+ return lastIndex;
+ }
+ if (needle >= lastNeedle) {
+ // lastIndex may be -1 if the previous needle was not found.
+ low = lastIndex === -1 ? 0 : lastIndex;
+ }
+ else {
+ high = lastIndex;
+ }
+ }
+ state.lastKey = key;
+ state.lastNeedle = needle;
+ return (state.lastIndex = binarySearch(haystack, needle, low, high));
+}
+
+const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)';
+const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)';
+const LEAST_UPPER_BOUND = -1;
+const GREATEST_LOWER_BOUND = 1;
+/**
+ * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.
+ */
+let decodedMappings;
+/**
+ * A low-level API to find the segment associated with a generated line/column (think, from a
+ * stack trace). Line and column here are 0-based, unlike `originalPositionFor`.
+ */
+let traceSegment;
+/**
+ * A higher-level API to find the source/line/column associated with a generated line/column
+ * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in
+ * `source-map` library.
+ */
+let originalPositionFor$1;
+class TraceMap {
+ constructor(map, mapUrl) {
+ const isString = typeof map === 'string';
+ if (!isString && map._decodedMemo)
+ return map;
+ const parsed = (isString ? JSON.parse(map) : map);
+ const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
+ this.version = version;
+ this.file = file;
+ this.names = names;
+ this.sourceRoot = sourceRoot;
+ this.sources = sources;
+ this.sourcesContent = sourcesContent;
+ const from = resolve$1(sourceRoot || '', stripFilename(mapUrl));
+ this.resolvedSources = sources.map((s) => resolve$1(s || '', from));
+ const { mappings } = parsed;
+ if (typeof mappings === 'string') {
+ this._encoded = mappings;
+ this._decoded = undefined;
+ }
+ else {
+ this._encoded = undefined;
+ this._decoded = maybeSort(mappings, isString);
+ }
+ this._decodedMemo = memoizedState();
+ this._bySources = undefined;
+ this._bySourceMemos = undefined;
+ }
+}
+(() => {
+ decodedMappings = (map) => {
+ return (map._decoded || (map._decoded = decode(map._encoded)));
+ };
+ traceSegment = (map, line, column) => {
+ const decoded = decodedMappings(map);
+ // It's common for parent source maps to have pointers to lines that have no
+ // mapping (like a "//# sourceMappingURL=") at the end of the child file.
+ if (line >= decoded.length)
+ return null;
+ const segments = decoded[line];
+ const index = traceSegmentInternal(segments, map._decodedMemo, line, column, GREATEST_LOWER_BOUND);
+ return index === -1 ? null : segments[index];
+ };
+ originalPositionFor$1 = (map, { line, column, bias }) => {
+ line--;
+ if (line < 0)
+ throw new Error(LINE_GTR_ZERO);
+ if (column < 0)
+ throw new Error(COL_GTR_EQ_ZERO);
+ const decoded = decodedMappings(map);
+ // It's common for parent source maps to have pointers to lines that have no
+ // mapping (like a "//# sourceMappingURL=") at the end of the child file.
+ if (line >= decoded.length)
+ return OMapping(null, null, null, null);
+ const segments = decoded[line];
+ const index = traceSegmentInternal(segments, map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
+ if (index === -1)
+ return OMapping(null, null, null, null);
+ const segment = segments[index];
+ if (segment.length === 1)
+ return OMapping(null, null, null, null);
+ const { names, resolvedSources } = map;
+ return OMapping(resolvedSources[segment[SOURCES_INDEX$1]], segment[SOURCE_LINE$1] + 1, segment[SOURCE_COLUMN$1], segment.length === 5 ? names[segment[NAMES_INDEX$1]] : null);
+ };
+})();
+function OMapping(source, line, column, name) {
+ return { source, line, column, name };
+}
+function traceSegmentInternal(segments, memo, line, column, bias) {
+ let index = memoizedBinarySearch(segments, column, memo, line);
+ if (found) {
+ index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
+ }
+ else if (bias === LEAST_UPPER_BOUND)
+ index++;
+ if (index === -1 || index === segments.length)
+ return -1;
+ return index;
+}
+
+/**
+ * Gets the index associated with `key` in the backing array, if it is already present.
+ */
+let get;
+/**
+ * Puts `key` into the backing array, if it is not already present. Returns
+ * the index of the `key` in the backing array.
+ */
+let put;
+/**
+ * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the
+ * index of the `key` in the backing array.
+ *
+ * This is designed to allow synchronizing a second array with the contents of the backing array,
+ * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,
+ * and there are never duplicates.
+ */
+class SetArray {
+ constructor() {
+ this._indexes = { __proto__: null };
+ this.array = [];
+ }
+}
+(() => {
+ get = (strarr, key) => strarr._indexes[key];
+ put = (strarr, key) => {
+ // The key may or may not be present. If it is present, it's a number.
+ const index = get(strarr, key);
+ if (index !== undefined)
+ return index;
+ const { array, _indexes: indexes } = strarr;
+ return (indexes[key] = array.push(key) - 1);
+ };
+})();
+
+const COLUMN = 0;
+const SOURCES_INDEX = 1;
+const SOURCE_LINE = 2;
+const SOURCE_COLUMN = 3;
+const NAMES_INDEX = 4;
+
+const NO_NAME = -1;
+/**
+ * Same as `addSegment`, but will only add the segment if it generates useful information in the
+ * resulting map. This only works correctly if segments are added **in order**, meaning you should
+ * not add a segment with a lower generated line/column than one that came before.
+ */
+let maybeAddSegment;
+/**
+ * Adds/removes the content of the source file to the source map.
+ */
+let setSourceContent;
+/**
+ * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
+ * a sourcemap, or to JSON.stringify.
+ */
+let toDecodedMap;
+/**
+ * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
+ * a sourcemap, or to JSON.stringify.
+ */
+let toEncodedMap;
+// This split declaration is only so that terser can elminiate the static initialization block.
+let addSegmentInternal;
+/**
+ * Provides the state to generate a sourcemap.
+ */
+class GenMapping {
+ constructor({ file, sourceRoot } = {}) {
+ this._names = new SetArray();
+ this._sources = new SetArray();
+ this._sourcesContent = [];
+ this._mappings = [];
+ this.file = file;
+ this.sourceRoot = sourceRoot;
+ }
+}
+(() => {
+ maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
+ return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content);
+ };
+ setSourceContent = (map, source, content) => {
+ const { _sources: sources, _sourcesContent: sourcesContent } = map;
+ sourcesContent[put(sources, source)] = content;
+ };
+ toDecodedMap = (map) => {
+ const { file, sourceRoot, _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map;
+ removeEmptyFinalLines(mappings);
+ return {
+ version: 3,
+ file: file || undefined,
+ names: names.array,
+ sourceRoot: sourceRoot || undefined,
+ sources: sources.array,
+ sourcesContent,
+ mappings,
+ };
+ };
+ toEncodedMap = (map) => {
+ const decoded = toDecodedMap(map);
+ return Object.assign(Object.assign({}, decoded), { mappings: encode$1(decoded.mappings) });
+ };
+ // Internal helpers
+ addSegmentInternal = (skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
+ const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map;
+ const line = getLine(mappings, genLine);
+ const index = getColumnIndex(line, genColumn);
+ if (!source) {
+ if (skipable && skipSourceless(line, index))
+ return;
+ return insert(line, index, [genColumn]);
+ }
+ const sourcesIndex = put(sources, source);
+ const namesIndex = name ? put(names, name) : NO_NAME;
+ if (sourcesIndex === sourcesContent.length)
+ sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null;
+ if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
+ return;
+ }
+ return insert(line, index, name
+ ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]
+ : [genColumn, sourcesIndex, sourceLine, sourceColumn]);
+ };
+})();
+function getLine(mappings, index) {
+ for (let i = mappings.length; i <= index; i++) {
+ mappings[i] = [];
+ }
+ return mappings[index];
+}
+function getColumnIndex(line, genColumn) {
+ let index = line.length;
+ for (let i = index - 1; i >= 0; index = i--) {
+ const current = line[i];
+ if (genColumn >= current[COLUMN])
+ break;
+ }
+ return index;
+}
+function insert(array, index, value) {
+ for (let i = array.length; i > index; i--) {
+ array[i] = array[i - 1];
+ }
+ array[index] = value;
+}
+function removeEmptyFinalLines(mappings) {
+ const { length } = mappings;
+ let len = length;
+ for (let i = len - 1; i >= 0; len = i, i--) {
+ if (mappings[i].length > 0)
+ break;
+ }
+ if (len < length)
+ mappings.length = len;
+}
+function skipSourceless(line, index) {
+ // The start of a line is already sourceless, so adding a sourceless segment to the beginning
+ // doesn't generate any useful information.
+ if (index === 0)
+ return true;
+ const prev = line[index - 1];
+ // If the previous segment is also sourceless, then adding another sourceless segment doesn't
+ // genrate any new information. Else, this segment will end the source/named segment and point to
+ // a sourceless position, which is useful.
+ return prev.length === 1;
+}
+function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) {
+ // A source/named segment at the start of a line gives position at that genColumn
+ if (index === 0)
+ return false;
+ const prev = line[index - 1];
+ // If the previous segment is sourceless, then we're transitioning to a source.
+ if (prev.length === 1)
+ return false;
+ // If the previous segment maps to the exact same source position, then this segment doesn't
+ // provide any new position information.
+ return (sourcesIndex === prev[SOURCES_INDEX] &&
+ sourceLine === prev[SOURCE_LINE] &&
+ sourceColumn === prev[SOURCE_COLUMN] &&
+ namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME));
+}
+
+const SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null);
+const EMPTY_SOURCES = [];
+function SegmentObject(source, line, column, name, content) {
+ return { source, line, column, name, content };
+}
+function Source(map, sources, source, content) {
+ return {
+ map,
+ sources,
+ source,
+ content,
+ };
+}
+/**
+ * MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
+ * (which may themselves be SourceMapTrees).
+ */
+function MapSource(map, sources) {
+ return Source(map, sources, '', null);
+}
+/**
+ * A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
+ * segment tracing ends at the `OriginalSource`.
+ */
+function OriginalSource(source, content) {
+ return Source(null, EMPTY_SOURCES, source, content);
+}
+/**
+ * traceMappings is only called on the root level SourceMapTree, and begins the process of
+ * resolving each mapping in terms of the original source files.
+ */
+function traceMappings(tree) {
+ // TODO: Eventually support sourceRoot, which has to be removed because the sources are already
+ // fully resolved. We'll need to make sources relative to the sourceRoot before adding them.
+ const gen = new GenMapping({ file: tree.map.file });
+ const { sources: rootSources, map } = tree;
+ const rootNames = map.names;
+ const rootMappings = decodedMappings(map);
+ for (let i = 0; i < rootMappings.length; i++) {
+ const segments = rootMappings[i];
+ for (let j = 0; j < segments.length; j++) {
+ const segment = segments[j];
+ const genCol = segment[0];
+ let traced = SOURCELESS_MAPPING;
+ // 1-length segments only move the current generated column, there's no source information
+ // to gather from it.
+ if (segment.length !== 1) {
+ const source = rootSources[segment[1]];
+ traced = originalPositionFor(source, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : '');
+ // If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a
+ // respective segment into an original source.
+ if (traced == null)
+ continue;
+ }
+ const { column, line, name, content, source } = traced;
+ maybeAddSegment(gen, i, genCol, source, line, column, name);
+ if (source && content != null)
+ setSourceContent(gen, source, content);
+ }
+ }
+ return gen;
+}
+/**
+ * originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
+ * child SourceMapTrees, until we find the original source map.
+ */
+function originalPositionFor(source, line, column, name) {
+ if (!source.map) {
+ return SegmentObject(source.source, line, column, name, source.content);
+ }
+ const segment = traceSegment(source.map, line, column);
+ // If we couldn't find a segment, then this doesn't exist in the sourcemap.
+ if (segment == null)
+ return null;
+ // 1-length segments only move the current generated column, there's no source information
+ // to gather from it.
+ if (segment.length === 1)
+ return SOURCELESS_MAPPING;
+ return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
+}
+
+function asArray(value) {
+ if (Array.isArray(value))
+ return value;
+ return [value];
+}
+/**
+ * Recursively builds a tree structure out of sourcemap files, with each node
+ * being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
+ * `OriginalSource`s and `SourceMapTree`s.
+ *
+ * Every sourcemap is composed of a collection of source files and mappings
+ * into locations of those source files. When we generate a `SourceMapTree` for
+ * the sourcemap, we attempt to load each source file's own sourcemap. If it
+ * does not have an associated sourcemap, it is considered an original,
+ * unmodified source file.
+ */
+function buildSourceMapTree(input, loader) {
+ const maps = asArray(input).map((m) => new TraceMap(m, ''));
+ const map = maps.pop();
+ for (let i = 0; i < maps.length; i++) {
+ if (maps[i].sources.length > 1) {
+ throw new Error(`Transformation map ${i} must have exactly one source file.\n` +
+ 'Did you specify these with the most recent transformation maps first?');
+ }
+ }
+ let tree = build$2(map, loader, '', 0);
+ for (let i = maps.length - 1; i >= 0; i--) {
+ tree = MapSource(maps[i], [tree]);
+ }
+ return tree;
+}
+function build$2(map, loader, importer, importerDepth) {
+ const { resolvedSources, sourcesContent } = map;
+ const depth = importerDepth + 1;
+ const children = resolvedSources.map((sourceFile, i) => {
+ // The loading context gives the loader more information about why this file is being loaded
+ // (eg, from which importer). It also allows the loader to override the location of the loaded
+ // sourcemap/original source, or to override the content in the sourcesContent field if it's
+ // an unmodified source file.
+ const ctx = {
+ importer,
+ depth,
+ source: sourceFile || '',
+ content: undefined,
+ };
+ // Use the provided loader callback to retrieve the file's sourcemap.
+ // TODO: We should eventually support async loading of sourcemap files.
+ const sourceMap = loader(ctx.source, ctx);
+ const { source, content } = ctx;
+ // If there is a sourcemap, then we need to recurse into it to load its source files.
+ if (sourceMap)
+ return build$2(new TraceMap(sourceMap, source), loader, source, depth);
+ // Else, it's an an unmodified source file.
+ // The contents of this unmodified source file can be overridden via the loader context,
+ // allowing it to be explicitly null or a string. If it remains undefined, we fall back to
+ // the importing sourcemap's `sourcesContent` field.
+ const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
+ return OriginalSource(source, sourceContent);
+ });
+ return MapSource(map, children);
+}
+
+/**
+ * A SourceMap v3 compatible sourcemap, which only includes fields that were
+ * provided to it.
+ */
+let SourceMap$1 = class SourceMap {
+ constructor(map, options) {
+ const out = options.decodedMappings ? toDecodedMap(map) : toEncodedMap(map);
+ this.version = out.version; // SourceMap spec says this should be first.
+ this.file = out.file;
+ this.mappings = out.mappings;
+ this.names = out.names;
+ this.sourceRoot = out.sourceRoot;
+ this.sources = out.sources;
+ if (!options.excludeContent) {
+ this.sourcesContent = out.sourcesContent;
+ }
+ }
+ toString() {
+ return JSON.stringify(this);
+ }
+};
+
+/**
+ * Traces through all the mappings in the root sourcemap, through the sources
+ * (and their sourcemaps), all the way back to the original source location.
+ *
+ * `loader` will be called every time we encounter a source file. If it returns
+ * a sourcemap, we will recurse into that sourcemap to continue the trace. If
+ * it returns a falsey value, that source file is treated as an original,
+ * unmodified source file.
+ *
+ * Pass `excludeContent` to exclude any self-containing source file content
+ * from the output sourcemap.
+ *
+ * Pass `decodedMappings` to receive a SourceMap with decoded (instead of
+ * VLQ encoded) mappings.
+ */
+function remapping(input, loader, options) {
+ const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
+ const tree = buildSourceMapTree(input, loader);
+ return new SourceMap$1(traceMappings(tree), opts);
+}
+
+var src$2 = {exports: {}};
+
+var browser$3 = {exports: {}};
+
+/**
+ * Helpers.
+ */
+
+var ms$1;
+var hasRequiredMs$1;
+
+function requireMs$1 () {
+ if (hasRequiredMs$1) return ms$1;
+ hasRequiredMs$1 = 1;
+ var s = 1000;
+ var m = s * 60;
+ var h = m * 60;
+ var d = h * 24;
+ var w = d * 7;
+ var y = d * 365.25;
+
+ /**
+ * Parse or format the given `val`.
+ *
+ * Options:
+ *
+ * - `long` verbose formatting [false]
+ *
+ * @param {String|Number} val
+ * @param {Object} [options]
+ * @throws {Error} throw an error if val is not a non-empty string or a number
+ * @return {String|Number}
+ * @api public
+ */
+
+ ms$1 = function(val, options) {
+ options = options || {};
+ var type = typeof val;
+ if (type === 'string' && val.length > 0) {
+ return parse(val);
+ } else if (type === 'number' && isFinite(val)) {
+ return options.long ? fmtLong(val) : fmtShort(val);
+ }
+ throw new Error(
+ 'val is not a non-empty string or a valid number. val=' +
+ JSON.stringify(val)
+ );
+ };
+
+ /**
+ * Parse the given `str` and return milliseconds.
+ *
+ * @param {String} str
+ * @return {Number}
+ * @api private
+ */
+
+ function parse(str) {
+ str = String(str);
+ if (str.length > 100) {
+ return;
+ }
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
+ str
+ );
+ if (!match) {
+ return;
+ }
+ var n = parseFloat(match[1]);
+ var type = (match[2] || 'ms').toLowerCase();
+ switch (type) {
+ case 'years':
+ case 'year':
+ case 'yrs':
+ case 'yr':
+ case 'y':
+ return n * y;
+ case 'weeks':
+ case 'week':
+ case 'w':
+ return n * w;
+ case 'days':
+ case 'day':
+ case 'd':
+ return n * d;
+ case 'hours':
+ case 'hour':
+ case 'hrs':
+ case 'hr':
+ case 'h':
+ return n * h;
+ case 'minutes':
+ case 'minute':
+ case 'mins':
+ case 'min':
+ case 'm':
+ return n * m;
+ case 'seconds':
+ case 'second':
+ case 'secs':
+ case 'sec':
+ case 's':
+ return n * s;
+ case 'milliseconds':
+ case 'millisecond':
+ case 'msecs':
+ case 'msec':
+ case 'ms':
+ return n;
+ default:
+ return undefined;
+ }
+ }
+
+ /**
+ * Short format for `ms`.
+ *
+ * @param {Number} ms
+ * @return {String}
+ * @api private
+ */
+
+ function fmtShort(ms) {
+ var msAbs = Math.abs(ms);
+ if (msAbs >= d) {
+ return Math.round(ms / d) + 'd';
+ }
+ if (msAbs >= h) {
+ return Math.round(ms / h) + 'h';
+ }
+ if (msAbs >= m) {
+ return Math.round(ms / m) + 'm';
+ }
+ if (msAbs >= s) {
+ return Math.round(ms / s) + 's';
+ }
+ return ms + 'ms';
+ }
+
+ /**
+ * Long format for `ms`.
+ *
+ * @param {Number} ms
+ * @return {String}
+ * @api private
+ */
+
+ function fmtLong(ms) {
+ var msAbs = Math.abs(ms);
+ if (msAbs >= d) {
+ return plural(ms, msAbs, d, 'day');
+ }
+ if (msAbs >= h) {
+ return plural(ms, msAbs, h, 'hour');
+ }
+ if (msAbs >= m) {
+ return plural(ms, msAbs, m, 'minute');
+ }
+ if (msAbs >= s) {
+ return plural(ms, msAbs, s, 'second');
+ }
+ return ms + ' ms';
+ }
+
+ /**
+ * Pluralization helper.
+ */
+
+ function plural(ms, msAbs, n, name) {
+ var isPlural = msAbs >= n * 1.5;
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
+ }
+ return ms$1;
+}
+
+var common$b;
+var hasRequiredCommon;
+
+function requireCommon () {
+ if (hasRequiredCommon) return common$b;
+ hasRequiredCommon = 1;
+ /**
+ * This is the common logic for both the Node.js and web browser
+ * implementations of `debug()`.
+ */
+
+ function setup(env) {
+ createDebug.debug = createDebug;
+ createDebug.default = createDebug;
+ createDebug.coerce = coerce;
+ createDebug.disable = disable;
+ createDebug.enable = enable;
+ createDebug.enabled = enabled;
+ createDebug.humanize = requireMs$1();
+ createDebug.destroy = destroy;
+
+ Object.keys(env).forEach(key => {
+ createDebug[key] = env[key];
+ });
+
+ /**
+ * The currently active debug mode names, and names to skip.
+ */
+
+ createDebug.names = [];
+ createDebug.skips = [];
+
+ /**
+ * Map of special "%n" handling functions, for the debug "format" argument.
+ *
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
+ */
+ createDebug.formatters = {};
+
+ /**
+ * Selects a color for a debug namespace
+ * @param {String} namespace The namespace string for the debug instance to be colored
+ * @return {Number|String} An ANSI color code for the given namespace
+ * @api private
+ */
+ function selectColor(namespace) {
+ let hash = 0;
+
+ for (let i = 0; i < namespace.length; i++) {
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
+ hash |= 0; // Convert to 32bit integer
+ }
+
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
+ }
+ createDebug.selectColor = selectColor;
+
+ /**
+ * Create a debugger with the given `namespace`.
+ *
+ * @param {String} namespace
+ * @return {Function}
+ * @api public
+ */
+ function createDebug(namespace) {
+ let prevTime;
+ let enableOverride = null;
+ let namespacesCache;
+ let enabledCache;
+
+ function debug(...args) {
+ // Disabled?
+ if (!debug.enabled) {
+ return;
+ }
+
+ const self = debug;
+
+ // Set `diff` timestamp
+ const curr = Number(new Date());
+ const ms = curr - (prevTime || curr);
+ self.diff = ms;
+ self.prev = prevTime;
+ self.curr = curr;
+ prevTime = curr;
+
+ args[0] = createDebug.coerce(args[0]);
+
+ if (typeof args[0] !== 'string') {
+ // Anything else let's inspect with %O
+ args.unshift('%O');
+ }
+
+ // Apply any `formatters` transformations
+ let index = 0;
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
+ // If we encounter an escaped % then don't increase the array index
+ if (match === '%%') {
+ return '%';
+ }
+ index++;
+ const formatter = createDebug.formatters[format];
+ if (typeof formatter === 'function') {
+ const val = args[index];
+ match = formatter.call(self, val);
+
+ // Now we need to remove `args[index]` since it's inlined in the `format`
+ args.splice(index, 1);
+ index--;
+ }
+ return match;
+ });
+
+ // Apply env-specific formatting (colors, etc.)
+ createDebug.formatArgs.call(self, args);
+
+ const logFn = self.log || createDebug.log;
+ logFn.apply(self, args);
+ }
+
+ debug.namespace = namespace;
+ debug.useColors = createDebug.useColors();
+ debug.color = createDebug.selectColor(namespace);
+ debug.extend = extend;
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
+
+ Object.defineProperty(debug, 'enabled', {
+ enumerable: true,
+ configurable: false,
+ get: () => {
+ if (enableOverride !== null) {
+ return enableOverride;
+ }
+ if (namespacesCache !== createDebug.namespaces) {
+ namespacesCache = createDebug.namespaces;
+ enabledCache = createDebug.enabled(namespace);
+ }
+
+ return enabledCache;
+ },
+ set: v => {
+ enableOverride = v;
+ }
+ });
+
+ // Env-specific initialization logic for debug instances
+ if (typeof createDebug.init === 'function') {
+ createDebug.init(debug);
+ }
+
+ return debug;
+ }
+
+ function extend(namespace, delimiter) {
+ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
+ newDebug.log = this.log;
+ return newDebug;
+ }
+
+ /**
+ * Enables a debug mode by namespaces. This can include modes
+ * separated by a colon and wildcards.
+ *
+ * @param {String} namespaces
+ * @api public
+ */
+ function enable(namespaces) {
+ createDebug.save(namespaces);
+ createDebug.namespaces = namespaces;
+
+ createDebug.names = [];
+ createDebug.skips = [];
+
+ let i;
+ const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
+ const len = split.length;
+
+ for (i = 0; i < len; i++) {
+ if (!split[i]) {
+ // ignore empty strings
+ continue;
+ }
+
+ namespaces = split[i].replace(/\*/g, '.*?');
+
+ if (namespaces[0] === '-') {
+ createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
+ } else {
+ createDebug.names.push(new RegExp('^' + namespaces + '$'));
+ }
+ }
+ }
+
+ /**
+ * Disable debug output.
+ *
+ * @return {String} namespaces
+ * @api public
+ */
+ function disable() {
+ const namespaces = [
+ ...createDebug.names.map(toNamespace),
+ ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
+ ].join(',');
+ createDebug.enable('');
+ return namespaces;
+ }
+
+ /**
+ * Returns true if the given mode name is enabled, false otherwise.
+ *
+ * @param {String} name
+ * @return {Boolean}
+ * @api public
+ */
+ function enabled(name) {
+ if (name[name.length - 1] === '*') {
+ return true;
+ }
+
+ let i;
+ let len;
+
+ for (i = 0, len = createDebug.skips.length; i < len; i++) {
+ if (createDebug.skips[i].test(name)) {
+ return false;
+ }
+ }
+
+ for (i = 0, len = createDebug.names.length; i < len; i++) {
+ if (createDebug.names[i].test(name)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Convert regexp to namespace
+ *
+ * @param {RegExp} regxep
+ * @return {String} namespace
+ * @api private
+ */
+ function toNamespace(regexp) {
+ return regexp.toString()
+ .substring(2, regexp.toString().length - 2)
+ .replace(/\.\*\?$/, '*');
+ }
+
+ /**
+ * Coerce `val`.
+ *
+ * @param {Mixed} val
+ * @return {Mixed}
+ * @api private
+ */
+ function coerce(val) {
+ if (val instanceof Error) {
+ return val.stack || val.message;
+ }
+ return val;
+ }
+
+ /**
+ * XXX DO NOT USE. This is a temporary stub function.
+ * XXX It WILL be removed in the next major release.
+ */
+ function destroy() {
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
+ }
+
+ createDebug.enable(createDebug.load());
+
+ return createDebug;
+ }
+
+ common$b = setup;
+ return common$b;
+}
+
+/* eslint-env browser */
+
+var hasRequiredBrowser$1;
+
+function requireBrowser$1 () {
+ if (hasRequiredBrowser$1) return browser$3.exports;
+ hasRequiredBrowser$1 = 1;
+ (function (module, exports) {
+ /**
+ * This is the web browser implementation of `debug()`.
+ */
+
+ exports.formatArgs = formatArgs;
+ exports.save = save;
+ exports.load = load;
+ exports.useColors = useColors;
+ exports.storage = localstorage();
+ exports.destroy = (() => {
+ let warned = false;
+
+ return () => {
+ if (!warned) {
+ warned = true;
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
+ }
+ };
+ })();
+
+ /**
+ * Colors.
+ */
+
+ exports.colors = [
+ '#0000CC',
+ '#0000FF',
+ '#0033CC',
+ '#0033FF',
+ '#0066CC',
+ '#0066FF',
+ '#0099CC',
+ '#0099FF',
+ '#00CC00',
+ '#00CC33',
+ '#00CC66',
+ '#00CC99',
+ '#00CCCC',
+ '#00CCFF',
+ '#3300CC',
+ '#3300FF',
+ '#3333CC',
+ '#3333FF',
+ '#3366CC',
+ '#3366FF',
+ '#3399CC',
+ '#3399FF',
+ '#33CC00',
+ '#33CC33',
+ '#33CC66',
+ '#33CC99',
+ '#33CCCC',
+ '#33CCFF',
+ '#6600CC',
+ '#6600FF',
+ '#6633CC',
+ '#6633FF',
+ '#66CC00',
+ '#66CC33',
+ '#9900CC',
+ '#9900FF',
+ '#9933CC',
+ '#9933FF',
+ '#99CC00',
+ '#99CC33',
+ '#CC0000',
+ '#CC0033',
+ '#CC0066',
+ '#CC0099',
+ '#CC00CC',
+ '#CC00FF',
+ '#CC3300',
+ '#CC3333',
+ '#CC3366',
+ '#CC3399',
+ '#CC33CC',
+ '#CC33FF',
+ '#CC6600',
+ '#CC6633',
+ '#CC9900',
+ '#CC9933',
+ '#CCCC00',
+ '#CCCC33',
+ '#FF0000',
+ '#FF0033',
+ '#FF0066',
+ '#FF0099',
+ '#FF00CC',
+ '#FF00FF',
+ '#FF3300',
+ '#FF3333',
+ '#FF3366',
+ '#FF3399',
+ '#FF33CC',
+ '#FF33FF',
+ '#FF6600',
+ '#FF6633',
+ '#FF9900',
+ '#FF9933',
+ '#FFCC00',
+ '#FFCC33'
+ ];
+
+ /**
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
+ * and the Firebug extension (any Firefox version) are known
+ * to support "%c" CSS customizations.
+ *
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
+ */
+
+ // eslint-disable-next-line complexity
+ function useColors() {
+ // NB: In an Electron preload script, document will be defined but not fully
+ // initialized. Since we know we're in Chrome, we'll just detect this case
+ // explicitly
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
+ return true;
+ }
+
+ // Internet Explorer and Edge do not support colors.
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
+ return false;
+ }
+
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
+ // Is firebug? http://stackoverflow.com/a/398120/376773
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
+ // Is firefox >= v31?
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
+ // Double check webkit in userAgent just in case we are in a worker
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
+ }
+
+ /**
+ * Colorize log arguments if enabled.
+ *
+ * @api public
+ */
+
+ function formatArgs(args) {
+ args[0] = (this.useColors ? '%c' : '') +
+ this.namespace +
+ (this.useColors ? ' %c' : ' ') +
+ args[0] +
+ (this.useColors ? '%c ' : ' ') +
+ '+' + module.exports.humanize(this.diff);
+
+ if (!this.useColors) {
+ return;
+ }
+
+ const c = 'color: ' + this.color;
+ args.splice(1, 0, c, 'color: inherit');
+
+ // The final "%c" is somewhat tricky, because there could be other
+ // arguments passed either before or after the %c, so we need to
+ // figure out the correct index to insert the CSS into
+ let index = 0;
+ let lastC = 0;
+ args[0].replace(/%[a-zA-Z%]/g, match => {
+ if (match === '%%') {
+ return;
+ }
+ index++;
+ if (match === '%c') {
+ // We only are interested in the *last* %c
+ // (the user may have provided their own)
+ lastC = index;
+ }
+ });
+
+ args.splice(lastC, 0, c);
+ }
+
+ /**
+ * Invokes `console.debug()` when available.
+ * No-op when `console.debug` is not a "function".
+ * If `console.debug` is not available, falls back
+ * to `console.log`.
+ *
+ * @api public
+ */
+ exports.log = console.debug || console.log || (() => {});
+
+ /**
+ * Save `namespaces`.
+ *
+ * @param {String} namespaces
+ * @api private
+ */
+ function save(namespaces) {
+ try {
+ if (namespaces) {
+ exports.storage.setItem('debug', namespaces);
+ } else {
+ exports.storage.removeItem('debug');
+ }
+ } catch (error) {
+ // Swallow
+ // XXX (@Qix-) should we be logging these?
+ }
+ }
+
+ /**
+ * Load `namespaces`.
+ *
+ * @return {String} returns the previously persisted debug modes
+ * @api private
+ */
+ function load() {
+ let r;
+ try {
+ r = exports.storage.getItem('debug');
+ } catch (error) {
+ // Swallow
+ // XXX (@Qix-) should we be logging these?
+ }
+
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
+ r = process.env.DEBUG;
+ }
+
+ return r;
+ }
+
+ /**
+ * Localstorage attempts to return the localstorage.
+ *
+ * This is necessary because safari throws
+ * when a user disables cookies/localstorage
+ * and you attempt to access it.
+ *
+ * @return {LocalStorage}
+ * @api private
+ */
+
+ function localstorage() {
+ try {
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
+ // The Browser also has localStorage in the global context.
+ return localStorage;
+ } catch (error) {
+ // Swallow
+ // XXX (@Qix-) should we be logging these?
+ }
+ }
+
+ module.exports = requireCommon()(exports);
+
+ const {formatters} = module.exports;
+
+ /**
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
+ */
+
+ formatters.j = function (v) {
+ try {
+ return JSON.stringify(v);
+ } catch (error) {
+ return '[UnexpectedJSONParseError]: ' + error.message;
+ }
+ };
+ } (browser$3, browser$3.exports));
+ return browser$3.exports;
+}
+
+var node$1 = {exports: {}};
+
+/**
+ * Module dependencies.
+ */
+
+var hasRequiredNode$1;
+
+function requireNode$1 () {
+ if (hasRequiredNode$1) return node$1.exports;
+ hasRequiredNode$1 = 1;
+ (function (module, exports) {
+ const tty = require$$0$3;
+ const util = require$$0$6;
+
+ /**
+ * This is the Node.js implementation of `debug()`.
+ */
+
+ exports.init = init;
+ exports.log = log;
+ exports.formatArgs = formatArgs;
+ exports.save = save;
+ exports.load = load;
+ exports.useColors = useColors;
+ exports.destroy = util.deprecate(
+ () => {},
+ 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
+ );
+
+ /**
+ * Colors.
+ */
+
+ exports.colors = [6, 2, 3, 4, 5, 1];
+
+ try {
+ // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
+ // eslint-disable-next-line import/no-extraneous-dependencies
+ const supportsColor = require('supports-color');
+
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
+ exports.colors = [
+ 20,
+ 21,
+ 26,
+ 27,
+ 32,
+ 33,
+ 38,
+ 39,
+ 40,
+ 41,
+ 42,
+ 43,
+ 44,
+ 45,
+ 56,
+ 57,
+ 62,
+ 63,
+ 68,
+ 69,
+ 74,
+ 75,
+ 76,
+ 77,
+ 78,
+ 79,
+ 80,
+ 81,
+ 92,
+ 93,
+ 98,
+ 99,
+ 112,
+ 113,
+ 128,
+ 129,
+ 134,
+ 135,
+ 148,
+ 149,
+ 160,
+ 161,
+ 162,
+ 163,
+ 164,
+ 165,
+ 166,
+ 167,
+ 168,
+ 169,
+ 170,
+ 171,
+ 172,
+ 173,
+ 178,
+ 179,
+ 184,
+ 185,
+ 196,
+ 197,
+ 198,
+ 199,
+ 200,
+ 201,
+ 202,
+ 203,
+ 204,
+ 205,
+ 206,
+ 207,
+ 208,
+ 209,
+ 214,
+ 215,
+ 220,
+ 221
+ ];
+ }
+ } catch (error) {
+ // Swallow - we only care if `supports-color` is available; it doesn't have to be.
+ }
+
+ /**
+ * Build up the default `inspectOpts` object from the environment variables.
+ *
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
+ */
+
+ exports.inspectOpts = Object.keys(process.env).filter(key => {
+ return /^debug_/i.test(key);
+ }).reduce((obj, key) => {
+ // Camel-case
+ const prop = key
+ .substring(6)
+ .toLowerCase()
+ .replace(/_([a-z])/g, (_, k) => {
+ return k.toUpperCase();
+ });
+
+ // Coerce string value into JS value
+ let val = process.env[key];
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
+ val = true;
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
+ val = false;
+ } else if (val === 'null') {
+ val = null;
+ } else {
+ val = Number(val);
+ }
+
+ obj[prop] = val;
+ return obj;
+ }, {});
+
+ /**
+ * Is stdout a TTY? Colored output is enabled when `true`.
+ */
+
+ function useColors() {
+ return 'colors' in exports.inspectOpts ?
+ Boolean(exports.inspectOpts.colors) :
+ tty.isatty(process.stderr.fd);
+ }
+
+ /**
+ * Adds ANSI color escape codes if enabled.
+ *
+ * @api public
+ */
+
+ function formatArgs(args) {
+ const {namespace: name, useColors} = this;
+
+ if (useColors) {
+ const c = this.color;
+ const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
+
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
+ args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
+ } else {
+ args[0] = getDate() + name + ' ' + args[0];
+ }
+ }
+
+ function getDate() {
+ if (exports.inspectOpts.hideDate) {
+ return '';
+ }
+ return new Date().toISOString() + ' ';
+ }
+
+ /**
+ * Invokes `util.format()` with the specified arguments and writes to stderr.
+ */
+
+ function log(...args) {
+ return process.stderr.write(util.format(...args) + '\n');
+ }
+
+ /**
+ * Save `namespaces`.
+ *
+ * @param {String} namespaces
+ * @api private
+ */
+ function save(namespaces) {
+ if (namespaces) {
+ process.env.DEBUG = namespaces;
+ } else {
+ // If you set a process.env field to null or undefined, it gets cast to the
+ // string 'null' or 'undefined'. Just delete instead.
+ delete process.env.DEBUG;
+ }
+ }
+
+ /**
+ * Load `namespaces`.
+ *
+ * @return {String} returns the previously persisted debug modes
+ * @api private
+ */
+
+ function load() {
+ return process.env.DEBUG;
+ }
+
+ /**
+ * Init logic for `debug` instances.
+ *
+ * Create a new `inspectOpts` object in case `useColors` is set
+ * differently for a particular `debug` instance.
+ */
+
+ function init(debug) {
+ debug.inspectOpts = {};
+
+ const keys = Object.keys(exports.inspectOpts);
+ for (let i = 0; i < keys.length; i++) {
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
+ }
+ }
+
+ module.exports = requireCommon()(exports);
+
+ const {formatters} = module.exports;
+
+ /**
+ * Map %o to `util.inspect()`, all on a single line.
+ */
+
+ formatters.o = function (v) {
+ this.inspectOpts.colors = this.useColors;
+ return util.inspect(v, this.inspectOpts)
+ .split('\n')
+ .map(str => str.trim())
+ .join(' ');
+ };
+
+ /**
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
+ */
+
+ formatters.O = function (v) {
+ this.inspectOpts.colors = this.useColors;
+ return util.inspect(v, this.inspectOpts);
+ };
+ } (node$1, node$1.exports));
+ return node$1.exports;
+}
+
+/**
+ * Detect Electron renderer / nwjs process, which is node, but we should
+ * treat as a browser.
+ */
+
+if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
+ src$2.exports = requireBrowser$1();
+} else {
+ src$2.exports = requireNode$1();
+}
+
+var srcExports$1 = src$2.exports;
+var debug$g = /*@__PURE__*/getDefaultExportFromCjs(srcExports$1);
+
+let pnp;
+if (process.versions.pnp) {
+ try {
+ pnp = createRequire$1(import.meta.url)('pnpapi');
+ }
+ catch { }
+}
+function invalidatePackageData(packageCache, pkgPath) {
+ const pkgDir = path$o.dirname(pkgPath);
+ packageCache.forEach((pkg, cacheKey) => {
+ if (pkg.dir === pkgDir) {
+ packageCache.delete(cacheKey);
+ }
+ });
+}
+function resolvePackageData(pkgName, basedir, preserveSymlinks = false, packageCache) {
+ if (pnp) {
+ const cacheKey = getRpdCacheKey(pkgName, basedir, preserveSymlinks);
+ if (packageCache?.has(cacheKey))
+ return packageCache.get(cacheKey);
+ try {
+ const pkg = pnp.resolveToUnqualified(pkgName, basedir, {
+ considerBuiltins: false,
+ });
+ if (!pkg)
+ return null;
+ const pkgData = loadPackageData(path$o.join(pkg, 'package.json'));
+ packageCache?.set(cacheKey, pkgData);
+ return pkgData;
+ }
+ catch {
+ return null;
+ }
+ }
+ const originalBasedir = basedir;
+ while (basedir) {
+ if (packageCache) {
+ const cached = getRpdCache(packageCache, pkgName, basedir, originalBasedir, preserveSymlinks);
+ if (cached)
+ return cached;
+ }
+ const pkg = path$o.join(basedir, 'node_modules', pkgName, 'package.json');
+ try {
+ if (fs$l.existsSync(pkg)) {
+ const pkgPath = preserveSymlinks ? pkg : safeRealpathSync(pkg);
+ const pkgData = loadPackageData(pkgPath);
+ if (packageCache) {
+ setRpdCache(packageCache, pkgData, pkgName, basedir, originalBasedir, preserveSymlinks);
+ }
+ return pkgData;
+ }
+ }
+ catch { }
+ const nextBasedir = path$o.dirname(basedir);
+ if (nextBasedir === basedir)
+ break;
+ basedir = nextBasedir;
+ }
+ return null;
+}
+function findNearestPackageData(basedir, packageCache) {
+ const originalBasedir = basedir;
+ while (basedir) {
+ if (packageCache) {
+ const cached = getFnpdCache(packageCache, basedir, originalBasedir);
+ if (cached)
+ return cached;
+ }
+ const pkgPath = path$o.join(basedir, 'package.json');
+ try {
+ if (fs$l.statSync(pkgPath, { throwIfNoEntry: false })?.isFile()) {
+ const pkgData = loadPackageData(pkgPath);
+ if (packageCache) {
+ setFnpdCache(packageCache, pkgData, basedir, originalBasedir);
+ }
+ return pkgData;
+ }
+ }
+ catch { }
+ const nextBasedir = path$o.dirname(basedir);
+ if (nextBasedir === basedir)
+ break;
+ basedir = nextBasedir;
+ }
+ return null;
+}
+// Finds the nearest package.json with a `name` field
+function findNearestMainPackageData(basedir, packageCache) {
+ const nearestPackage = findNearestPackageData(basedir, packageCache);
+ return (nearestPackage &&
+ (nearestPackage.data.name
+ ? nearestPackage
+ : findNearestMainPackageData(path$o.dirname(nearestPackage.dir), packageCache)));
+}
+function loadPackageData(pkgPath) {
+ const data = JSON.parse(fs$l.readFileSync(pkgPath, 'utf-8'));
+ const pkgDir = path$o.dirname(pkgPath);
+ const { sideEffects } = data;
+ let hasSideEffects;
+ if (typeof sideEffects === 'boolean') {
+ hasSideEffects = () => sideEffects;
+ }
+ else if (Array.isArray(sideEffects)) {
+ const finalPackageSideEffects = sideEffects.map((sideEffect) => {
+ /*
+ * The array accepts simple glob patterns to the relevant files... Patterns like *.css, which do not include a /, will be treated like **\/*.css.
+ * https://webpack.js.org/guides/tree-shaking/
+ * https://github.com/vitejs/vite/pull/11807
+ */
+ if (sideEffect.includes('/')) {
+ return sideEffect;
+ }
+ return `**/${sideEffect}`;
+ });
+ hasSideEffects = createFilter(finalPackageSideEffects, null, {
+ resolve: pkgDir,
+ });
+ }
+ else {
+ hasSideEffects = () => true;
+ }
+ const pkg = {
+ dir: pkgDir,
+ data,
+ hasSideEffects,
+ webResolvedImports: {},
+ nodeResolvedImports: {},
+ setResolvedCache(key, entry, targetWeb) {
+ if (targetWeb) {
+ pkg.webResolvedImports[key] = entry;
+ }
+ else {
+ pkg.nodeResolvedImports[key] = entry;
+ }
+ },
+ getResolvedCache(key, targetWeb) {
+ if (targetWeb) {
+ return pkg.webResolvedImports[key];
+ }
+ else {
+ return pkg.nodeResolvedImports[key];
+ }
+ },
+ };
+ return pkg;
+}
+function watchPackageDataPlugin(packageCache) {
+ // a list of files to watch before the plugin is ready
+ const watchQueue = new Set();
+ const watchedDirs = new Set();
+ const watchFileStub = (id) => {
+ watchQueue.add(id);
+ };
+ let watchFile = watchFileStub;
+ const setPackageData = packageCache.set.bind(packageCache);
+ packageCache.set = (id, pkg) => {
+ if (!isInNodeModules(pkg.dir) && !watchedDirs.has(pkg.dir)) {
+ watchedDirs.add(pkg.dir);
+ watchFile(path$o.join(pkg.dir, 'package.json'));
+ }
+ return setPackageData(id, pkg);
+ };
+ return {
+ name: 'vite:watch-package-data',
+ buildStart() {
+ watchFile = this.addWatchFile.bind(this);
+ watchQueue.forEach(watchFile);
+ watchQueue.clear();
+ },
+ buildEnd() {
+ watchFile = watchFileStub;
+ },
+ watchChange(id) {
+ if (id.endsWith('/package.json')) {
+ invalidatePackageData(packageCache, path$o.normalize(id));
+ }
+ },
+ handleHotUpdate({ file }) {
+ if (file.endsWith('/package.json')) {
+ invalidatePackageData(packageCache, path$o.normalize(file));
+ }
+ },
+ };
+}
+/**
+ * Get cached `resolvePackageData` value based on `basedir`. When one is found,
+ * and we've already traversed some directories between `basedir` and `originalBasedir`,
+ * we cache the value for those in-between directories as well.
+ *
+ * This makes it so the fs is only read once for a shared `basedir`.
+ */
+function getRpdCache(packageCache, pkgName, basedir, originalBasedir, preserveSymlinks) {
+ const cacheKey = getRpdCacheKey(pkgName, basedir, preserveSymlinks);
+ const pkgData = packageCache.get(cacheKey);
+ if (pkgData) {
+ traverseBetweenDirs(originalBasedir, basedir, (dir) => {
+ packageCache.set(getRpdCacheKey(pkgName, dir, preserveSymlinks), pkgData);
+ });
+ return pkgData;
+ }
+}
+function setRpdCache(packageCache, pkgData, pkgName, basedir, originalBasedir, preserveSymlinks) {
+ packageCache.set(getRpdCacheKey(pkgName, basedir, preserveSymlinks), pkgData);
+ traverseBetweenDirs(originalBasedir, basedir, (dir) => {
+ packageCache.set(getRpdCacheKey(pkgName, dir, preserveSymlinks), pkgData);
+ });
+}
+// package cache key for `resolvePackageData`
+function getRpdCacheKey(pkgName, basedir, preserveSymlinks) {
+ return `rpd_${pkgName}_${basedir}_${preserveSymlinks}`;
+}
+/**
+ * Get cached `findNearestPackageData` value based on `basedir`. When one is found,
+ * and we've already traversed some directories between `basedir` and `originalBasedir`,
+ * we cache the value for those in-between directories as well.
+ *
+ * This makes it so the fs is only read once for a shared `basedir`.
+ */
+function getFnpdCache(packageCache, basedir, originalBasedir) {
+ const cacheKey = getFnpdCacheKey(basedir);
+ const pkgData = packageCache.get(cacheKey);
+ if (pkgData) {
+ traverseBetweenDirs(originalBasedir, basedir, (dir) => {
+ packageCache.set(getFnpdCacheKey(dir), pkgData);
+ });
+ return pkgData;
+ }
+}
+function setFnpdCache(packageCache, pkgData, basedir, originalBasedir) {
+ packageCache.set(getFnpdCacheKey(basedir), pkgData);
+ traverseBetweenDirs(originalBasedir, basedir, (dir) => {
+ packageCache.set(getFnpdCacheKey(dir), pkgData);
+ });
+}
+// package cache key for `findNearestPackageData`
+function getFnpdCacheKey(basedir) {
+ return `fnpd_${basedir}`;
+}
+/**
+ * Traverse between `longerDir` (inclusive) and `shorterDir` (exclusive) and call `cb` for each dir.
+ * @param longerDir Longer dir path, e.g. `/User/foo/bar/baz`
+ * @param shorterDir Shorter dir path, e.g. `/User/foo`
+ */
+function traverseBetweenDirs(longerDir, shorterDir, cb) {
+ while (longerDir !== shorterDir) {
+ cb(longerDir);
+ longerDir = path$o.dirname(longerDir);
+ }
+}
+
+const createFilter = createFilter$1;
+const windowsSlashRE = /\\/g;
+function slash$1(p) {
+ return p.replace(windowsSlashRE, '/');
+}
+/**
+ * Prepend `/@id/` and replace null byte so the id is URL-safe.
+ * This is prepended to resolved ids that are not valid browser
+ * import specifiers by the importAnalysis plugin.
+ */
+function wrapId(id) {
+ return id.startsWith(VALID_ID_PREFIX)
+ ? id
+ : VALID_ID_PREFIX + id.replace('\0', NULL_BYTE_PLACEHOLDER);
+}
+/**
+ * Undo {@link wrapId}'s `/@id/` and null byte replacements.
+ */
+function unwrapId(id) {
+ return id.startsWith(VALID_ID_PREFIX)
+ ? id.slice(VALID_ID_PREFIX.length).replace(NULL_BYTE_PLACEHOLDER, '\0')
+ : id;
+}
+const replaceSlashOrColonRE = /[/:]/g;
+const replaceDotRE = /\./g;
+const replaceNestedIdRE = /(\s*>\s*)/g;
+const replaceHashRE = /#/g;
+const flattenId = (id) => id
+ .replace(replaceSlashOrColonRE, '_')
+ .replace(replaceDotRE, '__')
+ .replace(replaceNestedIdRE, '___')
+ .replace(replaceHashRE, '____');
+const normalizeId = (id) => id.replace(replaceNestedIdRE, ' > ');
+//TODO: revisit later to see if the edge case that "compiling using node v12 code to be run in node v16 in the server" is what we intend to support.
+const builtins = new Set([
+ ...builtinModules,
+ 'assert/strict',
+ 'diagnostics_channel',
+ 'dns/promises',
+ 'fs/promises',
+ 'path/posix',
+ 'path/win32',
+ 'readline/promises',
+ 'stream/consumers',
+ 'stream/promises',
+ 'stream/web',
+ 'timers/promises',
+ 'util/types',
+ 'wasi',
+]);
+const NODE_BUILTIN_NAMESPACE = 'node:';
+function isBuiltin(id) {
+ return builtins.has(id.startsWith(NODE_BUILTIN_NAMESPACE)
+ ? id.slice(NODE_BUILTIN_NAMESPACE.length)
+ : id);
+}
+function isInNodeModules(id) {
+ return id.includes('node_modules');
+}
+function moduleListContains(moduleList, id) {
+ return moduleList?.some((m) => m === id || id.startsWith(m + '/'));
+}
+function isOptimizable(id, optimizeDeps) {
+ const { extensions } = optimizeDeps;
+ return (OPTIMIZABLE_ENTRY_RE.test(id) ||
+ (extensions?.some((ext) => id.endsWith(ext)) ?? false));
+}
+const bareImportRE = /^(?![a-zA-Z]:)[\w@](?!.*:\/\/)/;
+const deepImportRE = /^([^@][^/]*)\/|^(@[^/]+\/[^/]+)\//;
+// TODO: use import()
+const _require$3 = createRequire$1(import.meta.url);
+// set in bin/vite.js
+const filter = process.env.VITE_DEBUG_FILTER;
+const DEBUG = process.env.DEBUG;
+function createDebugger(namespace, options = {}) {
+ const log = debug$g(namespace);
+ const { onlyWhenFocused } = options;
+ let enabled = log.enabled;
+ if (enabled && onlyWhenFocused) {
+ const ns = typeof onlyWhenFocused === 'string' ? onlyWhenFocused : namespace;
+ enabled = !!DEBUG?.includes(ns);
+ }
+ if (enabled) {
+ return (...args) => {
+ if (!filter || args.some((a) => a?.includes?.(filter))) {
+ log(...args);
+ }
+ };
+ }
+}
+function testCaseInsensitiveFS() {
+ if (!CLIENT_ENTRY.endsWith('client.mjs')) {
+ throw new Error(`cannot test case insensitive FS, CLIENT_ENTRY const doesn't contain client.mjs`);
+ }
+ if (!fs$l.existsSync(CLIENT_ENTRY)) {
+ throw new Error('cannot test case insensitive FS, CLIENT_ENTRY does not point to an existing file: ' +
+ CLIENT_ENTRY);
+ }
+ return fs$l.existsSync(CLIENT_ENTRY.replace('client.mjs', 'cLiEnT.mjs'));
+}
+function isUrl(path) {
+ try {
+ new URL$3(path);
+ return true;
+ }
+ catch {
+ return false;
+ }
+}
+const isCaseInsensitiveFS = testCaseInsensitiveFS();
+const isWindows$4 = os$4.platform() === 'win32';
+const VOLUME_RE = /^[A-Z]:/i;
+function normalizePath$3(id) {
+ return path$o.posix.normalize(isWindows$4 ? slash$1(id) : id);
+}
+function fsPathFromId(id) {
+ const fsPath = normalizePath$3(id.startsWith(FS_PREFIX) ? id.slice(FS_PREFIX.length) : id);
+ return fsPath[0] === '/' || fsPath.match(VOLUME_RE) ? fsPath : `/${fsPath}`;
+}
+function fsPathFromUrl(url) {
+ return fsPathFromId(cleanUrl(url));
+}
+/**
+ * Check if dir is a parent of file
+ *
+ * Warning: parameters are not validated, only works with normalized absolute paths
+ *
+ * @param dir - normalized absolute path
+ * @param file - normalized absolute path
+ * @returns true if dir is a parent of file
+ */
+function isParentDirectory(dir, file) {
+ if (dir[dir.length - 1] !== '/') {
+ dir = `${dir}/`;
+ }
+ return (file.startsWith(dir) ||
+ (isCaseInsensitiveFS && file.toLowerCase().startsWith(dir.toLowerCase())));
+}
+/**
+ * Check if 2 file name are identical
+ *
+ * Warning: parameters are not validated, only works with normalized absolute paths
+ *
+ * @param file1 - normalized absolute path
+ * @param file2 - normalized absolute path
+ * @returns true if both files url are identical
+ */
+function isSameFileUri(file1, file2) {
+ return (file1 === file2 ||
+ (isCaseInsensitiveFS && file1.toLowerCase() === file2.toLowerCase()));
+}
+const queryRE = /\?.*$/s;
+const postfixRE = /[?#].*$/s;
+function cleanUrl(url) {
+ return url.replace(postfixRE, '');
+}
+const externalRE = /^(https?:)?\/\//;
+const isExternalUrl = (url) => externalRE.test(url);
+const dataUrlRE = /^\s*data:/i;
+const isDataUrl = (url) => dataUrlRE.test(url);
+const virtualModuleRE = /^virtual-module:.*/;
+const virtualModulePrefix = 'virtual-module:';
+const knownJsSrcRE = /\.(?:[jt]sx?|m[jt]s|vue|marko|svelte|astro|imba)(?:$|\?)/;
+const isJSRequest = (url) => {
+ url = cleanUrl(url);
+ if (knownJsSrcRE.test(url)) {
+ return true;
+ }
+ if (!path$o.extname(url) && url[url.length - 1] !== '/') {
+ return true;
+ }
+ return false;
+};
+const knownTsRE = /\.(?:ts|mts|cts|tsx)(?:$|\?)/;
+const isTsRequest = (url) => knownTsRE.test(url);
+const importQueryRE = /(\?|&)import=?(?:&|$)/;
+const directRequestRE$1 = /(\?|&)direct=?(?:&|$)/;
+const internalPrefixes = [
+ FS_PREFIX,
+ VALID_ID_PREFIX,
+ CLIENT_PUBLIC_PATH,
+ ENV_PUBLIC_PATH,
+];
+const InternalPrefixRE = new RegExp(`^(?:${internalPrefixes.join('|')})`);
+const trailingSeparatorRE = /[?&]$/;
+const isImportRequest = (url) => importQueryRE.test(url);
+const isInternalRequest = (url) => InternalPrefixRE.test(url);
+function removeImportQuery(url) {
+ return url.replace(importQueryRE, '$1').replace(trailingSeparatorRE, '');
+}
+function removeDirectQuery(url) {
+ return url.replace(directRequestRE$1, '$1').replace(trailingSeparatorRE, '');
+}
+const replacePercentageRE = /%/g;
+function injectQuery(url, queryToInject) {
+ // encode percents for consistent behavior with pathToFileURL
+ // see #2614 for details
+ const resolvedUrl = new URL$3(url.replace(replacePercentageRE, '%25'), 'relative:///');
+ const { search, hash } = resolvedUrl;
+ let pathname = cleanUrl(url);
+ pathname = isWindows$4 ? slash$1(pathname) : pathname;
+ return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ''}${hash ?? ''}`;
+}
+const timestampRE = /\bt=\d{13}&?\b/;
+function removeTimestampQuery(url) {
+ return url.replace(timestampRE, '').replace(trailingSeparatorRE, '');
+}
+async function asyncReplace(input, re, replacer) {
+ let match;
+ let remaining = input;
+ let rewritten = '';
+ while ((match = re.exec(remaining))) {
+ rewritten += remaining.slice(0, match.index);
+ rewritten += await replacer(match);
+ remaining = remaining.slice(match.index + match[0].length);
+ }
+ rewritten += remaining;
+ return rewritten;
+}
+function timeFrom(start, subtract = 0) {
+ const time = performance.now() - start - subtract;
+ const timeString = (time.toFixed(2) + `ms`).padEnd(5, ' ');
+ if (time < 10) {
+ return colors$1.green(timeString);
+ }
+ else if (time < 50) {
+ return colors$1.yellow(timeString);
+ }
+ else {
+ return colors$1.red(timeString);
+ }
+}
+/**
+ * pretty url for logging.
+ */
+function prettifyUrl(url, root) {
+ url = removeTimestampQuery(url);
+ const isAbsoluteFile = url.startsWith(root);
+ if (isAbsoluteFile || url.startsWith(FS_PREFIX)) {
+ const file = path$o.relative(root, isAbsoluteFile ? url : fsPathFromId(url));
+ return colors$1.dim(file);
+ }
+ else {
+ return colors$1.dim(url);
+ }
+}
+function isObject$2(value) {
+ return Object.prototype.toString.call(value) === '[object Object]';
+}
+function isDefined(value) {
+ return value != null;
+}
+function tryStatSync(file) {
+ try {
+ return fs$l.statSync(file, { throwIfNoEntry: false });
+ }
+ catch {
+ // Ignore errors
+ }
+}
+function lookupFile(dir, fileNames) {
+ while (dir) {
+ for (const fileName of fileNames) {
+ const fullPath = path$o.join(dir, fileName);
+ if (tryStatSync(fullPath)?.isFile())
+ return fullPath;
+ }
+ const parentDir = path$o.dirname(dir);
+ if (parentDir === dir)
+ return;
+ dir = parentDir;
+ }
+}
+const splitRE = /\r?\n/;
+const range = 2;
+function pad$1(source, n = 2) {
+ const lines = source.split(splitRE);
+ return lines.map((l) => ` `.repeat(n) + l).join(`\n`);
+}
+function posToNumber(source, pos) {
+ if (typeof pos === 'number')
+ return pos;
+ const lines = source.split(splitRE);
+ const { line, column } = pos;
+ let start = 0;
+ for (let i = 0; i < line - 1 && i < lines.length; i++) {
+ start += lines[i].length + 1;
+ }
+ return start + column;
+}
+function numberToPos(source, offset) {
+ if (typeof offset !== 'number')
+ return offset;
+ if (offset > source.length) {
+ throw new Error(`offset is longer than source length! offset ${offset} > length ${source.length}`);
+ }
+ const lines = source.split(splitRE);
+ let counted = 0;
+ let line = 0;
+ let column = 0;
+ for (; line < lines.length; line++) {
+ const lineLength = lines[line].length + 1;
+ if (counted + lineLength >= offset) {
+ column = offset - counted + 1;
+ break;
+ }
+ counted += lineLength;
+ }
+ return { line: line + 1, column };
+}
+function generateCodeFrame(source, start = 0, end) {
+ start = posToNumber(source, start);
+ end = end || start;
+ const lines = source.split(splitRE);
+ let count = 0;
+ const res = [];
+ for (let i = 0; i < lines.length; i++) {
+ count += lines[i].length + 1;
+ if (count >= start) {
+ for (let j = i - range; j <= i + range || end > count; j++) {
+ if (j < 0 || j >= lines.length)
+ continue;
+ const line = j + 1;
+ res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
+ const lineLength = lines[j].length;
+ if (j === i) {
+ // push underline
+ const pad = Math.max(start - (count - lineLength) + 1, 0);
+ const length = Math.max(1, end > count ? lineLength - pad : end - start);
+ res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));
+ }
+ else if (j > i) {
+ if (end > count) {
+ const length = Math.max(Math.min(end - count, lineLength), 1);
+ res.push(` | ` + '^'.repeat(length));
+ }
+ count += lineLength + 1;
+ }
+ }
+ break;
+ }
+ }
+ return res.join('\n');
+}
+function isFileReadable(filename) {
+ try {
+ // The "throwIfNoEntry" is a performance optimization for cases where the file does not exist
+ if (!fs$l.statSync(filename, { throwIfNoEntry: false })) {
+ return false;
+ }
+ // Check if current process has read permission to the file
+ fs$l.accessSync(filename, fs$l.constants.R_OK);
+ return true;
+ }
+ catch {
+ return false;
+ }
+}
+const splitFirstDirRE = /(.+?)[\\/](.+)/;
+/**
+ * Delete every file and subdirectory. **The given directory must exist.**
+ * Pass an optional `skip` array to preserve files under the root directory.
+ */
+function emptyDir(dir, skip) {
+ const skipInDir = [];
+ let nested = null;
+ if (skip?.length) {
+ for (const file of skip) {
+ if (path$o.dirname(file) !== '.') {
+ const matched = file.match(splitFirstDirRE);
+ if (matched) {
+ nested ?? (nested = new Map());
+ const [, nestedDir, skipPath] = matched;
+ let nestedSkip = nested.get(nestedDir);
+ if (!nestedSkip) {
+ nestedSkip = [];
+ nested.set(nestedDir, nestedSkip);
+ }
+ if (!nestedSkip.includes(skipPath)) {
+ nestedSkip.push(skipPath);
+ }
+ }
+ }
+ else {
+ skipInDir.push(file);
+ }
+ }
+ }
+ for (const file of fs$l.readdirSync(dir)) {
+ if (skipInDir.includes(file)) {
+ continue;
+ }
+ if (nested?.has(file)) {
+ emptyDir(path$o.resolve(dir, file), nested.get(file));
+ }
+ else {
+ fs$l.rmSync(path$o.resolve(dir, file), { recursive: true, force: true });
+ }
+ }
+}
+function copyDir(srcDir, destDir) {
+ fs$l.mkdirSync(destDir, { recursive: true });
+ for (const file of fs$l.readdirSync(srcDir)) {
+ const srcFile = path$o.resolve(srcDir, file);
+ if (srcFile === destDir) {
+ continue;
+ }
+ const destFile = path$o.resolve(destDir, file);
+ const stat = fs$l.statSync(srcFile);
+ if (stat.isDirectory()) {
+ copyDir(srcFile, destFile);
+ }
+ else {
+ fs$l.copyFileSync(srcFile, destFile);
+ }
+ }
+}
+// `fs.realpathSync.native` resolves differently in Windows network drive,
+// causing file read errors. skip for now.
+// https://github.com/nodejs/node/issues/37737
+let safeRealpathSync = isWindows$4
+ ? windowsSafeRealPathSync
+ : fs$l.realpathSync.native;
+// Based on https://github.com/larrybahr/windows-network-drive
+// MIT License, Copyright (c) 2017 Larry Bahr
+const windowsNetworkMap = new Map();
+function windowsMappedRealpathSync(path) {
+ const realPath = fs$l.realpathSync.native(path);
+ if (realPath.startsWith('\\\\')) {
+ for (const [network, volume] of windowsNetworkMap) {
+ if (realPath.startsWith(network))
+ return realPath.replace(network, volume);
+ }
+ }
+ return realPath;
+}
+const parseNetUseRE = /^(\w+)? +(\w:) +([^ ]+)\s/;
+let firstSafeRealPathSyncRun = false;
+function windowsSafeRealPathSync(path) {
+ if (!firstSafeRealPathSyncRun) {
+ optimizeSafeRealPathSync();
+ firstSafeRealPathSyncRun = true;
+ }
+ return fs$l.realpathSync(path);
+}
+function optimizeSafeRealPathSync() {
+ // Skip if using Node <16.18 due to MAX_PATH issue: https://github.com/vitejs/vite/issues/12931
+ const nodeVersion = process.versions.node.split('.').map(Number);
+ if (nodeVersion[0] < 16 || (nodeVersion[0] === 16 && nodeVersion[1] < 18)) {
+ safeRealpathSync = fs$l.realpathSync;
+ return;
+ }
+ // Check the availability `fs.realpathSync.native`
+ // in Windows virtual and RAM disks that bypass the Volume Mount Manager, in programs such as imDisk
+ // get the error EISDIR: illegal operation on a directory
+ try {
+ fs$l.realpathSync.native(path$o.resolve('./'));
+ }
+ catch (error) {
+ if (error.message.includes('EISDIR: illegal operation on a directory')) {
+ safeRealpathSync = fs$l.realpathSync;
+ return;
+ }
+ }
+ exec('net use', (error, stdout) => {
+ if (error)
+ return;
+ const lines = stdout.split('\n');
+ // OK Y: \\NETWORKA\Foo Microsoft Windows Network
+ // OK Z: \\NETWORKA\Bar Microsoft Windows Network
+ for (const line of lines) {
+ const m = line.match(parseNetUseRE);
+ if (m)
+ windowsNetworkMap.set(m[3], m[2]);
+ }
+ if (windowsNetworkMap.size === 0) {
+ safeRealpathSync = fs$l.realpathSync.native;
+ }
+ else {
+ safeRealpathSync = windowsMappedRealpathSync;
+ }
+ });
+}
+function ensureWatchedFile(watcher, file, root) {
+ if (file &&
+ // only need to watch if out of root
+ !file.startsWith(root + '/') &&
+ // some rollup plugins use null bytes for private resolved Ids
+ !file.includes('\0') &&
+ fs$l.existsSync(file)) {
+ // resolve file to normalized system path
+ watcher.add(path$o.resolve(file));
+ }
+}
+const escapedSpaceCharacters = /( |\\t|\\n|\\f|\\r)+/g;
+const imageSetUrlRE = /^(?:[\w\-]+\(.*?\)|'.*?'|".*?"|\S*)/;
+function reduceSrcset(ret) {
+ return ret.reduce((prev, { url, descriptor }, index) => {
+ descriptor ?? (descriptor = '');
+ return (prev +=
+ url + ` ${descriptor}${index === ret.length - 1 ? '' : ', '}`);
+ }, '');
+}
+function splitSrcSetDescriptor(srcs) {
+ return splitSrcSet(srcs)
+ .map((s) => {
+ const src = s.replace(escapedSpaceCharacters, ' ').trim();
+ const [url] = imageSetUrlRE.exec(src) || [''];
+ return {
+ url,
+ descriptor: src?.slice(url.length).trim(),
+ };
+ })
+ .filter(({ url }) => !!url);
+}
+function processSrcSet(srcs, replacer) {
+ return Promise.all(splitSrcSetDescriptor(srcs).map(async ({ url, descriptor }) => ({
+ url: await replacer({ url, descriptor }),
+ descriptor,
+ }))).then((ret) => reduceSrcset(ret));
+}
+function processSrcSetSync(srcs, replacer) {
+ return reduceSrcset(splitSrcSetDescriptor(srcs).map(({ url, descriptor }) => ({
+ url: replacer({ url, descriptor }),
+ descriptor,
+ })));
+}
+const cleanSrcSetRE = /(?:url|image|gradient|cross-fade)\([^)]*\)|"([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'/g;
+function splitSrcSet(srcs) {
+ const parts = [];
+ // There could be a ',' inside of url(data:...), linear-gradient(...) or "data:..."
+ const cleanedSrcs = srcs.replace(cleanSrcSetRE, blankReplacer);
+ let startIndex = 0;
+ let splitIndex;
+ do {
+ splitIndex = cleanedSrcs.indexOf(',', startIndex);
+ parts.push(srcs.slice(startIndex, splitIndex !== -1 ? splitIndex : undefined));
+ startIndex = splitIndex + 1;
+ } while (splitIndex !== -1);
+ return parts;
+}
+const windowsDriveRE = /^[A-Z]:/;
+const replaceWindowsDriveRE = /^([A-Z]):\//;
+const linuxAbsolutePathRE = /^\/[^/]/;
+function escapeToLinuxLikePath(path) {
+ if (windowsDriveRE.test(path)) {
+ return path.replace(replaceWindowsDriveRE, '/windows/$1/');
+ }
+ if (linuxAbsolutePathRE.test(path)) {
+ return `/linux${path}`;
+ }
+ return path;
+}
+const revertWindowsDriveRE = /^\/windows\/([A-Z])\//;
+function unescapeToLinuxLikePath(path) {
+ if (path.startsWith('/linux/')) {
+ return path.slice('/linux'.length);
+ }
+ if (path.startsWith('/windows/')) {
+ return path.replace(revertWindowsDriveRE, '$1:/');
+ }
+ return path;
+}
+// based on https://github.com/sveltejs/svelte/blob/abf11bb02b2afbd3e4cac509a0f70e318c306364/src/compiler/utils/mapped_code.ts#L221
+const nullSourceMap = {
+ names: [],
+ sources: [],
+ mappings: '',
+ version: 3,
+};
+function combineSourcemaps(filename, sourcemapList) {
+ if (sourcemapList.length === 0 ||
+ sourcemapList.every((m) => m.sources.length === 0)) {
+ return { ...nullSourceMap };
+ }
+ // hack for parse broken with normalized absolute paths on windows (C:/path/to/something).
+ // escape them to linux like paths
+ // also avoid mutation here to prevent breaking plugin's using cache to generate sourcemaps like vue (see #7442)
+ sourcemapList = sourcemapList.map((sourcemap) => {
+ const newSourcemaps = { ...sourcemap };
+ newSourcemaps.sources = sourcemap.sources.map((source) => source ? escapeToLinuxLikePath(source) : null);
+ if (sourcemap.sourceRoot) {
+ newSourcemaps.sourceRoot = escapeToLinuxLikePath(sourcemap.sourceRoot);
+ }
+ return newSourcemaps;
+ });
+ const escapedFilename = escapeToLinuxLikePath(filename);
+ // We don't declare type here so we can convert/fake/map as RawSourceMap
+ let map; //: SourceMap
+ let mapIndex = 1;
+ const useArrayInterface = sourcemapList.slice(0, -1).find((m) => m.sources.length !== 1) === undefined;
+ if (useArrayInterface) {
+ map = remapping(sourcemapList, () => null);
+ }
+ else {
+ map = remapping(sourcemapList[0], function loader(sourcefile) {
+ if (sourcefile === escapedFilename && sourcemapList[mapIndex]) {
+ return sourcemapList[mapIndex++];
+ }
+ else {
+ return null;
+ }
+ });
+ }
+ if (!map.file) {
+ delete map.file;
+ }
+ // unescape the previous hack
+ map.sources = map.sources.map((source) => source ? unescapeToLinuxLikePath(source) : source);
+ map.file = filename;
+ return map;
+}
+function unique(arr) {
+ return Array.from(new Set(arr));
+}
+/**
+ * Returns resolved localhost address when `dns.lookup` result differs from DNS
+ *
+ * `dns.lookup` result is same when defaultResultOrder is `verbatim`.
+ * Even if defaultResultOrder is `ipv4first`, `dns.lookup` result maybe same.
+ * For example, when IPv6 is not supported on that machine/network.
+ */
+async function getLocalhostAddressIfDiffersFromDNS() {
+ const [nodeResult, dnsResult] = await Promise.all([
+ promises.lookup('localhost'),
+ promises.lookup('localhost', { verbatim: true }),
+ ]);
+ const isSame = nodeResult.family === dnsResult.family &&
+ nodeResult.address === dnsResult.address;
+ return isSame ? undefined : nodeResult.address;
+}
+function diffDnsOrderChange(oldUrls, newUrls) {
+ return !(oldUrls === newUrls ||
+ (oldUrls &&
+ newUrls &&
+ arrayEqual(oldUrls.local, newUrls.local) &&
+ arrayEqual(oldUrls.network, newUrls.network)));
+}
+async function resolveHostname(optionsHost) {
+ let host;
+ if (optionsHost === undefined || optionsHost === false) {
+ // Use a secure default
+ host = 'localhost';
+ }
+ else if (optionsHost === true) {
+ // If passed --host in the CLI without arguments
+ host = undefined; // undefined typically means 0.0.0.0 or :: (listen on all IPs)
+ }
+ else {
+ host = optionsHost;
+ }
+ // Set host name to localhost when possible
+ let name = host === undefined || wildcardHosts.has(host) ? 'localhost' : host;
+ if (host === 'localhost') {
+ // See #8647 for more details.
+ const localhostAddr = await getLocalhostAddressIfDiffersFromDNS();
+ if (localhostAddr) {
+ name = localhostAddr;
+ }
+ }
+ return { host, name };
+}
+async function resolveServerUrls(server, options, config) {
+ const address = server.address();
+ const isAddressInfo = (x) => x?.address;
+ if (!isAddressInfo(address)) {
+ return { local: [], network: [] };
+ }
+ const local = [];
+ const network = [];
+ const hostname = await resolveHostname(options.host);
+ const protocol = options.https ? 'https' : 'http';
+ const port = address.port;
+ const base = config.rawBase === './' || config.rawBase === '' ? '/' : config.rawBase;
+ if (hostname.host !== undefined && !wildcardHosts.has(hostname.host)) {
+ let hostnameName = hostname.name;
+ // ipv6 host
+ if (hostnameName.includes(':')) {
+ hostnameName = `[${hostnameName}]`;
+ }
+ const address = `${protocol}://${hostnameName}:${port}${base}`;
+ if (loopbackHosts.has(hostname.host)) {
+ local.push(address);
+ }
+ else {
+ network.push(address);
+ }
+ }
+ else {
+ Object.values(os$4.networkInterfaces())
+ .flatMap((nInterface) => nInterface ?? [])
+ .filter((detail) => detail &&
+ detail.address &&
+ (detail.family === 'IPv4' ||
+ // @ts-expect-error Node 18.0 - 18.3 returns number
+ detail.family === 4))
+ .forEach((detail) => {
+ let host = detail.address.replace('127.0.0.1', hostname.name);
+ // ipv6 host
+ if (host.includes(':')) {
+ host = `[${host}]`;
+ }
+ const url = `${protocol}://${host}:${port}${base}`;
+ if (detail.address.includes('127.0.0.1')) {
+ local.push(url);
+ }
+ else {
+ network.push(url);
+ }
+ });
+ }
+ return { local, network };
+}
+function arraify(target) {
+ return Array.isArray(target) ? target : [target];
+}
+// Taken from https://stackoverflow.com/a/36328890
+const multilineCommentsRE$1 = /\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g;
+const singlelineCommentsRE$1 = /\/\/.*/g;
+const requestQuerySplitRE = /\?(?!.*[/|}])/;
+// @ts-expect-error jest only exists when running Jest
+const usingDynamicImport = typeof jest === 'undefined';
+/**
+ * Dynamically import files. It will make sure it's not being compiled away by TS/Rollup.
+ *
+ * As a temporary workaround for Jest's lack of stable ESM support, we fallback to require
+ * if we're in a Jest environment.
+ * See https://github.com/vitejs/vite/pull/5197#issuecomment-938054077
+ *
+ * @param file File path to import.
+ */
+const dynamicImport = usingDynamicImport
+ ? new Function('file', 'return import(file)')
+ : _require$3;
+function parseRequest(id) {
+ const [_, search] = id.split(requestQuerySplitRE, 2);
+ if (!search) {
+ return null;
+ }
+ return Object.fromEntries(new URLSearchParams(search));
+}
+const blankReplacer = (match) => ' '.repeat(match.length);
+function getHash(text) {
+ return createHash$2('sha256').update(text).digest('hex').substring(0, 8);
+}
+const _dirname = path$o.dirname(fileURLToPath(import.meta.url));
+const requireResolveFromRootWithFallback = (root, id) => {
+ // check existence first, so if the package is not found,
+ // it won't be cached by nodejs, since there isn't a way to invalidate them:
+ // https://github.com/nodejs/node/issues/44663
+ const found = resolvePackageData(id, root) || resolvePackageData(id, _dirname);
+ if (!found) {
+ const error = new Error(`${JSON.stringify(id)} not found.`);
+ error.code = 'MODULE_NOT_FOUND';
+ throw error;
+ }
+ // actually resolve
+ // Search in the root directory first, and fallback to the default require paths.
+ return _require$3.resolve(id, { paths: [root, _dirname] });
+};
+function emptyCssComments(raw) {
+ return raw.replace(multilineCommentsRE$1, (s) => ' '.repeat(s.length));
+}
+function removeComments(raw) {
+ return raw.replace(multilineCommentsRE$1, '').replace(singlelineCommentsRE$1, '');
+}
+function mergeConfigRecursively(defaults, overrides, rootPath) {
+ const merged = { ...defaults };
+ for (const key in overrides) {
+ const value = overrides[key];
+ if (value == null) {
+ continue;
+ }
+ const existing = merged[key];
+ if (existing == null) {
+ merged[key] = value;
+ continue;
+ }
+ // fields that require special handling
+ if (key === 'alias' && (rootPath === 'resolve' || rootPath === '')) {
+ merged[key] = mergeAlias(existing, value);
+ continue;
+ }
+ else if (key === 'assetsInclude' && rootPath === '') {
+ merged[key] = [].concat(existing, value);
+ continue;
+ }
+ else if (key === 'noExternal' &&
+ rootPath === 'ssr' &&
+ (existing === true || value === true)) {
+ merged[key] = true;
+ continue;
+ }
+ if (Array.isArray(existing) || Array.isArray(value)) {
+ merged[key] = [...arraify(existing ?? []), ...arraify(value ?? [])];
+ continue;
+ }
+ if (isObject$2(existing) && isObject$2(value)) {
+ merged[key] = mergeConfigRecursively(existing, value, rootPath ? `${rootPath}.${key}` : key);
+ continue;
+ }
+ merged[key] = value;
+ }
+ return merged;
+}
+function mergeConfig(defaults, overrides, isRoot = true) {
+ if (typeof defaults === 'function' || typeof overrides === 'function') {
+ throw new Error(`Cannot merge config in form of callback`);
+ }
+ return mergeConfigRecursively(defaults, overrides, isRoot ? '' : '.');
+}
+function mergeAlias(a, b) {
+ if (!a)
+ return b;
+ if (!b)
+ return a;
+ if (isObject$2(a) && isObject$2(b)) {
+ return { ...a, ...b };
+ }
+ // the order is flipped because the alias is resolved from top-down,
+ // where the later should have higher priority
+ return [...normalizeAlias(b), ...normalizeAlias(a)];
+}
+function normalizeAlias(o = []) {
+ return Array.isArray(o)
+ ? o.map(normalizeSingleAlias)
+ : Object.keys(o).map((find) => normalizeSingleAlias({
+ find,
+ replacement: o[find],
+ }));
+}
+// https://github.com/vitejs/vite/issues/1363
+// work around https://github.com/rollup/plugins/issues/759
+function normalizeSingleAlias({ find, replacement, customResolver, }) {
+ if (typeof find === 'string' &&
+ find[find.length - 1] === '/' &&
+ replacement[replacement.length - 1] === '/') {
+ find = find.slice(0, find.length - 1);
+ replacement = replacement.slice(0, replacement.length - 1);
+ }
+ const alias = {
+ find,
+ replacement,
+ };
+ if (customResolver) {
+ alias.customResolver = customResolver;
+ }
+ return alias;
+}
+/**
+ * Transforms transpiled code result where line numbers aren't altered,
+ * so we can skip sourcemap generation during dev
+ */
+function transformStableResult(s, id, config) {
+ return {
+ code: s.toString(),
+ map: config.command === 'build' && config.build.sourcemap
+ ? s.generateMap({ hires: 'boundary', source: id })
+ : null,
+ };
+}
+async function asyncFlatten(arr) {
+ do {
+ arr = (await Promise.all(arr)).flat(Infinity);
+ } while (arr.some((v) => v?.then));
+ return arr;
+}
+// strip UTF-8 BOM
+function stripBomTag(content) {
+ if (content.charCodeAt(0) === 0xfeff) {
+ return content.slice(1);
+ }
+ return content;
+}
+const windowsDrivePathPrefixRE = /^[A-Za-z]:[/\\]/;
+/**
+ * path.isAbsolute also returns true for drive relative paths on windows (e.g. /something)
+ * this function returns false for them but true for absolute paths (e.g. C:/something)
+ */
+const isNonDriveRelativeAbsolutePath = (p) => {
+ if (!isWindows$4)
+ return p[0] === '/';
+ return windowsDrivePathPrefixRE.test(p);
+};
+/**
+ * Determine if a file is being requested with the correct case, to ensure
+ * consistent behaviour between dev and prod and across operating systems.
+ */
+function shouldServeFile(filePath, root) {
+ // can skip case check on Linux
+ if (!isCaseInsensitiveFS)
+ return true;
+ return hasCorrectCase(filePath, root);
+}
+/**
+ * Note that we can't use realpath here, because we don't want to follow
+ * symlinks.
+ */
+function hasCorrectCase(file, assets) {
+ if (file === assets)
+ return true;
+ const parent = path$o.dirname(file);
+ if (fs$l.readdirSync(parent).includes(path$o.basename(file))) {
+ return hasCorrectCase(parent, assets);
+ }
+ return false;
+}
+function joinUrlSegments(a, b) {
+ if (!a || !b) {
+ return a || b || '';
+ }
+ if (a[a.length - 1] === '/') {
+ a = a.substring(0, a.length - 1);
+ }
+ if (b[0] !== '/') {
+ b = '/' + b;
+ }
+ return a + b;
+}
+function removeLeadingSlash(str) {
+ return str[0] === '/' ? str.slice(1) : str;
+}
+function stripBase(path, base) {
+ if (path === base) {
+ return '/';
+ }
+ const devBase = base[base.length - 1] === '/' ? base : base + '/';
+ return path.startsWith(devBase) ? path.slice(devBase.length - 1) : path;
+}
+function arrayEqual(a, b) {
+ if (a === b)
+ return true;
+ if (a.length !== b.length)
+ return false;
+ for (let i = 0; i < a.length; i++) {
+ if (a[i] !== b[i])
+ return false;
+ }
+ return true;
+}
+function evalValue(rawValue) {
+ const fn = new Function(`
+ var console, exports, global, module, process, require
+ return (\n${rawValue}\n)
+ `);
+ return fn();
+}
+function getNpmPackageName(importPath) {
+ const parts = importPath.split('/');
+ if (parts[0][0] === '@') {
+ if (!parts[1])
+ return null;
+ return `${parts[0]}/${parts[1]}`;
+ }
+ else {
+ return parts[0];
+ }
+}
+const escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g;
+function escapeRegex(str) {
+ return str.replace(escapeRegexRE, '\\$&');
+}
+function getPackageManagerCommand(type = 'install') {
+ const packageManager = process.env.npm_config_user_agent?.split(' ')[0].split('/')[0] || 'npm';
+ switch (type) {
+ case 'install':
+ return packageManager === 'npm' ? 'npm install' : `${packageManager} add`;
+ case 'uninstall':
+ return packageManager === 'npm'
+ ? 'npm uninstall'
+ : `${packageManager} remove`;
+ case 'update':
+ return packageManager === 'yarn'
+ ? 'yarn upgrade'
+ : `${packageManager} update`;
+ default:
+ throw new TypeError(`Unknown command type: ${type}`);
+ }
+}
+
+/* eslint no-console: 0 */
+const LogLevels = {
+ silent: 0,
+ error: 1,
+ warn: 2,
+ info: 3,
+};
+let lastType;
+let lastMsg;
+let sameCount = 0;
+function clearScreen() {
+ const repeatCount = process.stdout.rows - 2;
+ const blank = repeatCount > 0 ? '\n'.repeat(repeatCount) : '';
+ console.log(blank);
+ readline.cursorTo(process.stdout, 0, 0);
+ readline.clearScreenDown(process.stdout);
+}
+function createLogger(level = 'info', options = {}) {
+ if (options.customLogger) {
+ return options.customLogger;
+ }
+ const timeFormatter = new Intl.DateTimeFormat(undefined, {
+ hour: 'numeric',
+ minute: 'numeric',
+ second: 'numeric',
+ });
+ const loggedErrors = new WeakSet();
+ const { prefix = '[vite]', allowClearScreen = true } = options;
+ const thresh = LogLevels[level];
+ const canClearScreen = allowClearScreen && process.stdout.isTTY && !process.env.CI;
+ const clear = canClearScreen ? clearScreen : () => { };
+ function output(type, msg, options = {}) {
+ if (thresh >= LogLevels[type]) {
+ const method = type === 'info' ? 'log' : type;
+ const format = () => {
+ if (options.timestamp) {
+ const tag = type === 'info'
+ ? colors$1.cyan(colors$1.bold(prefix))
+ : type === 'warn'
+ ? colors$1.yellow(colors$1.bold(prefix))
+ : colors$1.red(colors$1.bold(prefix));
+ return `${colors$1.dim(timeFormatter.format(new Date()))} ${tag} ${msg}`;
+ }
+ else {
+ return msg;
+ }
+ };
+ if (options.error) {
+ loggedErrors.add(options.error);
+ }
+ if (canClearScreen) {
+ if (type === lastType && msg === lastMsg) {
+ sameCount++;
+ clear();
+ console[method](format(), colors$1.yellow(`(x${sameCount + 1})`));
+ }
+ else {
+ sameCount = 0;
+ lastMsg = msg;
+ lastType = type;
+ if (options.clear) {
+ clear();
+ }
+ console[method](format());
+ }
+ }
+ else {
+ console[method](format());
+ }
+ }
+ }
+ const warnedMessages = new Set();
+ const logger = {
+ hasWarned: false,
+ info(msg, opts) {
+ output('info', msg, opts);
+ },
+ warn(msg, opts) {
+ logger.hasWarned = true;
+ output('warn', msg, opts);
+ },
+ warnOnce(msg, opts) {
+ if (warnedMessages.has(msg))
+ return;
+ logger.hasWarned = true;
+ output('warn', msg, opts);
+ warnedMessages.add(msg);
+ },
+ error(msg, opts) {
+ logger.hasWarned = true;
+ output('error', msg, opts);
+ },
+ clearScreen(type) {
+ if (thresh >= LogLevels[type]) {
+ clear();
+ }
+ },
+ hasErrorLogged(error) {
+ return loggedErrors.has(error);
+ },
+ };
+ return logger;
+}
+function printServerUrls(urls, optionsHost, info) {
+ const colorUrl = (url) => colors$1.cyan(url.replace(/:(\d+)\//, (_, port) => `:${colors$1.bold(port)}/`));
+ for (const url of urls.local) {
+ info(` ${colors$1.green('➜')} ${colors$1.bold('Local')}: ${colorUrl(url)}`);
+ }
+ for (const url of urls.network) {
+ info(` ${colors$1.green('➜')} ${colors$1.bold('Network')}: ${colorUrl(url)}`);
+ }
+ if (urls.network.length === 0 && optionsHost === undefined) {
+ info(colors$1.dim(` ${colors$1.green('➜')} ${colors$1.bold('Network')}: use `) +
+ colors$1.bold('--host') +
+ colors$1.dim(' to expose'));
+ }
+}
+
+const groups = [
+ { name: 'Assets', color: colors$1.green },
+ { name: 'CSS', color: colors$1.magenta },
+ { name: 'JS', color: colors$1.cyan },
+];
+const COMPRESSIBLE_ASSETS_RE = /\.(?:html|json|svg|txt|xml|xhtml)$/;
+function buildReporterPlugin(config) {
+ const compress = promisify$4(gzip);
+ const chunkLimit = config.build.chunkSizeWarningLimit;
+ const numberFormatter = new Intl.NumberFormat('en', {
+ maximumFractionDigits: 2,
+ minimumFractionDigits: 2,
+ });
+ const displaySize = (bytes) => {
+ return `${numberFormatter.format(bytes / 1000)} kB`;
+ };
+ const tty = process.stdout.isTTY && !process.env.CI;
+ const shouldLogInfo = LogLevels[config.logLevel || 'info'] >= LogLevels.info;
+ let hasTransformed = false;
+ let hasRenderedChunk = false;
+ let hasCompressChunk = false;
+ let transformedCount = 0;
+ let chunkCount = 0;
+ let compressedCount = 0;
+ let startTime = Date.now();
+ async function getCompressedSize(code) {
+ if (config.build.ssr || !config.build.reportCompressedSize) {
+ return null;
+ }
+ if (shouldLogInfo && !hasCompressChunk) {
+ if (!tty) {
+ config.logger.info('computing gzip size...');
+ }
+ else {
+ writeLine('computing gzip size (0)...');
+ }
+ hasCompressChunk = true;
+ }
+ const compressed = await compress(typeof code === 'string' ? code : Buffer.from(code));
+ compressedCount++;
+ if (shouldLogInfo && tty) {
+ writeLine(`computing gzip size (${compressedCount})...`);
+ }
+ return compressed.length;
+ }
+ const logTransform = throttle((id) => {
+ writeLine(`transforming (${transformedCount}) ${colors$1.dim(path$o.relative(config.root, id))}`);
+ });
+ return {
+ name: 'vite:reporter',
+ transform(_, id) {
+ transformedCount++;
+ if (shouldLogInfo) {
+ if (!tty) {
+ if (!hasTransformed) {
+ config.logger.info(`transforming...`);
+ }
+ }
+ else {
+ if (id.includes(`?`))
+ return;
+ logTransform(id);
+ }
+ hasTransformed = true;
+ }
+ return null;
+ },
+ options() {
+ startTime = Date.now();
+ },
+ buildStart() {
+ transformedCount = 0;
+ },
+ buildEnd() {
+ if (shouldLogInfo) {
+ if (tty) {
+ clearLine();
+ }
+ config.logger.info(`${colors$1.green(`✓`)} ${transformedCount} modules transformed.`);
+ }
+ },
+ renderStart() {
+ chunkCount = 0;
+ compressedCount = 0;
+ },
+ renderChunk(code, chunk, options) {
+ if (!options.inlineDynamicImports) {
+ for (const id of chunk.moduleIds) {
+ const module = this.getModuleInfo(id);
+ if (!module)
+ continue;
+ // When a dynamic importer shares a chunk with the imported module,
+ // warn that the dynamic imported module will not be moved to another chunk (#12850).
+ if (module.importers.length && module.dynamicImporters.length) {
+ // Filter out the intersection of dynamic importers and sibling modules in
+ // the same chunk. The intersecting dynamic importers' dynamic import is not
+ // expected to work. Note we're only detecting the direct ineffective
+ // dynamic import here.
+ const detectedIneffectiveDynamicImport = module.dynamicImporters.some((id) => !isInNodeModules(id) && chunk.moduleIds.includes(id));
+ if (detectedIneffectiveDynamicImport) {
+ this.warn(`\n(!) ${module.id} is dynamically imported by ${module.dynamicImporters.join(', ')} but also statically imported by ${module.importers.join(', ')}, dynamic import will not move module into another chunk.\n`);
+ }
+ }
+ }
+ }
+ chunkCount++;
+ if (shouldLogInfo) {
+ if (!tty) {
+ if (!hasRenderedChunk) {
+ config.logger.info('rendering chunks...');
+ }
+ }
+ else {
+ writeLine(`rendering chunks (${chunkCount})...`);
+ }
+ hasRenderedChunk = true;
+ }
+ return null;
+ },
+ generateBundle() {
+ if (shouldLogInfo && tty)
+ clearLine();
+ },
+ async writeBundle({ dir: outDir }, output) {
+ let hasLargeChunks = false;
+ if (shouldLogInfo) {
+ const entries = (await Promise.all(Object.values(output).map(async (chunk) => {
+ if (chunk.type === 'chunk') {
+ return {
+ name: chunk.fileName,
+ group: 'JS',
+ size: chunk.code.length,
+ compressedSize: await getCompressedSize(chunk.code),
+ mapSize: chunk.map ? chunk.map.toString().length : null,
+ };
+ }
+ else {
+ if (chunk.fileName.endsWith('.map'))
+ return null;
+ const isCSS = chunk.fileName.endsWith('.css');
+ const isCompressible = isCSS || COMPRESSIBLE_ASSETS_RE.test(chunk.fileName);
+ return {
+ name: chunk.fileName,
+ group: isCSS ? 'CSS' : 'Assets',
+ size: chunk.source.length,
+ mapSize: null,
+ compressedSize: isCompressible
+ ? await getCompressedSize(chunk.source)
+ : null,
+ };
+ }
+ }))).filter(isDefined);
+ if (tty)
+ clearLine();
+ let longest = 0;
+ let biggestSize = 0;
+ let biggestMap = 0;
+ let biggestCompressSize = 0;
+ for (const entry of entries) {
+ if (entry.name.length > longest)
+ longest = entry.name.length;
+ if (entry.size > biggestSize)
+ biggestSize = entry.size;
+ if (entry.mapSize && entry.mapSize > biggestMap) {
+ biggestMap = entry.mapSize;
+ }
+ if (entry.compressedSize &&
+ entry.compressedSize > biggestCompressSize) {
+ biggestCompressSize = entry.compressedSize;
+ }
+ }
+ const sizePad = displaySize(biggestSize).length;
+ const mapPad = displaySize(biggestMap).length;
+ const compressPad = displaySize(biggestCompressSize).length;
+ const relativeOutDir = normalizePath$3(path$o.relative(config.root, path$o.resolve(config.root, outDir ?? config.build.outDir)));
+ const assetsDir = path$o.join(config.build.assetsDir, '/');
+ for (const group of groups) {
+ const filtered = entries.filter((e) => e.group === group.name);
+ if (!filtered.length)
+ continue;
+ for (const entry of filtered.sort((a, z) => a.size - z.size)) {
+ const isLarge = group.name === 'JS' && entry.size / 1000 > chunkLimit;
+ if (isLarge)
+ hasLargeChunks = true;
+ const sizeColor = isLarge ? colors$1.yellow : colors$1.dim;
+ let log = colors$1.dim(relativeOutDir + '/');
+ log +=
+ !config.build.lib && entry.name.startsWith(assetsDir)
+ ? colors$1.dim(assetsDir) +
+ group.color(entry.name
+ .slice(assetsDir.length)
+ .padEnd(longest + 2 - assetsDir.length))
+ : group.color(entry.name.padEnd(longest + 2));
+ log += colors$1.bold(sizeColor(displaySize(entry.size).padStart(sizePad)));
+ if (entry.compressedSize) {
+ log += colors$1.dim(` │ gzip: ${displaySize(entry.compressedSize).padStart(compressPad)}`);
+ }
+ if (entry.mapSize) {
+ log += colors$1.dim(` │ map: ${displaySize(entry.mapSize).padStart(mapPad)}`);
+ }
+ config.logger.info(log);
+ }
+ }
+ }
+ else {
+ hasLargeChunks = Object.values(output).some((chunk) => {
+ return chunk.type === 'chunk' && chunk.code.length / 1000 > chunkLimit;
+ });
+ }
+ if (hasLargeChunks &&
+ config.build.minify &&
+ !config.build.lib &&
+ !config.build.ssr) {
+ config.logger.warn(colors$1.yellow(`\n(!) Some chunks are larger than ${chunkLimit} kBs after minification. Consider:\n` +
+ `- Using dynamic import() to code-split the application\n` +
+ `- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks\n` +
+ `- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.`));
+ }
+ },
+ closeBundle() {
+ if (shouldLogInfo && !config.build.watch) {
+ config.logger.info(`${colors$1.green(`✓ built in ${displayTime(Date.now() - startTime)}`)}`);
+ }
+ },
+ };
+}
+function writeLine(output) {
+ clearLine();
+ if (output.length < process.stdout.columns) {
+ process.stdout.write(output);
+ }
+ else {
+ process.stdout.write(output.substring(0, process.stdout.columns - 1));
+ }
+}
+function clearLine() {
+ process.stdout.clearLine(0);
+ process.stdout.cursorTo(0);
+}
+function throttle(fn) {
+ let timerHandle = null;
+ return (...args) => {
+ if (timerHandle)
+ return;
+ fn(...args);
+ timerHandle = setTimeout(() => {
+ timerHandle = null;
+ }, 100);
+ };
+}
+function displayTime(time) {
+ // display: {X}ms
+ if (time < 1000) {
+ return `${time}ms`;
+ }
+ time = time / 1000;
+ // display: {X}s
+ if (time < 60) {
+ return `${time.toFixed(2)}s`;
+ }
+ const mins = parseInt((time / 60).toString());
+ const seconds = time % 60;
+ // display: {X}m {Y}s
+ return `${mins}m${seconds < 1 ? '' : ` ${seconds.toFixed(0)}s`}`;
+}
+
+// src/find.ts
+async function find(filename, options) {
+ let dir = require$$0$4.dirname(require$$0$4.resolve(filename));
+ const root = (options == null ? void 0 : options.root) ? require$$0$4.resolve(options.root) : null;
+ while (dir) {
+ const tsconfig = await tsconfigInDir(dir, options);
+ if (tsconfig) {
+ return tsconfig;
+ } else {
+ if (root === dir) {
+ break;
+ }
+ const parent = require$$0$4.dirname(dir);
+ if (parent === dir) {
+ break;
+ } else {
+ dir = parent;
+ }
+ }
+ }
+ throw new Error(`no tsconfig file found for ${filename}`);
+}
+async function tsconfigInDir(dir, options) {
+ const tsconfig = require$$0$4.join(dir, "tsconfig.json");
+ if (options == null ? void 0 : options.tsConfigPaths) {
+ return options.tsConfigPaths.has(tsconfig) ? tsconfig : void 0;
+ }
+ try {
+ const stat = await promises$1.stat(tsconfig);
+ if (stat.isFile() || stat.isFIFO()) {
+ return tsconfig;
+ }
+ } catch (e) {
+ if (e.code !== "ENOENT") {
+ throw e;
+ }
+ }
+}
+var sep = require$$0$4.sep;
+async function findAll(dir, options) {
+ const state = {
+ files: [],
+ calls: 0,
+ skip: options == null ? void 0 : options.skip,
+ err: false
+ };
+ return new Promise((resolve, reject) => {
+ walk$3(require$$0$4.resolve(dir), state, (err, files) => err ? reject(err) : resolve(files));
+ });
+}
+function walk$3(dir, state, done) {
+ if (state.err) {
+ return;
+ }
+ state.calls++;
+ readdir$4(dir, { withFileTypes: true }, (err, entries = []) => {
+ var _a;
+ if (state.err) {
+ return;
+ }
+ if (err && !(err.code === "ENOENT" || err.code === "EACCES" || err.code === "EPERM")) {
+ state.err = true;
+ done(err);
+ } else {
+ for (const ent of entries) {
+ if (ent.isDirectory() && !((_a = state.skip) == null ? void 0 : _a.call(state, ent.name))) {
+ walk$3(`${dir}${sep}${ent.name}`, state, done);
+ } else if (ent.isFile() && ent.name === "tsconfig.json") {
+ state.files.push(`${dir}${sep}tsconfig.json`);
+ }
+ }
+ if (--state.calls === 0) {
+ if (!state.err) {
+ done(null, state.files);
+ }
+ }
+ }
+ });
+}
+
+// src/to-json.ts
+function toJson(tsconfigJson) {
+ const stripped = stripDanglingComma(stripJsonComments(stripBom(tsconfigJson)));
+ if (stripped.trim() === "") {
+ return "{}";
+ } else {
+ return stripped;
+ }
+}
+function stripDanglingComma(pseudoJson) {
+ let insideString = false;
+ let offset = 0;
+ let result = "";
+ let danglingCommaPos = null;
+ for (let i = 0; i < pseudoJson.length; i++) {
+ const currentCharacter = pseudoJson[i];
+ if (currentCharacter === '"') {
+ const escaped = isEscaped(pseudoJson, i);
+ if (!escaped) {
+ insideString = !insideString;
+ }
+ }
+ if (insideString) {
+ danglingCommaPos = null;
+ continue;
+ }
+ if (currentCharacter === ",") {
+ danglingCommaPos = i;
+ continue;
+ }
+ if (danglingCommaPos) {
+ if (currentCharacter === "}" || currentCharacter === "]") {
+ result += pseudoJson.slice(offset, danglingCommaPos) + " ";
+ offset = danglingCommaPos + 1;
+ danglingCommaPos = null;
+ } else if (!currentCharacter.match(/\s/)) {
+ danglingCommaPos = null;
+ }
+ }
+ }
+ return result + pseudoJson.substring(offset);
+}
+function isEscaped(jsonString, quotePosition) {
+ let index = quotePosition - 1;
+ let backslashCount = 0;
+ while (jsonString[index] === "\\") {
+ index -= 1;
+ backslashCount += 1;
+ }
+ return Boolean(backslashCount % 2);
+}
+function strip(string, start, end) {
+ return string.slice(start, end).replace(/\S/g, " ");
+}
+var singleComment = Symbol("singleComment");
+var multiComment = Symbol("multiComment");
+function stripJsonComments(jsonString) {
+ let isInsideString = false;
+ let isInsideComment = false;
+ let offset = 0;
+ let result = "";
+ for (let index = 0; index < jsonString.length; index++) {
+ const currentCharacter = jsonString[index];
+ const nextCharacter = jsonString[index + 1];
+ if (!isInsideComment && currentCharacter === '"') {
+ const escaped = isEscaped(jsonString, index);
+ if (!escaped) {
+ isInsideString = !isInsideString;
+ }
+ }
+ if (isInsideString) {
+ continue;
+ }
+ if (!isInsideComment && currentCharacter + nextCharacter === "//") {
+ result += jsonString.slice(offset, index);
+ offset = index;
+ isInsideComment = singleComment;
+ index++;
+ } else if (isInsideComment === singleComment && currentCharacter + nextCharacter === "\r\n") {
+ index++;
+ isInsideComment = false;
+ result += strip(jsonString, offset, index);
+ offset = index;
+ } else if (isInsideComment === singleComment && currentCharacter === "\n") {
+ isInsideComment = false;
+ result += strip(jsonString, offset, index);
+ offset = index;
+ } else if (!isInsideComment && currentCharacter + nextCharacter === "/*") {
+ result += jsonString.slice(offset, index);
+ offset = index;
+ isInsideComment = multiComment;
+ index++;
+ } else if (isInsideComment === multiComment && currentCharacter + nextCharacter === "*/") {
+ index++;
+ isInsideComment = false;
+ result += strip(jsonString, offset, index + 1);
+ offset = index + 1;
+ }
+ }
+ return result + (isInsideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset));
+}
+function stripBom(string) {
+ if (string.charCodeAt(0) === 65279) {
+ return string.slice(1);
+ }
+ return string;
+}
+var POSIX_SEP_RE = new RegExp("\\" + require$$0$4.posix.sep, "g");
+var NATIVE_SEP_RE = new RegExp("\\" + require$$0$4.sep, "g");
+var PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
+var GLOB_ALL_PATTERN = `**/*`;
+var DEFAULT_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
+var DEFAULT_EXTENSIONS_RE_GROUP = `\\.(?:${DEFAULT_EXTENSIONS.map((ext) => ext.substring(1)).join(
+ "|"
+)})`;
+new Function("path", "return import(path).then(m => m.default)");
+async function resolveTSConfig(filename) {
+ if (require$$0$4.extname(filename) !== ".json") {
+ return;
+ }
+ const tsconfig = require$$0$4.resolve(filename);
+ try {
+ const stat = await promises$1.stat(tsconfig);
+ if (stat.isFile() || stat.isFIFO()) {
+ return tsconfig;
+ }
+ } catch (e) {
+ if (e.code !== "ENOENT") {
+ throw e;
+ }
+ }
+ throw new Error(`no tsconfig file found for ${filename}`);
+}
+function posix2native(filename) {
+ return require$$0$4.posix.sep !== require$$0$4.sep && filename.includes(require$$0$4.posix.sep) ? filename.replace(POSIX_SEP_RE, require$$0$4.sep) : filename;
+}
+function native2posix(filename) {
+ return require$$0$4.posix.sep !== require$$0$4.sep && filename.includes(require$$0$4.sep) ? filename.replace(NATIVE_SEP_RE, require$$0$4.posix.sep) : filename;
+}
+function resolve2posix(dir, filename) {
+ if (require$$0$4.sep === require$$0$4.posix.sep) {
+ return dir ? require$$0$4.resolve(dir, filename) : require$$0$4.resolve(filename);
+ }
+ return native2posix(
+ dir ? require$$0$4.resolve(posix2native(dir), posix2native(filename)) : require$$0$4.resolve(posix2native(filename))
+ );
+}
+function resolveReferencedTSConfigFiles(result) {
+ const dir = require$$0$4.dirname(result.tsconfigFile);
+ return result.tsconfig.references.map((ref) => {
+ const refPath = ref.path.endsWith(".json") ? ref.path : require$$0$4.join(ref.path, "tsconfig.json");
+ return resolve2posix(dir, refPath);
+ });
+}
+function resolveSolutionTSConfig(filename, result) {
+ if (result.referenced && DEFAULT_EXTENSIONS.some((ext) => filename.endsWith(ext)) && !isIncluded(filename, result)) {
+ const solutionTSConfig = result.referenced.find(
+ (referenced) => isIncluded(filename, referenced)
+ );
+ if (solutionTSConfig) {
+ return {
+ ...solutionTSConfig,
+ solution: result
+ };
+ }
+ }
+ return result;
+}
+function isIncluded(filename, result) {
+ const dir = native2posix(require$$0$4.dirname(result.tsconfigFile));
+ const files = (result.tsconfig.files || []).map((file) => resolve2posix(dir, file));
+ const absoluteFilename = resolve2posix(null, filename);
+ if (files.includes(filename)) {
+ return true;
+ }
+ const isIncluded2 = isGlobMatch(
+ absoluteFilename,
+ dir,
+ result.tsconfig.include || (result.tsconfig.files ? [] : [GLOB_ALL_PATTERN])
+ );
+ if (isIncluded2) {
+ const isExcluded = isGlobMatch(absoluteFilename, dir, result.tsconfig.exclude || []);
+ return !isExcluded;
+ }
+ return false;
+}
+function isGlobMatch(filename, dir, patterns) {
+ return patterns.some((pattern) => {
+ let lastWildcardIndex = pattern.length;
+ let hasWildcard = false;
+ for (let i = pattern.length - 1; i > -1; i--) {
+ if (pattern[i] === "*" || pattern[i] === "?") {
+ lastWildcardIndex = i;
+ hasWildcard = true;
+ break;
+ }
+ }
+ if (lastWildcardIndex < pattern.length - 1 && !filename.endsWith(pattern.slice(lastWildcardIndex + 1))) {
+ return false;
+ }
+ if (pattern.endsWith("*") && !DEFAULT_EXTENSIONS.some((ext) => filename.endsWith(ext))) {
+ return false;
+ }
+ if (pattern === GLOB_ALL_PATTERN) {
+ return filename.startsWith(`${dir}/`);
+ }
+ const resolvedPattern = resolve2posix(dir, pattern);
+ let firstWildcardIndex = -1;
+ for (let i = 0; i < resolvedPattern.length; i++) {
+ if (resolvedPattern[i] === "*" || resolvedPattern[i] === "?") {
+ firstWildcardIndex = i;
+ hasWildcard = true;
+ break;
+ }
+ }
+ if (firstWildcardIndex > 1 && !filename.startsWith(resolvedPattern.slice(0, firstWildcardIndex - 1))) {
+ return false;
+ }
+ if (!hasWildcard) {
+ return filename === resolvedPattern;
+ }
+ if (PATTERN_REGEX_CACHE.has(resolvedPattern)) {
+ return PATTERN_REGEX_CACHE.get(resolvedPattern).test(filename);
+ }
+ const regex = pattern2regex(resolvedPattern);
+ PATTERN_REGEX_CACHE.set(resolvedPattern, regex);
+ return regex.test(filename);
+ });
+}
+function pattern2regex(resolvedPattern) {
+ let regexStr = "^";
+ for (let i = 0; i < resolvedPattern.length; i++) {
+ const char = resolvedPattern[i];
+ if (char === "?") {
+ regexStr += "[^\\/]";
+ continue;
+ }
+ if (char === "*") {
+ if (resolvedPattern[i + 1] === "*" && resolvedPattern[i + 2] === "/") {
+ i += 2;
+ regexStr += "(?:[^\\/]*\\/)*";
+ continue;
+ }
+ regexStr += "[^\\/]*";
+ continue;
+ }
+ if ("/.+^${}()|[]\\".includes(char)) {
+ regexStr += `\\`;
+ }
+ regexStr += char;
+ }
+ if (resolvedPattern.endsWith("*")) {
+ regexStr += DEFAULT_EXTENSIONS_RE_GROUP;
+ }
+ regexStr += "$";
+ return new RegExp(regexStr);
+}
+
+// src/parse.ts
+async function parse$f(filename, options) {
+ const cache = options == null ? void 0 : options.cache;
+ if (cache == null ? void 0 : cache.has(filename)) {
+ return cache.get(filename);
+ }
+ let tsconfigFile;
+ if (options == null ? void 0 : options.resolveWithEmptyIfConfigNotFound) {
+ try {
+ tsconfigFile = await resolveTSConfig(filename) || await find(filename, options);
+ } catch (e) {
+ const notFoundResult = {
+ tsconfigFile: "no_tsconfig_file_found",
+ tsconfig: {}
+ };
+ cache == null ? void 0 : cache.set(filename, notFoundResult);
+ return notFoundResult;
+ }
+ } else {
+ tsconfigFile = await resolveTSConfig(filename) || await find(filename, options);
+ }
+ let result;
+ if (cache == null ? void 0 : cache.has(tsconfigFile)) {
+ result = cache.get(tsconfigFile);
+ } else {
+ result = await parseFile$1(tsconfigFile, cache);
+ await Promise.all([parseExtends(result, cache), parseReferences(result, cache)]);
+ cache == null ? void 0 : cache.set(tsconfigFile, result);
+ }
+ result = resolveSolutionTSConfig(filename, result);
+ cache == null ? void 0 : cache.set(filename, result);
+ return result;
+}
+async function parseFile$1(tsconfigFile, cache) {
+ if (cache == null ? void 0 : cache.has(tsconfigFile)) {
+ return cache.get(tsconfigFile);
+ }
+ try {
+ const tsconfigJson = await promises$1.readFile(tsconfigFile, "utf-8");
+ const json = toJson(tsconfigJson);
+ const result = {
+ tsconfigFile,
+ tsconfig: normalizeTSConfig(JSON.parse(json), require$$0$4.dirname(tsconfigFile))
+ };
+ cache == null ? void 0 : cache.set(tsconfigFile, result);
+ return result;
+ } catch (e) {
+ throw new TSConfckParseError(
+ `parsing ${tsconfigFile} failed: ${e}`,
+ "PARSE_FILE",
+ tsconfigFile,
+ e
+ );
+ }
+}
+function normalizeTSConfig(tsconfig, dir) {
+ var _a;
+ if (((_a = tsconfig.compilerOptions) == null ? void 0 : _a.baseUrl) && !require$$0$4.isAbsolute(tsconfig.compilerOptions.baseUrl)) {
+ tsconfig.compilerOptions.baseUrl = resolve2posix(dir, tsconfig.compilerOptions.baseUrl);
+ }
+ return tsconfig;
+}
+async function parseReferences(result, cache) {
+ if (!result.tsconfig.references) {
+ return;
+ }
+ const referencedFiles = resolveReferencedTSConfigFiles(result);
+ const referenced = await Promise.all(referencedFiles.map((file) => parseFile$1(file, cache)));
+ await Promise.all(referenced.map((ref) => parseExtends(ref, cache)));
+ result.referenced = referenced;
+}
+async function parseExtends(result, cache) {
+ if (!result.tsconfig.extends) {
+ return;
+ }
+ const extended = [
+ { tsconfigFile: result.tsconfigFile, tsconfig: JSON.parse(JSON.stringify(result.tsconfig)) }
+ ];
+ let pos = 0;
+ const extendsPath = [];
+ let currentBranchDepth = 0;
+ while (pos < extended.length) {
+ const extending = extended[pos];
+ extendsPath.push(extending.tsconfigFile);
+ if (extending.tsconfig.extends) {
+ currentBranchDepth += 1;
+ let resolvedExtends;
+ if (!Array.isArray(extending.tsconfig.extends)) {
+ resolvedExtends = [resolveExtends(extending.tsconfig.extends, extending.tsconfigFile)];
+ } else {
+ resolvedExtends = extending.tsconfig.extends.reverse().map((ex) => resolveExtends(ex, extending.tsconfigFile));
+ }
+ const circularExtends = resolvedExtends.find(
+ (tsconfigFile) => extendsPath.includes(tsconfigFile)
+ );
+ if (circularExtends) {
+ const circle = extendsPath.concat([circularExtends]).join(" -> ");
+ throw new TSConfckParseError(
+ `Circular dependency in "extends": ${circle}`,
+ "EXTENDS_CIRCULAR",
+ result.tsconfigFile
+ );
+ }
+ extended.splice(
+ pos + 1,
+ 0,
+ ...await Promise.all(resolvedExtends.map((file) => parseFile$1(file, cache)))
+ );
+ } else {
+ extendsPath.splice(-currentBranchDepth);
+ currentBranchDepth = 0;
+ }
+ pos = pos + 1;
+ }
+ result.extended = extended;
+ for (const ext of result.extended.slice(1)) {
+ extendTSConfig(result, ext);
+ }
+}
+function resolveExtends(extended, from) {
+ let error;
+ try {
+ return createRequire$2(from).resolve(extended);
+ } catch (e) {
+ error = e;
+ }
+ if (!require$$0$4.isAbsolute(extended) && !extended.startsWith("./") && !extended.startsWith("../")) {
+ try {
+ const fallbackExtended = require$$0$4.join(extended, "tsconfig.json");
+ return createRequire$2(from).resolve(fallbackExtended);
+ } catch (e) {
+ error = e;
+ }
+ }
+ throw new TSConfckParseError(
+ `failed to resolve "extends":"${extended}" in ${from}`,
+ "EXTENDS_RESOLVE",
+ from,
+ error
+ );
+}
+var EXTENDABLE_KEYS = [
+ "compilerOptions",
+ "files",
+ "include",
+ "exclude",
+ "watchOptions",
+ "compileOnSave",
+ "typeAcquisition",
+ "buildOptions"
+];
+function extendTSConfig(extending, extended) {
+ const extendingConfig = extending.tsconfig;
+ const extendedConfig = extended.tsconfig;
+ const relativePath = native2posix(
+ require$$0$4.relative(require$$0$4.dirname(extending.tsconfigFile), require$$0$4.dirname(extended.tsconfigFile))
+ );
+ for (const key of Object.keys(extendedConfig).filter((key2) => EXTENDABLE_KEYS.includes(key2))) {
+ if (key === "compilerOptions") {
+ if (!extendingConfig.compilerOptions) {
+ extendingConfig.compilerOptions = {};
+ }
+ for (const option of Object.keys(extendedConfig.compilerOptions)) {
+ if (Object.prototype.hasOwnProperty.call(extendingConfig.compilerOptions, option)) {
+ continue;
+ }
+ extendingConfig.compilerOptions[option] = rebaseRelative(
+ option,
+ extendedConfig.compilerOptions[option],
+ relativePath
+ );
+ }
+ } else if (extendingConfig[key] === void 0) {
+ if (key === "watchOptions") {
+ extendingConfig.watchOptions = {};
+ for (const option of Object.keys(extendedConfig.watchOptions)) {
+ extendingConfig.watchOptions[option] = rebaseRelative(
+ option,
+ extendedConfig.watchOptions[option],
+ relativePath
+ );
+ }
+ } else {
+ extendingConfig[key] = rebaseRelative(key, extendedConfig[key], relativePath);
+ }
+ }
+ }
+}
+var REBASE_KEYS = [
+ // root
+ "files",
+ "include",
+ "exclude",
+ // compilerOptions
+ "baseUrl",
+ "rootDir",
+ "rootDirs",
+ "typeRoots",
+ "outDir",
+ "outFile",
+ "declarationDir",
+ // watchOptions
+ "excludeDirectories",
+ "excludeFiles"
+];
+function rebaseRelative(key, value, prependPath) {
+ if (!REBASE_KEYS.includes(key)) {
+ return value;
+ }
+ if (Array.isArray(value)) {
+ return value.map((x) => rebasePath(x, prependPath));
+ } else {
+ return rebasePath(value, prependPath);
+ }
+}
+function rebasePath(value, prependPath) {
+ if (require$$0$4.isAbsolute(value)) {
+ return value;
+ } else {
+ return require$$0$4.posix.normalize(require$$0$4.posix.join(prependPath, value));
+ }
+}
+var TSConfckParseError = class _TSConfckParseError extends Error {
+ constructor(message, code, tsconfigFile, cause) {
+ super(message);
+ Object.setPrototypeOf(this, _TSConfckParseError.prototype);
+ this.name = _TSConfckParseError.name;
+ this.code = code;
+ this.cause = cause;
+ this.tsconfigFile = tsconfigFile;
+ }
+};
+
+// https://github.com/vitejs/vite/issues/2820#issuecomment-812495079
+const ROOT_FILES = [
+ // '.git',
+ // https://pnpm.io/workspaces/
+ 'pnpm-workspace.yaml',
+ // https://rushjs.io/pages/advanced/config_files/
+ // 'rush.json',
+ // https://nx.dev/latest/react/getting-started/nx-setup
+ // 'workspace.json',
+ // 'nx.json',
+ // https://github.com/lerna/lerna#lernajson
+ 'lerna.json',
+];
+// npm: https://docs.npmjs.com/cli/v7/using-npm/workspaces#installing-workspaces
+// yarn: https://classic.yarnpkg.com/en/docs/workspaces/#toc-how-to-use-it
+function hasWorkspacePackageJSON(root) {
+ const path = join$2(root, 'package.json');
+ if (!isFileReadable(path)) {
+ return false;
+ }
+ const content = JSON.parse(fs$l.readFileSync(path, 'utf-8')) || {};
+ return !!content.workspaces;
+}
+function hasRootFile(root) {
+ return ROOT_FILES.some((file) => fs$l.existsSync(join$2(root, file)));
+}
+function hasPackageJSON(root) {
+ const path = join$2(root, 'package.json');
+ return fs$l.existsSync(path);
+}
+/**
+ * Search up for the nearest `package.json`
+ */
+function searchForPackageRoot(current, root = current) {
+ if (hasPackageJSON(current))
+ return current;
+ const dir = dirname$2(current);
+ // reach the fs root
+ if (!dir || dir === current)
+ return root;
+ return searchForPackageRoot(dir, root);
+}
+/**
+ * Search up for the nearest workspace root
+ */
+function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
+ if (hasRootFile(current))
+ return current;
+ if (hasWorkspacePackageJSON(current))
+ return current;
+ const dir = dirname$2(current);
+ // reach the fs root
+ if (!dir || dir === current)
+ return root;
+ return searchForWorkspaceRoot(dir, root);
+}
+
+const debug$f = createDebugger('vite:esbuild');
+const INJECT_HELPERS_IIFE_RE = /^(.*?)((?:const|var)\s+\S+\s*=\s*function\s*\([^)]*\)\s*\{\s*"use strict";)/s;
+const INJECT_HELPERS_UMD_RE = /^(.*?)(\(function\([^)]*\)\s*\{.+?amd.+?function\([^)]*\)\s*\{\s*"use strict";)/s;
+const validExtensionRE = /\.\w+$/;
+const jsxExtensionsRE = /\.(?:j|t)sx\b/;
+let server;
+async function transformWithEsbuild(code, filename, options, inMap) {
+ let loader = options?.loader;
+ if (!loader) {
+ // if the id ends with a valid ext, use it (e.g. vue blocks)
+ // otherwise, cleanup the query before checking the ext
+ const ext = path$o
+ .extname(validExtensionRE.test(filename) ? filename : cleanUrl(filename))
+ .slice(1);
+ if (ext === 'cjs' || ext === 'mjs') {
+ loader = 'js';
+ }
+ else if (ext === 'cts' || ext === 'mts') {
+ loader = 'ts';
+ }
+ else {
+ loader = ext;
+ }
+ }
+ let tsconfigRaw = options?.tsconfigRaw;
+ const fallbackSupported = {};
+ // if options provide tsconfigRaw in string, it takes highest precedence
+ if (typeof tsconfigRaw !== 'string') {
+ // these fields would affect the compilation result
+ // https://esbuild.github.io/content-types/#tsconfig-json
+ const meaningfulFields = [
+ 'alwaysStrict',
+ 'experimentalDecorators',
+ 'importsNotUsedAsValues',
+ 'jsx',
+ 'jsxFactory',
+ 'jsxFragmentFactory',
+ 'jsxImportSource',
+ 'preserveValueImports',
+ 'target',
+ 'useDefineForClassFields',
+ 'verbatimModuleSyntax',
+ ];
+ const compilerOptionsForFile = {};
+ if (loader === 'ts' || loader === 'tsx') {
+ const loadedTsconfig = await loadTsconfigJsonForFile(filename);
+ const loadedCompilerOptions = loadedTsconfig.compilerOptions ?? {};
+ for (const field of meaningfulFields) {
+ if (field in loadedCompilerOptions) {
+ // @ts-expect-error TypeScript can't tell they are of the same type
+ compilerOptionsForFile[field] = loadedCompilerOptions[field];
+ }
+ }
+ }
+ const compilerOptions = {
+ ...compilerOptionsForFile,
+ ...tsconfigRaw?.compilerOptions,
+ };
+ // esbuild uses `useDefineForClassFields: true` when `tsconfig.compilerOptions.target` isn't declared
+ // but we want `useDefineForClassFields: false` when `tsconfig.compilerOptions.target` isn't declared
+ // to align with the TypeScript's behavior
+ if (compilerOptions.useDefineForClassFields === undefined &&
+ compilerOptions.target === undefined) {
+ compilerOptions.useDefineForClassFields = false;
+ }
+ // esbuild v0.18 only transforms decorators when `experimentalDecorators` is set to `true`.
+ // To preserve compat with the esbuild breaking change, we set `experimentalDecorators` to
+ // `true` by default if it's unset.
+ // TODO: Remove this in Vite 5
+ if (compilerOptions.experimentalDecorators === undefined) {
+ compilerOptions.experimentalDecorators = true;
+ }
+ // Compat with esbuild 0.17 where static properties are transpiled to
+ // static blocks when `useDefineForClassFields` is false. Its support
+ // is not great yet, so temporarily disable it for now.
+ // TODO: Remove this in Vite 5, don't pass hardcoded `esnext` target
+ // to `transformWithEsbuild` in the esbuild plugin.
+ if (compilerOptions.useDefineForClassFields !== true) {
+ fallbackSupported['class-static-blocks'] = false;
+ }
+ // esbuild uses tsconfig fields when both the normal options and tsconfig was set
+ // but we want to prioritize the normal options
+ if (options) {
+ options.jsx && (compilerOptions.jsx = undefined);
+ options.jsxFactory && (compilerOptions.jsxFactory = undefined);
+ options.jsxFragment && (compilerOptions.jsxFragmentFactory = undefined);
+ options.jsxImportSource && (compilerOptions.jsxImportSource = undefined);
+ }
+ tsconfigRaw = {
+ ...tsconfigRaw,
+ compilerOptions,
+ };
+ }
+ const resolvedOptions = {
+ sourcemap: true,
+ // ensure source file name contains full query
+ sourcefile: filename,
+ ...options,
+ loader,
+ tsconfigRaw,
+ supported: {
+ ...fallbackSupported,
+ ...options?.supported,
+ },
+ };
+ // Some projects in the ecosystem are calling this function with an ESBuildOptions
+ // object and esbuild throws an error for extra fields
+ // @ts-expect-error include exists in ESBuildOptions
+ delete resolvedOptions.include;
+ // @ts-expect-error exclude exists in ESBuildOptions
+ delete resolvedOptions.exclude;
+ // @ts-expect-error jsxInject exists in ESBuildOptions
+ delete resolvedOptions.jsxInject;
+ try {
+ const result = await transform$1(code, resolvedOptions);
+ let map;
+ if (inMap && resolvedOptions.sourcemap) {
+ const nextMap = JSON.parse(result.map);
+ nextMap.sourcesContent = [];
+ map = combineSourcemaps(filename, [
+ nextMap,
+ inMap,
+ ]);
+ }
+ else {
+ map =
+ resolvedOptions.sourcemap && resolvedOptions.sourcemap !== 'inline'
+ ? JSON.parse(result.map)
+ : { mappings: '' };
+ }
+ return {
+ ...result,
+ map,
+ };
+ }
+ catch (e) {
+ debug$f?.(`esbuild error with options used: `, resolvedOptions);
+ // patch error information
+ if (e.errors) {
+ e.frame = '';
+ e.errors.forEach((m) => {
+ if (m.text === 'Experimental decorators are not currently enabled') {
+ m.text +=
+ '. Vite 4.4+ now uses esbuild 0.18 and you need to enable them by adding "experimentalDecorators": true in your "tsconfig.json" file.';
+ }
+ e.frame += `\n` + prettifyMessage(m, code);
+ });
+ e.loc = e.errors[0].location;
+ }
+ throw e;
+ }
+}
+function esbuildPlugin(config) {
+ const options = config.esbuild;
+ const { jsxInject, include, exclude, ...esbuildTransformOptions } = options;
+ const filter = createFilter(include || /\.(m?ts|[jt]sx)$/, exclude || /\.js$/);
+ // Remove optimization options for dev as we only need to transpile them,
+ // and for build as the final optimization is in `buildEsbuildPlugin`
+ const transformOptions = {
+ target: 'esnext',
+ charset: 'utf8',
+ ...esbuildTransformOptions,
+ minify: false,
+ minifyIdentifiers: false,
+ minifySyntax: false,
+ minifyWhitespace: false,
+ treeShaking: false,
+ // keepNames is not needed when minify is disabled.
+ // Also transforming multiple times with keepNames enabled breaks
+ // tree-shaking. (#9164)
+ keepNames: false,
+ };
+ initTSConfck(config.root);
+ return {
+ name: 'vite:esbuild',
+ configureServer(_server) {
+ server = _server;
+ server.watcher
+ .on('add', reloadOnTsconfigChange)
+ .on('change', reloadOnTsconfigChange)
+ .on('unlink', reloadOnTsconfigChange);
+ },
+ buildEnd() {
+ // recycle serve to avoid preventing Node self-exit (#6815)
+ server = null;
+ },
+ async transform(code, id) {
+ if (filter(id) || filter(cleanUrl(id))) {
+ const result = await transformWithEsbuild(code, id, transformOptions);
+ if (result.warnings.length) {
+ result.warnings.forEach((m) => {
+ this.warn(prettifyMessage(m, code));
+ });
+ }
+ if (jsxInject && jsxExtensionsRE.test(id)) {
+ result.code = jsxInject + ';' + result.code;
+ }
+ return {
+ code: result.code,
+ map: result.map,
+ };
+ }
+ },
+ };
+}
+const rollupToEsbuildFormatMap = {
+ es: 'esm',
+ cjs: 'cjs',
+ // passing `var Lib = (() => {})()` to esbuild with format = "iife"
+ // will turn it to `(() => { var Lib = (() => {})() })()`,
+ // so we remove the format config to tell esbuild not doing this
+ //
+ // although esbuild doesn't change format, there is still possibility
+ // that `{ treeShaking: true }` removes a top-level no-side-effect variable
+ // like: `var Lib = 1`, which becomes `` after esbuild transforming,
+ // but thankfully rollup does not do this optimization now
+ iife: undefined,
+};
+const buildEsbuildPlugin = (config) => {
+ initTSConfck(config.root);
+ return {
+ name: 'vite:esbuild-transpile',
+ async renderChunk(code, chunk, opts) {
+ // @ts-expect-error injected by @vitejs/plugin-legacy
+ if (opts.__vite_skip_esbuild__) {
+ return null;
+ }
+ const options = resolveEsbuildTranspileOptions(config, opts.format);
+ if (!options) {
+ return null;
+ }
+ const res = await transformWithEsbuild(code, chunk.fileName, options);
+ if (config.build.lib) {
+ // #7188, esbuild adds helpers out of the UMD and IIFE wrappers, and the
+ // names are minified potentially causing collision with other globals.
+ // We use a regex to inject the helpers inside the wrappers.
+ // We don't need to create a MagicString here because both the helpers and
+ // the headers don't modify the sourcemap
+ const injectHelpers = opts.format === 'umd'
+ ? INJECT_HELPERS_UMD_RE
+ : opts.format === 'iife'
+ ? INJECT_HELPERS_IIFE_RE
+ : undefined;
+ if (injectHelpers) {
+ res.code = res.code.replace(injectHelpers, (_, helpers, header) => header + helpers);
+ }
+ }
+ return res;
+ },
+ };
+};
+function resolveEsbuildTranspileOptions(config, format) {
+ const target = config.build.target;
+ const minify = config.build.minify === 'esbuild';
+ if ((!target || target === 'esnext') && !minify) {
+ return null;
+ }
+ // Do not minify whitespace for ES lib output since that would remove
+ // pure annotations and break tree-shaking
+ // https://github.com/vuejs/core/issues/2860#issuecomment-926882793
+ const isEsLibBuild = config.build.lib && format === 'es';
+ const esbuildOptions = config.esbuild || {};
+ const options = {
+ charset: 'utf8',
+ ...esbuildOptions,
+ target: target || undefined,
+ format: rollupToEsbuildFormatMap[format],
+ // the final build should always support dynamic import and import.meta.
+ // if they need to be polyfilled, plugin-legacy should be used.
+ // plugin-legacy detects these two features when checking for modern code.
+ supported: {
+ 'dynamic-import': true,
+ 'import-meta': true,
+ ...esbuildOptions.supported,
+ },
+ };
+ // If no minify, disable all minify options
+ if (!minify) {
+ return {
+ ...options,
+ minify: false,
+ minifyIdentifiers: false,
+ minifySyntax: false,
+ minifyWhitespace: false,
+ treeShaking: false,
+ };
+ }
+ // If user enable fine-grain minify options, minify with their options instead
+ if (options.minifyIdentifiers != null ||
+ options.minifySyntax != null ||
+ options.minifyWhitespace != null) {
+ if (isEsLibBuild) {
+ // Disable minify whitespace as it breaks tree-shaking
+ return {
+ ...options,
+ minify: false,
+ minifyIdentifiers: options.minifyIdentifiers ?? true,
+ minifySyntax: options.minifySyntax ?? true,
+ minifyWhitespace: false,
+ treeShaking: true,
+ };
+ }
+ else {
+ return {
+ ...options,
+ minify: false,
+ minifyIdentifiers: options.minifyIdentifiers ?? true,
+ minifySyntax: options.minifySyntax ?? true,
+ minifyWhitespace: options.minifyWhitespace ?? true,
+ treeShaking: true,
+ };
+ }
+ }
+ // Else apply default minify options
+ if (isEsLibBuild) {
+ // Minify all except whitespace as it breaks tree-shaking
+ return {
+ ...options,
+ minify: false,
+ minifyIdentifiers: true,
+ minifySyntax: true,
+ minifyWhitespace: false,
+ treeShaking: true,
+ };
+ }
+ else {
+ return {
+ ...options,
+ minify: true,
+ treeShaking: true,
+ };
+ }
+}
+function prettifyMessage(m, code) {
+ let res = colors$1.yellow(m.text);
+ if (m.location) {
+ const lines = code.split(/\r?\n/g);
+ const line = Number(m.location.line);
+ const column = Number(m.location.column);
+ const offset = lines
+ .slice(0, line - 1)
+ .map((l) => l.length)
+ .reduce((total, l) => total + l + 1, 0) + column;
+ res += `\n` + generateCodeFrame(code, offset, offset + 1);
+ }
+ return res + `\n`;
+}
+let tsconfckRoot;
+let tsconfckParseOptions = { resolveWithEmptyIfConfigNotFound: true };
+function initTSConfck(root, force = false) {
+ // bail if already cached
+ if (!force && root === tsconfckRoot)
+ return;
+ const workspaceRoot = searchForWorkspaceRoot(root);
+ tsconfckRoot = root;
+ tsconfckParseOptions = initTSConfckParseOptions(workspaceRoot);
+ // cached as the options value itself when promise is resolved
+ tsconfckParseOptions.then((options) => {
+ if (root === tsconfckRoot) {
+ tsconfckParseOptions = options;
+ }
+ });
+}
+async function initTSConfckParseOptions(workspaceRoot) {
+ const start = debug$f ? performance.now() : 0;
+ const options = {
+ cache: new Map(),
+ root: workspaceRoot,
+ tsConfigPaths: new Set(await findAll(workspaceRoot, {
+ skip: (dir) => dir === 'node_modules' || dir === '.git',
+ })),
+ resolveWithEmptyIfConfigNotFound: true,
+ };
+ debug$f?.(timeFrom(start), 'tsconfck init', colors$1.dim(workspaceRoot));
+ return options;
+}
+async function loadTsconfigJsonForFile(filename) {
+ try {
+ const result = await parse$f(filename, await tsconfckParseOptions);
+ // tsconfig could be out of root, make sure it is watched on dev
+ if (server && result.tsconfigFile !== 'no_tsconfig_file_found') {
+ ensureWatchedFile(server.watcher, result.tsconfigFile, server.config.root);
+ }
+ return result.tsconfig;
+ }
+ catch (e) {
+ if (e instanceof TSConfckParseError) {
+ // tsconfig could be out of root, make sure it is watched on dev
+ if (server && e.tsconfigFile) {
+ ensureWatchedFile(server.watcher, e.tsconfigFile, server.config.root);
+ }
+ }
+ throw e;
+ }
+}
+async function reloadOnTsconfigChange(changedFile) {
+ // server could be closed externally after a file change is detected
+ if (!server)
+ return;
+ // any tsconfig.json that's added in the workspace could be closer to a code file than a previously cached one
+ // any json file in the tsconfig cache could have been used to compile ts
+ if (path$o.basename(changedFile) === 'tsconfig.json' ||
+ (changedFile.endsWith('.json') &&
+ (await tsconfckParseOptions)?.cache?.has(changedFile))) {
+ server.config.logger.info(`changed tsconfig file detected: ${changedFile} - Clearing cache and forcing full-reload to ensure TypeScript is compiled with updated config values.`, { clear: server.config.clearScreen, timestamp: true });
+ // clear module graph to remove code compiled with outdated config
+ server.moduleGraph.invalidateAll();
+ // reset tsconfck so that recompile works with up2date configs
+ initTSConfck(server.config.root, true);
+ // server may not be available if vite config is updated at the same time
+ if (server) {
+ // force full reload
+ server.ws.send({
+ type: 'full-reload',
+ path: '*',
+ });
+ }
+ }
+}
+
+var dist$1 = {};
+
+var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(dist$1, "__esModule", { value: true });
+var Worker_1 = dist$1.Worker = void 0;
+const os_1 = __importDefault(require$$2);
+const worker_threads_1 = require$$1;
+class Worker {
+ constructor(fn, options = {}) {
+ this.code = genWorkerCode(fn);
+ this.max = options.max || Math.max(1, os_1.default.cpus().length - 1);
+ this.pool = [];
+ this.idlePool = [];
+ this.queue = [];
+ }
+ async run(...args) {
+ const worker = await this._getAvailableWorker();
+ return new Promise((resolve, reject) => {
+ worker.currentResolve = resolve;
+ worker.currentReject = reject;
+ worker.postMessage(args);
+ });
+ }
+ stop() {
+ this.pool.forEach((w) => w.unref());
+ this.queue.forEach(([_, reject]) => reject(new Error('Main worker pool stopped before a worker was available.')));
+ this.pool = [];
+ this.idlePool = [];
+ this.queue = [];
+ }
+ async _getAvailableWorker() {
+ // has idle one?
+ if (this.idlePool.length) {
+ return this.idlePool.shift();
+ }
+ // can spawn more?
+ if (this.pool.length < this.max) {
+ const worker = new worker_threads_1.Worker(this.code, { eval: true });
+ worker.on('message', (res) => {
+ worker.currentResolve && worker.currentResolve(res);
+ worker.currentResolve = null;
+ this._assignDoneWorker(worker);
+ });
+ worker.on('error', (err) => {
+ worker.currentReject && worker.currentReject(err);
+ worker.currentReject = null;
+ });
+ worker.on('exit', (code) => {
+ const i = this.pool.indexOf(worker);
+ if (i > -1)
+ this.pool.splice(i, 1);
+ if (code !== 0 && worker.currentReject) {
+ worker.currentReject(new Error(`Wroker stopped with non-0 exit code ${code}`));
+ worker.currentReject = null;
+ }
+ });
+ this.pool.push(worker);
+ return worker;
+ }
+ // no one is available, we have to wait
+ let resolve;
+ let reject;
+ const onWorkerAvailablePromise = new Promise((r, rj) => {
+ resolve = r;
+ reject = rj;
+ });
+ this.queue.push([resolve, reject]);
+ return onWorkerAvailablePromise;
+ }
+ _assignDoneWorker(worker) {
+ // someone's waiting already?
+ if (this.queue.length) {
+ const [resolve] = this.queue.shift();
+ resolve(worker);
+ return;
+ }
+ // take a rest.
+ this.idlePool.push(worker);
+ }
+}
+Worker_1 = dist$1.Worker = Worker;
+function genWorkerCode(fn) {
+ return `
+const doWork = ${fn.toString()}
+
+const { parentPort } = require('worker_threads')
+
+parentPort.on('message', async (args) => {
+ const res = await doWork(...args)
+ parentPort.postMessage(res)
+})
+ `;
+}
+
+let terserPath;
+const loadTerserPath = (root) => {
+ if (terserPath)
+ return terserPath;
+ try {
+ terserPath = requireResolveFromRootWithFallback(root, 'terser');
+ }
+ catch (e) {
+ if (e.code === 'MODULE_NOT_FOUND') {
+ throw new Error('terser not found. Since Vite v3, terser has become an optional dependency. You need to install it.');
+ }
+ else {
+ const message = new Error(`terser failed to load:\n${e.message}`);
+ message.stack = e.stack + '\n' + message.stack;
+ throw message;
+ }
+ }
+ return terserPath;
+};
+function terserPlugin(config) {
+ const makeWorker = () => new Worker_1(async (terserPath, code, options) => {
+ // test fails when using `import`. maybe related: https://github.com/nodejs/node/issues/43205
+ // eslint-disable-next-line no-restricted-globals -- this function runs inside cjs
+ const terser = require(terserPath);
+ return terser.minify(code, options);
+ });
+ let worker;
+ return {
+ name: 'vite:terser',
+ async renderChunk(code, _chunk, outputOptions) {
+ // This plugin is included for any non-false value of config.build.minify,
+ // so that normal chunks can use the preferred minifier, and legacy chunks
+ // can use terser.
+ if (config.build.minify !== 'terser' &&
+ // @ts-expect-error injected by @vitejs/plugin-legacy
+ !outputOptions.__vite_force_terser__) {
+ return null;
+ }
+ // Do not minify ES lib output since that would remove pure annotations
+ // and break tree-shaking.
+ if (config.build.lib && outputOptions.format === 'es') {
+ return null;
+ }
+ // Lazy load worker.
+ worker || (worker = makeWorker());
+ const terserPath = loadTerserPath(config.root);
+ const res = await worker.run(terserPath, code, {
+ safari10: true,
+ ...config.build.terserOptions,
+ sourceMap: !!outputOptions.sourcemap,
+ module: outputOptions.format.startsWith('es'),
+ toplevel: outputOptions.format === 'cjs',
+ });
+ return {
+ code: res.code,
+ map: res.map,
+ };
+ },
+ closeBundle() {
+ worker?.stop();
+ },
+ };
+}
+
+var json = JSON;
+
+var isArray$1 = Array.isArray || function (x) {
+ return {}.toString.call(x) === '[object Array]';
+};
+
+var objectKeys = Object.keys || function (obj) {
+ var has = Object.prototype.hasOwnProperty || function () { return true; };
+ var keys = [];
+ for (var key in obj) {
+ if (has.call(obj, key)) { keys.push(key); }
+ }
+ return keys;
+};
+
+var jsonStableStringify = function (obj, opts) {
+ if (!opts) { opts = {}; }
+ if (typeof opts === 'function') { opts = { cmp: opts }; }
+ var space = opts.space || '';
+ if (typeof space === 'number') { space = Array(space + 1).join(' '); }
+ var cycles = typeof opts.cycles === 'boolean' ? opts.cycles : false;
+ var replacer = opts.replacer || function (key, value) { return value; };
+
+ var cmp = opts.cmp && (function (f) {
+ return function (node) {
+ return function (a, b) {
+ var aobj = { key: a, value: node[a] };
+ var bobj = { key: b, value: node[b] };
+ return f(aobj, bobj);
+ };
+ };
+ }(opts.cmp));
+
+ var seen = [];
+ return (function stringify(parent, key, node, level) {
+ var indent = space ? '\n' + new Array(level + 1).join(space) : '';
+ var colonSeparator = space ? ': ' : ':';
+
+ if (node && node.toJSON && typeof node.toJSON === 'function') {
+ node = node.toJSON();
+ }
+
+ node = replacer.call(parent, key, node);
+
+ if (node === undefined) {
+ return;
+ }
+ if (typeof node !== 'object' || node === null) {
+ return json.stringify(node);
+ }
+ if (isArray$1(node)) {
+ var out = [];
+ for (var i = 0; i < node.length; i++) {
+ var item = stringify(node, i, node[i], level + 1) || json.stringify(null);
+ out.push(indent + space + item);
+ }
+ return '[' + out.join(',') + indent + ']';
+ }
+
+ if (seen.indexOf(node) !== -1) {
+ if (cycles) { return json.stringify('__cycle__'); }
+ throw new TypeError('Converting circular structure to JSON');
+ } else { seen.push(node); }
+
+ var keys = objectKeys(node).sort(cmp && cmp(node));
+ var out = [];
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ var value = stringify(node, key, node[key], level + 1);
+
+ if (!value) { continue; }
+
+ var keyValue = json.stringify(key)
+ + colonSeparator
+ + value;
+
+ out.push(indent + space + keyValue);
+ }
+ seen.splice(seen.indexOf(node), 1);
+ return '{' + out.join(',') + indent + '}';
+
+ }({ '': obj }, '', obj, 0));
+};
+
+var jsonStableStringify$1 = /*@__PURE__*/getDefaultExportFromCjs(jsonStableStringify);
+
+const mimes$1 = {
+ "ez": "application/andrew-inset",
+ "aw": "application/applixware",
+ "atom": "application/atom+xml",
+ "atomcat": "application/atomcat+xml",
+ "atomdeleted": "application/atomdeleted+xml",
+ "atomsvc": "application/atomsvc+xml",
+ "dwd": "application/atsc-dwd+xml",
+ "held": "application/atsc-held+xml",
+ "rsat": "application/atsc-rsat+xml",
+ "bdoc": "application/bdoc",
+ "xcs": "application/calendar+xml",
+ "ccxml": "application/ccxml+xml",
+ "cdfx": "application/cdfx+xml",
+ "cdmia": "application/cdmi-capability",
+ "cdmic": "application/cdmi-container",
+ "cdmid": "application/cdmi-domain",
+ "cdmio": "application/cdmi-object",
+ "cdmiq": "application/cdmi-queue",
+ "cu": "application/cu-seeme",
+ "mpd": "application/dash+xml",
+ "davmount": "application/davmount+xml",
+ "dbk": "application/docbook+xml",
+ "dssc": "application/dssc+der",
+ "xdssc": "application/dssc+xml",
+ "es": "application/ecmascript",
+ "ecma": "application/ecmascript",
+ "emma": "application/emma+xml",
+ "emotionml": "application/emotionml+xml",
+ "epub": "application/epub+zip",
+ "exi": "application/exi",
+ "fdt": "application/fdt+xml",
+ "pfr": "application/font-tdpfr",
+ "geojson": "application/geo+json",
+ "gml": "application/gml+xml",
+ "gpx": "application/gpx+xml",
+ "gxf": "application/gxf",
+ "gz": "application/gzip",
+ "hjson": "application/hjson",
+ "stk": "application/hyperstudio",
+ "ink": "application/inkml+xml",
+ "inkml": "application/inkml+xml",
+ "ipfix": "application/ipfix",
+ "its": "application/its+xml",
+ "jar": "application/java-archive",
+ "war": "application/java-archive",
+ "ear": "application/java-archive",
+ "ser": "application/java-serialized-object",
+ "class": "application/java-vm",
+ "js": "application/javascript",
+ "mjs": "application/javascript",
+ "json": "application/json",
+ "map": "application/json",
+ "json5": "application/json5",
+ "jsonml": "application/jsonml+json",
+ "jsonld": "application/ld+json",
+ "lgr": "application/lgr+xml",
+ "lostxml": "application/lost+xml",
+ "hqx": "application/mac-binhex40",
+ "cpt": "application/mac-compactpro",
+ "mads": "application/mads+xml",
+ "webmanifest": "application/manifest+json",
+ "mrc": "application/marc",
+ "mrcx": "application/marcxml+xml",
+ "ma": "application/mathematica",
+ "nb": "application/mathematica",
+ "mb": "application/mathematica",
+ "mathml": "application/mathml+xml",
+ "mbox": "application/mbox",
+ "mscml": "application/mediaservercontrol+xml",
+ "metalink": "application/metalink+xml",
+ "meta4": "application/metalink4+xml",
+ "mets": "application/mets+xml",
+ "maei": "application/mmt-aei+xml",
+ "musd": "application/mmt-usd+xml",
+ "mods": "application/mods+xml",
+ "m21": "application/mp21",
+ "mp21": "application/mp21",
+ "mp4s": "application/mp4",
+ "m4p": "application/mp4",
+ "doc": "application/msword",
+ "dot": "application/msword",
+ "mxf": "application/mxf",
+ "nq": "application/n-quads",
+ "nt": "application/n-triples",
+ "cjs": "application/node",
+ "bin": "application/octet-stream",
+ "dms": "application/octet-stream",
+ "lrf": "application/octet-stream",
+ "mar": "application/octet-stream",
+ "so": "application/octet-stream",
+ "dist": "application/octet-stream",
+ "distz": "application/octet-stream",
+ "pkg": "application/octet-stream",
+ "bpk": "application/octet-stream",
+ "dump": "application/octet-stream",
+ "elc": "application/octet-stream",
+ "deploy": "application/octet-stream",
+ "exe": "application/octet-stream",
+ "dll": "application/octet-stream",
+ "deb": "application/octet-stream",
+ "dmg": "application/octet-stream",
+ "iso": "application/octet-stream",
+ "img": "application/octet-stream",
+ "msi": "application/octet-stream",
+ "msp": "application/octet-stream",
+ "msm": "application/octet-stream",
+ "buffer": "application/octet-stream",
+ "oda": "application/oda",
+ "opf": "application/oebps-package+xml",
+ "ogx": "application/ogg",
+ "omdoc": "application/omdoc+xml",
+ "onetoc": "application/onenote",
+ "onetoc2": "application/onenote",
+ "onetmp": "application/onenote",
+ "onepkg": "application/onenote",
+ "oxps": "application/oxps",
+ "relo": "application/p2p-overlay+xml",
+ "xer": "application/patch-ops-error+xml",
+ "pdf": "application/pdf",
+ "pgp": "application/pgp-encrypted",
+ "asc": "application/pgp-signature",
+ "sig": "application/pgp-signature",
+ "prf": "application/pics-rules",
+ "p10": "application/pkcs10",
+ "p7m": "application/pkcs7-mime",
+ "p7c": "application/pkcs7-mime",
+ "p7s": "application/pkcs7-signature",
+ "p8": "application/pkcs8",
+ "ac": "application/pkix-attr-cert",
+ "cer": "application/pkix-cert",
+ "crl": "application/pkix-crl",
+ "pkipath": "application/pkix-pkipath",
+ "pki": "application/pkixcmp",
+ "pls": "application/pls+xml",
+ "ai": "application/postscript",
+ "eps": "application/postscript",
+ "ps": "application/postscript",
+ "provx": "application/provenance+xml",
+ "cww": "application/prs.cww",
+ "pskcxml": "application/pskc+xml",
+ "raml": "application/raml+yaml",
+ "rdf": "application/rdf+xml",
+ "owl": "application/rdf+xml",
+ "rif": "application/reginfo+xml",
+ "rnc": "application/relax-ng-compact-syntax",
+ "rl": "application/resource-lists+xml",
+ "rld": "application/resource-lists-diff+xml",
+ "rs": "application/rls-services+xml",
+ "rapd": "application/route-apd+xml",
+ "sls": "application/route-s-tsid+xml",
+ "rusd": "application/route-usd+xml",
+ "gbr": "application/rpki-ghostbusters",
+ "mft": "application/rpki-manifest",
+ "roa": "application/rpki-roa",
+ "rsd": "application/rsd+xml",
+ "rss": "application/rss+xml",
+ "rtf": "application/rtf",
+ "sbml": "application/sbml+xml",
+ "scq": "application/scvp-cv-request",
+ "scs": "application/scvp-cv-response",
+ "spq": "application/scvp-vp-request",
+ "spp": "application/scvp-vp-response",
+ "sdp": "application/sdp",
+ "senmlx": "application/senml+xml",
+ "sensmlx": "application/sensml+xml",
+ "setpay": "application/set-payment-initiation",
+ "setreg": "application/set-registration-initiation",
+ "shf": "application/shf+xml",
+ "siv": "application/sieve",
+ "sieve": "application/sieve",
+ "smi": "application/smil+xml",
+ "smil": "application/smil+xml",
+ "rq": "application/sparql-query",
+ "srx": "application/sparql-results+xml",
+ "gram": "application/srgs",
+ "grxml": "application/srgs+xml",
+ "sru": "application/sru+xml",
+ "ssdl": "application/ssdl+xml",
+ "ssml": "application/ssml+xml",
+ "swidtag": "application/swid+xml",
+ "tei": "application/tei+xml",
+ "teicorpus": "application/tei+xml",
+ "tfi": "application/thraud+xml",
+ "tsd": "application/timestamped-data",
+ "toml": "application/toml",
+ "trig": "application/trig",
+ "ttml": "application/ttml+xml",
+ "ubj": "application/ubjson",
+ "rsheet": "application/urc-ressheet+xml",
+ "td": "application/urc-targetdesc+xml",
+ "vxml": "application/voicexml+xml",
+ "wasm": "application/wasm",
+ "wgt": "application/widget",
+ "hlp": "application/winhlp",
+ "wsdl": "application/wsdl+xml",
+ "wspolicy": "application/wspolicy+xml",
+ "xaml": "application/xaml+xml",
+ "xav": "application/xcap-att+xml",
+ "xca": "application/xcap-caps+xml",
+ "xdf": "application/xcap-diff+xml",
+ "xel": "application/xcap-el+xml",
+ "xns": "application/xcap-ns+xml",
+ "xenc": "application/xenc+xml",
+ "xhtml": "application/xhtml+xml",
+ "xht": "application/xhtml+xml",
+ "xlf": "application/xliff+xml",
+ "xml": "application/xml",
+ "xsl": "application/xml",
+ "xsd": "application/xml",
+ "rng": "application/xml",
+ "dtd": "application/xml-dtd",
+ "xop": "application/xop+xml",
+ "xpl": "application/xproc+xml",
+ "xslt": "application/xml",
+ "xspf": "application/xspf+xml",
+ "mxml": "application/xv+xml",
+ "xhvml": "application/xv+xml",
+ "xvml": "application/xv+xml",
+ "xvm": "application/xv+xml",
+ "yang": "application/yang",
+ "yin": "application/yin+xml",
+ "zip": "application/zip",
+ "3gpp": "video/3gpp",
+ "adp": "audio/adpcm",
+ "amr": "audio/amr",
+ "au": "audio/basic",
+ "snd": "audio/basic",
+ "mid": "audio/midi",
+ "midi": "audio/midi",
+ "kar": "audio/midi",
+ "rmi": "audio/midi",
+ "mxmf": "audio/mobile-xmf",
+ "mp3": "audio/mpeg",
+ "m4a": "audio/mp4",
+ "mp4a": "audio/mp4",
+ "mpga": "audio/mpeg",
+ "mp2": "audio/mpeg",
+ "mp2a": "audio/mpeg",
+ "m2a": "audio/mpeg",
+ "m3a": "audio/mpeg",
+ "oga": "audio/ogg",
+ "ogg": "audio/ogg",
+ "spx": "audio/ogg",
+ "opus": "audio/ogg",
+ "s3m": "audio/s3m",
+ "sil": "audio/silk",
+ "wav": "audio/wav",
+ "weba": "audio/webm",
+ "xm": "audio/xm",
+ "ttc": "font/collection",
+ "otf": "font/otf",
+ "ttf": "font/ttf",
+ "woff": "font/woff",
+ "woff2": "font/woff2",
+ "exr": "image/aces",
+ "apng": "image/apng",
+ "avif": "image/avif",
+ "bmp": "image/bmp",
+ "cgm": "image/cgm",
+ "drle": "image/dicom-rle",
+ "emf": "image/emf",
+ "fits": "image/fits",
+ "g3": "image/g3fax",
+ "gif": "image/gif",
+ "heic": "image/heic",
+ "heics": "image/heic-sequence",
+ "heif": "image/heif",
+ "heifs": "image/heif-sequence",
+ "hej2": "image/hej2k",
+ "hsj2": "image/hsj2",
+ "ief": "image/ief",
+ "jls": "image/jls",
+ "jp2": "image/jp2",
+ "jpg2": "image/jp2",
+ "jpeg": "image/jpeg",
+ "jpg": "image/jpeg",
+ "jpe": "image/jpeg",
+ "jph": "image/jph",
+ "jhc": "image/jphc",
+ "jpm": "image/jpm",
+ "jpx": "image/jpx",
+ "jpf": "image/jpx",
+ "jxr": "image/jxr",
+ "jxra": "image/jxra",
+ "jxrs": "image/jxrs",
+ "jxs": "image/jxs",
+ "jxsc": "image/jxsc",
+ "jxsi": "image/jxsi",
+ "jxss": "image/jxss",
+ "ktx": "image/ktx",
+ "ktx2": "image/ktx2",
+ "png": "image/png",
+ "btif": "image/prs.btif",
+ "pti": "image/prs.pti",
+ "sgi": "image/sgi",
+ "svg": "image/svg+xml",
+ "svgz": "image/svg+xml",
+ "t38": "image/t38",
+ "tif": "image/tiff",
+ "tiff": "image/tiff",
+ "tfx": "image/tiff-fx",
+ "webp": "image/webp",
+ "wmf": "image/wmf",
+ "disposition-notification": "message/disposition-notification",
+ "u8msg": "message/global",
+ "u8dsn": "message/global-delivery-status",
+ "u8mdn": "message/global-disposition-notification",
+ "u8hdr": "message/global-headers",
+ "eml": "message/rfc822",
+ "mime": "message/rfc822",
+ "3mf": "model/3mf",
+ "gltf": "model/gltf+json",
+ "glb": "model/gltf-binary",
+ "igs": "model/iges",
+ "iges": "model/iges",
+ "msh": "model/mesh",
+ "mesh": "model/mesh",
+ "silo": "model/mesh",
+ "mtl": "model/mtl",
+ "obj": "model/obj",
+ "stpz": "model/step+zip",
+ "stpxz": "model/step-xml+zip",
+ "stl": "model/stl",
+ "wrl": "model/vrml",
+ "vrml": "model/vrml",
+ "x3db": "model/x3d+fastinfoset",
+ "x3dbz": "model/x3d+binary",
+ "x3dv": "model/x3d-vrml",
+ "x3dvz": "model/x3d+vrml",
+ "x3d": "model/x3d+xml",
+ "x3dz": "model/x3d+xml",
+ "appcache": "text/cache-manifest",
+ "manifest": "text/cache-manifest",
+ "ics": "text/calendar",
+ "ifb": "text/calendar",
+ "coffee": "text/coffeescript",
+ "litcoffee": "text/coffeescript",
+ "css": "text/css",
+ "csv": "text/csv",
+ "html": "text/html",
+ "htm": "text/html",
+ "shtml": "text/html",
+ "jade": "text/jade",
+ "jsx": "text/jsx",
+ "less": "text/less",
+ "markdown": "text/markdown",
+ "md": "text/markdown",
+ "mml": "text/mathml",
+ "mdx": "text/mdx",
+ "n3": "text/n3",
+ "txt": "text/plain",
+ "text": "text/plain",
+ "conf": "text/plain",
+ "def": "text/plain",
+ "list": "text/plain",
+ "log": "text/plain",
+ "in": "text/plain",
+ "ini": "text/plain",
+ "dsc": "text/prs.lines.tag",
+ "rtx": "text/richtext",
+ "sgml": "text/sgml",
+ "sgm": "text/sgml",
+ "shex": "text/shex",
+ "slim": "text/slim",
+ "slm": "text/slim",
+ "spdx": "text/spdx",
+ "stylus": "text/stylus",
+ "styl": "text/stylus",
+ "tsv": "text/tab-separated-values",
+ "t": "text/troff",
+ "tr": "text/troff",
+ "roff": "text/troff",
+ "man": "text/troff",
+ "me": "text/troff",
+ "ms": "text/troff",
+ "ttl": "text/turtle",
+ "uri": "text/uri-list",
+ "uris": "text/uri-list",
+ "urls": "text/uri-list",
+ "vcard": "text/vcard",
+ "vtt": "text/vtt",
+ "yaml": "text/yaml",
+ "yml": "text/yaml",
+ "3gp": "video/3gpp",
+ "3g2": "video/3gpp2",
+ "h261": "video/h261",
+ "h263": "video/h263",
+ "h264": "video/h264",
+ "m4s": "video/iso.segment",
+ "jpgv": "video/jpeg",
+ "jpgm": "image/jpm",
+ "mj2": "video/mj2",
+ "mjp2": "video/mj2",
+ "ts": "video/mp2t",
+ "mp4": "video/mp4",
+ "mp4v": "video/mp4",
+ "mpg4": "video/mp4",
+ "mpeg": "video/mpeg",
+ "mpg": "video/mpeg",
+ "mpe": "video/mpeg",
+ "m1v": "video/mpeg",
+ "m2v": "video/mpeg",
+ "ogv": "video/ogg",
+ "qt": "video/quicktime",
+ "mov": "video/quicktime",
+ "webm": "video/webm"
+};
+
+function lookup(extn) {
+ let tmp = ('' + extn).trim().toLowerCase();
+ let idx = tmp.lastIndexOf('.');
+ return mimes$1[!~idx ? tmp : tmp.substring(++idx)];
+}
+
+class BitSet {
+ constructor(arg) {
+ this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
+ }
+
+ add(n) {
+ this.bits[n >> 5] |= 1 << (n & 31);
+ }
+
+ has(n) {
+ return !!(this.bits[n >> 5] & (1 << (n & 31)));
+ }
+}
+
+class Chunk {
+ constructor(start, end, content) {
+ this.start = start;
+ this.end = end;
+ this.original = content;
+
+ this.intro = '';
+ this.outro = '';
+
+ this.content = content;
+ this.storeName = false;
+ this.edited = false;
+
+ {
+ this.previous = null;
+ this.next = null;
+ }
+ }
+
+ appendLeft(content) {
+ this.outro += content;
+ }
+
+ appendRight(content) {
+ this.intro = this.intro + content;
+ }
+
+ clone() {
+ const chunk = new Chunk(this.start, this.end, this.original);
+
+ chunk.intro = this.intro;
+ chunk.outro = this.outro;
+ chunk.content = this.content;
+ chunk.storeName = this.storeName;
+ chunk.edited = this.edited;
+
+ return chunk;
+ }
+
+ contains(index) {
+ return this.start < index && index < this.end;
+ }
+
+ eachNext(fn) {
+ let chunk = this;
+ while (chunk) {
+ fn(chunk);
+ chunk = chunk.next;
+ }
+ }
+
+ eachPrevious(fn) {
+ let chunk = this;
+ while (chunk) {
+ fn(chunk);
+ chunk = chunk.previous;
+ }
+ }
+
+ edit(content, storeName, contentOnly) {
+ this.content = content;
+ if (!contentOnly) {
+ this.intro = '';
+ this.outro = '';
+ }
+ this.storeName = storeName;
+
+ this.edited = true;
+
+ return this;
+ }
+
+ prependLeft(content) {
+ this.outro = content + this.outro;
+ }
+
+ prependRight(content) {
+ this.intro = content + this.intro;
+ }
+
+ split(index) {
+ const sliceIndex = index - this.start;
+
+ const originalBefore = this.original.slice(0, sliceIndex);
+ const originalAfter = this.original.slice(sliceIndex);
+
+ this.original = originalBefore;
+
+ const newChunk = new Chunk(index, this.end, originalAfter);
+ newChunk.outro = this.outro;
+ this.outro = '';
+
+ this.end = index;
+
+ if (this.edited) {
+ // TODO is this block necessary?...
+ newChunk.edit('', false);
+ this.content = '';
+ } else {
+ this.content = originalBefore;
+ }
+
+ newChunk.next = this.next;
+ if (newChunk.next) newChunk.next.previous = newChunk;
+ newChunk.previous = this;
+ this.next = newChunk;
+
+ return newChunk;
+ }
+
+ toString() {
+ return this.intro + this.content + this.outro;
+ }
+
+ trimEnd(rx) {
+ this.outro = this.outro.replace(rx, '');
+ if (this.outro.length) return true;
+
+ const trimmed = this.content.replace(rx, '');
+
+ if (trimmed.length) {
+ if (trimmed !== this.content) {
+ this.split(this.start + trimmed.length).edit('', undefined, true);
+ }
+ return true;
+ } else {
+ this.edit('', undefined, true);
+
+ this.intro = this.intro.replace(rx, '');
+ if (this.intro.length) return true;
+ }
+ }
+
+ trimStart(rx) {
+ this.intro = this.intro.replace(rx, '');
+ if (this.intro.length) return true;
+
+ const trimmed = this.content.replace(rx, '');
+
+ if (trimmed.length) {
+ if (trimmed !== this.content) {
+ this.split(this.end - trimmed.length);
+ this.edit('', undefined, true);
+ }
+ return true;
+ } else {
+ this.edit('', undefined, true);
+
+ this.outro = this.outro.replace(rx, '');
+ if (this.outro.length) return true;
+ }
+ }
+}
+
+function getBtoa() {
+ if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
+ return (str) => window.btoa(unescape(encodeURIComponent(str)));
+ } else if (typeof Buffer === 'function') {
+ return (str) => Buffer.from(str, 'utf-8').toString('base64');
+ } else {
+ return () => {
+ throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
+ };
+ }
+}
+
+const btoa$1 = /*#__PURE__*/ getBtoa();
+
+class SourceMap {
+ constructor(properties) {
+ this.version = 3;
+ this.file = properties.file;
+ this.sources = properties.sources;
+ this.sourcesContent = properties.sourcesContent;
+ this.names = properties.names;
+ this.mappings = encode$1(properties.mappings);
+ if (typeof properties.x_google_ignoreList !== 'undefined') {
+ this.x_google_ignoreList = properties.x_google_ignoreList;
+ }
+ }
+
+ toString() {
+ return JSON.stringify(this);
+ }
+
+ toUrl() {
+ return 'data:application/json;charset=utf-8;base64,' + btoa$1(this.toString());
+ }
+}
+
+function guessIndent(code) {
+ const lines = code.split('\n');
+
+ const tabbed = lines.filter((line) => /^\t+/.test(line));
+ const spaced = lines.filter((line) => /^ {2,}/.test(line));
+
+ if (tabbed.length === 0 && spaced.length === 0) {
+ return null;
+ }
+
+ // More lines tabbed than spaced? Assume tabs, and
+ // default to tabs in the case of a tie (or nothing
+ // to go on)
+ if (tabbed.length >= spaced.length) {
+ return '\t';
+ }
+
+ // Otherwise, we need to guess the multiple
+ const min = spaced.reduce((previous, current) => {
+ const numSpaces = /^ +/.exec(current)[0].length;
+ return Math.min(numSpaces, previous);
+ }, Infinity);
+
+ return new Array(min + 1).join(' ');
+}
+
+function getRelativePath(from, to) {
+ const fromParts = from.split(/[/\\]/);
+ const toParts = to.split(/[/\\]/);
+
+ fromParts.pop(); // get dirname
+
+ while (fromParts[0] === toParts[0]) {
+ fromParts.shift();
+ toParts.shift();
+ }
+
+ if (fromParts.length) {
+ let i = fromParts.length;
+ while (i--) fromParts[i] = '..';
+ }
+
+ return fromParts.concat(toParts).join('/');
+}
+
+const toString$2 = Object.prototype.toString;
+
+function isObject$1(thing) {
+ return toString$2.call(thing) === '[object Object]';
+}
+
+function getLocator(source) {
+ const originalLines = source.split('\n');
+ const lineOffsets = [];
+
+ for (let i = 0, pos = 0; i < originalLines.length; i++) {
+ lineOffsets.push(pos);
+ pos += originalLines[i].length + 1;
+ }
+
+ return function locate(index) {
+ let i = 0;
+ let j = lineOffsets.length;
+ while (i < j) {
+ const m = (i + j) >> 1;
+ if (index < lineOffsets[m]) {
+ j = m;
+ } else {
+ i = m + 1;
+ }
+ }
+ const line = i - 1;
+ const column = index - lineOffsets[line];
+ return { line, column };
+ };
+}
+
+const wordRegex = /\w/;
+
+class Mappings {
+ constructor(hires) {
+ this.hires = hires;
+ this.generatedCodeLine = 0;
+ this.generatedCodeColumn = 0;
+ this.raw = [];
+ this.rawSegments = this.raw[this.generatedCodeLine] = [];
+ this.pending = null;
+ }
+
+ addEdit(sourceIndex, content, loc, nameIndex) {
+ if (content.length) {
+ const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
+ if (nameIndex >= 0) {
+ segment.push(nameIndex);
+ }
+ this.rawSegments.push(segment);
+ } else if (this.pending) {
+ this.rawSegments.push(this.pending);
+ }
+
+ this.advance(content);
+ this.pending = null;
+ }
+
+ addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
+ let originalCharIndex = chunk.start;
+ let first = true;
+ // when iterating each char, check if it's in a word boundary
+ let charInHiresBoundary = false;
+
+ while (originalCharIndex < chunk.end) {
+ if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
+ const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
+
+ if (this.hires === 'boundary') {
+ // in hires "boundary", group segments per word boundary than per char
+ if (wordRegex.test(original[originalCharIndex])) {
+ // for first char in the boundary found, start the boundary by pushing a segment
+ if (!charInHiresBoundary) {
+ this.rawSegments.push(segment);
+ charInHiresBoundary = true;
+ }
+ } else {
+ // for non-word char, end the boundary by pushing a segment
+ this.rawSegments.push(segment);
+ charInHiresBoundary = false;
+ }
+ } else {
+ this.rawSegments.push(segment);
+ }
+ }
+
+ if (original[originalCharIndex] === '\n') {
+ loc.line += 1;
+ loc.column = 0;
+ this.generatedCodeLine += 1;
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
+ this.generatedCodeColumn = 0;
+ first = true;
+ } else {
+ loc.column += 1;
+ this.generatedCodeColumn += 1;
+ first = false;
+ }
+
+ originalCharIndex += 1;
+ }
+
+ this.pending = null;
+ }
+
+ advance(str) {
+ if (!str) return;
+
+ const lines = str.split('\n');
+
+ if (lines.length > 1) {
+ for (let i = 0; i < lines.length - 1; i++) {
+ this.generatedCodeLine++;
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
+ }
+ this.generatedCodeColumn = 0;
+ }
+
+ this.generatedCodeColumn += lines[lines.length - 1].length;
+ }
+}
+
+const n$1 = '\n';
+
+const warned = {
+ insertLeft: false,
+ insertRight: false,
+ storeName: false,
+};
+
+class MagicString {
+ constructor(string, options = {}) {
+ const chunk = new Chunk(0, string.length, string);
+
+ Object.defineProperties(this, {
+ original: { writable: true, value: string },
+ outro: { writable: true, value: '' },
+ intro: { writable: true, value: '' },
+ firstChunk: { writable: true, value: chunk },
+ lastChunk: { writable: true, value: chunk },
+ lastSearchedChunk: { writable: true, value: chunk },
+ byStart: { writable: true, value: {} },
+ byEnd: { writable: true, value: {} },
+ filename: { writable: true, value: options.filename },
+ indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
+ sourcemapLocations: { writable: true, value: new BitSet() },
+ storedNames: { writable: true, value: {} },
+ indentStr: { writable: true, value: undefined },
+ ignoreList: { writable: true, value: options.ignoreList },
+ });
+
+ this.byStart[0] = chunk;
+ this.byEnd[string.length] = chunk;
+ }
+
+ addSourcemapLocation(char) {
+ this.sourcemapLocations.add(char);
+ }
+
+ append(content) {
+ if (typeof content !== 'string') throw new TypeError('outro content must be a string');
+
+ this.outro += content;
+ return this;
+ }
+
+ appendLeft(index, content) {
+ if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
+
+ this._split(index);
+
+ const chunk = this.byEnd[index];
+
+ if (chunk) {
+ chunk.appendLeft(content);
+ } else {
+ this.intro += content;
+ }
+ return this;
+ }
+
+ appendRight(index, content) {
+ if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
+
+ this._split(index);
+
+ const chunk = this.byStart[index];
+
+ if (chunk) {
+ chunk.appendRight(content);
+ } else {
+ this.outro += content;
+ }
+ return this;
+ }
+
+ clone() {
+ const cloned = new MagicString(this.original, { filename: this.filename });
+
+ let originalChunk = this.firstChunk;
+ let clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
+
+ while (originalChunk) {
+ cloned.byStart[clonedChunk.start] = clonedChunk;
+ cloned.byEnd[clonedChunk.end] = clonedChunk;
+
+ const nextOriginalChunk = originalChunk.next;
+ const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
+
+ if (nextClonedChunk) {
+ clonedChunk.next = nextClonedChunk;
+ nextClonedChunk.previous = clonedChunk;
+
+ clonedChunk = nextClonedChunk;
+ }
+
+ originalChunk = nextOriginalChunk;
+ }
+
+ cloned.lastChunk = clonedChunk;
+
+ if (this.indentExclusionRanges) {
+ cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
+ }
+
+ cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
+
+ cloned.intro = this.intro;
+ cloned.outro = this.outro;
+
+ return cloned;
+ }
+
+ generateDecodedMap(options) {
+ options = options || {};
+
+ const sourceIndex = 0;
+ const names = Object.keys(this.storedNames);
+ const mappings = new Mappings(options.hires);
+
+ const locate = getLocator(this.original);
+
+ if (this.intro) {
+ mappings.advance(this.intro);
+ }
+
+ this.firstChunk.eachNext((chunk) => {
+ const loc = locate(chunk.start);
+
+ if (chunk.intro.length) mappings.advance(chunk.intro);
+
+ if (chunk.edited) {
+ mappings.addEdit(
+ sourceIndex,
+ chunk.content,
+ loc,
+ chunk.storeName ? names.indexOf(chunk.original) : -1,
+ );
+ } else {
+ mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
+ }
+
+ if (chunk.outro.length) mappings.advance(chunk.outro);
+ });
+
+ return {
+ file: options.file ? options.file.split(/[/\\]/).pop() : undefined,
+ sources: [
+ options.source ? getRelativePath(options.file || '', options.source) : options.file || '',
+ ],
+ sourcesContent: options.includeContent ? [this.original] : undefined,
+ names,
+ mappings: mappings.raw,
+ x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined,
+ };
+ }
+
+ generateMap(options) {
+ return new SourceMap(this.generateDecodedMap(options));
+ }
+
+ _ensureindentStr() {
+ if (this.indentStr === undefined) {
+ this.indentStr = guessIndent(this.original);
+ }
+ }
+
+ _getRawIndentString() {
+ this._ensureindentStr();
+ return this.indentStr;
+ }
+
+ getIndentString() {
+ this._ensureindentStr();
+ return this.indentStr === null ? '\t' : this.indentStr;
+ }
+
+ indent(indentStr, options) {
+ const pattern = /^[^\r\n]/gm;
+
+ if (isObject$1(indentStr)) {
+ options = indentStr;
+ indentStr = undefined;
+ }
+
+ if (indentStr === undefined) {
+ this._ensureindentStr();
+ indentStr = this.indentStr || '\t';
+ }
+
+ if (indentStr === '') return this; // noop
+
+ options = options || {};
+
+ // Process exclusion ranges
+ const isExcluded = {};
+
+ if (options.exclude) {
+ const exclusions =
+ typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
+ exclusions.forEach((exclusion) => {
+ for (let i = exclusion[0]; i < exclusion[1]; i += 1) {
+ isExcluded[i] = true;
+ }
+ });
+ }
+
+ let shouldIndentNextCharacter = options.indentStart !== false;
+ const replacer = (match) => {
+ if (shouldIndentNextCharacter) return `${indentStr}${match}`;
+ shouldIndentNextCharacter = true;
+ return match;
+ };
+
+ this.intro = this.intro.replace(pattern, replacer);
+
+ let charIndex = 0;
+ let chunk = this.firstChunk;
+
+ while (chunk) {
+ const end = chunk.end;
+
+ if (chunk.edited) {
+ if (!isExcluded[charIndex]) {
+ chunk.content = chunk.content.replace(pattern, replacer);
+
+ if (chunk.content.length) {
+ shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n';
+ }
+ }
+ } else {
+ charIndex = chunk.start;
+
+ while (charIndex < end) {
+ if (!isExcluded[charIndex]) {
+ const char = this.original[charIndex];
+
+ if (char === '\n') {
+ shouldIndentNextCharacter = true;
+ } else if (char !== '\r' && shouldIndentNextCharacter) {
+ shouldIndentNextCharacter = false;
+
+ if (charIndex === chunk.start) {
+ chunk.prependRight(indentStr);
+ } else {
+ this._splitChunk(chunk, charIndex);
+ chunk = chunk.next;
+ chunk.prependRight(indentStr);
+ }
+ }
+ }
+
+ charIndex += 1;
+ }
+ }
+
+ charIndex = chunk.end;
+ chunk = chunk.next;
+ }
+
+ this.outro = this.outro.replace(pattern, replacer);
+
+ return this;
+ }
+
+ insert() {
+ throw new Error(
+ 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)',
+ );
+ }
+
+ insertLeft(index, content) {
+ if (!warned.insertLeft) {
+ console.warn(
+ 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead',
+ ); // eslint-disable-line no-console
+ warned.insertLeft = true;
+ }
+
+ return this.appendLeft(index, content);
+ }
+
+ insertRight(index, content) {
+ if (!warned.insertRight) {
+ console.warn(
+ 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead',
+ ); // eslint-disable-line no-console
+ warned.insertRight = true;
+ }
+
+ return this.prependRight(index, content);
+ }
+
+ move(start, end, index) {
+ if (index >= start && index <= end) throw new Error('Cannot move a selection inside itself');
+
+ this._split(start);
+ this._split(end);
+ this._split(index);
+
+ const first = this.byStart[start];
+ const last = this.byEnd[end];
+
+ const oldLeft = first.previous;
+ const oldRight = last.next;
+
+ const newRight = this.byStart[index];
+ if (!newRight && last === this.lastChunk) return this;
+ const newLeft = newRight ? newRight.previous : this.lastChunk;
+
+ if (oldLeft) oldLeft.next = oldRight;
+ if (oldRight) oldRight.previous = oldLeft;
+
+ if (newLeft) newLeft.next = first;
+ if (newRight) newRight.previous = last;
+
+ if (!first.previous) this.firstChunk = last.next;
+ if (!last.next) {
+ this.lastChunk = first.previous;
+ this.lastChunk.next = null;
+ }
+
+ first.previous = newLeft;
+ last.next = newRight || null;
+
+ if (!newLeft) this.firstChunk = first;
+ if (!newRight) this.lastChunk = last;
+ return this;
+ }
+
+ overwrite(start, end, content, options) {
+ options = options || {};
+ return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
+ }
+
+ update(start, end, content, options) {
+ if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
+
+ while (start < 0) start += this.original.length;
+ while (end < 0) end += this.original.length;
+
+ if (end > this.original.length) throw new Error('end is out of bounds');
+ if (start === end)
+ throw new Error(
+ 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead',
+ );
+
+ this._split(start);
+ this._split(end);
+
+ if (options === true) {
+ if (!warned.storeName) {
+ console.warn(
+ 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string',
+ ); // eslint-disable-line no-console
+ warned.storeName = true;
+ }
+
+ options = { storeName: true };
+ }
+ const storeName = options !== undefined ? options.storeName : false;
+ const overwrite = options !== undefined ? options.overwrite : false;
+
+ if (storeName) {
+ const original = this.original.slice(start, end);
+ Object.defineProperty(this.storedNames, original, {
+ writable: true,
+ value: true,
+ enumerable: true,
+ });
+ }
+
+ const first = this.byStart[start];
+ const last = this.byEnd[end];
+
+ if (first) {
+ let chunk = first;
+ while (chunk !== last) {
+ if (chunk.next !== this.byStart[chunk.end]) {
+ throw new Error('Cannot overwrite across a split point');
+ }
+ chunk = chunk.next;
+ chunk.edit('', false);
+ }
+
+ first.edit(content, storeName, !overwrite);
+ } else {
+ // must be inserting at the end
+ const newChunk = new Chunk(start, end, '').edit(content, storeName);
+
+ // TODO last chunk in the array may not be the last chunk, if it's moved...
+ last.next = newChunk;
+ newChunk.previous = last;
+ }
+ return this;
+ }
+
+ prepend(content) {
+ if (typeof content !== 'string') throw new TypeError('outro content must be a string');
+
+ this.intro = content + this.intro;
+ return this;
+ }
+
+ prependLeft(index, content) {
+ if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
+
+ this._split(index);
+
+ const chunk = this.byEnd[index];
+
+ if (chunk) {
+ chunk.prependLeft(content);
+ } else {
+ this.intro = content + this.intro;
+ }
+ return this;
+ }
+
+ prependRight(index, content) {
+ if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
+
+ this._split(index);
+
+ const chunk = this.byStart[index];
+
+ if (chunk) {
+ chunk.prependRight(content);
+ } else {
+ this.outro = content + this.outro;
+ }
+ return this;
+ }
+
+ remove(start, end) {
+ while (start < 0) start += this.original.length;
+ while (end < 0) end += this.original.length;
+
+ if (start === end) return this;
+
+ if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');
+ if (start > end) throw new Error('end must be greater than start');
+
+ this._split(start);
+ this._split(end);
+
+ let chunk = this.byStart[start];
+
+ while (chunk) {
+ chunk.intro = '';
+ chunk.outro = '';
+ chunk.edit('');
+
+ chunk = end > chunk.end ? this.byStart[chunk.end] : null;
+ }
+ return this;
+ }
+
+ lastChar() {
+ if (this.outro.length) return this.outro[this.outro.length - 1];
+ let chunk = this.lastChunk;
+ do {
+ if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];
+ if (chunk.content.length) return chunk.content[chunk.content.length - 1];
+ if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];
+ } while ((chunk = chunk.previous));
+ if (this.intro.length) return this.intro[this.intro.length - 1];
+ return '';
+ }
+
+ lastLine() {
+ let lineIndex = this.outro.lastIndexOf(n$1);
+ if (lineIndex !== -1) return this.outro.substr(lineIndex + 1);
+ let lineStr = this.outro;
+ let chunk = this.lastChunk;
+ do {
+ if (chunk.outro.length > 0) {
+ lineIndex = chunk.outro.lastIndexOf(n$1);
+ if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;
+ lineStr = chunk.outro + lineStr;
+ }
+
+ if (chunk.content.length > 0) {
+ lineIndex = chunk.content.lastIndexOf(n$1);
+ if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;
+ lineStr = chunk.content + lineStr;
+ }
+
+ if (chunk.intro.length > 0) {
+ lineIndex = chunk.intro.lastIndexOf(n$1);
+ if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;
+ lineStr = chunk.intro + lineStr;
+ }
+ } while ((chunk = chunk.previous));
+ lineIndex = this.intro.lastIndexOf(n$1);
+ if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;
+ return this.intro + lineStr;
+ }
+
+ slice(start = 0, end = this.original.length) {
+ while (start < 0) start += this.original.length;
+ while (end < 0) end += this.original.length;
+
+ let result = '';
+
+ // find start chunk
+ let chunk = this.firstChunk;
+ while (chunk && (chunk.start > start || chunk.end <= start)) {
+ // found end chunk before start
+ if (chunk.start < end && chunk.end >= end) {
+ return result;
+ }
+
+ chunk = chunk.next;
+ }
+
+ if (chunk && chunk.edited && chunk.start !== start)
+ throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
+
+ const startChunk = chunk;
+ while (chunk) {
+ if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
+ result += chunk.intro;
+ }
+
+ const containsEnd = chunk.start < end && chunk.end >= end;
+ if (containsEnd && chunk.edited && chunk.end !== end)
+ throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
+
+ const sliceStart = startChunk === chunk ? start - chunk.start : 0;
+ const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
+
+ result += chunk.content.slice(sliceStart, sliceEnd);
+
+ if (chunk.outro && (!containsEnd || chunk.end === end)) {
+ result += chunk.outro;
+ }
+
+ if (containsEnd) {
+ break;
+ }
+
+ chunk = chunk.next;
+ }
+
+ return result;
+ }
+
+ // TODO deprecate this? not really very useful
+ snip(start, end) {
+ const clone = this.clone();
+ clone.remove(0, start);
+ clone.remove(end, clone.original.length);
+
+ return clone;
+ }
+
+ _split(index) {
+ if (this.byStart[index] || this.byEnd[index]) return;
+
+ let chunk = this.lastSearchedChunk;
+ const searchForward = index > chunk.end;
+
+ while (chunk) {
+ if (chunk.contains(index)) return this._splitChunk(chunk, index);
+
+ chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
+ }
+ }
+
+ _splitChunk(chunk, index) {
+ if (chunk.edited && chunk.content.length) {
+ // zero-length edited chunks are a special case (overlapping replacements)
+ const loc = getLocator(this.original)(index);
+ throw new Error(
+ `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`,
+ );
+ }
+
+ const newChunk = chunk.split(index);
+
+ this.byEnd[index] = chunk;
+ this.byStart[index] = newChunk;
+ this.byEnd[newChunk.end] = newChunk;
+
+ if (chunk === this.lastChunk) this.lastChunk = newChunk;
+
+ this.lastSearchedChunk = chunk;
+ return true;
+ }
+
+ toString() {
+ let str = this.intro;
+
+ let chunk = this.firstChunk;
+ while (chunk) {
+ str += chunk.toString();
+ chunk = chunk.next;
+ }
+
+ return str + this.outro;
+ }
+
+ isEmpty() {
+ let chunk = this.firstChunk;
+ do {
+ if (
+ (chunk.intro.length && chunk.intro.trim()) ||
+ (chunk.content.length && chunk.content.trim()) ||
+ (chunk.outro.length && chunk.outro.trim())
+ )
+ return false;
+ } while ((chunk = chunk.next));
+ return true;
+ }
+
+ length() {
+ let chunk = this.firstChunk;
+ let length = 0;
+ do {
+ length += chunk.intro.length + chunk.content.length + chunk.outro.length;
+ } while ((chunk = chunk.next));
+ return length;
+ }
+
+ trimLines() {
+ return this.trim('[\\r\\n]');
+ }
+
+ trim(charType) {
+ return this.trimStart(charType).trimEnd(charType);
+ }
+
+ trimEndAborted(charType) {
+ const rx = new RegExp((charType || '\\s') + '+$');
+
+ this.outro = this.outro.replace(rx, '');
+ if (this.outro.length) return true;
+
+ let chunk = this.lastChunk;
+
+ do {
+ const end = chunk.end;
+ const aborted = chunk.trimEnd(rx);
+
+ // if chunk was trimmed, we have a new lastChunk
+ if (chunk.end !== end) {
+ if (this.lastChunk === chunk) {
+ this.lastChunk = chunk.next;
+ }
+
+ this.byEnd[chunk.end] = chunk;
+ this.byStart[chunk.next.start] = chunk.next;
+ this.byEnd[chunk.next.end] = chunk.next;
+ }
+
+ if (aborted) return true;
+ chunk = chunk.previous;
+ } while (chunk);
+
+ return false;
+ }
+
+ trimEnd(charType) {
+ this.trimEndAborted(charType);
+ return this;
+ }
+ trimStartAborted(charType) {
+ const rx = new RegExp('^' + (charType || '\\s') + '+');
+
+ this.intro = this.intro.replace(rx, '');
+ if (this.intro.length) return true;
+
+ let chunk = this.firstChunk;
+
+ do {
+ const end = chunk.end;
+ const aborted = chunk.trimStart(rx);
+
+ if (chunk.end !== end) {
+ // special case...
+ if (chunk === this.lastChunk) this.lastChunk = chunk.next;
+
+ this.byEnd[chunk.end] = chunk;
+ this.byStart[chunk.next.start] = chunk.next;
+ this.byEnd[chunk.next.end] = chunk.next;
+ }
+
+ if (aborted) return true;
+ chunk = chunk.next;
+ } while (chunk);
+
+ return false;
+ }
+
+ trimStart(charType) {
+ this.trimStartAborted(charType);
+ return this;
+ }
+
+ hasChanged() {
+ return this.original !== this.toString();
+ }
+
+ _replaceRegexp(searchValue, replacement) {
+ function getReplacement(match, str) {
+ if (typeof replacement === 'string') {
+ return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter
+ if (i === '$') return '$';
+ if (i === '&') return match[0];
+ const num = +i;
+ if (num < match.length) return match[+i];
+ return `$${i}`;
+ });
+ } else {
+ return replacement(...match, match.index, str, match.groups);
+ }
+ }
+ function matchAll(re, str) {
+ let match;
+ const matches = [];
+ while ((match = re.exec(str))) {
+ matches.push(match);
+ }
+ return matches;
+ }
+ if (searchValue.global) {
+ const matches = matchAll(searchValue, this.original);
+ matches.forEach((match) => {
+ if (match.index != null)
+ this.overwrite(
+ match.index,
+ match.index + match[0].length,
+ getReplacement(match, this.original),
+ );
+ });
+ } else {
+ const match = this.original.match(searchValue);
+ if (match && match.index != null)
+ this.overwrite(
+ match.index,
+ match.index + match[0].length,
+ getReplacement(match, this.original),
+ );
+ }
+ return this;
+ }
+
+ _replaceString(string, replacement) {
+ const { original } = this;
+ const index = original.indexOf(string);
+
+ if (index !== -1) {
+ this.overwrite(index, index + string.length, replacement);
+ }
+
+ return this;
+ }
+
+ replace(searchValue, replacement) {
+ if (typeof searchValue === 'string') {
+ return this._replaceString(searchValue, replacement);
+ }
+
+ return this._replaceRegexp(searchValue, replacement);
+ }
+
+ _replaceAllString(string, replacement) {
+ const { original } = this;
+ const stringLength = string.length;
+ for (
+ let index = original.indexOf(string);
+ index !== -1;
+ index = original.indexOf(string, index + stringLength)
+ ) {
+ this.overwrite(index, index + stringLength, replacement);
+ }
+
+ return this;
+ }
+
+ replaceAll(searchValue, replacement) {
+ if (typeof searchValue === 'string') {
+ return this._replaceAllString(searchValue, replacement);
+ }
+
+ if (!searchValue.global) {
+ throw new TypeError(
+ 'MagicString.prototype.replaceAll called with a non-global RegExp argument',
+ );
+ }
+
+ return this._replaceRegexp(searchValue, replacement);
+ }
+}
+
+const assetUrlRE = /__VITE_ASSET__([a-z\d]+)__(?:\$_(.*?)__)?/g;
+const rawRE = /(?:\?|&)raw(?:&|$)/;
+const urlRE = /(\?|&)url(?:&|$)/;
+const jsSourceMapRE = /\.[cm]?js\.map$/;
+const unnededFinalQueryCharRE = /[?&]$/;
+const assetCache = new WeakMap();
+const generatedAssets = new WeakMap();
+// add own dictionary entry by directly assigning mrmime
+function registerCustomMime() {
+ // https://github.com/lukeed/mrmime/issues/3
+ mimes$1['ico'] = 'image/x-icon';
+ // https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#flac
+ mimes$1['flac'] = 'audio/flac';
+ // mrmime and mime-db is not released yet: https://github.com/jshttp/mime-db/commit/c9242a9b7d4bb25d7a0c9244adec74aeef08d8a1
+ mimes$1['aac'] = 'audio/aac';
+ // https://wiki.xiph.org/MIME_Types_and_File_Extensions#.opus_-_audio/ogg
+ mimes$1['opus'] = 'audio/ogg';
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
+ mimes$1['eot'] = 'application/vnd.ms-fontobject';
+}
+function renderAssetUrlInJS(ctx, config, chunk, opts, code) {
+ const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(opts.format, config.isWorker);
+ let match;
+ let s;
+ // Urls added with JS using e.g.
+ // imgElement.src = "__VITE_ASSET__5aa0ddc0__" are using quotes
+ // Urls added in CSS that is imported in JS end up like
+ // var inlined = ".inlined{color:green;background:url(__VITE_ASSET__5aa0ddc0__)}\n";
+ // In both cases, the wrapping should already be fine
+ assetUrlRE.lastIndex = 0;
+ while ((match = assetUrlRE.exec(code))) {
+ s || (s = new MagicString(code));
+ const [full, referenceId, postfix = ''] = match;
+ const file = ctx.getFileName(referenceId);
+ chunk.viteMetadata.importedAssets.add(cleanUrl(file));
+ const filename = file + postfix;
+ const replacement = toOutputFilePathInJS(filename, 'asset', chunk.fileName, 'js', config, toRelativeRuntime);
+ const replacementString = typeof replacement === 'string'
+ ? JSON.stringify(replacement).slice(1, -1)
+ : `"+${replacement.runtime}+"`;
+ s.update(match.index, match.index + full.length, replacementString);
+ }
+ // Replace __VITE_PUBLIC_ASSET__5aa0ddc0__ with absolute paths
+ const publicAssetUrlMap = publicAssetUrlCache.get(config);
+ publicAssetUrlRE.lastIndex = 0;
+ while ((match = publicAssetUrlRE.exec(code))) {
+ s || (s = new MagicString(code));
+ const [full, hash] = match;
+ const publicUrl = publicAssetUrlMap.get(hash).slice(1);
+ const replacement = toOutputFilePathInJS(publicUrl, 'public', chunk.fileName, 'js', config, toRelativeRuntime);
+ const replacementString = typeof replacement === 'string'
+ ? JSON.stringify(replacement).slice(1, -1)
+ : `"+${replacement.runtime}+"`;
+ s.update(match.index, match.index + full.length, replacementString);
+ }
+ return s;
+}
+/**
+ * Also supports loading plain strings with import text from './foo.txt?raw'
+ */
+function assetPlugin(config) {
+ registerCustomMime();
+ return {
+ name: 'vite:asset',
+ buildStart() {
+ assetCache.set(config, new Map());
+ generatedAssets.set(config, new Map());
+ },
+ resolveId(id) {
+ if (!config.assetsInclude(cleanUrl(id)) && !urlRE.test(id)) {
+ return;
+ }
+ // imports to absolute urls pointing to files in /public
+ // will fail to resolve in the main resolver. handle them here.
+ const publicFile = checkPublicFile(id, config);
+ if (publicFile) {
+ return id;
+ }
+ },
+ async load(id) {
+ if (id[0] === '\0') {
+ // Rollup convention, this id should be handled by the
+ // plugin that marked it with \0
+ return;
+ }
+ // raw requests, read from disk
+ if (rawRE.test(id)) {
+ const file = checkPublicFile(id, config) || cleanUrl(id);
+ // raw query, read file and return as string
+ return `export default ${JSON.stringify(await fsp.readFile(file, 'utf-8'))}`;
+ }
+ if (!config.assetsInclude(cleanUrl(id)) && !urlRE.test(id)) {
+ return;
+ }
+ id = id.replace(urlRE, '$1').replace(unnededFinalQueryCharRE, '');
+ const url = await fileToUrl(id, config, this);
+ return `export default ${JSON.stringify(url)}`;
+ },
+ renderChunk(code, chunk, opts) {
+ const s = renderAssetUrlInJS(this, config, chunk, opts, code);
+ if (s) {
+ return {
+ code: s.toString(),
+ map: config.build.sourcemap
+ ? s.generateMap({ hires: 'boundary' })
+ : null,
+ };
+ }
+ else {
+ return null;
+ }
+ },
+ generateBundle(_, bundle) {
+ // do not emit assets for SSR build
+ if (config.command === 'build' &&
+ config.build.ssr &&
+ !config.build.ssrEmitAssets) {
+ for (const file in bundle) {
+ if (bundle[file].type === 'asset' &&
+ !file.endsWith('ssr-manifest.json') &&
+ !jsSourceMapRE.test(file)) {
+ delete bundle[file];
+ }
+ }
+ }
+ },
+ };
+}
+function checkPublicFile(url, { publicDir }) {
+ // note if the file is in /public, the resolver would have returned it
+ // as-is so it's not going to be a fully resolved path.
+ if (!publicDir || url[0] !== '/') {
+ return;
+ }
+ const publicFile = path$o.join(publicDir, cleanUrl(url));
+ if (!publicFile.startsWith(publicDir)) {
+ // can happen if URL starts with '../'
+ return;
+ }
+ if (fs$l.existsSync(publicFile)) {
+ return publicFile;
+ }
+ else {
+ return;
+ }
+}
+async function fileToUrl(id, config, ctx) {
+ if (config.command === 'serve') {
+ return fileToDevUrl(id, config);
+ }
+ else {
+ return fileToBuiltUrl(id, config, ctx);
+ }
+}
+function fileToDevUrl(id, config) {
+ let rtn;
+ if (checkPublicFile(id, config)) {
+ // in public dir, keep the url as-is
+ rtn = id;
+ }
+ else if (id.startsWith(config.root)) {
+ // in project root, infer short public path
+ rtn = '/' + path$o.posix.relative(config.root, id);
+ }
+ else {
+ // outside of project root, use absolute fs path
+ // (this is special handled by the serve static middleware
+ rtn = path$o.posix.join(FS_PREFIX, id);
+ }
+ const base = joinUrlSegments(config.server?.origin ?? '', config.base);
+ return joinUrlSegments(base, removeLeadingSlash(rtn));
+}
+function getPublicAssetFilename(hash, config) {
+ return publicAssetUrlCache.get(config)?.get(hash);
+}
+const publicAssetUrlCache = new WeakMap();
+const publicAssetUrlRE = /__VITE_PUBLIC_ASSET__([a-z\d]{8})__/g;
+function publicFileToBuiltUrl(url, config) {
+ if (config.command !== 'build') {
+ // We don't need relative base or renderBuiltUrl support during dev
+ return joinUrlSegments(config.base, url);
+ }
+ const hash = getHash(url);
+ let cache = publicAssetUrlCache.get(config);
+ if (!cache) {
+ cache = new Map();
+ publicAssetUrlCache.set(config, cache);
+ }
+ if (!cache.get(hash)) {
+ cache.set(hash, url);
+ }
+ return `__VITE_PUBLIC_ASSET__${hash}__`;
+}
+const GIT_LFS_PREFIX = Buffer$1.from('version https://git-lfs.github.com');
+function isGitLfsPlaceholder(content) {
+ if (content.length < GIT_LFS_PREFIX.length)
+ return false;
+ // Check whether the content begins with the characteristic string of Git LFS placeholders
+ return GIT_LFS_PREFIX.compare(content, 0, GIT_LFS_PREFIX.length) === 0;
+}
+/**
+ * Register an asset to be emitted as part of the bundle (if necessary)
+ * and returns the resolved public URL
+ */
+async function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false) {
+ if (!skipPublicCheck && checkPublicFile(id, config)) {
+ return publicFileToBuiltUrl(id, config);
+ }
+ const cache = assetCache.get(config);
+ const cached = cache.get(id);
+ if (cached) {
+ return cached;
+ }
+ const file = cleanUrl(id);
+ const content = await fsp.readFile(file);
+ let url;
+ if (config.build.lib ||
+ (!file.endsWith('.svg') &&
+ !file.endsWith('.html') &&
+ content.length < Number(config.build.assetsInlineLimit) &&
+ !isGitLfsPlaceholder(content))) {
+ if (config.build.lib && isGitLfsPlaceholder(content)) {
+ config.logger.warn(colors$1.yellow(`Inlined file ${id} was not downloaded via Git LFS`));
+ }
+ const mimeType = lookup(file) ?? 'application/octet-stream';
+ // base64 inlined as a string
+ url = `data:${mimeType};base64,${content.toString('base64')}`;
+ }
+ else {
+ // emit as asset
+ const { search, hash } = parse$i(id);
+ const postfix = (search || '') + (hash || '');
+ const referenceId = pluginContext.emitFile({
+ // Ignore directory structure for asset file names
+ name: path$o.basename(file),
+ type: 'asset',
+ source: content,
+ });
+ const originalName = normalizePath$3(path$o.relative(config.root, file));
+ generatedAssets.get(config).set(referenceId, { originalName });
+ url = `__VITE_ASSET__${referenceId}__${postfix ? `$_${postfix}__` : ``}`; // TODO_BASE
+ }
+ cache.set(id, url);
+ return url;
+}
+async function urlToBuiltUrl(url, importer, config, pluginContext) {
+ if (checkPublicFile(url, config)) {
+ return publicFileToBuiltUrl(url, config);
+ }
+ const file = url[0] === '/'
+ ? path$o.join(config.root, url)
+ : path$o.join(path$o.dirname(importer), url);
+ return fileToBuiltUrl(file, config, pluginContext,
+ // skip public check since we just did it above
+ true);
+}
+
+function manifestPlugin(config) {
+ const manifest = {};
+ let outputCount;
+ return {
+ name: 'vite:manifest',
+ buildStart() {
+ outputCount = 0;
+ },
+ generateBundle({ format }, bundle) {
+ function getChunkName(chunk) {
+ if (chunk.facadeModuleId) {
+ let name = normalizePath$3(path$o.relative(config.root, chunk.facadeModuleId));
+ if (format === 'system' && !chunk.name.includes('-legacy')) {
+ const ext = path$o.extname(name);
+ const endPos = ext.length !== 0 ? -ext.length : undefined;
+ name = name.slice(0, endPos) + `-legacy` + ext;
+ }
+ return name.replace(/\0/g, '');
+ }
+ else {
+ return `_` + path$o.basename(chunk.fileName);
+ }
+ }
+ function getInternalImports(imports) {
+ const filteredImports = [];
+ for (const file of imports) {
+ if (bundle[file] === undefined) {
+ continue;
+ }
+ filteredImports.push(getChunkName(bundle[file]));
+ }
+ return filteredImports;
+ }
+ function createChunk(chunk) {
+ const manifestChunk = {
+ file: chunk.fileName,
+ };
+ if (chunk.facadeModuleId) {
+ manifestChunk.src = getChunkName(chunk);
+ }
+ if (chunk.isEntry) {
+ manifestChunk.isEntry = true;
+ }
+ if (chunk.isDynamicEntry) {
+ manifestChunk.isDynamicEntry = true;
+ }
+ if (chunk.imports.length) {
+ const internalImports = getInternalImports(chunk.imports);
+ if (internalImports.length > 0) {
+ manifestChunk.imports = internalImports;
+ }
+ }
+ if (chunk.dynamicImports.length) {
+ const internalImports = getInternalImports(chunk.dynamicImports);
+ if (internalImports.length > 0) {
+ manifestChunk.dynamicImports = internalImports;
+ }
+ }
+ if (chunk.viteMetadata?.importedCss.size) {
+ manifestChunk.css = [...chunk.viteMetadata.importedCss];
+ }
+ if (chunk.viteMetadata?.importedAssets.size) {
+ manifestChunk.assets = [...chunk.viteMetadata.importedAssets];
+ }
+ return manifestChunk;
+ }
+ function createAsset(asset, src, isEntry) {
+ const manifestChunk = {
+ file: asset.fileName,
+ src,
+ };
+ if (isEntry)
+ manifestChunk.isEntry = true;
+ return manifestChunk;
+ }
+ const fileNameToAssetMeta = new Map();
+ const assets = generatedAssets.get(config);
+ assets.forEach((asset, referenceId) => {
+ const fileName = this.getFileName(referenceId);
+ fileNameToAssetMeta.set(fileName, asset);
+ });
+ const fileNameToAsset = new Map();
+ for (const file in bundle) {
+ const chunk = bundle[file];
+ if (chunk.type === 'chunk') {
+ manifest[getChunkName(chunk)] = createChunk(chunk);
+ }
+ else if (chunk.type === 'asset' && typeof chunk.name === 'string') {
+ // Add every unique asset to the manifest, keyed by its original name
+ const assetMeta = fileNameToAssetMeta.get(chunk.fileName);
+ const src = assetMeta?.originalName ?? chunk.name;
+ const asset = createAsset(chunk, src, assetMeta?.isEntry);
+ manifest[src] = asset;
+ fileNameToAsset.set(chunk.fileName, asset);
+ }
+ }
+ // Add deduplicated assets to the manifest
+ assets.forEach(({ originalName }, referenceId) => {
+ if (!manifest[originalName]) {
+ const fileName = this.getFileName(referenceId);
+ const asset = fileNameToAsset.get(fileName);
+ if (asset) {
+ manifest[originalName] = asset;
+ }
+ }
+ });
+ outputCount++;
+ const output = config.build.rollupOptions?.output;
+ const outputLength = Array.isArray(output) ? output.length : 1;
+ if (outputCount >= outputLength) {
+ this.emitFile({
+ fileName: typeof config.build.manifest === 'string'
+ ? config.build.manifest
+ : 'manifest.json',
+ type: 'asset',
+ source: jsonStableStringify$1(manifest, { space: 2 }),
+ });
+ }
+ },
+ };
+}
+
+// This is based on @rollup/plugin-data-uri
+// MIT Licensed https://github.com/rollup/plugins/blob/master/LICENSE
+// ref https://github.com/vitejs/vite/issues/1428#issuecomment-757033808
+const dataUriRE = /^([^/]+\/[^;,]+)(;base64)?,([\s\S]*)$/;
+const base64RE = /base64/i;
+const dataUriPrefix = `\0/@data-uri/`;
+/**
+ * Build only, since importing from a data URI works natively.
+ */
+function dataURIPlugin() {
+ let resolved;
+ return {
+ name: 'vite:data-uri',
+ buildStart() {
+ resolved = new Map();
+ },
+ resolveId(id) {
+ if (!dataUriRE.test(id)) {
+ return;
+ }
+ const uri = new URL$3(id);
+ if (uri.protocol !== 'data:') {
+ return;
+ }
+ const match = uri.pathname.match(dataUriRE);
+ if (!match) {
+ return;
+ }
+ const [, mime, format, data] = match;
+ if (mime !== 'text/javascript') {
+ throw new Error(`data URI with non-JavaScript mime type is not supported. If you're using legacy JavaScript MIME types (such as 'application/javascript'), please use 'text/javascript' instead.`);
+ }
+ // decode data
+ const base64 = format && base64RE.test(format.substring(1));
+ const content = base64
+ ? Buffer.from(data, 'base64').toString('utf-8')
+ : data;
+ resolved.set(id, content);
+ return dataUriPrefix + id;
+ },
+ load(id) {
+ if (id.startsWith(dataUriPrefix)) {
+ return resolved.get(id.slice(dataUriPrefix.length));
+ }
+ },
+ };
+}
+
+/* es-module-lexer 1.3.0 */
+const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse$e(E,g="@"){if(!C)return init.then((()=>parse$e(E)));const I=E.length+1,o=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;o>0&&C.memory.grow(Math.ceil(o/65536));const D=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,D,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const K=[],k=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.ai(),g=C.id(),I=C.ss(),o=C.se();let D;C.ip()&&(D=J(E.slice(-1===g?A-1:A,-1===g?Q+1:Q))),K.push({n:D,s:A,e:Q,ss:I,se:o,d:g,a:B});}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),o=I[0],D=B<0?void 0:E.slice(B,g),K=D?D[0]:"";k.push({s:A,e:Q,ls:B,le:g,n:'"'===o||"'"===o?J(I):I,ln:'"'===K||"'"===K?J(D):D});}function J(A){try{return (0, eval)(A)}catch(A){}}return [K,k,!!C.f()]}function Q(A,Q){const B=A.length;let C=0;for(;C>>8;}}function B(A,Q){const B=A.length;let C=0;for(;CA.charCodeAt(0))))).then(WebAssembly.instantiate).then((({exports:A})=>{C=A;}));var E;
+
+var convertSourceMap$1 = {};
+
+(function (exports) {
+
+ Object.defineProperty(exports, 'commentRegex', {
+ get: function getCommentRegex () {
+ // Groups: 1: media type, 2: MIME type, 3: charset, 4: encoding, 5: data.
+ return /^\s*?\/[\/\*][@#]\s+?sourceMappingURL=data:(((?:application|text)\/json)(?:;charset=([^;,]+?)?)?)?(?:;(base64))?,(.*?)$/mg;
+ }
+ });
+
+
+ Object.defineProperty(exports, 'mapFileCommentRegex', {
+ get: function getMapFileCommentRegex () {
+ // Matches sourceMappingURL in either // or /* comment styles.
+ return /(?:\/\/[@#][ \t]+?sourceMappingURL=([^\s'"`]+?)[ \t]*?$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*?(?:\*\/){1}[ \t]*?$)/mg;
+ }
+ });
+
+ var decodeBase64;
+ if (typeof Buffer !== 'undefined') {
+ if (typeof Buffer.from === 'function') {
+ decodeBase64 = decodeBase64WithBufferFrom;
+ } else {
+ decodeBase64 = decodeBase64WithNewBuffer;
+ }
+ } else {
+ decodeBase64 = decodeBase64WithAtob;
+ }
+
+ function decodeBase64WithBufferFrom(base64) {
+ return Buffer.from(base64, 'base64').toString();
+ }
+
+ function decodeBase64WithNewBuffer(base64) {
+ if (typeof value === 'number') {
+ throw new TypeError('The value to decode must not be of type number.');
+ }
+ return new Buffer(base64, 'base64').toString();
+ }
+
+ function decodeBase64WithAtob(base64) {
+ return decodeURIComponent(escape(atob(base64)));
+ }
+
+ function stripComment(sm) {
+ return sm.split(',').pop();
+ }
+
+ function readFromFileMap(sm, read) {
+ var r = exports.mapFileCommentRegex.exec(sm);
+ // for some odd reason //# .. captures in 1 and /* .. */ in 2
+ var filename = r[1] || r[2];
+
+ try {
+ var sm = read(filename);
+ if (sm != null && typeof sm.catch === 'function') {
+ return sm.catch(throwError);
+ } else {
+ return sm;
+ }
+ } catch (e) {
+ throwError(e);
+ }
+
+ function throwError(e) {
+ throw new Error('An error occurred while trying to read the map file at ' + filename + '\n' + e.stack);
+ }
+ }
+
+ function Converter (sm, opts) {
+ opts = opts || {};
+
+ if (opts.hasComment) {
+ sm = stripComment(sm);
+ }
+
+ if (opts.encoding === 'base64') {
+ sm = decodeBase64(sm);
+ } else if (opts.encoding === 'uri') {
+ sm = decodeURIComponent(sm);
+ }
+
+ if (opts.isJSON || opts.encoding) {
+ sm = JSON.parse(sm);
+ }
+
+ this.sourcemap = sm;
+ }
+
+ Converter.prototype.toJSON = function (space) {
+ return JSON.stringify(this.sourcemap, null, space);
+ };
+
+ if (typeof Buffer !== 'undefined') {
+ if (typeof Buffer.from === 'function') {
+ Converter.prototype.toBase64 = encodeBase64WithBufferFrom;
+ } else {
+ Converter.prototype.toBase64 = encodeBase64WithNewBuffer;
+ }
+ } else {
+ Converter.prototype.toBase64 = encodeBase64WithBtoa;
+ }
+
+ function encodeBase64WithBufferFrom() {
+ var json = this.toJSON();
+ return Buffer.from(json, 'utf8').toString('base64');
+ }
+
+ function encodeBase64WithNewBuffer() {
+ var json = this.toJSON();
+ if (typeof json === 'number') {
+ throw new TypeError('The json to encode must not be of type number.');
+ }
+ return new Buffer(json, 'utf8').toString('base64');
+ }
+
+ function encodeBase64WithBtoa() {
+ var json = this.toJSON();
+ return btoa(unescape(encodeURIComponent(json)));
+ }
+
+ Converter.prototype.toURI = function () {
+ var json = this.toJSON();
+ return encodeURIComponent(json);
+ };
+
+ Converter.prototype.toComment = function (options) {
+ var encoding, content, data;
+ if (options != null && options.encoding === 'uri') {
+ encoding = '';
+ content = this.toURI();
+ } else {
+ encoding = ';base64';
+ content = this.toBase64();
+ }
+ data = 'sourceMappingURL=data:application/json;charset=utf-8' + encoding + ',' + content;
+ return options != null && options.multiline ? '/*# ' + data + ' */' : '//# ' + data;
+ };
+
+ // returns copy instead of original
+ Converter.prototype.toObject = function () {
+ return JSON.parse(this.toJSON());
+ };
+
+ Converter.prototype.addProperty = function (key, value) {
+ if (this.sourcemap.hasOwnProperty(key)) throw new Error('property "' + key + '" already exists on the sourcemap, use set property instead');
+ return this.setProperty(key, value);
+ };
+
+ Converter.prototype.setProperty = function (key, value) {
+ this.sourcemap[key] = value;
+ return this;
+ };
+
+ Converter.prototype.getProperty = function (key) {
+ return this.sourcemap[key];
+ };
+
+ exports.fromObject = function (obj) {
+ return new Converter(obj);
+ };
+
+ exports.fromJSON = function (json) {
+ return new Converter(json, { isJSON: true });
+ };
+
+ exports.fromURI = function (uri) {
+ return new Converter(uri, { encoding: 'uri' });
+ };
+
+ exports.fromBase64 = function (base64) {
+ return new Converter(base64, { encoding: 'base64' });
+ };
+
+ exports.fromComment = function (comment) {
+ var m, encoding;
+ comment = comment
+ .replace(/^\/\*/g, '//')
+ .replace(/\*\/$/g, '');
+ m = exports.commentRegex.exec(comment);
+ encoding = m && m[4] || 'uri';
+ return new Converter(comment, { encoding: encoding, hasComment: true });
+ };
+
+ function makeConverter(sm) {
+ return new Converter(sm, { isJSON: true });
+ }
+
+ exports.fromMapFileComment = function (comment, read) {
+ if (typeof read === 'string') {
+ throw new Error(
+ 'String directory paths are no longer supported with `fromMapFileComment`\n' +
+ 'Please review the Upgrading documentation at https://github.com/thlorenz/convert-source-map#upgrading'
+ )
+ }
+
+ var sm = readFromFileMap(comment, read);
+ if (sm != null && typeof sm.then === 'function') {
+ return sm.then(makeConverter);
+ } else {
+ return makeConverter(sm);
+ }
+ };
+
+ // Finds last sourcemap comment in file or returns null if none was found
+ exports.fromSource = function (content) {
+ var m = content.match(exports.commentRegex);
+ return m ? exports.fromComment(m.pop()) : null;
+ };
+
+ // Finds last sourcemap comment in file or returns null if none was found
+ exports.fromMapFileSource = function (content, read) {
+ if (typeof read === 'string') {
+ throw new Error(
+ 'String directory paths are no longer supported with `fromMapFileSource`\n' +
+ 'Please review the Upgrading documentation at https://github.com/thlorenz/convert-source-map#upgrading'
+ )
+ }
+ var m = content.match(exports.mapFileCommentRegex);
+ return m ? exports.fromMapFileComment(m.pop(), read) : null;
+ };
+
+ exports.removeComments = function (src) {
+ return src.replace(exports.commentRegex, '');
+ };
+
+ exports.removeMapFileComments = function (src) {
+ return src.replace(exports.mapFileCommentRegex, '');
+ };
+
+ exports.generateMapFileComment = function (file, options) {
+ var data = 'sourceMappingURL=' + file;
+ return options && options.multiline ? '/*# ' + data + ' */' : '//# ' + data;
+ };
+} (convertSourceMap$1));
+
+var convertSourceMap = /*@__PURE__*/getDefaultExportFromCjs(convertSourceMap$1);
+
+const debug$e = createDebugger('vite:sourcemap', {
+ onlyWhenFocused: true,
+});
+// Virtual modules should be prefixed with a null byte to avoid a
+// false positive "missing source" warning. We also check for certain
+// prefixes used for special handling in esbuildDepPlugin.
+const virtualSourceRE = /^(?:dep:|browser-external:|virtual:)|\0/;
+async function injectSourcesContent(map, file, logger) {
+ let sourceRoot;
+ try {
+ // The source root is undefined for virtual modules and permission errors.
+ sourceRoot = await fsp.realpath(path$o.resolve(path$o.dirname(file), map.sourceRoot || ''));
+ }
+ catch { }
+ const missingSources = [];
+ const sourcesContent = map.sourcesContent || [];
+ await Promise.all(map.sources.map(async (sourcePath, index) => {
+ let content = null;
+ if (sourcePath && !virtualSourceRE.test(sourcePath)) {
+ sourcePath = decodeURI(sourcePath);
+ if (sourceRoot) {
+ sourcePath = path$o.resolve(sourceRoot, sourcePath);
+ }
+ // inject content from source file when sourcesContent is null
+ content =
+ sourcesContent[index] ??
+ (await fsp.readFile(sourcePath, 'utf-8').catch(() => {
+ missingSources.push(sourcePath);
+ return null;
+ }));
+ }
+ sourcesContent[index] = content;
+ }));
+ map.sourcesContent = sourcesContent;
+ // Use this command…
+ // DEBUG="vite:sourcemap" vite build
+ // …to log the missing sources.
+ if (missingSources.length) {
+ logger.warnOnce(`Sourcemap for "${file}" points to missing source files`);
+ debug$e?.(`Missing sources:\n ` + missingSources.join(`\n `));
+ }
+}
+function genSourceMapUrl(map) {
+ if (typeof map !== 'string') {
+ map = JSON.stringify(map);
+ }
+ return `data:application/json;base64,${Buffer.from(map).toString('base64')}`;
+}
+function getCodeWithSourcemap(type, code, map) {
+ if (debug$e) {
+ code += `\n/*${JSON.stringify(map, null, 2).replace(/\*\//g, '*\\/')}*/\n`;
+ }
+ if (type === 'js') {
+ code += `\n//# sourceMappingURL=${genSourceMapUrl(map)}`;
+ }
+ else if (type === 'css') {
+ code += `\n/*# sourceMappingURL=${genSourceMapUrl(map)} */`;
+ }
+ return code;
+}
+function applySourcemapIgnoreList(map, sourcemapPath, sourcemapIgnoreList, logger) {
+ let { x_google_ignoreList } = map;
+ if (x_google_ignoreList === undefined) {
+ x_google_ignoreList = [];
+ }
+ for (let sourcesIndex = 0; sourcesIndex < map.sources.length; ++sourcesIndex) {
+ const sourcePath = map.sources[sourcesIndex];
+ if (!sourcePath)
+ continue;
+ const ignoreList = sourcemapIgnoreList(path$o.isAbsolute(sourcePath)
+ ? sourcePath
+ : path$o.resolve(path$o.dirname(sourcemapPath), sourcePath), sourcemapPath);
+ if (logger && typeof ignoreList !== 'boolean') {
+ logger.warn('sourcemapIgnoreList function must return a boolean.');
+ }
+ if (ignoreList && !x_google_ignoreList.includes(sourcesIndex)) {
+ x_google_ignoreList.push(sourcesIndex);
+ }
+ }
+ if (x_google_ignoreList.length > 0) {
+ if (!map.x_google_ignoreList)
+ map.x_google_ignoreList = x_google_ignoreList;
+ }
+}
+
+var tasks = {};
+
+var utils$g = {};
+
+var array$1 = {};
+
+Object.defineProperty(array$1, "__esModule", { value: true });
+array$1.splitWhen = array$1.flatten = void 0;
+function flatten$1(items) {
+ return items.reduce((collection, item) => [].concat(collection, item), []);
+}
+array$1.flatten = flatten$1;
+function splitWhen(items, predicate) {
+ const result = [[]];
+ let groupIndex = 0;
+ for (const item of items) {
+ if (predicate(item)) {
+ groupIndex++;
+ result[groupIndex] = [];
+ }
+ else {
+ result[groupIndex].push(item);
+ }
+ }
+ return result;
+}
+array$1.splitWhen = splitWhen;
+
+var errno$1 = {};
+
+Object.defineProperty(errno$1, "__esModule", { value: true });
+errno$1.isEnoentCodeError = void 0;
+function isEnoentCodeError(error) {
+ return error.code === 'ENOENT';
+}
+errno$1.isEnoentCodeError = isEnoentCodeError;
+
+var fs$h = {};
+
+Object.defineProperty(fs$h, "__esModule", { value: true });
+fs$h.createDirentFromStats = void 0;
+let DirentFromStats$1 = class DirentFromStats {
+ constructor(name, stats) {
+ this.name = name;
+ this.isBlockDevice = stats.isBlockDevice.bind(stats);
+ this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
+ this.isDirectory = stats.isDirectory.bind(stats);
+ this.isFIFO = stats.isFIFO.bind(stats);
+ this.isFile = stats.isFile.bind(stats);
+ this.isSocket = stats.isSocket.bind(stats);
+ this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
+ }
+};
+function createDirentFromStats$1(name, stats) {
+ return new DirentFromStats$1(name, stats);
+}
+fs$h.createDirentFromStats = createDirentFromStats$1;
+
+var path$h = {};
+
+Object.defineProperty(path$h, "__esModule", { value: true });
+path$h.convertPosixPathToPattern = path$h.convertWindowsPathToPattern = path$h.convertPathToPattern = path$h.escapePosixPath = path$h.escapeWindowsPath = path$h.escape = path$h.removeLeadingDotSegment = path$h.makeAbsolute = path$h.unixify = void 0;
+const os$3 = require$$2;
+const path$g = require$$0$4;
+const IS_WINDOWS_PLATFORM = os$3.platform() === 'win32';
+const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
+/**
+ * All non-escaped special characters.
+ * Posix: ()*?[\]{|}, !+@ before (, ! at the beginning, \\ before non-special characters.
+ * Windows: (){}, !+@ before (, ! at the beginning.
+ */
+const POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
+const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([(){}]|^!|[!+@](?=\())/g;
+/**
+ * The device path (\\.\ or \\?\).
+ * https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths
+ */
+const DOS_DEVICE_PATH_RE = /^\\\\([.?])/;
+/**
+ * All backslashes except those escaping special characters.
+ * Windows: !()+@{}
+ * https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
+ */
+const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@{}])/g;
+/**
+ * Designed to work only with simple paths: `dir\\file`.
+ */
+function unixify(filepath) {
+ return filepath.replace(/\\/g, '/');
+}
+path$h.unixify = unixify;
+function makeAbsolute(cwd, filepath) {
+ return path$g.resolve(cwd, filepath);
+}
+path$h.makeAbsolute = makeAbsolute;
+function removeLeadingDotSegment(entry) {
+ // We do not use `startsWith` because this is 10x slower than current implementation for some cases.
+ // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
+ if (entry.charAt(0) === '.') {
+ const secondCharactery = entry.charAt(1);
+ if (secondCharactery === '/' || secondCharactery === '\\') {
+ return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
+ }
+ }
+ return entry;
+}
+path$h.removeLeadingDotSegment = removeLeadingDotSegment;
+path$h.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
+function escapeWindowsPath(pattern) {
+ return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
+}
+path$h.escapeWindowsPath = escapeWindowsPath;
+function escapePosixPath(pattern) {
+ return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
+}
+path$h.escapePosixPath = escapePosixPath;
+path$h.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
+function convertWindowsPathToPattern(filepath) {
+ return escapeWindowsPath(filepath)
+ .replace(DOS_DEVICE_PATH_RE, '//$1')
+ .replace(WINDOWS_BACKSLASHES_RE, '/');
+}
+path$h.convertWindowsPathToPattern = convertWindowsPathToPattern;
+function convertPosixPathToPattern(filepath) {
+ return escapePosixPath(filepath);
+}
+path$h.convertPosixPathToPattern = convertPosixPathToPattern;
+
+var pattern$1 = {};
+
+/*!
+ * is-extglob
+ *
+ * Copyright (c) 2014-2016, Jon Schlinkert.
+ * Licensed under the MIT License.
+ */
+
+var isExtglob$1 = function isExtglob(str) {
+ if (typeof str !== 'string' || str === '') {
+ return false;
+ }
+
+ var match;
+ while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) {
+ if (match[2]) return true;
+ str = str.slice(match.index + match[0].length);
+ }
+
+ return false;
+};
+
+/*!
+ * is-glob
+ *
+ * Copyright (c) 2014-2017, Jon Schlinkert.
+ * Released under the MIT License.
+ */
+
+var isExtglob = isExtglob$1;
+var chars = { '{': '}', '(': ')', '[': ']'};
+var strictCheck = function(str) {
+ if (str[0] === '!') {
+ return true;
+ }
+ var index = 0;
+ var pipeIndex = -2;
+ var closeSquareIndex = -2;
+ var closeCurlyIndex = -2;
+ var closeParenIndex = -2;
+ var backSlashIndex = -2;
+ while (index < str.length) {
+ if (str[index] === '*') {
+ return true;
+ }
+
+ if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) {
+ return true;
+ }
+
+ if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') {
+ if (closeSquareIndex < index) {
+ closeSquareIndex = str.indexOf(']', index);
+ }
+ if (closeSquareIndex > index) {
+ if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
+ return true;
+ }
+ backSlashIndex = str.indexOf('\\', index);
+ if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
+ return true;
+ }
+ }
+ }
+
+ if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') {
+ closeCurlyIndex = str.indexOf('}', index);
+ if (closeCurlyIndex > index) {
+ backSlashIndex = str.indexOf('\\', index);
+ if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) {
+ return true;
+ }
+ }
+ }
+
+ if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') {
+ closeParenIndex = str.indexOf(')', index);
+ if (closeParenIndex > index) {
+ backSlashIndex = str.indexOf('\\', index);
+ if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
+ return true;
+ }
+ }
+ }
+
+ if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') {
+ if (pipeIndex < index) {
+ pipeIndex = str.indexOf('|', index);
+ }
+ if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') {
+ closeParenIndex = str.indexOf(')', pipeIndex);
+ if (closeParenIndex > pipeIndex) {
+ backSlashIndex = str.indexOf('\\', pipeIndex);
+ if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
+ return true;
+ }
+ }
+ }
+ }
+
+ if (str[index] === '\\') {
+ var open = str[index + 1];
+ index += 2;
+ var close = chars[open];
+
+ if (close) {
+ var n = str.indexOf(close, index);
+ if (n !== -1) {
+ index = n + 1;
+ }
+ }
+
+ if (str[index] === '!') {
+ return true;
+ }
+ } else {
+ index++;
+ }
+ }
+ return false;
+};
+
+var relaxedCheck = function(str) {
+ if (str[0] === '!') {
+ return true;
+ }
+ var index = 0;
+ while (index < str.length) {
+ if (/[*?{}()[\]]/.test(str[index])) {
+ return true;
+ }
+
+ if (str[index] === '\\') {
+ var open = str[index + 1];
+ index += 2;
+ var close = chars[open];
+
+ if (close) {
+ var n = str.indexOf(close, index);
+ if (n !== -1) {
+ index = n + 1;
+ }
+ }
+
+ if (str[index] === '!') {
+ return true;
+ }
+ } else {
+ index++;
+ }
+ }
+ return false;
+};
+
+var isGlob$2 = function isGlob(str, options) {
+ if (typeof str !== 'string' || str === '') {
+ return false;
+ }
+
+ if (isExtglob(str)) {
+ return true;
+ }
+
+ var check = strictCheck;
+
+ // optionally relax check
+ if (options && options.strict === false) {
+ check = relaxedCheck;
+ }
+
+ return check(str);
+};
+
+var isGlob$1 = isGlob$2;
+var pathPosixDirname = require$$0$4.posix.dirname;
+var isWin32 = require$$2.platform() === 'win32';
+
+var slash = '/';
+var backslash = /\\/g;
+var enclosure = /[\{\[].*[\}\]]$/;
+var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
+var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
+
+/**
+ * @param {string} str
+ * @param {Object} opts
+ * @param {boolean} [opts.flipBackslashes=true]
+ * @returns {string}
+ */
+var globParent$2 = function globParent(str, opts) {
+ var options = Object.assign({ flipBackslashes: true }, opts);
+
+ // flip windows path separators
+ if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
+ str = str.replace(backslash, slash);
+ }
+
+ // special case for strings ending in enclosure containing path separator
+ if (enclosure.test(str)) {
+ str += slash;
+ }
+
+ // preserves full path in case of trailing path separator
+ str += 'a';
+
+ // remove path parts that are globby
+ do {
+ str = pathPosixDirname(str);
+ } while (isGlob$1(str) || globby.test(str));
+
+ // remove escape chars and return result
+ return str.replace(escaped, '$1');
+};
+
+var utils$f = {};
+
+(function (exports) {
+
+ exports.isInteger = num => {
+ if (typeof num === 'number') {
+ return Number.isInteger(num);
+ }
+ if (typeof num === 'string' && num.trim() !== '') {
+ return Number.isInteger(Number(num));
+ }
+ return false;
+ };
+
+ /**
+ * Find a node of the given type
+ */
+
+ exports.find = (node, type) => node.nodes.find(node => node.type === type);
+
+ /**
+ * Find a node of the given type
+ */
+
+ exports.exceedsLimit = (min, max, step = 1, limit) => {
+ if (limit === false) return false;
+ if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
+ return ((Number(max) - Number(min)) / Number(step)) >= limit;
+ };
+
+ /**
+ * Escape the given node with '\\' before node.value
+ */
+
+ exports.escapeNode = (block, n = 0, type) => {
+ let node = block.nodes[n];
+ if (!node) return;
+
+ if ((type && node.type === type) || node.type === 'open' || node.type === 'close') {
+ if (node.escaped !== true) {
+ node.value = '\\' + node.value;
+ node.escaped = true;
+ }
+ }
+ };
+
+ /**
+ * Returns true if the given brace node should be enclosed in literal braces
+ */
+
+ exports.encloseBrace = node => {
+ if (node.type !== 'brace') return false;
+ if ((node.commas >> 0 + node.ranges >> 0) === 0) {
+ node.invalid = true;
+ return true;
+ }
+ return false;
+ };
+
+ /**
+ * Returns true if a brace node is invalid.
+ */
+
+ exports.isInvalidBrace = block => {
+ if (block.type !== 'brace') return false;
+ if (block.invalid === true || block.dollar) return true;
+ if ((block.commas >> 0 + block.ranges >> 0) === 0) {
+ block.invalid = true;
+ return true;
+ }
+ if (block.open !== true || block.close !== true) {
+ block.invalid = true;
+ return true;
+ }
+ return false;
+ };
+
+ /**
+ * Returns true if a node is an open or close node
+ */
+
+ exports.isOpenOrClose = node => {
+ if (node.type === 'open' || node.type === 'close') {
+ return true;
+ }
+ return node.open === true || node.close === true;
+ };
+
+ /**
+ * Reduce an array of text nodes.
+ */
+
+ exports.reduce = nodes => nodes.reduce((acc, node) => {
+ if (node.type === 'text') acc.push(node.value);
+ if (node.type === 'range') node.type = 'text';
+ return acc;
+ }, []);
+
+ /**
+ * Flatten an array
+ */
+
+ exports.flatten = (...args) => {
+ const result = [];
+ const flat = arr => {
+ for (let i = 0; i < arr.length; i++) {
+ let ele = arr[i];
+ Array.isArray(ele) ? flat(ele) : ele !== void 0 && result.push(ele);
+ }
+ return result;
+ };
+ flat(args);
+ return result;
+ };
+} (utils$f));
+
+const utils$e = utils$f;
+
+var stringify$7 = (ast, options = {}) => {
+ let stringify = (node, parent = {}) => {
+ let invalidBlock = options.escapeInvalid && utils$e.isInvalidBrace(parent);
+ let invalidNode = node.invalid === true && options.escapeInvalid === true;
+ let output = '';
+
+ if (node.value) {
+ if ((invalidBlock || invalidNode) && utils$e.isOpenOrClose(node)) {
+ return '\\' + node.value;
+ }
+ return node.value;
+ }
+
+ if (node.value) {
+ return node.value;
+ }
+
+ if (node.nodes) {
+ for (let child of node.nodes) {
+ output += stringify(child);
+ }
+ }
+ return output;
+ };
+
+ return stringify(ast);
+};
+
+/*!
+ * is-number
+ *
+ * Copyright (c) 2014-present, Jon Schlinkert.
+ * Released under the MIT License.
+ */
+
+var isNumber$2 = function(num) {
+ if (typeof num === 'number') {
+ return num - num === 0;
+ }
+ if (typeof num === 'string' && num.trim() !== '') {
+ return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
+ }
+ return false;
+};
+
+/*!
+ * to-regex-range
+ *
+ * Copyright (c) 2015-present, Jon Schlinkert.
+ * Released under the MIT License.
+ */
+
+const isNumber$1 = isNumber$2;
+
+const toRegexRange$1 = (min, max, options) => {
+ if (isNumber$1(min) === false) {
+ throw new TypeError('toRegexRange: expected the first argument to be a number');
+ }
+
+ if (max === void 0 || min === max) {
+ return String(min);
+ }
+
+ if (isNumber$1(max) === false) {
+ throw new TypeError('toRegexRange: expected the second argument to be a number.');
+ }
+
+ let opts = { relaxZeros: true, ...options };
+ if (typeof opts.strictZeros === 'boolean') {
+ opts.relaxZeros = opts.strictZeros === false;
+ }
+
+ let relax = String(opts.relaxZeros);
+ let shorthand = String(opts.shorthand);
+ let capture = String(opts.capture);
+ let wrap = String(opts.wrap);
+ let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap;
+
+ if (toRegexRange$1.cache.hasOwnProperty(cacheKey)) {
+ return toRegexRange$1.cache[cacheKey].result;
+ }
+
+ let a = Math.min(min, max);
+ let b = Math.max(min, max);
+
+ if (Math.abs(a - b) === 1) {
+ let result = min + '|' + max;
+ if (opts.capture) {
+ return `(${result})`;
+ }
+ if (opts.wrap === false) {
+ return result;
+ }
+ return `(?:${result})`;
+ }
+
+ let isPadded = hasPadding(min) || hasPadding(max);
+ let state = { min, max, a, b };
+ let positives = [];
+ let negatives = [];
+
+ if (isPadded) {
+ state.isPadded = isPadded;
+ state.maxLen = String(state.max).length;
+ }
+
+ if (a < 0) {
+ let newMin = b < 0 ? Math.abs(b) : 1;
+ negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
+ a = state.a = 0;
+ }
+
+ if (b >= 0) {
+ positives = splitToPatterns(a, b, state, opts);
+ }
+
+ state.negatives = negatives;
+ state.positives = positives;
+ state.result = collatePatterns(negatives, positives);
+
+ if (opts.capture === true) {
+ state.result = `(${state.result})`;
+ } else if (opts.wrap !== false && (positives.length + negatives.length) > 1) {
+ state.result = `(?:${state.result})`;
+ }
+
+ toRegexRange$1.cache[cacheKey] = state;
+ return state.result;
+};
+
+function collatePatterns(neg, pos, options) {
+ let onlyNegative = filterPatterns(neg, pos, '-', false) || [];
+ let onlyPositive = filterPatterns(pos, neg, '', false) || [];
+ let intersected = filterPatterns(neg, pos, '-?', true) || [];
+ let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
+ return subpatterns.join('|');
+}
+
+function splitToRanges(min, max) {
+ let nines = 1;
+ let zeros = 1;
+
+ let stop = countNines(min, nines);
+ let stops = new Set([max]);
+
+ while (min <= stop && stop <= max) {
+ stops.add(stop);
+ nines += 1;
+ stop = countNines(min, nines);
+ }
+
+ stop = countZeros(max + 1, zeros) - 1;
+
+ while (min < stop && stop <= max) {
+ stops.add(stop);
+ zeros += 1;
+ stop = countZeros(max + 1, zeros) - 1;
+ }
+
+ stops = [...stops];
+ stops.sort(compare);
+ return stops;
+}
+
+/**
+ * Convert a range to a regex pattern
+ * @param {Number} `start`
+ * @param {Number} `stop`
+ * @return {String}
+ */
+
+function rangeToPattern(start, stop, options) {
+ if (start === stop) {
+ return { pattern: start, count: [], digits: 0 };
+ }
+
+ let zipped = zip(start, stop);
+ let digits = zipped.length;
+ let pattern = '';
+ let count = 0;
+
+ for (let i = 0; i < digits; i++) {
+ let [startDigit, stopDigit] = zipped[i];
+
+ if (startDigit === stopDigit) {
+ pattern += startDigit;
+
+ } else if (startDigit !== '0' || stopDigit !== '9') {
+ pattern += toCharacterClass(startDigit, stopDigit);
+
+ } else {
+ count++;
+ }
+ }
+
+ if (count) {
+ pattern += options.shorthand === true ? '\\d' : '[0-9]';
+ }
+
+ return { pattern, count: [count], digits };
+}
+
+function splitToPatterns(min, max, tok, options) {
+ let ranges = splitToRanges(min, max);
+ let tokens = [];
+ let start = min;
+ let prev;
+
+ for (let i = 0; i < ranges.length; i++) {
+ let max = ranges[i];
+ let obj = rangeToPattern(String(start), String(max), options);
+ let zeros = '';
+
+ if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
+ if (prev.count.length > 1) {
+ prev.count.pop();
+ }
+
+ prev.count.push(obj.count[0]);
+ prev.string = prev.pattern + toQuantifier(prev.count);
+ start = max + 1;
+ continue;
+ }
+
+ if (tok.isPadded) {
+ zeros = padZeros(max, tok, options);
+ }
+
+ obj.string = zeros + obj.pattern + toQuantifier(obj.count);
+ tokens.push(obj);
+ start = max + 1;
+ prev = obj;
+ }
+
+ return tokens;
+}
+
+function filterPatterns(arr, comparison, prefix, intersection, options) {
+ let result = [];
+
+ for (let ele of arr) {
+ let { string } = ele;
+
+ // only push if _both_ are negative...
+ if (!intersection && !contains(comparison, 'string', string)) {
+ result.push(prefix + string);
+ }
+
+ // or _both_ are positive
+ if (intersection && contains(comparison, 'string', string)) {
+ result.push(prefix + string);
+ }
+ }
+ return result;
+}
+
+/**
+ * Zip strings
+ */
+
+function zip(a, b) {
+ let arr = [];
+ for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]);
+ return arr;
+}
+
+function compare(a, b) {
+ return a > b ? 1 : b > a ? -1 : 0;
+}
+
+function contains(arr, key, val) {
+ return arr.some(ele => ele[key] === val);
+}
+
+function countNines(min, len) {
+ return Number(String(min).slice(0, -len) + '9'.repeat(len));
+}
+
+function countZeros(integer, zeros) {
+ return integer - (integer % Math.pow(10, zeros));
+}
+
+function toQuantifier(digits) {
+ let [start = 0, stop = ''] = digits;
+ if (stop || start > 1) {
+ return `{${start + (stop ? ',' + stop : '')}}`;
+ }
+ return '';
+}
+
+function toCharacterClass(a, b, options) {
+ return `[${a}${(b - a === 1) ? '' : '-'}${b}]`;
+}
+
+function hasPadding(str) {
+ return /^-?(0+)\d/.test(str);
+}
+
+function padZeros(value, tok, options) {
+ if (!tok.isPadded) {
+ return value;
+ }
+
+ let diff = Math.abs(tok.maxLen - String(value).length);
+ let relax = options.relaxZeros !== false;
+
+ switch (diff) {
+ case 0:
+ return '';
+ case 1:
+ return relax ? '0?' : '0';
+ case 2:
+ return relax ? '0{0,2}' : '00';
+ default: {
+ return relax ? `0{0,${diff}}` : `0{${diff}}`;
+ }
+ }
+}
+
+/**
+ * Cache
+ */
+
+toRegexRange$1.cache = {};
+toRegexRange$1.clearCache = () => (toRegexRange$1.cache = {});
+
+/**
+ * Expose `toRegexRange`
+ */
+
+var toRegexRange_1 = toRegexRange$1;
+
+/*!
+ * fill-range
+ *
+ * Copyright (c) 2014-present, Jon Schlinkert.
+ * Licensed under the MIT License.
+ */
+
+const util$1 = require$$0$6;
+const toRegexRange = toRegexRange_1;
+
+const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
+
+const transform = toNumber => {
+ return value => toNumber === true ? Number(value) : String(value);
+};
+
+const isValidValue = value => {
+ return typeof value === 'number' || (typeof value === 'string' && value !== '');
+};
+
+const isNumber = num => Number.isInteger(+num);
+
+const zeros = input => {
+ let value = `${input}`;
+ let index = -1;
+ if (value[0] === '-') value = value.slice(1);
+ if (value === '0') return false;
+ while (value[++index] === '0');
+ return index > 0;
+};
+
+const stringify$6 = (start, end, options) => {
+ if (typeof start === 'string' || typeof end === 'string') {
+ return true;
+ }
+ return options.stringify === true;
+};
+
+const pad = (input, maxLength, toNumber) => {
+ if (maxLength > 0) {
+ let dash = input[0] === '-' ? '-' : '';
+ if (dash) input = input.slice(1);
+ input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0'));
+ }
+ if (toNumber === false) {
+ return String(input);
+ }
+ return input;
+};
+
+const toMaxLen = (input, maxLength) => {
+ let negative = input[0] === '-' ? '-' : '';
+ if (negative) {
+ input = input.slice(1);
+ maxLength--;
+ }
+ while (input.length < maxLength) input = '0' + input;
+ return negative ? ('-' + input) : input;
+};
+
+const toSequence = (parts, options) => {
+ parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
+ parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
+
+ let prefix = options.capture ? '' : '?:';
+ let positives = '';
+ let negatives = '';
+ let result;
+
+ if (parts.positives.length) {
+ positives = parts.positives.join('|');
+ }
+
+ if (parts.negatives.length) {
+ negatives = `-(${prefix}${parts.negatives.join('|')})`;
+ }
+
+ if (positives && negatives) {
+ result = `${positives}|${negatives}`;
+ } else {
+ result = positives || negatives;
+ }
+
+ if (options.wrap) {
+ return `(${prefix}${result})`;
+ }
+
+ return result;
+};
+
+const toRange = (a, b, isNumbers, options) => {
+ if (isNumbers) {
+ return toRegexRange(a, b, { wrap: false, ...options });
+ }
+
+ let start = String.fromCharCode(a);
+ if (a === b) return start;
+
+ let stop = String.fromCharCode(b);
+ return `[${start}-${stop}]`;
+};
+
+const toRegex = (start, end, options) => {
+ if (Array.isArray(start)) {
+ let wrap = options.wrap === true;
+ let prefix = options.capture ? '' : '?:';
+ return wrap ? `(${prefix}${start.join('|')})` : start.join('|');
+ }
+ return toRegexRange(start, end, options);
+};
+
+const rangeError = (...args) => {
+ return new RangeError('Invalid range arguments: ' + util$1.inspect(...args));
+};
+
+const invalidRange = (start, end, options) => {
+ if (options.strictRanges === true) throw rangeError([start, end]);
+ return [];
+};
+
+const invalidStep = (step, options) => {
+ if (options.strictRanges === true) {
+ throw new TypeError(`Expected step "${step}" to be a number`);
+ }
+ return [];
+};
+
+const fillNumbers = (start, end, step = 1, options = {}) => {
+ let a = Number(start);
+ let b = Number(end);
+
+ if (!Number.isInteger(a) || !Number.isInteger(b)) {
+ if (options.strictRanges === true) throw rangeError([start, end]);
+ return [];
+ }
+
+ // fix negative zero
+ if (a === 0) a = 0;
+ if (b === 0) b = 0;
+
+ let descending = a > b;
+ let startString = String(start);
+ let endString = String(end);
+ let stepString = String(step);
+ step = Math.max(Math.abs(step), 1);
+
+ let padded = zeros(startString) || zeros(endString) || zeros(stepString);
+ let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
+ let toNumber = padded === false && stringify$6(start, end, options) === false;
+ let format = options.transform || transform(toNumber);
+
+ if (options.toRegex && step === 1) {
+ return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
+ }
+
+ let parts = { negatives: [], positives: [] };
+ let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num));
+ let range = [];
+ let index = 0;
+
+ while (descending ? a >= b : a <= b) {
+ if (options.toRegex === true && step > 1) {
+ push(a);
+ } else {
+ range.push(pad(format(a, index), maxLen, toNumber));
+ }
+ a = descending ? a - step : a + step;
+ index++;
+ }
+
+ if (options.toRegex === true) {
+ return step > 1
+ ? toSequence(parts, options)
+ : toRegex(range, null, { wrap: false, ...options });
+ }
+
+ return range;
+};
+
+const fillLetters = (start, end, step = 1, options = {}) => {
+ if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) {
+ return invalidRange(start, end, options);
+ }
+
+
+ let format = options.transform || (val => String.fromCharCode(val));
+ let a = `${start}`.charCodeAt(0);
+ let b = `${end}`.charCodeAt(0);
+
+ let descending = a > b;
+ let min = Math.min(a, b);
+ let max = Math.max(a, b);
+
+ if (options.toRegex && step === 1) {
+ return toRange(min, max, false, options);
+ }
+
+ let range = [];
+ let index = 0;
+
+ while (descending ? a >= b : a <= b) {
+ range.push(format(a, index));
+ a = descending ? a - step : a + step;
+ index++;
+ }
+
+ if (options.toRegex === true) {
+ return toRegex(range, null, { wrap: false, options });
+ }
+
+ return range;
+};
+
+const fill$2 = (start, end, step, options = {}) => {
+ if (end == null && isValidValue(start)) {
+ return [start];
+ }
+
+ if (!isValidValue(start) || !isValidValue(end)) {
+ return invalidRange(start, end, options);
+ }
+
+ if (typeof step === 'function') {
+ return fill$2(start, end, 1, { transform: step });
+ }
+
+ if (isObject(step)) {
+ return fill$2(start, end, 0, step);
+ }
+
+ let opts = { ...options };
+ if (opts.capture === true) opts.wrap = true;
+ step = step || opts.step || 1;
+
+ if (!isNumber(step)) {
+ if (step != null && !isObject(step)) return invalidStep(step, opts);
+ return fill$2(start, end, 1, step);
+ }
+
+ if (isNumber(start) && isNumber(end)) {
+ return fillNumbers(start, end, step, opts);
+ }
+
+ return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
+};
+
+var fillRange = fill$2;
+
+const fill$1 = fillRange;
+const utils$d = utils$f;
+
+const compile$1 = (ast, options = {}) => {
+ let walk = (node, parent = {}) => {
+ let invalidBlock = utils$d.isInvalidBrace(parent);
+ let invalidNode = node.invalid === true && options.escapeInvalid === true;
+ let invalid = invalidBlock === true || invalidNode === true;
+ let prefix = options.escapeInvalid === true ? '\\' : '';
+ let output = '';
+
+ if (node.isOpen === true) {
+ return prefix + node.value;
+ }
+ if (node.isClose === true) {
+ return prefix + node.value;
+ }
+
+ if (node.type === 'open') {
+ return invalid ? (prefix + node.value) : '(';
+ }
+
+ if (node.type === 'close') {
+ return invalid ? (prefix + node.value) : ')';
+ }
+
+ if (node.type === 'comma') {
+ return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|');
+ }
+
+ if (node.value) {
+ return node.value;
+ }
+
+ if (node.nodes && node.ranges > 0) {
+ let args = utils$d.reduce(node.nodes);
+ let range = fill$1(...args, { ...options, wrap: false, toRegex: true });
+
+ if (range.length !== 0) {
+ return args.length > 1 && range.length > 1 ? `(${range})` : range;
+ }
+ }
+
+ if (node.nodes) {
+ for (let child of node.nodes) {
+ output += walk(child, node);
+ }
+ }
+ return output;
+ };
+
+ return walk(ast);
+};
+
+var compile_1 = compile$1;
+
+const fill = fillRange;
+const stringify$5 = stringify$7;
+const utils$c = utils$f;
+
+const append$1 = (queue = '', stash = '', enclose = false) => {
+ let result = [];
+
+ queue = [].concat(queue);
+ stash = [].concat(stash);
+
+ if (!stash.length) return queue;
+ if (!queue.length) {
+ return enclose ? utils$c.flatten(stash).map(ele => `{${ele}}`) : stash;
+ }
+
+ for (let item of queue) {
+ if (Array.isArray(item)) {
+ for (let value of item) {
+ result.push(append$1(value, stash, enclose));
+ }
+ } else {
+ for (let ele of stash) {
+ if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
+ result.push(Array.isArray(ele) ? append$1(item, ele, enclose) : (item + ele));
+ }
+ }
+ }
+ return utils$c.flatten(result);
+};
+
+const expand$2 = (ast, options = {}) => {
+ let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit;
+
+ let walk = (node, parent = {}) => {
+ node.queue = [];
+
+ let p = parent;
+ let q = parent.queue;
+
+ while (p.type !== 'brace' && p.type !== 'root' && p.parent) {
+ p = p.parent;
+ q = p.queue;
+ }
+
+ if (node.invalid || node.dollar) {
+ q.push(append$1(q.pop(), stringify$5(node, options)));
+ return;
+ }
+
+ if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) {
+ q.push(append$1(q.pop(), ['{}']));
+ return;
+ }
+
+ if (node.nodes && node.ranges > 0) {
+ let args = utils$c.reduce(node.nodes);
+
+ if (utils$c.exceedsLimit(...args, options.step, rangeLimit)) {
+ throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
+ }
+
+ let range = fill(...args, options);
+ if (range.length === 0) {
+ range = stringify$5(node, options);
+ }
+
+ q.push(append$1(q.pop(), range));
+ node.nodes = [];
+ return;
+ }
+
+ let enclose = utils$c.encloseBrace(node);
+ let queue = node.queue;
+ let block = node;
+
+ while (block.type !== 'brace' && block.type !== 'root' && block.parent) {
+ block = block.parent;
+ queue = block.queue;
+ }
+
+ for (let i = 0; i < node.nodes.length; i++) {
+ let child = node.nodes[i];
+
+ if (child.type === 'comma' && node.type === 'brace') {
+ if (i === 1) queue.push('');
+ queue.push('');
+ continue;
+ }
+
+ if (child.type === 'close') {
+ q.push(append$1(q.pop(), queue, enclose));
+ continue;
+ }
+
+ if (child.value && child.type !== 'open') {
+ queue.push(append$1(queue.pop(), child.value));
+ continue;
+ }
+
+ if (child.nodes) {
+ walk(child, node);
+ }
+ }
+
+ return queue;
+ };
+
+ return utils$c.flatten(walk(ast));
+};
+
+var expand_1$1 = expand$2;
+
+var constants$3 = {
+ MAX_LENGTH: 1024 * 64,
+
+ // Digits
+ CHAR_0: '0', /* 0 */
+ CHAR_9: '9', /* 9 */
+
+ // Alphabet chars.
+ CHAR_UPPERCASE_A: 'A', /* A */
+ CHAR_LOWERCASE_A: 'a', /* a */
+ CHAR_UPPERCASE_Z: 'Z', /* Z */
+ CHAR_LOWERCASE_Z: 'z', /* z */
+
+ CHAR_LEFT_PARENTHESES: '(', /* ( */
+ CHAR_RIGHT_PARENTHESES: ')', /* ) */
+
+ CHAR_ASTERISK: '*', /* * */
+
+ // Non-alphabetic chars.
+ CHAR_AMPERSAND: '&', /* & */
+ CHAR_AT: '@', /* @ */
+ CHAR_BACKSLASH: '\\', /* \ */
+ CHAR_BACKTICK: '`', /* ` */
+ CHAR_CARRIAGE_RETURN: '\r', /* \r */
+ CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */
+ CHAR_COLON: ':', /* : */
+ CHAR_COMMA: ',', /* , */
+ CHAR_DOLLAR: '$', /* . */
+ CHAR_DOT: '.', /* . */
+ CHAR_DOUBLE_QUOTE: '"', /* " */
+ CHAR_EQUAL: '=', /* = */
+ CHAR_EXCLAMATION_MARK: '!', /* ! */
+ CHAR_FORM_FEED: '\f', /* \f */
+ CHAR_FORWARD_SLASH: '/', /* / */
+ CHAR_HASH: '#', /* # */
+ CHAR_HYPHEN_MINUS: '-', /* - */
+ CHAR_LEFT_ANGLE_BRACKET: '<', /* < */
+ CHAR_LEFT_CURLY_BRACE: '{', /* { */
+ CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */
+ CHAR_LINE_FEED: '\n', /* \n */
+ CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */
+ CHAR_PERCENT: '%', /* % */
+ CHAR_PLUS: '+', /* + */
+ CHAR_QUESTION_MARK: '?', /* ? */
+ CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */
+ CHAR_RIGHT_CURLY_BRACE: '}', /* } */
+ CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */
+ CHAR_SEMICOLON: ';', /* ; */
+ CHAR_SINGLE_QUOTE: '\'', /* ' */
+ CHAR_SPACE: ' ', /* */
+ CHAR_TAB: '\t', /* \t */
+ CHAR_UNDERSCORE: '_', /* _ */
+ CHAR_VERTICAL_LINE: '|', /* | */
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */
+};
+
+const stringify$4 = stringify$7;
+
+/**
+ * Constants
+ */
+
+const {
+ MAX_LENGTH,
+ CHAR_BACKSLASH, /* \ */
+ CHAR_BACKTICK, /* ` */
+ CHAR_COMMA, /* , */
+ CHAR_DOT, /* . */
+ CHAR_LEFT_PARENTHESES, /* ( */
+ CHAR_RIGHT_PARENTHESES, /* ) */
+ CHAR_LEFT_CURLY_BRACE, /* { */
+ CHAR_RIGHT_CURLY_BRACE, /* } */
+ CHAR_LEFT_SQUARE_BRACKET, /* [ */
+ CHAR_RIGHT_SQUARE_BRACKET, /* ] */
+ CHAR_DOUBLE_QUOTE, /* " */
+ CHAR_SINGLE_QUOTE, /* ' */
+ CHAR_NO_BREAK_SPACE,
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE
+} = constants$3;
+
+/**
+ * parse
+ */
+
+const parse$d = (input, options = {}) => {
+ if (typeof input !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+
+ let opts = options || {};
+ let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
+ if (input.length > max) {
+ throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
+ }
+
+ let ast = { type: 'root', input, nodes: [] };
+ let stack = [ast];
+ let block = ast;
+ let prev = ast;
+ let brackets = 0;
+ let length = input.length;
+ let index = 0;
+ let depth = 0;
+ let value;
+
+ /**
+ * Helpers
+ */
+
+ const advance = () => input[index++];
+ const push = node => {
+ if (node.type === 'text' && prev.type === 'dot') {
+ prev.type = 'text';
+ }
+
+ if (prev && prev.type === 'text' && node.type === 'text') {
+ prev.value += node.value;
+ return;
+ }
+
+ block.nodes.push(node);
+ node.parent = block;
+ node.prev = prev;
+ prev = node;
+ return node;
+ };
+
+ push({ type: 'bos' });
+
+ while (index < length) {
+ block = stack[stack.length - 1];
+ value = advance();
+
+ /**
+ * Invalid chars
+ */
+
+ if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
+ continue;
+ }
+
+ /**
+ * Escaped chars
+ */
+
+ if (value === CHAR_BACKSLASH) {
+ push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() });
+ continue;
+ }
+
+ /**
+ * Right square bracket (literal): ']'
+ */
+
+ if (value === CHAR_RIGHT_SQUARE_BRACKET) {
+ push({ type: 'text', value: '\\' + value });
+ continue;
+ }
+
+ /**
+ * Left square bracket: '['
+ */
+
+ if (value === CHAR_LEFT_SQUARE_BRACKET) {
+ brackets++;
+ let next;
+
+ while (index < length && (next = advance())) {
+ value += next;
+
+ if (next === CHAR_LEFT_SQUARE_BRACKET) {
+ brackets++;
+ continue;
+ }
+
+ if (next === CHAR_BACKSLASH) {
+ value += advance();
+ continue;
+ }
+
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
+ brackets--;
+
+ if (brackets === 0) {
+ break;
+ }
+ }
+ }
+
+ push({ type: 'text', value });
+ continue;
+ }
+
+ /**
+ * Parentheses
+ */
+
+ if (value === CHAR_LEFT_PARENTHESES) {
+ block = push({ type: 'paren', nodes: [] });
+ stack.push(block);
+ push({ type: 'text', value });
+ continue;
+ }
+
+ if (value === CHAR_RIGHT_PARENTHESES) {
+ if (block.type !== 'paren') {
+ push({ type: 'text', value });
+ continue;
+ }
+ block = stack.pop();
+ push({ type: 'text', value });
+ block = stack[stack.length - 1];
+ continue;
+ }
+
+ /**
+ * Quotes: '|"|`
+ */
+
+ if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
+ let open = value;
+ let next;
+
+ if (options.keepQuotes !== true) {
+ value = '';
+ }
+
+ while (index < length && (next = advance())) {
+ if (next === CHAR_BACKSLASH) {
+ value += next + advance();
+ continue;
+ }
+
+ if (next === open) {
+ if (options.keepQuotes === true) value += next;
+ break;
+ }
+
+ value += next;
+ }
+
+ push({ type: 'text', value });
+ continue;
+ }
+
+ /**
+ * Left curly brace: '{'
+ */
+
+ if (value === CHAR_LEFT_CURLY_BRACE) {
+ depth++;
+
+ let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
+ let brace = {
+ type: 'brace',
+ open: true,
+ close: false,
+ dollar,
+ depth,
+ commas: 0,
+ ranges: 0,
+ nodes: []
+ };
+
+ block = push(brace);
+ stack.push(block);
+ push({ type: 'open', value });
+ continue;
+ }
+
+ /**
+ * Right curly brace: '}'
+ */
+
+ if (value === CHAR_RIGHT_CURLY_BRACE) {
+ if (block.type !== 'brace') {
+ push({ type: 'text', value });
+ continue;
+ }
+
+ let type = 'close';
+ block = stack.pop();
+ block.close = true;
+
+ push({ type, value });
+ depth--;
+
+ block = stack[stack.length - 1];
+ continue;
+ }
+
+ /**
+ * Comma: ','
+ */
+
+ if (value === CHAR_COMMA && depth > 0) {
+ if (block.ranges > 0) {
+ block.ranges = 0;
+ let open = block.nodes.shift();
+ block.nodes = [open, { type: 'text', value: stringify$4(block) }];
+ }
+
+ push({ type: 'comma', value });
+ block.commas++;
+ continue;
+ }
+
+ /**
+ * Dot: '.'
+ */
+
+ if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
+ let siblings = block.nodes;
+
+ if (depth === 0 || siblings.length === 0) {
+ push({ type: 'text', value });
+ continue;
+ }
+
+ if (prev.type === 'dot') {
+ block.range = [];
+ prev.value += value;
+ prev.type = 'range';
+
+ if (block.nodes.length !== 3 && block.nodes.length !== 5) {
+ block.invalid = true;
+ block.ranges = 0;
+ prev.type = 'text';
+ continue;
+ }
+
+ block.ranges++;
+ block.args = [];
+ continue;
+ }
+
+ if (prev.type === 'range') {
+ siblings.pop();
+
+ let before = siblings[siblings.length - 1];
+ before.value += prev.value + value;
+ prev = before;
+ block.ranges--;
+ continue;
+ }
+
+ push({ type: 'dot', value });
+ continue;
+ }
+
+ /**
+ * Text
+ */
+
+ push({ type: 'text', value });
+ }
+
+ // Mark imbalanced braces and brackets as invalid
+ do {
+ block = stack.pop();
+
+ if (block.type !== 'root') {
+ block.nodes.forEach(node => {
+ if (!node.nodes) {
+ if (node.type === 'open') node.isOpen = true;
+ if (node.type === 'close') node.isClose = true;
+ if (!node.nodes) node.type = 'text';
+ node.invalid = true;
+ }
+ });
+
+ // get the location of the block on parent.nodes (block's siblings)
+ let parent = stack[stack.length - 1];
+ let index = parent.nodes.indexOf(block);
+ // replace the (invalid) block with it's nodes
+ parent.nodes.splice(index, 1, ...block.nodes);
+ }
+ } while (stack.length > 0);
+
+ push({ type: 'eos' });
+ return ast;
+};
+
+var parse_1$2 = parse$d;
+
+const stringify$3 = stringify$7;
+const compile = compile_1;
+const expand$1 = expand_1$1;
+const parse$c = parse_1$2;
+
+/**
+ * Expand the given pattern or create a regex-compatible string.
+ *
+ * ```js
+ * const braces = require('braces');
+ * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
+ * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
+ * ```
+ * @param {String} `str`
+ * @param {Object} `options`
+ * @return {String}
+ * @api public
+ */
+
+const braces$2 = (input, options = {}) => {
+ let output = [];
+
+ if (Array.isArray(input)) {
+ for (let pattern of input) {
+ let result = braces$2.create(pattern, options);
+ if (Array.isArray(result)) {
+ output.push(...result);
+ } else {
+ output.push(result);
+ }
+ }
+ } else {
+ output = [].concat(braces$2.create(input, options));
+ }
+
+ if (options && options.expand === true && options.nodupes === true) {
+ output = [...new Set(output)];
+ }
+ return output;
+};
+
+/**
+ * Parse the given `str` with the given `options`.
+ *
+ * ```js
+ * // braces.parse(pattern, [, options]);
+ * const ast = braces.parse('a/{b,c}/d');
+ * console.log(ast);
+ * ```
+ * @param {String} pattern Brace pattern to parse
+ * @param {Object} options
+ * @return {Object} Returns an AST
+ * @api public
+ */
+
+braces$2.parse = (input, options = {}) => parse$c(input, options);
+
+/**
+ * Creates a braces string from an AST, or an AST node.
+ *
+ * ```js
+ * const braces = require('braces');
+ * let ast = braces.parse('foo/{a,b}/bar');
+ * console.log(stringify(ast.nodes[2])); //=> '{a,b}'
+ * ```
+ * @param {String} `input` Brace pattern or AST.
+ * @param {Object} `options`
+ * @return {Array} Returns an array of expanded values.
+ * @api public
+ */
+
+braces$2.stringify = (input, options = {}) => {
+ if (typeof input === 'string') {
+ return stringify$3(braces$2.parse(input, options), options);
+ }
+ return stringify$3(input, options);
+};
+
+/**
+ * Compiles a brace pattern into a regex-compatible, optimized string.
+ * This method is called by the main [braces](#braces) function by default.
+ *
+ * ```js
+ * const braces = require('braces');
+ * console.log(braces.compile('a/{b,c}/d'));
+ * //=> ['a/(b|c)/d']
+ * ```
+ * @param {String} `input` Brace pattern or AST.
+ * @param {Object} `options`
+ * @return {Array} Returns an array of expanded values.
+ * @api public
+ */
+
+braces$2.compile = (input, options = {}) => {
+ if (typeof input === 'string') {
+ input = braces$2.parse(input, options);
+ }
+ return compile(input, options);
+};
+
+/**
+ * Expands a brace pattern into an array. This method is called by the
+ * main [braces](#braces) function when `options.expand` is true. Before
+ * using this method it's recommended that you read the [performance notes](#performance))
+ * and advantages of using [.compile](#compile) instead.
+ *
+ * ```js
+ * const braces = require('braces');
+ * console.log(braces.expand('a/{b,c}/d'));
+ * //=> ['a/b/d', 'a/c/d'];
+ * ```
+ * @param {String} `pattern` Brace pattern
+ * @param {Object} `options`
+ * @return {Array} Returns an array of expanded values.
+ * @api public
+ */
+
+braces$2.expand = (input, options = {}) => {
+ if (typeof input === 'string') {
+ input = braces$2.parse(input, options);
+ }
+
+ let result = expand$1(input, options);
+
+ // filter out empty strings if specified
+ if (options.noempty === true) {
+ result = result.filter(Boolean);
+ }
+
+ // filter out duplicates if specified
+ if (options.nodupes === true) {
+ result = [...new Set(result)];
+ }
+
+ return result;
+};
+
+/**
+ * Processes a brace pattern and returns either an expanded array
+ * (if `options.expand` is true), a highly optimized regex-compatible string.
+ * This method is called by the main [braces](#braces) function.
+ *
+ * ```js
+ * const braces = require('braces');
+ * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
+ * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
+ * ```
+ * @param {String} `pattern` Brace pattern
+ * @param {Object} `options`
+ * @return {Array} Returns an array of expanded values.
+ * @api public
+ */
+
+braces$2.create = (input, options = {}) => {
+ if (input === '' || input.length < 3) {
+ return [input];
+ }
+
+ return options.expand !== true
+ ? braces$2.compile(input, options)
+ : braces$2.expand(input, options);
+};
+
+/**
+ * Expose "braces"
+ */
+
+var braces_1 = braces$2;
+
+const util = require$$0$6;
+const braces$1 = braces_1;
+const picomatch$2 = picomatch$3;
+const utils$b = utils$k;
+const isEmptyString = val => val === '' || val === './';
+
+/**
+ * Returns an array of strings that match one or more glob patterns.
+ *
+ * ```js
+ * const mm = require('micromatch');
+ * // mm(list, patterns[, options]);
+ *
+ * console.log(mm(['a.js', 'a.txt'], ['*.js']));
+ * //=> [ 'a.js' ]
+ * ```
+ * @param {String|Array} `list` List of strings to match.
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
+ * @param {Object} `options` See available [options](#options)
+ * @return {Array} Returns an array of matches
+ * @summary false
+ * @api public
+ */
+
+const micromatch$1 = (list, patterns, options) => {
+ patterns = [].concat(patterns);
+ list = [].concat(list);
+
+ let omit = new Set();
+ let keep = new Set();
+ let items = new Set();
+ let negatives = 0;
+
+ let onResult = state => {
+ items.add(state.output);
+ if (options && options.onResult) {
+ options.onResult(state);
+ }
+ };
+
+ for (let i = 0; i < patterns.length; i++) {
+ let isMatch = picomatch$2(String(patterns[i]), { ...options, onResult }, true);
+ let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
+ if (negated) negatives++;
+
+ for (let item of list) {
+ let matched = isMatch(item, true);
+
+ let match = negated ? !matched.isMatch : matched.isMatch;
+ if (!match) continue;
+
+ if (negated) {
+ omit.add(matched.output);
+ } else {
+ omit.delete(matched.output);
+ keep.add(matched.output);
+ }
+ }
+ }
+
+ let result = negatives === patterns.length ? [...items] : [...keep];
+ let matches = result.filter(item => !omit.has(item));
+
+ if (options && matches.length === 0) {
+ if (options.failglob === true) {
+ throw new Error(`No matches found for "${patterns.join(', ')}"`);
+ }
+
+ if (options.nonull === true || options.nullglob === true) {
+ return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns;
+ }
+ }
+
+ return matches;
+};
+
+/**
+ * Backwards compatibility
+ */
+
+micromatch$1.match = micromatch$1;
+
+/**
+ * Returns a matcher function from the given glob `pattern` and `options`.
+ * The returned function takes a string to match as its only argument and returns
+ * true if the string is a match.
+ *
+ * ```js
+ * const mm = require('micromatch');
+ * // mm.matcher(pattern[, options]);
+ *
+ * const isMatch = mm.matcher('*.!(*a)');
+ * console.log(isMatch('a.a')); //=> false
+ * console.log(isMatch('a.b')); //=> true
+ * ```
+ * @param {String} `pattern` Glob pattern
+ * @param {Object} `options`
+ * @return {Function} Returns a matcher function.
+ * @api public
+ */
+
+micromatch$1.matcher = (pattern, options) => picomatch$2(pattern, options);
+
+/**
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
+ *
+ * ```js
+ * const mm = require('micromatch');
+ * // mm.isMatch(string, patterns[, options]);
+ *
+ * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true
+ * console.log(mm.isMatch('a.a', 'b.*')); //=> false
+ * ```
+ * @param {String} `str` The string to test.
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
+ * @param {Object} `[options]` See available [options](#options).
+ * @return {Boolean} Returns true if any patterns match `str`
+ * @api public
+ */
+
+micromatch$1.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
+
+/**
+ * Backwards compatibility
+ */
+
+micromatch$1.any = micromatch$1.isMatch;
+
+/**
+ * Returns a list of strings that _**do not match any**_ of the given `patterns`.
+ *
+ * ```js
+ * const mm = require('micromatch');
+ * // mm.not(list, patterns[, options]);
+ *
+ * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
+ * //=> ['b.b', 'c.c']
+ * ```
+ * @param {Array} `list` Array of strings to match.
+ * @param {String|Array} `patterns` One or more glob pattern to use for matching.
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
+ * @return {Array} Returns an array of strings that **do not match** the given patterns.
+ * @api public
+ */
+
+micromatch$1.not = (list, patterns, options = {}) => {
+ patterns = [].concat(patterns).map(String);
+ let result = new Set();
+ let items = [];
+
+ let onResult = state => {
+ if (options.onResult) options.onResult(state);
+ items.push(state.output);
+ };
+
+ let matches = new Set(micromatch$1(list, patterns, { ...options, onResult }));
+
+ for (let item of items) {
+ if (!matches.has(item)) {
+ result.add(item);
+ }
+ }
+ return [...result];
+};
+
+/**
+ * Returns true if the given `string` contains the given pattern. Similar
+ * to [.isMatch](#isMatch) but the pattern can match any part of the string.
+ *
+ * ```js
+ * var mm = require('micromatch');
+ * // mm.contains(string, pattern[, options]);
+ *
+ * console.log(mm.contains('aa/bb/cc', '*b'));
+ * //=> true
+ * console.log(mm.contains('aa/bb/cc', '*d'));
+ * //=> false
+ * ```
+ * @param {String} `str` The string to match.
+ * @param {String|Array} `patterns` Glob pattern to use for matching.
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
+ * @return {Boolean} Returns true if any of the patterns matches any part of `str`.
+ * @api public
+ */
+
+micromatch$1.contains = (str, pattern, options) => {
+ if (typeof str !== 'string') {
+ throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
+ }
+
+ if (Array.isArray(pattern)) {
+ return pattern.some(p => micromatch$1.contains(str, p, options));
+ }
+
+ if (typeof pattern === 'string') {
+ if (isEmptyString(str) || isEmptyString(pattern)) {
+ return false;
+ }
+
+ if (str.includes(pattern) || (str.startsWith('./') && str.slice(2).includes(pattern))) {
+ return true;
+ }
+ }
+
+ return micromatch$1.isMatch(str, pattern, { ...options, contains: true });
+};
+
+/**
+ * Filter the keys of the given object with the given `glob` pattern
+ * and `options`. Does not attempt to match nested keys. If you need this feature,
+ * use [glob-object][] instead.
+ *
+ * ```js
+ * const mm = require('micromatch');
+ * // mm.matchKeys(object, patterns[, options]);
+ *
+ * const obj = { aa: 'a', ab: 'b', ac: 'c' };
+ * console.log(mm.matchKeys(obj, '*b'));
+ * //=> { ab: 'b' }
+ * ```
+ * @param {Object} `object` The object with keys to filter.
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
+ * @return {Object} Returns an object with only keys that match the given patterns.
+ * @api public
+ */
+
+micromatch$1.matchKeys = (obj, patterns, options) => {
+ if (!utils$b.isObject(obj)) {
+ throw new TypeError('Expected the first argument to be an object');
+ }
+ let keys = micromatch$1(Object.keys(obj), patterns, options);
+ let res = {};
+ for (let key of keys) res[key] = obj[key];
+ return res;
+};
+
+/**
+ * Returns true if some of the strings in the given `list` match any of the given glob `patterns`.
+ *
+ * ```js
+ * const mm = require('micromatch');
+ * // mm.some(list, patterns[, options]);
+ *
+ * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
+ * // true
+ * console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
+ * // false
+ * ```
+ * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
+ * @return {Boolean} Returns true if any `patterns` matches any of the strings in `list`
+ * @api public
+ */
+
+micromatch$1.some = (list, patterns, options) => {
+ let items = [].concat(list);
+
+ for (let pattern of [].concat(patterns)) {
+ let isMatch = picomatch$2(String(pattern), options);
+ if (items.some(item => isMatch(item))) {
+ return true;
+ }
+ }
+ return false;
+};
+
+/**
+ * Returns true if every string in the given `list` matches
+ * any of the given glob `patterns`.
+ *
+ * ```js
+ * const mm = require('micromatch');
+ * // mm.every(list, patterns[, options]);
+ *
+ * console.log(mm.every('foo.js', ['foo.js']));
+ * // true
+ * console.log(mm.every(['foo.js', 'bar.js'], ['*.js']));
+ * // true
+ * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
+ * // false
+ * console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
+ * // false
+ * ```
+ * @param {String|Array} `list` The string or array of strings to test.
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
+ * @return {Boolean} Returns true if all `patterns` matches all of the strings in `list`
+ * @api public
+ */
+
+micromatch$1.every = (list, patterns, options) => {
+ let items = [].concat(list);
+
+ for (let pattern of [].concat(patterns)) {
+ let isMatch = picomatch$2(String(pattern), options);
+ if (!items.every(item => isMatch(item))) {
+ return false;
+ }
+ }
+ return true;
+};
+
+/**
+ * Returns true if **all** of the given `patterns` match
+ * the specified string.
+ *
+ * ```js
+ * const mm = require('micromatch');
+ * // mm.all(string, patterns[, options]);
+ *
+ * console.log(mm.all('foo.js', ['foo.js']));
+ * // true
+ *
+ * console.log(mm.all('foo.js', ['*.js', '!foo.js']));
+ * // false
+ *
+ * console.log(mm.all('foo.js', ['*.js', 'foo.js']));
+ * // true
+ *
+ * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
+ * // true
+ * ```
+ * @param {String|Array} `str` The string to test.
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
+ * @return {Boolean} Returns true if any patterns match `str`
+ * @api public
+ */
+
+micromatch$1.all = (str, patterns, options) => {
+ if (typeof str !== 'string') {
+ throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
+ }
+
+ return [].concat(patterns).every(p => picomatch$2(p, options)(str));
+};
+
+/**
+ * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match.
+ *
+ * ```js
+ * const mm = require('micromatch');
+ * // mm.capture(pattern, string[, options]);
+ *
+ * console.log(mm.capture('test/*.js', 'test/foo.js'));
+ * //=> ['foo']
+ * console.log(mm.capture('test/*.js', 'foo/bar.css'));
+ * //=> null
+ * ```
+ * @param {String} `glob` Glob pattern to use for matching.
+ * @param {String} `input` String to match
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
+ * @return {Array|null} Returns an array of captures if the input matches the glob pattern, otherwise `null`.
+ * @api public
+ */
+
+micromatch$1.capture = (glob, input, options) => {
+ let posix = utils$b.isWindows(options);
+ let regex = picomatch$2.makeRe(String(glob), { ...options, capture: true });
+ let match = regex.exec(posix ? utils$b.toPosixSlashes(input) : input);
+
+ if (match) {
+ return match.slice(1).map(v => v === void 0 ? '' : v);
+ }
+};
+
+/**
+ * Create a regular expression from the given glob `pattern`.
+ *
+ * ```js
+ * const mm = require('micromatch');
+ * // mm.makeRe(pattern[, options]);
+ *
+ * console.log(mm.makeRe('*.js'));
+ * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
+ * ```
+ * @param {String} `pattern` A glob pattern to convert to regex.
+ * @param {Object} `options`
+ * @return {RegExp} Returns a regex created from the given pattern.
+ * @api public
+ */
+
+micromatch$1.makeRe = (...args) => picomatch$2.makeRe(...args);
+
+/**
+ * Scan a glob pattern to separate the pattern into segments. Used
+ * by the [split](#split) method.
+ *
+ * ```js
+ * const mm = require('micromatch');
+ * const state = mm.scan(pattern[, options]);
+ * ```
+ * @param {String} `pattern`
+ * @param {Object} `options`
+ * @return {Object} Returns an object with
+ * @api public
+ */
+
+micromatch$1.scan = (...args) => picomatch$2.scan(...args);
+
+/**
+ * Parse a glob pattern to create the source string for a regular
+ * expression.
+ *
+ * ```js
+ * const mm = require('micromatch');
+ * const state = mm.parse(pattern[, options]);
+ * ```
+ * @param {String} `glob`
+ * @param {Object} `options`
+ * @return {Object} Returns an object with useful properties and output to be used as regex source string.
+ * @api public
+ */
+
+micromatch$1.parse = (patterns, options) => {
+ let res = [];
+ for (let pattern of [].concat(patterns || [])) {
+ for (let str of braces$1(String(pattern), options)) {
+ res.push(picomatch$2.parse(str, options));
+ }
+ }
+ return res;
+};
+
+/**
+ * Process the given brace `pattern`.
+ *
+ * ```js
+ * const { braces } = require('micromatch');
+ * console.log(braces('foo/{a,b,c}/bar'));
+ * //=> [ 'foo/(a|b|c)/bar' ]
+ *
+ * console.log(braces('foo/{a,b,c}/bar', { expand: true }));
+ * //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ]
+ * ```
+ * @param {String} `pattern` String with brace pattern to process.
+ * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options.
+ * @return {Array}
+ * @api public
+ */
+
+micromatch$1.braces = (pattern, options) => {
+ if (typeof pattern !== 'string') throw new TypeError('Expected a string');
+ if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) {
+ return [pattern];
+ }
+ return braces$1(pattern, options);
+};
+
+/**
+ * Expand braces
+ */
+
+micromatch$1.braceExpand = (pattern, options) => {
+ if (typeof pattern !== 'string') throw new TypeError('Expected a string');
+ return micromatch$1.braces(pattern, { ...options, expand: true });
+};
+
+/**
+ * Expose micromatch
+ */
+
+var micromatch_1 = micromatch$1;
+
+var micromatch$2 = /*@__PURE__*/getDefaultExportFromCjs(micromatch_1);
+
+Object.defineProperty(pattern$1, "__esModule", { value: true });
+pattern$1.removeDuplicateSlashes = pattern$1.matchAny = pattern$1.convertPatternsToRe = pattern$1.makeRe = pattern$1.getPatternParts = pattern$1.expandBraceExpansion = pattern$1.expandPatternsWithBraceExpansion = pattern$1.isAffectDepthOfReadingPattern = pattern$1.endsWithSlashGlobStar = pattern$1.hasGlobStar = pattern$1.getBaseDirectory = pattern$1.isPatternRelatedToParentDirectory = pattern$1.getPatternsOutsideCurrentDirectory = pattern$1.getPatternsInsideCurrentDirectory = pattern$1.getPositivePatterns = pattern$1.getNegativePatterns = pattern$1.isPositivePattern = pattern$1.isNegativePattern = pattern$1.convertToNegativePattern = pattern$1.convertToPositivePattern = pattern$1.isDynamicPattern = pattern$1.isStaticPattern = void 0;
+const path$f = require$$0$4;
+const globParent$1 = globParent$2;
+const micromatch = micromatch_1;
+const GLOBSTAR$1 = '**';
+const ESCAPE_SYMBOL = '\\';
+const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
+const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
+const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
+const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
+const BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
+/**
+ * Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string.
+ * The latter is due to the presence of the device path at the beginning of the UNC path.
+ */
+const DOUBLE_SLASH_RE$1 = /(?!^)\/{2,}/g;
+function isStaticPattern(pattern, options = {}) {
+ return !isDynamicPattern(pattern, options);
+}
+pattern$1.isStaticPattern = isStaticPattern;
+function isDynamicPattern(pattern, options = {}) {
+ /**
+ * A special case with an empty string is necessary for matching patterns that start with a forward slash.
+ * An empty string cannot be a dynamic pattern.
+ * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'.
+ */
+ if (pattern === '') {
+ return false;
+ }
+ /**
+ * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check
+ * filepath directly (without read directory).
+ */
+ if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
+ return true;
+ }
+ if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
+ return true;
+ }
+ if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
+ return true;
+ }
+ if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
+ return true;
+ }
+ return false;
+}
+pattern$1.isDynamicPattern = isDynamicPattern;
+function hasBraceExpansion(pattern) {
+ const openingBraceIndex = pattern.indexOf('{');
+ if (openingBraceIndex === -1) {
+ return false;
+ }
+ const closingBraceIndex = pattern.indexOf('}', openingBraceIndex + 1);
+ if (closingBraceIndex === -1) {
+ return false;
+ }
+ const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
+ return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
+}
+function convertToPositivePattern(pattern) {
+ return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
+}
+pattern$1.convertToPositivePattern = convertToPositivePattern;
+function convertToNegativePattern(pattern) {
+ return '!' + pattern;
+}
+pattern$1.convertToNegativePattern = convertToNegativePattern;
+function isNegativePattern(pattern) {
+ return pattern.startsWith('!') && pattern[1] !== '(';
+}
+pattern$1.isNegativePattern = isNegativePattern;
+function isPositivePattern(pattern) {
+ return !isNegativePattern(pattern);
+}
+pattern$1.isPositivePattern = isPositivePattern;
+function getNegativePatterns(patterns) {
+ return patterns.filter(isNegativePattern);
+}
+pattern$1.getNegativePatterns = getNegativePatterns;
+function getPositivePatterns$1(patterns) {
+ return patterns.filter(isPositivePattern);
+}
+pattern$1.getPositivePatterns = getPositivePatterns$1;
+/**
+ * Returns patterns that can be applied inside the current directory.
+ *
+ * @example
+ * // ['./*', '*', 'a/*']
+ * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
+ */
+function getPatternsInsideCurrentDirectory(patterns) {
+ return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
+}
+pattern$1.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
+/**
+ * Returns patterns to be expanded relative to (outside) the current directory.
+ *
+ * @example
+ * // ['../*', './../*']
+ * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
+ */
+function getPatternsOutsideCurrentDirectory(patterns) {
+ return patterns.filter(isPatternRelatedToParentDirectory);
+}
+pattern$1.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
+function isPatternRelatedToParentDirectory(pattern) {
+ return pattern.startsWith('..') || pattern.startsWith('./..');
+}
+pattern$1.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
+function getBaseDirectory(pattern) {
+ return globParent$1(pattern, { flipBackslashes: false });
+}
+pattern$1.getBaseDirectory = getBaseDirectory;
+function hasGlobStar(pattern) {
+ return pattern.includes(GLOBSTAR$1);
+}
+pattern$1.hasGlobStar = hasGlobStar;
+function endsWithSlashGlobStar(pattern) {
+ return pattern.endsWith('/' + GLOBSTAR$1);
+}
+pattern$1.endsWithSlashGlobStar = endsWithSlashGlobStar;
+function isAffectDepthOfReadingPattern(pattern) {
+ const basename = path$f.basename(pattern);
+ return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
+}
+pattern$1.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
+function expandPatternsWithBraceExpansion(patterns) {
+ return patterns.reduce((collection, pattern) => {
+ return collection.concat(expandBraceExpansion(pattern));
+ }, []);
+}
+pattern$1.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
+function expandBraceExpansion(pattern) {
+ const patterns = micromatch.braces(pattern, { expand: true, nodupes: true });
+ /**
+ * Sort the patterns by length so that the same depth patterns are processed side by side.
+ * `a/{b,}/{c,}/*` – `['a///*', 'a/b//*', 'a//c/*', 'a/b/c/*']`
+ */
+ patterns.sort((a, b) => a.length - b.length);
+ /**
+ * Micromatch can return an empty string in the case of patterns like `{a,}`.
+ */
+ return patterns.filter((pattern) => pattern !== '');
+}
+pattern$1.expandBraceExpansion = expandBraceExpansion;
+function getPatternParts(pattern, options) {
+ let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true }));
+ /**
+ * The scan method returns an empty array in some cases.
+ * See micromatch/picomatch#58 for more details.
+ */
+ if (parts.length === 0) {
+ parts = [pattern];
+ }
+ /**
+ * The scan method does not return an empty part for the pattern with a forward slash.
+ * This is another part of micromatch/picomatch#58.
+ */
+ if (parts[0].startsWith('/')) {
+ parts[0] = parts[0].slice(1);
+ parts.unshift('');
+ }
+ return parts;
+}
+pattern$1.getPatternParts = getPatternParts;
+function makeRe(pattern, options) {
+ return micromatch.makeRe(pattern, options);
+}
+pattern$1.makeRe = makeRe;
+function convertPatternsToRe(patterns, options) {
+ return patterns.map((pattern) => makeRe(pattern, options));
+}
+pattern$1.convertPatternsToRe = convertPatternsToRe;
+function matchAny(entry, patternsRe) {
+ return patternsRe.some((patternRe) => patternRe.test(entry));
+}
+pattern$1.matchAny = matchAny;
+/**
+ * This package only works with forward slashes as a path separator.
+ * Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes.
+ */
+function removeDuplicateSlashes(pattern) {
+ return pattern.replace(DOUBLE_SLASH_RE$1, '/');
+}
+pattern$1.removeDuplicateSlashes = removeDuplicateSlashes;
+
+var stream$4 = {};
+
+/*
+ * merge2
+ * https://github.com/teambition/merge2
+ *
+ * Copyright (c) 2014-2020 Teambition
+ * Licensed under the MIT license.
+ */
+const Stream = require$$0$7;
+const PassThrough = Stream.PassThrough;
+const slice = Array.prototype.slice;
+
+var merge2_1 = merge2$1;
+
+function merge2$1 () {
+ const streamsQueue = [];
+ const args = slice.call(arguments);
+ let merging = false;
+ let options = args[args.length - 1];
+
+ if (options && !Array.isArray(options) && options.pipe == null) {
+ args.pop();
+ } else {
+ options = {};
+ }
+
+ const doEnd = options.end !== false;
+ const doPipeError = options.pipeError === true;
+ if (options.objectMode == null) {
+ options.objectMode = true;
+ }
+ if (options.highWaterMark == null) {
+ options.highWaterMark = 64 * 1024;
+ }
+ const mergedStream = PassThrough(options);
+
+ function addStream () {
+ for (let i = 0, len = arguments.length; i < len; i++) {
+ streamsQueue.push(pauseStreams(arguments[i], options));
+ }
+ mergeStream();
+ return this
+ }
+
+ function mergeStream () {
+ if (merging) {
+ return
+ }
+ merging = true;
+
+ let streams = streamsQueue.shift();
+ if (!streams) {
+ process.nextTick(endStream);
+ return
+ }
+ if (!Array.isArray(streams)) {
+ streams = [streams];
+ }
+
+ let pipesCount = streams.length + 1;
+
+ function next () {
+ if (--pipesCount > 0) {
+ return
+ }
+ merging = false;
+ mergeStream();
+ }
+
+ function pipe (stream) {
+ function onend () {
+ stream.removeListener('merge2UnpipeEnd', onend);
+ stream.removeListener('end', onend);
+ if (doPipeError) {
+ stream.removeListener('error', onerror);
+ }
+ next();
+ }
+ function onerror (err) {
+ mergedStream.emit('error', err);
+ }
+ // skip ended stream
+ if (stream._readableState.endEmitted) {
+ return next()
+ }
+
+ stream.on('merge2UnpipeEnd', onend);
+ stream.on('end', onend);
+
+ if (doPipeError) {
+ stream.on('error', onerror);
+ }
+
+ stream.pipe(mergedStream, { end: false });
+ // compatible for old stream
+ stream.resume();
+ }
+
+ for (let i = 0; i < streams.length; i++) {
+ pipe(streams[i]);
+ }
+
+ next();
+ }
+
+ function endStream () {
+ merging = false;
+ // emit 'queueDrain' when all streams merged.
+ mergedStream.emit('queueDrain');
+ if (doEnd) {
+ mergedStream.end();
+ }
+ }
+
+ mergedStream.setMaxListeners(0);
+ mergedStream.add = addStream;
+ mergedStream.on('unpipe', function (stream) {
+ stream.emit('merge2UnpipeEnd');
+ });
+
+ if (args.length) {
+ addStream.apply(null, args);
+ }
+ return mergedStream
+}
+
+// check and pause streams for pipe.
+function pauseStreams (streams, options) {
+ if (!Array.isArray(streams)) {
+ // Backwards-compat with old-style streams
+ if (!streams._readableState && streams.pipe) {
+ streams = streams.pipe(PassThrough(options));
+ }
+ if (!streams._readableState || !streams.pause || !streams.pipe) {
+ throw new Error('Only readable stream can be merged.')
+ }
+ streams.pause();
+ } else {
+ for (let i = 0, len = streams.length; i < len; i++) {
+ streams[i] = pauseStreams(streams[i], options);
+ }
+ }
+ return streams
+}
+
+Object.defineProperty(stream$4, "__esModule", { value: true });
+stream$4.merge = void 0;
+const merge2 = merge2_1;
+function merge$1(streams) {
+ const mergedStream = merge2(streams);
+ streams.forEach((stream) => {
+ stream.once('error', (error) => mergedStream.emit('error', error));
+ });
+ mergedStream.once('close', () => propagateCloseEventToSources(streams));
+ mergedStream.once('end', () => propagateCloseEventToSources(streams));
+ return mergedStream;
+}
+stream$4.merge = merge$1;
+function propagateCloseEventToSources(streams) {
+ streams.forEach((stream) => stream.emit('close'));
+}
+
+var string$2 = {};
+
+Object.defineProperty(string$2, "__esModule", { value: true });
+string$2.isEmpty = string$2.isString = void 0;
+function isString(input) {
+ return typeof input === 'string';
+}
+string$2.isString = isString;
+function isEmpty$1(input) {
+ return input === '';
+}
+string$2.isEmpty = isEmpty$1;
+
+Object.defineProperty(utils$g, "__esModule", { value: true });
+utils$g.string = utils$g.stream = utils$g.pattern = utils$g.path = utils$g.fs = utils$g.errno = utils$g.array = void 0;
+const array = array$1;
+utils$g.array = array;
+const errno = errno$1;
+utils$g.errno = errno;
+const fs$g = fs$h;
+utils$g.fs = fs$g;
+const path$e = path$h;
+utils$g.path = path$e;
+const pattern = pattern$1;
+utils$g.pattern = pattern;
+const stream$3 = stream$4;
+utils$g.stream = stream$3;
+const string$1 = string$2;
+utils$g.string = string$1;
+
+Object.defineProperty(tasks, "__esModule", { value: true });
+tasks.convertPatternGroupToTask = tasks.convertPatternGroupsToTasks = tasks.groupPatternsByBaseDirectory = tasks.getNegativePatternsAsPositive = tasks.getPositivePatterns = tasks.convertPatternsToTasks = tasks.generate = void 0;
+const utils$a = utils$g;
+function generate(input, settings) {
+ const patterns = processPatterns(input, settings);
+ const ignore = processPatterns(settings.ignore, settings);
+ const positivePatterns = getPositivePatterns(patterns);
+ const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
+ const staticPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isStaticPattern(pattern, settings));
+ const dynamicPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isDynamicPattern(pattern, settings));
+ const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false);
+ const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true);
+ return staticTasks.concat(dynamicTasks);
+}
+tasks.generate = generate;
+function processPatterns(input, settings) {
+ let patterns = input;
+ /**
+ * The original pattern like `{,*,**,a/*}` can lead to problems checking the depth when matching entry
+ * and some problems with the micromatch package (see fast-glob issues: #365, #394).
+ *
+ * To solve this problem, we expand all patterns containing brace expansion. This can lead to a slight slowdown
+ * in matching in the case of a large set of patterns after expansion.
+ */
+ if (settings.braceExpansion) {
+ patterns = utils$a.pattern.expandPatternsWithBraceExpansion(patterns);
+ }
+ /**
+ * If the `baseNameMatch` option is enabled, we must add globstar to patterns, so that they can be used
+ * at any nesting level.
+ *
+ * We do this here, because otherwise we have to complicate the filtering logic. For example, we need to change
+ * the pattern in the filter before creating a regular expression. There is no need to change the patterns
+ * in the application. Only on the input.
+ */
+ if (settings.baseNameMatch) {
+ patterns = patterns.map((pattern) => pattern.includes('/') ? pattern : `**/${pattern}`);
+ }
+ /**
+ * This method also removes duplicate slashes that may have been in the pattern or formed as a result of expansion.
+ */
+ return patterns.map((pattern) => utils$a.pattern.removeDuplicateSlashes(pattern));
+}
+/**
+ * Returns tasks grouped by basic pattern directories.
+ *
+ * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
+ * This is necessary because directory traversal starts at the base directory and goes deeper.
+ */
+function convertPatternsToTasks(positive, negative, dynamic) {
+ const tasks = [];
+ const patternsOutsideCurrentDirectory = utils$a.pattern.getPatternsOutsideCurrentDirectory(positive);
+ const patternsInsideCurrentDirectory = utils$a.pattern.getPatternsInsideCurrentDirectory(positive);
+ const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
+ const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
+ tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
+ /*
+ * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory
+ * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest.
+ */
+ if ('.' in insideCurrentDirectoryGroup) {
+ tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic));
+ }
+ else {
+ tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
+ }
+ return tasks;
+}
+tasks.convertPatternsToTasks = convertPatternsToTasks;
+function getPositivePatterns(patterns) {
+ return utils$a.pattern.getPositivePatterns(patterns);
+}
+tasks.getPositivePatterns = getPositivePatterns;
+function getNegativePatternsAsPositive(patterns, ignore) {
+ const negative = utils$a.pattern.getNegativePatterns(patterns).concat(ignore);
+ const positive = negative.map(utils$a.pattern.convertToPositivePattern);
+ return positive;
+}
+tasks.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
+function groupPatternsByBaseDirectory(patterns) {
+ const group = {};
+ return patterns.reduce((collection, pattern) => {
+ const base = utils$a.pattern.getBaseDirectory(pattern);
+ if (base in collection) {
+ collection[base].push(pattern);
+ }
+ else {
+ collection[base] = [pattern];
+ }
+ return collection;
+ }, group);
+}
+tasks.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
+function convertPatternGroupsToTasks(positive, negative, dynamic) {
+ return Object.keys(positive).map((base) => {
+ return convertPatternGroupToTask(base, positive[base], negative, dynamic);
+ });
+}
+tasks.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
+function convertPatternGroupToTask(base, positive, negative, dynamic) {
+ return {
+ dynamic,
+ positive,
+ negative,
+ base,
+ patterns: [].concat(positive, negative.map(utils$a.pattern.convertToNegativePattern))
+ };
+}
+tasks.convertPatternGroupToTask = convertPatternGroupToTask;
+
+var async$7 = {};
+
+var async$6 = {};
+
+var out$3 = {};
+
+var async$5 = {};
+
+var async$4 = {};
+
+var out$2 = {};
+
+var async$3 = {};
+
+var out$1 = {};
+
+var async$2 = {};
+
+Object.defineProperty(async$2, "__esModule", { value: true });
+async$2.read = void 0;
+function read$3(path, settings, callback) {
+ settings.fs.lstat(path, (lstatError, lstat) => {
+ if (lstatError !== null) {
+ callFailureCallback$2(callback, lstatError);
+ return;
+ }
+ if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
+ callSuccessCallback$2(callback, lstat);
+ return;
+ }
+ settings.fs.stat(path, (statError, stat) => {
+ if (statError !== null) {
+ if (settings.throwErrorOnBrokenSymbolicLink) {
+ callFailureCallback$2(callback, statError);
+ return;
+ }
+ callSuccessCallback$2(callback, lstat);
+ return;
+ }
+ if (settings.markSymbolicLink) {
+ stat.isSymbolicLink = () => true;
+ }
+ callSuccessCallback$2(callback, stat);
+ });
+ });
+}
+async$2.read = read$3;
+function callFailureCallback$2(callback, error) {
+ callback(error);
+}
+function callSuccessCallback$2(callback, result) {
+ callback(null, result);
+}
+
+var sync$8 = {};
+
+Object.defineProperty(sync$8, "__esModule", { value: true });
+sync$8.read = void 0;
+function read$2(path, settings) {
+ const lstat = settings.fs.lstatSync(path);
+ if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
+ return lstat;
+ }
+ try {
+ const stat = settings.fs.statSync(path);
+ if (settings.markSymbolicLink) {
+ stat.isSymbolicLink = () => true;
+ }
+ return stat;
+ }
+ catch (error) {
+ if (!settings.throwErrorOnBrokenSymbolicLink) {
+ return lstat;
+ }
+ throw error;
+ }
+}
+sync$8.read = read$2;
+
+var settings$3 = {};
+
+var fs$f = {};
+
+(function (exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
+ const fs = require$$0__default;
+ exports.FILE_SYSTEM_ADAPTER = {
+ lstat: fs.lstat,
+ stat: fs.stat,
+ lstatSync: fs.lstatSync,
+ statSync: fs.statSync
+ };
+ function createFileSystemAdapter(fsMethods) {
+ if (fsMethods === undefined) {
+ return exports.FILE_SYSTEM_ADAPTER;
+ }
+ return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
+ }
+ exports.createFileSystemAdapter = createFileSystemAdapter;
+} (fs$f));
+
+Object.defineProperty(settings$3, "__esModule", { value: true });
+const fs$e = fs$f;
+let Settings$2 = class Settings {
+ constructor(_options = {}) {
+ this._options = _options;
+ this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
+ this.fs = fs$e.createFileSystemAdapter(this._options.fs);
+ this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
+ this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
+ }
+ _getValue(option, value) {
+ return option !== null && option !== void 0 ? option : value;
+ }
+};
+settings$3.default = Settings$2;
+
+Object.defineProperty(out$1, "__esModule", { value: true });
+out$1.statSync = out$1.stat = out$1.Settings = void 0;
+const async$1 = async$2;
+const sync$7 = sync$8;
+const settings_1$3 = settings$3;
+out$1.Settings = settings_1$3.default;
+function stat$4(path, optionsOrSettingsOrCallback, callback) {
+ if (typeof optionsOrSettingsOrCallback === 'function') {
+ async$1.read(path, getSettings$2(), optionsOrSettingsOrCallback);
+ return;
+ }
+ async$1.read(path, getSettings$2(optionsOrSettingsOrCallback), callback);
+}
+out$1.stat = stat$4;
+function statSync(path, optionsOrSettings) {
+ const settings = getSettings$2(optionsOrSettings);
+ return sync$7.read(path, settings);
+}
+out$1.statSync = statSync;
+function getSettings$2(settingsOrOptions = {}) {
+ if (settingsOrOptions instanceof settings_1$3.default) {
+ return settingsOrOptions;
+ }
+ return new settings_1$3.default(settingsOrOptions);
+}
+
+/*! queue-microtask. MIT License. Feross Aboukhadijeh */
+
+let promise;
+
+var queueMicrotask_1 = typeof queueMicrotask === 'function'
+ ? queueMicrotask.bind(typeof window !== 'undefined' ? window : commonjsGlobal)
+ // reuse resolved promise, and allocate it lazily
+ : cb => (promise || (promise = Promise.resolve()))
+ .then(cb)
+ .catch(err => setTimeout(() => { throw err }, 0));
+
+/*! run-parallel. MIT License. Feross Aboukhadijeh */
+
+var runParallel_1 = runParallel;
+
+const queueMicrotask$1 = queueMicrotask_1;
+
+function runParallel (tasks, cb) {
+ let results, pending, keys;
+ let isSync = true;
+
+ if (Array.isArray(tasks)) {
+ results = [];
+ pending = tasks.length;
+ } else {
+ keys = Object.keys(tasks);
+ results = {};
+ pending = keys.length;
+ }
+
+ function done (err) {
+ function end () {
+ if (cb) cb(err, results);
+ cb = null;
+ }
+ if (isSync) queueMicrotask$1(end);
+ else end();
+ }
+
+ function each (i, err, result) {
+ results[i] = result;
+ if (--pending === 0 || err) {
+ done(err);
+ }
+ }
+
+ if (!pending) {
+ // empty
+ done(null);
+ } else if (keys) {
+ // object
+ keys.forEach(function (key) {
+ tasks[key](function (err, result) { each(key, err, result); });
+ });
+ } else {
+ // array
+ tasks.forEach(function (task, i) {
+ task(function (err, result) { each(i, err, result); });
+ });
+ }
+
+ isSync = false;
+}
+
+var constants$2 = {};
+
+Object.defineProperty(constants$2, "__esModule", { value: true });
+constants$2.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
+const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.');
+if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) {
+ throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
+}
+const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
+const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
+const SUPPORTED_MAJOR_VERSION = 10;
+const SUPPORTED_MINOR_VERSION = 10;
+const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
+const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
+/**
+ * IS `true` for Node.js 10.10 and greater.
+ */
+constants$2.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
+
+var utils$9 = {};
+
+var fs$d = {};
+
+Object.defineProperty(fs$d, "__esModule", { value: true });
+fs$d.createDirentFromStats = void 0;
+class DirentFromStats {
+ constructor(name, stats) {
+ this.name = name;
+ this.isBlockDevice = stats.isBlockDevice.bind(stats);
+ this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
+ this.isDirectory = stats.isDirectory.bind(stats);
+ this.isFIFO = stats.isFIFO.bind(stats);
+ this.isFile = stats.isFile.bind(stats);
+ this.isSocket = stats.isSocket.bind(stats);
+ this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
+ }
+}
+function createDirentFromStats(name, stats) {
+ return new DirentFromStats(name, stats);
+}
+fs$d.createDirentFromStats = createDirentFromStats;
+
+Object.defineProperty(utils$9, "__esModule", { value: true });
+utils$9.fs = void 0;
+const fs$c = fs$d;
+utils$9.fs = fs$c;
+
+var common$a = {};
+
+Object.defineProperty(common$a, "__esModule", { value: true });
+common$a.joinPathSegments = void 0;
+function joinPathSegments$1(a, b, separator) {
+ /**
+ * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
+ */
+ if (a.endsWith(separator)) {
+ return a + b;
+ }
+ return a + separator + b;
+}
+common$a.joinPathSegments = joinPathSegments$1;
+
+Object.defineProperty(async$3, "__esModule", { value: true });
+async$3.readdir = async$3.readdirWithFileTypes = async$3.read = void 0;
+const fsStat$5 = out$1;
+const rpl = runParallel_1;
+const constants_1$1 = constants$2;
+const utils$8 = utils$9;
+const common$9 = common$a;
+function read$1(directory, settings, callback) {
+ if (!settings.stats && constants_1$1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
+ readdirWithFileTypes$1(directory, settings, callback);
+ return;
+ }
+ readdir$3(directory, settings, callback);
+}
+async$3.read = read$1;
+function readdirWithFileTypes$1(directory, settings, callback) {
+ settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
+ if (readdirError !== null) {
+ callFailureCallback$1(callback, readdirError);
+ return;
+ }
+ const entries = dirents.map((dirent) => ({
+ dirent,
+ name: dirent.name,
+ path: common$9.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
+ }));
+ if (!settings.followSymbolicLinks) {
+ callSuccessCallback$1(callback, entries);
+ return;
+ }
+ const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
+ rpl(tasks, (rplError, rplEntries) => {
+ if (rplError !== null) {
+ callFailureCallback$1(callback, rplError);
+ return;
+ }
+ callSuccessCallback$1(callback, rplEntries);
+ });
+ });
+}
+async$3.readdirWithFileTypes = readdirWithFileTypes$1;
+function makeRplTaskEntry(entry, settings) {
+ return (done) => {
+ if (!entry.dirent.isSymbolicLink()) {
+ done(null, entry);
+ return;
+ }
+ settings.fs.stat(entry.path, (statError, stats) => {
+ if (statError !== null) {
+ if (settings.throwErrorOnBrokenSymbolicLink) {
+ done(statError);
+ return;
+ }
+ done(null, entry);
+ return;
+ }
+ entry.dirent = utils$8.fs.createDirentFromStats(entry.name, stats);
+ done(null, entry);
+ });
+ };
+}
+function readdir$3(directory, settings, callback) {
+ settings.fs.readdir(directory, (readdirError, names) => {
+ if (readdirError !== null) {
+ callFailureCallback$1(callback, readdirError);
+ return;
+ }
+ const tasks = names.map((name) => {
+ const path = common$9.joinPathSegments(directory, name, settings.pathSegmentSeparator);
+ return (done) => {
+ fsStat$5.stat(path, settings.fsStatSettings, (error, stats) => {
+ if (error !== null) {
+ done(error);
+ return;
+ }
+ const entry = {
+ name,
+ path,
+ dirent: utils$8.fs.createDirentFromStats(name, stats)
+ };
+ if (settings.stats) {
+ entry.stats = stats;
+ }
+ done(null, entry);
+ });
+ };
+ });
+ rpl(tasks, (rplError, entries) => {
+ if (rplError !== null) {
+ callFailureCallback$1(callback, rplError);
+ return;
+ }
+ callSuccessCallback$1(callback, entries);
+ });
+ });
+}
+async$3.readdir = readdir$3;
+function callFailureCallback$1(callback, error) {
+ callback(error);
+}
+function callSuccessCallback$1(callback, result) {
+ callback(null, result);
+}
+
+var sync$6 = {};
+
+Object.defineProperty(sync$6, "__esModule", { value: true });
+sync$6.readdir = sync$6.readdirWithFileTypes = sync$6.read = void 0;
+const fsStat$4 = out$1;
+const constants_1 = constants$2;
+const utils$7 = utils$9;
+const common$8 = common$a;
+function read(directory, settings) {
+ if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
+ return readdirWithFileTypes(directory, settings);
+ }
+ return readdir$2(directory, settings);
+}
+sync$6.read = read;
+function readdirWithFileTypes(directory, settings) {
+ const dirents = settings.fs.readdirSync(directory, { withFileTypes: true });
+ return dirents.map((dirent) => {
+ const entry = {
+ dirent,
+ name: dirent.name,
+ path: common$8.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
+ };
+ if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
+ try {
+ const stats = settings.fs.statSync(entry.path);
+ entry.dirent = utils$7.fs.createDirentFromStats(entry.name, stats);
+ }
+ catch (error) {
+ if (settings.throwErrorOnBrokenSymbolicLink) {
+ throw error;
+ }
+ }
+ }
+ return entry;
+ });
+}
+sync$6.readdirWithFileTypes = readdirWithFileTypes;
+function readdir$2(directory, settings) {
+ const names = settings.fs.readdirSync(directory);
+ return names.map((name) => {
+ const entryPath = common$8.joinPathSegments(directory, name, settings.pathSegmentSeparator);
+ const stats = fsStat$4.statSync(entryPath, settings.fsStatSettings);
+ const entry = {
+ name,
+ path: entryPath,
+ dirent: utils$7.fs.createDirentFromStats(name, stats)
+ };
+ if (settings.stats) {
+ entry.stats = stats;
+ }
+ return entry;
+ });
+}
+sync$6.readdir = readdir$2;
+
+var settings$2 = {};
+
+var fs$b = {};
+
+(function (exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
+ const fs = require$$0__default;
+ exports.FILE_SYSTEM_ADAPTER = {
+ lstat: fs.lstat,
+ stat: fs.stat,
+ lstatSync: fs.lstatSync,
+ statSync: fs.statSync,
+ readdir: fs.readdir,
+ readdirSync: fs.readdirSync
+ };
+ function createFileSystemAdapter(fsMethods) {
+ if (fsMethods === undefined) {
+ return exports.FILE_SYSTEM_ADAPTER;
+ }
+ return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
+ }
+ exports.createFileSystemAdapter = createFileSystemAdapter;
+} (fs$b));
+
+Object.defineProperty(settings$2, "__esModule", { value: true });
+const path$d = require$$0$4;
+const fsStat$3 = out$1;
+const fs$a = fs$b;
+let Settings$1 = class Settings {
+ constructor(_options = {}) {
+ this._options = _options;
+ this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
+ this.fs = fs$a.createFileSystemAdapter(this._options.fs);
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$d.sep);
+ this.stats = this._getValue(this._options.stats, false);
+ this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
+ this.fsStatSettings = new fsStat$3.Settings({
+ followSymbolicLink: this.followSymbolicLinks,
+ fs: this.fs,
+ throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
+ });
+ }
+ _getValue(option, value) {
+ return option !== null && option !== void 0 ? option : value;
+ }
+};
+settings$2.default = Settings$1;
+
+Object.defineProperty(out$2, "__esModule", { value: true });
+out$2.Settings = out$2.scandirSync = out$2.scandir = void 0;
+const async = async$3;
+const sync$5 = sync$6;
+const settings_1$2 = settings$2;
+out$2.Settings = settings_1$2.default;
+function scandir(path, optionsOrSettingsOrCallback, callback) {
+ if (typeof optionsOrSettingsOrCallback === 'function') {
+ async.read(path, getSettings$1(), optionsOrSettingsOrCallback);
+ return;
+ }
+ async.read(path, getSettings$1(optionsOrSettingsOrCallback), callback);
+}
+out$2.scandir = scandir;
+function scandirSync(path, optionsOrSettings) {
+ const settings = getSettings$1(optionsOrSettings);
+ return sync$5.read(path, settings);
+}
+out$2.scandirSync = scandirSync;
+function getSettings$1(settingsOrOptions = {}) {
+ if (settingsOrOptions instanceof settings_1$2.default) {
+ return settingsOrOptions;
+ }
+ return new settings_1$2.default(settingsOrOptions);
+}
+
+var queue = {exports: {}};
+
+function reusify$1 (Constructor) {
+ var head = new Constructor();
+ var tail = head;
+
+ function get () {
+ var current = head;
+
+ if (current.next) {
+ head = current.next;
+ } else {
+ head = new Constructor();
+ tail = head;
+ }
+
+ current.next = null;
+
+ return current
+ }
+
+ function release (obj) {
+ tail.next = obj;
+ tail = obj;
+ }
+
+ return {
+ get: get,
+ release: release
+ }
+}
+
+var reusify_1 = reusify$1;
+
+/* eslint-disable no-var */
+
+var reusify = reusify_1;
+
+function fastqueue (context, worker, concurrency) {
+ if (typeof context === 'function') {
+ concurrency = worker;
+ worker = context;
+ context = null;
+ }
+
+ if (concurrency < 1) {
+ throw new Error('fastqueue concurrency must be greater than 1')
+ }
+
+ var cache = reusify(Task);
+ var queueHead = null;
+ var queueTail = null;
+ var _running = 0;
+ var errorHandler = null;
+
+ var self = {
+ push: push,
+ drain: noop$4,
+ saturated: noop$4,
+ pause: pause,
+ paused: false,
+ concurrency: concurrency,
+ running: running,
+ resume: resume,
+ idle: idle,
+ length: length,
+ getQueue: getQueue,
+ unshift: unshift,
+ empty: noop$4,
+ kill: kill,
+ killAndDrain: killAndDrain,
+ error: error
+ };
+
+ return self
+
+ function running () {
+ return _running
+ }
+
+ function pause () {
+ self.paused = true;
+ }
+
+ function length () {
+ var current = queueHead;
+ var counter = 0;
+
+ while (current) {
+ current = current.next;
+ counter++;
+ }
+
+ return counter
+ }
+
+ function getQueue () {
+ var current = queueHead;
+ var tasks = [];
+
+ while (current) {
+ tasks.push(current.value);
+ current = current.next;
+ }
+
+ return tasks
+ }
+
+ function resume () {
+ if (!self.paused) return
+ self.paused = false;
+ for (var i = 0; i < self.concurrency; i++) {
+ _running++;
+ release();
+ }
+ }
+
+ function idle () {
+ return _running === 0 && self.length() === 0
+ }
+
+ function push (value, done) {
+ var current = cache.get();
+
+ current.context = context;
+ current.release = release;
+ current.value = value;
+ current.callback = done || noop$4;
+ current.errorHandler = errorHandler;
+
+ if (_running === self.concurrency || self.paused) {
+ if (queueTail) {
+ queueTail.next = current;
+ queueTail = current;
+ } else {
+ queueHead = current;
+ queueTail = current;
+ self.saturated();
+ }
+ } else {
+ _running++;
+ worker.call(context, current.value, current.worked);
+ }
+ }
+
+ function unshift (value, done) {
+ var current = cache.get();
+
+ current.context = context;
+ current.release = release;
+ current.value = value;
+ current.callback = done || noop$4;
+
+ if (_running === self.concurrency || self.paused) {
+ if (queueHead) {
+ current.next = queueHead;
+ queueHead = current;
+ } else {
+ queueHead = current;
+ queueTail = current;
+ self.saturated();
+ }
+ } else {
+ _running++;
+ worker.call(context, current.value, current.worked);
+ }
+ }
+
+ function release (holder) {
+ if (holder) {
+ cache.release(holder);
+ }
+ var next = queueHead;
+ if (next) {
+ if (!self.paused) {
+ if (queueTail === queueHead) {
+ queueTail = null;
+ }
+ queueHead = next.next;
+ next.next = null;
+ worker.call(context, next.value, next.worked);
+ if (queueTail === null) {
+ self.empty();
+ }
+ } else {
+ _running--;
+ }
+ } else if (--_running === 0) {
+ self.drain();
+ }
+ }
+
+ function kill () {
+ queueHead = null;
+ queueTail = null;
+ self.drain = noop$4;
+ }
+
+ function killAndDrain () {
+ queueHead = null;
+ queueTail = null;
+ self.drain();
+ self.drain = noop$4;
+ }
+
+ function error (handler) {
+ errorHandler = handler;
+ }
+}
+
+function noop$4 () {}
+
+function Task () {
+ this.value = null;
+ this.callback = noop$4;
+ this.next = null;
+ this.release = noop$4;
+ this.context = null;
+ this.errorHandler = null;
+
+ var self = this;
+
+ this.worked = function worked (err, result) {
+ var callback = self.callback;
+ var errorHandler = self.errorHandler;
+ var val = self.value;
+ self.value = null;
+ self.callback = noop$4;
+ if (self.errorHandler) {
+ errorHandler(err, val);
+ }
+ callback.call(self.context, err, result);
+ self.release(self);
+ };
+}
+
+function queueAsPromised (context, worker, concurrency) {
+ if (typeof context === 'function') {
+ concurrency = worker;
+ worker = context;
+ context = null;
+ }
+
+ function asyncWrapper (arg, cb) {
+ worker.call(this, arg)
+ .then(function (res) {
+ cb(null, res);
+ }, cb);
+ }
+
+ var queue = fastqueue(context, asyncWrapper, concurrency);
+
+ var pushCb = queue.push;
+ var unshiftCb = queue.unshift;
+
+ queue.push = push;
+ queue.unshift = unshift;
+ queue.drained = drained;
+
+ return queue
+
+ function push (value) {
+ var p = new Promise(function (resolve, reject) {
+ pushCb(value, function (err, result) {
+ if (err) {
+ reject(err);
+ return
+ }
+ resolve(result);
+ });
+ });
+
+ // Let's fork the promise chain to
+ // make the error bubble up to the user but
+ // not lead to a unhandledRejection
+ p.catch(noop$4);
+
+ return p
+ }
+
+ function unshift (value) {
+ var p = new Promise(function (resolve, reject) {
+ unshiftCb(value, function (err, result) {
+ if (err) {
+ reject(err);
+ return
+ }
+ resolve(result);
+ });
+ });
+
+ // Let's fork the promise chain to
+ // make the error bubble up to the user but
+ // not lead to a unhandledRejection
+ p.catch(noop$4);
+
+ return p
+ }
+
+ function drained () {
+ var previousDrain = queue.drain;
+
+ var p = new Promise(function (resolve) {
+ queue.drain = function () {
+ previousDrain();
+ resolve();
+ };
+ });
+
+ return p
+ }
+}
+
+queue.exports = fastqueue;
+queue.exports.promise = queueAsPromised;
+
+var queueExports = queue.exports;
+
+var common$7 = {};
+
+Object.defineProperty(common$7, "__esModule", { value: true });
+common$7.joinPathSegments = common$7.replacePathSegmentSeparator = common$7.isAppliedFilter = common$7.isFatalError = void 0;
+function isFatalError(settings, error) {
+ if (settings.errorFilter === null) {
+ return true;
+ }
+ return !settings.errorFilter(error);
+}
+common$7.isFatalError = isFatalError;
+function isAppliedFilter(filter, value) {
+ return filter === null || filter(value);
+}
+common$7.isAppliedFilter = isAppliedFilter;
+function replacePathSegmentSeparator(filepath, separator) {
+ return filepath.split(/[/\\]/).join(separator);
+}
+common$7.replacePathSegmentSeparator = replacePathSegmentSeparator;
+function joinPathSegments(a, b, separator) {
+ if (a === '') {
+ return b;
+ }
+ /**
+ * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
+ */
+ if (a.endsWith(separator)) {
+ return a + b;
+ }
+ return a + separator + b;
+}
+common$7.joinPathSegments = joinPathSegments;
+
+var reader$1 = {};
+
+Object.defineProperty(reader$1, "__esModule", { value: true });
+const common$6 = common$7;
+let Reader$1 = class Reader {
+ constructor(_root, _settings) {
+ this._root = _root;
+ this._settings = _settings;
+ this._root = common$6.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
+ }
+};
+reader$1.default = Reader$1;
+
+Object.defineProperty(async$4, "__esModule", { value: true });
+const events_1 = require$$0$5;
+const fsScandir$2 = out$2;
+const fastq = queueExports;
+const common$5 = common$7;
+const reader_1$4 = reader$1;
+class AsyncReader extends reader_1$4.default {
+ constructor(_root, _settings) {
+ super(_root, _settings);
+ this._settings = _settings;
+ this._scandir = fsScandir$2.scandir;
+ this._emitter = new events_1.EventEmitter();
+ this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
+ this._isFatalError = false;
+ this._isDestroyed = false;
+ this._queue.drain = () => {
+ if (!this._isFatalError) {
+ this._emitter.emit('end');
+ }
+ };
+ }
+ read() {
+ this._isFatalError = false;
+ this._isDestroyed = false;
+ setImmediate(() => {
+ this._pushToQueue(this._root, this._settings.basePath);
+ });
+ return this._emitter;
+ }
+ get isDestroyed() {
+ return this._isDestroyed;
+ }
+ destroy() {
+ if (this._isDestroyed) {
+ throw new Error('The reader is already destroyed');
+ }
+ this._isDestroyed = true;
+ this._queue.killAndDrain();
+ }
+ onEntry(callback) {
+ this._emitter.on('entry', callback);
+ }
+ onError(callback) {
+ this._emitter.once('error', callback);
+ }
+ onEnd(callback) {
+ this._emitter.once('end', callback);
+ }
+ _pushToQueue(directory, base) {
+ const queueItem = { directory, base };
+ this._queue.push(queueItem, (error) => {
+ if (error !== null) {
+ this._handleError(error);
+ }
+ });
+ }
+ _worker(item, done) {
+ this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
+ if (error !== null) {
+ done(error, undefined);
+ return;
+ }
+ for (const entry of entries) {
+ this._handleEntry(entry, item.base);
+ }
+ done(null, undefined);
+ });
+ }
+ _handleError(error) {
+ if (this._isDestroyed || !common$5.isFatalError(this._settings, error)) {
+ return;
+ }
+ this._isFatalError = true;
+ this._isDestroyed = true;
+ this._emitter.emit('error', error);
+ }
+ _handleEntry(entry, base) {
+ if (this._isDestroyed || this._isFatalError) {
+ return;
+ }
+ const fullpath = entry.path;
+ if (base !== undefined) {
+ entry.path = common$5.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
+ }
+ if (common$5.isAppliedFilter(this._settings.entryFilter, entry)) {
+ this._emitEntry(entry);
+ }
+ if (entry.dirent.isDirectory() && common$5.isAppliedFilter(this._settings.deepFilter, entry)) {
+ this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
+ }
+ }
+ _emitEntry(entry) {
+ this._emitter.emit('entry', entry);
+ }
+}
+async$4.default = AsyncReader;
+
+Object.defineProperty(async$5, "__esModule", { value: true });
+const async_1$4 = async$4;
+class AsyncProvider {
+ constructor(_root, _settings) {
+ this._root = _root;
+ this._settings = _settings;
+ this._reader = new async_1$4.default(this._root, this._settings);
+ this._storage = [];
+ }
+ read(callback) {
+ this._reader.onError((error) => {
+ callFailureCallback(callback, error);
+ });
+ this._reader.onEntry((entry) => {
+ this._storage.push(entry);
+ });
+ this._reader.onEnd(() => {
+ callSuccessCallback(callback, this._storage);
+ });
+ this._reader.read();
+ }
+}
+async$5.default = AsyncProvider;
+function callFailureCallback(callback, error) {
+ callback(error);
+}
+function callSuccessCallback(callback, entries) {
+ callback(null, entries);
+}
+
+var stream$2 = {};
+
+Object.defineProperty(stream$2, "__esModule", { value: true });
+const stream_1$5 = require$$0$7;
+const async_1$3 = async$4;
+class StreamProvider {
+ constructor(_root, _settings) {
+ this._root = _root;
+ this._settings = _settings;
+ this._reader = new async_1$3.default(this._root, this._settings);
+ this._stream = new stream_1$5.Readable({
+ objectMode: true,
+ read: () => { },
+ destroy: () => {
+ if (!this._reader.isDestroyed) {
+ this._reader.destroy();
+ }
+ }
+ });
+ }
+ read() {
+ this._reader.onError((error) => {
+ this._stream.emit('error', error);
+ });
+ this._reader.onEntry((entry) => {
+ this._stream.push(entry);
+ });
+ this._reader.onEnd(() => {
+ this._stream.push(null);
+ });
+ this._reader.read();
+ return this._stream;
+ }
+}
+stream$2.default = StreamProvider;
+
+var sync$4 = {};
+
+var sync$3 = {};
+
+Object.defineProperty(sync$3, "__esModule", { value: true });
+const fsScandir$1 = out$2;
+const common$4 = common$7;
+const reader_1$3 = reader$1;
+class SyncReader extends reader_1$3.default {
+ constructor() {
+ super(...arguments);
+ this._scandir = fsScandir$1.scandirSync;
+ this._storage = [];
+ this._queue = new Set();
+ }
+ read() {
+ this._pushToQueue(this._root, this._settings.basePath);
+ this._handleQueue();
+ return this._storage;
+ }
+ _pushToQueue(directory, base) {
+ this._queue.add({ directory, base });
+ }
+ _handleQueue() {
+ for (const item of this._queue.values()) {
+ this._handleDirectory(item.directory, item.base);
+ }
+ }
+ _handleDirectory(directory, base) {
+ try {
+ const entries = this._scandir(directory, this._settings.fsScandirSettings);
+ for (const entry of entries) {
+ this._handleEntry(entry, base);
+ }
+ }
+ catch (error) {
+ this._handleError(error);
+ }
+ }
+ _handleError(error) {
+ if (!common$4.isFatalError(this._settings, error)) {
+ return;
+ }
+ throw error;
+ }
+ _handleEntry(entry, base) {
+ const fullpath = entry.path;
+ if (base !== undefined) {
+ entry.path = common$4.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
+ }
+ if (common$4.isAppliedFilter(this._settings.entryFilter, entry)) {
+ this._pushToStorage(entry);
+ }
+ if (entry.dirent.isDirectory() && common$4.isAppliedFilter(this._settings.deepFilter, entry)) {
+ this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
+ }
+ }
+ _pushToStorage(entry) {
+ this._storage.push(entry);
+ }
+}
+sync$3.default = SyncReader;
+
+Object.defineProperty(sync$4, "__esModule", { value: true });
+const sync_1$3 = sync$3;
+class SyncProvider {
+ constructor(_root, _settings) {
+ this._root = _root;
+ this._settings = _settings;
+ this._reader = new sync_1$3.default(this._root, this._settings);
+ }
+ read() {
+ return this._reader.read();
+ }
+}
+sync$4.default = SyncProvider;
+
+var settings$1 = {};
+
+Object.defineProperty(settings$1, "__esModule", { value: true });
+const path$c = require$$0$4;
+const fsScandir = out$2;
+class Settings {
+ constructor(_options = {}) {
+ this._options = _options;
+ this.basePath = this._getValue(this._options.basePath, undefined);
+ this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
+ this.deepFilter = this._getValue(this._options.deepFilter, null);
+ this.entryFilter = this._getValue(this._options.entryFilter, null);
+ this.errorFilter = this._getValue(this._options.errorFilter, null);
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$c.sep);
+ this.fsScandirSettings = new fsScandir.Settings({
+ followSymbolicLinks: this._options.followSymbolicLinks,
+ fs: this._options.fs,
+ pathSegmentSeparator: this._options.pathSegmentSeparator,
+ stats: this._options.stats,
+ throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
+ });
+ }
+ _getValue(option, value) {
+ return option !== null && option !== void 0 ? option : value;
+ }
+}
+settings$1.default = Settings;
+
+Object.defineProperty(out$3, "__esModule", { value: true });
+out$3.Settings = out$3.walkStream = out$3.walkSync = out$3.walk = void 0;
+const async_1$2 = async$5;
+const stream_1$4 = stream$2;
+const sync_1$2 = sync$4;
+const settings_1$1 = settings$1;
+out$3.Settings = settings_1$1.default;
+function walk$2(directory, optionsOrSettingsOrCallback, callback) {
+ if (typeof optionsOrSettingsOrCallback === 'function') {
+ new async_1$2.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
+ return;
+ }
+ new async_1$2.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
+}
+out$3.walk = walk$2;
+function walkSync(directory, optionsOrSettings) {
+ const settings = getSettings(optionsOrSettings);
+ const provider = new sync_1$2.default(directory, settings);
+ return provider.read();
+}
+out$3.walkSync = walkSync;
+function walkStream(directory, optionsOrSettings) {
+ const settings = getSettings(optionsOrSettings);
+ const provider = new stream_1$4.default(directory, settings);
+ return provider.read();
+}
+out$3.walkStream = walkStream;
+function getSettings(settingsOrOptions = {}) {
+ if (settingsOrOptions instanceof settings_1$1.default) {
+ return settingsOrOptions;
+ }
+ return new settings_1$1.default(settingsOrOptions);
+}
+
+var reader = {};
+
+Object.defineProperty(reader, "__esModule", { value: true });
+const path$b = require$$0$4;
+const fsStat$2 = out$1;
+const utils$6 = utils$g;
+class Reader {
+ constructor(_settings) {
+ this._settings = _settings;
+ this._fsStatSettings = new fsStat$2.Settings({
+ followSymbolicLink: this._settings.followSymbolicLinks,
+ fs: this._settings.fs,
+ throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
+ });
+ }
+ _getFullEntryPath(filepath) {
+ return path$b.resolve(this._settings.cwd, filepath);
+ }
+ _makeEntry(stats, pattern) {
+ const entry = {
+ name: pattern,
+ path: pattern,
+ dirent: utils$6.fs.createDirentFromStats(pattern, stats)
+ };
+ if (this._settings.stats) {
+ entry.stats = stats;
+ }
+ return entry;
+ }
+ _isFatalError(error) {
+ return !utils$6.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
+ }
+}
+reader.default = Reader;
+
+var stream$1 = {};
+
+Object.defineProperty(stream$1, "__esModule", { value: true });
+const stream_1$3 = require$$0$7;
+const fsStat$1 = out$1;
+const fsWalk$2 = out$3;
+const reader_1$2 = reader;
+class ReaderStream extends reader_1$2.default {
+ constructor() {
+ super(...arguments);
+ this._walkStream = fsWalk$2.walkStream;
+ this._stat = fsStat$1.stat;
+ }
+ dynamic(root, options) {
+ return this._walkStream(root, options);
+ }
+ static(patterns, options) {
+ const filepaths = patterns.map(this._getFullEntryPath, this);
+ const stream = new stream_1$3.PassThrough({ objectMode: true });
+ stream._write = (index, _enc, done) => {
+ return this._getEntry(filepaths[index], patterns[index], options)
+ .then((entry) => {
+ if (entry !== null && options.entryFilter(entry)) {
+ stream.push(entry);
+ }
+ if (index === filepaths.length - 1) {
+ stream.end();
+ }
+ done();
+ })
+ .catch(done);
+ };
+ for (let i = 0; i < filepaths.length; i++) {
+ stream.write(i);
+ }
+ return stream;
+ }
+ _getEntry(filepath, pattern, options) {
+ return this._getStat(filepath)
+ .then((stats) => this._makeEntry(stats, pattern))
+ .catch((error) => {
+ if (options.errorFilter(error)) {
+ return null;
+ }
+ throw error;
+ });
+ }
+ _getStat(filepath) {
+ return new Promise((resolve, reject) => {
+ this._stat(filepath, this._fsStatSettings, (error, stats) => {
+ return error === null ? resolve(stats) : reject(error);
+ });
+ });
+ }
+}
+stream$1.default = ReaderStream;
+
+Object.defineProperty(async$6, "__esModule", { value: true });
+const fsWalk$1 = out$3;
+const reader_1$1 = reader;
+const stream_1$2 = stream$1;
+class ReaderAsync extends reader_1$1.default {
+ constructor() {
+ super(...arguments);
+ this._walkAsync = fsWalk$1.walk;
+ this._readerStream = new stream_1$2.default(this._settings);
+ }
+ dynamic(root, options) {
+ return new Promise((resolve, reject) => {
+ this._walkAsync(root, options, (error, entries) => {
+ if (error === null) {
+ resolve(entries);
+ }
+ else {
+ reject(error);
+ }
+ });
+ });
+ }
+ async static(patterns, options) {
+ const entries = [];
+ const stream = this._readerStream.static(patterns, options);
+ // After #235, replace it with an asynchronous iterator.
+ return new Promise((resolve, reject) => {
+ stream.once('error', reject);
+ stream.on('data', (entry) => entries.push(entry));
+ stream.once('end', () => resolve(entries));
+ });
+ }
+}
+async$6.default = ReaderAsync;
+
+var provider = {};
+
+var deep = {};
+
+var partial = {};
+
+var matcher = {};
+
+Object.defineProperty(matcher, "__esModule", { value: true });
+const utils$5 = utils$g;
+class Matcher {
+ constructor(_patterns, _settings, _micromatchOptions) {
+ this._patterns = _patterns;
+ this._settings = _settings;
+ this._micromatchOptions = _micromatchOptions;
+ this._storage = [];
+ this._fillStorage();
+ }
+ _fillStorage() {
+ for (const pattern of this._patterns) {
+ const segments = this._getPatternSegments(pattern);
+ const sections = this._splitSegmentsIntoSections(segments);
+ this._storage.push({
+ complete: sections.length <= 1,
+ pattern,
+ segments,
+ sections
+ });
+ }
+ }
+ _getPatternSegments(pattern) {
+ const parts = utils$5.pattern.getPatternParts(pattern, this._micromatchOptions);
+ return parts.map((part) => {
+ const dynamic = utils$5.pattern.isDynamicPattern(part, this._settings);
+ if (!dynamic) {
+ return {
+ dynamic: false,
+ pattern: part
+ };
+ }
+ return {
+ dynamic: true,
+ pattern: part,
+ patternRe: utils$5.pattern.makeRe(part, this._micromatchOptions)
+ };
+ });
+ }
+ _splitSegmentsIntoSections(segments) {
+ return utils$5.array.splitWhen(segments, (segment) => segment.dynamic && utils$5.pattern.hasGlobStar(segment.pattern));
+ }
+}
+matcher.default = Matcher;
+
+Object.defineProperty(partial, "__esModule", { value: true });
+const matcher_1 = matcher;
+class PartialMatcher extends matcher_1.default {
+ match(filepath) {
+ const parts = filepath.split('/');
+ const levels = parts.length;
+ const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
+ for (const pattern of patterns) {
+ const section = pattern.sections[0];
+ /**
+ * In this case, the pattern has a globstar and we must read all directories unconditionally,
+ * but only if the level has reached the end of the first group.
+ *
+ * fixtures/{a,b}/**
+ * ^ true/false ^ always true
+ */
+ if (!pattern.complete && levels > section.length) {
+ return true;
+ }
+ const match = parts.every((part, index) => {
+ const segment = pattern.segments[index];
+ if (segment.dynamic && segment.patternRe.test(part)) {
+ return true;
+ }
+ if (!segment.dynamic && segment.pattern === part) {
+ return true;
+ }
+ return false;
+ });
+ if (match) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+partial.default = PartialMatcher;
+
+Object.defineProperty(deep, "__esModule", { value: true });
+const utils$4 = utils$g;
+const partial_1 = partial;
+class DeepFilter {
+ constructor(_settings, _micromatchOptions) {
+ this._settings = _settings;
+ this._micromatchOptions = _micromatchOptions;
+ }
+ getFilter(basePath, positive, negative) {
+ const matcher = this._getMatcher(positive);
+ const negativeRe = this._getNegativePatternsRe(negative);
+ return (entry) => this._filter(basePath, entry, matcher, negativeRe);
+ }
+ _getMatcher(patterns) {
+ return new partial_1.default(patterns, this._settings, this._micromatchOptions);
+ }
+ _getNegativePatternsRe(patterns) {
+ const affectDepthOfReadingPatterns = patterns.filter(utils$4.pattern.isAffectDepthOfReadingPattern);
+ return utils$4.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
+ }
+ _filter(basePath, entry, matcher, negativeRe) {
+ if (this._isSkippedByDeep(basePath, entry.path)) {
+ return false;
+ }
+ if (this._isSkippedSymbolicLink(entry)) {
+ return false;
+ }
+ const filepath = utils$4.path.removeLeadingDotSegment(entry.path);
+ if (this._isSkippedByPositivePatterns(filepath, matcher)) {
+ return false;
+ }
+ return this._isSkippedByNegativePatterns(filepath, negativeRe);
+ }
+ _isSkippedByDeep(basePath, entryPath) {
+ /**
+ * Avoid unnecessary depth calculations when it doesn't matter.
+ */
+ if (this._settings.deep === Infinity) {
+ return false;
+ }
+ return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
+ }
+ _getEntryLevel(basePath, entryPath) {
+ const entryPathDepth = entryPath.split('/').length;
+ if (basePath === '') {
+ return entryPathDepth;
+ }
+ const basePathDepth = basePath.split('/').length;
+ return entryPathDepth - basePathDepth;
+ }
+ _isSkippedSymbolicLink(entry) {
+ return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
+ }
+ _isSkippedByPositivePatterns(entryPath, matcher) {
+ return !this._settings.baseNameMatch && !matcher.match(entryPath);
+ }
+ _isSkippedByNegativePatterns(entryPath, patternsRe) {
+ return !utils$4.pattern.matchAny(entryPath, patternsRe);
+ }
+}
+deep.default = DeepFilter;
+
+var entry$1 = {};
+
+Object.defineProperty(entry$1, "__esModule", { value: true });
+const utils$3 = utils$g;
+class EntryFilter {
+ constructor(_settings, _micromatchOptions) {
+ this._settings = _settings;
+ this._micromatchOptions = _micromatchOptions;
+ this.index = new Map();
+ }
+ getFilter(positive, negative) {
+ const positiveRe = utils$3.pattern.convertPatternsToRe(positive, this._micromatchOptions);
+ const negativeRe = utils$3.pattern.convertPatternsToRe(negative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true }));
+ return (entry) => this._filter(entry, positiveRe, negativeRe);
+ }
+ _filter(entry, positiveRe, negativeRe) {
+ const filepath = utils$3.path.removeLeadingDotSegment(entry.path);
+ if (this._settings.unique && this._isDuplicateEntry(filepath)) {
+ return false;
+ }
+ if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
+ return false;
+ }
+ if (this._isSkippedByAbsoluteNegativePatterns(filepath, negativeRe)) {
+ return false;
+ }
+ const isDirectory = entry.dirent.isDirectory();
+ const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory) && !this._isMatchToPatterns(filepath, negativeRe, isDirectory);
+ if (this._settings.unique && isMatched) {
+ this._createIndexRecord(filepath);
+ }
+ return isMatched;
+ }
+ _isDuplicateEntry(filepath) {
+ return this.index.has(filepath);
+ }
+ _createIndexRecord(filepath) {
+ this.index.set(filepath, undefined);
+ }
+ _onlyFileFilter(entry) {
+ return this._settings.onlyFiles && !entry.dirent.isFile();
+ }
+ _onlyDirectoryFilter(entry) {
+ return this._settings.onlyDirectories && !entry.dirent.isDirectory();
+ }
+ _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
+ if (!this._settings.absolute) {
+ return false;
+ }
+ const fullpath = utils$3.path.makeAbsolute(this._settings.cwd, entryPath);
+ return utils$3.pattern.matchAny(fullpath, patternsRe);
+ }
+ _isMatchToPatterns(filepath, patternsRe, isDirectory) {
+ // Trying to match files and directories by patterns.
+ const isMatched = utils$3.pattern.matchAny(filepath, patternsRe);
+ // A pattern with a trailling slash can be used for directory matching.
+ // To apply such pattern, we need to add a tralling slash to the path.
+ if (!isMatched && isDirectory) {
+ return utils$3.pattern.matchAny(filepath + '/', patternsRe);
+ }
+ return isMatched;
+ }
+}
+entry$1.default = EntryFilter;
+
+var error$2 = {};
+
+Object.defineProperty(error$2, "__esModule", { value: true });
+const utils$2 = utils$g;
+class ErrorFilter {
+ constructor(_settings) {
+ this._settings = _settings;
+ }
+ getFilter() {
+ return (error) => this._isNonFatalError(error);
+ }
+ _isNonFatalError(error) {
+ return utils$2.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
+ }
+}
+error$2.default = ErrorFilter;
+
+var entry = {};
+
+Object.defineProperty(entry, "__esModule", { value: true });
+const utils$1 = utils$g;
+class EntryTransformer {
+ constructor(_settings) {
+ this._settings = _settings;
+ }
+ getTransformer() {
+ return (entry) => this._transform(entry);
+ }
+ _transform(entry) {
+ let filepath = entry.path;
+ if (this._settings.absolute) {
+ filepath = utils$1.path.makeAbsolute(this._settings.cwd, filepath);
+ filepath = utils$1.path.unixify(filepath);
+ }
+ if (this._settings.markDirectories && entry.dirent.isDirectory()) {
+ filepath += '/';
+ }
+ if (!this._settings.objectMode) {
+ return filepath;
+ }
+ return Object.assign(Object.assign({}, entry), { path: filepath });
+ }
+}
+entry.default = EntryTransformer;
+
+Object.defineProperty(provider, "__esModule", { value: true });
+const path$a = require$$0$4;
+const deep_1 = deep;
+const entry_1 = entry$1;
+const error_1 = error$2;
+const entry_2 = entry;
+class Provider {
+ constructor(_settings) {
+ this._settings = _settings;
+ this.errorFilter = new error_1.default(this._settings);
+ this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
+ this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
+ this.entryTransformer = new entry_2.default(this._settings);
+ }
+ _getRootDirectory(task) {
+ return path$a.resolve(this._settings.cwd, task.base);
+ }
+ _getReaderOptions(task) {
+ const basePath = task.base === '.' ? '' : task.base;
+ return {
+ basePath,
+ pathSegmentSeparator: '/',
+ concurrency: this._settings.concurrency,
+ deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
+ entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
+ errorFilter: this.errorFilter.getFilter(),
+ followSymbolicLinks: this._settings.followSymbolicLinks,
+ fs: this._settings.fs,
+ stats: this._settings.stats,
+ throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
+ transform: this.entryTransformer.getTransformer()
+ };
+ }
+ _getMicromatchOptions() {
+ return {
+ dot: this._settings.dot,
+ matchBase: this._settings.baseNameMatch,
+ nobrace: !this._settings.braceExpansion,
+ nocase: !this._settings.caseSensitiveMatch,
+ noext: !this._settings.extglob,
+ noglobstar: !this._settings.globstar,
+ posix: true,
+ strictSlashes: false
+ };
+ }
+}
+provider.default = Provider;
+
+Object.defineProperty(async$7, "__esModule", { value: true });
+const async_1$1 = async$6;
+const provider_1$2 = provider;
+class ProviderAsync extends provider_1$2.default {
+ constructor() {
+ super(...arguments);
+ this._reader = new async_1$1.default(this._settings);
+ }
+ async read(task) {
+ const root = this._getRootDirectory(task);
+ const options = this._getReaderOptions(task);
+ const entries = await this.api(root, task, options);
+ return entries.map((entry) => options.transform(entry));
+ }
+ api(root, task, options) {
+ if (task.dynamic) {
+ return this._reader.dynamic(root, options);
+ }
+ return this._reader.static(task.patterns, options);
+ }
+}
+async$7.default = ProviderAsync;
+
+var stream = {};
+
+Object.defineProperty(stream, "__esModule", { value: true });
+const stream_1$1 = require$$0$7;
+const stream_2 = stream$1;
+const provider_1$1 = provider;
+class ProviderStream extends provider_1$1.default {
+ constructor() {
+ super(...arguments);
+ this._reader = new stream_2.default(this._settings);
+ }
+ read(task) {
+ const root = this._getRootDirectory(task);
+ const options = this._getReaderOptions(task);
+ const source = this.api(root, task, options);
+ const destination = new stream_1$1.Readable({ objectMode: true, read: () => { } });
+ source
+ .once('error', (error) => destination.emit('error', error))
+ .on('data', (entry) => destination.emit('data', options.transform(entry)))
+ .once('end', () => destination.emit('end'));
+ destination
+ .once('close', () => source.destroy());
+ return destination;
+ }
+ api(root, task, options) {
+ if (task.dynamic) {
+ return this._reader.dynamic(root, options);
+ }
+ return this._reader.static(task.patterns, options);
+ }
+}
+stream.default = ProviderStream;
+
+var sync$2 = {};
+
+var sync$1 = {};
+
+Object.defineProperty(sync$1, "__esModule", { value: true });
+const fsStat = out$1;
+const fsWalk = out$3;
+const reader_1 = reader;
+class ReaderSync extends reader_1.default {
+ constructor() {
+ super(...arguments);
+ this._walkSync = fsWalk.walkSync;
+ this._statSync = fsStat.statSync;
+ }
+ dynamic(root, options) {
+ return this._walkSync(root, options);
+ }
+ static(patterns, options) {
+ const entries = [];
+ for (const pattern of patterns) {
+ const filepath = this._getFullEntryPath(pattern);
+ const entry = this._getEntry(filepath, pattern, options);
+ if (entry === null || !options.entryFilter(entry)) {
+ continue;
+ }
+ entries.push(entry);
+ }
+ return entries;
+ }
+ _getEntry(filepath, pattern, options) {
+ try {
+ const stats = this._getStat(filepath);
+ return this._makeEntry(stats, pattern);
+ }
+ catch (error) {
+ if (options.errorFilter(error)) {
+ return null;
+ }
+ throw error;
+ }
+ }
+ _getStat(filepath) {
+ return this._statSync(filepath, this._fsStatSettings);
+ }
+}
+sync$1.default = ReaderSync;
+
+Object.defineProperty(sync$2, "__esModule", { value: true });
+const sync_1$1 = sync$1;
+const provider_1 = provider;
+class ProviderSync extends provider_1.default {
+ constructor() {
+ super(...arguments);
+ this._reader = new sync_1$1.default(this._settings);
+ }
+ read(task) {
+ const root = this._getRootDirectory(task);
+ const options = this._getReaderOptions(task);
+ const entries = this.api(root, task, options);
+ return entries.map(options.transform);
+ }
+ api(root, task, options) {
+ if (task.dynamic) {
+ return this._reader.dynamic(root, options);
+ }
+ return this._reader.static(task.patterns, options);
+ }
+}
+sync$2.default = ProviderSync;
+
+var settings = {};
+
+(function (exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
+ const fs = require$$0__default;
+ const os = require$$2;
+ /**
+ * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
+ * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
+ */
+ const CPU_COUNT = Math.max(os.cpus().length, 1);
+ exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
+ lstat: fs.lstat,
+ lstatSync: fs.lstatSync,
+ stat: fs.stat,
+ statSync: fs.statSync,
+ readdir: fs.readdir,
+ readdirSync: fs.readdirSync
+ };
+ class Settings {
+ constructor(_options = {}) {
+ this._options = _options;
+ this.absolute = this._getValue(this._options.absolute, false);
+ this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
+ this.braceExpansion = this._getValue(this._options.braceExpansion, true);
+ this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
+ this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
+ this.cwd = this._getValue(this._options.cwd, process.cwd());
+ this.deep = this._getValue(this._options.deep, Infinity);
+ this.dot = this._getValue(this._options.dot, false);
+ this.extglob = this._getValue(this._options.extglob, true);
+ this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
+ this.fs = this._getFileSystemMethods(this._options.fs);
+ this.globstar = this._getValue(this._options.globstar, true);
+ this.ignore = this._getValue(this._options.ignore, []);
+ this.markDirectories = this._getValue(this._options.markDirectories, false);
+ this.objectMode = this._getValue(this._options.objectMode, false);
+ this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
+ this.onlyFiles = this._getValue(this._options.onlyFiles, true);
+ this.stats = this._getValue(this._options.stats, false);
+ this.suppressErrors = this._getValue(this._options.suppressErrors, false);
+ this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
+ this.unique = this._getValue(this._options.unique, true);
+ if (this.onlyDirectories) {
+ this.onlyFiles = false;
+ }
+ if (this.stats) {
+ this.objectMode = true;
+ }
+ // Remove the cast to the array in the next major (#404).
+ this.ignore = [].concat(this.ignore);
+ }
+ _getValue(option, value) {
+ return option === undefined ? value : option;
+ }
+ _getFileSystemMethods(methods = {}) {
+ return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
+ }
+ }
+ exports.default = Settings;
+} (settings));
+
+const taskManager = tasks;
+const async_1 = async$7;
+const stream_1 = stream;
+const sync_1 = sync$2;
+const settings_1 = settings;
+const utils = utils$g;
+async function FastGlob(source, options) {
+ assertPatternsInput(source);
+ const works = getWorks(source, async_1.default, options);
+ const result = await Promise.all(works);
+ return utils.array.flatten(result);
+}
+// https://github.com/typescript-eslint/typescript-eslint/issues/60
+// eslint-disable-next-line no-redeclare
+(function (FastGlob) {
+ FastGlob.glob = FastGlob;
+ FastGlob.globSync = sync;
+ FastGlob.globStream = stream;
+ FastGlob.async = FastGlob;
+ function sync(source, options) {
+ assertPatternsInput(source);
+ const works = getWorks(source, sync_1.default, options);
+ return utils.array.flatten(works);
+ }
+ FastGlob.sync = sync;
+ function stream(source, options) {
+ assertPatternsInput(source);
+ const works = getWorks(source, stream_1.default, options);
+ /**
+ * The stream returned by the provider cannot work with an asynchronous iterator.
+ * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams.
+ * This affects performance (+25%). I don't see best solution right now.
+ */
+ return utils.stream.merge(works);
+ }
+ FastGlob.stream = stream;
+ function generateTasks(source, options) {
+ assertPatternsInput(source);
+ const patterns = [].concat(source);
+ const settings = new settings_1.default(options);
+ return taskManager.generate(patterns, settings);
+ }
+ FastGlob.generateTasks = generateTasks;
+ function isDynamicPattern(source, options) {
+ assertPatternsInput(source);
+ const settings = new settings_1.default(options);
+ return utils.pattern.isDynamicPattern(source, settings);
+ }
+ FastGlob.isDynamicPattern = isDynamicPattern;
+ function escapePath(source) {
+ assertPatternsInput(source);
+ return utils.path.escape(source);
+ }
+ FastGlob.escapePath = escapePath;
+ function convertPathToPattern(source) {
+ assertPatternsInput(source);
+ return utils.path.convertPathToPattern(source);
+ }
+ FastGlob.convertPathToPattern = convertPathToPattern;
+ (function (posix) {
+ function escapePath(source) {
+ assertPatternsInput(source);
+ return utils.path.escapePosixPath(source);
+ }
+ posix.escapePath = escapePath;
+ function convertPathToPattern(source) {
+ assertPatternsInput(source);
+ return utils.path.convertPosixPathToPattern(source);
+ }
+ posix.convertPathToPattern = convertPathToPattern;
+ })(FastGlob.posix || (FastGlob.posix = {}));
+ (function (win32) {
+ function escapePath(source) {
+ assertPatternsInput(source);
+ return utils.path.escapeWindowsPath(source);
+ }
+ win32.escapePath = escapePath;
+ function convertPathToPattern(source) {
+ assertPatternsInput(source);
+ return utils.path.convertWindowsPathToPattern(source);
+ }
+ win32.convertPathToPattern = convertPathToPattern;
+ })(FastGlob.win32 || (FastGlob.win32 = {}));
+})(FastGlob || (FastGlob = {}));
+function getWorks(source, _Provider, options) {
+ const patterns = [].concat(source);
+ const settings = new settings_1.default(options);
+ const tasks = taskManager.generate(patterns, settings);
+ const provider = new _Provider(settings);
+ return tasks.map(provider.read, provider);
+}
+function assertPatternsInput(input) {
+ const source = [].concat(input);
+ const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
+ if (!isValidSource) {
+ throw new TypeError('Patterns must be a string (non empty) or an array of strings');
+ }
+}
+var out = FastGlob;
+
+var glob = /*@__PURE__*/getDefaultExportFromCjs(out);
+
+function e(e,n,r){throw new Error(r?`No known conditions for "${n}" specifier in "${e}" package`:`Missing "${n}" specifier in "${e}" package`)}function n(n,i,o,f){let s,u,l=r(n,o),c=function(e){let n=new Set(["default",...e.conditions||[]]);return e.unsafe||n.add(e.require?"require":"import"),e.unsafe||n.add(e.browser?"browser":"node"),n}(f||{}),a=i[l];if(void 0===a){let e,n,r,t;for(t in i)n&&t.length1&&(r=t.indexOf("*",1),~r&&(e=RegExp("^"+t.substring(0,r)+"(.*)"+t.substring(1+r)).exec(l),e&&e[1]&&(u=e[1],n=t))));a=i[n];}return a||e(n,l),s=t(a,c),s||e(n,l,1),u&&function(e,n){let r,t=0,i=e.length,o=/[*]/g,f=/[/]$/;for(;t0xffff code points that are a valid part of identifiers. The
+// offset starts at 0x10000, and each pair of numbers represents an
+// offset to the next range, and then a size of the range.
+
+// Reserved word lists for various dialects of the language
+
+var reservedWords = {
+ 3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
+ 5: "class enum extends super const export import",
+ 6: "enum",
+ strict: "implements interface let package private protected public static yield",
+ strictBind: "eval arguments"
+};
+
+// And the keywords
+
+var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
+
+var keywords$1 = {
+ 5: ecma5AndLessKeywords,
+ "5module": ecma5AndLessKeywords + " export import",
+ 6: ecma5AndLessKeywords + " const class extends export import super"
+};
+
+var keywordRelationalOperator = /^in(stanceof)?$/;
+
+// ## Character categories
+
+var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
+var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
+
+// This has a complexity linear to the value of the code. The
+// assumption is that looking up astral identifier characters is
+// rare.
+function isInAstralSet(code, set) {
+ var pos = 0x10000;
+ for (var i = 0; i < set.length; i += 2) {
+ pos += set[i];
+ if (pos > code) { return false }
+ pos += set[i + 1];
+ if (pos >= code) { return true }
+ }
+ return false
+}
+
+// Test whether a given character code starts an identifier.
+
+function isIdentifierStart(code, astral) {
+ if (code < 65) { return code === 36 }
+ if (code < 91) { return true }
+ if (code < 97) { return code === 95 }
+ if (code < 123) { return true }
+ if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) }
+ if (astral === false) { return false }
+ return isInAstralSet(code, astralIdentifierStartCodes)
+}
+
+// Test whether a given character is part of an identifier.
+
+function isIdentifierChar(code, astral) {
+ if (code < 48) { return code === 36 }
+ if (code < 58) { return true }
+ if (code < 65) { return false }
+ if (code < 91) { return true }
+ if (code < 97) { return code === 95 }
+ if (code < 123) { return true }
+ if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) }
+ if (astral === false) { return false }
+ return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)
+}
+
+// ## Token types
+
+// The assignment of fine-grained, information-carrying type objects
+// allows the tokenizer to store the information it has about a
+// token in a way that is very cheap for the parser to look up.
+
+// All token type variables start with an underscore, to make them
+// easy to recognize.
+
+// The `beforeExpr` property is used to disambiguate between regular
+// expressions and divisions. It is set on all token types that can
+// be followed by an expression (thus, a slash after them would be a
+// regular expression).
+//
+// The `startsExpr` property is used to check if the token ends a
+// `yield` expression. It is set on all token types that either can
+// directly start an expression (like a quotation mark) or can
+// continue an expression (like the body of a string).
+//
+// `isLoop` marks a keyword as starting a loop, which is important
+// to know when parsing a label, in order to allow or disallow
+// continue jumps to that label.
+
+var TokenType = function TokenType(label, conf) {
+ if ( conf === void 0 ) conf = {};
+
+ this.label = label;
+ this.keyword = conf.keyword;
+ this.beforeExpr = !!conf.beforeExpr;
+ this.startsExpr = !!conf.startsExpr;
+ this.isLoop = !!conf.isLoop;
+ this.isAssign = !!conf.isAssign;
+ this.prefix = !!conf.prefix;
+ this.postfix = !!conf.postfix;
+ this.binop = conf.binop || null;
+ this.updateContext = null;
+};
+
+function binop(name, prec) {
+ return new TokenType(name, {beforeExpr: true, binop: prec})
+}
+var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
+
+// Map keyword names to token types.
+
+var keywords$2 = {};
+
+// Succinct definitions of keyword token types
+function kw(name, options) {
+ if ( options === void 0 ) options = {};
+
+ options.keyword = name;
+ return keywords$2[name] = new TokenType(name, options)
+}
+
+var types$1 = {
+ num: new TokenType("num", startsExpr),
+ regexp: new TokenType("regexp", startsExpr),
+ string: new TokenType("string", startsExpr),
+ name: new TokenType("name", startsExpr),
+ privateId: new TokenType("privateId", startsExpr),
+ eof: new TokenType("eof"),
+
+ // Punctuation token types.
+ bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}),
+ bracketR: new TokenType("]"),
+ braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}),
+ braceR: new TokenType("}"),
+ parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}),
+ parenR: new TokenType(")"),
+ comma: new TokenType(",", beforeExpr),
+ semi: new TokenType(";", beforeExpr),
+ colon: new TokenType(":", beforeExpr),
+ dot: new TokenType("."),
+ question: new TokenType("?", beforeExpr),
+ questionDot: new TokenType("?."),
+ arrow: new TokenType("=>", beforeExpr),
+ template: new TokenType("template"),
+ invalidTemplate: new TokenType("invalidTemplate"),
+ ellipsis: new TokenType("...", beforeExpr),
+ backQuote: new TokenType("`", startsExpr),
+ dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}),
+
+ // Operators. These carry several kinds of properties to help the
+ // parser use them properly (the presence of these properties is
+ // what categorizes them as operators).
+ //
+ // `binop`, when present, specifies that this operator is a binary
+ // operator, and will refer to its precedence.
+ //
+ // `prefix` and `postfix` mark the operator as a prefix or postfix
+ // unary operator.
+ //
+ // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
+ // binary operators with a very low precedence, that should result
+ // in AssignmentExpression nodes.
+
+ eq: new TokenType("=", {beforeExpr: true, isAssign: true}),
+ assign: new TokenType("_=", {beforeExpr: true, isAssign: true}),
+ incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}),
+ prefix: new TokenType("!/~", {beforeExpr: true, prefix: true, startsExpr: true}),
+ logicalOR: binop("||", 1),
+ logicalAND: binop("&&", 2),
+ bitwiseOR: binop("|", 3),
+ bitwiseXOR: binop("^", 4),
+ bitwiseAND: binop("&", 5),
+ equality: binop("==/!=/===/!==", 6),
+ relational: binop(">/<=/>=", 7),
+ bitShift: binop("<>>/>>>", 8),
+ plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),
+ modulo: binop("%", 10),
+ star: binop("*", 10),
+ slash: binop("/", 10),
+ starstar: new TokenType("**", {beforeExpr: true}),
+ coalesce: binop("??", 1),
+
+ // Keyword token types.
+ _break: kw("break"),
+ _case: kw("case", beforeExpr),
+ _catch: kw("catch"),
+ _continue: kw("continue"),
+ _debugger: kw("debugger"),
+ _default: kw("default", beforeExpr),
+ _do: kw("do", {isLoop: true, beforeExpr: true}),
+ _else: kw("else", beforeExpr),
+ _finally: kw("finally"),
+ _for: kw("for", {isLoop: true}),
+ _function: kw("function", startsExpr),
+ _if: kw("if"),
+ _return: kw("return", beforeExpr),
+ _switch: kw("switch"),
+ _throw: kw("throw", beforeExpr),
+ _try: kw("try"),
+ _var: kw("var"),
+ _const: kw("const"),
+ _while: kw("while", {isLoop: true}),
+ _with: kw("with"),
+ _new: kw("new", {beforeExpr: true, startsExpr: true}),
+ _this: kw("this", startsExpr),
+ _super: kw("super", startsExpr),
+ _class: kw("class", startsExpr),
+ _extends: kw("extends", beforeExpr),
+ _export: kw("export"),
+ _import: kw("import", startsExpr),
+ _null: kw("null", startsExpr),
+ _true: kw("true", startsExpr),
+ _false: kw("false", startsExpr),
+ _in: kw("in", {beforeExpr: true, binop: 7}),
+ _instanceof: kw("instanceof", {beforeExpr: true, binop: 7}),
+ _typeof: kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true}),
+ _void: kw("void", {beforeExpr: true, prefix: true, startsExpr: true}),
+ _delete: kw("delete", {beforeExpr: true, prefix: true, startsExpr: true})
+};
+
+// Matches a whole line break (where CRLF is considered a single
+// line break). Used to count lines.
+
+var lineBreak = /\r\n?|\n|\u2028|\u2029/;
+var lineBreakG = new RegExp(lineBreak.source, "g");
+
+function isNewLine(code) {
+ return code === 10 || code === 13 || code === 0x2028 || code === 0x2029
+}
+
+function nextLineBreak(code, from, end) {
+ if ( end === void 0 ) end = code.length;
+
+ for (var i = from; i < end; i++) {
+ var next = code.charCodeAt(i);
+ if (isNewLine(next))
+ { return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1 }
+ }
+ return -1
+}
+
+var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
+
+var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
+
+var ref = Object.prototype;
+var hasOwnProperty$1 = ref.hasOwnProperty;
+var toString$1 = ref.toString;
+
+var hasOwn = Object.hasOwn || (function (obj, propName) { return (
+ hasOwnProperty$1.call(obj, propName)
+); });
+
+var isArray = Array.isArray || (function (obj) { return (
+ toString$1.call(obj) === "[object Array]"
+); });
+
+function wordsRegexp(words) {
+ return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")
+}
+
+function codePointToString(code) {
+ // UTF-16 Decoding
+ if (code <= 0xFFFF) { return String.fromCharCode(code) }
+ code -= 0x10000;
+ return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
+}
+
+var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
+
+// These are used when `options.locations` is on, for the
+// `startLoc` and `endLoc` properties.
+
+var Position = function Position(line, col) {
+ this.line = line;
+ this.column = col;
+};
+
+Position.prototype.offset = function offset (n) {
+ return new Position(this.line, this.column + n)
+};
+
+var SourceLocation = function SourceLocation(p, start, end) {
+ this.start = start;
+ this.end = end;
+ if (p.sourceFile !== null) { this.source = p.sourceFile; }
+};
+
+// The `getLineInfo` function is mostly useful when the
+// `locations` option is off (for performance reasons) and you
+// want to find the line/column position for a given character
+// offset. `input` should be the code string that the offset refers
+// into.
+
+function getLineInfo(input, offset) {
+ for (var line = 1, cur = 0;;) {
+ var nextBreak = nextLineBreak(input, cur, offset);
+ if (nextBreak < 0) { return new Position(line, offset - cur) }
+ ++line;
+ cur = nextBreak;
+ }
+}
+
+// A second argument must be given to configure the parser process.
+// These options are recognized (only `ecmaVersion` is required):
+
+var defaultOptions = {
+ // `ecmaVersion` indicates the ECMAScript version to parse. Must be
+ // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
+ // (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"`
+ // (the latest version the library supports). This influences
+ // support for strict mode, the set of reserved words, and support
+ // for new syntax features.
+ ecmaVersion: null,
+ // `sourceType` indicates the mode the code should be parsed in.
+ // Can be either `"script"` or `"module"`. This influences global
+ // strict mode and parsing of `import` and `export` declarations.
+ sourceType: "script",
+ // `onInsertedSemicolon` can be a callback that will be called
+ // when a semicolon is automatically inserted. It will be passed
+ // the position of the comma as an offset, and if `locations` is
+ // enabled, it is given the location as a `{line, column}` object
+ // as second argument.
+ onInsertedSemicolon: null,
+ // `onTrailingComma` is similar to `onInsertedSemicolon`, but for
+ // trailing commas.
+ onTrailingComma: null,
+ // By default, reserved words are only enforced if ecmaVersion >= 5.
+ // Set `allowReserved` to a boolean value to explicitly turn this on
+ // an off. When this option has the value "never", reserved words
+ // and keywords can also not be used as property names.
+ allowReserved: null,
+ // When enabled, a return at the top level is not considered an
+ // error.
+ allowReturnOutsideFunction: false,
+ // When enabled, import/export statements are not constrained to
+ // appearing at the top of the program, and an import.meta expression
+ // in a script isn't considered an error.
+ allowImportExportEverywhere: false,
+ // By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022.
+ // When enabled, await identifiers are allowed to appear at the top-level scope,
+ // but they are still not allowed in non-async functions.
+ allowAwaitOutsideFunction: null,
+ // When enabled, super identifiers are not constrained to
+ // appearing in methods and do not raise an error when they appear elsewhere.
+ allowSuperOutsideMethod: null,
+ // When enabled, hashbang directive in the beginning of file is
+ // allowed and treated as a line comment. Enabled by default when
+ // `ecmaVersion` >= 2023.
+ allowHashBang: false,
+ // By default, the parser will verify that private properties are
+ // only used in places where they are valid and have been declared.
+ // Set this to false to turn such checks off.
+ checkPrivateFields: true,
+ // When `locations` is on, `loc` properties holding objects with
+ // `start` and `end` properties in `{line, column}` form (with
+ // line being 1-based and column 0-based) will be attached to the
+ // nodes.
+ locations: false,
+ // A function can be passed as `onToken` option, which will
+ // cause Acorn to call that function with object in the same
+ // format as tokens returned from `tokenizer().getToken()`. Note
+ // that you are not allowed to call the parser from the
+ // callback—that will corrupt its internal state.
+ onToken: null,
+ // A function can be passed as `onComment` option, which will
+ // cause Acorn to call that function with `(block, text, start,
+ // end)` parameters whenever a comment is skipped. `block` is a
+ // boolean indicating whether this is a block (`/* */`) comment,
+ // `text` is the content of the comment, and `start` and `end` are
+ // character offsets that denote the start and end of the comment.
+ // When the `locations` option is on, two more parameters are
+ // passed, the full `{line, column}` locations of the start and
+ // end of the comments. Note that you are not allowed to call the
+ // parser from the callback—that will corrupt its internal state.
+ onComment: null,
+ // Nodes have their start and end characters offsets recorded in
+ // `start` and `end` properties (directly on the node, rather than
+ // the `loc` object, which holds line/column data. To also add a
+ // [semi-standardized][range] `range` property holding a `[start,
+ // end]` array with the same numbers, set the `ranges` option to
+ // `true`.
+ //
+ // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
+ ranges: false,
+ // It is possible to parse multiple files into a single AST by
+ // passing the tree produced by parsing the first file as
+ // `program` option in subsequent parses. This will add the
+ // toplevel forms of the parsed file to the `Program` (top) node
+ // of an existing parse tree.
+ program: null,
+ // When `locations` is on, you can pass this to record the source
+ // file in every node's `loc` object.
+ sourceFile: null,
+ // This value, if given, is stored in every node, whether
+ // `locations` is on or off.
+ directSourceFile: null,
+ // When enabled, parenthesized expressions are represented by
+ // (non-standard) ParenthesizedExpression nodes
+ preserveParens: false
+};
+
+// Interpret and default an options object
+
+var warnedAboutEcmaVersion = false;
+
+function getOptions(opts) {
+ var options = {};
+
+ for (var opt in defaultOptions)
+ { options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt]; }
+
+ if (options.ecmaVersion === "latest") {
+ options.ecmaVersion = 1e8;
+ } else if (options.ecmaVersion == null) {
+ if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) {
+ warnedAboutEcmaVersion = true;
+ console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.");
+ }
+ options.ecmaVersion = 11;
+ } else if (options.ecmaVersion >= 2015) {
+ options.ecmaVersion -= 2009;
+ }
+
+ if (options.allowReserved == null)
+ { options.allowReserved = options.ecmaVersion < 5; }
+
+ if (!opts || opts.allowHashBang == null)
+ { options.allowHashBang = options.ecmaVersion >= 14; }
+
+ if (isArray(options.onToken)) {
+ var tokens = options.onToken;
+ options.onToken = function (token) { return tokens.push(token); };
+ }
+ if (isArray(options.onComment))
+ { options.onComment = pushComment(options, options.onComment); }
+
+ return options
+}
+
+function pushComment(options, array) {
+ return function(block, text, start, end, startLoc, endLoc) {
+ var comment = {
+ type: block ? "Block" : "Line",
+ value: text,
+ start: start,
+ end: end
+ };
+ if (options.locations)
+ { comment.loc = new SourceLocation(this, startLoc, endLoc); }
+ if (options.ranges)
+ { comment.range = [start, end]; }
+ array.push(comment);
+ }
+}
+
+// Each scope gets a bitset that may contain these flags
+var
+ SCOPE_TOP = 1,
+ SCOPE_FUNCTION = 2,
+ SCOPE_ASYNC = 4,
+ SCOPE_GENERATOR = 8,
+ SCOPE_ARROW = 16,
+ SCOPE_SIMPLE_CATCH = 32,
+ SCOPE_SUPER = 64,
+ SCOPE_DIRECT_SUPER = 128,
+ SCOPE_CLASS_STATIC_BLOCK = 256,
+ SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
+
+function functionFlags(async, generator) {
+ return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0)
+}
+
+// Used in checkLVal* and declareName to determine the type of a binding
+var
+ BIND_NONE = 0, // Not a binding
+ BIND_VAR = 1, // Var-style binding
+ BIND_LEXICAL = 2, // Let- or const-style binding
+ BIND_FUNCTION = 3, // Function declaration
+ BIND_SIMPLE_CATCH = 4, // Simple (identifier pattern) catch binding
+ BIND_OUTSIDE = 5; // Special case for function names as bound inside the function
+
+var Parser$1 = function Parser(options, input, startPos) {
+ this.options = options = getOptions(options);
+ this.sourceFile = options.sourceFile;
+ this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
+ var reserved = "";
+ if (options.allowReserved !== true) {
+ reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
+ if (options.sourceType === "module") { reserved += " await"; }
+ }
+ this.reservedWords = wordsRegexp(reserved);
+ var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
+ this.reservedWordsStrict = wordsRegexp(reservedStrict);
+ this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
+ this.input = String(input);
+
+ // Used to signal to callers of `readWord1` whether the word
+ // contained any escape sequences. This is needed because words with
+ // escape sequences must not be interpreted as keywords.
+ this.containsEsc = false;
+
+ // Set up token state
+
+ // The current position of the tokenizer in the input.
+ if (startPos) {
+ this.pos = startPos;
+ this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
+ this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
+ } else {
+ this.pos = this.lineStart = 0;
+ this.curLine = 1;
+ }
+
+ // Properties of the current token:
+ // Its type
+ this.type = types$1.eof;
+ // For tokens that include more information than their type, the value
+ this.value = null;
+ // Its start and end offset
+ this.start = this.end = this.pos;
+ // And, if locations are used, the {line, column} object
+ // corresponding to those offsets
+ this.startLoc = this.endLoc = this.curPosition();
+
+ // Position information for the previous token
+ this.lastTokEndLoc = this.lastTokStartLoc = null;
+ this.lastTokStart = this.lastTokEnd = this.pos;
+
+ // The context stack is used to superficially track syntactic
+ // context to predict whether a regular expression is allowed in a
+ // given position.
+ this.context = this.initialContext();
+ this.exprAllowed = true;
+
+ // Figure out if it's a module code.
+ this.inModule = options.sourceType === "module";
+ this.strict = this.inModule || this.strictDirective(this.pos);
+
+ // Used to signify the start of a potential arrow function
+ this.potentialArrowAt = -1;
+ this.potentialArrowInForAwait = false;
+
+ // Positions to delayed-check that yield/await does not exist in default parameters.
+ this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
+ // Labels in scope.
+ this.labels = [];
+ // Thus-far undefined exports.
+ this.undefinedExports = Object.create(null);
+
+ // If enabled, skip leading hashbang line.
+ if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!")
+ { this.skipLineComment(2); }
+
+ // Scope tracking for duplicate variable names (see scope.js)
+ this.scopeStack = [];
+ this.enterScope(SCOPE_TOP);
+
+ // For RegExp validation
+ this.regexpState = null;
+
+ // The stack of private names.
+ // Each element has two properties: 'declared' and 'used'.
+ // When it exited from the outermost class definition, all used private names must be declared.
+ this.privateNameStack = [];
+};
+
+var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },inClassStaticBlock: { configurable: true } };
+
+Parser$1.prototype.parse = function parse () {
+ var node = this.options.program || this.startNode();
+ this.nextToken();
+ return this.parseTopLevel(node)
+};
+
+prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
+
+prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
+
+prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
+
+prototypeAccessors.canAwait.get = function () {
+ for (var i = this.scopeStack.length - 1; i >= 0; i--) {
+ var scope = this.scopeStack[i];
+ if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) { return false }
+ if (scope.flags & SCOPE_FUNCTION) { return (scope.flags & SCOPE_ASYNC) > 0 }
+ }
+ return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
+};
+
+prototypeAccessors.allowSuper.get = function () {
+ var ref = this.currentThisScope();
+ var flags = ref.flags;
+ var inClassFieldInit = ref.inClassFieldInit;
+ return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
+};
+
+prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
+
+prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
+
+prototypeAccessors.allowNewDotTarget.get = function () {
+ var ref = this.currentThisScope();
+ var flags = ref.flags;
+ var inClassFieldInit = ref.inClassFieldInit;
+ return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit
+};
+
+prototypeAccessors.inClassStaticBlock.get = function () {
+ return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
+};
+
+Parser$1.extend = function extend () {
+ var plugins = [], len = arguments.length;
+ while ( len-- ) plugins[ len ] = arguments[ len ];
+
+ var cls = this;
+ for (var i = 0; i < plugins.length; i++) { cls = plugins[i](cls); }
+ return cls
+};
+
+Parser$1.parse = function parse (input, options) {
+ return new this(options, input).parse()
+};
+
+Parser$1.parseExpressionAt = function parseExpressionAt (input, pos, options) {
+ var parser = new this(options, input, pos);
+ parser.nextToken();
+ return parser.parseExpression()
+};
+
+Parser$1.tokenizer = function tokenizer (input, options) {
+ return new this(options, input)
+};
+
+Object.defineProperties( Parser$1.prototype, prototypeAccessors );
+
+var pp$9 = Parser$1.prototype;
+
+// ## Parser utilities
+
+var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
+pp$9.strictDirective = function(start) {
+ if (this.options.ecmaVersion < 5) { return false }
+ for (;;) {
+ // Try to find string literal.
+ skipWhiteSpace.lastIndex = start;
+ start += skipWhiteSpace.exec(this.input)[0].length;
+ var match = literal.exec(this.input.slice(start));
+ if (!match) { return false }
+ if ((match[1] || match[2]) === "use strict") {
+ skipWhiteSpace.lastIndex = start + match[0].length;
+ var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;
+ var next = this.input.charAt(end);
+ return next === ";" || next === "}" ||
+ (lineBreak.test(spaceAfter[0]) &&
+ !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "="))
+ }
+ start += match[0].length;
+
+ // Skip semicolon, if any.
+ skipWhiteSpace.lastIndex = start;
+ start += skipWhiteSpace.exec(this.input)[0].length;
+ if (this.input[start] === ";")
+ { start++; }
+ }
+};
+
+// Predicate that tests whether the next token is of the given
+// type, and if yes, consumes it as a side effect.
+
+pp$9.eat = function(type) {
+ if (this.type === type) {
+ this.next();
+ return true
+ } else {
+ return false
+ }
+};
+
+// Tests whether parsed token is a contextual keyword.
+
+pp$9.isContextual = function(name) {
+ return this.type === types$1.name && this.value === name && !this.containsEsc
+};
+
+// Consumes contextual keyword if possible.
+
+pp$9.eatContextual = function(name) {
+ if (!this.isContextual(name)) { return false }
+ this.next();
+ return true
+};
+
+// Asserts that following token is given contextual keyword.
+
+pp$9.expectContextual = function(name) {
+ if (!this.eatContextual(name)) { this.unexpected(); }
+};
+
+// Test whether a semicolon can be inserted at the current position.
+
+pp$9.canInsertSemicolon = function() {
+ return this.type === types$1.eof ||
+ this.type === types$1.braceR ||
+ lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
+};
+
+pp$9.insertSemicolon = function() {
+ if (this.canInsertSemicolon()) {
+ if (this.options.onInsertedSemicolon)
+ { this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }
+ return true
+ }
+};
+
+// Consume a semicolon, or, failing that, see if we are allowed to
+// pretend that there is a semicolon at this position.
+
+pp$9.semicolon = function() {
+ if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }
+};
+
+pp$9.afterTrailingComma = function(tokType, notNext) {
+ if (this.type === tokType) {
+ if (this.options.onTrailingComma)
+ { this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
+ if (!notNext)
+ { this.next(); }
+ return true
+ }
+};
+
+// Expect a token of a given type. If found, consume it, otherwise,
+// raise an unexpected token error.
+
+pp$9.expect = function(type) {
+ this.eat(type) || this.unexpected();
+};
+
+// Raise an unexpected token error.
+
+pp$9.unexpected = function(pos) {
+ this.raise(pos != null ? pos : this.start, "Unexpected token");
+};
+
+var DestructuringErrors = function DestructuringErrors() {
+ this.shorthandAssign =
+ this.trailingComma =
+ this.parenthesizedAssign =
+ this.parenthesizedBind =
+ this.doubleProto =
+ -1;
+};
+
+pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
+ if (!refDestructuringErrors) { return }
+ if (refDestructuringErrors.trailingComma > -1)
+ { this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
+ var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
+ if (parens > -1) { this.raiseRecoverable(parens, isAssign ? "Assigning to rvalue" : "Parenthesized pattern"); }
+};
+
+pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
+ if (!refDestructuringErrors) { return false }
+ var shorthandAssign = refDestructuringErrors.shorthandAssign;
+ var doubleProto = refDestructuringErrors.doubleProto;
+ if (!andThrow) { return shorthandAssign >= 0 || doubleProto >= 0 }
+ if (shorthandAssign >= 0)
+ { this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"); }
+ if (doubleProto >= 0)
+ { this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property"); }
+};
+
+pp$9.checkYieldAwaitInDefaultParams = function() {
+ if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))
+ { this.raise(this.yieldPos, "Yield expression cannot be a default value"); }
+ if (this.awaitPos)
+ { this.raise(this.awaitPos, "Await expression cannot be a default value"); }
+};
+
+pp$9.isSimpleAssignTarget = function(expr) {
+ if (expr.type === "ParenthesizedExpression")
+ { return this.isSimpleAssignTarget(expr.expression) }
+ return expr.type === "Identifier" || expr.type === "MemberExpression"
+};
+
+var pp$8 = Parser$1.prototype;
+
+// ### Statement parsing
+
+// Parse a program. Initializes the parser, reads any number of
+// statements, and wraps them in a Program node. Optionally takes a
+// `program` argument. If present, the statements will be appended
+// to its body instead of creating a new node.
+
+pp$8.parseTopLevel = function(node) {
+ var exports = Object.create(null);
+ if (!node.body) { node.body = []; }
+ while (this.type !== types$1.eof) {
+ var stmt = this.parseStatement(null, true, exports);
+ node.body.push(stmt);
+ }
+ if (this.inModule)
+ { for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1)
+ {
+ var name = list[i];
+
+ this.raiseRecoverable(this.undefinedExports[name].start, ("Export '" + name + "' is not defined"));
+ } }
+ this.adaptDirectivePrologue(node.body);
+ this.next();
+ node.sourceType = this.options.sourceType;
+ return this.finishNode(node, "Program")
+};
+
+var loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"};
+
+pp$8.isLet = function(context) {
+ if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
+ skipWhiteSpace.lastIndex = this.pos;
+ var skip = skipWhiteSpace.exec(this.input);
+ var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
+ // For ambiguous cases, determine if a LexicalDeclaration (or only a
+ // Statement) is allowed here. If context is not empty then only a Statement
+ // is allowed. However, `let [` is an explicit negative lookahead for
+ // ExpressionStatement, so special-case it first.
+ if (nextCh === 91 || nextCh === 92) { return true } // '[', '/'
+ if (context) { return false }
+
+ if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '{', astral
+ if (isIdentifierStart(nextCh, true)) {
+ var pos = next + 1;
+ while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; }
+ if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true }
+ var ident = this.input.slice(next, pos);
+ if (!keywordRelationalOperator.test(ident)) { return true }
+ }
+ return false
+};
+
+// check 'async [no LineTerminator here] function'
+// - 'async /*foo*/ function' is OK.
+// - 'async /*\n*/ function' is invalid.
+pp$8.isAsyncFunction = function() {
+ if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
+ { return false }
+
+ skipWhiteSpace.lastIndex = this.pos;
+ var skip = skipWhiteSpace.exec(this.input);
+ var next = this.pos + skip[0].length, after;
+ return !lineBreak.test(this.input.slice(this.pos, next)) &&
+ this.input.slice(next, next + 8) === "function" &&
+ (next + 8 === this.input.length ||
+ !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00))
+};
+
+// Parse a single statement.
+//
+// If expecting a statement and finding a slash operator, parse a
+// regular expression literal. This is to handle cases like
+// `if (foo) /blah/.exec(foo)`, where looking at the previous token
+// does not help.
+
+pp$8.parseStatement = function(context, topLevel, exports) {
+ var starttype = this.type, node = this.startNode(), kind;
+
+ if (this.isLet(context)) {
+ starttype = types$1._var;
+ kind = "let";
+ }
+
+ // Most types of statements are recognized by the keyword they
+ // start with. Many are trivial to parse, some require a bit of
+ // complexity.
+
+ switch (starttype) {
+ case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
+ case types$1._debugger: return this.parseDebuggerStatement(node)
+ case types$1._do: return this.parseDoStatement(node)
+ case types$1._for: return this.parseForStatement(node)
+ case types$1._function:
+ // Function as sole body of either an if statement or a labeled statement
+ // works, but not when it is part of a labeled statement that is the sole
+ // body of an if statement.
+ if ((context && (this.strict || context !== "if" && context !== "label")) && this.options.ecmaVersion >= 6) { this.unexpected(); }
+ return this.parseFunctionStatement(node, false, !context)
+ case types$1._class:
+ if (context) { this.unexpected(); }
+ return this.parseClass(node, true)
+ case types$1._if: return this.parseIfStatement(node)
+ case types$1._return: return this.parseReturnStatement(node)
+ case types$1._switch: return this.parseSwitchStatement(node)
+ case types$1._throw: return this.parseThrowStatement(node)
+ case types$1._try: return this.parseTryStatement(node)
+ case types$1._const: case types$1._var:
+ kind = kind || this.value;
+ if (context && kind !== "var") { this.unexpected(); }
+ return this.parseVarStatement(node, kind)
+ case types$1._while: return this.parseWhileStatement(node)
+ case types$1._with: return this.parseWithStatement(node)
+ case types$1.braceL: return this.parseBlock(true, node)
+ case types$1.semi: return this.parseEmptyStatement(node)
+ case types$1._export:
+ case types$1._import:
+ if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
+ skipWhiteSpace.lastIndex = this.pos;
+ var skip = skipWhiteSpace.exec(this.input);
+ var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
+ if (nextCh === 40 || nextCh === 46) // '(' or '.'
+ { return this.parseExpressionStatement(node, this.parseExpression()) }
+ }
+
+ if (!this.options.allowImportExportEverywhere) {
+ if (!topLevel)
+ { this.raise(this.start, "'import' and 'export' may only appear at the top level"); }
+ if (!this.inModule)
+ { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
+ }
+ return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
+
+ // If the statement does not start with a statement keyword or a
+ // brace, it's an ExpressionStatement or LabeledStatement. We
+ // simply start parsing an expression, and afterwards, if the
+ // next token is a colon and the expression was a simple
+ // Identifier node, we switch to interpreting it as a label.
+ default:
+ if (this.isAsyncFunction()) {
+ if (context) { this.unexpected(); }
+ this.next();
+ return this.parseFunctionStatement(node, true, !context)
+ }
+
+ var maybeName = this.value, expr = this.parseExpression();
+ if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon))
+ { return this.parseLabeledStatement(node, maybeName, expr, context) }
+ else { return this.parseExpressionStatement(node, expr) }
+ }
+};
+
+pp$8.parseBreakContinueStatement = function(node, keyword) {
+ var isBreak = keyword === "break";
+ this.next();
+ if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }
+ else if (this.type !== types$1.name) { this.unexpected(); }
+ else {
+ node.label = this.parseIdent();
+ this.semicolon();
+ }
+
+ // Verify that there is an actual destination to break or
+ // continue to.
+ var i = 0;
+ for (; i < this.labels.length; ++i) {
+ var lab = this.labels[i];
+ if (node.label == null || lab.name === node.label.name) {
+ if (lab.kind != null && (isBreak || lab.kind === "loop")) { break }
+ if (node.label && isBreak) { break }
+ }
+ }
+ if (i === this.labels.length) { this.raise(node.start, "Unsyntactic " + keyword); }
+ return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
+};
+
+pp$8.parseDebuggerStatement = function(node) {
+ this.next();
+ this.semicolon();
+ return this.finishNode(node, "DebuggerStatement")
+};
+
+pp$8.parseDoStatement = function(node) {
+ this.next();
+ this.labels.push(loopLabel);
+ node.body = this.parseStatement("do");
+ this.labels.pop();
+ this.expect(types$1._while);
+ node.test = this.parseParenExpression();
+ if (this.options.ecmaVersion >= 6)
+ { this.eat(types$1.semi); }
+ else
+ { this.semicolon(); }
+ return this.finishNode(node, "DoWhileStatement")
+};
+
+// Disambiguating between a `for` and a `for`/`in` or `for`/`of`
+// loop is non-trivial. Basically, we have to parse the init `var`
+// statement or expression, disallowing the `in` operator (see
+// the second parameter to `parseExpression`), and then check
+// whether the next token is `in` or `of`. When there is no init
+// part (semicolon immediately after the opening parenthesis), it
+// is a regular `for` loop.
+
+pp$8.parseForStatement = function(node) {
+ this.next();
+ var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await")) ? this.lastTokStart : -1;
+ this.labels.push(loopLabel);
+ this.enterScope(0);
+ this.expect(types$1.parenL);
+ if (this.type === types$1.semi) {
+ if (awaitAt > -1) { this.unexpected(awaitAt); }
+ return this.parseFor(node, null)
+ }
+ var isLet = this.isLet();
+ if (this.type === types$1._var || this.type === types$1._const || isLet) {
+ var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
+ this.next();
+ this.parseVar(init$1, true, kind);
+ this.finishNode(init$1, "VariableDeclaration");
+ if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
+ if (this.options.ecmaVersion >= 9) {
+ if (this.type === types$1._in) {
+ if (awaitAt > -1) { this.unexpected(awaitAt); }
+ } else { node.await = awaitAt > -1; }
+ }
+ return this.parseForIn(node, init$1)
+ }
+ if (awaitAt > -1) { this.unexpected(awaitAt); }
+ return this.parseFor(node, init$1)
+ }
+ var startsWithLet = this.isContextual("let"), isForOf = false;
+ var refDestructuringErrors = new DestructuringErrors;
+ var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
+ if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
+ if (this.options.ecmaVersion >= 9) {
+ if (this.type === types$1._in) {
+ if (awaitAt > -1) { this.unexpected(awaitAt); }
+ } else { node.await = awaitAt > -1; }
+ }
+ if (startsWithLet && isForOf) { this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."); }
+ this.toAssignable(init, false, refDestructuringErrors);
+ this.checkLValPattern(init);
+ return this.parseForIn(node, init)
+ } else {
+ this.checkExpressionErrors(refDestructuringErrors, true);
+ }
+ if (awaitAt > -1) { this.unexpected(awaitAt); }
+ return this.parseFor(node, init)
+};
+
+pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
+ this.next();
+ return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)
+};
+
+pp$8.parseIfStatement = function(node) {
+ this.next();
+ node.test = this.parseParenExpression();
+ // allow function declarations in branches, but only in non-strict mode
+ node.consequent = this.parseStatement("if");
+ node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
+ return this.finishNode(node, "IfStatement")
+};
+
+pp$8.parseReturnStatement = function(node) {
+ if (!this.inFunction && !this.options.allowReturnOutsideFunction)
+ { this.raise(this.start, "'return' outside of function"); }
+ this.next();
+
+ // In `return` (and `break`/`continue`), the keywords with
+ // optional arguments, we eagerly look for a semicolon or the
+ // possibility to insert one.
+
+ if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }
+ else { node.argument = this.parseExpression(); this.semicolon(); }
+ return this.finishNode(node, "ReturnStatement")
+};
+
+pp$8.parseSwitchStatement = function(node) {
+ this.next();
+ node.discriminant = this.parseParenExpression();
+ node.cases = [];
+ this.expect(types$1.braceL);
+ this.labels.push(switchLabel);
+ this.enterScope(0);
+
+ // Statements under must be grouped (by label) in SwitchCase
+ // nodes. `cur` is used to keep the node that we are currently
+ // adding statements to.
+
+ var cur;
+ for (var sawDefault = false; this.type !== types$1.braceR;) {
+ if (this.type === types$1._case || this.type === types$1._default) {
+ var isCase = this.type === types$1._case;
+ if (cur) { this.finishNode(cur, "SwitchCase"); }
+ node.cases.push(cur = this.startNode());
+ cur.consequent = [];
+ this.next();
+ if (isCase) {
+ cur.test = this.parseExpression();
+ } else {
+ if (sawDefault) { this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"); }
+ sawDefault = true;
+ cur.test = null;
+ }
+ this.expect(types$1.colon);
+ } else {
+ if (!cur) { this.unexpected(); }
+ cur.consequent.push(this.parseStatement(null));
+ }
+ }
+ this.exitScope();
+ if (cur) { this.finishNode(cur, "SwitchCase"); }
+ this.next(); // Closing brace
+ this.labels.pop();
+ return this.finishNode(node, "SwitchStatement")
+};
+
+pp$8.parseThrowStatement = function(node) {
+ this.next();
+ if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
+ { this.raise(this.lastTokEnd, "Illegal newline after throw"); }
+ node.argument = this.parseExpression();
+ this.semicolon();
+ return this.finishNode(node, "ThrowStatement")
+};
+
+// Reused empty array added for node fields that are always empty.
+
+var empty$1 = [];
+
+pp$8.parseCatchClauseParam = function() {
+ var param = this.parseBindingAtom();
+ var simple = param.type === "Identifier";
+ this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
+ this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
+ this.expect(types$1.parenR);
+
+ return param
+};
+
+pp$8.parseTryStatement = function(node) {
+ this.next();
+ node.block = this.parseBlock();
+ node.handler = null;
+ if (this.type === types$1._catch) {
+ var clause = this.startNode();
+ this.next();
+ if (this.eat(types$1.parenL)) {
+ clause.param = this.parseCatchClauseParam();
+ } else {
+ if (this.options.ecmaVersion < 10) { this.unexpected(); }
+ clause.param = null;
+ this.enterScope(0);
+ }
+ clause.body = this.parseBlock(false);
+ this.exitScope();
+ node.handler = this.finishNode(clause, "CatchClause");
+ }
+ node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
+ if (!node.handler && !node.finalizer)
+ { this.raise(node.start, "Missing catch or finally clause"); }
+ return this.finishNode(node, "TryStatement")
+};
+
+pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {
+ this.next();
+ this.parseVar(node, false, kind, allowMissingInitializer);
+ this.semicolon();
+ return this.finishNode(node, "VariableDeclaration")
+};
+
+pp$8.parseWhileStatement = function(node) {
+ this.next();
+ node.test = this.parseParenExpression();
+ this.labels.push(loopLabel);
+ node.body = this.parseStatement("while");
+ this.labels.pop();
+ return this.finishNode(node, "WhileStatement")
+};
+
+pp$8.parseWithStatement = function(node) {
+ if (this.strict) { this.raise(this.start, "'with' in strict mode"); }
+ this.next();
+ node.object = this.parseParenExpression();
+ node.body = this.parseStatement("with");
+ return this.finishNode(node, "WithStatement")
+};
+
+pp$8.parseEmptyStatement = function(node) {
+ this.next();
+ return this.finishNode(node, "EmptyStatement")
+};
+
+pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
+ for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)
+ {
+ var label = list[i$1];
+
+ if (label.name === maybeName)
+ { this.raise(expr.start, "Label '" + maybeName + "' is already declared");
+ } }
+ var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
+ for (var i = this.labels.length - 1; i >= 0; i--) {
+ var label$1 = this.labels[i];
+ if (label$1.statementStart === node.start) {
+ // Update information about previous labels on this node
+ label$1.statementStart = this.start;
+ label$1.kind = kind;
+ } else { break }
+ }
+ this.labels.push({name: maybeName, kind: kind, statementStart: this.start});
+ node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label");
+ this.labels.pop();
+ node.label = expr;
+ return this.finishNode(node, "LabeledStatement")
+};
+
+pp$8.parseExpressionStatement = function(node, expr) {
+ node.expression = expr;
+ this.semicolon();
+ return this.finishNode(node, "ExpressionStatement")
+};
+
+// Parse a semicolon-enclosed block of statements, handling `"use
+// strict"` declarations when `allowStrict` is true (used for
+// function bodies).
+
+pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
+ if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;
+ if ( node === void 0 ) node = this.startNode();
+
+ node.body = [];
+ this.expect(types$1.braceL);
+ if (createNewLexicalScope) { this.enterScope(0); }
+ while (this.type !== types$1.braceR) {
+ var stmt = this.parseStatement(null);
+ node.body.push(stmt);
+ }
+ if (exitStrict) { this.strict = false; }
+ this.next();
+ if (createNewLexicalScope) { this.exitScope(); }
+ return this.finishNode(node, "BlockStatement")
+};
+
+// Parse a regular `for` loop. The disambiguation code in
+// `parseStatement` will already have parsed the init statement or
+// expression.
+
+pp$8.parseFor = function(node, init) {
+ node.init = init;
+ this.expect(types$1.semi);
+ node.test = this.type === types$1.semi ? null : this.parseExpression();
+ this.expect(types$1.semi);
+ node.update = this.type === types$1.parenR ? null : this.parseExpression();
+ this.expect(types$1.parenR);
+ node.body = this.parseStatement("for");
+ this.exitScope();
+ this.labels.pop();
+ return this.finishNode(node, "ForStatement")
+};
+
+// Parse a `for`/`in` and `for`/`of` loop, which are almost
+// same from parser's perspective.
+
+pp$8.parseForIn = function(node, init) {
+ var isForIn = this.type === types$1._in;
+ this.next();
+
+ if (
+ init.type === "VariableDeclaration" &&
+ init.declarations[0].init != null &&
+ (
+ !isForIn ||
+ this.options.ecmaVersion < 8 ||
+ this.strict ||
+ init.kind !== "var" ||
+ init.declarations[0].id.type !== "Identifier"
+ )
+ ) {
+ this.raise(
+ init.start,
+ ((isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer")
+ );
+ }
+ node.left = init;
+ node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
+ this.expect(types$1.parenR);
+ node.body = this.parseStatement("for");
+ this.exitScope();
+ this.labels.pop();
+ return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement")
+};
+
+// Parse a list of variable declarations.
+
+pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
+ node.declarations = [];
+ node.kind = kind;
+ for (;;) {
+ var decl = this.startNode();
+ this.parseVarId(decl, kind);
+ if (this.eat(types$1.eq)) {
+ decl.init = this.parseMaybeAssign(isFor);
+ } else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
+ this.unexpected();
+ } else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
+ this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
+ } else {
+ decl.init = null;
+ }
+ node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
+ if (!this.eat(types$1.comma)) { break }
+ }
+ return node
+};
+
+pp$8.parseVarId = function(decl, kind) {
+ decl.id = this.parseBindingAtom();
+ this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
+};
+
+var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
+
+// Parse a function declaration or literal (depending on the
+// `statement & FUNC_STATEMENT`).
+
+// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
+pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
+ this.initFunction(node);
+ if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
+ if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))
+ { this.unexpected(); }
+ node.generator = this.eat(types$1.star);
+ }
+ if (this.options.ecmaVersion >= 8)
+ { node.async = !!isAsync; }
+
+ if (statement & FUNC_STATEMENT) {
+ node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();
+ if (node.id && !(statement & FUNC_HANGING_STATEMENT))
+ // If it is a regular function declaration in sloppy mode, then it is
+ // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
+ // mode depends on properties of the current scope (see
+ // treatFunctionsAsVar).
+ { this.checkLValSimple(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); }
+ }
+
+ var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
+ this.yieldPos = 0;
+ this.awaitPos = 0;
+ this.awaitIdentPos = 0;
+ this.enterScope(functionFlags(node.async, node.generator));
+
+ if (!(statement & FUNC_STATEMENT))
+ { node.id = this.type === types$1.name ? this.parseIdent() : null; }
+
+ this.parseFunctionParams(node);
+ this.parseFunctionBody(node, allowExpressionBody, false, forInit);
+
+ this.yieldPos = oldYieldPos;
+ this.awaitPos = oldAwaitPos;
+ this.awaitIdentPos = oldAwaitIdentPos;
+ return this.finishNode(node, (statement & FUNC_STATEMENT) ? "FunctionDeclaration" : "FunctionExpression")
+};
+
+pp$8.parseFunctionParams = function(node) {
+ this.expect(types$1.parenL);
+ node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
+ this.checkYieldAwaitInDefaultParams();
+};
+
+// Parse a class declaration or literal (depending on the
+// `isStatement` parameter).
+
+pp$8.parseClass = function(node, isStatement) {
+ this.next();
+
+ // ecma-262 14.6 Class Definitions
+ // A class definition is always strict mode code.
+ var oldStrict = this.strict;
+ this.strict = true;
+
+ this.parseClassId(node, isStatement);
+ this.parseClassSuper(node);
+ var privateNameMap = this.enterClassBody();
+ var classBody = this.startNode();
+ var hadConstructor = false;
+ classBody.body = [];
+ this.expect(types$1.braceL);
+ while (this.type !== types$1.braceR) {
+ var element = this.parseClassElement(node.superClass !== null);
+ if (element) {
+ classBody.body.push(element);
+ if (element.type === "MethodDefinition" && element.kind === "constructor") {
+ if (hadConstructor) { this.raiseRecoverable(element.start, "Duplicate constructor in the same class"); }
+ hadConstructor = true;
+ } else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
+ this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared"));
+ }
+ }
+ }
+ this.strict = oldStrict;
+ this.next();
+ node.body = this.finishNode(classBody, "ClassBody");
+ this.exitClassBody();
+ return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
+};
+
+pp$8.parseClassElement = function(constructorAllowsSuper) {
+ if (this.eat(types$1.semi)) { return null }
+
+ var ecmaVersion = this.options.ecmaVersion;
+ var node = this.startNode();
+ var keyName = "";
+ var isGenerator = false;
+ var isAsync = false;
+ var kind = "method";
+ var isStatic = false;
+
+ if (this.eatContextual("static")) {
+ // Parse static init block
+ if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
+ this.parseClassStaticBlock(node);
+ return node
+ }
+ if (this.isClassElementNameStart() || this.type === types$1.star) {
+ isStatic = true;
+ } else {
+ keyName = "static";
+ }
+ }
+ node.static = isStatic;
+ if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
+ if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
+ isAsync = true;
+ } else {
+ keyName = "async";
+ }
+ }
+ if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
+ isGenerator = true;
+ }
+ if (!keyName && !isAsync && !isGenerator) {
+ var lastValue = this.value;
+ if (this.eatContextual("get") || this.eatContextual("set")) {
+ if (this.isClassElementNameStart()) {
+ kind = lastValue;
+ } else {
+ keyName = lastValue;
+ }
+ }
+ }
+
+ // Parse element name
+ if (keyName) {
+ // 'async', 'get', 'set', or 'static' were not a keyword contextually.
+ // The last token is any of those. Make it the element name.
+ node.computed = false;
+ node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);
+ node.key.name = keyName;
+ this.finishNode(node.key, "Identifier");
+ } else {
+ this.parseClassElementName(node);
+ }
+
+ // Parse element value
+ if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
+ var isConstructor = !node.static && checkKeyName(node, "constructor");
+ var allowsDirectSuper = isConstructor && constructorAllowsSuper;
+ // Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
+ if (isConstructor && kind !== "method") { this.raise(node.key.start, "Constructor can't have get/set modifier"); }
+ node.kind = isConstructor ? "constructor" : kind;
+ this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper);
+ } else {
+ this.parseClassField(node);
+ }
+
+ return node
+};
+
+pp$8.isClassElementNameStart = function() {
+ return (
+ this.type === types$1.name ||
+ this.type === types$1.privateId ||
+ this.type === types$1.num ||
+ this.type === types$1.string ||
+ this.type === types$1.bracketL ||
+ this.type.keyword
+ )
+};
+
+pp$8.parseClassElementName = function(element) {
+ if (this.type === types$1.privateId) {
+ if (this.value === "constructor") {
+ this.raise(this.start, "Classes can't have an element named '#constructor'");
+ }
+ element.computed = false;
+ element.key = this.parsePrivateIdent();
+ } else {
+ this.parsePropertyName(element);
+ }
+};
+
+pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
+ // Check key and flags
+ var key = method.key;
+ if (method.kind === "constructor") {
+ if (isGenerator) { this.raise(key.start, "Constructor can't be a generator"); }
+ if (isAsync) { this.raise(key.start, "Constructor can't be an async method"); }
+ } else if (method.static && checkKeyName(method, "prototype")) {
+ this.raise(key.start, "Classes may not have a static property named prototype");
+ }
+
+ // Parse value
+ var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
+
+ // Check value
+ if (method.kind === "get" && value.params.length !== 0)
+ { this.raiseRecoverable(value.start, "getter should have no params"); }
+ if (method.kind === "set" && value.params.length !== 1)
+ { this.raiseRecoverable(value.start, "setter should have exactly one param"); }
+ if (method.kind === "set" && value.params[0].type === "RestElement")
+ { this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params"); }
+
+ return this.finishNode(method, "MethodDefinition")
+};
+
+pp$8.parseClassField = function(field) {
+ if (checkKeyName(field, "constructor")) {
+ this.raise(field.key.start, "Classes can't have a field named 'constructor'");
+ } else if (field.static && checkKeyName(field, "prototype")) {
+ this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
+ }
+
+ if (this.eat(types$1.eq)) {
+ // To raise SyntaxError if 'arguments' exists in the initializer.
+ var scope = this.currentThisScope();
+ var inClassFieldInit = scope.inClassFieldInit;
+ scope.inClassFieldInit = true;
+ field.value = this.parseMaybeAssign();
+ scope.inClassFieldInit = inClassFieldInit;
+ } else {
+ field.value = null;
+ }
+ this.semicolon();
+
+ return this.finishNode(field, "PropertyDefinition")
+};
+
+pp$8.parseClassStaticBlock = function(node) {
+ node.body = [];
+
+ var oldLabels = this.labels;
+ this.labels = [];
+ this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
+ while (this.type !== types$1.braceR) {
+ var stmt = this.parseStatement(null);
+ node.body.push(stmt);
+ }
+ this.next();
+ this.exitScope();
+ this.labels = oldLabels;
+
+ return this.finishNode(node, "StaticBlock")
+};
+
+pp$8.parseClassId = function(node, isStatement) {
+ if (this.type === types$1.name) {
+ node.id = this.parseIdent();
+ if (isStatement)
+ { this.checkLValSimple(node.id, BIND_LEXICAL, false); }
+ } else {
+ if (isStatement === true)
+ { this.unexpected(); }
+ node.id = null;
+ }
+};
+
+pp$8.parseClassSuper = function(node) {
+ node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, false) : null;
+};
+
+pp$8.enterClassBody = function() {
+ var element = {declared: Object.create(null), used: []};
+ this.privateNameStack.push(element);
+ return element.declared
+};
+
+pp$8.exitClassBody = function() {
+ var ref = this.privateNameStack.pop();
+ var declared = ref.declared;
+ var used = ref.used;
+ if (!this.options.checkPrivateFields) { return }
+ var len = this.privateNameStack.length;
+ var parent = len === 0 ? null : this.privateNameStack[len - 1];
+ for (var i = 0; i < used.length; ++i) {
+ var id = used[i];
+ if (!hasOwn(declared, id.name)) {
+ if (parent) {
+ parent.used.push(id);
+ } else {
+ this.raiseRecoverable(id.start, ("Private field '#" + (id.name) + "' must be declared in an enclosing class"));
+ }
+ }
+ }
+};
+
+function isPrivateNameConflicted(privateNameMap, element) {
+ var name = element.key.name;
+ var curr = privateNameMap[name];
+
+ var next = "true";
+ if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) {
+ next = (element.static ? "s" : "i") + element.kind;
+ }
+
+ // `class { get #a(){}; static set #a(_){} }` is also conflict.
+ if (
+ curr === "iget" && next === "iset" ||
+ curr === "iset" && next === "iget" ||
+ curr === "sget" && next === "sset" ||
+ curr === "sset" && next === "sget"
+ ) {
+ privateNameMap[name] = "true";
+ return false
+ } else if (!curr) {
+ privateNameMap[name] = next;
+ return false
+ } else {
+ return true
+ }
+}
+
+function checkKeyName(node, name) {
+ var computed = node.computed;
+ var key = node.key;
+ return !computed && (
+ key.type === "Identifier" && key.name === name ||
+ key.type === "Literal" && key.value === name
+ )
+}
+
+// Parses module export declaration.
+
+pp$8.parseExportAllDeclaration = function(node, exports) {
+ if (this.options.ecmaVersion >= 11) {
+ if (this.eatContextual("as")) {
+ node.exported = this.parseModuleExportName();
+ this.checkExport(exports, node.exported, this.lastTokStart);
+ } else {
+ node.exported = null;
+ }
+ }
+ this.expectContextual("from");
+ if (this.type !== types$1.string) { this.unexpected(); }
+ node.source = this.parseExprAtom();
+ this.semicolon();
+ return this.finishNode(node, "ExportAllDeclaration")
+};
+
+pp$8.parseExport = function(node, exports) {
+ this.next();
+ // export * from '...'
+ if (this.eat(types$1.star)) {
+ return this.parseExportAllDeclaration(node, exports)
+ }
+ if (this.eat(types$1._default)) { // export default ...
+ this.checkExport(exports, "default", this.lastTokStart);
+ node.declaration = this.parseExportDefaultDeclaration();
+ return this.finishNode(node, "ExportDefaultDeclaration")
+ }
+ // export var|const|let|function|class ...
+ if (this.shouldParseExportStatement()) {
+ node.declaration = this.parseExportDeclaration(node);
+ if (node.declaration.type === "VariableDeclaration")
+ { this.checkVariableExport(exports, node.declaration.declarations); }
+ else
+ { this.checkExport(exports, node.declaration.id, node.declaration.id.start); }
+ node.specifiers = [];
+ node.source = null;
+ } else { // export { x, y as z } [from '...']
+ node.declaration = null;
+ node.specifiers = this.parseExportSpecifiers(exports);
+ if (this.eatContextual("from")) {
+ if (this.type !== types$1.string) { this.unexpected(); }
+ node.source = this.parseExprAtom();
+ } else {
+ for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
+ // check for keywords used as local names
+ var spec = list[i];
+
+ this.checkUnreserved(spec.local);
+ // check if export is defined
+ this.checkLocalExport(spec.local);
+
+ if (spec.local.type === "Literal") {
+ this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`.");
+ }
+ }
+
+ node.source = null;
+ }
+ this.semicolon();
+ }
+ return this.finishNode(node, "ExportNamedDeclaration")
+};
+
+pp$8.parseExportDeclaration = function(node) {
+ return this.parseStatement(null)
+};
+
+pp$8.parseExportDefaultDeclaration = function() {
+ var isAsync;
+ if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
+ var fNode = this.startNode();
+ this.next();
+ if (isAsync) { this.next(); }
+ return this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync)
+ } else if (this.type === types$1._class) {
+ var cNode = this.startNode();
+ return this.parseClass(cNode, "nullableID")
+ } else {
+ var declaration = this.parseMaybeAssign();
+ this.semicolon();
+ return declaration
+ }
+};
+
+pp$8.checkExport = function(exports, name, pos) {
+ if (!exports) { return }
+ if (typeof name !== "string")
+ { name = name.type === "Identifier" ? name.name : name.value; }
+ if (hasOwn(exports, name))
+ { this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
+ exports[name] = true;
+};
+
+pp$8.checkPatternExport = function(exports, pat) {
+ var type = pat.type;
+ if (type === "Identifier")
+ { this.checkExport(exports, pat, pat.start); }
+ else if (type === "ObjectPattern")
+ { for (var i = 0, list = pat.properties; i < list.length; i += 1)
+ {
+ var prop = list[i];
+
+ this.checkPatternExport(exports, prop);
+ } }
+ else if (type === "ArrayPattern")
+ { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
+ var elt = list$1[i$1];
+
+ if (elt) { this.checkPatternExport(exports, elt); }
+ } }
+ else if (type === "Property")
+ { this.checkPatternExport(exports, pat.value); }
+ else if (type === "AssignmentPattern")
+ { this.checkPatternExport(exports, pat.left); }
+ else if (type === "RestElement")
+ { this.checkPatternExport(exports, pat.argument); }
+ else if (type === "ParenthesizedExpression")
+ { this.checkPatternExport(exports, pat.expression); }
+};
+
+pp$8.checkVariableExport = function(exports, decls) {
+ if (!exports) { return }
+ for (var i = 0, list = decls; i < list.length; i += 1)
+ {
+ var decl = list[i];
+
+ this.checkPatternExport(exports, decl.id);
+ }
+};
+
+pp$8.shouldParseExportStatement = function() {
+ return this.type.keyword === "var" ||
+ this.type.keyword === "const" ||
+ this.type.keyword === "class" ||
+ this.type.keyword === "function" ||
+ this.isLet() ||
+ this.isAsyncFunction()
+};
+
+// Parses a comma-separated list of module exports.
+
+pp$8.parseExportSpecifier = function(exports) {
+ var node = this.startNode();
+ node.local = this.parseModuleExportName();
+
+ node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
+ this.checkExport(
+ exports,
+ node.exported,
+ node.exported.start
+ );
+
+ return this.finishNode(node, "ExportSpecifier")
+};
+
+pp$8.parseExportSpecifiers = function(exports) {
+ var nodes = [], first = true;
+ // export { x, y as z } [from '...']
+ this.expect(types$1.braceL);
+ while (!this.eat(types$1.braceR)) {
+ if (!first) {
+ this.expect(types$1.comma);
+ if (this.afterTrailingComma(types$1.braceR)) { break }
+ } else { first = false; }
+
+ nodes.push(this.parseExportSpecifier(exports));
+ }
+ return nodes
+};
+
+// Parses import declaration.
+
+pp$8.parseImport = function(node) {
+ this.next();
+
+ // import '...'
+ if (this.type === types$1.string) {
+ node.specifiers = empty$1;
+ node.source = this.parseExprAtom();
+ } else {
+ node.specifiers = this.parseImportSpecifiers();
+ this.expectContextual("from");
+ node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
+ }
+ this.semicolon();
+ return this.finishNode(node, "ImportDeclaration")
+};
+
+// Parses a comma-separated list of module imports.
+
+pp$8.parseImportSpecifier = function() {
+ var node = this.startNode();
+ node.imported = this.parseModuleExportName();
+
+ if (this.eatContextual("as")) {
+ node.local = this.parseIdent();
+ } else {
+ this.checkUnreserved(node.imported);
+ node.local = node.imported;
+ }
+ this.checkLValSimple(node.local, BIND_LEXICAL);
+
+ return this.finishNode(node, "ImportSpecifier")
+};
+
+pp$8.parseImportDefaultSpecifier = function() {
+ // import defaultObj, { x, y as z } from '...'
+ var node = this.startNode();
+ node.local = this.parseIdent();
+ this.checkLValSimple(node.local, BIND_LEXICAL);
+ return this.finishNode(node, "ImportDefaultSpecifier")
+};
+
+pp$8.parseImportNamespaceSpecifier = function() {
+ var node = this.startNode();
+ this.next();
+ this.expectContextual("as");
+ node.local = this.parseIdent();
+ this.checkLValSimple(node.local, BIND_LEXICAL);
+ return this.finishNode(node, "ImportNamespaceSpecifier")
+};
+
+pp$8.parseImportSpecifiers = function() {
+ var nodes = [], first = true;
+ if (this.type === types$1.name) {
+ nodes.push(this.parseImportDefaultSpecifier());
+ if (!this.eat(types$1.comma)) { return nodes }
+ }
+ if (this.type === types$1.star) {
+ nodes.push(this.parseImportNamespaceSpecifier());
+ return nodes
+ }
+ this.expect(types$1.braceL);
+ while (!this.eat(types$1.braceR)) {
+ if (!first) {
+ this.expect(types$1.comma);
+ if (this.afterTrailingComma(types$1.braceR)) { break }
+ } else { first = false; }
+
+ nodes.push(this.parseImportSpecifier());
+ }
+ return nodes
+};
+
+pp$8.parseModuleExportName = function() {
+ if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {
+ var stringLiteral = this.parseLiteral(this.value);
+ if (loneSurrogate.test(stringLiteral.value)) {
+ this.raise(stringLiteral.start, "An export name cannot include a lone surrogate.");
+ }
+ return stringLiteral
+ }
+ return this.parseIdent(true)
+};
+
+// Set `ExpressionStatement#directive` property for directive prologues.
+pp$8.adaptDirectivePrologue = function(statements) {
+ for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
+ statements[i].directive = statements[i].expression.raw.slice(1, -1);
+ }
+};
+pp$8.isDirectiveCandidate = function(statement) {
+ return (
+ this.options.ecmaVersion >= 5 &&
+ statement.type === "ExpressionStatement" &&
+ statement.expression.type === "Literal" &&
+ typeof statement.expression.value === "string" &&
+ // Reject parenthesized strings.
+ (this.input[statement.start] === "\"" || this.input[statement.start] === "'")
+ )
+};
+
+var pp$7 = Parser$1.prototype;
+
+// Convert existing expression atom to assignable pattern
+// if possible.
+
+pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
+ if (this.options.ecmaVersion >= 6 && node) {
+ switch (node.type) {
+ case "Identifier":
+ if (this.inAsync && node.name === "await")
+ { this.raise(node.start, "Cannot use 'await' as identifier inside an async function"); }
+ break
+
+ case "ObjectPattern":
+ case "ArrayPattern":
+ case "AssignmentPattern":
+ case "RestElement":
+ break
+
+ case "ObjectExpression":
+ node.type = "ObjectPattern";
+ if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
+ for (var i = 0, list = node.properties; i < list.length; i += 1) {
+ var prop = list[i];
+
+ this.toAssignable(prop, isBinding);
+ // Early error:
+ // AssignmentRestProperty[Yield, Await] :
+ // `...` DestructuringAssignmentTarget[Yield, Await]
+ //
+ // It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.
+ if (
+ prop.type === "RestElement" &&
+ (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")
+ ) {
+ this.raise(prop.argument.start, "Unexpected token");
+ }
+ }
+ break
+
+ case "Property":
+ // AssignmentProperty has type === "Property"
+ if (node.kind !== "init") { this.raise(node.key.start, "Object pattern can't contain getter or setter"); }
+ this.toAssignable(node.value, isBinding);
+ break
+
+ case "ArrayExpression":
+ node.type = "ArrayPattern";
+ if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
+ this.toAssignableList(node.elements, isBinding);
+ break
+
+ case "SpreadElement":
+ node.type = "RestElement";
+ this.toAssignable(node.argument, isBinding);
+ if (node.argument.type === "AssignmentPattern")
+ { this.raise(node.argument.start, "Rest elements cannot have a default value"); }
+ break
+
+ case "AssignmentExpression":
+ if (node.operator !== "=") { this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); }
+ node.type = "AssignmentPattern";
+ delete node.operator;
+ this.toAssignable(node.left, isBinding);
+ break
+
+ case "ParenthesizedExpression":
+ this.toAssignable(node.expression, isBinding, refDestructuringErrors);
+ break
+
+ case "ChainExpression":
+ this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side");
+ break
+
+ case "MemberExpression":
+ if (!isBinding) { break }
+
+ default:
+ this.raise(node.start, "Assigning to rvalue");
+ }
+ } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }
+ return node
+};
+
+// Convert list of expression atoms to binding list.
+
+pp$7.toAssignableList = function(exprList, isBinding) {
+ var end = exprList.length;
+ for (var i = 0; i < end; i++) {
+ var elt = exprList[i];
+ if (elt) { this.toAssignable(elt, isBinding); }
+ }
+ if (end) {
+ var last = exprList[end - 1];
+ if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier")
+ { this.unexpected(last.argument.start); }
+ }
+ return exprList
+};
+
+// Parses spread element.
+
+pp$7.parseSpread = function(refDestructuringErrors) {
+ var node = this.startNode();
+ this.next();
+ node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
+ return this.finishNode(node, "SpreadElement")
+};
+
+pp$7.parseRestBinding = function() {
+ var node = this.startNode();
+ this.next();
+
+ // RestElement inside of a function parameter must be an identifier
+ if (this.options.ecmaVersion === 6 && this.type !== types$1.name)
+ { this.unexpected(); }
+
+ node.argument = this.parseBindingAtom();
+
+ return this.finishNode(node, "RestElement")
+};
+
+// Parses lvalue (assignable) atom.
+
+pp$7.parseBindingAtom = function() {
+ if (this.options.ecmaVersion >= 6) {
+ switch (this.type) {
+ case types$1.bracketL:
+ var node = this.startNode();
+ this.next();
+ node.elements = this.parseBindingList(types$1.bracketR, true, true);
+ return this.finishNode(node, "ArrayPattern")
+
+ case types$1.braceL:
+ return this.parseObj(true)
+ }
+ }
+ return this.parseIdent()
+};
+
+pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) {
+ var elts = [], first = true;
+ while (!this.eat(close)) {
+ if (first) { first = false; }
+ else { this.expect(types$1.comma); }
+ if (allowEmpty && this.type === types$1.comma) {
+ elts.push(null);
+ } else if (allowTrailingComma && this.afterTrailingComma(close)) {
+ break
+ } else if (this.type === types$1.ellipsis) {
+ var rest = this.parseRestBinding();
+ this.parseBindingListItem(rest);
+ elts.push(rest);
+ if (this.type === types$1.comma) { this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); }
+ this.expect(close);
+ break
+ } else {
+ elts.push(this.parseAssignableListItem(allowModifiers));
+ }
+ }
+ return elts
+};
+
+pp$7.parseAssignableListItem = function(allowModifiers) {
+ var elem = this.parseMaybeDefault(this.start, this.startLoc);
+ this.parseBindingListItem(elem);
+ return elem
+};
+
+pp$7.parseBindingListItem = function(param) {
+ return param
+};
+
+// Parses assignment pattern around given atom if possible.
+
+pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
+ left = left || this.parseBindingAtom();
+ if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }
+ var node = this.startNodeAt(startPos, startLoc);
+ node.left = left;
+ node.right = this.parseMaybeAssign();
+ return this.finishNode(node, "AssignmentPattern")
+};
+
+// The following three functions all verify that a node is an lvalue —
+// something that can be bound, or assigned to. In order to do so, they perform
+// a variety of checks:
+//
+// - Check that none of the bound/assigned-to identifiers are reserved words.
+// - Record name declarations for bindings in the appropriate scope.
+// - Check duplicate argument names, if checkClashes is set.
+//
+// If a complex binding pattern is encountered (e.g., object and array
+// destructuring), the entire pattern is recursively checked.
+//
+// There are three versions of checkLVal*() appropriate for different
+// circumstances:
+//
+// - checkLValSimple() shall be used if the syntactic construct supports
+// nothing other than identifiers and member expressions. Parenthesized
+// expressions are also correctly handled. This is generally appropriate for
+// constructs for which the spec says
+//
+// > It is a Syntax Error if AssignmentTargetType of [the production] is not
+// > simple.
+//
+// It is also appropriate for checking if an identifier is valid and not
+// defined elsewhere, like import declarations or function/class identifiers.
+//
+// Examples where this is used include:
+// a += …;
+// import a from '…';
+// where a is the node to be checked.
+//
+// - checkLValPattern() shall be used if the syntactic construct supports
+// anything checkLValSimple() supports, as well as object and array
+// destructuring patterns. This is generally appropriate for constructs for
+// which the spec says
+//
+// > It is a Syntax Error if [the production] is neither an ObjectLiteral nor
+// > an ArrayLiteral and AssignmentTargetType of [the production] is not
+// > simple.
+//
+// Examples where this is used include:
+// (a = …);
+// const a = …;
+// try { … } catch (a) { … }
+// where a is the node to be checked.
+//
+// - checkLValInnerPattern() shall be used if the syntactic construct supports
+// anything checkLValPattern() supports, as well as default assignment
+// patterns, rest elements, and other constructs that may appear within an
+// object or array destructuring pattern.
+//
+// As a special case, function parameters also use checkLValInnerPattern(),
+// as they also support defaults and rest constructs.
+//
+// These functions deliberately support both assignment and binding constructs,
+// as the logic for both is exceedingly similar. If the node is the target of
+// an assignment, then bindingType should be set to BIND_NONE. Otherwise, it
+// should be set to the appropriate BIND_* constant, like BIND_VAR or
+// BIND_LEXICAL.
+//
+// If the function is called with a non-BIND_NONE bindingType, then
+// additionally a checkClashes object may be specified to allow checking for
+// duplicate argument names. checkClashes is ignored if the provided construct
+// is an assignment (i.e., bindingType is BIND_NONE).
+
+pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
+ if ( bindingType === void 0 ) bindingType = BIND_NONE;
+
+ var isBind = bindingType !== BIND_NONE;
+
+ switch (expr.type) {
+ case "Identifier":
+ if (this.strict && this.reservedWordsStrictBind.test(expr.name))
+ { this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); }
+ if (isBind) {
+ if (bindingType === BIND_LEXICAL && expr.name === "let")
+ { this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); }
+ if (checkClashes) {
+ if (hasOwn(checkClashes, expr.name))
+ { this.raiseRecoverable(expr.start, "Argument name clash"); }
+ checkClashes[expr.name] = true;
+ }
+ if (bindingType !== BIND_OUTSIDE) { this.declareName(expr.name, bindingType, expr.start); }
+ }
+ break
+
+ case "ChainExpression":
+ this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side");
+ break
+
+ case "MemberExpression":
+ if (isBind) { this.raiseRecoverable(expr.start, "Binding member expression"); }
+ break
+
+ case "ParenthesizedExpression":
+ if (isBind) { this.raiseRecoverable(expr.start, "Binding parenthesized expression"); }
+ return this.checkLValSimple(expr.expression, bindingType, checkClashes)
+
+ default:
+ this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue");
+ }
+};
+
+pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
+ if ( bindingType === void 0 ) bindingType = BIND_NONE;
+
+ switch (expr.type) {
+ case "ObjectPattern":
+ for (var i = 0, list = expr.properties; i < list.length; i += 1) {
+ var prop = list[i];
+
+ this.checkLValInnerPattern(prop, bindingType, checkClashes);
+ }
+ break
+
+ case "ArrayPattern":
+ for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {
+ var elem = list$1[i$1];
+
+ if (elem) { this.checkLValInnerPattern(elem, bindingType, checkClashes); }
+ }
+ break
+
+ default:
+ this.checkLValSimple(expr, bindingType, checkClashes);
+ }
+};
+
+pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
+ if ( bindingType === void 0 ) bindingType = BIND_NONE;
+
+ switch (expr.type) {
+ case "Property":
+ // AssignmentProperty has type === "Property"
+ this.checkLValInnerPattern(expr.value, bindingType, checkClashes);
+ break
+
+ case "AssignmentPattern":
+ this.checkLValPattern(expr.left, bindingType, checkClashes);
+ break
+
+ case "RestElement":
+ this.checkLValPattern(expr.argument, bindingType, checkClashes);
+ break
+
+ default:
+ this.checkLValPattern(expr, bindingType, checkClashes);
+ }
+};
+
+// The algorithm used to determine whether a regexp can appear at a
+// given point in the program is loosely based on sweet.js' approach.
+// See https://github.com/mozilla/sweet.js/wiki/design
+
+
+var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
+ this.token = token;
+ this.isExpr = !!isExpr;
+ this.preserveSpace = !!preserveSpace;
+ this.override = override;
+ this.generator = !!generator;
+};
+
+var types$2 = {
+ b_stat: new TokContext("{", false),
+ b_expr: new TokContext("{", true),
+ b_tmpl: new TokContext("${", false),
+ p_stat: new TokContext("(", false),
+ p_expr: new TokContext("(", true),
+ q_tmpl: new TokContext("`", true, true, function (p) { return p.tryReadTemplateToken(); }),
+ f_stat: new TokContext("function", false),
+ f_expr: new TokContext("function", true),
+ f_expr_gen: new TokContext("function", true, false, null, true),
+ f_gen: new TokContext("function", false, false, null, true)
+};
+
+var pp$6 = Parser$1.prototype;
+
+pp$6.initialContext = function() {
+ return [types$2.b_stat]
+};
+
+pp$6.curContext = function() {
+ return this.context[this.context.length - 1]
+};
+
+pp$6.braceIsBlock = function(prevType) {
+ var parent = this.curContext();
+ if (parent === types$2.f_expr || parent === types$2.f_stat)
+ { return true }
+ if (prevType === types$1.colon && (parent === types$2.b_stat || parent === types$2.b_expr))
+ { return !parent.isExpr }
+
+ // The check for `tt.name && exprAllowed` detects whether we are
+ // after a `yield` or `of` construct. See the `updateContext` for
+ // `tt.name`.
+ if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)
+ { return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
+ if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)
+ { return true }
+ if (prevType === types$1.braceL)
+ { return parent === types$2.b_stat }
+ if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)
+ { return false }
+ return !this.exprAllowed
+};
+
+pp$6.inGeneratorContext = function() {
+ for (var i = this.context.length - 1; i >= 1; i--) {
+ var context = this.context[i];
+ if (context.token === "function")
+ { return context.generator }
+ }
+ return false
+};
+
+pp$6.updateContext = function(prevType) {
+ var update, type = this.type;
+ if (type.keyword && prevType === types$1.dot)
+ { this.exprAllowed = false; }
+ else if (update = type.updateContext)
+ { update.call(this, prevType); }
+ else
+ { this.exprAllowed = type.beforeExpr; }
+};
+
+// Used to handle egde cases when token context could not be inferred correctly during tokenization phase
+
+pp$6.overrideContext = function(tokenCtx) {
+ if (this.curContext() !== tokenCtx) {
+ this.context[this.context.length - 1] = tokenCtx;
+ }
+};
+
+// Token-specific context update code
+
+types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
+ if (this.context.length === 1) {
+ this.exprAllowed = true;
+ return
+ }
+ var out = this.context.pop();
+ if (out === types$2.b_stat && this.curContext().token === "function") {
+ out = this.context.pop();
+ }
+ this.exprAllowed = !out.isExpr;
+};
+
+types$1.braceL.updateContext = function(prevType) {
+ this.context.push(this.braceIsBlock(prevType) ? types$2.b_stat : types$2.b_expr);
+ this.exprAllowed = true;
+};
+
+types$1.dollarBraceL.updateContext = function() {
+ this.context.push(types$2.b_tmpl);
+ this.exprAllowed = true;
+};
+
+types$1.parenL.updateContext = function(prevType) {
+ var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
+ this.context.push(statementParens ? types$2.p_stat : types$2.p_expr);
+ this.exprAllowed = true;
+};
+
+types$1.incDec.updateContext = function() {
+ // tokExprAllowed stays unchanged
+};
+
+types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
+ if (prevType.beforeExpr && prevType !== types$1._else &&
+ !(prevType === types$1.semi && this.curContext() !== types$2.p_stat) &&
+ !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
+ !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types$2.b_stat))
+ { this.context.push(types$2.f_expr); }
+ else
+ { this.context.push(types$2.f_stat); }
+ this.exprAllowed = false;
+};
+
+types$1.backQuote.updateContext = function() {
+ if (this.curContext() === types$2.q_tmpl)
+ { this.context.pop(); }
+ else
+ { this.context.push(types$2.q_tmpl); }
+ this.exprAllowed = false;
+};
+
+types$1.star.updateContext = function(prevType) {
+ if (prevType === types$1._function) {
+ var index = this.context.length - 1;
+ if (this.context[index] === types$2.f_expr)
+ { this.context[index] = types$2.f_expr_gen; }
+ else
+ { this.context[index] = types$2.f_gen; }
+ }
+ this.exprAllowed = true;
+};
+
+types$1.name.updateContext = function(prevType) {
+ var allowed = false;
+ if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
+ if (this.value === "of" && !this.exprAllowed ||
+ this.value === "yield" && this.inGeneratorContext())
+ { allowed = true; }
+ }
+ this.exprAllowed = allowed;
+};
+
+// A recursive descent parser operates by defining functions for all
+// syntactic elements, and recursively calling those, each function
+// advancing the input stream and returning an AST node. Precedence
+// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
+// instead of `(!x)[1]` is handled by the fact that the parser
+// function that parses unary prefix operators is called first, and
+// in turn calls the function that parses `[]` subscripts — that
+// way, it'll receive the node for `x[1]` already parsed, and wraps
+// *that* in the unary operator node.
+//
+// Acorn uses an [operator precedence parser][opp] to handle binary
+// operator precedence, because it is much more compact than using
+// the technique outlined above, which uses different, nesting
+// functions to specify precedence, for all of the ten binary
+// precedence levels that JavaScript defines.
+//
+// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
+
+
+var pp$5 = Parser$1.prototype;
+
+// Check if property name clashes with already added.
+// Object/class getters and setters are not allowed to clash —
+// either with each other or with an init property — and in
+// strict mode, init properties are also not allowed to be repeated.
+
+pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
+ if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement")
+ { return }
+ if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))
+ { return }
+ var key = prop.key;
+ var name;
+ switch (key.type) {
+ case "Identifier": name = key.name; break
+ case "Literal": name = String(key.value); break
+ default: return
+ }
+ var kind = prop.kind;
+ if (this.options.ecmaVersion >= 6) {
+ if (name === "__proto__" && kind === "init") {
+ if (propHash.proto) {
+ if (refDestructuringErrors) {
+ if (refDestructuringErrors.doubleProto < 0) {
+ refDestructuringErrors.doubleProto = key.start;
+ }
+ } else {
+ this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
+ }
+ }
+ propHash.proto = true;
+ }
+ return
+ }
+ name = "$" + name;
+ var other = propHash[name];
+ if (other) {
+ var redefinition;
+ if (kind === "init") {
+ redefinition = this.strict && other.init || other.get || other.set;
+ } else {
+ redefinition = other.init || other[kind];
+ }
+ if (redefinition)
+ { this.raiseRecoverable(key.start, "Redefinition of property"); }
+ } else {
+ other = propHash[name] = {
+ init: false,
+ get: false,
+ set: false
+ };
+ }
+ other[kind] = true;
+};
+
+// ### Expression parsing
+
+// These nest, from the most general expression type at the top to
+// 'atomic', nondivisible expression types at the bottom. Most of
+// the functions will simply let the function(s) below them parse,
+// and, *if* the syntactic construct they handle is present, wrap
+// the AST node that the inner parser gave them in another node.
+
+// Parse a full expression. The optional arguments are used to
+// forbid the `in` operator (in for loops initalization expressions)
+// and provide reference for storing '=' operator inside shorthand
+// property assignment in contexts where both object expression
+// and object pattern might appear (so it's possible to raise
+// delayed syntax error at correct position).
+
+pp$5.parseExpression = function(forInit, refDestructuringErrors) {
+ var startPos = this.start, startLoc = this.startLoc;
+ var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
+ if (this.type === types$1.comma) {
+ var node = this.startNodeAt(startPos, startLoc);
+ node.expressions = [expr];
+ while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
+ return this.finishNode(node, "SequenceExpression")
+ }
+ return expr
+};
+
+// Parse an assignment expression. This includes applications of
+// operators like `+=`.
+
+pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
+ if (this.isContextual("yield")) {
+ if (this.inGenerator) { return this.parseYield(forInit) }
+ // The tokenizer will assume an expression is allowed after
+ // `yield`, but this isn't that kind of yield
+ else { this.exprAllowed = false; }
+ }
+
+ var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
+ if (refDestructuringErrors) {
+ oldParenAssign = refDestructuringErrors.parenthesizedAssign;
+ oldTrailingComma = refDestructuringErrors.trailingComma;
+ oldDoubleProto = refDestructuringErrors.doubleProto;
+ refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
+ } else {
+ refDestructuringErrors = new DestructuringErrors;
+ ownDestructuringErrors = true;
+ }
+
+ var startPos = this.start, startLoc = this.startLoc;
+ if (this.type === types$1.parenL || this.type === types$1.name) {
+ this.potentialArrowAt = this.start;
+ this.potentialArrowInForAwait = forInit === "await";
+ }
+ var left = this.parseMaybeConditional(forInit, refDestructuringErrors);
+ if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }
+ if (this.type.isAssign) {
+ var node = this.startNodeAt(startPos, startLoc);
+ node.operator = this.value;
+ if (this.type === types$1.eq)
+ { left = this.toAssignable(left, false, refDestructuringErrors); }
+ if (!ownDestructuringErrors) {
+ refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
+ }
+ if (refDestructuringErrors.shorthandAssign >= left.start)
+ { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly
+ if (this.type === types$1.eq)
+ { this.checkLValPattern(left); }
+ else
+ { this.checkLValSimple(left); }
+ node.left = left;
+ this.next();
+ node.right = this.parseMaybeAssign(forInit);
+ if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }
+ return this.finishNode(node, "AssignmentExpression")
+ } else {
+ if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
+ }
+ if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; }
+ if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; }
+ return left
+};
+
+// Parse a ternary conditional (`?:`) operator.
+
+pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
+ var startPos = this.start, startLoc = this.startLoc;
+ var expr = this.parseExprOps(forInit, refDestructuringErrors);
+ if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
+ if (this.eat(types$1.question)) {
+ var node = this.startNodeAt(startPos, startLoc);
+ node.test = expr;
+ node.consequent = this.parseMaybeAssign();
+ this.expect(types$1.colon);
+ node.alternate = this.parseMaybeAssign(forInit);
+ return this.finishNode(node, "ConditionalExpression")
+ }
+ return expr
+};
+
+// Start the precedence parser.
+
+pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
+ var startPos = this.start, startLoc = this.startLoc;
+ var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
+ if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
+ return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit)
+};
+
+// Parse binary operators with the operator precedence parsing
+// algorithm. `left` is the left-hand side of the operator.
+// `minPrec` provides context that allows the function to stop and
+// defer further parser to one of its callers when it encounters an
+// operator that has a lower precedence than the set it is parsing.
+
+pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
+ var prec = this.type.binop;
+ if (prec != null && (!forInit || this.type !== types$1._in)) {
+ if (prec > minPrec) {
+ var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
+ var coalesce = this.type === types$1.coalesce;
+ if (coalesce) {
+ // Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.
+ // In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.
+ prec = types$1.logicalAND.binop;
+ }
+ var op = this.value;
+ this.next();
+ var startPos = this.start, startLoc = this.startLoc;
+ var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
+ var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
+ if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {
+ this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
+ }
+ return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
+ }
+ }
+ return left
+};
+
+pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
+ if (right.type === "PrivateIdentifier") { this.raise(right.start, "Private identifier can only be left side of binary expression"); }
+ var node = this.startNodeAt(startPos, startLoc);
+ node.left = left;
+ node.operator = op;
+ node.right = right;
+ return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression")
+};
+
+// Parse unary operators, both prefix and postfix.
+
+pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
+ var startPos = this.start, startLoc = this.startLoc, expr;
+ if (this.isContextual("await") && this.canAwait) {
+ expr = this.parseAwait(forInit);
+ sawUnary = true;
+ } else if (this.type.prefix) {
+ var node = this.startNode(), update = this.type === types$1.incDec;
+ node.operator = this.value;
+ node.prefix = true;
+ this.next();
+ node.argument = this.parseMaybeUnary(null, true, update, forInit);
+ this.checkExpressionErrors(refDestructuringErrors, true);
+ if (update) { this.checkLValSimple(node.argument); }
+ else if (this.strict && node.operator === "delete" &&
+ node.argument.type === "Identifier")
+ { this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); }
+ else if (node.operator === "delete" && isPrivateFieldAccess(node.argument))
+ { this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
+ else { sawUnary = true; }
+ expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
+ } else if (!sawUnary && this.type === types$1.privateId) {
+ if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) { this.unexpected(); }
+ expr = this.parsePrivateIdent();
+ // only could be private fields in 'in', such as #x in obj
+ if (this.type !== types$1._in) { this.unexpected(); }
+ } else {
+ expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
+ if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
+ while (this.type.postfix && !this.canInsertSemicolon()) {
+ var node$1 = this.startNodeAt(startPos, startLoc);
+ node$1.operator = this.value;
+ node$1.prefix = false;
+ node$1.argument = expr;
+ this.checkLValSimple(expr);
+ this.next();
+ expr = this.finishNode(node$1, "UpdateExpression");
+ }
+ }
+
+ if (!incDec && this.eat(types$1.starstar)) {
+ if (sawUnary)
+ { this.unexpected(this.lastTokStart); }
+ else
+ { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false) }
+ } else {
+ return expr
+ }
+};
+
+function isPrivateFieldAccess(node) {
+ return (
+ node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" ||
+ node.type === "ChainExpression" && isPrivateFieldAccess(node.expression)
+ )
+}
+
+// Parse call, dot, and `[]`-subscript expressions.
+
+pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
+ var startPos = this.start, startLoc = this.startLoc;
+ var expr = this.parseExprAtom(refDestructuringErrors, forInit);
+ if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
+ { return expr }
+ var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit);
+ if (refDestructuringErrors && result.type === "MemberExpression") {
+ if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }
+ if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }
+ if (refDestructuringErrors.trailingComma >= result.start) { refDestructuringErrors.trailingComma = -1; }
+ }
+ return result
+};
+
+pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
+ var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
+ this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&
+ this.potentialArrowAt === base.start;
+ var optionalChained = false;
+
+ while (true) {
+ var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit);
+
+ if (element.optional) { optionalChained = true; }
+ if (element === base || element.type === "ArrowFunctionExpression") {
+ if (optionalChained) {
+ var chainNode = this.startNodeAt(startPos, startLoc);
+ chainNode.expression = element;
+ element = this.finishNode(chainNode, "ChainExpression");
+ }
+ return element
+ }
+
+ base = element;
+ }
+};
+
+pp$5.shouldParseAsyncArrow = function() {
+ return !this.canInsertSemicolon() && this.eat(types$1.arrow)
+};
+
+pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) {
+ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)
+};
+
+pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
+ var optionalSupported = this.options.ecmaVersion >= 11;
+ var optional = optionalSupported && this.eat(types$1.questionDot);
+ if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); }
+
+ var computed = this.eat(types$1.bracketL);
+ if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {
+ var node = this.startNodeAt(startPos, startLoc);
+ node.object = base;
+ if (computed) {
+ node.property = this.parseExpression();
+ this.expect(types$1.bracketR);
+ } else if (this.type === types$1.privateId && base.type !== "Super") {
+ node.property = this.parsePrivateIdent();
+ } else {
+ node.property = this.parseIdent(this.options.allowReserved !== "never");
+ }
+ node.computed = !!computed;
+ if (optionalSupported) {
+ node.optional = optional;
+ }
+ base = this.finishNode(node, "MemberExpression");
+ } else if (!noCalls && this.eat(types$1.parenL)) {
+ var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
+ this.yieldPos = 0;
+ this.awaitPos = 0;
+ this.awaitIdentPos = 0;
+ var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
+ if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {
+ this.checkPatternErrors(refDestructuringErrors, false);
+ this.checkYieldAwaitInDefaultParams();
+ if (this.awaitIdentPos > 0)
+ { this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); }
+ this.yieldPos = oldYieldPos;
+ this.awaitPos = oldAwaitPos;
+ this.awaitIdentPos = oldAwaitIdentPos;
+ return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit)
+ }
+ this.checkExpressionErrors(refDestructuringErrors, true);
+ this.yieldPos = oldYieldPos || this.yieldPos;
+ this.awaitPos = oldAwaitPos || this.awaitPos;
+ this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
+ var node$1 = this.startNodeAt(startPos, startLoc);
+ node$1.callee = base;
+ node$1.arguments = exprList;
+ if (optionalSupported) {
+ node$1.optional = optional;
+ }
+ base = this.finishNode(node$1, "CallExpression");
+ } else if (this.type === types$1.backQuote) {
+ if (optional || optionalChained) {
+ this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
+ }
+ var node$2 = this.startNodeAt(startPos, startLoc);
+ node$2.tag = base;
+ node$2.quasi = this.parseTemplate({isTagged: true});
+ base = this.finishNode(node$2, "TaggedTemplateExpression");
+ }
+ return base
+};
+
+// Parse an atomic expression — either a single token that is an
+// expression, an expression started by a keyword like `function` or
+// `new`, or an expression wrapped in punctuation like `()`, `[]`,
+// or `{}`.
+
+pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
+ // If a division operator appears in an expression position, the
+ // tokenizer got confused, and we force it to read a regexp instead.
+ if (this.type === types$1.slash) { this.readRegexp(); }
+
+ var node, canBeArrow = this.potentialArrowAt === this.start;
+ switch (this.type) {
+ case types$1._super:
+ if (!this.allowSuper)
+ { this.raise(this.start, "'super' keyword outside a method"); }
+ node = this.startNode();
+ this.next();
+ if (this.type === types$1.parenL && !this.allowDirectSuper)
+ { this.raise(node.start, "super() call outside constructor of a subclass"); }
+ // The `super` keyword can appear at below:
+ // SuperProperty:
+ // super [ Expression ]
+ // super . IdentifierName
+ // SuperCall:
+ // super ( Arguments )
+ if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)
+ { this.unexpected(); }
+ return this.finishNode(node, "Super")
+
+ case types$1._this:
+ node = this.startNode();
+ this.next();
+ return this.finishNode(node, "ThisExpression")
+
+ case types$1.name:
+ var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
+ var id = this.parseIdent(false);
+ if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
+ this.overrideContext(types$2.f_expr);
+ return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)
+ }
+ if (canBeArrow && !this.canInsertSemicolon()) {
+ if (this.eat(types$1.arrow))
+ { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }
+ if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc &&
+ (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
+ id = this.parseIdent(false);
+ if (this.canInsertSemicolon() || !this.eat(types$1.arrow))
+ { this.unexpected(); }
+ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)
+ }
+ }
+ return id
+
+ case types$1.regexp:
+ var value = this.value;
+ node = this.parseLiteral(value.value);
+ node.regex = {pattern: value.pattern, flags: value.flags};
+ return node
+
+ case types$1.num: case types$1.string:
+ return this.parseLiteral(this.value)
+
+ case types$1._null: case types$1._true: case types$1._false:
+ node = this.startNode();
+ node.value = this.type === types$1._null ? null : this.type === types$1._true;
+ node.raw = this.type.keyword;
+ this.next();
+ return this.finishNode(node, "Literal")
+
+ case types$1.parenL:
+ var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
+ if (refDestructuringErrors) {
+ if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))
+ { refDestructuringErrors.parenthesizedAssign = start; }
+ if (refDestructuringErrors.parenthesizedBind < 0)
+ { refDestructuringErrors.parenthesizedBind = start; }
+ }
+ return expr
+
+ case types$1.bracketL:
+ node = this.startNode();
+ this.next();
+ node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
+ return this.finishNode(node, "ArrayExpression")
+
+ case types$1.braceL:
+ this.overrideContext(types$2.b_expr);
+ return this.parseObj(false, refDestructuringErrors)
+
+ case types$1._function:
+ node = this.startNode();
+ this.next();
+ return this.parseFunction(node, 0)
+
+ case types$1._class:
+ return this.parseClass(this.startNode(), false)
+
+ case types$1._new:
+ return this.parseNew()
+
+ case types$1.backQuote:
+ return this.parseTemplate()
+
+ case types$1._import:
+ if (this.options.ecmaVersion >= 11) {
+ return this.parseExprImport(forNew)
+ } else {
+ return this.unexpected()
+ }
+
+ default:
+ return this.parseExprAtomDefault()
+ }
+};
+
+pp$5.parseExprAtomDefault = function() {
+ this.unexpected();
+};
+
+pp$5.parseExprImport = function(forNew) {
+ var node = this.startNode();
+
+ // Consume `import` as an identifier for `import.meta`.
+ // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`.
+ if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
+ var meta = this.parseIdent(true);
+
+ if (this.type === types$1.parenL && !forNew) {
+ return this.parseDynamicImport(node)
+ } else if (this.type === types$1.dot) {
+ node.meta = meta;
+ return this.parseImportMeta(node)
+ } else {
+ this.unexpected();
+ }
+};
+
+pp$5.parseDynamicImport = function(node) {
+ this.next(); // skip `(`
+
+ // Parse node.source.
+ node.source = this.parseMaybeAssign();
+
+ // Verify ending.
+ if (!this.eat(types$1.parenR)) {
+ var errorPos = this.start;
+ if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
+ this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
+ } else {
+ this.unexpected(errorPos);
+ }
+ }
+
+ return this.finishNode(node, "ImportExpression")
+};
+
+pp$5.parseImportMeta = function(node) {
+ this.next(); // skip `.`
+
+ var containsEsc = this.containsEsc;
+ node.property = this.parseIdent(true);
+
+ if (node.property.name !== "meta")
+ { this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); }
+ if (containsEsc)
+ { this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); }
+ if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere)
+ { this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); }
+
+ return this.finishNode(node, "MetaProperty")
+};
+
+pp$5.parseLiteral = function(value) {
+ var node = this.startNode();
+ node.value = value;
+ node.raw = this.input.slice(this.start, this.end);
+ if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1).replace(/_/g, ""); }
+ this.next();
+ return this.finishNode(node, "Literal")
+};
+
+pp$5.parseParenExpression = function() {
+ this.expect(types$1.parenL);
+ var val = this.parseExpression();
+ this.expect(types$1.parenR);
+ return val
+};
+
+pp$5.shouldParseArrow = function(exprList) {
+ return !this.canInsertSemicolon()
+};
+
+pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
+ var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
+ if (this.options.ecmaVersion >= 6) {
+ this.next();
+
+ var innerStartPos = this.start, innerStartLoc = this.startLoc;
+ var exprList = [], first = true, lastIsComma = false;
+ var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart;
+ this.yieldPos = 0;
+ this.awaitPos = 0;
+ // Do not save awaitIdentPos to allow checking awaits nested in parameters
+ while (this.type !== types$1.parenR) {
+ first ? first = false : this.expect(types$1.comma);
+ if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
+ lastIsComma = true;
+ break
+ } else if (this.type === types$1.ellipsis) {
+ spreadStart = this.start;
+ exprList.push(this.parseParenItem(this.parseRestBinding()));
+ if (this.type === types$1.comma) {
+ this.raiseRecoverable(
+ this.start,
+ "Comma is not permitted after the rest element"
+ );
+ }
+ break
+ } else {
+ exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
+ }
+ }
+ var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
+ this.expect(types$1.parenR);
+
+ if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {
+ this.checkPatternErrors(refDestructuringErrors, false);
+ this.checkYieldAwaitInDefaultParams();
+ this.yieldPos = oldYieldPos;
+ this.awaitPos = oldAwaitPos;
+ return this.parseParenArrowList(startPos, startLoc, exprList, forInit)
+ }
+
+ if (!exprList.length || lastIsComma) { this.unexpected(this.lastTokStart); }
+ if (spreadStart) { this.unexpected(spreadStart); }
+ this.checkExpressionErrors(refDestructuringErrors, true);
+ this.yieldPos = oldYieldPos || this.yieldPos;
+ this.awaitPos = oldAwaitPos || this.awaitPos;
+
+ if (exprList.length > 1) {
+ val = this.startNodeAt(innerStartPos, innerStartLoc);
+ val.expressions = exprList;
+ this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
+ } else {
+ val = exprList[0];
+ }
+ } else {
+ val = this.parseParenExpression();
+ }
+
+ if (this.options.preserveParens) {
+ var par = this.startNodeAt(startPos, startLoc);
+ par.expression = val;
+ return this.finishNode(par, "ParenthesizedExpression")
+ } else {
+ return val
+ }
+};
+
+pp$5.parseParenItem = function(item) {
+ return item
+};
+
+pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
+ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)
+};
+
+// New's precedence is slightly tricky. It must allow its argument to
+// be a `[]` or dot subscript expression, but not a call — at least,
+// not without wrapping it in parentheses. Thus, it uses the noCalls
+// argument to parseSubscripts to prevent it from consuming the
+// argument list.
+
+var empty = [];
+
+pp$5.parseNew = function() {
+ if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); }
+ var node = this.startNode();
+ var meta = this.parseIdent(true);
+ if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
+ node.meta = meta;
+ var containsEsc = this.containsEsc;
+ node.property = this.parseIdent(true);
+ if (node.property.name !== "target")
+ { this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"); }
+ if (containsEsc)
+ { this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); }
+ if (!this.allowNewDotTarget)
+ { this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
+ return this.finishNode(node, "MetaProperty")
+ }
+ var startPos = this.start, startLoc = this.startLoc;
+ node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
+ if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
+ else { node.arguments = empty; }
+ return this.finishNode(node, "NewExpression")
+};
+
+// Parse template expression.
+
+pp$5.parseTemplateElement = function(ref) {
+ var isTagged = ref.isTagged;
+
+ var elem = this.startNode();
+ if (this.type === types$1.invalidTemplate) {
+ if (!isTagged) {
+ this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
+ }
+ elem.value = {
+ raw: this.value,
+ cooked: null
+ };
+ } else {
+ elem.value = {
+ raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
+ cooked: this.value
+ };
+ }
+ this.next();
+ elem.tail = this.type === types$1.backQuote;
+ return this.finishNode(elem, "TemplateElement")
+};
+
+pp$5.parseTemplate = function(ref) {
+ if ( ref === void 0 ) ref = {};
+ var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;
+
+ var node = this.startNode();
+ this.next();
+ node.expressions = [];
+ var curElt = this.parseTemplateElement({isTagged: isTagged});
+ node.quasis = [curElt];
+ while (!curElt.tail) {
+ if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); }
+ this.expect(types$1.dollarBraceL);
+ node.expressions.push(this.parseExpression());
+ this.expect(types$1.braceR);
+ node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));
+ }
+ this.next();
+ return this.finishNode(node, "TemplateLiteral")
+};
+
+pp$5.isAsyncProp = function(prop) {
+ return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
+ (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types$1.star)) &&
+ !lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
+};
+
+// Parse an object literal or binding pattern.
+
+pp$5.parseObj = function(isPattern, refDestructuringErrors) {
+ var node = this.startNode(), first = true, propHash = {};
+ node.properties = [];
+ this.next();
+ while (!this.eat(types$1.braceR)) {
+ if (!first) {
+ this.expect(types$1.comma);
+ if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }
+ } else { first = false; }
+
+ var prop = this.parseProperty(isPattern, refDestructuringErrors);
+ if (!isPattern) { this.checkPropClash(prop, propHash, refDestructuringErrors); }
+ node.properties.push(prop);
+ }
+ return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression")
+};
+
+pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
+ var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
+ if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
+ if (isPattern) {
+ prop.argument = this.parseIdent(false);
+ if (this.type === types$1.comma) {
+ this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
+ }
+ return this.finishNode(prop, "RestElement")
+ }
+ // Parse argument.
+ prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
+ // To disallow trailing comma via `this.toAssignable()`.
+ if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
+ refDestructuringErrors.trailingComma = this.start;
+ }
+ // Finish
+ return this.finishNode(prop, "SpreadElement")
+ }
+ if (this.options.ecmaVersion >= 6) {
+ prop.method = false;
+ prop.shorthand = false;
+ if (isPattern || refDestructuringErrors) {
+ startPos = this.start;
+ startLoc = this.startLoc;
+ }
+ if (!isPattern)
+ { isGenerator = this.eat(types$1.star); }
+ }
+ var containsEsc = this.containsEsc;
+ this.parsePropertyName(prop);
+ if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
+ isAsync = true;
+ isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
+ this.parsePropertyName(prop);
+ } else {
+ isAsync = false;
+ }
+ this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);
+ return this.finishNode(prop, "Property")
+};
+
+pp$5.parseGetterSetter = function(prop) {
+ prop.kind = prop.key.name;
+ this.parsePropertyName(prop);
+ prop.value = this.parseMethod(false);
+ var paramCount = prop.kind === "get" ? 0 : 1;
+ if (prop.value.params.length !== paramCount) {
+ var start = prop.value.start;
+ if (prop.kind === "get")
+ { this.raiseRecoverable(start, "getter should have no params"); }
+ else
+ { this.raiseRecoverable(start, "setter should have exactly one param"); }
+ } else {
+ if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
+ { this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
+ }
+};
+
+pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
+ if ((isGenerator || isAsync) && this.type === types$1.colon)
+ { this.unexpected(); }
+
+ if (this.eat(types$1.colon)) {
+ prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
+ prop.kind = "init";
+ } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
+ if (isPattern) { this.unexpected(); }
+ prop.kind = "init";
+ prop.method = true;
+ prop.value = this.parseMethod(isGenerator, isAsync);
+ } else if (!isPattern && !containsEsc &&
+ this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
+ (prop.key.name === "get" || prop.key.name === "set") &&
+ (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
+ if (isGenerator || isAsync) { this.unexpected(); }
+ this.parseGetterSetter(prop);
+ } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
+ if (isGenerator || isAsync) { this.unexpected(); }
+ this.checkUnreserved(prop.key);
+ if (prop.key.name === "await" && !this.awaitIdentPos)
+ { this.awaitIdentPos = startPos; }
+ prop.kind = "init";
+ if (isPattern) {
+ prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
+ } else if (this.type === types$1.eq && refDestructuringErrors) {
+ if (refDestructuringErrors.shorthandAssign < 0)
+ { refDestructuringErrors.shorthandAssign = this.start; }
+ prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
+ } else {
+ prop.value = this.copyNode(prop.key);
+ }
+ prop.shorthand = true;
+ } else { this.unexpected(); }
+};
+
+pp$5.parsePropertyName = function(prop) {
+ if (this.options.ecmaVersion >= 6) {
+ if (this.eat(types$1.bracketL)) {
+ prop.computed = true;
+ prop.key = this.parseMaybeAssign();
+ this.expect(types$1.bracketR);
+ return prop.key
+ } else {
+ prop.computed = false;
+ }
+ }
+ return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never")
+};
+
+// Initialize empty function node.
+
+pp$5.initFunction = function(node) {
+ node.id = null;
+ if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }
+ if (this.options.ecmaVersion >= 8) { node.async = false; }
+};
+
+// Parse object or class method.
+
+pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
+ var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
+
+ this.initFunction(node);
+ if (this.options.ecmaVersion >= 6)
+ { node.generator = isGenerator; }
+ if (this.options.ecmaVersion >= 8)
+ { node.async = !!isAsync; }
+
+ this.yieldPos = 0;
+ this.awaitPos = 0;
+ this.awaitIdentPos = 0;
+ this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
+
+ this.expect(types$1.parenL);
+ node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
+ this.checkYieldAwaitInDefaultParams();
+ this.parseFunctionBody(node, false, true, false);
+
+ this.yieldPos = oldYieldPos;
+ this.awaitPos = oldAwaitPos;
+ this.awaitIdentPos = oldAwaitIdentPos;
+ return this.finishNode(node, "FunctionExpression")
+};
+
+// Parse arrow function expression with given parameters.
+
+pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
+ var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
+
+ this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
+ this.initFunction(node);
+ if (this.options.ecmaVersion >= 8) { node.async = !!isAsync; }
+
+ this.yieldPos = 0;
+ this.awaitPos = 0;
+ this.awaitIdentPos = 0;
+
+ node.params = this.toAssignableList(params, true);
+ this.parseFunctionBody(node, true, false, forInit);
+
+ this.yieldPos = oldYieldPos;
+ this.awaitPos = oldAwaitPos;
+ this.awaitIdentPos = oldAwaitIdentPos;
+ return this.finishNode(node, "ArrowFunctionExpression")
+};
+
+// Parse function body and check parameters.
+
+pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
+ var isExpression = isArrowFunction && this.type !== types$1.braceL;
+ var oldStrict = this.strict, useStrict = false;
+
+ if (isExpression) {
+ node.body = this.parseMaybeAssign(forInit);
+ node.expression = true;
+ this.checkParams(node, false);
+ } else {
+ var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
+ if (!oldStrict || nonSimple) {
+ useStrict = this.strictDirective(this.end);
+ // If this is a strict mode function, verify that argument names
+ // are not repeated, and it does not try to bind the words `eval`
+ // or `arguments`.
+ if (useStrict && nonSimple)
+ { this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"); }
+ }
+ // Start a new scope with regard to labels and the `inFunction`
+ // flag (restore them to their old value afterwards).
+ var oldLabels = this.labels;
+ this.labels = [];
+ if (useStrict) { this.strict = true; }
+
+ // Add the params to varDeclaredNames to ensure that an error is thrown
+ // if a let/const declaration in the function clashes with one of the params.
+ this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));
+ // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'
+ if (this.strict && node.id) { this.checkLValSimple(node.id, BIND_OUTSIDE); }
+ node.body = this.parseBlock(false, undefined, useStrict && !oldStrict);
+ node.expression = false;
+ this.adaptDirectivePrologue(node.body.body);
+ this.labels = oldLabels;
+ }
+ this.exitScope();
+};
+
+pp$5.isSimpleParamList = function(params) {
+ for (var i = 0, list = params; i < list.length; i += 1)
+ {
+ var param = list[i];
+
+ if (param.type !== "Identifier") { return false
+ } }
+ return true
+};
+
+// Checks function params for various disallowed patterns such as using "eval"
+// or "arguments" and duplicate parameters.
+
+pp$5.checkParams = function(node, allowDuplicates) {
+ var nameHash = Object.create(null);
+ for (var i = 0, list = node.params; i < list.length; i += 1)
+ {
+ var param = list[i];
+
+ this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);
+ }
+};
+
+// Parses a comma-separated list of expressions, and returns them as
+// an array. `close` is the token type that ends the list, and
+// `allowEmpty` can be turned on to allow subsequent commas with
+// nothing in between them to be parsed as `null` (which is needed
+// for array literals).
+
+pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
+ var elts = [], first = true;
+ while (!this.eat(close)) {
+ if (!first) {
+ this.expect(types$1.comma);
+ if (allowTrailingComma && this.afterTrailingComma(close)) { break }
+ } else { first = false; }
+
+ var elt = (void 0);
+ if (allowEmpty && this.type === types$1.comma)
+ { elt = null; }
+ else if (this.type === types$1.ellipsis) {
+ elt = this.parseSpread(refDestructuringErrors);
+ if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)
+ { refDestructuringErrors.trailingComma = this.start; }
+ } else {
+ elt = this.parseMaybeAssign(false, refDestructuringErrors);
+ }
+ elts.push(elt);
+ }
+ return elts
+};
+
+pp$5.checkUnreserved = function(ref) {
+ var start = ref.start;
+ var end = ref.end;
+ var name = ref.name;
+
+ if (this.inGenerator && name === "yield")
+ { this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); }
+ if (this.inAsync && name === "await")
+ { this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); }
+ if (this.currentThisScope().inClassFieldInit && name === "arguments")
+ { this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); }
+ if (this.inClassStaticBlock && (name === "arguments" || name === "await"))
+ { this.raise(start, ("Cannot use " + name + " in class static initialization block")); }
+ if (this.keywords.test(name))
+ { this.raise(start, ("Unexpected keyword '" + name + "'")); }
+ if (this.options.ecmaVersion < 6 &&
+ this.input.slice(start, end).indexOf("\\") !== -1) { return }
+ var re = this.strict ? this.reservedWordsStrict : this.reservedWords;
+ if (re.test(name)) {
+ if (!this.inAsync && name === "await")
+ { this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function"); }
+ this.raiseRecoverable(start, ("The keyword '" + name + "' is reserved"));
+ }
+};
+
+// Parse the next token as an identifier. If `liberal` is true (used
+// when parsing properties), it will also convert keywords into
+// identifiers.
+
+pp$5.parseIdent = function(liberal) {
+ var node = this.parseIdentNode();
+ this.next(!!liberal);
+ this.finishNode(node, "Identifier");
+ if (!liberal) {
+ this.checkUnreserved(node);
+ if (node.name === "await" && !this.awaitIdentPos)
+ { this.awaitIdentPos = node.start; }
+ }
+ return node
+};
+
+pp$5.parseIdentNode = function() {
+ var node = this.startNode();
+ if (this.type === types$1.name) {
+ node.name = this.value;
+ } else if (this.type.keyword) {
+ node.name = this.type.keyword;
+
+ // To fix https://github.com/acornjs/acorn/issues/575
+ // `class` and `function` keywords push new context into this.context.
+ // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
+ // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
+ if ((node.name === "class" || node.name === "function") &&
+ (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
+ this.context.pop();
+ }
+ } else {
+ this.unexpected();
+ }
+ return node
+};
+
+pp$5.parsePrivateIdent = function() {
+ var node = this.startNode();
+ if (this.type === types$1.privateId) {
+ node.name = this.value;
+ } else {
+ this.unexpected();
+ }
+ this.next();
+ this.finishNode(node, "PrivateIdentifier");
+
+ // For validating existence
+ if (this.options.checkPrivateFields) {
+ if (this.privateNameStack.length === 0) {
+ this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
+ } else {
+ this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
+ }
+ }
+
+ return node
+};
+
+// Parses yield expression inside generator.
+
+pp$5.parseYield = function(forInit) {
+ if (!this.yieldPos) { this.yieldPos = this.start; }
+
+ var node = this.startNode();
+ this.next();
+ if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {
+ node.delegate = false;
+ node.argument = null;
+ } else {
+ node.delegate = this.eat(types$1.star);
+ node.argument = this.parseMaybeAssign(forInit);
+ }
+ return this.finishNode(node, "YieldExpression")
+};
+
+pp$5.parseAwait = function(forInit) {
+ if (!this.awaitPos) { this.awaitPos = this.start; }
+
+ var node = this.startNode();
+ this.next();
+ node.argument = this.parseMaybeUnary(null, true, false, forInit);
+ return this.finishNode(node, "AwaitExpression")
+};
+
+var pp$4 = Parser$1.prototype;
+
+// This function is used to raise exceptions on parse errors. It
+// takes an offset integer (into the current `input`) to indicate
+// the location of the error, attaches the position to the end
+// of the error message, and then raises a `SyntaxError` with that
+// message.
+
+pp$4.raise = function(pos, message) {
+ var loc = getLineInfo(this.input, pos);
+ message += " (" + loc.line + ":" + loc.column + ")";
+ var err = new SyntaxError(message);
+ err.pos = pos; err.loc = loc; err.raisedAt = this.pos;
+ throw err
+};
+
+pp$4.raiseRecoverable = pp$4.raise;
+
+pp$4.curPosition = function() {
+ if (this.options.locations) {
+ return new Position(this.curLine, this.pos - this.lineStart)
+ }
+};
+
+var pp$3 = Parser$1.prototype;
+
+var Scope = function Scope(flags) {
+ this.flags = flags;
+ // A list of var-declared names in the current lexical scope
+ this.var = [];
+ // A list of lexically-declared names in the current lexical scope
+ this.lexical = [];
+ // A list of lexically-declared FunctionDeclaration names in the current lexical scope
+ this.functions = [];
+ // A switch to disallow the identifier reference 'arguments'
+ this.inClassFieldInit = false;
+};
+
+// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
+
+pp$3.enterScope = function(flags) {
+ this.scopeStack.push(new Scope(flags));
+};
+
+pp$3.exitScope = function() {
+ this.scopeStack.pop();
+};
+
+// The spec says:
+// > At the top level of a function, or script, function declarations are
+// > treated like var declarations rather than like lexical declarations.
+pp$3.treatFunctionsAsVarInScope = function(scope) {
+ return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
+};
+
+pp$3.declareName = function(name, bindingType, pos) {
+ var redeclared = false;
+ if (bindingType === BIND_LEXICAL) {
+ var scope = this.currentScope();
+ redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
+ scope.lexical.push(name);
+ if (this.inModule && (scope.flags & SCOPE_TOP))
+ { delete this.undefinedExports[name]; }
+ } else if (bindingType === BIND_SIMPLE_CATCH) {
+ var scope$1 = this.currentScope();
+ scope$1.lexical.push(name);
+ } else if (bindingType === BIND_FUNCTION) {
+ var scope$2 = this.currentScope();
+ if (this.treatFunctionsAsVar)
+ { redeclared = scope$2.lexical.indexOf(name) > -1; }
+ else
+ { redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; }
+ scope$2.functions.push(name);
+ } else {
+ for (var i = this.scopeStack.length - 1; i >= 0; --i) {
+ var scope$3 = this.scopeStack[i];
+ if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||
+ !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
+ redeclared = true;
+ break
+ }
+ scope$3.var.push(name);
+ if (this.inModule && (scope$3.flags & SCOPE_TOP))
+ { delete this.undefinedExports[name]; }
+ if (scope$3.flags & SCOPE_VAR) { break }
+ }
+ }
+ if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
+};
+
+pp$3.checkLocalExport = function(id) {
+ // scope.functions must be empty as Module code is always strict.
+ if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
+ this.scopeStack[0].var.indexOf(id.name) === -1) {
+ this.undefinedExports[id.name] = id;
+ }
+};
+
+pp$3.currentScope = function() {
+ return this.scopeStack[this.scopeStack.length - 1]
+};
+
+pp$3.currentVarScope = function() {
+ for (var i = this.scopeStack.length - 1;; i--) {
+ var scope = this.scopeStack[i];
+ if (scope.flags & SCOPE_VAR) { return scope }
+ }
+};
+
+// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
+pp$3.currentThisScope = function() {
+ for (var i = this.scopeStack.length - 1;; i--) {
+ var scope = this.scopeStack[i];
+ if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }
+ }
+};
+
+var Node = function Node(parser, pos, loc) {
+ this.type = "";
+ this.start = pos;
+ this.end = 0;
+ if (parser.options.locations)
+ { this.loc = new SourceLocation(parser, loc); }
+ if (parser.options.directSourceFile)
+ { this.sourceFile = parser.options.directSourceFile; }
+ if (parser.options.ranges)
+ { this.range = [pos, 0]; }
+};
+
+// Start an AST node, attaching a start offset.
+
+var pp$2 = Parser$1.prototype;
+
+pp$2.startNode = function() {
+ return new Node(this, this.start, this.startLoc)
+};
+
+pp$2.startNodeAt = function(pos, loc) {
+ return new Node(this, pos, loc)
+};
+
+// Finish an AST node, adding `type` and `end` properties.
+
+function finishNodeAt(node, type, pos, loc) {
+ node.type = type;
+ node.end = pos;
+ if (this.options.locations)
+ { node.loc.end = loc; }
+ if (this.options.ranges)
+ { node.range[1] = pos; }
+ return node
+}
+
+pp$2.finishNode = function(node, type) {
+ return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
+};
+
+// Finish node at given position
+
+pp$2.finishNodeAt = function(node, type, pos, loc) {
+ return finishNodeAt.call(this, node, type, pos, loc)
+};
+
+pp$2.copyNode = function(node) {
+ var newNode = new Node(this, node.start, this.startLoc);
+ for (var prop in node) { newNode[prop] = node[prop]; }
+ return newNode
+};
+
+// This file contains Unicode properties extracted from the ECMAScript specification.
+// The lists are extracted like so:
+// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)
+
+// #table-binary-unicode-properties
+var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS";
+var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic";
+var ecma11BinaryProperties = ecma10BinaryProperties;
+var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict";
+var ecma13BinaryProperties = ecma12BinaryProperties;
+var ecma14BinaryProperties = ecma13BinaryProperties;
+
+var unicodeBinaryProperties = {
+ 9: ecma9BinaryProperties,
+ 10: ecma10BinaryProperties,
+ 11: ecma11BinaryProperties,
+ 12: ecma12BinaryProperties,
+ 13: ecma13BinaryProperties,
+ 14: ecma14BinaryProperties
+};
+
+// #table-binary-unicode-properties-of-strings
+var ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji";
+
+var unicodeBinaryPropertiesOfStrings = {
+ 9: "",
+ 10: "",
+ 11: "",
+ 12: "",
+ 13: "",
+ 14: ecma14BinaryPropertiesOfStrings
+};
+
+// #table-unicode-general-category-values
+var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";
+
+// #table-unicode-script-values
+var ecma9ScriptValues = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb";
+var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd";
+var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
+var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
+var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
+var ecma14ScriptValues = ecma13ScriptValues + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz";
+
+var unicodeScriptValues = {
+ 9: ecma9ScriptValues,
+ 10: ecma10ScriptValues,
+ 11: ecma11ScriptValues,
+ 12: ecma12ScriptValues,
+ 13: ecma13ScriptValues,
+ 14: ecma14ScriptValues
+};
+
+var data = {};
+function buildUnicodeData(ecmaVersion) {
+ var d = data[ecmaVersion] = {
+ binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
+ binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),
+ nonBinary: {
+ General_Category: wordsRegexp(unicodeGeneralCategoryValues),
+ Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
+ }
+ };
+ d.nonBinary.Script_Extensions = d.nonBinary.Script;
+
+ d.nonBinary.gc = d.nonBinary.General_Category;
+ d.nonBinary.sc = d.nonBinary.Script;
+ d.nonBinary.scx = d.nonBinary.Script_Extensions;
+}
+
+for (var i$1 = 0, list = [9, 10, 11, 12, 13, 14]; i$1 < list.length; i$1 += 1) {
+ var ecmaVersion = list[i$1];
+
+ buildUnicodeData(ecmaVersion);
+}
+
+var pp$1 = Parser$1.prototype;
+
+var RegExpValidationState = function RegExpValidationState(parser) {
+ this.parser = parser;
+ this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
+ this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];
+ this.source = "";
+ this.flags = "";
+ this.start = 0;
+ this.switchU = false;
+ this.switchV = false;
+ this.switchN = false;
+ this.pos = 0;
+ this.lastIntValue = 0;
+ this.lastStringValue = "";
+ this.lastAssertionIsQuantifiable = false;
+ this.numCapturingParens = 0;
+ this.maxBackReference = 0;
+ this.groupNames = [];
+ this.backReferenceNames = [];
+};
+
+RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
+ var unicodeSets = flags.indexOf("v") !== -1;
+ var unicode = flags.indexOf("u") !== -1;
+ this.start = start | 0;
+ this.source = pattern + "";
+ this.flags = flags;
+ if (unicodeSets && this.parser.options.ecmaVersion >= 15) {
+ this.switchU = true;
+ this.switchV = true;
+ this.switchN = true;
+ } else {
+ this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
+ this.switchV = false;
+ this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
+ }
+};
+
+RegExpValidationState.prototype.raise = function raise (message) {
+ this.parser.raiseRecoverable(this.start, ("Invalid regular expression: /" + (this.source) + "/: " + message));
+};
+
+// If u flag is given, this returns the code point at the index (it combines a surrogate pair).
+// Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).
+RegExpValidationState.prototype.at = function at (i, forceU) {
+ if ( forceU === void 0 ) forceU = false;
+
+ var s = this.source;
+ var l = s.length;
+ if (i >= l) {
+ return -1
+ }
+ var c = s.charCodeAt(i);
+ if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
+ return c
+ }
+ var next = s.charCodeAt(i + 1);
+ return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c
+};
+
+RegExpValidationState.prototype.nextIndex = function nextIndex (i, forceU) {
+ if ( forceU === void 0 ) forceU = false;
+
+ var s = this.source;
+ var l = s.length;
+ if (i >= l) {
+ return l
+ }
+ var c = s.charCodeAt(i), next;
+ if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l ||
+ (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {
+ return i + 1
+ }
+ return i + 2
+};
+
+RegExpValidationState.prototype.current = function current (forceU) {
+ if ( forceU === void 0 ) forceU = false;
+
+ return this.at(this.pos, forceU)
+};
+
+RegExpValidationState.prototype.lookahead = function lookahead (forceU) {
+ if ( forceU === void 0 ) forceU = false;
+
+ return this.at(this.nextIndex(this.pos, forceU), forceU)
+};
+
+RegExpValidationState.prototype.advance = function advance (forceU) {
+ if ( forceU === void 0 ) forceU = false;
+
+ this.pos = this.nextIndex(this.pos, forceU);
+};
+
+RegExpValidationState.prototype.eat = function eat (ch, forceU) {
+ if ( forceU === void 0 ) forceU = false;
+
+ if (this.current(forceU) === ch) {
+ this.advance(forceU);
+ return true
+ }
+ return false
+};
+
+RegExpValidationState.prototype.eatChars = function eatChars (chs, forceU) {
+ if ( forceU === void 0 ) forceU = false;
+
+ var pos = this.pos;
+ for (var i = 0, list = chs; i < list.length; i += 1) {
+ var ch = list[i];
+
+ var current = this.at(pos, forceU);
+ if (current === -1 || current !== ch) {
+ return false
+ }
+ pos = this.nextIndex(pos, forceU);
+ }
+ this.pos = pos;
+ return true
+};
+
+/**
+ * Validate the flags part of a given RegExpLiteral.
+ *
+ * @param {RegExpValidationState} state The state to validate RegExp.
+ * @returns {void}
+ */
+pp$1.validateRegExpFlags = function(state) {
+ var validFlags = state.validFlags;
+ var flags = state.flags;
+
+ var u = false;
+ var v = false;
+
+ for (var i = 0; i < flags.length; i++) {
+ var flag = flags.charAt(i);
+ if (validFlags.indexOf(flag) === -1) {
+ this.raise(state.start, "Invalid regular expression flag");
+ }
+ if (flags.indexOf(flag, i + 1) > -1) {
+ this.raise(state.start, "Duplicate regular expression flag");
+ }
+ if (flag === "u") { u = true; }
+ if (flag === "v") { v = true; }
+ }
+ if (this.options.ecmaVersion >= 15 && u && v) {
+ this.raise(state.start, "Invalid regular expression flag");
+ }
+};
+
+/**
+ * Validate the pattern part of a given RegExpLiteral.
+ *
+ * @param {RegExpValidationState} state The state to validate RegExp.
+ * @returns {void}
+ */
+pp$1.validateRegExpPattern = function(state) {
+ this.regexp_pattern(state);
+
+ // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of
+ // parsing contains a |GroupName|, reparse with the goal symbol
+ // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError*
+ // exception if _P_ did not conform to the grammar, if any elements of _P_
+ // were not matched by the parse, or if any Early Error conditions exist.
+ if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) {
+ state.switchN = true;
+ this.regexp_pattern(state);
+ }
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
+pp$1.regexp_pattern = function(state) {
+ state.pos = 0;
+ state.lastIntValue = 0;
+ state.lastStringValue = "";
+ state.lastAssertionIsQuantifiable = false;
+ state.numCapturingParens = 0;
+ state.maxBackReference = 0;
+ state.groupNames.length = 0;
+ state.backReferenceNames.length = 0;
+
+ this.regexp_disjunction(state);
+
+ if (state.pos !== state.source.length) {
+ // Make the same messages as V8.
+ if (state.eat(0x29 /* ) */)) {
+ state.raise("Unmatched ')'");
+ }
+ if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) {
+ state.raise("Lone quantifier brackets");
+ }
+ }
+ if (state.maxBackReference > state.numCapturingParens) {
+ state.raise("Invalid escape");
+ }
+ for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
+ var name = list[i];
+
+ if (state.groupNames.indexOf(name) === -1) {
+ state.raise("Invalid named capture referenced");
+ }
+ }
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
+pp$1.regexp_disjunction = function(state) {
+ this.regexp_alternative(state);
+ while (state.eat(0x7C /* | */)) {
+ this.regexp_alternative(state);
+ }
+
+ // Make the same message as V8.
+ if (this.regexp_eatQuantifier(state, true)) {
+ state.raise("Nothing to repeat");
+ }
+ if (state.eat(0x7B /* { */)) {
+ state.raise("Lone quantifier brackets");
+ }
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
+pp$1.regexp_alternative = function(state) {
+ while (state.pos < state.source.length && this.regexp_eatTerm(state))
+ { }
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term
+pp$1.regexp_eatTerm = function(state) {
+ if (this.regexp_eatAssertion(state)) {
+ // Handle `QuantifiableAssertion Quantifier` alternative.
+ // `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
+ // is a QuantifiableAssertion.
+ if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {
+ // Make the same message as V8.
+ if (state.switchU) {
+ state.raise("Invalid quantifier");
+ }
+ }
+ return true
+ }
+
+ if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {
+ this.regexp_eatQuantifier(state);
+ return true
+ }
+
+ return false
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
+pp$1.regexp_eatAssertion = function(state) {
+ var start = state.pos;
+ state.lastAssertionIsQuantifiable = false;
+
+ // ^, $
+ if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) {
+ return true
+ }
+
+ // \b \B
+ if (state.eat(0x5C /* \ */)) {
+ if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) {
+ return true
+ }
+ state.pos = start;
+ }
+
+ // Lookahead / Lookbehind
+ if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) {
+ var lookbehind = false;
+ if (this.options.ecmaVersion >= 9) {
+ lookbehind = state.eat(0x3C /* < */);
+ }
+ if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) {
+ this.regexp_disjunction(state);
+ if (!state.eat(0x29 /* ) */)) {
+ state.raise("Unterminated group");
+ }
+ state.lastAssertionIsQuantifiable = !lookbehind;
+ return true
+ }
+ }
+
+ state.pos = start;
+ return false
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
+pp$1.regexp_eatQuantifier = function(state, noError) {
+ if ( noError === void 0 ) noError = false;
+
+ if (this.regexp_eatQuantifierPrefix(state, noError)) {
+ state.eat(0x3F /* ? */);
+ return true
+ }
+ return false
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
+pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
+ return (
+ state.eat(0x2A /* * */) ||
+ state.eat(0x2B /* + */) ||
+ state.eat(0x3F /* ? */) ||
+ this.regexp_eatBracedQuantifier(state, noError)
+ )
+};
+pp$1.regexp_eatBracedQuantifier = function(state, noError) {
+ var start = state.pos;
+ if (state.eat(0x7B /* { */)) {
+ var min = 0, max = -1;
+ if (this.regexp_eatDecimalDigits(state)) {
+ min = state.lastIntValue;
+ if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) {
+ max = state.lastIntValue;
+ }
+ if (state.eat(0x7D /* } */)) {
+ // SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term
+ if (max !== -1 && max < min && !noError) {
+ state.raise("numbers out of order in {} quantifier");
+ }
+ return true
+ }
+ }
+ if (state.switchU && !noError) {
+ state.raise("Incomplete quantifier");
+ }
+ state.pos = start;
+ }
+ return false
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
+pp$1.regexp_eatAtom = function(state) {
+ return (
+ this.regexp_eatPatternCharacters(state) ||
+ state.eat(0x2E /* . */) ||
+ this.regexp_eatReverseSolidusAtomEscape(state) ||
+ this.regexp_eatCharacterClass(state) ||
+ this.regexp_eatUncapturingGroup(state) ||
+ this.regexp_eatCapturingGroup(state)
+ )
+};
+pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
+ var start = state.pos;
+ if (state.eat(0x5C /* \ */)) {
+ if (this.regexp_eatAtomEscape(state)) {
+ return true
+ }
+ state.pos = start;
+ }
+ return false
+};
+pp$1.regexp_eatUncapturingGroup = function(state) {
+ var start = state.pos;
+ if (state.eat(0x28 /* ( */)) {
+ if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {
+ this.regexp_disjunction(state);
+ if (state.eat(0x29 /* ) */)) {
+ return true
+ }
+ state.raise("Unterminated group");
+ }
+ state.pos = start;
+ }
+ return false
+};
+pp$1.regexp_eatCapturingGroup = function(state) {
+ if (state.eat(0x28 /* ( */)) {
+ if (this.options.ecmaVersion >= 9) {
+ this.regexp_groupSpecifier(state);
+ } else if (state.current() === 0x3F /* ? */) {
+ state.raise("Invalid group");
+ }
+ this.regexp_disjunction(state);
+ if (state.eat(0x29 /* ) */)) {
+ state.numCapturingParens += 1;
+ return true
+ }
+ state.raise("Unterminated group");
+ }
+ return false
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
+pp$1.regexp_eatExtendedAtom = function(state) {
+ return (
+ state.eat(0x2E /* . */) ||
+ this.regexp_eatReverseSolidusAtomEscape(state) ||
+ this.regexp_eatCharacterClass(state) ||
+ this.regexp_eatUncapturingGroup(state) ||
+ this.regexp_eatCapturingGroup(state) ||
+ this.regexp_eatInvalidBracedQuantifier(state) ||
+ this.regexp_eatExtendedPatternCharacter(state)
+ )
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier
+pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
+ if (this.regexp_eatBracedQuantifier(state, true)) {
+ state.raise("Nothing to repeat");
+ }
+ return false
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
+pp$1.regexp_eatSyntaxCharacter = function(state) {
+ var ch = state.current();
+ if (isSyntaxCharacter(ch)) {
+ state.lastIntValue = ch;
+ state.advance();
+ return true
+ }
+ return false
+};
+function isSyntaxCharacter(ch) {
+ return (
+ ch === 0x24 /* $ */ ||
+ ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ ||
+ ch === 0x2E /* . */ ||
+ ch === 0x3F /* ? */ ||
+ ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ ||
+ ch >= 0x7B /* { */ && ch <= 0x7D /* } */
+ )
+}
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
+// But eat eager.
+pp$1.regexp_eatPatternCharacters = function(state) {
+ var start = state.pos;
+ var ch = 0;
+ while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
+ state.advance();
+ }
+ return state.pos !== start
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
+pp$1.regexp_eatExtendedPatternCharacter = function(state) {
+ var ch = state.current();
+ if (
+ ch !== -1 &&
+ ch !== 0x24 /* $ */ &&
+ !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) &&
+ ch !== 0x2E /* . */ &&
+ ch !== 0x3F /* ? */ &&
+ ch !== 0x5B /* [ */ &&
+ ch !== 0x5E /* ^ */ &&
+ ch !== 0x7C /* | */
+ ) {
+ state.advance();
+ return true
+ }
+ return false
+};
+
+// GroupSpecifier ::
+// [empty]
+// `?` GroupName
+pp$1.regexp_groupSpecifier = function(state) {
+ if (state.eat(0x3F /* ? */)) {
+ if (this.regexp_eatGroupName(state)) {
+ if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
+ state.raise("Duplicate capture group name");
+ }
+ state.groupNames.push(state.lastStringValue);
+ return
+ }
+ state.raise("Invalid group");
+ }
+};
+
+// GroupName ::
+// `<` RegExpIdentifierName `>`
+// Note: this updates `state.lastStringValue` property with the eaten name.
+pp$1.regexp_eatGroupName = function(state) {
+ state.lastStringValue = "";
+ if (state.eat(0x3C /* < */)) {
+ if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
+ return true
+ }
+ state.raise("Invalid capture group name");
+ }
+ return false
+};
+
+// RegExpIdentifierName ::
+// RegExpIdentifierStart
+// RegExpIdentifierName RegExpIdentifierPart
+// Note: this updates `state.lastStringValue` property with the eaten name.
+pp$1.regexp_eatRegExpIdentifierName = function(state) {
+ state.lastStringValue = "";
+ if (this.regexp_eatRegExpIdentifierStart(state)) {
+ state.lastStringValue += codePointToString(state.lastIntValue);
+ while (this.regexp_eatRegExpIdentifierPart(state)) {
+ state.lastStringValue += codePointToString(state.lastIntValue);
+ }
+ return true
+ }
+ return false
+};
+
+// RegExpIdentifierStart ::
+// UnicodeIDStart
+// `$`
+// `_`
+// `\` RegExpUnicodeEscapeSequence[+U]
+pp$1.regexp_eatRegExpIdentifierStart = function(state) {
+ var start = state.pos;
+ var forceU = this.options.ecmaVersion >= 11;
+ var ch = state.current(forceU);
+ state.advance(forceU);
+
+ if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
+ ch = state.lastIntValue;
+ }
+ if (isRegExpIdentifierStart(ch)) {
+ state.lastIntValue = ch;
+ return true
+ }
+
+ state.pos = start;
+ return false
+};
+function isRegExpIdentifierStart(ch) {
+ return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */
+}
+
+// RegExpIdentifierPart ::
+// UnicodeIDContinue
+// `$`
+// `_`
+// `\` RegExpUnicodeEscapeSequence[+U]
+//
+//
+pp$1.regexp_eatRegExpIdentifierPart = function(state) {
+ var start = state.pos;
+ var forceU = this.options.ecmaVersion >= 11;
+ var ch = state.current(forceU);
+ state.advance(forceU);
+
+ if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
+ ch = state.lastIntValue;
+ }
+ if (isRegExpIdentifierPart(ch)) {
+ state.lastIntValue = ch;
+ return true
+ }
+
+ state.pos = start;
+ return false
+};
+function isRegExpIdentifierPart(ch) {
+ return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* */ || ch === 0x200D /* */
+}
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
+pp$1.regexp_eatAtomEscape = function(state) {
+ if (
+ this.regexp_eatBackReference(state) ||
+ this.regexp_eatCharacterClassEscape(state) ||
+ this.regexp_eatCharacterEscape(state) ||
+ (state.switchN && this.regexp_eatKGroupName(state))
+ ) {
+ return true
+ }
+ if (state.switchU) {
+ // Make the same message as V8.
+ if (state.current() === 0x63 /* c */) {
+ state.raise("Invalid unicode escape");
+ }
+ state.raise("Invalid escape");
+ }
+ return false
+};
+pp$1.regexp_eatBackReference = function(state) {
+ var start = state.pos;
+ if (this.regexp_eatDecimalEscape(state)) {
+ var n = state.lastIntValue;
+ if (state.switchU) {
+ // For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape
+ if (n > state.maxBackReference) {
+ state.maxBackReference = n;
+ }
+ return true
+ }
+ if (n <= state.numCapturingParens) {
+ return true
+ }
+ state.pos = start;
+ }
+ return false
+};
+pp$1.regexp_eatKGroupName = function(state) {
+ if (state.eat(0x6B /* k */)) {
+ if (this.regexp_eatGroupName(state)) {
+ state.backReferenceNames.push(state.lastStringValue);
+ return true
+ }
+ state.raise("Invalid named reference");
+ }
+ return false
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
+pp$1.regexp_eatCharacterEscape = function(state) {
+ return (
+ this.regexp_eatControlEscape(state) ||
+ this.regexp_eatCControlLetter(state) ||
+ this.regexp_eatZero(state) ||
+ this.regexp_eatHexEscapeSequence(state) ||
+ this.regexp_eatRegExpUnicodeEscapeSequence(state, false) ||
+ (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) ||
+ this.regexp_eatIdentityEscape(state)
+ )
+};
+pp$1.regexp_eatCControlLetter = function(state) {
+ var start = state.pos;
+ if (state.eat(0x63 /* c */)) {
+ if (this.regexp_eatControlLetter(state)) {
+ return true
+ }
+ state.pos = start;
+ }
+ return false
+};
+pp$1.regexp_eatZero = function(state) {
+ if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
+ state.lastIntValue = 0;
+ state.advance();
+ return true
+ }
+ return false
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
+pp$1.regexp_eatControlEscape = function(state) {
+ var ch = state.current();
+ if (ch === 0x74 /* t */) {
+ state.lastIntValue = 0x09; /* \t */
+ state.advance();
+ return true
+ }
+ if (ch === 0x6E /* n */) {
+ state.lastIntValue = 0x0A; /* \n */
+ state.advance();
+ return true
+ }
+ if (ch === 0x76 /* v */) {
+ state.lastIntValue = 0x0B; /* \v */
+ state.advance();
+ return true
+ }
+ if (ch === 0x66 /* f */) {
+ state.lastIntValue = 0x0C; /* \f */
+ state.advance();
+ return true
+ }
+ if (ch === 0x72 /* r */) {
+ state.lastIntValue = 0x0D; /* \r */
+ state.advance();
+ return true
+ }
+ return false
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
+pp$1.regexp_eatControlLetter = function(state) {
+ var ch = state.current();
+ if (isControlLetter(ch)) {
+ state.lastIntValue = ch % 0x20;
+ state.advance();
+ return true
+ }
+ return false
+};
+function isControlLetter(ch) {
+ return (
+ (ch >= 0x41 /* A */ && ch <= 0x5A /* Z */) ||
+ (ch >= 0x61 /* a */ && ch <= 0x7A /* z */)
+ )
+}
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
+pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
+ if ( forceU === void 0 ) forceU = false;
+
+ var start = state.pos;
+ var switchU = forceU || state.switchU;
+
+ if (state.eat(0x75 /* u */)) {
+ if (this.regexp_eatFixedHexDigits(state, 4)) {
+ var lead = state.lastIntValue;
+ if (switchU && lead >= 0xD800 && lead <= 0xDBFF) {
+ var leadSurrogateEnd = state.pos;
+ if (state.eat(0x5C /* \ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {
+ var trail = state.lastIntValue;
+ if (trail >= 0xDC00 && trail <= 0xDFFF) {
+ state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
+ return true
+ }
+ }
+ state.pos = leadSurrogateEnd;
+ state.lastIntValue = lead;
+ }
+ return true
+ }
+ if (
+ switchU &&
+ state.eat(0x7B /* { */) &&
+ this.regexp_eatHexDigits(state) &&
+ state.eat(0x7D /* } */) &&
+ isValidUnicode(state.lastIntValue)
+ ) {
+ return true
+ }
+ if (switchU) {
+ state.raise("Invalid unicode escape");
+ }
+ state.pos = start;
+ }
+
+ return false
+};
+function isValidUnicode(ch) {
+ return ch >= 0 && ch <= 0x10FFFF
+}
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
+pp$1.regexp_eatIdentityEscape = function(state) {
+ if (state.switchU) {
+ if (this.regexp_eatSyntaxCharacter(state)) {
+ return true
+ }
+ if (state.eat(0x2F /* / */)) {
+ state.lastIntValue = 0x2F; /* / */
+ return true
+ }
+ return false
+ }
+
+ var ch = state.current();
+ if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) {
+ state.lastIntValue = ch;
+ state.advance();
+ return true
+ }
+
+ return false
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
+pp$1.regexp_eatDecimalEscape = function(state) {
+ state.lastIntValue = 0;
+ var ch = state.current();
+ if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
+ do {
+ state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
+ state.advance();
+ } while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */)
+ return true
+ }
+ return false
+};
+
+// Return values used by character set parsing methods, needed to
+// forbid negation of sets that can match strings.
+var CharSetNone = 0; // Nothing parsed
+var CharSetOk = 1; // Construct parsed, cannot contain strings
+var CharSetString = 2; // Construct parsed, can contain strings
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
+pp$1.regexp_eatCharacterClassEscape = function(state) {
+ var ch = state.current();
+
+ if (isCharacterClassEscape(ch)) {
+ state.lastIntValue = -1;
+ state.advance();
+ return CharSetOk
+ }
+
+ var negate = false;
+ if (
+ state.switchU &&
+ this.options.ecmaVersion >= 9 &&
+ ((negate = ch === 0x50 /* P */) || ch === 0x70 /* p */)
+ ) {
+ state.lastIntValue = -1;
+ state.advance();
+ var result;
+ if (
+ state.eat(0x7B /* { */) &&
+ (result = this.regexp_eatUnicodePropertyValueExpression(state)) &&
+ state.eat(0x7D /* } */)
+ ) {
+ if (negate && result === CharSetString) { state.raise("Invalid property name"); }
+ return result
+ }
+ state.raise("Invalid property name");
+ }
+
+ return CharSetNone
+};
+
+function isCharacterClassEscape(ch) {
+ return (
+ ch === 0x64 /* d */ ||
+ ch === 0x44 /* D */ ||
+ ch === 0x73 /* s */ ||
+ ch === 0x53 /* S */ ||
+ ch === 0x77 /* w */ ||
+ ch === 0x57 /* W */
+ )
+}
+
+// UnicodePropertyValueExpression ::
+// UnicodePropertyName `=` UnicodePropertyValue
+// LoneUnicodePropertyNameOrValue
+pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
+ var start = state.pos;
+
+ // UnicodePropertyName `=` UnicodePropertyValue
+ if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) {
+ var name = state.lastStringValue;
+ if (this.regexp_eatUnicodePropertyValue(state)) {
+ var value = state.lastStringValue;
+ this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
+ return CharSetOk
+ }
+ }
+ state.pos = start;
+
+ // LoneUnicodePropertyNameOrValue
+ if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
+ var nameOrValue = state.lastStringValue;
+ return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)
+ }
+ return CharSetNone
+};
+
+pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
+ if (!hasOwn(state.unicodeProperties.nonBinary, name))
+ { state.raise("Invalid property name"); }
+ if (!state.unicodeProperties.nonBinary[name].test(value))
+ { state.raise("Invalid property value"); }
+};
+
+pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
+ if (state.unicodeProperties.binary.test(nameOrValue)) { return CharSetOk }
+ if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) { return CharSetString }
+ state.raise("Invalid property name");
+};
+
+// UnicodePropertyName ::
+// UnicodePropertyNameCharacters
+pp$1.regexp_eatUnicodePropertyName = function(state) {
+ var ch = 0;
+ state.lastStringValue = "";
+ while (isUnicodePropertyNameCharacter(ch = state.current())) {
+ state.lastStringValue += codePointToString(ch);
+ state.advance();
+ }
+ return state.lastStringValue !== ""
+};
+
+function isUnicodePropertyNameCharacter(ch) {
+ return isControlLetter(ch) || ch === 0x5F /* _ */
+}
+
+// UnicodePropertyValue ::
+// UnicodePropertyValueCharacters
+pp$1.regexp_eatUnicodePropertyValue = function(state) {
+ var ch = 0;
+ state.lastStringValue = "";
+ while (isUnicodePropertyValueCharacter(ch = state.current())) {
+ state.lastStringValue += codePointToString(ch);
+ state.advance();
+ }
+ return state.lastStringValue !== ""
+};
+function isUnicodePropertyValueCharacter(ch) {
+ return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch)
+}
+
+// LoneUnicodePropertyNameOrValue ::
+// UnicodePropertyValueCharacters
+pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
+ return this.regexp_eatUnicodePropertyValue(state)
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
+pp$1.regexp_eatCharacterClass = function(state) {
+ if (state.eat(0x5B /* [ */)) {
+ var negate = state.eat(0x5E /* ^ */);
+ var result = this.regexp_classContents(state);
+ if (!state.eat(0x5D /* ] */))
+ { state.raise("Unterminated character class"); }
+ if (negate && result === CharSetString)
+ { state.raise("Negated character class may contain strings"); }
+ return true
+ }
+ return false
+};
+
+// https://tc39.es/ecma262/#prod-ClassContents
+// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
+pp$1.regexp_classContents = function(state) {
+ if (state.current() === 0x5D /* ] */) { return CharSetOk }
+ if (state.switchV) { return this.regexp_classSetExpression(state) }
+ this.regexp_nonEmptyClassRanges(state);
+ return CharSetOk
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
+// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
+pp$1.regexp_nonEmptyClassRanges = function(state) {
+ while (this.regexp_eatClassAtom(state)) {
+ var left = state.lastIntValue;
+ if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
+ var right = state.lastIntValue;
+ if (state.switchU && (left === -1 || right === -1)) {
+ state.raise("Invalid character class");
+ }
+ if (left !== -1 && right !== -1 && left > right) {
+ state.raise("Range out of order in character class");
+ }
+ }
+ }
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
+// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
+pp$1.regexp_eatClassAtom = function(state) {
+ var start = state.pos;
+
+ if (state.eat(0x5C /* \ */)) {
+ if (this.regexp_eatClassEscape(state)) {
+ return true
+ }
+ if (state.switchU) {
+ // Make the same message as V8.
+ var ch$1 = state.current();
+ if (ch$1 === 0x63 /* c */ || isOctalDigit(ch$1)) {
+ state.raise("Invalid class escape");
+ }
+ state.raise("Invalid escape");
+ }
+ state.pos = start;
+ }
+
+ var ch = state.current();
+ if (ch !== 0x5D /* ] */) {
+ state.lastIntValue = ch;
+ state.advance();
+ return true
+ }
+
+ return false
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
+pp$1.regexp_eatClassEscape = function(state) {
+ var start = state.pos;
+
+ if (state.eat(0x62 /* b */)) {
+ state.lastIntValue = 0x08; /* */
+ return true
+ }
+
+ if (state.switchU && state.eat(0x2D /* - */)) {
+ state.lastIntValue = 0x2D; /* - */
+ return true
+ }
+
+ if (!state.switchU && state.eat(0x63 /* c */)) {
+ if (this.regexp_eatClassControlLetter(state)) {
+ return true
+ }
+ state.pos = start;
+ }
+
+ return (
+ this.regexp_eatCharacterClassEscape(state) ||
+ this.regexp_eatCharacterEscape(state)
+ )
+};
+
+// https://tc39.es/ecma262/#prod-ClassSetExpression
+// https://tc39.es/ecma262/#prod-ClassUnion
+// https://tc39.es/ecma262/#prod-ClassIntersection
+// https://tc39.es/ecma262/#prod-ClassSubtraction
+pp$1.regexp_classSetExpression = function(state) {
+ var result = CharSetOk, subResult;
+ if (this.regexp_eatClassSetRange(state)) ; else if (subResult = this.regexp_eatClassSetOperand(state)) {
+ if (subResult === CharSetString) { result = CharSetString; }
+ // https://tc39.es/ecma262/#prod-ClassIntersection
+ var start = state.pos;
+ while (state.eatChars([0x26, 0x26] /* && */)) {
+ if (
+ state.current() !== 0x26 /* & */ &&
+ (subResult = this.regexp_eatClassSetOperand(state))
+ ) {
+ if (subResult !== CharSetString) { result = CharSetOk; }
+ continue
+ }
+ state.raise("Invalid character in character class");
+ }
+ if (start !== state.pos) { return result }
+ // https://tc39.es/ecma262/#prod-ClassSubtraction
+ while (state.eatChars([0x2D, 0x2D] /* -- */)) {
+ if (this.regexp_eatClassSetOperand(state)) { continue }
+ state.raise("Invalid character in character class");
+ }
+ if (start !== state.pos) { return result }
+ } else {
+ state.raise("Invalid character in character class");
+ }
+ // https://tc39.es/ecma262/#prod-ClassUnion
+ for (;;) {
+ if (this.regexp_eatClassSetRange(state)) { continue }
+ subResult = this.regexp_eatClassSetOperand(state);
+ if (!subResult) { return result }
+ if (subResult === CharSetString) { result = CharSetString; }
+ }
+};
+
+// https://tc39.es/ecma262/#prod-ClassSetRange
+pp$1.regexp_eatClassSetRange = function(state) {
+ var start = state.pos;
+ if (this.regexp_eatClassSetCharacter(state)) {
+ var left = state.lastIntValue;
+ if (state.eat(0x2D /* - */) && this.regexp_eatClassSetCharacter(state)) {
+ var right = state.lastIntValue;
+ if (left !== -1 && right !== -1 && left > right) {
+ state.raise("Range out of order in character class");
+ }
+ return true
+ }
+ state.pos = start;
+ }
+ return false
+};
+
+// https://tc39.es/ecma262/#prod-ClassSetOperand
+pp$1.regexp_eatClassSetOperand = function(state) {
+ if (this.regexp_eatClassSetCharacter(state)) { return CharSetOk }
+ return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state)
+};
+
+// https://tc39.es/ecma262/#prod-NestedClass
+pp$1.regexp_eatNestedClass = function(state) {
+ var start = state.pos;
+ if (state.eat(0x5B /* [ */)) {
+ var negate = state.eat(0x5E /* ^ */);
+ var result = this.regexp_classContents(state);
+ if (state.eat(0x5D /* ] */)) {
+ if (negate && result === CharSetString) {
+ state.raise("Negated character class may contain strings");
+ }
+ return result
+ }
+ state.pos = start;
+ }
+ if (state.eat(0x5C /* \ */)) {
+ var result$1 = this.regexp_eatCharacterClassEscape(state);
+ if (result$1) {
+ return result$1
+ }
+ state.pos = start;
+ }
+ return null
+};
+
+// https://tc39.es/ecma262/#prod-ClassStringDisjunction
+pp$1.regexp_eatClassStringDisjunction = function(state) {
+ var start = state.pos;
+ if (state.eatChars([0x5C, 0x71] /* \q */)) {
+ if (state.eat(0x7B /* { */)) {
+ var result = this.regexp_classStringDisjunctionContents(state);
+ if (state.eat(0x7D /* } */)) {
+ return result
+ }
+ } else {
+ // Make the same message as V8.
+ state.raise("Invalid escape");
+ }
+ state.pos = start;
+ }
+ return null
+};
+
+// https://tc39.es/ecma262/#prod-ClassStringDisjunctionContents
+pp$1.regexp_classStringDisjunctionContents = function(state) {
+ var result = this.regexp_classString(state);
+ while (state.eat(0x7C /* | */)) {
+ if (this.regexp_classString(state) === CharSetString) { result = CharSetString; }
+ }
+ return result
+};
+
+// https://tc39.es/ecma262/#prod-ClassString
+// https://tc39.es/ecma262/#prod-NonEmptyClassString
+pp$1.regexp_classString = function(state) {
+ var count = 0;
+ while (this.regexp_eatClassSetCharacter(state)) { count++; }
+ return count === 1 ? CharSetOk : CharSetString
+};
+
+// https://tc39.es/ecma262/#prod-ClassSetCharacter
+pp$1.regexp_eatClassSetCharacter = function(state) {
+ var start = state.pos;
+ if (state.eat(0x5C /* \ */)) {
+ if (
+ this.regexp_eatCharacterEscape(state) ||
+ this.regexp_eatClassSetReservedPunctuator(state)
+ ) {
+ return true
+ }
+ if (state.eat(0x62 /* b */)) {
+ state.lastIntValue = 0x08; /* */
+ return true
+ }
+ state.pos = start;
+ return false
+ }
+ var ch = state.current();
+ if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) { return false }
+ if (isClassSetSyntaxCharacter(ch)) { return false }
+ state.advance();
+ state.lastIntValue = ch;
+ return true
+};
+
+// https://tc39.es/ecma262/#prod-ClassSetReservedDoublePunctuator
+function isClassSetReservedDoublePunctuatorCharacter(ch) {
+ return (
+ ch === 0x21 /* ! */ ||
+ ch >= 0x23 /* # */ && ch <= 0x26 /* & */ ||
+ ch >= 0x2A /* * */ && ch <= 0x2C /* , */ ||
+ ch === 0x2E /* . */ ||
+ ch >= 0x3A /* : */ && ch <= 0x40 /* @ */ ||
+ ch === 0x5E /* ^ */ ||
+ ch === 0x60 /* ` */ ||
+ ch === 0x7E /* ~ */
+ )
+}
+
+// https://tc39.es/ecma262/#prod-ClassSetSyntaxCharacter
+function isClassSetSyntaxCharacter(ch) {
+ return (
+ ch === 0x28 /* ( */ ||
+ ch === 0x29 /* ) */ ||
+ ch === 0x2D /* - */ ||
+ ch === 0x2F /* / */ ||
+ ch >= 0x5B /* [ */ && ch <= 0x5D /* ] */ ||
+ ch >= 0x7B /* { */ && ch <= 0x7D /* } */
+ )
+}
+
+// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
+pp$1.regexp_eatClassSetReservedPunctuator = function(state) {
+ var ch = state.current();
+ if (isClassSetReservedPunctuator(ch)) {
+ state.lastIntValue = ch;
+ state.advance();
+ return true
+ }
+ return false
+};
+
+// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
+function isClassSetReservedPunctuator(ch) {
+ return (
+ ch === 0x21 /* ! */ ||
+ ch === 0x23 /* # */ ||
+ ch === 0x25 /* % */ ||
+ ch === 0x26 /* & */ ||
+ ch === 0x2C /* , */ ||
+ ch === 0x2D /* - */ ||
+ ch >= 0x3A /* : */ && ch <= 0x3E /* > */ ||
+ ch === 0x40 /* @ */ ||
+ ch === 0x60 /* ` */ ||
+ ch === 0x7E /* ~ */
+ )
+}
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
+pp$1.regexp_eatClassControlLetter = function(state) {
+ var ch = state.current();
+ if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
+ state.lastIntValue = ch % 0x20;
+ state.advance();
+ return true
+ }
+ return false
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
+pp$1.regexp_eatHexEscapeSequence = function(state) {
+ var start = state.pos;
+ if (state.eat(0x78 /* x */)) {
+ if (this.regexp_eatFixedHexDigits(state, 2)) {
+ return true
+ }
+ if (state.switchU) {
+ state.raise("Invalid escape");
+ }
+ state.pos = start;
+ }
+ return false
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
+pp$1.regexp_eatDecimalDigits = function(state) {
+ var start = state.pos;
+ var ch = 0;
+ state.lastIntValue = 0;
+ while (isDecimalDigit(ch = state.current())) {
+ state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
+ state.advance();
+ }
+ return state.pos !== start
+};
+function isDecimalDigit(ch) {
+ return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */
+}
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
+pp$1.regexp_eatHexDigits = function(state) {
+ var start = state.pos;
+ var ch = 0;
+ state.lastIntValue = 0;
+ while (isHexDigit(ch = state.current())) {
+ state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
+ state.advance();
+ }
+ return state.pos !== start
+};
+function isHexDigit(ch) {
+ return (
+ (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) ||
+ (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) ||
+ (ch >= 0x61 /* a */ && ch <= 0x66 /* f */)
+ )
+}
+function hexToInt(ch) {
+ if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) {
+ return 10 + (ch - 0x41 /* A */)
+ }
+ if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) {
+ return 10 + (ch - 0x61 /* a */)
+ }
+ return ch - 0x30 /* 0 */
+}
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
+// Allows only 0-377(octal) i.e. 0-255(decimal).
+pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {
+ if (this.regexp_eatOctalDigit(state)) {
+ var n1 = state.lastIntValue;
+ if (this.regexp_eatOctalDigit(state)) {
+ var n2 = state.lastIntValue;
+ if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {
+ state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue;
+ } else {
+ state.lastIntValue = n1 * 8 + n2;
+ }
+ } else {
+ state.lastIntValue = n1;
+ }
+ return true
+ }
+ return false
+};
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
+pp$1.regexp_eatOctalDigit = function(state) {
+ var ch = state.current();
+ if (isOctalDigit(ch)) {
+ state.lastIntValue = ch - 0x30; /* 0 */
+ state.advance();
+ return true
+ }
+ state.lastIntValue = 0;
+ return false
+};
+function isOctalDigit(ch) {
+ return ch >= 0x30 /* 0 */ && ch <= 0x37 /* 7 */
+}
+
+// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
+// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
+// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
+pp$1.regexp_eatFixedHexDigits = function(state, length) {
+ var start = state.pos;
+ state.lastIntValue = 0;
+ for (var i = 0; i < length; ++i) {
+ var ch = state.current();
+ if (!isHexDigit(ch)) {
+ state.pos = start;
+ return false
+ }
+ state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
+ state.advance();
+ }
+ return true
+};
+
+// Object type used to represent tokens. Note that normally, tokens
+// simply exist as properties on the parser object. This is only
+// used for the onToken callback and the external tokenizer.
+
+var Token = function Token(p) {
+ this.type = p.type;
+ this.value = p.value;
+ this.start = p.start;
+ this.end = p.end;
+ if (p.options.locations)
+ { this.loc = new SourceLocation(p, p.startLoc, p.endLoc); }
+ if (p.options.ranges)
+ { this.range = [p.start, p.end]; }
+};
+
+// ## Tokenizer
+
+var pp = Parser$1.prototype;
+
+// Move to the next token
+
+pp.next = function(ignoreEscapeSequenceInKeyword) {
+ if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)
+ { this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); }
+ if (this.options.onToken)
+ { this.options.onToken(new Token(this)); }
+
+ this.lastTokEnd = this.end;
+ this.lastTokStart = this.start;
+ this.lastTokEndLoc = this.endLoc;
+ this.lastTokStartLoc = this.startLoc;
+ this.nextToken();
+};
+
+pp.getToken = function() {
+ this.next();
+ return new Token(this)
+};
+
+// If we're in an ES6 environment, make parsers iterable
+if (typeof Symbol !== "undefined")
+ { pp[Symbol.iterator] = function() {
+ var this$1$1 = this;
+
+ return {
+ next: function () {
+ var token = this$1$1.getToken();
+ return {
+ done: token.type === types$1.eof,
+ value: token
+ }
+ }
+ }
+ }; }
+
+// Toggle strict mode. Re-reads the next number or string to please
+// pedantic tests (`"use strict"; 010;` should fail).
+
+// Read a single token, updating the parser object's token-related
+// properties.
+
+pp.nextToken = function() {
+ var curContext = this.curContext();
+ if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }
+
+ this.start = this.pos;
+ if (this.options.locations) { this.startLoc = this.curPosition(); }
+ if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }
+
+ if (curContext.override) { return curContext.override(this) }
+ else { this.readToken(this.fullCharCodeAtPos()); }
+};
+
+pp.readToken = function(code) {
+ // Identifier or keyword. '\uXXXX' sequences are allowed in
+ // identifiers, so '\' also dispatches to that.
+ if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */)
+ { return this.readWord() }
+
+ return this.getTokenFromCode(code)
+};
+
+pp.fullCharCodeAtPos = function() {
+ var code = this.input.charCodeAt(this.pos);
+ if (code <= 0xd7ff || code >= 0xdc00) { return code }
+ var next = this.input.charCodeAt(this.pos + 1);
+ return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
+};
+
+pp.skipBlockComment = function() {
+ var startLoc = this.options.onComment && this.curPosition();
+ var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
+ if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
+ this.pos = end + 2;
+ if (this.options.locations) {
+ for (var nextBreak = (void 0), pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1;) {
+ ++this.curLine;
+ pos = this.lineStart = nextBreak;
+ }
+ }
+ if (this.options.onComment)
+ { this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,
+ startLoc, this.curPosition()); }
+};
+
+pp.skipLineComment = function(startSkip) {
+ var start = this.pos;
+ var startLoc = this.options.onComment && this.curPosition();
+ var ch = this.input.charCodeAt(this.pos += startSkip);
+ while (this.pos < this.input.length && !isNewLine(ch)) {
+ ch = this.input.charCodeAt(++this.pos);
+ }
+ if (this.options.onComment)
+ { this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,
+ startLoc, this.curPosition()); }
+};
+
+// Called at the start of the parse and after every token. Skips
+// whitespace and comments, and.
+
+pp.skipSpace = function() {
+ loop: while (this.pos < this.input.length) {
+ var ch = this.input.charCodeAt(this.pos);
+ switch (ch) {
+ case 32: case 160: // ' '
+ ++this.pos;
+ break
+ case 13:
+ if (this.input.charCodeAt(this.pos + 1) === 10) {
+ ++this.pos;
+ }
+ case 10: case 8232: case 8233:
+ ++this.pos;
+ if (this.options.locations) {
+ ++this.curLine;
+ this.lineStart = this.pos;
+ }
+ break
+ case 47: // '/'
+ switch (this.input.charCodeAt(this.pos + 1)) {
+ case 42: // '*'
+ this.skipBlockComment();
+ break
+ case 47:
+ this.skipLineComment(2);
+ break
+ default:
+ break loop
+ }
+ break
+ default:
+ if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
+ ++this.pos;
+ } else {
+ break loop
+ }
+ }
+ }
+};
+
+// Called at the end of every token. Sets `end`, `val`, and
+// maintains `context` and `exprAllowed`, and skips the space after
+// the token, so that the next one's `start` will point at the
+// right position.
+
+pp.finishToken = function(type, val) {
+ this.end = this.pos;
+ if (this.options.locations) { this.endLoc = this.curPosition(); }
+ var prevType = this.type;
+ this.type = type;
+ this.value = val;
+
+ this.updateContext(prevType);
+};
+
+// ### Token reading
+
+// This is the function that is called to fetch the next token. It
+// is somewhat obscure, because it works in character codes rather
+// than characters, and because operator parsing has been inlined
+// into it.
+//
+// All in the name of speed.
+//
+pp.readToken_dot = function() {
+ var next = this.input.charCodeAt(this.pos + 1);
+ if (next >= 48 && next <= 57) { return this.readNumber(true) }
+ var next2 = this.input.charCodeAt(this.pos + 2);
+ if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'
+ this.pos += 3;
+ return this.finishToken(types$1.ellipsis)
+ } else {
+ ++this.pos;
+ return this.finishToken(types$1.dot)
+ }
+};
+
+pp.readToken_slash = function() { // '/'
+ var next = this.input.charCodeAt(this.pos + 1);
+ if (this.exprAllowed) { ++this.pos; return this.readRegexp() }
+ if (next === 61) { return this.finishOp(types$1.assign, 2) }
+ return this.finishOp(types$1.slash, 1)
+};
+
+pp.readToken_mult_modulo_exp = function(code) { // '%*'
+ var next = this.input.charCodeAt(this.pos + 1);
+ var size = 1;
+ var tokentype = code === 42 ? types$1.star : types$1.modulo;
+
+ // exponentiation operator ** and **=
+ if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
+ ++size;
+ tokentype = types$1.starstar;
+ next = this.input.charCodeAt(this.pos + 2);
+ }
+
+ if (next === 61) { return this.finishOp(types$1.assign, size + 1) }
+ return this.finishOp(tokentype, size)
+};
+
+pp.readToken_pipe_amp = function(code) { // '|&'
+ var next = this.input.charCodeAt(this.pos + 1);
+ if (next === code) {
+ if (this.options.ecmaVersion >= 12) {
+ var next2 = this.input.charCodeAt(this.pos + 2);
+ if (next2 === 61) { return this.finishOp(types$1.assign, 3) }
+ }
+ return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)
+ }
+ if (next === 61) { return this.finishOp(types$1.assign, 2) }
+ return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)
+};
+
+pp.readToken_caret = function() { // '^'
+ var next = this.input.charCodeAt(this.pos + 1);
+ if (next === 61) { return this.finishOp(types$1.assign, 2) }
+ return this.finishOp(types$1.bitwiseXOR, 1)
+};
+
+pp.readToken_plus_min = function(code) { // '+-'
+ var next = this.input.charCodeAt(this.pos + 1);
+ if (next === code) {
+ if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
+ (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {
+ // A `-->` line comment
+ this.skipLineComment(3);
+ this.skipSpace();
+ return this.nextToken()
+ }
+ return this.finishOp(types$1.incDec, 2)
+ }
+ if (next === 61) { return this.finishOp(types$1.assign, 2) }
+ return this.finishOp(types$1.plusMin, 1)
+};
+
+pp.readToken_lt_gt = function(code) { // '<>'
+ var next = this.input.charCodeAt(this.pos + 1);
+ var size = 1;
+ if (next === code) {
+ size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
+ if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }
+ return this.finishOp(types$1.bitShift, size)
+ }
+ if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
+ this.input.charCodeAt(this.pos + 3) === 45) {
+ // `/gs;
+const srcRE = /\bsrc\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
+const typeRE = /\btype\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
+const langRE = /\blang\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
+const contextRE = /\bcontext\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
+function esbuildScanPlugin(config, container, depImports, missing, entries) {
+ const seen = new Map();
+ const resolve = async (id, importer, options) => {
+ const key = id + (importer && path$o.dirname(importer));
+ if (seen.has(key)) {
+ return seen.get(key);
+ }
+ const resolved = await container.resolveId(id, importer && normalizePath$3(importer), {
+ ...options,
+ scan: true,
+ });
+ const res = resolved?.id;
+ seen.set(key, res);
+ return res;
+ };
+ const include = config.optimizeDeps?.include;
+ const exclude = [
+ ...(config.optimizeDeps?.exclude || []),
+ '@vite/client',
+ '@vite/env',
+ ];
+ const externalUnlessEntry = ({ path }) => ({
+ path,
+ external: !entries.includes(path),
+ });
+ const doTransformGlobImport = async (contents, id, loader) => {
+ let transpiledContents;
+ // transpile because `transformGlobImport` only expects js
+ if (loader !== 'js') {
+ transpiledContents = (await transform$1(contents, { loader })).code;
+ }
+ else {
+ transpiledContents = contents;
+ }
+ const result = await transformGlobImport(transpiledContents, id, config.root, resolve, config.isProduction);
+ return result?.s.toString() || transpiledContents;
+ };
+ return {
+ name: 'vite:dep-scan',
+ setup(build) {
+ const scripts = {};
+ // external urls
+ build.onResolve({ filter: externalRE }, ({ path }) => ({
+ path,
+ external: true,
+ }));
+ // data urls
+ build.onResolve({ filter: dataUrlRE }, ({ path }) => ({
+ path,
+ external: true,
+ }));
+ // local scripts (``);
+ preTransformRequest(server, modulePath, base);
+ };
+ await traverseHtml(html, filename, (node) => {
+ if (!nodeIsElement(node)) {
+ return;
+ }
+ // script tags
+ if (node.nodeName === 'script') {
+ const { src, sourceCodeLocation, isModule } = getScriptInfo(node);
+ if (src) {
+ processNodeUrl(src, sourceCodeLocation, s, config, htmlPath, originalUrl, server);
+ }
+ else if (isModule && node.childNodes.length) {
+ addInlineModule(node, 'js');
+ }
+ }
+ if (node.nodeName === 'style' && node.childNodes.length) {
+ const children = node.childNodes[0];
+ styleUrl.push({
+ start: children.sourceCodeLocation.startOffset,
+ end: children.sourceCodeLocation.endOffset,
+ code: children.value,
+ });
+ }
+ // elements with [href/src] attrs
+ const assetAttrs = assetAttrsConfig[node.nodeName];
+ if (assetAttrs) {
+ for (const p of node.attrs) {
+ const attrKey = getAttrKey(p);
+ if (p.value && assetAttrs.includes(attrKey)) {
+ processNodeUrl(p, node.sourceCodeLocation.attrs[attrKey], s, config, htmlPath, originalUrl);
+ }
+ }
+ }
+ });
+ await Promise.all(styleUrl.map(async ({ start, end, code }, index) => {
+ const url = `${proxyModulePath}?html-proxy&direct&index=${index}.css`;
+ // ensure module in graph after successful load
+ const mod = await moduleGraph.ensureEntryFromUrl(url, false);
+ ensureWatchedFile(watcher, mod.file, config.root);
+ const result = await server.pluginContainer.transform(code, mod.id);
+ let content = '';
+ if (result) {
+ if (result.map) {
+ if (result.map.mappings) {
+ await injectSourcesContent(result.map, proxyModulePath, config.logger);
+ }
+ content = getCodeWithSourcemap('css', result.code, result.map);
+ }
+ else {
+ content = result.code;
+ }
+ }
+ s.overwrite(start, end, content);
+ }));
+ html = s.toString();
+ return {
+ html,
+ tags: [
+ {
+ tag: 'script',
+ attrs: {
+ type: 'module',
+ src: path$o.posix.join(base, CLIENT_PUBLIC_PATH),
+ },
+ injectTo: 'head-prepend',
+ },
+ ],
+ };
+};
+function indexHtmlMiddleware(server) {
+ // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
+ return async function viteIndexHtmlMiddleware(req, res, next) {
+ if (res.writableEnded) {
+ return next();
+ }
+ const url = req.url && cleanUrl(req.url);
+ // htmlFallbackMiddleware appends '.html' to URLs
+ if (url?.endsWith('.html') && req.headers['sec-fetch-dest'] !== 'script') {
+ const filename = getHtmlFilename(url, server);
+ if (fs$l.existsSync(filename)) {
+ try {
+ let html = await fsp.readFile(filename, 'utf-8');
+ html = await server.transformIndexHtml(url, html, req.originalUrl);
+ return send$2(req, res, html, 'html', {
+ headers: server.config.server.headers,
+ });
+ }
+ catch (e) {
+ return next(e);
+ }
+ }
+ }
+ next();
+ };
+}
+function preTransformRequest(server, url, base) {
+ if (!server.config.server.preTransformRequests)
+ return;
+ url = unwrapId(stripBase(url, base));
+ // transform all url as non-ssr as html includes client-side assets only
+ server.transformRequest(url).catch((e) => {
+ if (e?.code === ERR_OUTDATED_OPTIMIZED_DEP ||
+ e?.code === ERR_CLOSED_SERVER) {
+ // these are expected errors
+ return;
+ }
+ // Unexpected error, log the issue but avoid an unhandled exception
+ server.config.logger.error(e.message);
+ });
+}
+
+const logTime = createDebugger('vite:time');
+function timeMiddleware(root) {
+ // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
+ return function viteTimeMiddleware(req, res, next) {
+ const start = performance.now();
+ const end = res.end;
+ res.end = (...args) => {
+ logTime?.(`${timeFrom(start)} ${prettifyUrl(req.url, root)}`);
+ return end.call(res, ...args);
+ };
+ next();
+ };
+}
+
+class ModuleNode {
+ /**
+ * @param setIsSelfAccepting - set `false` to set `isSelfAccepting` later. e.g. #7870
+ */
+ constructor(url, setIsSelfAccepting = true) {
+ /**
+ * Resolved file system path + query
+ */
+ this.id = null;
+ this.file = null;
+ this.importers = new Set();
+ this.clientImportedModules = new Set();
+ this.ssrImportedModules = new Set();
+ this.acceptedHmrDeps = new Set();
+ this.acceptedHmrExports = null;
+ this.importedBindings = null;
+ this.transformResult = null;
+ this.ssrTransformResult = null;
+ this.ssrModule = null;
+ this.ssrError = null;
+ this.lastHMRTimestamp = 0;
+ this.lastInvalidationTimestamp = 0;
+ this.url = url;
+ this.type = isDirectCSSRequest(url) ? 'css' : 'js';
+ if (setIsSelfAccepting) {
+ this.isSelfAccepting = false;
+ }
+ }
+ get importedModules() {
+ const importedModules = new Set(this.clientImportedModules);
+ for (const module of this.ssrImportedModules) {
+ importedModules.add(module);
+ }
+ return importedModules;
+ }
+}
+class ModuleGraph {
+ constructor(resolveId) {
+ this.resolveId = resolveId;
+ this.urlToModuleMap = new Map();
+ this.idToModuleMap = new Map();
+ // a single file may corresponds to multiple modules with different queries
+ this.fileToModulesMap = new Map();
+ this.safeModulesPath = new Set();
+ /**
+ * @internal
+ */
+ this._unresolvedUrlToModuleMap = new Map();
+ /**
+ * @internal
+ */
+ this._ssrUnresolvedUrlToModuleMap = new Map();
+ }
+ async getModuleByUrl(rawUrl, ssr) {
+ // Quick path, if we already have a module for this rawUrl (even without extension)
+ rawUrl = removeImportQuery(removeTimestampQuery(rawUrl));
+ const mod = this._getUnresolvedUrlToModule(rawUrl, ssr);
+ if (mod) {
+ return mod;
+ }
+ const [url] = await this._resolveUrl(rawUrl, ssr);
+ return this.urlToModuleMap.get(url);
+ }
+ getModuleById(id) {
+ return this.idToModuleMap.get(removeTimestampQuery(id));
+ }
+ getModulesByFile(file) {
+ return this.fileToModulesMap.get(file);
+ }
+ onFileChange(file) {
+ const mods = this.getModulesByFile(file);
+ if (mods) {
+ const seen = new Set();
+ mods.forEach((mod) => {
+ this.invalidateModule(mod, seen);
+ });
+ }
+ }
+ invalidateModule(mod, seen = new Set(), timestamp = Date.now(), isHmr = false, hmrBoundaries = []) {
+ if (seen.has(mod)) {
+ return;
+ }
+ seen.add(mod);
+ if (isHmr) {
+ mod.lastHMRTimestamp = timestamp;
+ }
+ else {
+ // Save the timestamp for this invalidation, so we can avoid caching the result of possible already started
+ // processing being done for this module
+ mod.lastInvalidationTimestamp = timestamp;
+ }
+ // Don't invalidate mod.info and mod.meta, as they are part of the processing pipeline
+ // Invalidating the transform result is enough to ensure this module is re-processed next time it is requested
+ mod.transformResult = null;
+ mod.ssrTransformResult = null;
+ mod.ssrModule = null;
+ mod.ssrError = null;
+ // Fix #3033
+ if (hmrBoundaries.includes(mod)) {
+ return;
+ }
+ mod.importers.forEach((importer) => {
+ if (!importer.acceptedHmrDeps.has(mod)) {
+ this.invalidateModule(importer, seen, timestamp, isHmr);
+ }
+ });
+ }
+ invalidateAll() {
+ const timestamp = Date.now();
+ const seen = new Set();
+ this.idToModuleMap.forEach((mod) => {
+ this.invalidateModule(mod, seen, timestamp);
+ });
+ }
+ /**
+ * Update the module graph based on a module's updated imports information
+ * If there are dependencies that no longer have any importers, they are
+ * returned as a Set.
+ */
+ async updateModuleInfo(mod, importedModules, importedBindings, acceptedModules, acceptedExports, isSelfAccepting, ssr) {
+ mod.isSelfAccepting = isSelfAccepting;
+ const prevImports = ssr ? mod.ssrImportedModules : mod.clientImportedModules;
+ let noLongerImported;
+ let resolvePromises = [];
+ let resolveResults = new Array(importedModules.size);
+ let index = 0;
+ // update import graph
+ for (const imported of importedModules) {
+ const nextIndex = index++;
+ if (typeof imported === 'string') {
+ resolvePromises.push(this.ensureEntryFromUrl(imported, ssr).then((dep) => {
+ dep.importers.add(mod);
+ resolveResults[nextIndex] = dep;
+ }));
+ }
+ else {
+ imported.importers.add(mod);
+ resolveResults[nextIndex] = imported;
+ }
+ }
+ if (resolvePromises.length) {
+ await Promise.all(resolvePromises);
+ }
+ const nextImports = new Set(resolveResults);
+ if (ssr) {
+ mod.ssrImportedModules = nextImports;
+ }
+ else {
+ mod.clientImportedModules = nextImports;
+ }
+ // remove the importer from deps that were imported but no longer are.
+ prevImports.forEach((dep) => {
+ if (!mod.clientImportedModules.has(dep) &&
+ !mod.ssrImportedModules.has(dep)) {
+ dep.importers.delete(mod);
+ if (!dep.importers.size) {
+ (noLongerImported || (noLongerImported = new Set())).add(dep);
+ }
+ }
+ });
+ // update accepted hmr deps
+ resolvePromises = [];
+ resolveResults = new Array(acceptedModules.size);
+ index = 0;
+ for (const accepted of acceptedModules) {
+ const nextIndex = index++;
+ if (typeof accepted === 'string') {
+ resolvePromises.push(this.ensureEntryFromUrl(accepted, ssr).then((dep) => {
+ resolveResults[nextIndex] = dep;
+ }));
+ }
+ else {
+ resolveResults[nextIndex] = accepted;
+ }
+ }
+ if (resolvePromises.length) {
+ await Promise.all(resolvePromises);
+ }
+ mod.acceptedHmrDeps = new Set(resolveResults);
+ // update accepted hmr exports
+ mod.acceptedHmrExports = acceptedExports;
+ mod.importedBindings = importedBindings;
+ return noLongerImported;
+ }
+ async ensureEntryFromUrl(rawUrl, ssr, setIsSelfAccepting = true) {
+ return this._ensureEntryFromUrl(rawUrl, ssr, setIsSelfAccepting);
+ }
+ /**
+ * @internal
+ */
+ async _ensureEntryFromUrl(rawUrl, ssr, setIsSelfAccepting = true,
+ // Optimization, avoid resolving the same url twice if the caller already did it
+ resolved) {
+ // Quick path, if we already have a module for this rawUrl (even without extension)
+ rawUrl = removeImportQuery(removeTimestampQuery(rawUrl));
+ let mod = this._getUnresolvedUrlToModule(rawUrl, ssr);
+ if (mod) {
+ return mod;
+ }
+ const modPromise = (async () => {
+ const [url, resolvedId, meta] = await this._resolveUrl(rawUrl, ssr, resolved);
+ mod = this.idToModuleMap.get(resolvedId);
+ if (!mod) {
+ mod = new ModuleNode(url, setIsSelfAccepting);
+ if (meta)
+ mod.meta = meta;
+ this.urlToModuleMap.set(url, mod);
+ mod.id = resolvedId;
+ this.idToModuleMap.set(resolvedId, mod);
+ const file = (mod.file = cleanUrl(resolvedId));
+ let fileMappedModules = this.fileToModulesMap.get(file);
+ if (!fileMappedModules) {
+ fileMappedModules = new Set();
+ this.fileToModulesMap.set(file, fileMappedModules);
+ }
+ fileMappedModules.add(mod);
+ }
+ // multiple urls can map to the same module and id, make sure we register
+ // the url to the existing module in that case
+ else if (!this.urlToModuleMap.has(url)) {
+ this.urlToModuleMap.set(url, mod);
+ }
+ this._setUnresolvedUrlToModule(rawUrl, mod, ssr);
+ return mod;
+ })();
+ // Also register the clean url to the module, so that we can short-circuit
+ // resolving the same url twice
+ this._setUnresolvedUrlToModule(rawUrl, modPromise, ssr);
+ return modPromise;
+ }
+ // some deps, like a css file referenced via @import, don't have its own
+ // url because they are inlined into the main css import. But they still
+ // need to be represented in the module graph so that they can trigger
+ // hmr in the importing css file.
+ createFileOnlyEntry(file) {
+ file = normalizePath$3(file);
+ let fileMappedModules = this.fileToModulesMap.get(file);
+ if (!fileMappedModules) {
+ fileMappedModules = new Set();
+ this.fileToModulesMap.set(file, fileMappedModules);
+ }
+ const url = `${FS_PREFIX}${file}`;
+ for (const m of fileMappedModules) {
+ if (m.url === url || m.id === file) {
+ return m;
+ }
+ }
+ const mod = new ModuleNode(url);
+ mod.file = file;
+ fileMappedModules.add(mod);
+ return mod;
+ }
+ // for incoming urls, it is important to:
+ // 1. remove the HMR timestamp query (?t=xxxx) and the ?import query
+ // 2. resolve its extension so that urls with or without extension all map to
+ // the same module
+ async resolveUrl(url, ssr) {
+ url = removeImportQuery(removeTimestampQuery(url));
+ const mod = await this._getUnresolvedUrlToModule(url, ssr);
+ if (mod?.id) {
+ return [mod.url, mod.id, mod.meta];
+ }
+ return this._resolveUrl(url, ssr);
+ }
+ /**
+ * @internal
+ */
+ _getUnresolvedUrlToModule(url, ssr) {
+ return (ssr ? this._ssrUnresolvedUrlToModuleMap : this._unresolvedUrlToModuleMap).get(url);
+ }
+ /**
+ * @internal
+ */
+ _setUnresolvedUrlToModule(url, mod, ssr) {
+ (ssr
+ ? this._ssrUnresolvedUrlToModuleMap
+ : this._unresolvedUrlToModuleMap).set(url, mod);
+ }
+ /**
+ * @internal
+ */
+ async _resolveUrl(url, ssr, alreadyResolved) {
+ const resolved = alreadyResolved ?? (await this.resolveId(url, !!ssr));
+ const resolvedId = resolved?.id || url;
+ if (url !== resolvedId &&
+ !url.includes('\0') &&
+ !url.startsWith(`virtual:`)) {
+ const ext = extname$1(cleanUrl(resolvedId));
+ if (ext) {
+ const pathname = cleanUrl(url);
+ if (!pathname.endsWith(ext)) {
+ url = pathname + ext + url.slice(pathname.length);
+ }
+ }
+ }
+ return [url, resolvedId, resolved?.meta];
+ }
+}
+
+function createServer(inlineConfig = {}) {
+ return _createServer(inlineConfig, { ws: true });
+}
+async function _createServer(inlineConfig = {}, options) {
+ const config = await resolveConfig(inlineConfig, 'serve');
+ const { root, server: serverConfig } = config;
+ const httpsOptions = await resolveHttpsConfig(config.server.https);
+ const { middlewareMode } = serverConfig;
+ const resolvedWatchOptions = resolveChokidarOptions(config, {
+ disableGlobbing: true,
+ ...serverConfig.watch,
+ });
+ const middlewares = connect$1();
+ const httpServer = middlewareMode
+ ? null
+ : await resolveHttpServer(serverConfig, middlewares, httpsOptions);
+ const ws = createWebSocketServer(httpServer, config, httpsOptions);
+ if (httpServer) {
+ setClientErrorHandler(httpServer, config.logger);
+ }
+ const watcher = chokidar.watch(
+ // config file dependencies and env file might be outside of root
+ [root, ...config.configFileDependencies, config.envDir], resolvedWatchOptions);
+ const moduleGraph = new ModuleGraph((url, ssr) => container.resolveId(url, undefined, { ssr }));
+ const container = await createPluginContainer(config, moduleGraph, watcher);
+ const closeHttpServer = createServerCloseFn(httpServer);
+ let exitProcess;
+ const server = {
+ config,
+ middlewares,
+ httpServer,
+ watcher,
+ pluginContainer: container,
+ ws,
+ moduleGraph,
+ resolvedUrls: null,
+ ssrTransform(code, inMap, url, originalCode = code) {
+ return ssrTransform(code, inMap, url, originalCode, server.config);
+ },
+ transformRequest(url, options) {
+ return transformRequest(url, server, options);
+ },
+ transformIndexHtml: null,
+ async ssrLoadModule(url, opts) {
+ if (isDepsOptimizerEnabled(config, true)) {
+ await initDevSsrDepsOptimizer(config, server);
+ }
+ if (config.legacy?.buildSsrCjsExternalHeuristics) {
+ await updateCjsSsrExternals(server);
+ }
+ return ssrLoadModule(url, server, undefined, undefined, opts?.fixStacktrace);
+ },
+ ssrFixStacktrace(e) {
+ ssrFixStacktrace(e, moduleGraph);
+ },
+ ssrRewriteStacktrace(stack) {
+ return ssrRewriteStacktrace(stack, moduleGraph);
+ },
+ async reloadModule(module) {
+ if (serverConfig.hmr !== false && module.file) {
+ updateModules(module.file, [module], Date.now(), server);
+ }
+ },
+ async listen(port, isRestart) {
+ await startServer(server, port);
+ if (httpServer) {
+ server.resolvedUrls = await resolveServerUrls(httpServer, config.server, config);
+ if (!isRestart && config.server.open)
+ server.openBrowser();
+ }
+ return server;
+ },
+ openBrowser() {
+ const options = server.config.server;
+ const url = server.resolvedUrls?.local[0] ?? server.resolvedUrls?.network[0];
+ if (url) {
+ const path = typeof options.open === 'string'
+ ? new URL(options.open, url).href
+ : url;
+ openBrowser(path, true, server.config.logger);
+ }
+ else {
+ server.config.logger.warn('No URL available to open in browser');
+ }
+ },
+ async close() {
+ if (!middlewareMode) {
+ process.off('SIGTERM', exitProcess);
+ if (process.env.CI !== 'true') {
+ process.stdin.off('end', exitProcess);
+ }
+ }
+ await Promise.allSettled([
+ watcher.close(),
+ ws.close(),
+ container.close(),
+ getDepsOptimizer(server.config)?.close(),
+ getDepsOptimizer(server.config, true)?.close(),
+ closeHttpServer(),
+ ]);
+ // Await pending requests. We throw early in transformRequest
+ // and in hooks if the server is closing for non-ssr requests,
+ // so the import analysis plugin stops pre-transforming static
+ // imports and this block is resolved sooner.
+ // During SSR, we let pending requests finish to avoid exposing
+ // the server closed error to the users.
+ while (server._pendingRequests.size > 0) {
+ await Promise.allSettled([...server._pendingRequests.values()].map((pending) => pending.request));
+ }
+ server.resolvedUrls = null;
+ },
+ printUrls() {
+ if (server.resolvedUrls) {
+ printServerUrls(server.resolvedUrls, serverConfig.host, config.logger.info);
+ }
+ else if (middlewareMode) {
+ throw new Error('cannot print server URLs in middleware mode.');
+ }
+ else {
+ throw new Error('cannot print server URLs before server.listen is called.');
+ }
+ },
+ async restart(forceOptimize) {
+ if (!server._restartPromise) {
+ server._forceOptimizeOnRestart = !!forceOptimize;
+ server._restartPromise = restartServer(server).finally(() => {
+ server._restartPromise = null;
+ server._forceOptimizeOnRestart = false;
+ });
+ }
+ return server._restartPromise;
+ },
+ _ssrExternals: null,
+ _restartPromise: null,
+ _importGlobMap: new Map(),
+ _forceOptimizeOnRestart: false,
+ _pendingRequests: new Map(),
+ _fsDenyGlob: picomatch$4(config.server.fs.deny, { matchBase: true }),
+ _shortcutsOptions: undefined,
+ };
+ server.transformIndexHtml = createDevHtmlTransformFn(server);
+ if (!middlewareMode) {
+ exitProcess = async () => {
+ try {
+ await server.close();
+ }
+ finally {
+ process.exit();
+ }
+ };
+ process.once('SIGTERM', exitProcess);
+ if (process.env.CI !== 'true') {
+ process.stdin.on('end', exitProcess);
+ }
+ }
+ const onHMRUpdate = async (file, configOnly) => {
+ if (serverConfig.hmr !== false) {
+ try {
+ await handleHMRUpdate(file, server, configOnly);
+ }
+ catch (err) {
+ ws.send({
+ type: 'error',
+ err: prepareError(err),
+ });
+ }
+ }
+ };
+ const onFileAddUnlink = async (file) => {
+ file = normalizePath$3(file);
+ await handleFileAddUnlink(file, server);
+ await onHMRUpdate(file, true);
+ };
+ watcher.on('change', async (file) => {
+ file = normalizePath$3(file);
+ // invalidate module graph cache on file change
+ moduleGraph.onFileChange(file);
+ await onHMRUpdate(file, false);
+ });
+ watcher.on('add', onFileAddUnlink);
+ watcher.on('unlink', onFileAddUnlink);
+ ws.on('vite:invalidate', async ({ path, message }) => {
+ const mod = moduleGraph.urlToModuleMap.get(path);
+ if (mod && mod.isSelfAccepting && mod.lastHMRTimestamp > 0) {
+ config.logger.info(colors$1.yellow(`hmr invalidate `) +
+ colors$1.dim(path) +
+ (message ? ` ${message}` : ''), { timestamp: true });
+ const file = getShortName(mod.file, config.root);
+ updateModules(file, [...mod.importers], mod.lastHMRTimestamp, server, true);
+ }
+ });
+ if (!middlewareMode && httpServer) {
+ httpServer.once('listening', () => {
+ // update actual port since this may be different from initial value
+ serverConfig.port = httpServer.address().port;
+ });
+ }
+ // apply server configuration hooks from plugins
+ const postHooks = [];
+ for (const hook of config.getSortedPluginHooks('configureServer')) {
+ postHooks.push(await hook(server));
+ }
+ // Internal middlewares ------------------------------------------------------
+ // request timer
+ if (process.env.DEBUG) {
+ middlewares.use(timeMiddleware(root));
+ }
+ // cors (enabled by default)
+ const { cors } = serverConfig;
+ if (cors !== false) {
+ middlewares.use(corsMiddleware(typeof cors === 'boolean' ? {} : cors));
+ }
+ // proxy
+ const { proxy } = serverConfig;
+ if (proxy) {
+ middlewares.use(proxyMiddleware(httpServer, proxy, config));
+ }
+ // base
+ if (config.base !== '/') {
+ middlewares.use(baseMiddleware(server));
+ }
+ // open in editor support
+ middlewares.use('/__open-in-editor', launchEditorMiddleware$1());
+ // ping request handler
+ // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
+ middlewares.use(function viteHMRPingMiddleware(req, res, next) {
+ if (req.headers['accept'] === 'text/x-vite-ping') {
+ res.writeHead(204).end();
+ }
+ else {
+ next();
+ }
+ });
+ // serve static files under /public
+ // this applies before the transform middleware so that these files are served
+ // as-is without transforms.
+ if (config.publicDir) {
+ middlewares.use(servePublicMiddleware(config.publicDir, config.server.headers));
+ }
+ // main transform middleware
+ middlewares.use(transformMiddleware(server));
+ // serve static files
+ middlewares.use(serveRawFsMiddleware(server));
+ middlewares.use(serveStaticMiddleware(root, server));
+ // html fallback
+ if (config.appType === 'spa' || config.appType === 'mpa') {
+ middlewares.use(htmlFallbackMiddleware(root, config.appType === 'spa'));
+ }
+ // run post config hooks
+ // This is applied before the html middleware so that user middleware can
+ // serve custom content instead of index.html.
+ postHooks.forEach((fn) => fn && fn());
+ if (config.appType === 'spa' || config.appType === 'mpa') {
+ // transform index.html
+ middlewares.use(indexHtmlMiddleware(server));
+ // handle 404s
+ // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
+ middlewares.use(function vite404Middleware(_, res) {
+ res.statusCode = 404;
+ res.end();
+ });
+ }
+ // error handler
+ middlewares.use(errorMiddleware(server, middlewareMode));
+ // httpServer.listen can be called multiple times
+ // when port when using next port number
+ // this code is to avoid calling buildStart multiple times
+ let initingServer;
+ let serverInited = false;
+ const initServer = async () => {
+ if (serverInited)
+ return;
+ if (initingServer)
+ return initingServer;
+ initingServer = (async function () {
+ await container.buildStart({});
+ // start deps optimizer after all container plugins are ready
+ if (isDepsOptimizerEnabled(config, false)) {
+ await initDepsOptimizer(config, server);
+ }
+ initingServer = undefined;
+ serverInited = true;
+ })();
+ return initingServer;
+ };
+ if (!middlewareMode && httpServer) {
+ // overwrite listen to init optimizer before server start
+ const listen = httpServer.listen.bind(httpServer);
+ httpServer.listen = (async (port, ...args) => {
+ try {
+ // ensure ws server started
+ ws.listen();
+ await initServer();
+ }
+ catch (e) {
+ httpServer.emit('error', e);
+ return;
+ }
+ return listen(port, ...args);
+ });
+ }
+ else {
+ if (options.ws) {
+ ws.listen();
+ }
+ await initServer();
+ }
+ return server;
+}
+async function startServer(server, inlinePort) {
+ const httpServer = server.httpServer;
+ if (!httpServer) {
+ throw new Error('Cannot call server.listen in middleware mode.');
+ }
+ const options = server.config.server;
+ const port = inlinePort ?? options.port ?? DEFAULT_DEV_PORT;
+ const hostname = await resolveHostname(options.host);
+ await httpServerStart(httpServer, {
+ port,
+ strictPort: options.strictPort,
+ host: hostname.host,
+ logger: server.config.logger,
+ });
+}
+function createServerCloseFn(server) {
+ if (!server) {
+ return () => { };
+ }
+ let hasListened = false;
+ const openSockets = new Set();
+ server.on('connection', (socket) => {
+ openSockets.add(socket);
+ socket.on('close', () => {
+ openSockets.delete(socket);
+ });
+ });
+ server.once('listening', () => {
+ hasListened = true;
+ });
+ return () => new Promise((resolve, reject) => {
+ openSockets.forEach((s) => s.destroy());
+ if (hasListened) {
+ server.close((err) => {
+ if (err) {
+ reject(err);
+ }
+ else {
+ resolve();
+ }
+ });
+ }
+ else {
+ resolve();
+ }
+ });
+}
+function resolvedAllowDir(root, dir) {
+ return normalizePath$3(path$o.resolve(root, dir));
+}
+function resolveServerOptions(root, raw, logger) {
+ const server = {
+ preTransformRequests: true,
+ ...raw,
+ sourcemapIgnoreList: raw?.sourcemapIgnoreList === false
+ ? () => false
+ : raw?.sourcemapIgnoreList || isInNodeModules,
+ middlewareMode: !!raw?.middlewareMode,
+ };
+ let allowDirs = server.fs?.allow;
+ const deny = server.fs?.deny || ['.env', '.env.*', '*.{crt,pem}'];
+ if (!allowDirs) {
+ allowDirs = [searchForWorkspaceRoot(root)];
+ }
+ allowDirs = allowDirs.map((i) => resolvedAllowDir(root, i));
+ // only push client dir when vite itself is outside-of-root
+ const resolvedClientDir = resolvedAllowDir(root, CLIENT_DIR);
+ if (!allowDirs.some((dir) => isParentDirectory(dir, resolvedClientDir))) {
+ allowDirs.push(resolvedClientDir);
+ }
+ server.fs = {
+ strict: server.fs?.strict ?? true,
+ allow: allowDirs,
+ deny,
+ };
+ if (server.origin?.endsWith('/')) {
+ server.origin = server.origin.slice(0, -1);
+ logger.warn(colors$1.yellow(`${colors$1.bold('(!)')} server.origin should not end with "/". Using "${server.origin}" instead.`));
+ }
+ return server;
+}
+async function restartServer(server) {
+ global.__vite_start_time = performance.now();
+ const { port: prevPort, host: prevHost } = server.config.server;
+ const shortcutsOptions = server._shortcutsOptions;
+ const oldUrls = server.resolvedUrls;
+ let inlineConfig = server.config.inlineConfig;
+ if (server._forceOptimizeOnRestart) {
+ inlineConfig = mergeConfig(inlineConfig, {
+ optimizeDeps: {
+ force: true,
+ },
+ });
+ }
+ let newServer = null;
+ try {
+ // delay ws server listen
+ newServer = await _createServer(inlineConfig, { ws: false });
+ }
+ catch (err) {
+ server.config.logger.error(err.message, {
+ timestamp: true,
+ });
+ server.config.logger.error('server restart failed', { timestamp: true });
+ return;
+ }
+ await server.close();
+ // Assign new server props to existing server instance
+ Object.assign(server, newServer);
+ const { logger, server: { port, host, middlewareMode }, } = server.config;
+ if (!middlewareMode) {
+ await server.listen(port, true);
+ logger.info('server restarted.', { timestamp: true });
+ if ((port ?? DEFAULT_DEV_PORT) !== (prevPort ?? DEFAULT_DEV_PORT) ||
+ host !== prevHost ||
+ diffDnsOrderChange(oldUrls, newServer.resolvedUrls)) {
+ logger.info('');
+ server.printUrls();
+ }
+ }
+ else {
+ server.ws.listen();
+ logger.info('server restarted.', { timestamp: true });
+ }
+ if (shortcutsOptions) {
+ shortcutsOptions.print = false;
+ bindShortcuts(newServer, shortcutsOptions);
+ }
+}
+async function updateCjsSsrExternals(server) {
+ if (!server._ssrExternals) {
+ let knownImports = [];
+ // Important! We use the non-ssr optimized deps to find known imports
+ // Only the explicitly defined deps are optimized during dev SSR, so
+ // we use the generated list from the scanned deps in regular dev.
+ // This is part of the v2 externalization heuristics and it is kept
+ // for backwards compatibility in case user needs to fallback to the
+ // legacy scheme. It may be removed in a future v3 minor.
+ const depsOptimizer = getDepsOptimizer(server.config, false); // non-ssr
+ if (depsOptimizer) {
+ await depsOptimizer.scanProcessing;
+ knownImports = [
+ ...Object.keys(depsOptimizer.metadata.optimized),
+ ...Object.keys(depsOptimizer.metadata.discovered),
+ ];
+ }
+ server._ssrExternals = cjsSsrResolveExternals(server.config, knownImports);
+ }
+}
+
+var index = {
+ __proto__: null,
+ _createServer: _createServer,
+ createServer: createServer,
+ resolveServerOptions: resolveServerOptions
+};
+
+/* eslint-disable */
+//@ts-nocheck
+//TODO: replace this code with https://github.com/lukeed/polka/pull/148 once it's released
+// This is based on https://github.com/preactjs/wmr/blob/main/packages/wmr/src/lib/polkompress.js
+// MIT Licensed https://github.com/preactjs/wmr/blob/main/LICENSE
+/* global Buffer */
+const noop = () => { };
+const mimes = /text|javascript|\/json|xml/i;
+const threshold = 1024;
+const level = -1;
+let brotli = false;
+const getChunkSize = (chunk, enc) => (chunk ? Buffer.byteLength(chunk, enc) : 0);
+function compression() {
+ const brotliOpts = (typeof brotli === 'object' && brotli) || {};
+ const gzipOpts = {};
+ // disable Brotli on Node<12.7 where it is unsupported:
+ if (!zlib$1.createBrotliCompress)
+ brotli = false;
+ return function viteCompressionMiddleware(req, res, next = noop) {
+ const accept = req.headers['accept-encoding'] + '';
+ const encoding = ((brotli && accept.match(/\bbr\b/)) ||
+ (accept.match(/\bgzip\b/)) ||
+ [])[0];
+ // skip if no response body or no supported encoding:
+ if (req.method === 'HEAD' || !encoding)
+ return next();
+ /** @type {zlib.Gzip | zlib.BrotliCompress} */
+ let compress;
+ let pendingStatus;
+ /** @type {[string, function][]?} */
+ let pendingListeners = [];
+ let started = false;
+ let size = 0;
+ function start() {
+ started = true;
+ size = res.getHeader('Content-Length') | 0 || size;
+ const compressible = mimes.test(String(res.getHeader('Content-Type') || 'text/plain'));
+ const cleartext = !res.getHeader('Content-Encoding');
+ const listeners = pendingListeners || [];
+ if (compressible && cleartext && size >= threshold) {
+ res.setHeader('Content-Encoding', encoding);
+ res.removeHeader('Content-Length');
+ if (encoding === 'br') {
+ const params = {
+ [zlib$1.constants.BROTLI_PARAM_QUALITY]: level,
+ [zlib$1.constants.BROTLI_PARAM_SIZE_HINT]: size,
+ };
+ compress = zlib$1.createBrotliCompress({
+ params: Object.assign(params, brotliOpts),
+ });
+ }
+ else {
+ compress = zlib$1.createGzip(Object.assign({ level }, gzipOpts));
+ }
+ // backpressure
+ compress.on('data', (chunk) => write.call(res, chunk) === false && compress.pause());
+ on.call(res, 'drain', () => compress.resume());
+ compress.on('end', () => end.call(res));
+ listeners.forEach((p) => compress.on.apply(compress, p));
+ }
+ else {
+ pendingListeners = null;
+ listeners.forEach((p) => on.apply(res, p));
+ }
+ writeHead.call(res, pendingStatus || res.statusCode);
+ }
+ const { end, write, on, writeHead } = res;
+ res.writeHead = function (status, reason, headers) {
+ if (typeof reason !== 'string')
+ [headers, reason] = [reason, headers];
+ if (headers)
+ for (let i in headers)
+ res.setHeader(i, headers[i]);
+ pendingStatus = status;
+ return this;
+ };
+ res.write = function (chunk, enc, cb) {
+ size += getChunkSize(chunk, enc);
+ if (!started)
+ start();
+ if (!compress)
+ return write.apply(this, arguments);
+ return compress.write.apply(compress, arguments);
+ };
+ res.end = function (chunk, enc, cb) {
+ if (arguments.length > 0 && typeof chunk !== 'function') {
+ size += getChunkSize(chunk, enc);
+ }
+ if (!started)
+ start();
+ if (!compress)
+ return end.apply(this, arguments);
+ return compress.end.apply(compress, arguments);
+ };
+ res.on = function (type, listener) {
+ if (!pendingListeners || type !== 'drain')
+ on.call(this, type, listener);
+ else if (compress)
+ compress.on(type, listener);
+ else
+ pendingListeners.push([type, listener]);
+ return this;
+ };
+ next();
+ };
+}
+
+function resolvePreviewOptions(preview, server) {
+ // The preview server inherits every CommonServerOption from the `server` config
+ // except for the port to enable having both the dev and preview servers running
+ // at the same time without extra configuration
+ return {
+ port: preview?.port,
+ strictPort: preview?.strictPort ?? server.strictPort,
+ host: preview?.host ?? server.host,
+ https: preview?.https ?? server.https,
+ open: preview?.open ?? server.open,
+ proxy: preview?.proxy ?? server.proxy,
+ cors: preview?.cors ?? server.cors,
+ headers: preview?.headers ?? server.headers,
+ };
+}
+/**
+ * Starts the Vite server in preview mode, to simulate a production deployment
+ */
+async function preview(inlineConfig = {}) {
+ const config = await resolveConfig(inlineConfig, 'serve', 'production', 'production');
+ const distDir = path$o.resolve(config.root, config.build.outDir);
+ if (!fs$l.existsSync(distDir) &&
+ // error if no plugins implement `configurePreviewServer`
+ config.plugins.every((plugin) => !plugin.configurePreviewServer) &&
+ // error if called in CLI only. programmatic usage could access `httpServer`
+ // and affect file serving
+ process.argv[1]?.endsWith(path$o.normalize('bin/vite.js')) &&
+ process.argv[2] === 'preview') {
+ throw new Error(`The directory "${config.build.outDir}" does not exist. Did you build your project?`);
+ }
+ const app = connect$1();
+ const httpServer = await resolveHttpServer(config.preview, app, await resolveHttpsConfig(config.preview?.https));
+ setClientErrorHandler(httpServer, config.logger);
+ const options = config.preview;
+ const logger = config.logger;
+ const server = {
+ config,
+ middlewares: app,
+ httpServer,
+ resolvedUrls: null,
+ printUrls() {
+ if (server.resolvedUrls) {
+ printServerUrls(server.resolvedUrls, options.host, logger.info);
+ }
+ else {
+ throw new Error('cannot print server URLs before server is listening.');
+ }
+ },
+ };
+ // apply server hooks from plugins
+ const postHooks = [];
+ for (const hook of config.getSortedPluginHooks('configurePreviewServer')) {
+ postHooks.push(await hook(server));
+ }
+ // cors
+ const { cors } = config.preview;
+ if (cors !== false) {
+ app.use(corsMiddleware(typeof cors === 'boolean' ? {} : cors));
+ }
+ // proxy
+ const { proxy } = config.preview;
+ if (proxy) {
+ app.use(proxyMiddleware(httpServer, proxy, config));
+ }
+ app.use(compression());
+ const previewBase = config.base === './' || config.base === '' ? '/' : config.base;
+ // static assets
+ const headers = config.preview.headers;
+ const viteAssetMiddleware = (...args) => sirv(distDir, {
+ etag: true,
+ dev: true,
+ single: config.appType === 'spa',
+ setHeaders(res) {
+ if (headers) {
+ for (const name in headers) {
+ res.setHeader(name, headers[name]);
+ }
+ }
+ },
+ shouldServe(filePath) {
+ return shouldServeFile(filePath, distDir);
+ },
+ })(...args);
+ app.use(previewBase, viteAssetMiddleware);
+ // apply post server hooks from plugins
+ postHooks.forEach((fn) => fn && fn());
+ const hostname = await resolveHostname(options.host);
+ const port = options.port ?? DEFAULT_PREVIEW_PORT;
+ const protocol = options.https ? 'https' : 'http';
+ const serverPort = await httpServerStart(httpServer, {
+ port,
+ strictPort: options.strictPort,
+ host: hostname.host,
+ logger,
+ });
+ server.resolvedUrls = await resolveServerUrls(httpServer, config.preview, config);
+ if (options.open) {
+ const path = typeof options.open === 'string' ? options.open : previewBase;
+ openBrowser(path.startsWith('http')
+ ? path
+ : new URL(path, `${protocol}://${hostname.name}:${serverPort}`).href, true, logger);
+ }
+ return server;
+}
+
+var preview$1 = {
+ __proto__: null,
+ preview: preview,
+ resolvePreviewOptions: resolvePreviewOptions
+};
+
+function resolveSSROptions(ssr, preserveSymlinks, buildSsrCjsExternalHeuristics) {
+ ssr ?? (ssr = {});
+ const optimizeDeps = ssr.optimizeDeps ?? {};
+ const format = buildSsrCjsExternalHeuristics ? 'cjs' : 'esm';
+ const target = 'node';
+ return {
+ format,
+ target,
+ ...ssr,
+ optimizeDeps: {
+ disabled: true,
+ ...optimizeDeps,
+ esbuildOptions: {
+ preserveSymlinks,
+ ...optimizeDeps.esbuildOptions,
+ },
+ },
+ };
+}
+
+const debug = createDebugger('vite:config');
+const promisifiedRealpath = promisify$4(fs$l.realpath);
+function defineConfig(config) {
+ return config;
+}
+async function resolveConfig(inlineConfig, command, defaultMode = 'development', defaultNodeEnv = 'development') {
+ let config = inlineConfig;
+ let configFileDependencies = [];
+ let mode = inlineConfig.mode || defaultMode;
+ const isNodeEnvSet = !!process.env.NODE_ENV;
+ const packageCache = new Map();
+ // some dependencies e.g. @vue/compiler-* relies on NODE_ENV for getting
+ // production-specific behavior, so set it early on
+ if (!isNodeEnvSet) {
+ process.env.NODE_ENV = defaultNodeEnv;
+ }
+ const configEnv = {
+ mode,
+ command,
+ ssrBuild: !!config.build?.ssr,
+ };
+ let { configFile } = config;
+ if (configFile !== false) {
+ const loadResult = await loadConfigFromFile(configEnv, configFile, config.root, config.logLevel);
+ if (loadResult) {
+ config = mergeConfig(loadResult.config, config);
+ configFile = loadResult.path;
+ configFileDependencies = loadResult.dependencies;
+ }
+ }
+ // user config may provide an alternative mode. But --mode has a higher priority
+ mode = inlineConfig.mode || config.mode || mode;
+ configEnv.mode = mode;
+ const filterPlugin = (p) => {
+ if (!p) {
+ return false;
+ }
+ else if (!p.apply) {
+ return true;
+ }
+ else if (typeof p.apply === 'function') {
+ return p.apply({ ...config, mode }, configEnv);
+ }
+ else {
+ return p.apply === command;
+ }
+ };
+ // Some plugins that aren't intended to work in the bundling of workers (doing post-processing at build time for example).
+ // And Plugins may also have cached that could be corrupted by being used in these extra rollup calls.
+ // So we need to separate the worker plugin from the plugin that vite needs to run.
+ const rawWorkerUserPlugins = (await asyncFlatten(config.worker?.plugins || [])).filter(filterPlugin);
+ // resolve plugins
+ const rawUserPlugins = (await asyncFlatten(config.plugins || [])).filter(filterPlugin);
+ const [prePlugins, normalPlugins, postPlugins] = sortUserPlugins(rawUserPlugins);
+ // run config hooks
+ const userPlugins = [...prePlugins, ...normalPlugins, ...postPlugins];
+ config = await runConfigHook(config, userPlugins, configEnv);
+ // If there are custom commonjsOptions, don't force optimized deps for this test
+ // even if the env var is set as it would interfere with the playground specs.
+ if (!config.build?.commonjsOptions &&
+ process.env.VITE_TEST_WITHOUT_PLUGIN_COMMONJS) {
+ config = mergeConfig(config, {
+ optimizeDeps: { disabled: false },
+ ssr: { optimizeDeps: { disabled: false } },
+ });
+ config.build ?? (config.build = {});
+ config.build.commonjsOptions = { include: [] };
+ }
+ // Define logger
+ const logger = createLogger(config.logLevel, {
+ allowClearScreen: config.clearScreen,
+ customLogger: config.customLogger,
+ });
+ // resolve root
+ const resolvedRoot = normalizePath$3(config.root ? path$o.resolve(config.root) : process.cwd());
+ const clientAlias = [
+ {
+ find: /^\/?@vite\/env/,
+ replacement: path$o.posix.join(FS_PREFIX, normalizePath$3(ENV_ENTRY)),
+ },
+ {
+ find: /^\/?@vite\/client/,
+ replacement: path$o.posix.join(FS_PREFIX, normalizePath$3(CLIENT_ENTRY)),
+ },
+ ];
+ // resolve alias with internal client alias
+ const resolvedAlias = normalizeAlias(mergeAlias(clientAlias, config.resolve?.alias || []));
+ const resolveOptions = {
+ mainFields: config.resolve?.mainFields ?? DEFAULT_MAIN_FIELDS,
+ browserField: config.resolve?.browserField ?? true,
+ conditions: config.resolve?.conditions ?? [],
+ extensions: config.resolve?.extensions ?? DEFAULT_EXTENSIONS$1,
+ dedupe: config.resolve?.dedupe ?? [],
+ preserveSymlinks: config.resolve?.preserveSymlinks ?? false,
+ alias: resolvedAlias,
+ };
+ // load .env files
+ const envDir = config.envDir
+ ? normalizePath$3(path$o.resolve(resolvedRoot, config.envDir))
+ : resolvedRoot;
+ const userEnv = inlineConfig.envFile !== false &&
+ loadEnv(mode, envDir, resolveEnvPrefix(config));
+ // Note it is possible for user to have a custom mode, e.g. `staging` where
+ // development-like behavior is expected. This is indicated by NODE_ENV=development
+ // loaded from `.staging.env` and set by us as VITE_USER_NODE_ENV
+ const userNodeEnv = process.env.VITE_USER_NODE_ENV;
+ if (!isNodeEnvSet && userNodeEnv) {
+ if (userNodeEnv === 'development') {
+ process.env.NODE_ENV = 'development';
+ }
+ else {
+ // NODE_ENV=production is not supported as it could break HMR in dev for frameworks like Vue
+ logger.warn(`NODE_ENV=${userNodeEnv} is not supported in the .env file. ` +
+ `Only NODE_ENV=development is supported to create a development build of your project. ` +
+ `If you need to set process.env.NODE_ENV, you can set it in the Vite config instead.`);
+ }
+ }
+ const isProduction = process.env.NODE_ENV === 'production';
+ // resolve public base url
+ const isBuild = command === 'build';
+ const relativeBaseShortcut = config.base === '' || config.base === './';
+ // During dev, we ignore relative base and fallback to '/'
+ // For the SSR build, relative base isn't possible by means
+ // of import.meta.url.
+ const resolvedBase = relativeBaseShortcut
+ ? !isBuild || config.build?.ssr
+ ? '/'
+ : './'
+ : resolveBaseUrl(config.base, isBuild, logger) ?? '/';
+ const resolvedBuildOptions = resolveBuildOptions(config.build, logger, resolvedRoot);
+ // resolve cache directory
+ const pkgDir = findNearestPackageData(resolvedRoot, packageCache)?.dir;
+ const cacheDir = normalizePath$3(config.cacheDir
+ ? path$o.resolve(resolvedRoot, config.cacheDir)
+ : pkgDir
+ ? path$o.join(pkgDir, `node_modules/.vite`)
+ : path$o.join(resolvedRoot, `.vite`));
+ const assetsFilter = config.assetsInclude &&
+ (!Array.isArray(config.assetsInclude) || config.assetsInclude.length)
+ ? createFilter(config.assetsInclude)
+ : () => false;
+ // create an internal resolver to be used in special scenarios, e.g.
+ // optimizer & handling css @imports
+ const createResolver = (options) => {
+ let aliasContainer;
+ let resolverContainer;
+ return async (id, importer, aliasOnly, ssr) => {
+ let container;
+ if (aliasOnly) {
+ container =
+ aliasContainer ||
+ (aliasContainer = await createPluginContainer({
+ ...resolved,
+ plugins: [alias$1({ entries: resolved.resolve.alias })],
+ }));
+ }
+ else {
+ container =
+ resolverContainer ||
+ (resolverContainer = await createPluginContainer({
+ ...resolved,
+ plugins: [
+ alias$1({ entries: resolved.resolve.alias }),
+ resolvePlugin({
+ ...resolved.resolve,
+ root: resolvedRoot,
+ isProduction,
+ isBuild: command === 'build',
+ ssrConfig: resolved.ssr,
+ asSrc: true,
+ preferRelative: false,
+ tryIndex: true,
+ ...options,
+ idOnly: true,
+ }),
+ ],
+ }));
+ }
+ return (await container.resolveId(id, importer, {
+ ssr,
+ scan: options?.scan,
+ }))?.id;
+ };
+ };
+ const { publicDir } = config;
+ const resolvedPublicDir = publicDir !== false && publicDir !== ''
+ ? path$o.resolve(resolvedRoot, typeof publicDir === 'string' ? publicDir : 'public')
+ : '';
+ const server = resolveServerOptions(resolvedRoot, config.server, logger);
+ const ssr = resolveSSROptions(config.ssr, resolveOptions.preserveSymlinks, config.legacy?.buildSsrCjsExternalHeuristics);
+ const middlewareMode = config?.server?.middlewareMode;
+ const optimizeDeps = config.optimizeDeps || {};
+ const BASE_URL = resolvedBase;
+ // resolve worker
+ let workerConfig = mergeConfig({}, config);
+ const [workerPrePlugins, workerNormalPlugins, workerPostPlugins] = sortUserPlugins(rawWorkerUserPlugins);
+ // run config hooks
+ const workerUserPlugins = [
+ ...workerPrePlugins,
+ ...workerNormalPlugins,
+ ...workerPostPlugins,
+ ];
+ workerConfig = await runConfigHook(workerConfig, workerUserPlugins, configEnv);
+ const resolvedWorkerOptions = {
+ format: workerConfig.worker?.format || 'iife',
+ plugins: [],
+ rollupOptions: workerConfig.worker?.rollupOptions || {},
+ getSortedPlugins: undefined,
+ getSortedPluginHooks: undefined,
+ };
+ const resolvedConfig = {
+ configFile: configFile ? normalizePath$3(configFile) : undefined,
+ configFileDependencies: configFileDependencies.map((name) => normalizePath$3(path$o.resolve(name))),
+ inlineConfig,
+ root: resolvedRoot,
+ base: resolvedBase.endsWith('/') ? resolvedBase : resolvedBase + '/',
+ rawBase: resolvedBase,
+ resolve: resolveOptions,
+ publicDir: resolvedPublicDir,
+ cacheDir,
+ command,
+ mode,
+ ssr,
+ isWorker: false,
+ mainConfig: null,
+ isProduction,
+ plugins: userPlugins,
+ css: resolveCSSOptions(config.css),
+ esbuild: config.esbuild === false
+ ? false
+ : {
+ jsxDev: !isProduction,
+ ...config.esbuild,
+ },
+ server,
+ build: resolvedBuildOptions,
+ preview: resolvePreviewOptions(config.preview, server),
+ envDir,
+ env: {
+ ...userEnv,
+ BASE_URL,
+ MODE: mode,
+ DEV: !isProduction,
+ PROD: isProduction,
+ },
+ assetsInclude(file) {
+ return DEFAULT_ASSETS_RE.test(file) || assetsFilter(file);
+ },
+ logger,
+ packageCache,
+ createResolver,
+ optimizeDeps: {
+ disabled: 'build',
+ ...optimizeDeps,
+ esbuildOptions: {
+ preserveSymlinks: resolveOptions.preserveSymlinks,
+ ...optimizeDeps.esbuildOptions,
+ },
+ },
+ worker: resolvedWorkerOptions,
+ appType: config.appType ?? (middlewareMode === 'ssr' ? 'custom' : 'spa'),
+ experimental: {
+ importGlobRestoreExtension: false,
+ hmrPartialAccept: false,
+ ...config.experimental,
+ },
+ getSortedPlugins: undefined,
+ getSortedPluginHooks: undefined,
+ };
+ const resolved = {
+ ...config,
+ ...resolvedConfig,
+ };
+ resolved.plugins = await resolvePlugins(resolved, prePlugins, normalPlugins, postPlugins);
+ Object.assign(resolved, createPluginHookUtils(resolved.plugins));
+ const workerResolved = {
+ ...workerConfig,
+ ...resolvedConfig,
+ isWorker: true,
+ mainConfig: resolved,
+ };
+ resolvedConfig.worker.plugins = await resolvePlugins(workerResolved, workerPrePlugins, workerNormalPlugins, workerPostPlugins);
+ Object.assign(resolvedConfig.worker, createPluginHookUtils(resolvedConfig.worker.plugins));
+ // call configResolved hooks
+ await Promise.all([
+ ...resolved
+ .getSortedPluginHooks('configResolved')
+ .map((hook) => hook(resolved)),
+ ...resolvedConfig.worker
+ .getSortedPluginHooks('configResolved')
+ .map((hook) => hook(workerResolved)),
+ ]);
+ // validate config
+ if (middlewareMode === 'ssr') {
+ logger.warn(colors$1.yellow(`Setting server.middlewareMode to 'ssr' is deprecated, set server.middlewareMode to \`true\`${config.appType === 'custom' ? '' : ` and appType to 'custom'`} instead`));
+ }
+ if (middlewareMode === 'html') {
+ logger.warn(colors$1.yellow(`Setting server.middlewareMode to 'html' is deprecated, set server.middlewareMode to \`true\` instead`));
+ }
+ if (config.server?.force &&
+ !isBuild &&
+ config.optimizeDeps?.force === undefined) {
+ resolved.optimizeDeps.force = true;
+ logger.warn(colors$1.yellow(`server.force is deprecated, use optimizeDeps.force instead`));
+ }
+ debug?.(`using resolved config: %O`, {
+ ...resolved,
+ plugins: resolved.plugins.map((p) => p.name),
+ worker: {
+ ...resolved.worker,
+ plugins: resolved.worker.plugins.map((p) => p.name),
+ },
+ });
+ if (config.build?.terserOptions && config.build.minify !== 'terser') {
+ logger.warn(colors$1.yellow(`build.terserOptions is specified but build.minify is not set to use Terser. ` +
+ `Note Vite now defaults to use esbuild for minification. If you still ` +
+ `prefer Terser, set build.minify to "terser".`));
+ }
+ // Check if all assetFileNames have the same reference.
+ // If not, display a warn for user.
+ const outputOption = config.build?.rollupOptions?.output ?? [];
+ // Use isArray to narrow its type to array
+ if (Array.isArray(outputOption)) {
+ const assetFileNamesList = outputOption.map((output) => output.assetFileNames);
+ if (assetFileNamesList.length > 1) {
+ const firstAssetFileNames = assetFileNamesList[0];
+ const hasDifferentReference = assetFileNamesList.some((assetFileNames) => assetFileNames !== firstAssetFileNames);
+ if (hasDifferentReference) {
+ resolved.logger.warn(colors$1.yellow(`
+assetFileNames isn't equal for every build.rollupOptions.output. A single pattern across all outputs is supported by Vite.
+`));
+ }
+ }
+ }
+ // Warn about removal of experimental features
+ if (config.legacy?.buildSsrCjsExternalHeuristics ||
+ config.ssr?.format === 'cjs') {
+ resolved.logger.warn(colors$1.yellow(`
+(!) Experimental legacy.buildSsrCjsExternalHeuristics and ssr.format: 'cjs' are going to be removed in Vite 5.
+ Find more information and give feedback at https://github.com/vitejs/vite/discussions/13816.
+`));
+ }
+ return resolved;
+}
+/**
+ * Resolve base url. Note that some users use Vite to build for non-web targets like
+ * electron or expects to deploy
+ */
+function resolveBaseUrl(base = '/', isBuild, logger) {
+ if (base[0] === '.') {
+ logger.warn(colors$1.yellow(colors$1.bold(`(!) invalid "base" option: ${base}. The value can only be an absolute ` +
+ `URL, ./, or an empty string.`)));
+ return '/';
+ }
+ // external URL flag
+ const isExternal = isExternalUrl(base);
+ // no leading slash warn
+ if (!isExternal && base[0] !== '/') {
+ logger.warn(colors$1.yellow(colors$1.bold(`(!) "base" option should start with a slash.`)));
+ }
+ // parse base when command is serve or base is not External URL
+ if (!isBuild || !isExternal) {
+ base = new URL(base, 'http://vitejs.dev').pathname;
+ // ensure leading slash
+ if (base[0] !== '/') {
+ base = '/' + base;
+ }
+ }
+ return base;
+}
+function sortUserPlugins(plugins) {
+ const prePlugins = [];
+ const postPlugins = [];
+ const normalPlugins = [];
+ if (plugins) {
+ plugins.flat().forEach((p) => {
+ if (p.enforce === 'pre')
+ prePlugins.push(p);
+ else if (p.enforce === 'post')
+ postPlugins.push(p);
+ else
+ normalPlugins.push(p);
+ });
+ }
+ return [prePlugins, normalPlugins, postPlugins];
+}
+async function loadConfigFromFile(configEnv, configFile, configRoot = process.cwd(), logLevel) {
+ const start = performance.now();
+ const getTime = () => `${(performance.now() - start).toFixed(2)}ms`;
+ let resolvedPath;
+ if (configFile) {
+ // explicit config path is always resolved from cwd
+ resolvedPath = path$o.resolve(configFile);
+ }
+ else {
+ // implicit config file loaded from inline root (if present)
+ // otherwise from cwd
+ for (const filename of DEFAULT_CONFIG_FILES) {
+ const filePath = path$o.resolve(configRoot, filename);
+ if (!fs$l.existsSync(filePath))
+ continue;
+ resolvedPath = filePath;
+ break;
+ }
+ }
+ if (!resolvedPath) {
+ debug?.('no config file found.');
+ return null;
+ }
+ let isESM = false;
+ if (/\.m[jt]s$/.test(resolvedPath)) {
+ isESM = true;
+ }
+ else if (/\.c[jt]s$/.test(resolvedPath)) {
+ isESM = false;
+ }
+ else {
+ // check package.json for type: "module" and set `isESM` to true
+ try {
+ const pkg = lookupFile(configRoot, ['package.json']);
+ isESM =
+ !!pkg && JSON.parse(fs$l.readFileSync(pkg, 'utf-8')).type === 'module';
+ }
+ catch (e) { }
+ }
+ try {
+ const bundled = await bundleConfigFile(resolvedPath, isESM);
+ const userConfig = await loadConfigFromBundledFile(resolvedPath, bundled.code, isESM);
+ debug?.(`bundled config file loaded in ${getTime()}`);
+ const config = await (typeof userConfig === 'function'
+ ? userConfig(configEnv)
+ : userConfig);
+ if (!isObject$2(config)) {
+ throw new Error(`config must export or return an object.`);
+ }
+ return {
+ path: normalizePath$3(resolvedPath),
+ config,
+ dependencies: bundled.dependencies,
+ };
+ }
+ catch (e) {
+ createLogger(logLevel).error(colors$1.red(`failed to load config from ${resolvedPath}`), { error: e });
+ throw e;
+ }
+}
+async function bundleConfigFile(fileName, isESM) {
+ const dirnameVarName = '__vite_injected_original_dirname';
+ const filenameVarName = '__vite_injected_original_filename';
+ const importMetaUrlVarName = '__vite_injected_original_import_meta_url';
+ const result = await build$3({
+ absWorkingDir: process.cwd(),
+ entryPoints: [fileName],
+ outfile: 'out.js',
+ write: false,
+ target: ['node14.18', 'node16'],
+ platform: 'node',
+ bundle: true,
+ format: isESM ? 'esm' : 'cjs',
+ mainFields: ['main'],
+ sourcemap: 'inline',
+ metafile: true,
+ define: {
+ __dirname: dirnameVarName,
+ __filename: filenameVarName,
+ 'import.meta.url': importMetaUrlVarName,
+ },
+ plugins: [
+ {
+ name: 'externalize-deps',
+ setup(build) {
+ const packageCache = new Map();
+ const resolveByViteResolver = (id, importer, isRequire) => {
+ return tryNodeResolve(id, importer, {
+ root: path$o.dirname(fileName),
+ isBuild: true,
+ isProduction: true,
+ preferRelative: false,
+ tryIndex: true,
+ mainFields: [],
+ browserField: false,
+ conditions: [],
+ overrideConditions: ['node'],
+ dedupe: [],
+ extensions: DEFAULT_EXTENSIONS$1,
+ preserveSymlinks: false,
+ packageCache,
+ isRequire,
+ }, false)?.id;
+ };
+ const isESMFile = (id) => {
+ if (id.endsWith('.mjs'))
+ return true;
+ if (id.endsWith('.cjs'))
+ return false;
+ const nearestPackageJson = findNearestPackageData(path$o.dirname(id), packageCache);
+ return (!!nearestPackageJson && nearestPackageJson.data.type === 'module');
+ };
+ // externalize bare imports
+ build.onResolve({ filter: /^[^.].*/ }, async ({ path: id, importer, kind }) => {
+ if (kind === 'entry-point' ||
+ path$o.isAbsolute(id) ||
+ isBuiltin(id)) {
+ return;
+ }
+ // partial deno support as `npm:` does not work with esbuild
+ if (id.startsWith('npm:')) {
+ return { external: true };
+ }
+ const isImport = isESM || kind === 'dynamic-import';
+ let idFsPath;
+ try {
+ idFsPath = resolveByViteResolver(id, importer, !isImport);
+ }
+ catch (e) {
+ if (!isImport) {
+ let canResolveWithImport = false;
+ try {
+ canResolveWithImport = !!resolveByViteResolver(id, importer, false);
+ }
+ catch { }
+ if (canResolveWithImport) {
+ throw new Error(`Failed to resolve ${JSON.stringify(id)}. This package is ESM only but it was tried to load by \`require\`. See http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.`);
+ }
+ }
+ throw e;
+ }
+ if (idFsPath && isImport) {
+ idFsPath = pathToFileURL(idFsPath).href;
+ }
+ if (idFsPath && !isImport && isESMFile(idFsPath)) {
+ throw new Error(`${JSON.stringify(id)} resolved to an ESM file. ESM file cannot be loaded by \`require\`. See http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.`);
+ }
+ return {
+ path: idFsPath,
+ external: true,
+ };
+ });
+ },
+ },
+ {
+ name: 'inject-file-scope-variables',
+ setup(build) {
+ build.onLoad({ filter: /\.[cm]?[jt]s$/ }, async (args) => {
+ const contents = await fsp.readFile(args.path, 'utf8');
+ const injectValues = `const ${dirnameVarName} = ${JSON.stringify(path$o.dirname(args.path))};` +
+ `const ${filenameVarName} = ${JSON.stringify(args.path)};` +
+ `const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL(args.path).href)};`;
+ return {
+ loader: args.path.endsWith('ts') ? 'ts' : 'js',
+ contents: injectValues + contents,
+ };
+ });
+ },
+ },
+ ],
+ });
+ const { text } = result.outputFiles[0];
+ return {
+ code: text,
+ dependencies: result.metafile ? Object.keys(result.metafile.inputs) : [],
+ };
+}
+const _require = createRequire$1(import.meta.url);
+async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
+ // for esm, before we can register loaders without requiring users to run node
+ // with --experimental-loader themselves, we have to do a hack here:
+ // write it to disk, load it with native Node ESM, then delete the file.
+ if (isESM) {
+ const fileBase = `${fileName}.timestamp-${Date.now()}-${Math.random()
+ .toString(16)
+ .slice(2)}`;
+ const fileNameTmp = `${fileBase}.mjs`;
+ const fileUrl = `${pathToFileURL(fileBase)}.mjs`;
+ await fsp.writeFile(fileNameTmp, bundledCode);
+ try {
+ return (await dynamicImport(fileUrl)).default;
+ }
+ finally {
+ fs$l.unlink(fileNameTmp, () => { }); // Ignore errors
+ }
+ }
+ // for cjs, we can register a custom loader via `_require.extensions`
+ else {
+ const extension = path$o.extname(fileName);
+ // We don't use fsp.realpath() here because it has the same behaviour as
+ // fs.realpath.native. On some Windows systems, it returns uppercase volume
+ // letters (e.g. "C:\") while the Node.js loader uses lowercase volume letters.
+ // See https://github.com/vitejs/vite/issues/12923
+ const realFileName = await promisifiedRealpath(fileName);
+ const loaderExt = extension in _require.extensions ? extension : '.js';
+ const defaultLoader = _require.extensions[loaderExt];
+ _require.extensions[loaderExt] = (module, filename) => {
+ if (filename === realFileName) {
+ module._compile(bundledCode, filename);
+ }
+ else {
+ defaultLoader(module, filename);
+ }
+ };
+ // clear cache in case of server restart
+ delete _require.cache[_require.resolve(fileName)];
+ const raw = _require(fileName);
+ _require.extensions[loaderExt] = defaultLoader;
+ return raw.__esModule ? raw.default : raw;
+ }
+}
+async function runConfigHook(config, plugins, configEnv) {
+ let conf = config;
+ for (const p of getSortedPluginsByHook('config', plugins)) {
+ const hook = p.config;
+ const handler = hook && 'handler' in hook ? hook.handler : hook;
+ if (handler) {
+ const res = await handler(conf, configEnv);
+ if (res) {
+ conf = mergeConfig(conf, res);
+ }
+ }
+ }
+ return conf;
+}
+function getDepOptimizationConfig(config, ssr) {
+ return ssr ? config.ssr.optimizeDeps : config.optimizeDeps;
+}
+function isDepsOptimizerEnabled(config, ssr) {
+ const { command } = config;
+ const { disabled } = getDepOptimizationConfig(config, ssr);
+ return !(disabled === true ||
+ (command === 'build' && disabled === 'build') ||
+ (command === 'serve' && disabled === 'dev'));
+}
+
+export { loadEnv as A, resolveEnvPrefix as B, colors$1 as C, bindShortcuts as D, getDefaultExportFromCjs as E, commonjsGlobal as F, index$1 as G, build$1 as H, index as I, preview$1 as J, preprocessCSS as a, build as b, createServer as c, resolvePackageData as d, buildErrorMessage as e, formatPostcssSourceMap as f, defineConfig as g, resolveConfig as h, isInNodeModules as i, resolveBaseUrl as j, getDepOptimizationConfig as k, loadConfigFromFile as l, isDepsOptimizerEnabled as m, normalizePath$3 as n, optimizeDeps as o, preview as p, mergeConfig as q, resolvePackageEntry as r, sortUserPlugins as s, transformWithEsbuild as t, mergeAlias as u, createFilter as v, send$2 as w, createLogger as x, searchForWorkspaceRoot as y, isFileServingAllowed as z };
diff --git a/node_modules/vite/dist/node/chunks/dep-e0331088.js b/node_modules/vite/dist/node/chunks/dep-e0331088.js
new file mode 100644
index 0000000..e6d1e25
--- /dev/null
+++ b/node_modules/vite/dist/node/chunks/dep-e0331088.js
@@ -0,0 +1,914 @@
+import { E as getDefaultExportFromCjs } from './dep-df561101.js';
+import require$$0 from 'path';
+import require$$0__default from 'fs';
+import { l as lib } from './dep-c423598f.js';
+
+import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
+import { dirname as __cjs_dirname } from 'node:path';
+import { createRequire as __cjs_createRequire } from 'node:module';
+
+const __filename = __cjs_fileURLToPath(import.meta.url);
+const __dirname = __cjs_dirname(__filename);
+const require = __cjs_createRequire(import.meta.url);
+const __require = require;
+function _mergeNamespaces(n, m) {
+ for (var i = 0; i < m.length; i++) {
+ var e = m[i];
+ if (typeof e !== 'string' && !Array.isArray(e)) { for (var k in e) {
+ if (k !== 'default' && !(k in n)) {
+ n[k] = e[k];
+ }
+ } }
+ }
+ return n;
+}
+
+const startsWithKeywordRegexp = /^(all|not|only|print|screen)/i;
+
+var joinMedia$1 = function (parentMedia, childMedia) {
+ if (!parentMedia.length && childMedia.length) return childMedia
+ if (parentMedia.length && !childMedia.length) return parentMedia
+ if (!parentMedia.length && !childMedia.length) return []
+
+ const media = [];
+
+ parentMedia.forEach(parentItem => {
+ const parentItemStartsWithKeyword = startsWithKeywordRegexp.test(parentItem);
+
+ childMedia.forEach(childItem => {
+ const childItemStartsWithKeyword = startsWithKeywordRegexp.test(childItem);
+ if (parentItem !== childItem) {
+ if (childItemStartsWithKeyword && !parentItemStartsWithKeyword) {
+ media.push(`${childItem} and ${parentItem}`);
+ } else {
+ media.push(`${parentItem} and ${childItem}`);
+ }
+ }
+ });
+ });
+
+ return media
+};
+
+var joinLayer$1 = function (parentLayer, childLayer) {
+ if (!parentLayer.length && childLayer.length) return childLayer
+ if (parentLayer.length && !childLayer.length) return parentLayer
+ if (!parentLayer.length && !childLayer.length) return []
+
+ return parentLayer.concat(childLayer)
+};
+
+var readCache$1 = {exports: {}};
+
+var pify$2 = {exports: {}};
+
+var processFn = function (fn, P, opts) {
+ return function () {
+ var that = this;
+ var args = new Array(arguments.length);
+
+ for (var i = 0; i < arguments.length; i++) {
+ args[i] = arguments[i];
+ }
+
+ return new P(function (resolve, reject) {
+ args.push(function (err, result) {
+ if (err) {
+ reject(err);
+ } else if (opts.multiArgs) {
+ var results = new Array(arguments.length - 1);
+
+ for (var i = 1; i < arguments.length; i++) {
+ results[i - 1] = arguments[i];
+ }
+
+ resolve(results);
+ } else {
+ resolve(result);
+ }
+ });
+
+ fn.apply(that, args);
+ });
+ };
+};
+
+var pify$1 = pify$2.exports = function (obj, P, opts) {
+ if (typeof P !== 'function') {
+ opts = P;
+ P = Promise;
+ }
+
+ opts = opts || {};
+ opts.exclude = opts.exclude || [/.+Sync$/];
+
+ var filter = function (key) {
+ var match = function (pattern) {
+ return typeof pattern === 'string' ? key === pattern : pattern.test(key);
+ };
+
+ return opts.include ? opts.include.some(match) : !opts.exclude.some(match);
+ };
+
+ var ret = typeof obj === 'function' ? function () {
+ if (opts.excludeMain) {
+ return obj.apply(this, arguments);
+ }
+
+ return processFn(obj, P, opts).apply(this, arguments);
+ } : {};
+
+ return Object.keys(obj).reduce(function (ret, key) {
+ var x = obj[key];
+
+ ret[key] = typeof x === 'function' && filter(key) ? processFn(x, P, opts) : x;
+
+ return ret;
+ }, ret);
+};
+
+pify$1.all = pify$1;
+
+var pifyExports = pify$2.exports;
+
+var fs = require$$0__default;
+var path$2 = require$$0;
+var pify = pifyExports;
+
+var stat = pify(fs.stat);
+var readFile = pify(fs.readFile);
+var resolve = path$2.resolve;
+
+var cache = Object.create(null);
+
+function convert(content, encoding) {
+ if (Buffer.isEncoding(encoding)) {
+ return content.toString(encoding);
+ }
+ return content;
+}
+
+readCache$1.exports = function (path, encoding) {
+ path = resolve(path);
+
+ return stat(path).then(function (stats) {
+ var item = cache[path];
+
+ if (item && item.mtime.getTime() === stats.mtime.getTime()) {
+ return convert(item.content, encoding);
+ }
+
+ return readFile(path).then(function (data) {
+ cache[path] = {
+ mtime: stats.mtime,
+ content: data
+ };
+
+ return convert(data, encoding);
+ });
+ }).catch(function (err) {
+ cache[path] = null;
+ return Promise.reject(err);
+ });
+};
+
+readCache$1.exports.sync = function (path, encoding) {
+ path = resolve(path);
+
+ try {
+ var stats = fs.statSync(path);
+ var item = cache[path];
+
+ if (item && item.mtime.getTime() === stats.mtime.getTime()) {
+ return convert(item.content, encoding);
+ }
+
+ var data = fs.readFileSync(path);
+
+ cache[path] = {
+ mtime: stats.mtime,
+ content: data
+ };
+
+ return convert(data, encoding);
+ } catch (err) {
+ cache[path] = null;
+ throw err;
+ }
+
+};
+
+readCache$1.exports.get = function (path, encoding) {
+ path = resolve(path);
+ if (cache[path]) {
+ return convert(cache[path].content, encoding);
+ }
+ return null;
+};
+
+readCache$1.exports.clear = function () {
+ cache = Object.create(null);
+};
+
+var readCacheExports = readCache$1.exports;
+
+const dataURLRegexp = /^data:text\/css;base64,/i;
+
+function isValid(url) {
+ return dataURLRegexp.test(url)
+}
+
+function contents(url) {
+ // "data:text/css;base64,".length === 21
+ return Buffer.from(url.slice(21), "base64").toString()
+}
+
+var dataUrl = {
+ isValid,
+ contents,
+};
+
+const readCache = readCacheExports;
+const dataURL$1 = dataUrl;
+
+var loadContent$1 = filename => {
+ if (dataURL$1.isValid(filename)) {
+ return dataURL$1.contents(filename)
+ }
+
+ return readCache(filename, "utf-8")
+};
+
+// builtin tooling
+const path$1 = require$$0;
+
+// placeholder tooling
+let sugarss;
+
+var processContent$1 = function processContent(
+ result,
+ content,
+ filename,
+ options,
+ postcss
+) {
+ const { plugins } = options;
+ const ext = path$1.extname(filename);
+
+ const parserList = [];
+
+ // SugarSS support:
+ if (ext === ".sss") {
+ if (!sugarss) {
+ try {
+ sugarss = __require('sugarss');
+ } catch {} // Ignore
+ }
+ if (sugarss)
+ return runPostcss(postcss, content, filename, plugins, [sugarss])
+ }
+
+ // Syntax support:
+ if (result.opts.syntax?.parse) {
+ parserList.push(result.opts.syntax.parse);
+ }
+
+ // Parser support:
+ if (result.opts.parser) parserList.push(result.opts.parser);
+ // Try the default as a last resort:
+ parserList.push(null);
+
+ return runPostcss(postcss, content, filename, plugins, parserList)
+};
+
+function runPostcss(postcss, content, filename, plugins, parsers, index) {
+ if (!index) index = 0;
+ return postcss(plugins)
+ .process(content, {
+ from: filename,
+ parser: parsers[index],
+ })
+ .catch(err => {
+ // If there's an error, try the next parser
+ index++;
+ // If there are no parsers left, throw it
+ if (index === parsers.length) throw err
+ return runPostcss(postcss, content, filename, plugins, parsers, index)
+ })
+}
+
+// external tooling
+const valueParser = lib;
+
+// extended tooling
+const { stringify } = valueParser;
+
+function split(params, start) {
+ const list = [];
+ const last = params.reduce((item, node, index) => {
+ if (index < start) return ""
+ if (node.type === "div" && node.value === ",") {
+ list.push(item);
+ return ""
+ }
+ return item + stringify(node)
+ }, "");
+ list.push(last);
+ return list
+}
+
+var parseStatements$1 = function (result, styles) {
+ const statements = [];
+ let nodes = [];
+
+ styles.each(node => {
+ let stmt;
+ if (node.type === "atrule") {
+ if (node.name === "import") stmt = parseImport(result, node);
+ else if (node.name === "media") stmt = parseMedia(result, node);
+ else if (node.name === "charset") stmt = parseCharset(result, node);
+ }
+
+ if (stmt) {
+ if (nodes.length) {
+ statements.push({
+ type: "nodes",
+ nodes,
+ media: [],
+ layer: [],
+ });
+ nodes = [];
+ }
+ statements.push(stmt);
+ } else nodes.push(node);
+ });
+
+ if (nodes.length) {
+ statements.push({
+ type: "nodes",
+ nodes,
+ media: [],
+ layer: [],
+ });
+ }
+
+ return statements
+};
+
+function parseMedia(result, atRule) {
+ const params = valueParser(atRule.params).nodes;
+ return {
+ type: "media",
+ node: atRule,
+ media: split(params, 0),
+ layer: [],
+ }
+}
+
+function parseCharset(result, atRule) {
+ if (atRule.prev()) {
+ return result.warn("@charset must precede all other statements", {
+ node: atRule,
+ })
+ }
+ return {
+ type: "charset",
+ node: atRule,
+ media: [],
+ layer: [],
+ }
+}
+
+function parseImport(result, atRule) {
+ let prev = atRule.prev();
+ if (prev) {
+ do {
+ if (
+ prev.type !== "comment" &&
+ (prev.type !== "atrule" ||
+ (prev.name !== "import" &&
+ prev.name !== "charset" &&
+ !(prev.name === "layer" && !prev.nodes)))
+ ) {
+ return result.warn(
+ "@import must precede all other statements (besides @charset or empty @layer)",
+ { node: atRule }
+ )
+ }
+ prev = prev.prev();
+ } while (prev)
+ }
+
+ if (atRule.nodes) {
+ return result.warn(
+ "It looks like you didn't end your @import statement correctly. " +
+ "Child nodes are attached to it.",
+ { node: atRule }
+ )
+ }
+
+ const params = valueParser(atRule.params).nodes;
+ const stmt = {
+ type: "import",
+ node: atRule,
+ media: [],
+ layer: [],
+ };
+
+ // prettier-ignore
+ if (
+ !params.length ||
+ (
+ params[0].type !== "string" ||
+ !params[0].value
+ ) &&
+ (
+ params[0].type !== "function" ||
+ params[0].value !== "url" ||
+ !params[0].nodes.length ||
+ !params[0].nodes[0].value
+ )
+ ) {
+ return result.warn(`Unable to find uri in '${ atRule.toString() }'`, {
+ node: atRule,
+ })
+ }
+
+ if (params[0].type === "string") stmt.uri = params[0].value;
+ else stmt.uri = params[0].nodes[0].value;
+ stmt.fullUri = stringify(params[0]);
+
+ let remainder = params;
+ if (remainder.length > 2) {
+ if (
+ (remainder[2].type === "word" || remainder[2].type === "function") &&
+ remainder[2].value === "layer"
+ ) {
+ if (remainder[1].type !== "space") {
+ return result.warn("Invalid import layer statement", { node: atRule })
+ }
+
+ if (remainder[2].nodes) {
+ stmt.layer = [stringify(remainder[2].nodes)];
+ } else {
+ stmt.layer = [""];
+ }
+ remainder = remainder.slice(2);
+ }
+ }
+
+ if (remainder.length > 2) {
+ if (remainder[1].type !== "space") {
+ return result.warn("Invalid import media statement", { node: atRule })
+ }
+
+ stmt.media = split(remainder, 2);
+ }
+
+ return stmt
+}
+
+var assignLayerNames$1 = function (layer, node, state, options) {
+ layer.forEach((layerPart, i) => {
+ if (layerPart.trim() === "") {
+ if (options.nameLayer) {
+ layer[i] = options
+ .nameLayer(state.anonymousLayerCounter++, state.rootFilename)
+ .toString();
+ } else {
+ throw node.error(
+ `When using anonymous layers in @import you must also set the "nameLayer" plugin option`
+ )
+ }
+ }
+ });
+};
+
+// builtin tooling
+const path = require$$0;
+
+// internal tooling
+const joinMedia = joinMedia$1;
+const joinLayer = joinLayer$1;
+const resolveId = (id) => id;
+const loadContent = loadContent$1;
+const processContent = processContent$1;
+const parseStatements = parseStatements$1;
+const assignLayerNames = assignLayerNames$1;
+const dataURL = dataUrl;
+
+function AtImport(options) {
+ options = {
+ root: process.cwd(),
+ path: [],
+ skipDuplicates: true,
+ resolve: resolveId,
+ load: loadContent,
+ plugins: [],
+ addModulesDirectories: [],
+ nameLayer: null,
+ ...options,
+ };
+
+ options.root = path.resolve(options.root);
+
+ // convert string to an array of a single element
+ if (typeof options.path === "string") options.path = [options.path];
+
+ if (!Array.isArray(options.path)) options.path = [];
+
+ options.path = options.path.map(p => path.resolve(options.root, p));
+
+ return {
+ postcssPlugin: "postcss-import",
+ Once(styles, { result, atRule, postcss }) {
+ const state = {
+ importedFiles: {},
+ hashFiles: {},
+ rootFilename: null,
+ anonymousLayerCounter: 0,
+ };
+
+ if (styles.source?.input?.file) {
+ state.rootFilename = styles.source.input.file;
+ state.importedFiles[styles.source.input.file] = {};
+ }
+
+ if (options.plugins && !Array.isArray(options.plugins)) {
+ throw new Error("plugins option must be an array")
+ }
+
+ if (options.nameLayer && typeof options.nameLayer !== "function") {
+ throw new Error("nameLayer option must be a function")
+ }
+
+ return parseStyles(result, styles, options, state, [], []).then(
+ bundle => {
+ applyRaws(bundle);
+ applyMedia(bundle);
+ applyStyles(bundle, styles);
+ }
+ )
+
+ function applyRaws(bundle) {
+ bundle.forEach((stmt, index) => {
+ if (index === 0) return
+
+ if (stmt.parent) {
+ const { before } = stmt.parent.node.raws;
+ if (stmt.type === "nodes") stmt.nodes[0].raws.before = before;
+ else stmt.node.raws.before = before;
+ } else if (stmt.type === "nodes") {
+ stmt.nodes[0].raws.before = stmt.nodes[0].raws.before || "\n";
+ }
+ });
+ }
+
+ function applyMedia(bundle) {
+ bundle.forEach(stmt => {
+ if (
+ (!stmt.media.length && !stmt.layer.length) ||
+ stmt.type === "charset"
+ ) {
+ return
+ }
+
+ if (stmt.layer.length > 1) {
+ assignLayerNames(stmt.layer, stmt.node, state, options);
+ }
+
+ if (stmt.type === "import") {
+ const parts = [stmt.fullUri];
+
+ const media = stmt.media.join(", ");
+
+ if (stmt.layer.length) {
+ const layerName = stmt.layer.join(".");
+
+ let layerParams = "layer";
+ if (layerName) {
+ layerParams = `layer(${layerName})`;
+ }
+
+ parts.push(layerParams);
+ }
+
+ if (media) {
+ parts.push(media);
+ }
+
+ stmt.node.params = parts.join(" ");
+ } else if (stmt.type === "media") {
+ if (stmt.layer.length) {
+ const layerNode = atRule({
+ name: "layer",
+ params: stmt.layer.join("."),
+ source: stmt.node.source,
+ });
+
+ if (stmt.parentMedia?.length) {
+ const mediaNode = atRule({
+ name: "media",
+ params: stmt.parentMedia.join(", "),
+ source: stmt.node.source,
+ });
+
+ mediaNode.append(layerNode);
+ layerNode.append(stmt.node);
+ stmt.node = mediaNode;
+ } else {
+ layerNode.append(stmt.node);
+ stmt.node = layerNode;
+ }
+ } else {
+ stmt.node.params = stmt.media.join(", ");
+ }
+ } else {
+ const { nodes } = stmt;
+ const { parent } = nodes[0];
+
+ let outerAtRule;
+ let innerAtRule;
+ if (stmt.media.length && stmt.layer.length) {
+ const mediaNode = atRule({
+ name: "media",
+ params: stmt.media.join(", "),
+ source: parent.source,
+ });
+
+ const layerNode = atRule({
+ name: "layer",
+ params: stmt.layer.join("."),
+ source: parent.source,
+ });
+
+ mediaNode.append(layerNode);
+ innerAtRule = layerNode;
+ outerAtRule = mediaNode;
+ } else if (stmt.media.length) {
+ const mediaNode = atRule({
+ name: "media",
+ params: stmt.media.join(", "),
+ source: parent.source,
+ });
+
+ innerAtRule = mediaNode;
+ outerAtRule = mediaNode;
+ } else if (stmt.layer.length) {
+ const layerNode = atRule({
+ name: "layer",
+ params: stmt.layer.join("."),
+ source: parent.source,
+ });
+
+ innerAtRule = layerNode;
+ outerAtRule = layerNode;
+ }
+
+ parent.insertBefore(nodes[0], outerAtRule);
+
+ // remove nodes
+ nodes.forEach(node => {
+ node.parent = undefined;
+ });
+
+ // better output
+ nodes[0].raws.before = nodes[0].raws.before || "\n";
+
+ // wrap new rules with media query and/or layer at rule
+ innerAtRule.append(nodes);
+
+ stmt.type = "media";
+ stmt.node = outerAtRule;
+ delete stmt.nodes;
+ }
+ });
+ }
+
+ function applyStyles(bundle, styles) {
+ styles.nodes = [];
+
+ // Strip additional statements.
+ bundle.forEach(stmt => {
+ if (["charset", "import", "media"].includes(stmt.type)) {
+ stmt.node.parent = undefined;
+ styles.append(stmt.node);
+ } else if (stmt.type === "nodes") {
+ stmt.nodes.forEach(node => {
+ node.parent = undefined;
+ styles.append(node);
+ });
+ }
+ });
+ }
+
+ function parseStyles(result, styles, options, state, media, layer) {
+ const statements = parseStatements(result, styles);
+
+ return Promise.resolve(statements)
+ .then(stmts => {
+ // process each statement in series
+ return stmts.reduce((promise, stmt) => {
+ return promise.then(() => {
+ stmt.media = joinMedia(media, stmt.media || []);
+ stmt.parentMedia = media;
+ stmt.layer = joinLayer(layer, stmt.layer || []);
+
+ // skip protocol base uri (protocol://url) or protocol-relative
+ if (
+ stmt.type !== "import" ||
+ /^(?:[a-z]+:)?\/\//i.test(stmt.uri)
+ ) {
+ return
+ }
+
+ if (options.filter && !options.filter(stmt.uri)) {
+ // rejected by filter
+ return
+ }
+
+ return resolveImportId(result, stmt, options, state)
+ })
+ }, Promise.resolve())
+ })
+ .then(() => {
+ let charset;
+ const imports = [];
+ const bundle = [];
+
+ function handleCharset(stmt) {
+ if (!charset) charset = stmt;
+ // charsets aren't case-sensitive, so convert to lower case to compare
+ else if (
+ stmt.node.params.toLowerCase() !==
+ charset.node.params.toLowerCase()
+ ) {
+ throw new Error(
+ `Incompatable @charset statements:
+ ${stmt.node.params} specified in ${stmt.node.source.input.file}
+ ${charset.node.params} specified in ${charset.node.source.input.file}`
+ )
+ }
+ }
+
+ // squash statements and their children
+ statements.forEach(stmt => {
+ if (stmt.type === "charset") handleCharset(stmt);
+ else if (stmt.type === "import") {
+ if (stmt.children) {
+ stmt.children.forEach((child, index) => {
+ if (child.type === "import") imports.push(child);
+ else if (child.type === "charset") handleCharset(child);
+ else bundle.push(child);
+ // For better output
+ if (index === 0) child.parent = stmt;
+ });
+ } else imports.push(stmt);
+ } else if (stmt.type === "media" || stmt.type === "nodes") {
+ bundle.push(stmt);
+ }
+ });
+
+ return charset
+ ? [charset, ...imports.concat(bundle)]
+ : imports.concat(bundle)
+ })
+ }
+
+ function resolveImportId(result, stmt, options, state) {
+ if (dataURL.isValid(stmt.uri)) {
+ return loadImportContent(result, stmt, stmt.uri, options, state).then(
+ result => {
+ stmt.children = result;
+ }
+ )
+ }
+
+ const atRule = stmt.node;
+ let sourceFile;
+ if (atRule.source?.input?.file) {
+ sourceFile = atRule.source.input.file;
+ }
+ const base = sourceFile
+ ? path.dirname(atRule.source.input.file)
+ : options.root;
+
+ return Promise.resolve(options.resolve(stmt.uri, base, options))
+ .then(paths => {
+ if (!Array.isArray(paths)) paths = [paths];
+ // Ensure that each path is absolute:
+ return Promise.all(
+ paths.map(file => {
+ return !path.isAbsolute(file)
+ ? resolveId(file)
+ : file
+ })
+ )
+ })
+ .then(resolved => {
+ // Add dependency messages:
+ resolved.forEach(file => {
+ result.messages.push({
+ type: "dependency",
+ plugin: "postcss-import",
+ file,
+ parent: sourceFile,
+ });
+ });
+
+ return Promise.all(
+ resolved.map(file => {
+ return loadImportContent(result, stmt, file, options, state)
+ })
+ )
+ })
+ .then(result => {
+ // Merge loaded statements
+ stmt.children = result.reduce((result, statements) => {
+ return statements ? result.concat(statements) : result
+ }, []);
+ })
+ }
+
+ function loadImportContent(result, stmt, filename, options, state) {
+ const atRule = stmt.node;
+ const { media, layer } = stmt;
+
+ assignLayerNames(layer, atRule, state, options);
+
+ if (options.skipDuplicates) {
+ // skip files already imported at the same scope
+ if (state.importedFiles[filename]?.[media]?.[layer]) {
+ return
+ }
+
+ // save imported files to skip them next time
+ if (!state.importedFiles[filename]) {
+ state.importedFiles[filename] = {};
+ }
+ if (!state.importedFiles[filename][media]) {
+ state.importedFiles[filename][media] = {};
+ }
+ state.importedFiles[filename][media][layer] = true;
+ }
+
+ return Promise.resolve(options.load(filename, options)).then(
+ content => {
+ if (content.trim() === "") {
+ result.warn(`${filename} is empty`, { node: atRule });
+ return
+ }
+
+ // skip previous imported files not containing @import rules
+ if (state.hashFiles[content]?.[media]?.[layer]) {
+ return
+ }
+
+ return processContent(
+ result,
+ content,
+ filename,
+ options,
+ postcss
+ ).then(importedResult => {
+ const styles = importedResult.root;
+ result.messages = result.messages.concat(importedResult.messages);
+
+ if (options.skipDuplicates) {
+ const hasImport = styles.some(child => {
+ return child.type === "atrule" && child.name === "import"
+ });
+ if (!hasImport) {
+ // save hash files to skip them next time
+ if (!state.hashFiles[content]) {
+ state.hashFiles[content] = {};
+ }
+ if (!state.hashFiles[content][media]) {
+ state.hashFiles[content][media] = {};
+ }
+ state.hashFiles[content][media][layer] = true;
+ }
+ }
+
+ // recursion: import @import from imported file
+ return parseStyles(result, styles, options, state, media, layer)
+ })
+ }
+ )
+ }
+ },
+ }
+}
+
+AtImport.postcss = true;
+
+var postcssImport = AtImport;
+
+var index = /*@__PURE__*/getDefaultExportFromCjs(postcssImport);
+
+var index$1 = /*#__PURE__*/_mergeNamespaces({
+ __proto__: null,
+ default: index
+}, [postcssImport]);
+
+export { index$1 as i };
diff --git a/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js b/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js
new file mode 100644
index 0000000..a8082bf
--- /dev/null
+++ b/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js
@@ -0,0 +1,7930 @@
+import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
+import { dirname as __cjs_dirname } from 'node:path';
+import { createRequire as __cjs_createRequire } from 'node:module';
+
+const __filename = __cjs_fileURLToPath(import.meta.url);
+const __dirname = __cjs_dirname(__filename);
+const require = __cjs_createRequire(import.meta.url);
+const __require = require;
+const UNDEFINED_CODE_POINTS = new Set([
+ 65534, 65535, 131070, 131071, 196606, 196607, 262142, 262143, 327678, 327679, 393214,
+ 393215, 458750, 458751, 524286, 524287, 589822, 589823, 655358, 655359, 720894,
+ 720895, 786430, 786431, 851966, 851967, 917502, 917503, 983038, 983039, 1048574,
+ 1048575, 1114110, 1114111,
+]);
+const REPLACEMENT_CHARACTER = '\uFFFD';
+var CODE_POINTS;
+(function (CODE_POINTS) {
+ CODE_POINTS[CODE_POINTS["EOF"] = -1] = "EOF";
+ CODE_POINTS[CODE_POINTS["NULL"] = 0] = "NULL";
+ CODE_POINTS[CODE_POINTS["TABULATION"] = 9] = "TABULATION";
+ CODE_POINTS[CODE_POINTS["CARRIAGE_RETURN"] = 13] = "CARRIAGE_RETURN";
+ CODE_POINTS[CODE_POINTS["LINE_FEED"] = 10] = "LINE_FEED";
+ CODE_POINTS[CODE_POINTS["FORM_FEED"] = 12] = "FORM_FEED";
+ CODE_POINTS[CODE_POINTS["SPACE"] = 32] = "SPACE";
+ CODE_POINTS[CODE_POINTS["EXCLAMATION_MARK"] = 33] = "EXCLAMATION_MARK";
+ CODE_POINTS[CODE_POINTS["QUOTATION_MARK"] = 34] = "QUOTATION_MARK";
+ CODE_POINTS[CODE_POINTS["NUMBER_SIGN"] = 35] = "NUMBER_SIGN";
+ CODE_POINTS[CODE_POINTS["AMPERSAND"] = 38] = "AMPERSAND";
+ CODE_POINTS[CODE_POINTS["APOSTROPHE"] = 39] = "APOSTROPHE";
+ CODE_POINTS[CODE_POINTS["HYPHEN_MINUS"] = 45] = "HYPHEN_MINUS";
+ CODE_POINTS[CODE_POINTS["SOLIDUS"] = 47] = "SOLIDUS";
+ CODE_POINTS[CODE_POINTS["DIGIT_0"] = 48] = "DIGIT_0";
+ CODE_POINTS[CODE_POINTS["DIGIT_9"] = 57] = "DIGIT_9";
+ CODE_POINTS[CODE_POINTS["SEMICOLON"] = 59] = "SEMICOLON";
+ CODE_POINTS[CODE_POINTS["LESS_THAN_SIGN"] = 60] = "LESS_THAN_SIGN";
+ CODE_POINTS[CODE_POINTS["EQUALS_SIGN"] = 61] = "EQUALS_SIGN";
+ CODE_POINTS[CODE_POINTS["GREATER_THAN_SIGN"] = 62] = "GREATER_THAN_SIGN";
+ CODE_POINTS[CODE_POINTS["QUESTION_MARK"] = 63] = "QUESTION_MARK";
+ CODE_POINTS[CODE_POINTS["LATIN_CAPITAL_A"] = 65] = "LATIN_CAPITAL_A";
+ CODE_POINTS[CODE_POINTS["LATIN_CAPITAL_F"] = 70] = "LATIN_CAPITAL_F";
+ CODE_POINTS[CODE_POINTS["LATIN_CAPITAL_X"] = 88] = "LATIN_CAPITAL_X";
+ CODE_POINTS[CODE_POINTS["LATIN_CAPITAL_Z"] = 90] = "LATIN_CAPITAL_Z";
+ CODE_POINTS[CODE_POINTS["RIGHT_SQUARE_BRACKET"] = 93] = "RIGHT_SQUARE_BRACKET";
+ CODE_POINTS[CODE_POINTS["GRAVE_ACCENT"] = 96] = "GRAVE_ACCENT";
+ CODE_POINTS[CODE_POINTS["LATIN_SMALL_A"] = 97] = "LATIN_SMALL_A";
+ CODE_POINTS[CODE_POINTS["LATIN_SMALL_F"] = 102] = "LATIN_SMALL_F";
+ CODE_POINTS[CODE_POINTS["LATIN_SMALL_X"] = 120] = "LATIN_SMALL_X";
+ CODE_POINTS[CODE_POINTS["LATIN_SMALL_Z"] = 122] = "LATIN_SMALL_Z";
+ CODE_POINTS[CODE_POINTS["REPLACEMENT_CHARACTER"] = 65533] = "REPLACEMENT_CHARACTER";
+})(CODE_POINTS = CODE_POINTS || (CODE_POINTS = {}));
+const SEQUENCES = {
+ DASH_DASH: '--',
+ CDATA_START: '[CDATA[',
+ DOCTYPE: 'doctype',
+ SCRIPT: 'script',
+ PUBLIC: 'public',
+ SYSTEM: 'system',
+};
+//Surrogates
+function isSurrogate(cp) {
+ return cp >= 55296 && cp <= 57343;
+}
+function isSurrogatePair(cp) {
+ return cp >= 56320 && cp <= 57343;
+}
+function getSurrogatePairCodePoint(cp1, cp2) {
+ return (cp1 - 55296) * 1024 + 9216 + cp2;
+}
+//NOTE: excluding NULL and ASCII whitespace
+function isControlCodePoint(cp) {
+ return ((cp !== 0x20 && cp !== 0x0a && cp !== 0x0d && cp !== 0x09 && cp !== 0x0c && cp >= 0x01 && cp <= 0x1f) ||
+ (cp >= 0x7f && cp <= 0x9f));
+}
+function isUndefinedCodePoint(cp) {
+ return (cp >= 64976 && cp <= 65007) || UNDEFINED_CODE_POINTS.has(cp);
+}
+
+var ERR;
+(function (ERR) {
+ ERR["controlCharacterInInputStream"] = "control-character-in-input-stream";
+ ERR["noncharacterInInputStream"] = "noncharacter-in-input-stream";
+ ERR["surrogateInInputStream"] = "surrogate-in-input-stream";
+ ERR["nonVoidHtmlElementStartTagWithTrailingSolidus"] = "non-void-html-element-start-tag-with-trailing-solidus";
+ ERR["endTagWithAttributes"] = "end-tag-with-attributes";
+ ERR["endTagWithTrailingSolidus"] = "end-tag-with-trailing-solidus";
+ ERR["unexpectedSolidusInTag"] = "unexpected-solidus-in-tag";
+ ERR["unexpectedNullCharacter"] = "unexpected-null-character";
+ ERR["unexpectedQuestionMarkInsteadOfTagName"] = "unexpected-question-mark-instead-of-tag-name";
+ ERR["invalidFirstCharacterOfTagName"] = "invalid-first-character-of-tag-name";
+ ERR["unexpectedEqualsSignBeforeAttributeName"] = "unexpected-equals-sign-before-attribute-name";
+ ERR["missingEndTagName"] = "missing-end-tag-name";
+ ERR["unexpectedCharacterInAttributeName"] = "unexpected-character-in-attribute-name";
+ ERR["unknownNamedCharacterReference"] = "unknown-named-character-reference";
+ ERR["missingSemicolonAfterCharacterReference"] = "missing-semicolon-after-character-reference";
+ ERR["unexpectedCharacterAfterDoctypeSystemIdentifier"] = "unexpected-character-after-doctype-system-identifier";
+ ERR["unexpectedCharacterInUnquotedAttributeValue"] = "unexpected-character-in-unquoted-attribute-value";
+ ERR["eofBeforeTagName"] = "eof-before-tag-name";
+ ERR["eofInTag"] = "eof-in-tag";
+ ERR["missingAttributeValue"] = "missing-attribute-value";
+ ERR["missingWhitespaceBetweenAttributes"] = "missing-whitespace-between-attributes";
+ ERR["missingWhitespaceAfterDoctypePublicKeyword"] = "missing-whitespace-after-doctype-public-keyword";
+ ERR["missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers"] = "missing-whitespace-between-doctype-public-and-system-identifiers";
+ ERR["missingWhitespaceAfterDoctypeSystemKeyword"] = "missing-whitespace-after-doctype-system-keyword";
+ ERR["missingQuoteBeforeDoctypePublicIdentifier"] = "missing-quote-before-doctype-public-identifier";
+ ERR["missingQuoteBeforeDoctypeSystemIdentifier"] = "missing-quote-before-doctype-system-identifier";
+ ERR["missingDoctypePublicIdentifier"] = "missing-doctype-public-identifier";
+ ERR["missingDoctypeSystemIdentifier"] = "missing-doctype-system-identifier";
+ ERR["abruptDoctypePublicIdentifier"] = "abrupt-doctype-public-identifier";
+ ERR["abruptDoctypeSystemIdentifier"] = "abrupt-doctype-system-identifier";
+ ERR["cdataInHtmlContent"] = "cdata-in-html-content";
+ ERR["incorrectlyOpenedComment"] = "incorrectly-opened-comment";
+ ERR["eofInScriptHtmlCommentLikeText"] = "eof-in-script-html-comment-like-text";
+ ERR["eofInDoctype"] = "eof-in-doctype";
+ ERR["nestedComment"] = "nested-comment";
+ ERR["abruptClosingOfEmptyComment"] = "abrupt-closing-of-empty-comment";
+ ERR["eofInComment"] = "eof-in-comment";
+ ERR["incorrectlyClosedComment"] = "incorrectly-closed-comment";
+ ERR["eofInCdata"] = "eof-in-cdata";
+ ERR["absenceOfDigitsInNumericCharacterReference"] = "absence-of-digits-in-numeric-character-reference";
+ ERR["nullCharacterReference"] = "null-character-reference";
+ ERR["surrogateCharacterReference"] = "surrogate-character-reference";
+ ERR["characterReferenceOutsideUnicodeRange"] = "character-reference-outside-unicode-range";
+ ERR["controlCharacterReference"] = "control-character-reference";
+ ERR["noncharacterCharacterReference"] = "noncharacter-character-reference";
+ ERR["missingWhitespaceBeforeDoctypeName"] = "missing-whitespace-before-doctype-name";
+ ERR["missingDoctypeName"] = "missing-doctype-name";
+ ERR["invalidCharacterSequenceAfterDoctypeName"] = "invalid-character-sequence-after-doctype-name";
+ ERR["duplicateAttribute"] = "duplicate-attribute";
+ ERR["nonConformingDoctype"] = "non-conforming-doctype";
+ ERR["missingDoctype"] = "missing-doctype";
+ ERR["misplacedDoctype"] = "misplaced-doctype";
+ ERR["endTagWithoutMatchingOpenElement"] = "end-tag-without-matching-open-element";
+ ERR["closingOfElementWithOpenChildElements"] = "closing-of-element-with-open-child-elements";
+ ERR["disallowedContentInNoscriptInHead"] = "disallowed-content-in-noscript-in-head";
+ ERR["openElementsLeftAfterEof"] = "open-elements-left-after-eof";
+ ERR["abandonedHeadElementChild"] = "abandoned-head-element-child";
+ ERR["misplacedStartTagForHeadElement"] = "misplaced-start-tag-for-head-element";
+ ERR["nestedNoscriptInHead"] = "nested-noscript-in-head";
+ ERR["eofInElementThatCanContainOnlyText"] = "eof-in-element-that-can-contain-only-text";
+})(ERR = ERR || (ERR = {}));
+
+//Const
+const DEFAULT_BUFFER_WATERLINE = 1 << 16;
+//Preprocessor
+//NOTE: HTML input preprocessing
+//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream)
+class Preprocessor {
+ constructor(handler) {
+ this.handler = handler;
+ this.html = '';
+ this.pos = -1;
+ // NOTE: Initial `lastGapPos` is -2, to ensure `col` on initialisation is 0
+ this.lastGapPos = -2;
+ this.gapStack = [];
+ this.skipNextNewLine = false;
+ this.lastChunkWritten = false;
+ this.endOfChunkHit = false;
+ this.bufferWaterline = DEFAULT_BUFFER_WATERLINE;
+ this.isEol = false;
+ this.lineStartPos = 0;
+ this.droppedBufferSize = 0;
+ this.line = 1;
+ //NOTE: avoid reporting errors twice on advance/retreat
+ this.lastErrOffset = -1;
+ }
+ /** The column on the current line. If we just saw a gap (eg. a surrogate pair), return the index before. */
+ get col() {
+ return this.pos - this.lineStartPos + Number(this.lastGapPos !== this.pos);
+ }
+ get offset() {
+ return this.droppedBufferSize + this.pos;
+ }
+ getError(code) {
+ const { line, col, offset } = this;
+ return {
+ code,
+ startLine: line,
+ endLine: line,
+ startCol: col,
+ endCol: col,
+ startOffset: offset,
+ endOffset: offset,
+ };
+ }
+ _err(code) {
+ if (this.handler.onParseError && this.lastErrOffset !== this.offset) {
+ this.lastErrOffset = this.offset;
+ this.handler.onParseError(this.getError(code));
+ }
+ }
+ _addGap() {
+ this.gapStack.push(this.lastGapPos);
+ this.lastGapPos = this.pos;
+ }
+ _processSurrogate(cp) {
+ //NOTE: try to peek a surrogate pair
+ if (this.pos !== this.html.length - 1) {
+ const nextCp = this.html.charCodeAt(this.pos + 1);
+ if (isSurrogatePair(nextCp)) {
+ //NOTE: we have a surrogate pair. Peek pair character and recalculate code point.
+ this.pos++;
+ //NOTE: add a gap that should be avoided during retreat
+ this._addGap();
+ return getSurrogatePairCodePoint(cp, nextCp);
+ }
+ }
+ //NOTE: we are at the end of a chunk, therefore we can't infer the surrogate pair yet.
+ else if (!this.lastChunkWritten) {
+ this.endOfChunkHit = true;
+ return CODE_POINTS.EOF;
+ }
+ //NOTE: isolated surrogate
+ this._err(ERR.surrogateInInputStream);
+ return cp;
+ }
+ willDropParsedChunk() {
+ return this.pos > this.bufferWaterline;
+ }
+ dropParsedChunk() {
+ if (this.willDropParsedChunk()) {
+ this.html = this.html.substring(this.pos);
+ this.lineStartPos -= this.pos;
+ this.droppedBufferSize += this.pos;
+ this.pos = 0;
+ this.lastGapPos = -2;
+ this.gapStack.length = 0;
+ }
+ }
+ write(chunk, isLastChunk) {
+ if (this.html.length > 0) {
+ this.html += chunk;
+ }
+ else {
+ this.html = chunk;
+ }
+ this.endOfChunkHit = false;
+ this.lastChunkWritten = isLastChunk;
+ }
+ insertHtmlAtCurrentPos(chunk) {
+ this.html = this.html.substring(0, this.pos + 1) + chunk + this.html.substring(this.pos + 1);
+ this.endOfChunkHit = false;
+ }
+ startsWith(pattern, caseSensitive) {
+ // Check if our buffer has enough characters
+ if (this.pos + pattern.length > this.html.length) {
+ this.endOfChunkHit = !this.lastChunkWritten;
+ return false;
+ }
+ if (caseSensitive) {
+ return this.html.startsWith(pattern, this.pos);
+ }
+ for (let i = 0; i < pattern.length; i++) {
+ const cp = this.html.charCodeAt(this.pos + i) | 0x20;
+ if (cp !== pattern.charCodeAt(i)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ peek(offset) {
+ const pos = this.pos + offset;
+ if (pos >= this.html.length) {
+ this.endOfChunkHit = !this.lastChunkWritten;
+ return CODE_POINTS.EOF;
+ }
+ const code = this.html.charCodeAt(pos);
+ return code === CODE_POINTS.CARRIAGE_RETURN ? CODE_POINTS.LINE_FEED : code;
+ }
+ advance() {
+ this.pos++;
+ //NOTE: LF should be in the last column of the line
+ if (this.isEol) {
+ this.isEol = false;
+ this.line++;
+ this.lineStartPos = this.pos;
+ }
+ if (this.pos >= this.html.length) {
+ this.endOfChunkHit = !this.lastChunkWritten;
+ return CODE_POINTS.EOF;
+ }
+ let cp = this.html.charCodeAt(this.pos);
+ //NOTE: all U+000D CARRIAGE RETURN (CR) characters must be converted to U+000A LINE FEED (LF) characters
+ if (cp === CODE_POINTS.CARRIAGE_RETURN) {
+ this.isEol = true;
+ this.skipNextNewLine = true;
+ return CODE_POINTS.LINE_FEED;
+ }
+ //NOTE: any U+000A LINE FEED (LF) characters that immediately follow a U+000D CARRIAGE RETURN (CR) character
+ //must be ignored.
+ if (cp === CODE_POINTS.LINE_FEED) {
+ this.isEol = true;
+ if (this.skipNextNewLine) {
+ // `line` will be bumped again in the recursive call.
+ this.line--;
+ this.skipNextNewLine = false;
+ this._addGap();
+ return this.advance();
+ }
+ }
+ this.skipNextNewLine = false;
+ if (isSurrogate(cp)) {
+ cp = this._processSurrogate(cp);
+ }
+ //OPTIMIZATION: first check if code point is in the common allowed
+ //range (ASCII alphanumeric, whitespaces, big chunk of BMP)
+ //before going into detailed performance cost validation.
+ const isCommonValidRange = this.handler.onParseError === null ||
+ (cp > 0x1f && cp < 0x7f) ||
+ cp === CODE_POINTS.LINE_FEED ||
+ cp === CODE_POINTS.CARRIAGE_RETURN ||
+ (cp > 0x9f && cp < 64976);
+ if (!isCommonValidRange) {
+ this._checkForProblematicCharacters(cp);
+ }
+ return cp;
+ }
+ _checkForProblematicCharacters(cp) {
+ if (isControlCodePoint(cp)) {
+ this._err(ERR.controlCharacterInInputStream);
+ }
+ else if (isUndefinedCodePoint(cp)) {
+ this._err(ERR.noncharacterInInputStream);
+ }
+ }
+ retreat(count) {
+ this.pos -= count;
+ while (this.pos < this.lastGapPos) {
+ this.lastGapPos = this.gapStack.pop();
+ this.pos--;
+ }
+ this.isEol = false;
+ }
+}
+
+var TokenType;
+(function (TokenType) {
+ TokenType[TokenType["CHARACTER"] = 0] = "CHARACTER";
+ TokenType[TokenType["NULL_CHARACTER"] = 1] = "NULL_CHARACTER";
+ TokenType[TokenType["WHITESPACE_CHARACTER"] = 2] = "WHITESPACE_CHARACTER";
+ TokenType[TokenType["START_TAG"] = 3] = "START_TAG";
+ TokenType[TokenType["END_TAG"] = 4] = "END_TAG";
+ TokenType[TokenType["COMMENT"] = 5] = "COMMENT";
+ TokenType[TokenType["DOCTYPE"] = 6] = "DOCTYPE";
+ TokenType[TokenType["EOF"] = 7] = "EOF";
+ TokenType[TokenType["HIBERNATION"] = 8] = "HIBERNATION";
+})(TokenType = TokenType || (TokenType = {}));
+function getTokenAttr(token, attrName) {
+ for (let i = token.attrs.length - 1; i >= 0; i--) {
+ if (token.attrs[i].name === attrName) {
+ return token.attrs[i].value;
+ }
+ }
+ return null;
+}
+
+// Generated using scripts/write-decode-map.ts
+var htmlDecodeTree = new Uint16Array(
+// prettier-ignore
+"\u1d41<\xd5\u0131\u028a\u049d\u057b\u05d0\u0675\u06de\u07a2\u07d6\u080f\u0a4a\u0a91\u0da1\u0e6d\u0f09\u0f26\u10ca\u1228\u12e1\u1415\u149d\u14c3\u14df\u1525\0\0\0\0\0\0\u156b\u16cd\u198d\u1c12\u1ddd\u1f7e\u2060\u21b0\u228d\u23c0\u23fb\u2442\u2824\u2912\u2d08\u2e48\u2fce\u3016\u32ba\u3639\u37ac\u38fe\u3a28\u3a71\u3ae0\u3b2e\u0800EMabcfglmnoprstu\\bfms\x7f\x84\x8b\x90\x95\x98\xa6\xb3\xb9\xc8\xcflig\u803b\xc6\u40c6P\u803b&\u4026cute\u803b\xc1\u40c1reve;\u4102\u0100iyx}rc\u803b\xc2\u40c2;\u4410r;\uc000\ud835\udd04rave\u803b\xc0\u40c0pha;\u4391acr;\u4100d;\u6a53\u0100gp\x9d\xa1on;\u4104f;\uc000\ud835\udd38plyFunction;\u6061ing\u803b\xc5\u40c5\u0100cs\xbe\xc3r;\uc000\ud835\udc9cign;\u6254ilde\u803b\xc3\u40c3ml\u803b\xc4\u40c4\u0400aceforsu\xe5\xfb\xfe\u0117\u011c\u0122\u0127\u012a\u0100cr\xea\xf2kslash;\u6216\u0176\xf6\xf8;\u6ae7ed;\u6306y;\u4411\u0180crt\u0105\u010b\u0114ause;\u6235noullis;\u612ca;\u4392r;\uc000\ud835\udd05pf;\uc000\ud835\udd39eve;\u42d8c\xf2\u0113mpeq;\u624e\u0700HOacdefhilorsu\u014d\u0151\u0156\u0180\u019e\u01a2\u01b5\u01b7\u01ba\u01dc\u0215\u0273\u0278\u027ecy;\u4427PY\u803b\xa9\u40a9\u0180cpy\u015d\u0162\u017aute;\u4106\u0100;i\u0167\u0168\u62d2talDifferentialD;\u6145leys;\u612d\u0200aeio\u0189\u018e\u0194\u0198ron;\u410cdil\u803b\xc7\u40c7rc;\u4108nint;\u6230ot;\u410a\u0100dn\u01a7\u01adilla;\u40b8terDot;\u40b7\xf2\u017fi;\u43a7rcle\u0200DMPT\u01c7\u01cb\u01d1\u01d6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01e2\u01f8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020foubleQuote;\u601duote;\u6019\u0200lnpu\u021e\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6a74\u0180git\u022f\u0236\u023aruent;\u6261nt;\u622fourIntegral;\u622e\u0100fr\u024c\u024e;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6a2fcr;\uc000\ud835\udc9ep\u0100;C\u0284\u0285\u62d3ap;\u624d\u0580DJSZacefios\u02a0\u02ac\u02b0\u02b4\u02b8\u02cb\u02d7\u02e1\u02e6\u0333\u048d\u0100;o\u0179\u02a5trahd;\u6911cy;\u4402cy;\u4405cy;\u440f\u0180grs\u02bf\u02c4\u02c7ger;\u6021r;\u61a1hv;\u6ae4\u0100ay\u02d0\u02d5ron;\u410e;\u4414l\u0100;t\u02dd\u02de\u6207a;\u4394r;\uc000\ud835\udd07\u0100af\u02eb\u0327\u0100cm\u02f0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031ccute;\u40b4o\u0174\u030b\u030d;\u42d9bleAcute;\u42ddrave;\u4060ilde;\u42dcond;\u62c4ferentialD;\u6146\u0470\u033d\0\0\0\u0342\u0354\0\u0405f;\uc000\ud835\udd3b\u0180;DE\u0348\u0349\u034d\u40a8ot;\u60dcqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03cf\u03e2\u03f8ontourIntegra\xec\u0239o\u0274\u0379\0\0\u037b\xbb\u0349nArrow;\u61d3\u0100eo\u0387\u03a4ft\u0180ART\u0390\u0396\u03a1rrow;\u61d0ightArrow;\u61d4e\xe5\u02cang\u0100LR\u03ab\u03c4eft\u0100AR\u03b3\u03b9rrow;\u67f8ightArrow;\u67faightArrow;\u67f9ight\u0100AT\u03d8\u03derrow;\u61d2ee;\u62a8p\u0241\u03e9\0\0\u03efrrow;\u61d1ownArrow;\u61d5erticalBar;\u6225n\u0300ABLRTa\u0412\u042a\u0430\u045e\u047f\u037crrow\u0180;BU\u041d\u041e\u0422\u6193ar;\u6913pArrow;\u61f5reve;\u4311eft\u02d2\u043a\0\u0446\0\u0450ightVector;\u6950eeVector;\u695eector\u0100;B\u0459\u045a\u61bdar;\u6956ight\u01d4\u0467\0\u0471eeVector;\u695fector\u0100;B\u047a\u047b\u61c1ar;\u6957ee\u0100;A\u0486\u0487\u62a4rrow;\u61a7\u0100ct\u0492\u0497r;\uc000\ud835\udc9frok;\u4110\u0800NTacdfglmopqstux\u04bd\u04c0\u04c4\u04cb\u04de\u04e2\u04e7\u04ee\u04f5\u0521\u052f\u0536\u0552\u055d\u0560\u0565G;\u414aH\u803b\xd0\u40d0cute\u803b\xc9\u40c9\u0180aiy\u04d2\u04d7\u04dcron;\u411arc\u803b\xca\u40ca;\u442dot;\u4116r;\uc000\ud835\udd08rave\u803b\xc8\u40c8ement;\u6208\u0100ap\u04fa\u04fecr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65fberySmallSquare;\u65ab\u0100gp\u0526\u052aon;\u4118f;\uc000\ud835\udd3csilon;\u4395u\u0100ai\u053c\u0549l\u0100;T\u0542\u0543\u6a75ilde;\u6242librium;\u61cc\u0100ci\u0557\u055ar;\u6130m;\u6a73a;\u4397ml\u803b\xcb\u40cb\u0100ip\u056a\u056fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058d\u05b2\u05ccy;\u4424r;\uc000\ud835\udd09lled\u0253\u0597\0\0\u05a3mallSquare;\u65fcerySmallSquare;\u65aa\u0370\u05ba\0\u05bf\0\0\u05c4f;\uc000\ud835\udd3dAll;\u6200riertrf;\u6131c\xf2\u05cb\u0600JTabcdfgorst\u05e8\u05ec\u05ef\u05fa\u0600\u0612\u0616\u061b\u061d\u0623\u066c\u0672cy;\u4403\u803b>\u403emma\u0100;d\u05f7\u05f8\u4393;\u43dcreve;\u411e\u0180eiy\u0607\u060c\u0610dil;\u4122rc;\u411c;\u4413ot;\u4120r;\uc000\ud835\udd0a;\u62d9pf;\uc000\ud835\udd3eeater\u0300EFGLST\u0635\u0644\u064e\u0656\u065b\u0666qual\u0100;L\u063e\u063f\u6265ess;\u62dbullEqual;\u6267reater;\u6aa2ess;\u6277lantEqual;\u6a7eilde;\u6273cr;\uc000\ud835\udca2;\u626b\u0400Aacfiosu\u0685\u068b\u0696\u069b\u069e\u06aa\u06be\u06caRDcy;\u442a\u0100ct\u0690\u0694ek;\u42c7;\u405eirc;\u4124r;\u610clbertSpace;\u610b\u01f0\u06af\0\u06b2f;\u610dizontalLine;\u6500\u0100ct\u06c3\u06c5\xf2\u06a9rok;\u4126mp\u0144\u06d0\u06d8ownHum\xf0\u012fqual;\u624f\u0700EJOacdfgmnostu\u06fa\u06fe\u0703\u0707\u070e\u071a\u071e\u0721\u0728\u0744\u0778\u078b\u078f\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803b\xcd\u40cd\u0100iy\u0713\u0718rc\u803b\xce\u40ce;\u4418ot;\u4130r;\u6111rave\u803b\xcc\u40cc\u0180;ap\u0720\u072f\u073f\u0100cg\u0734\u0737r;\u412ainaryI;\u6148lie\xf3\u03dd\u01f4\u0749\0\u0762\u0100;e\u074d\u074e\u622c\u0100gr\u0753\u0758ral;\u622bsection;\u62c2isible\u0100CT\u076c\u0772omma;\u6063imes;\u6062\u0180gpt\u077f\u0783\u0788on;\u412ef;\uc000\ud835\udd40a;\u4399cr;\u6110ilde;\u4128\u01eb\u079a\0\u079ecy;\u4406l\u803b\xcf\u40cf\u0280cfosu\u07ac\u07b7\u07bc\u07c2\u07d0\u0100iy\u07b1\u07b5rc;\u4134;\u4419r;\uc000\ud835\udd0dpf;\uc000\ud835\udd41\u01e3\u07c7\0\u07ccr;\uc000\ud835\udca5rcy;\u4408kcy;\u4404\u0380HJacfos\u07e4\u07e8\u07ec\u07f1\u07fd\u0802\u0808cy;\u4425cy;\u440cppa;\u439a\u0100ey\u07f6\u07fbdil;\u4136;\u441ar;\uc000\ud835\udd0epf;\uc000\ud835\udd42cr;\uc000\ud835\udca6\u0580JTaceflmost\u0825\u0829\u082c\u0850\u0863\u09b3\u09b8\u09c7\u09cd\u0a37\u0a47cy;\u4409\u803b<\u403c\u0280cmnpr\u0837\u083c\u0841\u0844\u084dute;\u4139bda;\u439bg;\u67ealacetrf;\u6112r;\u619e\u0180aey\u0857\u085c\u0861ron;\u413ddil;\u413b;\u441b\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087e\u08a9\u08b1\u08e0\u08e6\u08fc\u092f\u095b\u0390\u096a\u0100nr\u0883\u088fgleBracket;\u67e8row\u0180;BR\u0899\u089a\u089e\u6190ar;\u61e4ightArrow;\u61c6eiling;\u6308o\u01f5\u08b7\0\u08c3bleBracket;\u67e6n\u01d4\u08c8\0\u08d2eeVector;\u6961ector\u0100;B\u08db\u08dc\u61c3ar;\u6959loor;\u630aight\u0100AV\u08ef\u08f5rrow;\u6194ector;\u694e\u0100er\u0901\u0917e\u0180;AV\u0909\u090a\u0910\u62a3rrow;\u61a4ector;\u695aiangle\u0180;BE\u0924\u0925\u0929\u62b2ar;\u69cfqual;\u62b4p\u0180DTV\u0937\u0942\u094cownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61bfar;\u6958ector\u0100;B\u0965\u0966\u61bcar;\u6952ight\xe1\u039cs\u0300EFGLST\u097e\u098b\u0995\u099d\u09a2\u09adqualGreater;\u62daullEqual;\u6266reater;\u6276ess;\u6aa1lantEqual;\u6a7dilde;\u6272r;\uc000\ud835\udd0f\u0100;e\u09bd\u09be\u62d8ftarrow;\u61daidot;\u413f\u0180npw\u09d4\u0a16\u0a1bg\u0200LRlr\u09de\u09f7\u0a02\u0a10eft\u0100AR\u09e6\u09ecrrow;\u67f5ightArrow;\u67f7ightArrow;\u67f6eft\u0100ar\u03b3\u0a0aight\xe1\u03bfight\xe1\u03caf;\uc000\ud835\udd43er\u0100LR\u0a22\u0a2ceftArrow;\u6199ightArrow;\u6198\u0180cht\u0a3e\u0a40\u0a42\xf2\u084c;\u61b0rok;\u4141;\u626a\u0400acefiosu\u0a5a\u0a5d\u0a60\u0a77\u0a7c\u0a85\u0a8b\u0a8ep;\u6905y;\u441c\u0100dl\u0a65\u0a6fiumSpace;\u605flintrf;\u6133r;\uc000\ud835\udd10nusPlus;\u6213pf;\uc000\ud835\udd44c\xf2\u0a76;\u439c\u0480Jacefostu\u0aa3\u0aa7\u0aad\u0ac0\u0b14\u0b19\u0d91\u0d97\u0d9ecy;\u440acute;\u4143\u0180aey\u0ab4\u0ab9\u0aberon;\u4147dil;\u4145;\u441d\u0180gsw\u0ac7\u0af0\u0b0eative\u0180MTV\u0ad3\u0adf\u0ae8ediumSpace;\u600bhi\u0100cn\u0ae6\u0ad8\xeb\u0ad9eryThi\xee\u0ad9ted\u0100GL\u0af8\u0b06reaterGreate\xf2\u0673essLes\xf3\u0a48Line;\u400ar;\uc000\ud835\udd11\u0200Bnpt\u0b22\u0b28\u0b37\u0b3areak;\u6060BreakingSpace;\u40a0f;\u6115\u0680;CDEGHLNPRSTV\u0b55\u0b56\u0b6a\u0b7c\u0ba1\u0beb\u0c04\u0c5e\u0c84\u0ca6\u0cd8\u0d61\u0d85\u6aec\u0100ou\u0b5b\u0b64ngruent;\u6262pCap;\u626doubleVerticalBar;\u6226\u0180lqx\u0b83\u0b8a\u0b9bement;\u6209ual\u0100;T\u0b92\u0b93\u6260ilde;\uc000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0bb6\u0bb7\u0bbd\u0bc9\u0bd3\u0bd8\u0be5\u626fqual;\u6271ullEqual;\uc000\u2267\u0338reater;\uc000\u226b\u0338ess;\u6279lantEqual;\uc000\u2a7e\u0338ilde;\u6275ump\u0144\u0bf2\u0bfdownHump;\uc000\u224e\u0338qual;\uc000\u224f\u0338e\u0100fs\u0c0a\u0c27tTriangle\u0180;BE\u0c1a\u0c1b\u0c21\u62eaar;\uc000\u29cf\u0338qual;\u62ecs\u0300;EGLST\u0c35\u0c36\u0c3c\u0c44\u0c4b\u0c58\u626equal;\u6270reater;\u6278ess;\uc000\u226a\u0338lantEqual;\uc000\u2a7d\u0338ilde;\u6274ested\u0100GL\u0c68\u0c79reaterGreater;\uc000\u2aa2\u0338essLess;\uc000\u2aa1\u0338recedes\u0180;ES\u0c92\u0c93\u0c9b\u6280qual;\uc000\u2aaf\u0338lantEqual;\u62e0\u0100ei\u0cab\u0cb9verseElement;\u620cghtTriangle\u0180;BE\u0ccb\u0ccc\u0cd2\u62ebar;\uc000\u29d0\u0338qual;\u62ed\u0100qu\u0cdd\u0d0cuareSu\u0100bp\u0ce8\u0cf9set\u0100;E\u0cf0\u0cf3\uc000\u228f\u0338qual;\u62e2erset\u0100;E\u0d03\u0d06\uc000\u2290\u0338qual;\u62e3\u0180bcp\u0d13\u0d24\u0d4eset\u0100;E\u0d1b\u0d1e\uc000\u2282\u20d2qual;\u6288ceeds\u0200;EST\u0d32\u0d33\u0d3b\u0d46\u6281qual;\uc000\u2ab0\u0338lantEqual;\u62e1ilde;\uc000\u227f\u0338erset\u0100;E\u0d58\u0d5b\uc000\u2283\u20d2qual;\u6289ilde\u0200;EFT\u0d6e\u0d6f\u0d75\u0d7f\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uc000\ud835\udca9ilde\u803b\xd1\u40d1;\u439d\u0700Eacdfgmoprstuv\u0dbd\u0dc2\u0dc9\u0dd5\u0ddb\u0de0\u0de7\u0dfc\u0e02\u0e20\u0e22\u0e32\u0e3f\u0e44lig;\u4152cute\u803b\xd3\u40d3\u0100iy\u0dce\u0dd3rc\u803b\xd4\u40d4;\u441eblac;\u4150r;\uc000\ud835\udd12rave\u803b\xd2\u40d2\u0180aei\u0dee\u0df2\u0df6cr;\u414cga;\u43a9cron;\u439fpf;\uc000\ud835\udd46enCurly\u0100DQ\u0e0e\u0e1aoubleQuote;\u601cuote;\u6018;\u6a54\u0100cl\u0e27\u0e2cr;\uc000\ud835\udcaaash\u803b\xd8\u40d8i\u016c\u0e37\u0e3cde\u803b\xd5\u40d5es;\u6a37ml\u803b\xd6\u40d6er\u0100BP\u0e4b\u0e60\u0100ar\u0e50\u0e53r;\u603eac\u0100ek\u0e5a\u0e5c;\u63deet;\u63b4arenthesis;\u63dc\u0480acfhilors\u0e7f\u0e87\u0e8a\u0e8f\u0e92\u0e94\u0e9d\u0eb0\u0efcrtialD;\u6202y;\u441fr;\uc000\ud835\udd13i;\u43a6;\u43a0usMinus;\u40b1\u0100ip\u0ea2\u0eadncareplan\xe5\u069df;\u6119\u0200;eio\u0eb9\u0eba\u0ee0\u0ee4\u6abbcedes\u0200;EST\u0ec8\u0ec9\u0ecf\u0eda\u627aqual;\u6aaflantEqual;\u627cilde;\u627eme;\u6033\u0100dp\u0ee9\u0eeeuct;\u620fortion\u0100;a\u0225\u0ef9l;\u621d\u0100ci\u0f01\u0f06r;\uc000\ud835\udcab;\u43a8\u0200Ufos\u0f11\u0f16\u0f1b\u0f1fOT\u803b\"\u4022r;\uc000\ud835\udd14pf;\u611acr;\uc000\ud835\udcac\u0600BEacefhiorsu\u0f3e\u0f43\u0f47\u0f60\u0f73\u0fa7\u0faa\u0fad\u1096\u10a9\u10b4\u10bearr;\u6910G\u803b\xae\u40ae\u0180cnr\u0f4e\u0f53\u0f56ute;\u4154g;\u67ebr\u0100;t\u0f5c\u0f5d\u61a0l;\u6916\u0180aey\u0f67\u0f6c\u0f71ron;\u4158dil;\u4156;\u4420\u0100;v\u0f78\u0f79\u611cerse\u0100EU\u0f82\u0f99\u0100lq\u0f87\u0f8eement;\u620builibrium;\u61cbpEquilibrium;\u696fr\xbb\u0f79o;\u43a1ght\u0400ACDFTUVa\u0fc1\u0feb\u0ff3\u1022\u1028\u105b\u1087\u03d8\u0100nr\u0fc6\u0fd2gleBracket;\u67e9row\u0180;BL\u0fdc\u0fdd\u0fe1\u6192ar;\u61e5eftArrow;\u61c4eiling;\u6309o\u01f5\u0ff9\0\u1005bleBracket;\u67e7n\u01d4\u100a\0\u1014eeVector;\u695dector\u0100;B\u101d\u101e\u61c2ar;\u6955loor;\u630b\u0100er\u102d\u1043e\u0180;AV\u1035\u1036\u103c\u62a2rrow;\u61a6ector;\u695biangle\u0180;BE\u1050\u1051\u1055\u62b3ar;\u69d0qual;\u62b5p\u0180DTV\u1063\u106e\u1078ownVector;\u694feeVector;\u695cector\u0100;B\u1082\u1083\u61bear;\u6954ector\u0100;B\u1091\u1092\u61c0ar;\u6953\u0100pu\u109b\u109ef;\u611dndImplies;\u6970ightarrow;\u61db\u0100ch\u10b9\u10bcr;\u611b;\u61b1leDelayed;\u69f4\u0680HOacfhimoqstu\u10e4\u10f1\u10f7\u10fd\u1119\u111e\u1151\u1156\u1161\u1167\u11b5\u11bb\u11bf\u0100Cc\u10e9\u10eeHcy;\u4429y;\u4428FTcy;\u442ccute;\u415a\u0280;aeiy\u1108\u1109\u110e\u1113\u1117\u6abcron;\u4160dil;\u415erc;\u415c;\u4421r;\uc000\ud835\udd16ort\u0200DLRU\u112a\u1134\u113e\u1149ownArrow\xbb\u041eeftArrow\xbb\u089aightArrow\xbb\u0fddpArrow;\u6191gma;\u43a3allCircle;\u6218pf;\uc000\ud835\udd4a\u0272\u116d\0\0\u1170t;\u621aare\u0200;ISU\u117b\u117c\u1189\u11af\u65a1ntersection;\u6293u\u0100bp\u118f\u119eset\u0100;E\u1197\u1198\u628fqual;\u6291erset\u0100;E\u11a8\u11a9\u6290qual;\u6292nion;\u6294cr;\uc000\ud835\udcaear;\u62c6\u0200bcmp\u11c8\u11db\u1209\u120b\u0100;s\u11cd\u11ce\u62d0et\u0100;E\u11cd\u11d5qual;\u6286\u0100ch\u11e0\u1205eeds\u0200;EST\u11ed\u11ee\u11f4\u11ff\u627bqual;\u6ab0lantEqual;\u627dilde;\u627fTh\xe1\u0f8c;\u6211\u0180;es\u1212\u1213\u1223\u62d1rset\u0100;E\u121c\u121d\u6283qual;\u6287et\xbb\u1213\u0580HRSacfhiors\u123e\u1244\u1249\u1255\u125e\u1271\u1276\u129f\u12c2\u12c8\u12d1ORN\u803b\xde\u40deADE;\u6122\u0100Hc\u124e\u1252cy;\u440by;\u4426\u0100bu\u125a\u125c;\u4009;\u43a4\u0180aey\u1265\u126a\u126fron;\u4164dil;\u4162;\u4422r;\uc000\ud835\udd17\u0100ei\u127b\u1289\u01f2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128e\u1298kSpace;\uc000\u205f\u200aSpace;\u6009lde\u0200;EFT\u12ab\u12ac\u12b2\u12bc\u623cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uc000\ud835\udd4bipleDot;\u60db\u0100ct\u12d6\u12dbr;\uc000\ud835\udcafrok;\u4166\u0ae1\u12f7\u130e\u131a\u1326\0\u132c\u1331\0\0\0\0\0\u1338\u133d\u1377\u1385\0\u13ff\u1404\u140a\u1410\u0100cr\u12fb\u1301ute\u803b\xda\u40dar\u0100;o\u1307\u1308\u619fcir;\u6949r\u01e3\u1313\0\u1316y;\u440eve;\u416c\u0100iy\u131e\u1323rc\u803b\xdb\u40db;\u4423blac;\u4170r;\uc000\ud835\udd18rave\u803b\xd9\u40d9acr;\u416a\u0100di\u1341\u1369er\u0100BP\u1348\u135d\u0100ar\u134d\u1350r;\u405fac\u0100ek\u1357\u1359;\u63dfet;\u63b5arenthesis;\u63ddon\u0100;P\u1370\u1371\u62c3lus;\u628e\u0100gp\u137b\u137fon;\u4172f;\uc000\ud835\udd4c\u0400ADETadps\u1395\u13ae\u13b8\u13c4\u03e8\u13d2\u13d7\u13f3rrow\u0180;BD\u1150\u13a0\u13a4ar;\u6912ownArrow;\u61c5ownArrow;\u6195quilibrium;\u696eee\u0100;A\u13cb\u13cc\u62a5rrow;\u61a5own\xe1\u03f3er\u0100LR\u13de\u13e8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13f9\u13fa\u43d2on;\u43a5ing;\u416ecr;\uc000\ud835\udcb0ilde;\u4168ml\u803b\xdc\u40dc\u0480Dbcdefosv\u1427\u142c\u1430\u1433\u143e\u1485\u148a\u1490\u1496ash;\u62abar;\u6aeby;\u4412ash\u0100;l\u143b\u143c\u62a9;\u6ae6\u0100er\u1443\u1445;\u62c1\u0180bty\u144c\u1450\u147aar;\u6016\u0100;i\u144f\u1455cal\u0200BLST\u1461\u1465\u146a\u1474ar;\u6223ine;\u407ceparator;\u6758ilde;\u6240ThinSpace;\u600ar;\uc000\ud835\udd19pf;\uc000\ud835\udd4dcr;\uc000\ud835\udcb1dash;\u62aa\u0280cefos\u14a7\u14ac\u14b1\u14b6\u14bcirc;\u4174dge;\u62c0r;\uc000\ud835\udd1apf;\uc000\ud835\udd4ecr;\uc000\ud835\udcb2\u0200fios\u14cb\u14d0\u14d2\u14d8r;\uc000\ud835\udd1b;\u439epf;\uc000\ud835\udd4fcr;\uc000\ud835\udcb3\u0480AIUacfosu\u14f1\u14f5\u14f9\u14fd\u1504\u150f\u1514\u151a\u1520cy;\u442fcy;\u4407cy;\u442ecute\u803b\xdd\u40dd\u0100iy\u1509\u150drc;\u4176;\u442br;\uc000\ud835\udd1cpf;\uc000\ud835\udd50cr;\uc000\ud835\udcb4ml;\u4178\u0400Hacdefos\u1535\u1539\u153f\u154b\u154f\u155d\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417d;\u4417ot;\u417b\u01f2\u1554\0\u155boWidt\xe8\u0ad9a;\u4396r;\u6128pf;\u6124cr;\uc000\ud835\udcb5\u0be1\u1583\u158a\u1590\0\u15b0\u15b6\u15bf\0\0\0\0\u15c6\u15db\u15eb\u165f\u166d\0\u1695\u169b\u16b2\u16b9\0\u16becute\u803b\xe1\u40e1reve;\u4103\u0300;Ediuy\u159c\u159d\u15a1\u15a3\u15a8\u15ad\u623e;\uc000\u223e\u0333;\u623frc\u803b\xe2\u40e2te\u80bb\xb4\u0306;\u4430lig\u803b\xe6\u40e6\u0100;r\xb2\u15ba;\uc000\ud835\udd1erave\u803b\xe0\u40e0\u0100ep\u15ca\u15d6\u0100fp\u15cf\u15d4sym;\u6135\xe8\u15d3ha;\u43b1\u0100ap\u15dfc\u0100cl\u15e4\u15e7r;\u4101g;\u6a3f\u0264\u15f0\0\0\u160a\u0280;adsv\u15fa\u15fb\u15ff\u1601\u1607\u6227nd;\u6a55;\u6a5clope;\u6a58;\u6a5a\u0380;elmrsz\u1618\u1619\u161b\u161e\u163f\u164f\u1659\u6220;\u69a4e\xbb\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163a\u163c\u163e;\u69a8;\u69a9;\u69aa;\u69ab;\u69ac;\u69ad;\u69ae;\u69aft\u0100;v\u1645\u1646\u621fb\u0100;d\u164c\u164d\u62be;\u699d\u0100pt\u1654\u1657h;\u6222\xbb\xb9arr;\u637c\u0100gp\u1663\u1667on;\u4105f;\uc000\ud835\udd52\u0380;Eaeiop\u12c1\u167b\u167d\u1682\u1684\u1687\u168a;\u6a70cir;\u6a6f;\u624ad;\u624bs;\u4027rox\u0100;e\u12c1\u1692\xf1\u1683ing\u803b\xe5\u40e5\u0180cty\u16a1\u16a6\u16a8r;\uc000\ud835\udcb6;\u402amp\u0100;e\u12c1\u16af\xf1\u0288ilde\u803b\xe3\u40e3ml\u803b\xe4\u40e4\u0100ci\u16c2\u16c8onin\xf4\u0272nt;\u6a11\u0800Nabcdefiklnoprsu\u16ed\u16f1\u1730\u173c\u1743\u1748\u1778\u177d\u17e0\u17e6\u1839\u1850\u170d\u193d\u1948\u1970ot;\u6aed\u0100cr\u16f6\u171ek\u0200ceps\u1700\u1705\u170d\u1713ong;\u624cpsilon;\u43f6rime;\u6035im\u0100;e\u171a\u171b\u623dq;\u62cd\u0176\u1722\u1726ee;\u62bded\u0100;g\u172c\u172d\u6305e\xbb\u172drk\u0100;t\u135c\u1737brk;\u63b6\u0100oy\u1701\u1741;\u4431quo;\u601e\u0280cmprt\u1753\u175b\u1761\u1764\u1768aus\u0100;e\u010a\u0109ptyv;\u69b0s\xe9\u170cno\xf5\u0113\u0180ahw\u176f\u1771\u1773;\u43b2;\u6136een;\u626cr;\uc000\ud835\udd1fg\u0380costuvw\u178d\u179d\u17b3\u17c1\u17d5\u17db\u17de\u0180aiu\u1794\u1796\u179a\xf0\u0760rc;\u65efp\xbb\u1371\u0180dpt\u17a4\u17a8\u17adot;\u6a00lus;\u6a01imes;\u6a02\u0271\u17b9\0\0\u17becup;\u6a06ar;\u6605riangle\u0100du\u17cd\u17d2own;\u65bdp;\u65b3plus;\u6a04e\xe5\u1444\xe5\u14adarow;\u690d\u0180ako\u17ed\u1826\u1835\u0100cn\u17f2\u1823k\u0180lst\u17fa\u05ab\u1802ozenge;\u69ebriangle\u0200;dlr\u1812\u1813\u1818\u181d\u65b4own;\u65beeft;\u65c2ight;\u65b8k;\u6423\u01b1\u182b\0\u1833\u01b2\u182f\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183e\u184d\u0100;q\u1843\u1846\uc000=\u20e5uiv;\uc000\u2261\u20e5t;\u6310\u0200ptwx\u1859\u185e\u1867\u186cf;\uc000\ud835\udd53\u0100;t\u13cb\u1863om\xbb\u13cctie;\u62c8\u0600DHUVbdhmptuv\u1885\u1896\u18aa\u18bb\u18d7\u18db\u18ec\u18ff\u1905\u190a\u1910\u1921\u0200LRlr\u188e\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18a1\u18a2\u18a4\u18a6\u18a8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18b3\u18b5\u18b7\u18b9;\u655d;\u655a;\u655c;\u6559\u0380;HLRhlr\u18ca\u18cb\u18cd\u18cf\u18d1\u18d3\u18d5\u6551;\u656c;\u6563;\u6560;\u656b;\u6562;\u655fox;\u69c9\u0200LRlr\u18e4\u18e6\u18e8\u18ea;\u6555;\u6552;\u6510;\u650c\u0280;DUdu\u06bd\u18f7\u18f9\u18fb\u18fd;\u6565;\u6568;\u652c;\u6534inus;\u629flus;\u629eimes;\u62a0\u0200LRlr\u1919\u191b\u191d\u191f;\u655b;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193b\u6502;\u656a;\u6561;\u655e;\u653c;\u6524;\u651c\u0100ev\u0123\u1942bar\u803b\xa6\u40a6\u0200ceio\u1951\u1956\u195a\u1960r;\uc000\ud835\udcb7mi;\u604fm\u0100;e\u171a\u171cl\u0180;bh\u1968\u1969\u196b\u405c;\u69c5sub;\u67c8\u016c\u1974\u197el\u0100;e\u1979\u197a\u6022t\xbb\u197ap\u0180;Ee\u012f\u1985\u1987;\u6aae\u0100;q\u06dc\u06db\u0ce1\u19a7\0\u19e8\u1a11\u1a15\u1a32\0\u1a37\u1a50\0\0\u1ab4\0\0\u1ac1\0\0\u1b21\u1b2e\u1b4d\u1b52\0\u1bfd\0\u1c0c\u0180cpr\u19ad\u19b2\u19ddute;\u4107\u0300;abcds\u19bf\u19c0\u19c4\u19ca\u19d5\u19d9\u6229nd;\u6a44rcup;\u6a49\u0100au\u19cf\u19d2p;\u6a4bp;\u6a47ot;\u6a40;\uc000\u2229\ufe00\u0100eo\u19e2\u19e5t;\u6041\xee\u0693\u0200aeiu\u19f0\u19fb\u1a01\u1a05\u01f0\u19f5\0\u19f8s;\u6a4don;\u410ddil\u803b\xe7\u40e7rc;\u4109ps\u0100;s\u1a0c\u1a0d\u6a4cm;\u6a50ot;\u410b\u0180dmn\u1a1b\u1a20\u1a26il\u80bb\xb8\u01adptyv;\u69b2t\u8100\xa2;e\u1a2d\u1a2e\u40a2r\xe4\u01b2r;\uc000\ud835\udd20\u0180cei\u1a3d\u1a40\u1a4dy;\u4447ck\u0100;m\u1a47\u1a48\u6713ark\xbb\u1a48;\u43c7r\u0380;Ecefms\u1a5f\u1a60\u1a62\u1a6b\u1aa4\u1aaa\u1aae\u65cb;\u69c3\u0180;el\u1a69\u1a6a\u1a6d\u42c6q;\u6257e\u0261\u1a74\0\0\u1a88rrow\u0100lr\u1a7c\u1a81eft;\u61baight;\u61bb\u0280RSacd\u1a92\u1a94\u1a96\u1a9a\u1a9f\xbb\u0f47;\u64c8st;\u629birc;\u629aash;\u629dnint;\u6a10id;\u6aefcir;\u69c2ubs\u0100;u\u1abb\u1abc\u6663it\xbb\u1abc\u02ec\u1ac7\u1ad4\u1afa\0\u1b0aon\u0100;e\u1acd\u1ace\u403a\u0100;q\xc7\xc6\u026d\u1ad9\0\0\u1ae2a\u0100;t\u1ade\u1adf\u402c;\u4040\u0180;fl\u1ae8\u1ae9\u1aeb\u6201\xee\u1160e\u0100mx\u1af1\u1af6ent\xbb\u1ae9e\xf3\u024d\u01e7\u1afe\0\u1b07\u0100;d\u12bb\u1b02ot;\u6a6dn\xf4\u0246\u0180fry\u1b10\u1b14\u1b17;\uc000\ud835\udd54o\xe4\u0254\u8100\xa9;s\u0155\u1b1dr;\u6117\u0100ao\u1b25\u1b29rr;\u61b5ss;\u6717\u0100cu\u1b32\u1b37r;\uc000\ud835\udcb8\u0100bp\u1b3c\u1b44\u0100;e\u1b41\u1b42\u6acf;\u6ad1\u0100;e\u1b49\u1b4a\u6ad0;\u6ad2dot;\u62ef\u0380delprvw\u1b60\u1b6c\u1b77\u1b82\u1bac\u1bd4\u1bf9arr\u0100lr\u1b68\u1b6a;\u6938;\u6935\u0270\u1b72\0\0\u1b75r;\u62dec;\u62dfarr\u0100;p\u1b7f\u1b80\u61b6;\u693d\u0300;bcdos\u1b8f\u1b90\u1b96\u1ba1\u1ba5\u1ba8\u622arcap;\u6a48\u0100au\u1b9b\u1b9ep;\u6a46p;\u6a4aot;\u628dr;\u6a45;\uc000\u222a\ufe00\u0200alrv\u1bb5\u1bbf\u1bde\u1be3rr\u0100;m\u1bbc\u1bbd\u61b7;\u693cy\u0180evw\u1bc7\u1bd4\u1bd8q\u0270\u1bce\0\0\u1bd2re\xe3\u1b73u\xe3\u1b75ee;\u62ceedge;\u62cfen\u803b\xa4\u40a4earrow\u0100lr\u1bee\u1bf3eft\xbb\u1b80ight\xbb\u1bbde\xe4\u1bdd\u0100ci\u1c01\u1c07onin\xf4\u01f7nt;\u6231lcty;\u632d\u0980AHabcdefhijlorstuwz\u1c38\u1c3b\u1c3f\u1c5d\u1c69\u1c75\u1c8a\u1c9e\u1cac\u1cb7\u1cfb\u1cff\u1d0d\u1d7b\u1d91\u1dab\u1dbb\u1dc6\u1dcdr\xf2\u0381ar;\u6965\u0200glrs\u1c48\u1c4d\u1c52\u1c54ger;\u6020eth;\u6138\xf2\u1133h\u0100;v\u1c5a\u1c5b\u6010\xbb\u090a\u016b\u1c61\u1c67arow;\u690fa\xe3\u0315\u0100ay\u1c6e\u1c73ron;\u410f;\u4434\u0180;ao\u0332\u1c7c\u1c84\u0100gr\u02bf\u1c81r;\u61catseq;\u6a77\u0180glm\u1c91\u1c94\u1c98\u803b\xb0\u40b0ta;\u43b4ptyv;\u69b1\u0100ir\u1ca3\u1ca8sht;\u697f;\uc000\ud835\udd21ar\u0100lr\u1cb3\u1cb5\xbb\u08dc\xbb\u101e\u0280aegsv\u1cc2\u0378\u1cd6\u1cdc\u1ce0m\u0180;os\u0326\u1cca\u1cd4nd\u0100;s\u0326\u1cd1uit;\u6666amma;\u43ddin;\u62f2\u0180;io\u1ce7\u1ce8\u1cf8\u40f7de\u8100\xf7;o\u1ce7\u1cf0ntimes;\u62c7n\xf8\u1cf7cy;\u4452c\u026f\u1d06\0\0\u1d0arn;\u631eop;\u630d\u0280lptuw\u1d18\u1d1d\u1d22\u1d49\u1d55lar;\u4024f;\uc000\ud835\udd55\u0280;emps\u030b\u1d2d\u1d37\u1d3d\u1d42q\u0100;d\u0352\u1d33ot;\u6251inus;\u6238lus;\u6214quare;\u62a1blebarwedg\xe5\xfan\u0180adh\u112e\u1d5d\u1d67ownarrow\xf3\u1c83arpoon\u0100lr\u1d72\u1d76ef\xf4\u1cb4igh\xf4\u1cb6\u0162\u1d7f\u1d85karo\xf7\u0f42\u026f\u1d8a\0\0\u1d8ern;\u631fop;\u630c\u0180cot\u1d98\u1da3\u1da6\u0100ry\u1d9d\u1da1;\uc000\ud835\udcb9;\u4455l;\u69f6rok;\u4111\u0100dr\u1db0\u1db4ot;\u62f1i\u0100;f\u1dba\u1816\u65bf\u0100ah\u1dc0\u1dc3r\xf2\u0429a\xf2\u0fa6angle;\u69a6\u0100ci\u1dd2\u1dd5y;\u445fgrarr;\u67ff\u0900Dacdefglmnopqrstux\u1e01\u1e09\u1e19\u1e38\u0578\u1e3c\u1e49\u1e61\u1e7e\u1ea5\u1eaf\u1ebd\u1ee1\u1f2a\u1f37\u1f44\u1f4e\u1f5a\u0100Do\u1e06\u1d34o\xf4\u1c89\u0100cs\u1e0e\u1e14ute\u803b\xe9\u40e9ter;\u6a6e\u0200aioy\u1e22\u1e27\u1e31\u1e36ron;\u411br\u0100;c\u1e2d\u1e2e\u6256\u803b\xea\u40ealon;\u6255;\u444dot;\u4117\u0100Dr\u1e41\u1e45ot;\u6252;\uc000\ud835\udd22\u0180;rs\u1e50\u1e51\u1e57\u6a9aave\u803b\xe8\u40e8\u0100;d\u1e5c\u1e5d\u6a96ot;\u6a98\u0200;ils\u1e6a\u1e6b\u1e72\u1e74\u6a99nters;\u63e7;\u6113\u0100;d\u1e79\u1e7a\u6a95ot;\u6a97\u0180aps\u1e85\u1e89\u1e97cr;\u4113ty\u0180;sv\u1e92\u1e93\u1e95\u6205et\xbb\u1e93p\u01001;\u1e9d\u1ea4\u0133\u1ea1\u1ea3;\u6004;\u6005\u6003\u0100gs\u1eaa\u1eac;\u414bp;\u6002\u0100gp\u1eb4\u1eb8on;\u4119f;\uc000\ud835\udd56\u0180als\u1ec4\u1ece\u1ed2r\u0100;s\u1eca\u1ecb\u62d5l;\u69e3us;\u6a71i\u0180;lv\u1eda\u1edb\u1edf\u43b5on\xbb\u1edb;\u43f5\u0200csuv\u1eea\u1ef3\u1f0b\u1f23\u0100io\u1eef\u1e31rc\xbb\u1e2e\u0269\u1ef9\0\0\u1efb\xed\u0548ant\u0100gl\u1f02\u1f06tr\xbb\u1e5dess\xbb\u1e7a\u0180aei\u1f12\u1f16\u1f1als;\u403dst;\u625fv\u0100;D\u0235\u1f20D;\u6a78parsl;\u69e5\u0100Da\u1f2f\u1f33ot;\u6253rr;\u6971\u0180cdi\u1f3e\u1f41\u1ef8r;\u612fo\xf4\u0352\u0100ah\u1f49\u1f4b;\u43b7\u803b\xf0\u40f0\u0100mr\u1f53\u1f57l\u803b\xeb\u40ebo;\u60ac\u0180cip\u1f61\u1f64\u1f67l;\u4021s\xf4\u056e\u0100eo\u1f6c\u1f74ctatio\xee\u0559nential\xe5\u0579\u09e1\u1f92\0\u1f9e\0\u1fa1\u1fa7\0\0\u1fc6\u1fcc\0\u1fd3\0\u1fe6\u1fea\u2000\0\u2008\u205allingdotse\xf1\u1e44y;\u4444male;\u6640\u0180ilr\u1fad\u1fb3\u1fc1lig;\u8000\ufb03\u0269\u1fb9\0\0\u1fbdg;\u8000\ufb00ig;\u8000\ufb04;\uc000\ud835\udd23lig;\u8000\ufb01lig;\uc000fj\u0180alt\u1fd9\u1fdc\u1fe1t;\u666dig;\u8000\ufb02ns;\u65b1of;\u4192\u01f0\u1fee\0\u1ff3f;\uc000\ud835\udd57\u0100ak\u05bf\u1ff7\u0100;v\u1ffc\u1ffd\u62d4;\u6ad9artint;\u6a0d\u0100ao\u200c\u2055\u0100cs\u2011\u2052\u03b1\u201a\u2030\u2038\u2045\u2048\0\u2050\u03b2\u2022\u2025\u2027\u202a\u202c\0\u202e\u803b\xbd\u40bd;\u6153\u803b\xbc\u40bc;\u6155;\u6159;\u615b\u01b3\u2034\0\u2036;\u6154;\u6156\u02b4\u203e\u2041\0\0\u2043\u803b\xbe\u40be;\u6157;\u615c5;\u6158\u01b6\u204c\0\u204e;\u615a;\u615d8;\u615el;\u6044wn;\u6322cr;\uc000\ud835\udcbb\u0880Eabcdefgijlnorstv\u2082\u2089\u209f\u20a5\u20b0\u20b4\u20f0\u20f5\u20fa\u20ff\u2103\u2112\u2138\u0317\u213e\u2152\u219e\u0100;l\u064d\u2087;\u6a8c\u0180cmp\u2090\u2095\u209dute;\u41f5ma\u0100;d\u209c\u1cda\u43b3;\u6a86reve;\u411f\u0100iy\u20aa\u20aerc;\u411d;\u4433ot;\u4121\u0200;lqs\u063e\u0642\u20bd\u20c9\u0180;qs\u063e\u064c\u20c4lan\xf4\u0665\u0200;cdl\u0665\u20d2\u20d5\u20e5c;\u6aa9ot\u0100;o\u20dc\u20dd\u6a80\u0100;l\u20e2\u20e3\u6a82;\u6a84\u0100;e\u20ea\u20ed\uc000\u22db\ufe00s;\u6a94r;\uc000\ud835\udd24\u0100;g\u0673\u061bmel;\u6137cy;\u4453\u0200;Eaj\u065a\u210c\u210e\u2110;\u6a92;\u6aa5;\u6aa4\u0200Eaes\u211b\u211d\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6a8arox\xbb\u2124\u0100;q\u212e\u212f\u6a88\u0100;q\u212e\u211bim;\u62e7pf;\uc000\ud835\udd58\u0100ci\u2143\u2146r;\u610am\u0180;el\u066b\u214e\u2150;\u6a8e;\u6a90\u8300>;cdlqr\u05ee\u2160\u216a\u216e\u2173\u2179\u0100ci\u2165\u2167;\u6aa7r;\u6a7aot;\u62d7Par;\u6995uest;\u6a7c\u0280adels\u2184\u216a\u2190\u0656\u219b\u01f0\u2189\0\u218epro\xf8\u209er;\u6978q\u0100lq\u063f\u2196les\xf3\u2088i\xed\u066b\u0100en\u21a3\u21adrtneqq;\uc000\u2269\ufe00\xc5\u21aa\u0500Aabcefkosy\u21c4\u21c7\u21f1\u21f5\u21fa\u2218\u221d\u222f\u2268\u227dr\xf2\u03a0\u0200ilmr\u21d0\u21d4\u21d7\u21dbrs\xf0\u1484f\xbb\u2024il\xf4\u06a9\u0100dr\u21e0\u21e4cy;\u444a\u0180;cw\u08f4\u21eb\u21efir;\u6948;\u61adar;\u610firc;\u4125\u0180alr\u2201\u220e\u2213rts\u0100;u\u2209\u220a\u6665it\xbb\u220alip;\u6026con;\u62b9r;\uc000\ud835\udd25s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223a\u223e\u2243\u225e\u2263rr;\u61fftht;\u623bk\u0100lr\u2249\u2253eftarrow;\u61a9ightarrow;\u61aaf;\uc000\ud835\udd59bar;\u6015\u0180clt\u226f\u2274\u2278r;\uc000\ud835\udcbdas\xe8\u21f4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xbb\u1c5b\u0ae1\u22a3\0\u22aa\0\u22b8\u22c5\u22ce\0\u22d5\u22f3\0\0\u22f8\u2322\u2367\u2362\u237f\0\u2386\u23aa\u23b4cute\u803b\xed\u40ed\u0180;iy\u0771\u22b0\u22b5rc\u803b\xee\u40ee;\u4438\u0100cx\u22bc\u22bfy;\u4435cl\u803b\xa1\u40a1\u0100fr\u039f\u22c9;\uc000\ud835\udd26rave\u803b\xec\u40ec\u0200;ino\u073e\u22dd\u22e9\u22ee\u0100in\u22e2\u22e6nt;\u6a0ct;\u622dfin;\u69dcta;\u6129lig;\u4133\u0180aop\u22fe\u231a\u231d\u0180cgt\u2305\u2308\u2317r;\u412b\u0180elp\u071f\u230f\u2313in\xe5\u078ear\xf4\u0720h;\u4131f;\u62b7ed;\u41b5\u0280;cfot\u04f4\u232c\u2331\u233d\u2341are;\u6105in\u0100;t\u2338\u2339\u621eie;\u69dddo\xf4\u2319\u0280;celp\u0757\u234c\u2350\u235b\u2361al;\u62ba\u0100gr\u2355\u2359er\xf3\u1563\xe3\u234darhk;\u6a17rod;\u6a3c\u0200cgpt\u236f\u2372\u2376\u237by;\u4451on;\u412ff;\uc000\ud835\udd5aa;\u43b9uest\u803b\xbf\u40bf\u0100ci\u238a\u238fr;\uc000\ud835\udcben\u0280;Edsv\u04f4\u239b\u239d\u23a1\u04f3;\u62f9ot;\u62f5\u0100;v\u23a6\u23a7\u62f4;\u62f3\u0100;i\u0777\u23aelde;\u4129\u01eb\u23b8\0\u23bccy;\u4456l\u803b\xef\u40ef\u0300cfmosu\u23cc\u23d7\u23dc\u23e1\u23e7\u23f5\u0100iy\u23d1\u23d5rc;\u4135;\u4439r;\uc000\ud835\udd27ath;\u4237pf;\uc000\ud835\udd5b\u01e3\u23ec\0\u23f1r;\uc000\ud835\udcbfrcy;\u4458kcy;\u4454\u0400acfghjos\u240b\u2416\u2422\u2427\u242d\u2431\u2435\u243bppa\u0100;v\u2413\u2414\u43ba;\u43f0\u0100ey\u241b\u2420dil;\u4137;\u443ar;\uc000\ud835\udd28reen;\u4138cy;\u4445cy;\u445cpf;\uc000\ud835\udd5ccr;\uc000\ud835\udcc0\u0b80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248d\u2491\u250e\u253d\u255a\u2580\u264e\u265e\u2665\u2679\u267d\u269a\u26b2\u26d8\u275d\u2768\u278b\u27c0\u2801\u2812\u0180art\u2477\u247a\u247cr\xf2\u09c6\xf2\u0395ail;\u691barr;\u690e\u0100;g\u0994\u248b;\u6a8bar;\u6962\u0963\u24a5\0\u24aa\0\u24b1\0\0\0\0\0\u24b5\u24ba\0\u24c6\u24c8\u24cd\0\u24f9ute;\u413amptyv;\u69b4ra\xee\u084cbda;\u43bbg\u0180;dl\u088e\u24c1\u24c3;\u6991\xe5\u088e;\u6a85uo\u803b\xab\u40abr\u0400;bfhlpst\u0899\u24de\u24e6\u24e9\u24eb\u24ee\u24f1\u24f5\u0100;f\u089d\u24e3s;\u691fs;\u691d\xeb\u2252p;\u61abl;\u6939im;\u6973l;\u61a2\u0180;ae\u24ff\u2500\u2504\u6aabil;\u6919\u0100;s\u2509\u250a\u6aad;\uc000\u2aad\ufe00\u0180abr\u2515\u2519\u251drr;\u690crk;\u6772\u0100ak\u2522\u252cc\u0100ek\u2528\u252a;\u407b;\u405b\u0100es\u2531\u2533;\u698bl\u0100du\u2539\u253b;\u698f;\u698d\u0200aeuy\u2546\u254b\u2556\u2558ron;\u413e\u0100di\u2550\u2554il;\u413c\xec\u08b0\xe2\u2529;\u443b\u0200cqrs\u2563\u2566\u256d\u257da;\u6936uo\u0100;r\u0e19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694bh;\u61b2\u0280;fgqs\u258b\u258c\u0989\u25f3\u25ff\u6264t\u0280ahlrt\u2598\u25a4\u25b7\u25c2\u25e8rrow\u0100;t\u0899\u25a1a\xe9\u24f6arpoon\u0100du\u25af\u25b4own\xbb\u045ap\xbb\u0966eftarrows;\u61c7ight\u0180ahs\u25cd\u25d6\u25derrow\u0100;s\u08f4\u08a7arpoon\xf3\u0f98quigarro\xf7\u21f0hreetimes;\u62cb\u0180;qs\u258b\u0993\u25falan\xf4\u09ac\u0280;cdgs\u09ac\u260a\u260d\u261d\u2628c;\u6aa8ot\u0100;o\u2614\u2615\u6a7f\u0100;r\u261a\u261b\u6a81;\u6a83\u0100;e\u2622\u2625\uc000\u22da\ufe00s;\u6a93\u0280adegs\u2633\u2639\u263d\u2649\u264bppro\xf8\u24c6ot;\u62d6q\u0100gq\u2643\u2645\xf4\u0989gt\xf2\u248c\xf4\u099bi\xed\u09b2\u0180ilr\u2655\u08e1\u265asht;\u697c;\uc000\ud835\udd29\u0100;E\u099c\u2663;\u6a91\u0161\u2669\u2676r\u0100du\u25b2\u266e\u0100;l\u0965\u2673;\u696alk;\u6584cy;\u4459\u0280;acht\u0a48\u2688\u268b\u2691\u2696r\xf2\u25c1orne\xf2\u1d08ard;\u696bri;\u65fa\u0100io\u269f\u26a4dot;\u4140ust\u0100;a\u26ac\u26ad\u63b0che\xbb\u26ad\u0200Eaes\u26bb\u26bd\u26c9\u26d4;\u6268p\u0100;p\u26c3\u26c4\u6a89rox\xbb\u26c4\u0100;q\u26ce\u26cf\u6a87\u0100;q\u26ce\u26bbim;\u62e6\u0400abnoptwz\u26e9\u26f4\u26f7\u271a\u272f\u2741\u2747\u2750\u0100nr\u26ee\u26f1g;\u67ecr;\u61fdr\xeb\u08c1g\u0180lmr\u26ff\u270d\u2714eft\u0100ar\u09e6\u2707ight\xe1\u09f2apsto;\u67fcight\xe1\u09fdparrow\u0100lr\u2725\u2729ef\xf4\u24edight;\u61ac\u0180afl\u2736\u2739\u273dr;\u6985;\uc000\ud835\udd5dus;\u6a2dimes;\u6a34\u0161\u274b\u274fst;\u6217\xe1\u134e\u0180;ef\u2757\u2758\u1800\u65cange\xbb\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277c\u2785\u2787r\xf2\u08a8orne\xf2\u1d8car\u0100;d\u0f98\u2783;\u696d;\u600eri;\u62bf\u0300achiqt\u2798\u279d\u0a40\u27a2\u27ae\u27bbquo;\u6039r;\uc000\ud835\udcc1m\u0180;eg\u09b2\u27aa\u27ac;\u6a8d;\u6a8f\u0100bu\u252a\u27b3o\u0100;r\u0e1f\u27b9;\u601arok;\u4142\u8400<;cdhilqr\u082b\u27d2\u2639\u27dc\u27e0\u27e5\u27ea\u27f0\u0100ci\u27d7\u27d9;\u6aa6r;\u6a79re\xe5\u25f2mes;\u62c9arr;\u6976uest;\u6a7b\u0100Pi\u27f5\u27f9ar;\u6996\u0180;ef\u2800\u092d\u181b\u65c3r\u0100du\u2807\u280dshar;\u694ahar;\u6966\u0100en\u2817\u2821rtneqq;\uc000\u2268\ufe00\xc5\u281e\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288e\u2893\u28a0\u28a5\u28a8\u28da\u28e2\u28e4\u0a83\u28f3\u2902Dot;\u623a\u0200clpr\u284e\u2852\u2863\u287dr\u803b\xaf\u40af\u0100et\u2857\u2859;\u6642\u0100;e\u285e\u285f\u6720se\xbb\u285f\u0100;s\u103b\u2868to\u0200;dlu\u103b\u2873\u2877\u287bow\xee\u048cef\xf4\u090f\xf0\u13d1ker;\u65ae\u0100oy\u2887\u288cmma;\u6a29;\u443cash;\u6014asuredangle\xbb\u1626r;\uc000\ud835\udd2ao;\u6127\u0180cdn\u28af\u28b4\u28c9ro\u803b\xb5\u40b5\u0200;acd\u1464\u28bd\u28c0\u28c4s\xf4\u16a7ir;\u6af0ot\u80bb\xb7\u01b5us\u0180;bd\u28d2\u1903\u28d3\u6212\u0100;u\u1d3c\u28d8;\u6a2a\u0163\u28de\u28e1p;\u6adb\xf2\u2212\xf0\u0a81\u0100dp\u28e9\u28eeels;\u62a7f;\uc000\ud835\udd5e\u0100ct\u28f8\u28fdr;\uc000\ud835\udcc2pos\xbb\u159d\u0180;lm\u2909\u290a\u290d\u43bctimap;\u62b8\u0c00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297e\u2989\u2998\u29da\u29e9\u2a15\u2a1a\u2a58\u2a5d\u2a83\u2a95\u2aa4\u2aa8\u2b04\u2b07\u2b44\u2b7f\u2bae\u2c34\u2c67\u2c7c\u2ce9\u0100gt\u2947\u294b;\uc000\u22d9\u0338\u0100;v\u2950\u0bcf\uc000\u226b\u20d2\u0180elt\u295a\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61cdightarrow;\u61ce;\uc000\u22d8\u0338\u0100;v\u297b\u0c47\uc000\u226a\u20d2ightarrow;\u61cf\u0100Dd\u298e\u2993ash;\u62afash;\u62ae\u0280bcnpt\u29a3\u29a7\u29ac\u29b1\u29ccla\xbb\u02deute;\u4144g;\uc000\u2220\u20d2\u0280;Eiop\u0d84\u29bc\u29c0\u29c5\u29c8;\uc000\u2a70\u0338d;\uc000\u224b\u0338s;\u4149ro\xf8\u0d84ur\u0100;a\u29d3\u29d4\u666el\u0100;s\u29d3\u0b38\u01f3\u29df\0\u29e3p\u80bb\xa0\u0b37mp\u0100;e\u0bf9\u0c00\u0280aeouy\u29f4\u29fe\u2a03\u2a10\u2a13\u01f0\u29f9\0\u29fb;\u6a43on;\u4148dil;\u4146ng\u0100;d\u0d7e\u2a0aot;\uc000\u2a6d\u0338p;\u6a42;\u443dash;\u6013\u0380;Aadqsx\u0b92\u2a29\u2a2d\u2a3b\u2a41\u2a45\u2a50rr;\u61d7r\u0100hr\u2a33\u2a36k;\u6924\u0100;o\u13f2\u13f0ot;\uc000\u2250\u0338ui\xf6\u0b63\u0100ei\u2a4a\u2a4ear;\u6928\xed\u0b98ist\u0100;s\u0ba0\u0b9fr;\uc000\ud835\udd2b\u0200Eest\u0bc5\u2a66\u2a79\u2a7c\u0180;qs\u0bbc\u2a6d\u0be1\u0180;qs\u0bbc\u0bc5\u2a74lan\xf4\u0be2i\xed\u0bea\u0100;r\u0bb6\u2a81\xbb\u0bb7\u0180Aap\u2a8a\u2a8d\u2a91r\xf2\u2971rr;\u61aear;\u6af2\u0180;sv\u0f8d\u2a9c\u0f8c\u0100;d\u2aa1\u2aa2\u62fc;\u62facy;\u445a\u0380AEadest\u2ab7\u2aba\u2abe\u2ac2\u2ac5\u2af6\u2af9r\xf2\u2966;\uc000\u2266\u0338rr;\u619ar;\u6025\u0200;fqs\u0c3b\u2ace\u2ae3\u2aeft\u0100ar\u2ad4\u2ad9rro\xf7\u2ac1ightarro\xf7\u2a90\u0180;qs\u0c3b\u2aba\u2aealan\xf4\u0c55\u0100;s\u0c55\u2af4\xbb\u0c36i\xed\u0c5d\u0100;r\u0c35\u2afei\u0100;e\u0c1a\u0c25i\xe4\u0d90\u0100pt\u2b0c\u2b11f;\uc000\ud835\udd5f\u8180\xac;in\u2b19\u2b1a\u2b36\u40acn\u0200;Edv\u0b89\u2b24\u2b28\u2b2e;\uc000\u22f9\u0338ot;\uc000\u22f5\u0338\u01e1\u0b89\u2b33\u2b35;\u62f7;\u62f6i\u0100;v\u0cb8\u2b3c\u01e1\u0cb8\u2b41\u2b43;\u62fe;\u62fd\u0180aor\u2b4b\u2b63\u2b69r\u0200;ast\u0b7b\u2b55\u2b5a\u2b5flle\xec\u0b7bl;\uc000\u2afd\u20e5;\uc000\u2202\u0338lint;\u6a14\u0180;ce\u0c92\u2b70\u2b73u\xe5\u0ca5\u0100;c\u0c98\u2b78\u0100;e\u0c92\u2b7d\xf1\u0c98\u0200Aait\u2b88\u2b8b\u2b9d\u2ba7r\xf2\u2988rr\u0180;cw\u2b94\u2b95\u2b99\u619b;\uc000\u2933\u0338;\uc000\u219d\u0338ghtarrow\xbb\u2b95ri\u0100;e\u0ccb\u0cd6\u0380chimpqu\u2bbd\u2bcd\u2bd9\u2b04\u0b78\u2be4\u2bef\u0200;cer\u0d32\u2bc6\u0d37\u2bc9u\xe5\u0d45;\uc000\ud835\udcc3ort\u026d\u2b05\0\0\u2bd6ar\xe1\u2b56m\u0100;e\u0d6e\u2bdf\u0100;q\u0d74\u0d73su\u0100bp\u2beb\u2bed\xe5\u0cf8\xe5\u0d0b\u0180bcp\u2bf6\u2c11\u2c19\u0200;Ees\u2bff\u2c00\u0d22\u2c04\u6284;\uc000\u2ac5\u0338et\u0100;e\u0d1b\u2c0bq\u0100;q\u0d23\u2c00c\u0100;e\u0d32\u2c17\xf1\u0d38\u0200;Ees\u2c22\u2c23\u0d5f\u2c27\u6285;\uc000\u2ac6\u0338et\u0100;e\u0d58\u2c2eq\u0100;q\u0d60\u2c23\u0200gilr\u2c3d\u2c3f\u2c45\u2c47\xec\u0bd7lde\u803b\xf1\u40f1\xe7\u0c43iangle\u0100lr\u2c52\u2c5ceft\u0100;e\u0c1a\u2c5a\xf1\u0c26ight\u0100;e\u0ccb\u2c65\xf1\u0cd7\u0100;m\u2c6c\u2c6d\u43bd\u0180;es\u2c74\u2c75\u2c79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2c8f\u2c94\u2c99\u2c9e\u2ca3\u2cb0\u2cb6\u2cd3\u2ce3ash;\u62adarr;\u6904p;\uc000\u224d\u20d2ash;\u62ac\u0100et\u2ca8\u2cac;\uc000\u2265\u20d2;\uc000>\u20d2nfin;\u69de\u0180Aet\u2cbd\u2cc1\u2cc5rr;\u6902;\uc000\u2264\u20d2\u0100;r\u2cca\u2ccd\uc000<\u20d2ie;\uc000\u22b4\u20d2\u0100At\u2cd8\u2cdcrr;\u6903rie;\uc000\u22b5\u20d2im;\uc000\u223c\u20d2\u0180Aan\u2cf0\u2cf4\u2d02rr;\u61d6r\u0100hr\u2cfa\u2cfdk;\u6923\u0100;o\u13e7\u13e5ear;\u6927\u1253\u1a95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2d2d\0\u2d38\u2d48\u2d60\u2d65\u2d72\u2d84\u1b07\0\0\u2d8d\u2dab\0\u2dc8\u2dce\0\u2ddc\u2e19\u2e2b\u2e3e\u2e43\u0100cs\u2d31\u1a97ute\u803b\xf3\u40f3\u0100iy\u2d3c\u2d45r\u0100;c\u1a9e\u2d42\u803b\xf4\u40f4;\u443e\u0280abios\u1aa0\u2d52\u2d57\u01c8\u2d5alac;\u4151v;\u6a38old;\u69bclig;\u4153\u0100cr\u2d69\u2d6dir;\u69bf;\uc000\ud835\udd2c\u036f\u2d79\0\0\u2d7c\0\u2d82n;\u42dbave\u803b\xf2\u40f2;\u69c1\u0100bm\u2d88\u0df4ar;\u69b5\u0200acit\u2d95\u2d98\u2da5\u2da8r\xf2\u1a80\u0100ir\u2d9d\u2da0r;\u69beoss;\u69bbn\xe5\u0e52;\u69c0\u0180aei\u2db1\u2db5\u2db9cr;\u414dga;\u43c9\u0180cdn\u2dc0\u2dc5\u01cdron;\u43bf;\u69b6pf;\uc000\ud835\udd60\u0180ael\u2dd4\u2dd7\u01d2r;\u69b7rp;\u69b9\u0380;adiosv\u2dea\u2deb\u2dee\u2e08\u2e0d\u2e10\u2e16\u6228r\xf2\u1a86\u0200;efm\u2df7\u2df8\u2e02\u2e05\u6a5dr\u0100;o\u2dfe\u2dff\u6134f\xbb\u2dff\u803b\xaa\u40aa\u803b\xba\u40bagof;\u62b6r;\u6a56lope;\u6a57;\u6a5b\u0180clo\u2e1f\u2e21\u2e27\xf2\u2e01ash\u803b\xf8\u40f8l;\u6298i\u016c\u2e2f\u2e34de\u803b\xf5\u40f5es\u0100;a\u01db\u2e3as;\u6a36ml\u803b\xf6\u40f6bar;\u633d\u0ae1\u2e5e\0\u2e7d\0\u2e80\u2e9d\0\u2ea2\u2eb9\0\0\u2ecb\u0e9c\0\u2f13\0\0\u2f2b\u2fbc\0\u2fc8r\u0200;ast\u0403\u2e67\u2e72\u0e85\u8100\xb6;l\u2e6d\u2e6e\u40b6le\xec\u0403\u0269\u2e78\0\0\u2e7bm;\u6af3;\u6afdy;\u443fr\u0280cimpt\u2e8b\u2e8f\u2e93\u1865\u2e97nt;\u4025od;\u402eil;\u6030enk;\u6031r;\uc000\ud835\udd2d\u0180imo\u2ea8\u2eb0\u2eb4\u0100;v\u2ead\u2eae\u43c6;\u43d5ma\xf4\u0a76ne;\u660e\u0180;tv\u2ebf\u2ec0\u2ec8\u43c0chfork\xbb\u1ffd;\u43d6\u0100au\u2ecf\u2edfn\u0100ck\u2ed5\u2eddk\u0100;h\u21f4\u2edb;\u610e\xf6\u21f4s\u0480;abcdemst\u2ef3\u2ef4\u1908\u2ef9\u2efd\u2f04\u2f06\u2f0a\u2f0e\u402bcir;\u6a23ir;\u6a22\u0100ou\u1d40\u2f02;\u6a25;\u6a72n\u80bb\xb1\u0e9dim;\u6a26wo;\u6a27\u0180ipu\u2f19\u2f20\u2f25ntint;\u6a15f;\uc000\ud835\udd61nd\u803b\xa3\u40a3\u0500;Eaceinosu\u0ec8\u2f3f\u2f41\u2f44\u2f47\u2f81\u2f89\u2f92\u2f7e\u2fb6;\u6ab3p;\u6ab7u\xe5\u0ed9\u0100;c\u0ece\u2f4c\u0300;acens\u0ec8\u2f59\u2f5f\u2f66\u2f68\u2f7eppro\xf8\u2f43urlye\xf1\u0ed9\xf1\u0ece\u0180aes\u2f6f\u2f76\u2f7approx;\u6ab9qq;\u6ab5im;\u62e8i\xed\u0edfme\u0100;s\u2f88\u0eae\u6032\u0180Eas\u2f78\u2f90\u2f7a\xf0\u2f75\u0180dfp\u0eec\u2f99\u2faf\u0180als\u2fa0\u2fa5\u2faalar;\u632eine;\u6312urf;\u6313\u0100;t\u0efb\u2fb4\xef\u0efbrel;\u62b0\u0100ci\u2fc0\u2fc5r;\uc000\ud835\udcc5;\u43c8ncsp;\u6008\u0300fiopsu\u2fda\u22e2\u2fdf\u2fe5\u2feb\u2ff1r;\uc000\ud835\udd2epf;\uc000\ud835\udd62rime;\u6057cr;\uc000\ud835\udcc6\u0180aeo\u2ff8\u3009\u3013t\u0100ei\u2ffe\u3005rnion\xf3\u06b0nt;\u6a16st\u0100;e\u3010\u3011\u403f\xf1\u1f19\xf4\u0f14\u0a80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30e0\u310e\u312b\u3147\u3162\u3172\u318e\u3206\u3215\u3224\u3229\u3258\u326e\u3272\u3290\u32b0\u32b7\u0180art\u3047\u304a\u304cr\xf2\u10b3\xf2\u03ddail;\u691car\xf2\u1c65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307f\u308f\u3094\u30cc\u0100eu\u306d\u3071;\uc000\u223d\u0331te;\u4155i\xe3\u116emptyv;\u69b3g\u0200;del\u0fd1\u3089\u308b\u308d;\u6992;\u69a5\xe5\u0fd1uo\u803b\xbb\u40bbr\u0580;abcfhlpstw\u0fdc\u30ac\u30af\u30b7\u30b9\u30bc\u30be\u30c0\u30c3\u30c7\u30cap;\u6975\u0100;f\u0fe0\u30b4s;\u6920;\u6933s;\u691e\xeb\u225d\xf0\u272el;\u6945im;\u6974l;\u61a3;\u619d\u0100ai\u30d1\u30d5il;\u691ao\u0100;n\u30db\u30dc\u6236al\xf3\u0f1e\u0180abr\u30e7\u30ea\u30eer\xf2\u17e5rk;\u6773\u0100ak\u30f3\u30fdc\u0100ek\u30f9\u30fb;\u407d;\u405d\u0100es\u3102\u3104;\u698cl\u0100du\u310a\u310c;\u698e;\u6990\u0200aeuy\u3117\u311c\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xec\u0ff2\xe2\u30fa;\u4440\u0200clqs\u3134\u3137\u313d\u3144a;\u6937dhar;\u6969uo\u0100;r\u020e\u020dh;\u61b3\u0180acg\u314e\u315f\u0f44l\u0200;ips\u0f78\u3158\u315b\u109cn\xe5\u10bbar\xf4\u0fa9t;\u65ad\u0180ilr\u3169\u1023\u316esht;\u697d;\uc000\ud835\udd2f\u0100ao\u3177\u3186r\u0100du\u317d\u317f\xbb\u047b\u0100;l\u1091\u3184;\u696c\u0100;v\u318b\u318c\u43c1;\u43f1\u0180gns\u3195\u31f9\u31fcht\u0300ahlrst\u31a4\u31b0\u31c2\u31d8\u31e4\u31eerrow\u0100;t\u0fdc\u31ada\xe9\u30c8arpoon\u0100du\u31bb\u31bfow\xee\u317ep\xbb\u1092eft\u0100ah\u31ca\u31d0rrow\xf3\u0feaarpoon\xf3\u0551ightarrows;\u61c9quigarro\xf7\u30cbhreetimes;\u62ccg;\u42daingdotse\xf1\u1f32\u0180ahm\u320d\u3210\u3213r\xf2\u0feaa\xf2\u0551;\u600foust\u0100;a\u321e\u321f\u63b1che\xbb\u321fmid;\u6aee\u0200abpt\u3232\u323d\u3240\u3252\u0100nr\u3237\u323ag;\u67edr;\u61fer\xeb\u1003\u0180afl\u3247\u324a\u324er;\u6986;\uc000\ud835\udd63us;\u6a2eimes;\u6a35\u0100ap\u325d\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6a12ar\xf2\u31e3\u0200achq\u327b\u3280\u10bc\u3285quo;\u603ar;\uc000\ud835\udcc7\u0100bu\u30fb\u328ao\u0100;r\u0214\u0213\u0180hir\u3297\u329b\u32a0re\xe5\u31f8mes;\u62cai\u0200;efl\u32aa\u1059\u1821\u32ab\u65b9tri;\u69celuhar;\u6968;\u611e\u0d61\u32d5\u32db\u32df\u332c\u3338\u3371\0\u337a\u33a4\0\0\u33ec\u33f0\0\u3428\u3448\u345a\u34ad\u34b1\u34ca\u34f1\0\u3616\0\0\u3633cute;\u415bqu\xef\u27ba\u0500;Eaceinpsy\u11ed\u32f3\u32f5\u32ff\u3302\u330b\u330f\u331f\u3326\u3329;\u6ab4\u01f0\u32fa\0\u32fc;\u6ab8on;\u4161u\xe5\u11fe\u0100;d\u11f3\u3307il;\u415frc;\u415d\u0180Eas\u3316\u3318\u331b;\u6ab6p;\u6abaim;\u62e9olint;\u6a13i\xed\u1204;\u4441ot\u0180;be\u3334\u1d47\u3335\u62c5;\u6a66\u0380Aacmstx\u3346\u334a\u3357\u335b\u335e\u3363\u336drr;\u61d8r\u0100hr\u3350\u3352\xeb\u2228\u0100;o\u0a36\u0a34t\u803b\xa7\u40a7i;\u403bwar;\u6929m\u0100in\u3369\xf0nu\xf3\xf1t;\u6736r\u0100;o\u3376\u2055\uc000\ud835\udd30\u0200acoy\u3382\u3386\u3391\u33a0rp;\u666f\u0100hy\u338b\u338fcy;\u4449;\u4448rt\u026d\u3399\0\0\u339ci\xe4\u1464ara\xec\u2e6f\u803b\xad\u40ad\u0100gm\u33a8\u33b4ma\u0180;fv\u33b1\u33b2\u33b2\u43c3;\u43c2\u0400;deglnpr\u12ab\u33c5\u33c9\u33ce\u33d6\u33de\u33e1\u33e6ot;\u6a6a\u0100;q\u12b1\u12b0\u0100;E\u33d3\u33d4\u6a9e;\u6aa0\u0100;E\u33db\u33dc\u6a9d;\u6a9fe;\u6246lus;\u6a24arr;\u6972ar\xf2\u113d\u0200aeit\u33f8\u3408\u340f\u3417\u0100ls\u33fd\u3404lsetm\xe9\u336ahp;\u6a33parsl;\u69e4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341c\u341d\u6aaa\u0100;s\u3422\u3423\u6aac;\uc000\u2aac\ufe00\u0180flp\u342e\u3433\u3442tcy;\u444c\u0100;b\u3438\u3439\u402f\u0100;a\u343e\u343f\u69c4r;\u633ff;\uc000\ud835\udd64a\u0100dr\u344d\u0402es\u0100;u\u3454\u3455\u6660it\xbb\u3455\u0180csu\u3460\u3479\u349f\u0100au\u3465\u346fp\u0100;s\u1188\u346b;\uc000\u2293\ufe00p\u0100;s\u11b4\u3475;\uc000\u2294\ufe00u\u0100bp\u347f\u348f\u0180;es\u1197\u119c\u3486et\u0100;e\u1197\u348d\xf1\u119d\u0180;es\u11a8\u11ad\u3496et\u0100;e\u11a8\u349d\xf1\u11ae\u0180;af\u117b\u34a6\u05b0r\u0165\u34ab\u05b1\xbb\u117car\xf2\u1148\u0200cemt\u34b9\u34be\u34c2\u34c5r;\uc000\ud835\udcc8tm\xee\xf1i\xec\u3415ar\xe6\u11be\u0100ar\u34ce\u34d5r\u0100;f\u34d4\u17bf\u6606\u0100an\u34da\u34edight\u0100ep\u34e3\u34eapsilo\xee\u1ee0h\xe9\u2eafs\xbb\u2852\u0280bcmnp\u34fb\u355e\u1209\u358b\u358e\u0480;Edemnprs\u350e\u350f\u3511\u3515\u351e\u3523\u352c\u3531\u3536\u6282;\u6ac5ot;\u6abd\u0100;d\u11da\u351aot;\u6ac3ult;\u6ac1\u0100Ee\u3528\u352a;\u6acb;\u628alus;\u6abfarr;\u6979\u0180eiu\u353d\u3552\u3555t\u0180;en\u350e\u3545\u354bq\u0100;q\u11da\u350feq\u0100;q\u352b\u3528m;\u6ac7\u0100bp\u355a\u355c;\u6ad5;\u6ad3c\u0300;acens\u11ed\u356c\u3572\u3579\u357b\u3326ppro\xf8\u32faurlye\xf1\u11fe\xf1\u11f3\u0180aes\u3582\u3588\u331bppro\xf8\u331aq\xf1\u3317g;\u666a\u0680123;Edehlmnps\u35a9\u35ac\u35af\u121c\u35b2\u35b4\u35c0\u35c9\u35d5\u35da\u35df\u35e8\u35ed\u803b\xb9\u40b9\u803b\xb2\u40b2\u803b\xb3\u40b3;\u6ac6\u0100os\u35b9\u35bct;\u6abeub;\u6ad8\u0100;d\u1222\u35c5ot;\u6ac4s\u0100ou\u35cf\u35d2l;\u67c9b;\u6ad7arr;\u697bult;\u6ac2\u0100Ee\u35e4\u35e6;\u6acc;\u628blus;\u6ac0\u0180eiu\u35f4\u3609\u360ct\u0180;en\u121c\u35fc\u3602q\u0100;q\u1222\u35b2eq\u0100;q\u35e7\u35e4m;\u6ac8\u0100bp\u3611\u3613;\u6ad4;\u6ad6\u0180Aan\u361c\u3620\u362drr;\u61d9r\u0100hr\u3626\u3628\xeb\u222e\u0100;o\u0a2b\u0a29war;\u692alig\u803b\xdf\u40df\u0be1\u3651\u365d\u3660\u12ce\u3673\u3679\0\u367e\u36c2\0\0\0\0\0\u36db\u3703\0\u3709\u376c\0\0\0\u3787\u0272\u3656\0\0\u365bget;\u6316;\u43c4r\xeb\u0e5f\u0180aey\u3666\u366b\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uc000\ud835\udd31\u0200eiko\u3686\u369d\u36b5\u36bc\u01f2\u368b\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369b\u43b8ym;\u43d1\u0100cn\u36a2\u36b2k\u0100as\u36a8\u36aeppro\xf8\u12c1im\xbb\u12acs\xf0\u129e\u0100as\u36ba\u36ae\xf0\u12c1rn\u803b\xfe\u40fe\u01ec\u031f\u36c6\u22e7es\u8180\xd7;bd\u36cf\u36d0\u36d8\u40d7\u0100;a\u190f\u36d5r;\u6a31;\u6a30\u0180eps\u36e1\u36e3\u3700\xe1\u2a4d\u0200;bcf\u0486\u36ec\u36f0\u36f4ot;\u6336ir;\u6af1\u0100;o\u36f9\u36fc\uc000\ud835\udd65rk;\u6ada\xe1\u3362rime;\u6034\u0180aip\u370f\u3712\u3764d\xe5\u1248\u0380adempst\u3721\u374d\u3740\u3751\u3757\u375c\u375fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65b5own\xbb\u1dbbeft\u0100;e\u2800\u373e\xf1\u092e;\u625cight\u0100;e\u32aa\u374b\xf1\u105aot;\u65ecinus;\u6a3alus;\u6a39b;\u69cdime;\u6a3bezium;\u63e2\u0180cht\u3772\u377d\u3781\u0100ry\u3777\u377b;\uc000\ud835\udcc9;\u4446cy;\u445brok;\u4167\u0100io\u378b\u378ex\xf4\u1777head\u0100lr\u3797\u37a0eftarro\xf7\u084fightarrow\xbb\u0f5d\u0900AHabcdfghlmoprstuw\u37d0\u37d3\u37d7\u37e4\u37f0\u37fc\u380e\u381c\u3823\u3834\u3851\u385d\u386b\u38a9\u38cc\u38d2\u38ea\u38f6r\xf2\u03edar;\u6963\u0100cr\u37dc\u37e2ute\u803b\xfa\u40fa\xf2\u1150r\u01e3\u37ea\0\u37edy;\u445eve;\u416d\u0100iy\u37f5\u37farc\u803b\xfb\u40fb;\u4443\u0180abh\u3803\u3806\u380br\xf2\u13adlac;\u4171a\xf2\u13c3\u0100ir\u3813\u3818sht;\u697e;\uc000\ud835\udd32rave\u803b\xf9\u40f9\u0161\u3827\u3831r\u0100lr\u382c\u382e\xbb\u0957\xbb\u1083lk;\u6580\u0100ct\u3839\u384d\u026f\u383f\0\0\u384arn\u0100;e\u3845\u3846\u631cr\xbb\u3846op;\u630fri;\u65f8\u0100al\u3856\u385acr;\u416b\u80bb\xa8\u0349\u0100gp\u3862\u3866on;\u4173f;\uc000\ud835\udd66\u0300adhlsu\u114b\u3878\u387d\u1372\u3891\u38a0own\xe1\u13b3arpoon\u0100lr\u3888\u388cef\xf4\u382digh\xf4\u382fi\u0180;hl\u3899\u389a\u389c\u43c5\xbb\u13faon\xbb\u389aparrows;\u61c8\u0180cit\u38b0\u38c4\u38c8\u026f\u38b6\0\0\u38c1rn\u0100;e\u38bc\u38bd\u631dr\xbb\u38bdop;\u630eng;\u416fri;\u65f9cr;\uc000\ud835\udcca\u0180dir\u38d9\u38dd\u38e2ot;\u62f0lde;\u4169i\u0100;f\u3730\u38e8\xbb\u1813\u0100am\u38ef\u38f2r\xf2\u38a8l\u803b\xfc\u40fcangle;\u69a7\u0780ABDacdeflnoprsz\u391c\u391f\u3929\u392d\u39b5\u39b8\u39bd\u39df\u39e4\u39e8\u39f3\u39f9\u39fd\u3a01\u3a20r\xf2\u03f7ar\u0100;v\u3926\u3927\u6ae8;\u6ae9as\xe8\u03e1\u0100nr\u3932\u3937grt;\u699c\u0380eknprst\u34e3\u3946\u394b\u3952\u395d\u3964\u3996app\xe1\u2415othin\xe7\u1e96\u0180hir\u34eb\u2ec8\u3959op\xf4\u2fb5\u0100;h\u13b7\u3962\xef\u318d\u0100iu\u3969\u396dgm\xe1\u33b3\u0100bp\u3972\u3984setneq\u0100;q\u397d\u3980\uc000\u228a\ufe00;\uc000\u2acb\ufe00setneq\u0100;q\u398f\u3992\uc000\u228b\ufe00;\uc000\u2acc\ufe00\u0100hr\u399b\u399fet\xe1\u369ciangle\u0100lr\u39aa\u39afeft\xbb\u0925ight\xbb\u1051y;\u4432ash\xbb\u1036\u0180elr\u39c4\u39d2\u39d7\u0180;be\u2dea\u39cb\u39cfar;\u62bbq;\u625alip;\u62ee\u0100bt\u39dc\u1468a\xf2\u1469r;\uc000\ud835\udd33tr\xe9\u39aesu\u0100bp\u39ef\u39f1\xbb\u0d1c\xbb\u0d59pf;\uc000\ud835\udd67ro\xf0\u0efbtr\xe9\u39b4\u0100cu\u3a06\u3a0br;\uc000\ud835\udccb\u0100bp\u3a10\u3a18n\u0100Ee\u3980\u3a16\xbb\u397en\u0100Ee\u3992\u3a1e\xbb\u3990igzag;\u699a\u0380cefoprs\u3a36\u3a3b\u3a56\u3a5b\u3a54\u3a61\u3a6airc;\u4175\u0100di\u3a40\u3a51\u0100bg\u3a45\u3a49ar;\u6a5fe\u0100;q\u15fa\u3a4f;\u6259erp;\u6118r;\uc000\ud835\udd34pf;\uc000\ud835\udd68\u0100;e\u1479\u3a66at\xe8\u1479cr;\uc000\ud835\udccc\u0ae3\u178e\u3a87\0\u3a8b\0\u3a90\u3a9b\0\0\u3a9d\u3aa8\u3aab\u3aaf\0\0\u3ac3\u3ace\0\u3ad8\u17dc\u17dftr\xe9\u17d1r;\uc000\ud835\udd35\u0100Aa\u3a94\u3a97r\xf2\u03c3r\xf2\u09f6;\u43be\u0100Aa\u3aa1\u3aa4r\xf2\u03b8r\xf2\u09eba\xf0\u2713is;\u62fb\u0180dpt\u17a4\u3ab5\u3abe\u0100fl\u3aba\u17a9;\uc000\ud835\udd69im\xe5\u17b2\u0100Aa\u3ac7\u3acar\xf2\u03cer\xf2\u0a01\u0100cq\u3ad2\u17b8r;\uc000\ud835\udccd\u0100pt\u17d6\u3adcr\xe9\u17d4\u0400acefiosu\u3af0\u3afd\u3b08\u3b0c\u3b11\u3b15\u3b1b\u3b21c\u0100uy\u3af6\u3afbte\u803b\xfd\u40fd;\u444f\u0100iy\u3b02\u3b06rc;\u4177;\u444bn\u803b\xa5\u40a5r;\uc000\ud835\udd36cy;\u4457pf;\uc000\ud835\udd6acr;\uc000\ud835\udcce\u0100cm\u3b26\u3b29y;\u444el\u803b\xff\u40ff\u0500acdefhiosw\u3b42\u3b48\u3b54\u3b58\u3b64\u3b69\u3b6d\u3b74\u3b7a\u3b80cute;\u417a\u0100ay\u3b4d\u3b52ron;\u417e;\u4437ot;\u417c\u0100et\u3b5d\u3b61tr\xe6\u155fa;\u43b6r;\uc000\ud835\udd37cy;\u4436grarr;\u61ddpf;\uc000\ud835\udd6bcr;\uc000\ud835\udccf\u0100jn\u3b85\u3b87;\u600dj;\u600c"
+ .split("")
+ .map((c) => c.charCodeAt(0)));
+
+// Generated using scripts/write-decode-map.ts
+new Uint16Array(
+// prettier-ignore
+"\u0200aglq\t\x15\x18\x1b\u026d\x0f\0\0\x12p;\u4026os;\u4027t;\u403et;\u403cuot;\u4022"
+ .split("")
+ .map((c) => c.charCodeAt(0)));
+
+var CharCodes;
+(function (CharCodes) {
+ CharCodes[CharCodes["NUM"] = 35] = "NUM";
+ CharCodes[CharCodes["SEMI"] = 59] = "SEMI";
+ CharCodes[CharCodes["ZERO"] = 48] = "ZERO";
+ CharCodes[CharCodes["NINE"] = 57] = "NINE";
+ CharCodes[CharCodes["LOWER_A"] = 97] = "LOWER_A";
+ CharCodes[CharCodes["LOWER_F"] = 102] = "LOWER_F";
+ CharCodes[CharCodes["LOWER_X"] = 120] = "LOWER_X";
+ /** Bit that needs to be set to convert an upper case ASCII character to lower case */
+ CharCodes[CharCodes["To_LOWER_BIT"] = 32] = "To_LOWER_BIT";
+})(CharCodes || (CharCodes = {}));
+var BinTrieFlags;
+(function (BinTrieFlags) {
+ BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
+ BinTrieFlags[BinTrieFlags["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH";
+ BinTrieFlags[BinTrieFlags["JUMP_TABLE"] = 127] = "JUMP_TABLE";
+})(BinTrieFlags || (BinTrieFlags = {}));
+function determineBranch(decodeTree, current, nodeIdx, char) {
+ const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
+ const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
+ // Case 1: Single branch encoded in jump offset
+ if (branchCount === 0) {
+ return jumpOffset !== 0 && char === jumpOffset ? nodeIdx : -1;
+ }
+ // Case 2: Multiple branches encoded in jump table
+ if (jumpOffset) {
+ const value = char - jumpOffset;
+ return value < 0 || value >= branchCount
+ ? -1
+ : decodeTree[nodeIdx + value] - 1;
+ }
+ // Case 3: Multiple branches encoded in dictionary
+ // Binary search for the character.
+ let lo = nodeIdx;
+ let hi = lo + branchCount - 1;
+ while (lo <= hi) {
+ const mid = (lo + hi) >>> 1;
+ const midVal = decodeTree[mid];
+ if (midVal < char) {
+ lo = mid + 1;
+ }
+ else if (midVal > char) {
+ hi = mid - 1;
+ }
+ else {
+ return decodeTree[mid + branchCount];
+ }
+ }
+ return -1;
+}
+
+/** All valid namespaces in HTML. */
+var NS;
+(function (NS) {
+ NS["HTML"] = "http://www.w3.org/1999/xhtml";
+ NS["MATHML"] = "http://www.w3.org/1998/Math/MathML";
+ NS["SVG"] = "http://www.w3.org/2000/svg";
+ NS["XLINK"] = "http://www.w3.org/1999/xlink";
+ NS["XML"] = "http://www.w3.org/XML/1998/namespace";
+ NS["XMLNS"] = "http://www.w3.org/2000/xmlns/";
+})(NS = NS || (NS = {}));
+var ATTRS;
+(function (ATTRS) {
+ ATTRS["TYPE"] = "type";
+ ATTRS["ACTION"] = "action";
+ ATTRS["ENCODING"] = "encoding";
+ ATTRS["PROMPT"] = "prompt";
+ ATTRS["NAME"] = "name";
+ ATTRS["COLOR"] = "color";
+ ATTRS["FACE"] = "face";
+ ATTRS["SIZE"] = "size";
+})(ATTRS = ATTRS || (ATTRS = {}));
+/**
+ * The mode of the document.
+ *
+ * @see {@link https://dom.spec.whatwg.org/#concept-document-limited-quirks}
+ */
+var DOCUMENT_MODE;
+(function (DOCUMENT_MODE) {
+ DOCUMENT_MODE["NO_QUIRKS"] = "no-quirks";
+ DOCUMENT_MODE["QUIRKS"] = "quirks";
+ DOCUMENT_MODE["LIMITED_QUIRKS"] = "limited-quirks";
+})(DOCUMENT_MODE = DOCUMENT_MODE || (DOCUMENT_MODE = {}));
+var TAG_NAMES;
+(function (TAG_NAMES) {
+ TAG_NAMES["A"] = "a";
+ TAG_NAMES["ADDRESS"] = "address";
+ TAG_NAMES["ANNOTATION_XML"] = "annotation-xml";
+ TAG_NAMES["APPLET"] = "applet";
+ TAG_NAMES["AREA"] = "area";
+ TAG_NAMES["ARTICLE"] = "article";
+ TAG_NAMES["ASIDE"] = "aside";
+ TAG_NAMES["B"] = "b";
+ TAG_NAMES["BASE"] = "base";
+ TAG_NAMES["BASEFONT"] = "basefont";
+ TAG_NAMES["BGSOUND"] = "bgsound";
+ TAG_NAMES["BIG"] = "big";
+ TAG_NAMES["BLOCKQUOTE"] = "blockquote";
+ TAG_NAMES["BODY"] = "body";
+ TAG_NAMES["BR"] = "br";
+ TAG_NAMES["BUTTON"] = "button";
+ TAG_NAMES["CAPTION"] = "caption";
+ TAG_NAMES["CENTER"] = "center";
+ TAG_NAMES["CODE"] = "code";
+ TAG_NAMES["COL"] = "col";
+ TAG_NAMES["COLGROUP"] = "colgroup";
+ TAG_NAMES["DD"] = "dd";
+ TAG_NAMES["DESC"] = "desc";
+ TAG_NAMES["DETAILS"] = "details";
+ TAG_NAMES["DIALOG"] = "dialog";
+ TAG_NAMES["DIR"] = "dir";
+ TAG_NAMES["DIV"] = "div";
+ TAG_NAMES["DL"] = "dl";
+ TAG_NAMES["DT"] = "dt";
+ TAG_NAMES["EM"] = "em";
+ TAG_NAMES["EMBED"] = "embed";
+ TAG_NAMES["FIELDSET"] = "fieldset";
+ TAG_NAMES["FIGCAPTION"] = "figcaption";
+ TAG_NAMES["FIGURE"] = "figure";
+ TAG_NAMES["FONT"] = "font";
+ TAG_NAMES["FOOTER"] = "footer";
+ TAG_NAMES["FOREIGN_OBJECT"] = "foreignObject";
+ TAG_NAMES["FORM"] = "form";
+ TAG_NAMES["FRAME"] = "frame";
+ TAG_NAMES["FRAMESET"] = "frameset";
+ TAG_NAMES["H1"] = "h1";
+ TAG_NAMES["H2"] = "h2";
+ TAG_NAMES["H3"] = "h3";
+ TAG_NAMES["H4"] = "h4";
+ TAG_NAMES["H5"] = "h5";
+ TAG_NAMES["H6"] = "h6";
+ TAG_NAMES["HEAD"] = "head";
+ TAG_NAMES["HEADER"] = "header";
+ TAG_NAMES["HGROUP"] = "hgroup";
+ TAG_NAMES["HR"] = "hr";
+ TAG_NAMES["HTML"] = "html";
+ TAG_NAMES["I"] = "i";
+ TAG_NAMES["IMG"] = "img";
+ TAG_NAMES["IMAGE"] = "image";
+ TAG_NAMES["INPUT"] = "input";
+ TAG_NAMES["IFRAME"] = "iframe";
+ TAG_NAMES["KEYGEN"] = "keygen";
+ TAG_NAMES["LABEL"] = "label";
+ TAG_NAMES["LI"] = "li";
+ TAG_NAMES["LINK"] = "link";
+ TAG_NAMES["LISTING"] = "listing";
+ TAG_NAMES["MAIN"] = "main";
+ TAG_NAMES["MALIGNMARK"] = "malignmark";
+ TAG_NAMES["MARQUEE"] = "marquee";
+ TAG_NAMES["MATH"] = "math";
+ TAG_NAMES["MENU"] = "menu";
+ TAG_NAMES["META"] = "meta";
+ TAG_NAMES["MGLYPH"] = "mglyph";
+ TAG_NAMES["MI"] = "mi";
+ TAG_NAMES["MO"] = "mo";
+ TAG_NAMES["MN"] = "mn";
+ TAG_NAMES["MS"] = "ms";
+ TAG_NAMES["MTEXT"] = "mtext";
+ TAG_NAMES["NAV"] = "nav";
+ TAG_NAMES["NOBR"] = "nobr";
+ TAG_NAMES["NOFRAMES"] = "noframes";
+ TAG_NAMES["NOEMBED"] = "noembed";
+ TAG_NAMES["NOSCRIPT"] = "noscript";
+ TAG_NAMES["OBJECT"] = "object";
+ TAG_NAMES["OL"] = "ol";
+ TAG_NAMES["OPTGROUP"] = "optgroup";
+ TAG_NAMES["OPTION"] = "option";
+ TAG_NAMES["P"] = "p";
+ TAG_NAMES["PARAM"] = "param";
+ TAG_NAMES["PLAINTEXT"] = "plaintext";
+ TAG_NAMES["PRE"] = "pre";
+ TAG_NAMES["RB"] = "rb";
+ TAG_NAMES["RP"] = "rp";
+ TAG_NAMES["RT"] = "rt";
+ TAG_NAMES["RTC"] = "rtc";
+ TAG_NAMES["RUBY"] = "ruby";
+ TAG_NAMES["S"] = "s";
+ TAG_NAMES["SCRIPT"] = "script";
+ TAG_NAMES["SECTION"] = "section";
+ TAG_NAMES["SELECT"] = "select";
+ TAG_NAMES["SOURCE"] = "source";
+ TAG_NAMES["SMALL"] = "small";
+ TAG_NAMES["SPAN"] = "span";
+ TAG_NAMES["STRIKE"] = "strike";
+ TAG_NAMES["STRONG"] = "strong";
+ TAG_NAMES["STYLE"] = "style";
+ TAG_NAMES["SUB"] = "sub";
+ TAG_NAMES["SUMMARY"] = "summary";
+ TAG_NAMES["SUP"] = "sup";
+ TAG_NAMES["TABLE"] = "table";
+ TAG_NAMES["TBODY"] = "tbody";
+ TAG_NAMES["TEMPLATE"] = "template";
+ TAG_NAMES["TEXTAREA"] = "textarea";
+ TAG_NAMES["TFOOT"] = "tfoot";
+ TAG_NAMES["TD"] = "td";
+ TAG_NAMES["TH"] = "th";
+ TAG_NAMES["THEAD"] = "thead";
+ TAG_NAMES["TITLE"] = "title";
+ TAG_NAMES["TR"] = "tr";
+ TAG_NAMES["TRACK"] = "track";
+ TAG_NAMES["TT"] = "tt";
+ TAG_NAMES["U"] = "u";
+ TAG_NAMES["UL"] = "ul";
+ TAG_NAMES["SVG"] = "svg";
+ TAG_NAMES["VAR"] = "var";
+ TAG_NAMES["WBR"] = "wbr";
+ TAG_NAMES["XMP"] = "xmp";
+})(TAG_NAMES = TAG_NAMES || (TAG_NAMES = {}));
+/**
+ * Tag IDs are numeric IDs for known tag names.
+ *
+ * We use tag IDs to improve the performance of tag name comparisons.
+ */
+var TAG_ID;
+(function (TAG_ID) {
+ TAG_ID[TAG_ID["UNKNOWN"] = 0] = "UNKNOWN";
+ TAG_ID[TAG_ID["A"] = 1] = "A";
+ TAG_ID[TAG_ID["ADDRESS"] = 2] = "ADDRESS";
+ TAG_ID[TAG_ID["ANNOTATION_XML"] = 3] = "ANNOTATION_XML";
+ TAG_ID[TAG_ID["APPLET"] = 4] = "APPLET";
+ TAG_ID[TAG_ID["AREA"] = 5] = "AREA";
+ TAG_ID[TAG_ID["ARTICLE"] = 6] = "ARTICLE";
+ TAG_ID[TAG_ID["ASIDE"] = 7] = "ASIDE";
+ TAG_ID[TAG_ID["B"] = 8] = "B";
+ TAG_ID[TAG_ID["BASE"] = 9] = "BASE";
+ TAG_ID[TAG_ID["BASEFONT"] = 10] = "BASEFONT";
+ TAG_ID[TAG_ID["BGSOUND"] = 11] = "BGSOUND";
+ TAG_ID[TAG_ID["BIG"] = 12] = "BIG";
+ TAG_ID[TAG_ID["BLOCKQUOTE"] = 13] = "BLOCKQUOTE";
+ TAG_ID[TAG_ID["BODY"] = 14] = "BODY";
+ TAG_ID[TAG_ID["BR"] = 15] = "BR";
+ TAG_ID[TAG_ID["BUTTON"] = 16] = "BUTTON";
+ TAG_ID[TAG_ID["CAPTION"] = 17] = "CAPTION";
+ TAG_ID[TAG_ID["CENTER"] = 18] = "CENTER";
+ TAG_ID[TAG_ID["CODE"] = 19] = "CODE";
+ TAG_ID[TAG_ID["COL"] = 20] = "COL";
+ TAG_ID[TAG_ID["COLGROUP"] = 21] = "COLGROUP";
+ TAG_ID[TAG_ID["DD"] = 22] = "DD";
+ TAG_ID[TAG_ID["DESC"] = 23] = "DESC";
+ TAG_ID[TAG_ID["DETAILS"] = 24] = "DETAILS";
+ TAG_ID[TAG_ID["DIALOG"] = 25] = "DIALOG";
+ TAG_ID[TAG_ID["DIR"] = 26] = "DIR";
+ TAG_ID[TAG_ID["DIV"] = 27] = "DIV";
+ TAG_ID[TAG_ID["DL"] = 28] = "DL";
+ TAG_ID[TAG_ID["DT"] = 29] = "DT";
+ TAG_ID[TAG_ID["EM"] = 30] = "EM";
+ TAG_ID[TAG_ID["EMBED"] = 31] = "EMBED";
+ TAG_ID[TAG_ID["FIELDSET"] = 32] = "FIELDSET";
+ TAG_ID[TAG_ID["FIGCAPTION"] = 33] = "FIGCAPTION";
+ TAG_ID[TAG_ID["FIGURE"] = 34] = "FIGURE";
+ TAG_ID[TAG_ID["FONT"] = 35] = "FONT";
+ TAG_ID[TAG_ID["FOOTER"] = 36] = "FOOTER";
+ TAG_ID[TAG_ID["FOREIGN_OBJECT"] = 37] = "FOREIGN_OBJECT";
+ TAG_ID[TAG_ID["FORM"] = 38] = "FORM";
+ TAG_ID[TAG_ID["FRAME"] = 39] = "FRAME";
+ TAG_ID[TAG_ID["FRAMESET"] = 40] = "FRAMESET";
+ TAG_ID[TAG_ID["H1"] = 41] = "H1";
+ TAG_ID[TAG_ID["H2"] = 42] = "H2";
+ TAG_ID[TAG_ID["H3"] = 43] = "H3";
+ TAG_ID[TAG_ID["H4"] = 44] = "H4";
+ TAG_ID[TAG_ID["H5"] = 45] = "H5";
+ TAG_ID[TAG_ID["H6"] = 46] = "H6";
+ TAG_ID[TAG_ID["HEAD"] = 47] = "HEAD";
+ TAG_ID[TAG_ID["HEADER"] = 48] = "HEADER";
+ TAG_ID[TAG_ID["HGROUP"] = 49] = "HGROUP";
+ TAG_ID[TAG_ID["HR"] = 50] = "HR";
+ TAG_ID[TAG_ID["HTML"] = 51] = "HTML";
+ TAG_ID[TAG_ID["I"] = 52] = "I";
+ TAG_ID[TAG_ID["IMG"] = 53] = "IMG";
+ TAG_ID[TAG_ID["IMAGE"] = 54] = "IMAGE";
+ TAG_ID[TAG_ID["INPUT"] = 55] = "INPUT";
+ TAG_ID[TAG_ID["IFRAME"] = 56] = "IFRAME";
+ TAG_ID[TAG_ID["KEYGEN"] = 57] = "KEYGEN";
+ TAG_ID[TAG_ID["LABEL"] = 58] = "LABEL";
+ TAG_ID[TAG_ID["LI"] = 59] = "LI";
+ TAG_ID[TAG_ID["LINK"] = 60] = "LINK";
+ TAG_ID[TAG_ID["LISTING"] = 61] = "LISTING";
+ TAG_ID[TAG_ID["MAIN"] = 62] = "MAIN";
+ TAG_ID[TAG_ID["MALIGNMARK"] = 63] = "MALIGNMARK";
+ TAG_ID[TAG_ID["MARQUEE"] = 64] = "MARQUEE";
+ TAG_ID[TAG_ID["MATH"] = 65] = "MATH";
+ TAG_ID[TAG_ID["MENU"] = 66] = "MENU";
+ TAG_ID[TAG_ID["META"] = 67] = "META";
+ TAG_ID[TAG_ID["MGLYPH"] = 68] = "MGLYPH";
+ TAG_ID[TAG_ID["MI"] = 69] = "MI";
+ TAG_ID[TAG_ID["MO"] = 70] = "MO";
+ TAG_ID[TAG_ID["MN"] = 71] = "MN";
+ TAG_ID[TAG_ID["MS"] = 72] = "MS";
+ TAG_ID[TAG_ID["MTEXT"] = 73] = "MTEXT";
+ TAG_ID[TAG_ID["NAV"] = 74] = "NAV";
+ TAG_ID[TAG_ID["NOBR"] = 75] = "NOBR";
+ TAG_ID[TAG_ID["NOFRAMES"] = 76] = "NOFRAMES";
+ TAG_ID[TAG_ID["NOEMBED"] = 77] = "NOEMBED";
+ TAG_ID[TAG_ID["NOSCRIPT"] = 78] = "NOSCRIPT";
+ TAG_ID[TAG_ID["OBJECT"] = 79] = "OBJECT";
+ TAG_ID[TAG_ID["OL"] = 80] = "OL";
+ TAG_ID[TAG_ID["OPTGROUP"] = 81] = "OPTGROUP";
+ TAG_ID[TAG_ID["OPTION"] = 82] = "OPTION";
+ TAG_ID[TAG_ID["P"] = 83] = "P";
+ TAG_ID[TAG_ID["PARAM"] = 84] = "PARAM";
+ TAG_ID[TAG_ID["PLAINTEXT"] = 85] = "PLAINTEXT";
+ TAG_ID[TAG_ID["PRE"] = 86] = "PRE";
+ TAG_ID[TAG_ID["RB"] = 87] = "RB";
+ TAG_ID[TAG_ID["RP"] = 88] = "RP";
+ TAG_ID[TAG_ID["RT"] = 89] = "RT";
+ TAG_ID[TAG_ID["RTC"] = 90] = "RTC";
+ TAG_ID[TAG_ID["RUBY"] = 91] = "RUBY";
+ TAG_ID[TAG_ID["S"] = 92] = "S";
+ TAG_ID[TAG_ID["SCRIPT"] = 93] = "SCRIPT";
+ TAG_ID[TAG_ID["SECTION"] = 94] = "SECTION";
+ TAG_ID[TAG_ID["SELECT"] = 95] = "SELECT";
+ TAG_ID[TAG_ID["SOURCE"] = 96] = "SOURCE";
+ TAG_ID[TAG_ID["SMALL"] = 97] = "SMALL";
+ TAG_ID[TAG_ID["SPAN"] = 98] = "SPAN";
+ TAG_ID[TAG_ID["STRIKE"] = 99] = "STRIKE";
+ TAG_ID[TAG_ID["STRONG"] = 100] = "STRONG";
+ TAG_ID[TAG_ID["STYLE"] = 101] = "STYLE";
+ TAG_ID[TAG_ID["SUB"] = 102] = "SUB";
+ TAG_ID[TAG_ID["SUMMARY"] = 103] = "SUMMARY";
+ TAG_ID[TAG_ID["SUP"] = 104] = "SUP";
+ TAG_ID[TAG_ID["TABLE"] = 105] = "TABLE";
+ TAG_ID[TAG_ID["TBODY"] = 106] = "TBODY";
+ TAG_ID[TAG_ID["TEMPLATE"] = 107] = "TEMPLATE";
+ TAG_ID[TAG_ID["TEXTAREA"] = 108] = "TEXTAREA";
+ TAG_ID[TAG_ID["TFOOT"] = 109] = "TFOOT";
+ TAG_ID[TAG_ID["TD"] = 110] = "TD";
+ TAG_ID[TAG_ID["TH"] = 111] = "TH";
+ TAG_ID[TAG_ID["THEAD"] = 112] = "THEAD";
+ TAG_ID[TAG_ID["TITLE"] = 113] = "TITLE";
+ TAG_ID[TAG_ID["TR"] = 114] = "TR";
+ TAG_ID[TAG_ID["TRACK"] = 115] = "TRACK";
+ TAG_ID[TAG_ID["TT"] = 116] = "TT";
+ TAG_ID[TAG_ID["U"] = 117] = "U";
+ TAG_ID[TAG_ID["UL"] = 118] = "UL";
+ TAG_ID[TAG_ID["SVG"] = 119] = "SVG";
+ TAG_ID[TAG_ID["VAR"] = 120] = "VAR";
+ TAG_ID[TAG_ID["WBR"] = 121] = "WBR";
+ TAG_ID[TAG_ID["XMP"] = 122] = "XMP";
+})(TAG_ID = TAG_ID || (TAG_ID = {}));
+const TAG_NAME_TO_ID = new Map([
+ [TAG_NAMES.A, TAG_ID.A],
+ [TAG_NAMES.ADDRESS, TAG_ID.ADDRESS],
+ [TAG_NAMES.ANNOTATION_XML, TAG_ID.ANNOTATION_XML],
+ [TAG_NAMES.APPLET, TAG_ID.APPLET],
+ [TAG_NAMES.AREA, TAG_ID.AREA],
+ [TAG_NAMES.ARTICLE, TAG_ID.ARTICLE],
+ [TAG_NAMES.ASIDE, TAG_ID.ASIDE],
+ [TAG_NAMES.B, TAG_ID.B],
+ [TAG_NAMES.BASE, TAG_ID.BASE],
+ [TAG_NAMES.BASEFONT, TAG_ID.BASEFONT],
+ [TAG_NAMES.BGSOUND, TAG_ID.BGSOUND],
+ [TAG_NAMES.BIG, TAG_ID.BIG],
+ [TAG_NAMES.BLOCKQUOTE, TAG_ID.BLOCKQUOTE],
+ [TAG_NAMES.BODY, TAG_ID.BODY],
+ [TAG_NAMES.BR, TAG_ID.BR],
+ [TAG_NAMES.BUTTON, TAG_ID.BUTTON],
+ [TAG_NAMES.CAPTION, TAG_ID.CAPTION],
+ [TAG_NAMES.CENTER, TAG_ID.CENTER],
+ [TAG_NAMES.CODE, TAG_ID.CODE],
+ [TAG_NAMES.COL, TAG_ID.COL],
+ [TAG_NAMES.COLGROUP, TAG_ID.COLGROUP],
+ [TAG_NAMES.DD, TAG_ID.DD],
+ [TAG_NAMES.DESC, TAG_ID.DESC],
+ [TAG_NAMES.DETAILS, TAG_ID.DETAILS],
+ [TAG_NAMES.DIALOG, TAG_ID.DIALOG],
+ [TAG_NAMES.DIR, TAG_ID.DIR],
+ [TAG_NAMES.DIV, TAG_ID.DIV],
+ [TAG_NAMES.DL, TAG_ID.DL],
+ [TAG_NAMES.DT, TAG_ID.DT],
+ [TAG_NAMES.EM, TAG_ID.EM],
+ [TAG_NAMES.EMBED, TAG_ID.EMBED],
+ [TAG_NAMES.FIELDSET, TAG_ID.FIELDSET],
+ [TAG_NAMES.FIGCAPTION, TAG_ID.FIGCAPTION],
+ [TAG_NAMES.FIGURE, TAG_ID.FIGURE],
+ [TAG_NAMES.FONT, TAG_ID.FONT],
+ [TAG_NAMES.FOOTER, TAG_ID.FOOTER],
+ [TAG_NAMES.FOREIGN_OBJECT, TAG_ID.FOREIGN_OBJECT],
+ [TAG_NAMES.FORM, TAG_ID.FORM],
+ [TAG_NAMES.FRAME, TAG_ID.FRAME],
+ [TAG_NAMES.FRAMESET, TAG_ID.FRAMESET],
+ [TAG_NAMES.H1, TAG_ID.H1],
+ [TAG_NAMES.H2, TAG_ID.H2],
+ [TAG_NAMES.H3, TAG_ID.H3],
+ [TAG_NAMES.H4, TAG_ID.H4],
+ [TAG_NAMES.H5, TAG_ID.H5],
+ [TAG_NAMES.H6, TAG_ID.H6],
+ [TAG_NAMES.HEAD, TAG_ID.HEAD],
+ [TAG_NAMES.HEADER, TAG_ID.HEADER],
+ [TAG_NAMES.HGROUP, TAG_ID.HGROUP],
+ [TAG_NAMES.HR, TAG_ID.HR],
+ [TAG_NAMES.HTML, TAG_ID.HTML],
+ [TAG_NAMES.I, TAG_ID.I],
+ [TAG_NAMES.IMG, TAG_ID.IMG],
+ [TAG_NAMES.IMAGE, TAG_ID.IMAGE],
+ [TAG_NAMES.INPUT, TAG_ID.INPUT],
+ [TAG_NAMES.IFRAME, TAG_ID.IFRAME],
+ [TAG_NAMES.KEYGEN, TAG_ID.KEYGEN],
+ [TAG_NAMES.LABEL, TAG_ID.LABEL],
+ [TAG_NAMES.LI, TAG_ID.LI],
+ [TAG_NAMES.LINK, TAG_ID.LINK],
+ [TAG_NAMES.LISTING, TAG_ID.LISTING],
+ [TAG_NAMES.MAIN, TAG_ID.MAIN],
+ [TAG_NAMES.MALIGNMARK, TAG_ID.MALIGNMARK],
+ [TAG_NAMES.MARQUEE, TAG_ID.MARQUEE],
+ [TAG_NAMES.MATH, TAG_ID.MATH],
+ [TAG_NAMES.MENU, TAG_ID.MENU],
+ [TAG_NAMES.META, TAG_ID.META],
+ [TAG_NAMES.MGLYPH, TAG_ID.MGLYPH],
+ [TAG_NAMES.MI, TAG_ID.MI],
+ [TAG_NAMES.MO, TAG_ID.MO],
+ [TAG_NAMES.MN, TAG_ID.MN],
+ [TAG_NAMES.MS, TAG_ID.MS],
+ [TAG_NAMES.MTEXT, TAG_ID.MTEXT],
+ [TAG_NAMES.NAV, TAG_ID.NAV],
+ [TAG_NAMES.NOBR, TAG_ID.NOBR],
+ [TAG_NAMES.NOFRAMES, TAG_ID.NOFRAMES],
+ [TAG_NAMES.NOEMBED, TAG_ID.NOEMBED],
+ [TAG_NAMES.NOSCRIPT, TAG_ID.NOSCRIPT],
+ [TAG_NAMES.OBJECT, TAG_ID.OBJECT],
+ [TAG_NAMES.OL, TAG_ID.OL],
+ [TAG_NAMES.OPTGROUP, TAG_ID.OPTGROUP],
+ [TAG_NAMES.OPTION, TAG_ID.OPTION],
+ [TAG_NAMES.P, TAG_ID.P],
+ [TAG_NAMES.PARAM, TAG_ID.PARAM],
+ [TAG_NAMES.PLAINTEXT, TAG_ID.PLAINTEXT],
+ [TAG_NAMES.PRE, TAG_ID.PRE],
+ [TAG_NAMES.RB, TAG_ID.RB],
+ [TAG_NAMES.RP, TAG_ID.RP],
+ [TAG_NAMES.RT, TAG_ID.RT],
+ [TAG_NAMES.RTC, TAG_ID.RTC],
+ [TAG_NAMES.RUBY, TAG_ID.RUBY],
+ [TAG_NAMES.S, TAG_ID.S],
+ [TAG_NAMES.SCRIPT, TAG_ID.SCRIPT],
+ [TAG_NAMES.SECTION, TAG_ID.SECTION],
+ [TAG_NAMES.SELECT, TAG_ID.SELECT],
+ [TAG_NAMES.SOURCE, TAG_ID.SOURCE],
+ [TAG_NAMES.SMALL, TAG_ID.SMALL],
+ [TAG_NAMES.SPAN, TAG_ID.SPAN],
+ [TAG_NAMES.STRIKE, TAG_ID.STRIKE],
+ [TAG_NAMES.STRONG, TAG_ID.STRONG],
+ [TAG_NAMES.STYLE, TAG_ID.STYLE],
+ [TAG_NAMES.SUB, TAG_ID.SUB],
+ [TAG_NAMES.SUMMARY, TAG_ID.SUMMARY],
+ [TAG_NAMES.SUP, TAG_ID.SUP],
+ [TAG_NAMES.TABLE, TAG_ID.TABLE],
+ [TAG_NAMES.TBODY, TAG_ID.TBODY],
+ [TAG_NAMES.TEMPLATE, TAG_ID.TEMPLATE],
+ [TAG_NAMES.TEXTAREA, TAG_ID.TEXTAREA],
+ [TAG_NAMES.TFOOT, TAG_ID.TFOOT],
+ [TAG_NAMES.TD, TAG_ID.TD],
+ [TAG_NAMES.TH, TAG_ID.TH],
+ [TAG_NAMES.THEAD, TAG_ID.THEAD],
+ [TAG_NAMES.TITLE, TAG_ID.TITLE],
+ [TAG_NAMES.TR, TAG_ID.TR],
+ [TAG_NAMES.TRACK, TAG_ID.TRACK],
+ [TAG_NAMES.TT, TAG_ID.TT],
+ [TAG_NAMES.U, TAG_ID.U],
+ [TAG_NAMES.UL, TAG_ID.UL],
+ [TAG_NAMES.SVG, TAG_ID.SVG],
+ [TAG_NAMES.VAR, TAG_ID.VAR],
+ [TAG_NAMES.WBR, TAG_ID.WBR],
+ [TAG_NAMES.XMP, TAG_ID.XMP],
+]);
+function getTagID(tagName) {
+ var _a;
+ return (_a = TAG_NAME_TO_ID.get(tagName)) !== null && _a !== void 0 ? _a : TAG_ID.UNKNOWN;
+}
+const $ = TAG_ID;
+const SPECIAL_ELEMENTS = {
+ [NS.HTML]: new Set([
+ $.ADDRESS,
+ $.APPLET,
+ $.AREA,
+ $.ARTICLE,
+ $.ASIDE,
+ $.BASE,
+ $.BASEFONT,
+ $.BGSOUND,
+ $.BLOCKQUOTE,
+ $.BODY,
+ $.BR,
+ $.BUTTON,
+ $.CAPTION,
+ $.CENTER,
+ $.COL,
+ $.COLGROUP,
+ $.DD,
+ $.DETAILS,
+ $.DIR,
+ $.DIV,
+ $.DL,
+ $.DT,
+ $.EMBED,
+ $.FIELDSET,
+ $.FIGCAPTION,
+ $.FIGURE,
+ $.FOOTER,
+ $.FORM,
+ $.FRAME,
+ $.FRAMESET,
+ $.H1,
+ $.H2,
+ $.H3,
+ $.H4,
+ $.H5,
+ $.H6,
+ $.HEAD,
+ $.HEADER,
+ $.HGROUP,
+ $.HR,
+ $.HTML,
+ $.IFRAME,
+ $.IMG,
+ $.INPUT,
+ $.LI,
+ $.LINK,
+ $.LISTING,
+ $.MAIN,
+ $.MARQUEE,
+ $.MENU,
+ $.META,
+ $.NAV,
+ $.NOEMBED,
+ $.NOFRAMES,
+ $.NOSCRIPT,
+ $.OBJECT,
+ $.OL,
+ $.P,
+ $.PARAM,
+ $.PLAINTEXT,
+ $.PRE,
+ $.SCRIPT,
+ $.SECTION,
+ $.SELECT,
+ $.SOURCE,
+ $.STYLE,
+ $.SUMMARY,
+ $.TABLE,
+ $.TBODY,
+ $.TD,
+ $.TEMPLATE,
+ $.TEXTAREA,
+ $.TFOOT,
+ $.TH,
+ $.THEAD,
+ $.TITLE,
+ $.TR,
+ $.TRACK,
+ $.UL,
+ $.WBR,
+ $.XMP,
+ ]),
+ [NS.MATHML]: new Set([$.MI, $.MO, $.MN, $.MS, $.MTEXT, $.ANNOTATION_XML]),
+ [NS.SVG]: new Set([$.TITLE, $.FOREIGN_OBJECT, $.DESC]),
+ [NS.XLINK]: new Set(),
+ [NS.XML]: new Set(),
+ [NS.XMLNS]: new Set(),
+};
+function isNumberedHeader(tn) {
+ return tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6;
+}
+
+//C1 Unicode control character reference replacements
+const C1_CONTROLS_REFERENCE_REPLACEMENTS = new Map([
+ [0x80, 8364],
+ [0x82, 8218],
+ [0x83, 402],
+ [0x84, 8222],
+ [0x85, 8230],
+ [0x86, 8224],
+ [0x87, 8225],
+ [0x88, 710],
+ [0x89, 8240],
+ [0x8a, 352],
+ [0x8b, 8249],
+ [0x8c, 338],
+ [0x8e, 381],
+ [0x91, 8216],
+ [0x92, 8217],
+ [0x93, 8220],
+ [0x94, 8221],
+ [0x95, 8226],
+ [0x96, 8211],
+ [0x97, 8212],
+ [0x98, 732],
+ [0x99, 8482],
+ [0x9a, 353],
+ [0x9b, 8250],
+ [0x9c, 339],
+ [0x9e, 382],
+ [0x9f, 376],
+]);
+//States
+var State;
+(function (State) {
+ State[State["DATA"] = 0] = "DATA";
+ State[State["RCDATA"] = 1] = "RCDATA";
+ State[State["RAWTEXT"] = 2] = "RAWTEXT";
+ State[State["SCRIPT_DATA"] = 3] = "SCRIPT_DATA";
+ State[State["PLAINTEXT"] = 4] = "PLAINTEXT";
+ State[State["TAG_OPEN"] = 5] = "TAG_OPEN";
+ State[State["END_TAG_OPEN"] = 6] = "END_TAG_OPEN";
+ State[State["TAG_NAME"] = 7] = "TAG_NAME";
+ State[State["RCDATA_LESS_THAN_SIGN"] = 8] = "RCDATA_LESS_THAN_SIGN";
+ State[State["RCDATA_END_TAG_OPEN"] = 9] = "RCDATA_END_TAG_OPEN";
+ State[State["RCDATA_END_TAG_NAME"] = 10] = "RCDATA_END_TAG_NAME";
+ State[State["RAWTEXT_LESS_THAN_SIGN"] = 11] = "RAWTEXT_LESS_THAN_SIGN";
+ State[State["RAWTEXT_END_TAG_OPEN"] = 12] = "RAWTEXT_END_TAG_OPEN";
+ State[State["RAWTEXT_END_TAG_NAME"] = 13] = "RAWTEXT_END_TAG_NAME";
+ State[State["SCRIPT_DATA_LESS_THAN_SIGN"] = 14] = "SCRIPT_DATA_LESS_THAN_SIGN";
+ State[State["SCRIPT_DATA_END_TAG_OPEN"] = 15] = "SCRIPT_DATA_END_TAG_OPEN";
+ State[State["SCRIPT_DATA_END_TAG_NAME"] = 16] = "SCRIPT_DATA_END_TAG_NAME";
+ State[State["SCRIPT_DATA_ESCAPE_START"] = 17] = "SCRIPT_DATA_ESCAPE_START";
+ State[State["SCRIPT_DATA_ESCAPE_START_DASH"] = 18] = "SCRIPT_DATA_ESCAPE_START_DASH";
+ State[State["SCRIPT_DATA_ESCAPED"] = 19] = "SCRIPT_DATA_ESCAPED";
+ State[State["SCRIPT_DATA_ESCAPED_DASH"] = 20] = "SCRIPT_DATA_ESCAPED_DASH";
+ State[State["SCRIPT_DATA_ESCAPED_DASH_DASH"] = 21] = "SCRIPT_DATA_ESCAPED_DASH_DASH";
+ State[State["SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN"] = 22] = "SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN";
+ State[State["SCRIPT_DATA_ESCAPED_END_TAG_OPEN"] = 23] = "SCRIPT_DATA_ESCAPED_END_TAG_OPEN";
+ State[State["SCRIPT_DATA_ESCAPED_END_TAG_NAME"] = 24] = "SCRIPT_DATA_ESCAPED_END_TAG_NAME";
+ State[State["SCRIPT_DATA_DOUBLE_ESCAPE_START"] = 25] = "SCRIPT_DATA_DOUBLE_ESCAPE_START";
+ State[State["SCRIPT_DATA_DOUBLE_ESCAPED"] = 26] = "SCRIPT_DATA_DOUBLE_ESCAPED";
+ State[State["SCRIPT_DATA_DOUBLE_ESCAPED_DASH"] = 27] = "SCRIPT_DATA_DOUBLE_ESCAPED_DASH";
+ State[State["SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH"] = 28] = "SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH";
+ State[State["SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN"] = 29] = "SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN";
+ State[State["SCRIPT_DATA_DOUBLE_ESCAPE_END"] = 30] = "SCRIPT_DATA_DOUBLE_ESCAPE_END";
+ State[State["BEFORE_ATTRIBUTE_NAME"] = 31] = "BEFORE_ATTRIBUTE_NAME";
+ State[State["ATTRIBUTE_NAME"] = 32] = "ATTRIBUTE_NAME";
+ State[State["AFTER_ATTRIBUTE_NAME"] = 33] = "AFTER_ATTRIBUTE_NAME";
+ State[State["BEFORE_ATTRIBUTE_VALUE"] = 34] = "BEFORE_ATTRIBUTE_VALUE";
+ State[State["ATTRIBUTE_VALUE_DOUBLE_QUOTED"] = 35] = "ATTRIBUTE_VALUE_DOUBLE_QUOTED";
+ State[State["ATTRIBUTE_VALUE_SINGLE_QUOTED"] = 36] = "ATTRIBUTE_VALUE_SINGLE_QUOTED";
+ State[State["ATTRIBUTE_VALUE_UNQUOTED"] = 37] = "ATTRIBUTE_VALUE_UNQUOTED";
+ State[State["AFTER_ATTRIBUTE_VALUE_QUOTED"] = 38] = "AFTER_ATTRIBUTE_VALUE_QUOTED";
+ State[State["SELF_CLOSING_START_TAG"] = 39] = "SELF_CLOSING_START_TAG";
+ State[State["BOGUS_COMMENT"] = 40] = "BOGUS_COMMENT";
+ State[State["MARKUP_DECLARATION_OPEN"] = 41] = "MARKUP_DECLARATION_OPEN";
+ State[State["COMMENT_START"] = 42] = "COMMENT_START";
+ State[State["COMMENT_START_DASH"] = 43] = "COMMENT_START_DASH";
+ State[State["COMMENT"] = 44] = "COMMENT";
+ State[State["COMMENT_LESS_THAN_SIGN"] = 45] = "COMMENT_LESS_THAN_SIGN";
+ State[State["COMMENT_LESS_THAN_SIGN_BANG"] = 46] = "COMMENT_LESS_THAN_SIGN_BANG";
+ State[State["COMMENT_LESS_THAN_SIGN_BANG_DASH"] = 47] = "COMMENT_LESS_THAN_SIGN_BANG_DASH";
+ State[State["COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH"] = 48] = "COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH";
+ State[State["COMMENT_END_DASH"] = 49] = "COMMENT_END_DASH";
+ State[State["COMMENT_END"] = 50] = "COMMENT_END";
+ State[State["COMMENT_END_BANG"] = 51] = "COMMENT_END_BANG";
+ State[State["DOCTYPE"] = 52] = "DOCTYPE";
+ State[State["BEFORE_DOCTYPE_NAME"] = 53] = "BEFORE_DOCTYPE_NAME";
+ State[State["DOCTYPE_NAME"] = 54] = "DOCTYPE_NAME";
+ State[State["AFTER_DOCTYPE_NAME"] = 55] = "AFTER_DOCTYPE_NAME";
+ State[State["AFTER_DOCTYPE_PUBLIC_KEYWORD"] = 56] = "AFTER_DOCTYPE_PUBLIC_KEYWORD";
+ State[State["BEFORE_DOCTYPE_PUBLIC_IDENTIFIER"] = 57] = "BEFORE_DOCTYPE_PUBLIC_IDENTIFIER";
+ State[State["DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED"] = 58] = "DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED";
+ State[State["DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED"] = 59] = "DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED";
+ State[State["AFTER_DOCTYPE_PUBLIC_IDENTIFIER"] = 60] = "AFTER_DOCTYPE_PUBLIC_IDENTIFIER";
+ State[State["BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS"] = 61] = "BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS";
+ State[State["AFTER_DOCTYPE_SYSTEM_KEYWORD"] = 62] = "AFTER_DOCTYPE_SYSTEM_KEYWORD";
+ State[State["BEFORE_DOCTYPE_SYSTEM_IDENTIFIER"] = 63] = "BEFORE_DOCTYPE_SYSTEM_IDENTIFIER";
+ State[State["DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED"] = 64] = "DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED";
+ State[State["DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED"] = 65] = "DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED";
+ State[State["AFTER_DOCTYPE_SYSTEM_IDENTIFIER"] = 66] = "AFTER_DOCTYPE_SYSTEM_IDENTIFIER";
+ State[State["BOGUS_DOCTYPE"] = 67] = "BOGUS_DOCTYPE";
+ State[State["CDATA_SECTION"] = 68] = "CDATA_SECTION";
+ State[State["CDATA_SECTION_BRACKET"] = 69] = "CDATA_SECTION_BRACKET";
+ State[State["CDATA_SECTION_END"] = 70] = "CDATA_SECTION_END";
+ State[State["CHARACTER_REFERENCE"] = 71] = "CHARACTER_REFERENCE";
+ State[State["NAMED_CHARACTER_REFERENCE"] = 72] = "NAMED_CHARACTER_REFERENCE";
+ State[State["AMBIGUOUS_AMPERSAND"] = 73] = "AMBIGUOUS_AMPERSAND";
+ State[State["NUMERIC_CHARACTER_REFERENCE"] = 74] = "NUMERIC_CHARACTER_REFERENCE";
+ State[State["HEXADEMICAL_CHARACTER_REFERENCE_START"] = 75] = "HEXADEMICAL_CHARACTER_REFERENCE_START";
+ State[State["HEXADEMICAL_CHARACTER_REFERENCE"] = 76] = "HEXADEMICAL_CHARACTER_REFERENCE";
+ State[State["DECIMAL_CHARACTER_REFERENCE"] = 77] = "DECIMAL_CHARACTER_REFERENCE";
+ State[State["NUMERIC_CHARACTER_REFERENCE_END"] = 78] = "NUMERIC_CHARACTER_REFERENCE_END";
+})(State || (State = {}));
+//Tokenizer initial states for different modes
+const TokenizerMode = {
+ DATA: State.DATA,
+ RCDATA: State.RCDATA,
+ RAWTEXT: State.RAWTEXT,
+ SCRIPT_DATA: State.SCRIPT_DATA,
+ PLAINTEXT: State.PLAINTEXT,
+ CDATA_SECTION: State.CDATA_SECTION,
+};
+//Utils
+//OPTIMIZATION: these utility functions should not be moved out of this module. V8 Crankshaft will not inline
+//this functions if they will be situated in another module due to context switch.
+//Always perform inlining check before modifying this functions ('node --trace-inlining').
+function isAsciiDigit(cp) {
+ return cp >= CODE_POINTS.DIGIT_0 && cp <= CODE_POINTS.DIGIT_9;
+}
+function isAsciiUpper(cp) {
+ return cp >= CODE_POINTS.LATIN_CAPITAL_A && cp <= CODE_POINTS.LATIN_CAPITAL_Z;
+}
+function isAsciiLower(cp) {
+ return cp >= CODE_POINTS.LATIN_SMALL_A && cp <= CODE_POINTS.LATIN_SMALL_Z;
+}
+function isAsciiLetter(cp) {
+ return isAsciiLower(cp) || isAsciiUpper(cp);
+}
+function isAsciiAlphaNumeric(cp) {
+ return isAsciiLetter(cp) || isAsciiDigit(cp);
+}
+function isAsciiUpperHexDigit(cp) {
+ return cp >= CODE_POINTS.LATIN_CAPITAL_A && cp <= CODE_POINTS.LATIN_CAPITAL_F;
+}
+function isAsciiLowerHexDigit(cp) {
+ return cp >= CODE_POINTS.LATIN_SMALL_A && cp <= CODE_POINTS.LATIN_SMALL_F;
+}
+function isAsciiHexDigit(cp) {
+ return isAsciiDigit(cp) || isAsciiUpperHexDigit(cp) || isAsciiLowerHexDigit(cp);
+}
+function toAsciiLower(cp) {
+ return cp + 32;
+}
+function isWhitespace(cp) {
+ return cp === CODE_POINTS.SPACE || cp === CODE_POINTS.LINE_FEED || cp === CODE_POINTS.TABULATION || cp === CODE_POINTS.FORM_FEED;
+}
+function isEntityInAttributeInvalidEnd(nextCp) {
+ return nextCp === CODE_POINTS.EQUALS_SIGN || isAsciiAlphaNumeric(nextCp);
+}
+function isScriptDataDoubleEscapeSequenceEnd(cp) {
+ return isWhitespace(cp) || cp === CODE_POINTS.SOLIDUS || cp === CODE_POINTS.GREATER_THAN_SIGN;
+}
+//Tokenizer
+class Tokenizer {
+ constructor(options, handler) {
+ this.options = options;
+ this.handler = handler;
+ this.paused = false;
+ /** Ensures that the parsing loop isn't run multiple times at once. */
+ this.inLoop = false;
+ /**
+ * Indicates that the current adjusted node exists, is not an element in the HTML namespace,
+ * and that it is not an integration point for either MathML or HTML.
+ *
+ * @see {@link https://html.spec.whatwg.org/multipage/parsing.html#tree-construction}
+ */
+ this.inForeignNode = false;
+ this.lastStartTagName = '';
+ this.active = false;
+ this.state = State.DATA;
+ this.returnState = State.DATA;
+ this.charRefCode = -1;
+ this.consumedAfterSnapshot = -1;
+ this.currentCharacterToken = null;
+ this.currentToken = null;
+ this.currentAttr = { name: '', value: '' };
+ this.preprocessor = new Preprocessor(handler);
+ this.currentLocation = this.getCurrentLocation(-1);
+ }
+ //Errors
+ _err(code) {
+ var _a, _b;
+ (_b = (_a = this.handler).onParseError) === null || _b === void 0 ? void 0 : _b.call(_a, this.preprocessor.getError(code));
+ }
+ // NOTE: `offset` may never run across line boundaries.
+ getCurrentLocation(offset) {
+ if (!this.options.sourceCodeLocationInfo) {
+ return null;
+ }
+ return {
+ startLine: this.preprocessor.line,
+ startCol: this.preprocessor.col - offset,
+ startOffset: this.preprocessor.offset - offset,
+ endLine: -1,
+ endCol: -1,
+ endOffset: -1,
+ };
+ }
+ _runParsingLoop() {
+ if (this.inLoop)
+ return;
+ this.inLoop = true;
+ while (this.active && !this.paused) {
+ this.consumedAfterSnapshot = 0;
+ const cp = this._consume();
+ if (!this._ensureHibernation()) {
+ this._callState(cp);
+ }
+ }
+ this.inLoop = false;
+ }
+ //API
+ pause() {
+ this.paused = true;
+ }
+ resume(writeCallback) {
+ if (!this.paused) {
+ throw new Error('Parser was already resumed');
+ }
+ this.paused = false;
+ // Necessary for synchronous resume.
+ if (this.inLoop)
+ return;
+ this._runParsingLoop();
+ if (!this.paused) {
+ writeCallback === null || writeCallback === void 0 ? void 0 : writeCallback();
+ }
+ }
+ write(chunk, isLastChunk, writeCallback) {
+ this.active = true;
+ this.preprocessor.write(chunk, isLastChunk);
+ this._runParsingLoop();
+ if (!this.paused) {
+ writeCallback === null || writeCallback === void 0 ? void 0 : writeCallback();
+ }
+ }
+ insertHtmlAtCurrentPos(chunk) {
+ this.active = true;
+ this.preprocessor.insertHtmlAtCurrentPos(chunk);
+ this._runParsingLoop();
+ }
+ //Hibernation
+ _ensureHibernation() {
+ if (this.preprocessor.endOfChunkHit) {
+ this._unconsume(this.consumedAfterSnapshot);
+ this.active = false;
+ return true;
+ }
+ return false;
+ }
+ //Consumption
+ _consume() {
+ this.consumedAfterSnapshot++;
+ return this.preprocessor.advance();
+ }
+ _unconsume(count) {
+ this.consumedAfterSnapshot -= count;
+ this.preprocessor.retreat(count);
+ }
+ _reconsumeInState(state, cp) {
+ this.state = state;
+ this._callState(cp);
+ }
+ _advanceBy(count) {
+ this.consumedAfterSnapshot += count;
+ for (let i = 0; i < count; i++) {
+ this.preprocessor.advance();
+ }
+ }
+ _consumeSequenceIfMatch(pattern, caseSensitive) {
+ if (this.preprocessor.startsWith(pattern, caseSensitive)) {
+ // We will already have consumed one character before calling this method.
+ this._advanceBy(pattern.length - 1);
+ return true;
+ }
+ return false;
+ }
+ //Token creation
+ _createStartTagToken() {
+ this.currentToken = {
+ type: TokenType.START_TAG,
+ tagName: '',
+ tagID: TAG_ID.UNKNOWN,
+ selfClosing: false,
+ ackSelfClosing: false,
+ attrs: [],
+ location: this.getCurrentLocation(1),
+ };
+ }
+ _createEndTagToken() {
+ this.currentToken = {
+ type: TokenType.END_TAG,
+ tagName: '',
+ tagID: TAG_ID.UNKNOWN,
+ selfClosing: false,
+ ackSelfClosing: false,
+ attrs: [],
+ location: this.getCurrentLocation(2),
+ };
+ }
+ _createCommentToken(offset) {
+ this.currentToken = {
+ type: TokenType.COMMENT,
+ data: '',
+ location: this.getCurrentLocation(offset),
+ };
+ }
+ _createDoctypeToken(initialName) {
+ this.currentToken = {
+ type: TokenType.DOCTYPE,
+ name: initialName,
+ forceQuirks: false,
+ publicId: null,
+ systemId: null,
+ location: this.currentLocation,
+ };
+ }
+ _createCharacterToken(type, chars) {
+ this.currentCharacterToken = {
+ type,
+ chars,
+ location: this.currentLocation,
+ };
+ }
+ //Tag attributes
+ _createAttr(attrNameFirstCh) {
+ this.currentAttr = {
+ name: attrNameFirstCh,
+ value: '',
+ };
+ this.currentLocation = this.getCurrentLocation(0);
+ }
+ _leaveAttrName() {
+ var _a;
+ var _b;
+ const token = this.currentToken;
+ if (getTokenAttr(token, this.currentAttr.name) === null) {
+ token.attrs.push(this.currentAttr);
+ if (token.location && this.currentLocation) {
+ const attrLocations = ((_a = (_b = token.location).attrs) !== null && _a !== void 0 ? _a : (_b.attrs = Object.create(null)));
+ attrLocations[this.currentAttr.name] = this.currentLocation;
+ // Set end location
+ this._leaveAttrValue();
+ }
+ }
+ else {
+ this._err(ERR.duplicateAttribute);
+ }
+ }
+ _leaveAttrValue() {
+ if (this.currentLocation) {
+ this.currentLocation.endLine = this.preprocessor.line;
+ this.currentLocation.endCol = this.preprocessor.col;
+ this.currentLocation.endOffset = this.preprocessor.offset;
+ }
+ }
+ //Token emission
+ prepareToken(ct) {
+ this._emitCurrentCharacterToken(ct.location);
+ this.currentToken = null;
+ if (ct.location) {
+ ct.location.endLine = this.preprocessor.line;
+ ct.location.endCol = this.preprocessor.col + 1;
+ ct.location.endOffset = this.preprocessor.offset + 1;
+ }
+ this.currentLocation = this.getCurrentLocation(-1);
+ }
+ emitCurrentTagToken() {
+ const ct = this.currentToken;
+ this.prepareToken(ct);
+ ct.tagID = getTagID(ct.tagName);
+ if (ct.type === TokenType.START_TAG) {
+ this.lastStartTagName = ct.tagName;
+ this.handler.onStartTag(ct);
+ }
+ else {
+ if (ct.attrs.length > 0) {
+ this._err(ERR.endTagWithAttributes);
+ }
+ if (ct.selfClosing) {
+ this._err(ERR.endTagWithTrailingSolidus);
+ }
+ this.handler.onEndTag(ct);
+ }
+ this.preprocessor.dropParsedChunk();
+ }
+ emitCurrentComment(ct) {
+ this.prepareToken(ct);
+ this.handler.onComment(ct);
+ this.preprocessor.dropParsedChunk();
+ }
+ emitCurrentDoctype(ct) {
+ this.prepareToken(ct);
+ this.handler.onDoctype(ct);
+ this.preprocessor.dropParsedChunk();
+ }
+ _emitCurrentCharacterToken(nextLocation) {
+ if (this.currentCharacterToken) {
+ //NOTE: if we have a pending character token, make it's end location equal to the
+ //current token's start location.
+ if (nextLocation && this.currentCharacterToken.location) {
+ this.currentCharacterToken.location.endLine = nextLocation.startLine;
+ this.currentCharacterToken.location.endCol = nextLocation.startCol;
+ this.currentCharacterToken.location.endOffset = nextLocation.startOffset;
+ }
+ switch (this.currentCharacterToken.type) {
+ case TokenType.CHARACTER: {
+ this.handler.onCharacter(this.currentCharacterToken);
+ break;
+ }
+ case TokenType.NULL_CHARACTER: {
+ this.handler.onNullCharacter(this.currentCharacterToken);
+ break;
+ }
+ case TokenType.WHITESPACE_CHARACTER: {
+ this.handler.onWhitespaceCharacter(this.currentCharacterToken);
+ break;
+ }
+ }
+ this.currentCharacterToken = null;
+ }
+ }
+ _emitEOFToken() {
+ const location = this.getCurrentLocation(0);
+ if (location) {
+ location.endLine = location.startLine;
+ location.endCol = location.startCol;
+ location.endOffset = location.startOffset;
+ }
+ this._emitCurrentCharacterToken(location);
+ this.handler.onEof({ type: TokenType.EOF, location });
+ this.active = false;
+ }
+ //Characters emission
+ //OPTIMIZATION: specification uses only one type of character tokens (one token per character).
+ //This causes a huge memory overhead and a lot of unnecessary parser loops. parse5 uses 3 groups of characters.
+ //If we have a sequence of characters that belong to the same group, the parser can process it
+ //as a single solid character token.
+ //So, there are 3 types of character tokens in parse5:
+ //1)TokenType.NULL_CHARACTER - \u0000-character sequences (e.g. '\u0000\u0000\u0000')
+ //2)TokenType.WHITESPACE_CHARACTER - any whitespace/new-line character sequences (e.g. '\n \r\t \f')
+ //3)TokenType.CHARACTER - any character sequence which don't belong to groups 1 and 2 (e.g. 'abcdef1234@@#$%^')
+ _appendCharToCurrentCharacterToken(type, ch) {
+ if (this.currentCharacterToken) {
+ if (this.currentCharacterToken.type !== type) {
+ this.currentLocation = this.getCurrentLocation(0);
+ this._emitCurrentCharacterToken(this.currentLocation);
+ this.preprocessor.dropParsedChunk();
+ }
+ else {
+ this.currentCharacterToken.chars += ch;
+ return;
+ }
+ }
+ this._createCharacterToken(type, ch);
+ }
+ _emitCodePoint(cp) {
+ const type = isWhitespace(cp)
+ ? TokenType.WHITESPACE_CHARACTER
+ : cp === CODE_POINTS.NULL
+ ? TokenType.NULL_CHARACTER
+ : TokenType.CHARACTER;
+ this._appendCharToCurrentCharacterToken(type, String.fromCodePoint(cp));
+ }
+ //NOTE: used when we emit characters explicitly.
+ //This is always for non-whitespace and non-null characters, which allows us to avoid additional checks.
+ _emitChars(ch) {
+ this._appendCharToCurrentCharacterToken(TokenType.CHARACTER, ch);
+ }
+ // Character reference helpers
+ _matchNamedCharacterReference(cp) {
+ let result = null;
+ let excess = 0;
+ let withoutSemicolon = false;
+ for (let i = 0, current = htmlDecodeTree[0]; i >= 0; cp = this._consume()) {
+ i = determineBranch(htmlDecodeTree, current, i + 1, cp);
+ if (i < 0)
+ break;
+ excess += 1;
+ current = htmlDecodeTree[i];
+ const masked = current & BinTrieFlags.VALUE_LENGTH;
+ // If the branch is a value, store it and continue
+ if (masked) {
+ // The mask is the number of bytes of the value, including the current byte.
+ const valueLength = (masked >> 14) - 1;
+ // Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.
+ // See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state
+ if (cp !== CODE_POINTS.SEMICOLON &&
+ this._isCharacterReferenceInAttribute() &&
+ isEntityInAttributeInvalidEnd(this.preprocessor.peek(1))) {
+ //NOTE: we don't flush all consumed code points here, and instead switch back to the original state after
+ //emitting an ampersand. This is fine, as alphanumeric characters won't be parsed differently in attributes.
+ result = [CODE_POINTS.AMPERSAND];
+ // Skip over the value.
+ i += valueLength;
+ }
+ else {
+ // If this is a surrogate pair, consume the next two bytes.
+ result =
+ valueLength === 0
+ ? [htmlDecodeTree[i] & ~BinTrieFlags.VALUE_LENGTH]
+ : valueLength === 1
+ ? [htmlDecodeTree[++i]]
+ : [htmlDecodeTree[++i], htmlDecodeTree[++i]];
+ excess = 0;
+ withoutSemicolon = cp !== CODE_POINTS.SEMICOLON;
+ }
+ if (valueLength === 0) {
+ // If the value is zero-length, we're done.
+ this._consume();
+ break;
+ }
+ }
+ }
+ this._unconsume(excess);
+ if (withoutSemicolon && !this.preprocessor.endOfChunkHit) {
+ this._err(ERR.missingSemicolonAfterCharacterReference);
+ }
+ // We want to emit the error above on the code point after the entity.
+ // We always consume one code point too many in the loop, and we wait to
+ // unconsume it until after the error is emitted.
+ this._unconsume(1);
+ return result;
+ }
+ _isCharacterReferenceInAttribute() {
+ return (this.returnState === State.ATTRIBUTE_VALUE_DOUBLE_QUOTED ||
+ this.returnState === State.ATTRIBUTE_VALUE_SINGLE_QUOTED ||
+ this.returnState === State.ATTRIBUTE_VALUE_UNQUOTED);
+ }
+ _flushCodePointConsumedAsCharacterReference(cp) {
+ if (this._isCharacterReferenceInAttribute()) {
+ this.currentAttr.value += String.fromCodePoint(cp);
+ }
+ else {
+ this._emitCodePoint(cp);
+ }
+ }
+ // Calling states this way turns out to be much faster than any other approach.
+ _callState(cp) {
+ switch (this.state) {
+ case State.DATA: {
+ this._stateData(cp);
+ break;
+ }
+ case State.RCDATA: {
+ this._stateRcdata(cp);
+ break;
+ }
+ case State.RAWTEXT: {
+ this._stateRawtext(cp);
+ break;
+ }
+ case State.SCRIPT_DATA: {
+ this._stateScriptData(cp);
+ break;
+ }
+ case State.PLAINTEXT: {
+ this._statePlaintext(cp);
+ break;
+ }
+ case State.TAG_OPEN: {
+ this._stateTagOpen(cp);
+ break;
+ }
+ case State.END_TAG_OPEN: {
+ this._stateEndTagOpen(cp);
+ break;
+ }
+ case State.TAG_NAME: {
+ this._stateTagName(cp);
+ break;
+ }
+ case State.RCDATA_LESS_THAN_SIGN: {
+ this._stateRcdataLessThanSign(cp);
+ break;
+ }
+ case State.RCDATA_END_TAG_OPEN: {
+ this._stateRcdataEndTagOpen(cp);
+ break;
+ }
+ case State.RCDATA_END_TAG_NAME: {
+ this._stateRcdataEndTagName(cp);
+ break;
+ }
+ case State.RAWTEXT_LESS_THAN_SIGN: {
+ this._stateRawtextLessThanSign(cp);
+ break;
+ }
+ case State.RAWTEXT_END_TAG_OPEN: {
+ this._stateRawtextEndTagOpen(cp);
+ break;
+ }
+ case State.RAWTEXT_END_TAG_NAME: {
+ this._stateRawtextEndTagName(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_LESS_THAN_SIGN: {
+ this._stateScriptDataLessThanSign(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_END_TAG_OPEN: {
+ this._stateScriptDataEndTagOpen(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_END_TAG_NAME: {
+ this._stateScriptDataEndTagName(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_ESCAPE_START: {
+ this._stateScriptDataEscapeStart(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_ESCAPE_START_DASH: {
+ this._stateScriptDataEscapeStartDash(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_ESCAPED: {
+ this._stateScriptDataEscaped(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_ESCAPED_DASH: {
+ this._stateScriptDataEscapedDash(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_ESCAPED_DASH_DASH: {
+ this._stateScriptDataEscapedDashDash(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN: {
+ this._stateScriptDataEscapedLessThanSign(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN: {
+ this._stateScriptDataEscapedEndTagOpen(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_ESCAPED_END_TAG_NAME: {
+ this._stateScriptDataEscapedEndTagName(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_DOUBLE_ESCAPE_START: {
+ this._stateScriptDataDoubleEscapeStart(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_DOUBLE_ESCAPED: {
+ this._stateScriptDataDoubleEscaped(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH: {
+ this._stateScriptDataDoubleEscapedDash(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH: {
+ this._stateScriptDataDoubleEscapedDashDash(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN: {
+ this._stateScriptDataDoubleEscapedLessThanSign(cp);
+ break;
+ }
+ case State.SCRIPT_DATA_DOUBLE_ESCAPE_END: {
+ this._stateScriptDataDoubleEscapeEnd(cp);
+ break;
+ }
+ case State.BEFORE_ATTRIBUTE_NAME: {
+ this._stateBeforeAttributeName(cp);
+ break;
+ }
+ case State.ATTRIBUTE_NAME: {
+ this._stateAttributeName(cp);
+ break;
+ }
+ case State.AFTER_ATTRIBUTE_NAME: {
+ this._stateAfterAttributeName(cp);
+ break;
+ }
+ case State.BEFORE_ATTRIBUTE_VALUE: {
+ this._stateBeforeAttributeValue(cp);
+ break;
+ }
+ case State.ATTRIBUTE_VALUE_DOUBLE_QUOTED: {
+ this._stateAttributeValueDoubleQuoted(cp);
+ break;
+ }
+ case State.ATTRIBUTE_VALUE_SINGLE_QUOTED: {
+ this._stateAttributeValueSingleQuoted(cp);
+ break;
+ }
+ case State.ATTRIBUTE_VALUE_UNQUOTED: {
+ this._stateAttributeValueUnquoted(cp);
+ break;
+ }
+ case State.AFTER_ATTRIBUTE_VALUE_QUOTED: {
+ this._stateAfterAttributeValueQuoted(cp);
+ break;
+ }
+ case State.SELF_CLOSING_START_TAG: {
+ this._stateSelfClosingStartTag(cp);
+ break;
+ }
+ case State.BOGUS_COMMENT: {
+ this._stateBogusComment(cp);
+ break;
+ }
+ case State.MARKUP_DECLARATION_OPEN: {
+ this._stateMarkupDeclarationOpen(cp);
+ break;
+ }
+ case State.COMMENT_START: {
+ this._stateCommentStart(cp);
+ break;
+ }
+ case State.COMMENT_START_DASH: {
+ this._stateCommentStartDash(cp);
+ break;
+ }
+ case State.COMMENT: {
+ this._stateComment(cp);
+ break;
+ }
+ case State.COMMENT_LESS_THAN_SIGN: {
+ this._stateCommentLessThanSign(cp);
+ break;
+ }
+ case State.COMMENT_LESS_THAN_SIGN_BANG: {
+ this._stateCommentLessThanSignBang(cp);
+ break;
+ }
+ case State.COMMENT_LESS_THAN_SIGN_BANG_DASH: {
+ this._stateCommentLessThanSignBangDash(cp);
+ break;
+ }
+ case State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH: {
+ this._stateCommentLessThanSignBangDashDash(cp);
+ break;
+ }
+ case State.COMMENT_END_DASH: {
+ this._stateCommentEndDash(cp);
+ break;
+ }
+ case State.COMMENT_END: {
+ this._stateCommentEnd(cp);
+ break;
+ }
+ case State.COMMENT_END_BANG: {
+ this._stateCommentEndBang(cp);
+ break;
+ }
+ case State.DOCTYPE: {
+ this._stateDoctype(cp);
+ break;
+ }
+ case State.BEFORE_DOCTYPE_NAME: {
+ this._stateBeforeDoctypeName(cp);
+ break;
+ }
+ case State.DOCTYPE_NAME: {
+ this._stateDoctypeName(cp);
+ break;
+ }
+ case State.AFTER_DOCTYPE_NAME: {
+ this._stateAfterDoctypeName(cp);
+ break;
+ }
+ case State.AFTER_DOCTYPE_PUBLIC_KEYWORD: {
+ this._stateAfterDoctypePublicKeyword(cp);
+ break;
+ }
+ case State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER: {
+ this._stateBeforeDoctypePublicIdentifier(cp);
+ break;
+ }
+ case State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED: {
+ this._stateDoctypePublicIdentifierDoubleQuoted(cp);
+ break;
+ }
+ case State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED: {
+ this._stateDoctypePublicIdentifierSingleQuoted(cp);
+ break;
+ }
+ case State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER: {
+ this._stateAfterDoctypePublicIdentifier(cp);
+ break;
+ }
+ case State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS: {
+ this._stateBetweenDoctypePublicAndSystemIdentifiers(cp);
+ break;
+ }
+ case State.AFTER_DOCTYPE_SYSTEM_KEYWORD: {
+ this._stateAfterDoctypeSystemKeyword(cp);
+ break;
+ }
+ case State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER: {
+ this._stateBeforeDoctypeSystemIdentifier(cp);
+ break;
+ }
+ case State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED: {
+ this._stateDoctypeSystemIdentifierDoubleQuoted(cp);
+ break;
+ }
+ case State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED: {
+ this._stateDoctypeSystemIdentifierSingleQuoted(cp);
+ break;
+ }
+ case State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER: {
+ this._stateAfterDoctypeSystemIdentifier(cp);
+ break;
+ }
+ case State.BOGUS_DOCTYPE: {
+ this._stateBogusDoctype(cp);
+ break;
+ }
+ case State.CDATA_SECTION: {
+ this._stateCdataSection(cp);
+ break;
+ }
+ case State.CDATA_SECTION_BRACKET: {
+ this._stateCdataSectionBracket(cp);
+ break;
+ }
+ case State.CDATA_SECTION_END: {
+ this._stateCdataSectionEnd(cp);
+ break;
+ }
+ case State.CHARACTER_REFERENCE: {
+ this._stateCharacterReference(cp);
+ break;
+ }
+ case State.NAMED_CHARACTER_REFERENCE: {
+ this._stateNamedCharacterReference(cp);
+ break;
+ }
+ case State.AMBIGUOUS_AMPERSAND: {
+ this._stateAmbiguousAmpersand(cp);
+ break;
+ }
+ case State.NUMERIC_CHARACTER_REFERENCE: {
+ this._stateNumericCharacterReference(cp);
+ break;
+ }
+ case State.HEXADEMICAL_CHARACTER_REFERENCE_START: {
+ this._stateHexademicalCharacterReferenceStart(cp);
+ break;
+ }
+ case State.HEXADEMICAL_CHARACTER_REFERENCE: {
+ this._stateHexademicalCharacterReference(cp);
+ break;
+ }
+ case State.DECIMAL_CHARACTER_REFERENCE: {
+ this._stateDecimalCharacterReference(cp);
+ break;
+ }
+ case State.NUMERIC_CHARACTER_REFERENCE_END: {
+ this._stateNumericCharacterReferenceEnd(cp);
+ break;
+ }
+ default: {
+ throw new Error('Unknown state');
+ }
+ }
+ }
+ // State machine
+ // Data state
+ //------------------------------------------------------------------
+ _stateData(cp) {
+ switch (cp) {
+ case CODE_POINTS.LESS_THAN_SIGN: {
+ this.state = State.TAG_OPEN;
+ break;
+ }
+ case CODE_POINTS.AMPERSAND: {
+ this.returnState = State.DATA;
+ this.state = State.CHARACTER_REFERENCE;
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ this._emitCodePoint(cp);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._emitCodePoint(cp);
+ }
+ }
+ }
+ // RCDATA state
+ //------------------------------------------------------------------
+ _stateRcdata(cp) {
+ switch (cp) {
+ case CODE_POINTS.AMPERSAND: {
+ this.returnState = State.RCDATA;
+ this.state = State.CHARACTER_REFERENCE;
+ break;
+ }
+ case CODE_POINTS.LESS_THAN_SIGN: {
+ this.state = State.RCDATA_LESS_THAN_SIGN;
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ this._emitChars(REPLACEMENT_CHARACTER);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._emitCodePoint(cp);
+ }
+ }
+ }
+ // RAWTEXT state
+ //------------------------------------------------------------------
+ _stateRawtext(cp) {
+ switch (cp) {
+ case CODE_POINTS.LESS_THAN_SIGN: {
+ this.state = State.RAWTEXT_LESS_THAN_SIGN;
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ this._emitChars(REPLACEMENT_CHARACTER);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._emitCodePoint(cp);
+ }
+ }
+ }
+ // Script data state
+ //------------------------------------------------------------------
+ _stateScriptData(cp) {
+ switch (cp) {
+ case CODE_POINTS.LESS_THAN_SIGN: {
+ this.state = State.SCRIPT_DATA_LESS_THAN_SIGN;
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ this._emitChars(REPLACEMENT_CHARACTER);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._emitCodePoint(cp);
+ }
+ }
+ }
+ // PLAINTEXT state
+ //------------------------------------------------------------------
+ _statePlaintext(cp) {
+ switch (cp) {
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ this._emitChars(REPLACEMENT_CHARACTER);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._emitCodePoint(cp);
+ }
+ }
+ }
+ // Tag open state
+ //------------------------------------------------------------------
+ _stateTagOpen(cp) {
+ if (isAsciiLetter(cp)) {
+ this._createStartTagToken();
+ this.state = State.TAG_NAME;
+ this._stateTagName(cp);
+ }
+ else
+ switch (cp) {
+ case CODE_POINTS.EXCLAMATION_MARK: {
+ this.state = State.MARKUP_DECLARATION_OPEN;
+ break;
+ }
+ case CODE_POINTS.SOLIDUS: {
+ this.state = State.END_TAG_OPEN;
+ break;
+ }
+ case CODE_POINTS.QUESTION_MARK: {
+ this._err(ERR.unexpectedQuestionMarkInsteadOfTagName);
+ this._createCommentToken(1);
+ this.state = State.BOGUS_COMMENT;
+ this._stateBogusComment(cp);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofBeforeTagName);
+ this._emitChars('<');
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._err(ERR.invalidFirstCharacterOfTagName);
+ this._emitChars('<');
+ this.state = State.DATA;
+ this._stateData(cp);
+ }
+ }
+ }
+ // End tag open state
+ //------------------------------------------------------------------
+ _stateEndTagOpen(cp) {
+ if (isAsciiLetter(cp)) {
+ this._createEndTagToken();
+ this.state = State.TAG_NAME;
+ this._stateTagName(cp);
+ }
+ else
+ switch (cp) {
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._err(ERR.missingEndTagName);
+ this.state = State.DATA;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofBeforeTagName);
+ this._emitChars('');
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._err(ERR.invalidFirstCharacterOfTagName);
+ this._createCommentToken(2);
+ this.state = State.BOGUS_COMMENT;
+ this._stateBogusComment(cp);
+ }
+ }
+ }
+ // Tag name state
+ //------------------------------------------------------------------
+ _stateTagName(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ this.state = State.BEFORE_ATTRIBUTE_NAME;
+ break;
+ }
+ case CODE_POINTS.SOLIDUS: {
+ this.state = State.SELF_CLOSING_START_TAG;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this.state = State.DATA;
+ this.emitCurrentTagToken();
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ token.tagName += REPLACEMENT_CHARACTER;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInTag);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ token.tagName += String.fromCodePoint(isAsciiUpper(cp) ? toAsciiLower(cp) : cp);
+ }
+ }
+ }
+ // RCDATA less-than sign state
+ //------------------------------------------------------------------
+ _stateRcdataLessThanSign(cp) {
+ if (cp === CODE_POINTS.SOLIDUS) {
+ this.state = State.RCDATA_END_TAG_OPEN;
+ }
+ else {
+ this._emitChars('<');
+ this.state = State.RCDATA;
+ this._stateRcdata(cp);
+ }
+ }
+ // RCDATA end tag open state
+ //------------------------------------------------------------------
+ _stateRcdataEndTagOpen(cp) {
+ if (isAsciiLetter(cp)) {
+ this.state = State.RCDATA_END_TAG_NAME;
+ this._stateRcdataEndTagName(cp);
+ }
+ else {
+ this._emitChars('');
+ this.state = State.RCDATA;
+ this._stateRcdata(cp);
+ }
+ }
+ handleSpecialEndTag(_cp) {
+ if (!this.preprocessor.startsWith(this.lastStartTagName, false)) {
+ return !this._ensureHibernation();
+ }
+ this._createEndTagToken();
+ const token = this.currentToken;
+ token.tagName = this.lastStartTagName;
+ const cp = this.preprocessor.peek(this.lastStartTagName.length);
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ this._advanceBy(this.lastStartTagName.length);
+ this.state = State.BEFORE_ATTRIBUTE_NAME;
+ return false;
+ }
+ case CODE_POINTS.SOLIDUS: {
+ this._advanceBy(this.lastStartTagName.length);
+ this.state = State.SELF_CLOSING_START_TAG;
+ return false;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._advanceBy(this.lastStartTagName.length);
+ this.emitCurrentTagToken();
+ this.state = State.DATA;
+ return false;
+ }
+ default: {
+ return !this._ensureHibernation();
+ }
+ }
+ }
+ // RCDATA end tag name state
+ //------------------------------------------------------------------
+ _stateRcdataEndTagName(cp) {
+ if (this.handleSpecialEndTag(cp)) {
+ this._emitChars('');
+ this.state = State.RCDATA;
+ this._stateRcdata(cp);
+ }
+ }
+ // RAWTEXT less-than sign state
+ //------------------------------------------------------------------
+ _stateRawtextLessThanSign(cp) {
+ if (cp === CODE_POINTS.SOLIDUS) {
+ this.state = State.RAWTEXT_END_TAG_OPEN;
+ }
+ else {
+ this._emitChars('<');
+ this.state = State.RAWTEXT;
+ this._stateRawtext(cp);
+ }
+ }
+ // RAWTEXT end tag open state
+ //------------------------------------------------------------------
+ _stateRawtextEndTagOpen(cp) {
+ if (isAsciiLetter(cp)) {
+ this.state = State.RAWTEXT_END_TAG_NAME;
+ this._stateRawtextEndTagName(cp);
+ }
+ else {
+ this._emitChars('');
+ this.state = State.RAWTEXT;
+ this._stateRawtext(cp);
+ }
+ }
+ // RAWTEXT end tag name state
+ //------------------------------------------------------------------
+ _stateRawtextEndTagName(cp) {
+ if (this.handleSpecialEndTag(cp)) {
+ this._emitChars('');
+ this.state = State.RAWTEXT;
+ this._stateRawtext(cp);
+ }
+ }
+ // Script data less-than sign state
+ //------------------------------------------------------------------
+ _stateScriptDataLessThanSign(cp) {
+ switch (cp) {
+ case CODE_POINTS.SOLIDUS: {
+ this.state = State.SCRIPT_DATA_END_TAG_OPEN;
+ break;
+ }
+ case CODE_POINTS.EXCLAMATION_MARK: {
+ this.state = State.SCRIPT_DATA_ESCAPE_START;
+ this._emitChars('');
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ this.state = State.SCRIPT_DATA_ESCAPED;
+ this._emitChars(REPLACEMENT_CHARACTER);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInScriptHtmlCommentLikeText);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this.state = State.SCRIPT_DATA_ESCAPED;
+ this._emitCodePoint(cp);
+ }
+ }
+ }
+ // Script data escaped less-than sign state
+ //------------------------------------------------------------------
+ _stateScriptDataEscapedLessThanSign(cp) {
+ if (cp === CODE_POINTS.SOLIDUS) {
+ this.state = State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN;
+ }
+ else if (isAsciiLetter(cp)) {
+ this._emitChars('<');
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPE_START;
+ this._stateScriptDataDoubleEscapeStart(cp);
+ }
+ else {
+ this._emitChars('<');
+ this.state = State.SCRIPT_DATA_ESCAPED;
+ this._stateScriptDataEscaped(cp);
+ }
+ }
+ // Script data escaped end tag open state
+ //------------------------------------------------------------------
+ _stateScriptDataEscapedEndTagOpen(cp) {
+ if (isAsciiLetter(cp)) {
+ this.state = State.SCRIPT_DATA_ESCAPED_END_TAG_NAME;
+ this._stateScriptDataEscapedEndTagName(cp);
+ }
+ else {
+ this._emitChars('');
+ this.state = State.SCRIPT_DATA_ESCAPED;
+ this._stateScriptDataEscaped(cp);
+ }
+ }
+ // Script data escaped end tag name state
+ //------------------------------------------------------------------
+ _stateScriptDataEscapedEndTagName(cp) {
+ if (this.handleSpecialEndTag(cp)) {
+ this._emitChars('');
+ this.state = State.SCRIPT_DATA_ESCAPED;
+ this._stateScriptDataEscaped(cp);
+ }
+ }
+ // Script data double escape start state
+ //------------------------------------------------------------------
+ _stateScriptDataDoubleEscapeStart(cp) {
+ if (this.preprocessor.startsWith(SEQUENCES.SCRIPT, false) &&
+ isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek(SEQUENCES.SCRIPT.length))) {
+ this._emitCodePoint(cp);
+ for (let i = 0; i < SEQUENCES.SCRIPT.length; i++) {
+ this._emitCodePoint(this._consume());
+ }
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
+ }
+ else if (!this._ensureHibernation()) {
+ this.state = State.SCRIPT_DATA_ESCAPED;
+ this._stateScriptDataEscaped(cp);
+ }
+ }
+ // Script data double escaped state
+ //------------------------------------------------------------------
+ _stateScriptDataDoubleEscaped(cp) {
+ switch (cp) {
+ case CODE_POINTS.HYPHEN_MINUS: {
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH;
+ this._emitChars('-');
+ break;
+ }
+ case CODE_POINTS.LESS_THAN_SIGN: {
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
+ this._emitChars('<');
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ this._emitChars(REPLACEMENT_CHARACTER);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInScriptHtmlCommentLikeText);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._emitCodePoint(cp);
+ }
+ }
+ }
+ // Script data double escaped dash state
+ //------------------------------------------------------------------
+ _stateScriptDataDoubleEscapedDash(cp) {
+ switch (cp) {
+ case CODE_POINTS.HYPHEN_MINUS: {
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH;
+ this._emitChars('-');
+ break;
+ }
+ case CODE_POINTS.LESS_THAN_SIGN: {
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
+ this._emitChars('<');
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
+ this._emitChars(REPLACEMENT_CHARACTER);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInScriptHtmlCommentLikeText);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
+ this._emitCodePoint(cp);
+ }
+ }
+ }
+ // Script data double escaped dash dash state
+ //------------------------------------------------------------------
+ _stateScriptDataDoubleEscapedDashDash(cp) {
+ switch (cp) {
+ case CODE_POINTS.HYPHEN_MINUS: {
+ this._emitChars('-');
+ break;
+ }
+ case CODE_POINTS.LESS_THAN_SIGN: {
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
+ this._emitChars('<');
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this.state = State.SCRIPT_DATA;
+ this._emitChars('>');
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
+ this._emitChars(REPLACEMENT_CHARACTER);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInScriptHtmlCommentLikeText);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
+ this._emitCodePoint(cp);
+ }
+ }
+ }
+ // Script data double escaped less-than sign state
+ //------------------------------------------------------------------
+ _stateScriptDataDoubleEscapedLessThanSign(cp) {
+ if (cp === CODE_POINTS.SOLIDUS) {
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPE_END;
+ this._emitChars('/');
+ }
+ else {
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
+ this._stateScriptDataDoubleEscaped(cp);
+ }
+ }
+ // Script data double escape end state
+ //------------------------------------------------------------------
+ _stateScriptDataDoubleEscapeEnd(cp) {
+ if (this.preprocessor.startsWith(SEQUENCES.SCRIPT, false) &&
+ isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek(SEQUENCES.SCRIPT.length))) {
+ this._emitCodePoint(cp);
+ for (let i = 0; i < SEQUENCES.SCRIPT.length; i++) {
+ this._emitCodePoint(this._consume());
+ }
+ this.state = State.SCRIPT_DATA_ESCAPED;
+ }
+ else if (!this._ensureHibernation()) {
+ this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
+ this._stateScriptDataDoubleEscaped(cp);
+ }
+ }
+ // Before attribute name state
+ //------------------------------------------------------------------
+ _stateBeforeAttributeName(cp) {
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ // Ignore whitespace
+ break;
+ }
+ case CODE_POINTS.SOLIDUS:
+ case CODE_POINTS.GREATER_THAN_SIGN:
+ case CODE_POINTS.EOF: {
+ this.state = State.AFTER_ATTRIBUTE_NAME;
+ this._stateAfterAttributeName(cp);
+ break;
+ }
+ case CODE_POINTS.EQUALS_SIGN: {
+ this._err(ERR.unexpectedEqualsSignBeforeAttributeName);
+ this._createAttr('=');
+ this.state = State.ATTRIBUTE_NAME;
+ break;
+ }
+ default: {
+ this._createAttr('');
+ this.state = State.ATTRIBUTE_NAME;
+ this._stateAttributeName(cp);
+ }
+ }
+ }
+ // Attribute name state
+ //------------------------------------------------------------------
+ _stateAttributeName(cp) {
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED:
+ case CODE_POINTS.SOLIDUS:
+ case CODE_POINTS.GREATER_THAN_SIGN:
+ case CODE_POINTS.EOF: {
+ this._leaveAttrName();
+ this.state = State.AFTER_ATTRIBUTE_NAME;
+ this._stateAfterAttributeName(cp);
+ break;
+ }
+ case CODE_POINTS.EQUALS_SIGN: {
+ this._leaveAttrName();
+ this.state = State.BEFORE_ATTRIBUTE_VALUE;
+ break;
+ }
+ case CODE_POINTS.QUOTATION_MARK:
+ case CODE_POINTS.APOSTROPHE:
+ case CODE_POINTS.LESS_THAN_SIGN: {
+ this._err(ERR.unexpectedCharacterInAttributeName);
+ this.currentAttr.name += String.fromCodePoint(cp);
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ this.currentAttr.name += REPLACEMENT_CHARACTER;
+ break;
+ }
+ default: {
+ this.currentAttr.name += String.fromCodePoint(isAsciiUpper(cp) ? toAsciiLower(cp) : cp);
+ }
+ }
+ }
+ // After attribute name state
+ //------------------------------------------------------------------
+ _stateAfterAttributeName(cp) {
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ // Ignore whitespace
+ break;
+ }
+ case CODE_POINTS.SOLIDUS: {
+ this.state = State.SELF_CLOSING_START_TAG;
+ break;
+ }
+ case CODE_POINTS.EQUALS_SIGN: {
+ this.state = State.BEFORE_ATTRIBUTE_VALUE;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this.state = State.DATA;
+ this.emitCurrentTagToken();
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInTag);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._createAttr('');
+ this.state = State.ATTRIBUTE_NAME;
+ this._stateAttributeName(cp);
+ }
+ }
+ }
+ // Before attribute value state
+ //------------------------------------------------------------------
+ _stateBeforeAttributeValue(cp) {
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ // Ignore whitespace
+ break;
+ }
+ case CODE_POINTS.QUOTATION_MARK: {
+ this.state = State.ATTRIBUTE_VALUE_DOUBLE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.APOSTROPHE: {
+ this.state = State.ATTRIBUTE_VALUE_SINGLE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._err(ERR.missingAttributeValue);
+ this.state = State.DATA;
+ this.emitCurrentTagToken();
+ break;
+ }
+ default: {
+ this.state = State.ATTRIBUTE_VALUE_UNQUOTED;
+ this._stateAttributeValueUnquoted(cp);
+ }
+ }
+ }
+ // Attribute value (double-quoted) state
+ //------------------------------------------------------------------
+ _stateAttributeValueDoubleQuoted(cp) {
+ switch (cp) {
+ case CODE_POINTS.QUOTATION_MARK: {
+ this.state = State.AFTER_ATTRIBUTE_VALUE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.AMPERSAND: {
+ this.returnState = State.ATTRIBUTE_VALUE_DOUBLE_QUOTED;
+ this.state = State.CHARACTER_REFERENCE;
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ this.currentAttr.value += REPLACEMENT_CHARACTER;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInTag);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this.currentAttr.value += String.fromCodePoint(cp);
+ }
+ }
+ }
+ // Attribute value (single-quoted) state
+ //------------------------------------------------------------------
+ _stateAttributeValueSingleQuoted(cp) {
+ switch (cp) {
+ case CODE_POINTS.APOSTROPHE: {
+ this.state = State.AFTER_ATTRIBUTE_VALUE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.AMPERSAND: {
+ this.returnState = State.ATTRIBUTE_VALUE_SINGLE_QUOTED;
+ this.state = State.CHARACTER_REFERENCE;
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ this.currentAttr.value += REPLACEMENT_CHARACTER;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInTag);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this.currentAttr.value += String.fromCodePoint(cp);
+ }
+ }
+ }
+ // Attribute value (unquoted) state
+ //------------------------------------------------------------------
+ _stateAttributeValueUnquoted(cp) {
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ this._leaveAttrValue();
+ this.state = State.BEFORE_ATTRIBUTE_NAME;
+ break;
+ }
+ case CODE_POINTS.AMPERSAND: {
+ this.returnState = State.ATTRIBUTE_VALUE_UNQUOTED;
+ this.state = State.CHARACTER_REFERENCE;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._leaveAttrValue();
+ this.state = State.DATA;
+ this.emitCurrentTagToken();
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ this.currentAttr.value += REPLACEMENT_CHARACTER;
+ break;
+ }
+ case CODE_POINTS.QUOTATION_MARK:
+ case CODE_POINTS.APOSTROPHE:
+ case CODE_POINTS.LESS_THAN_SIGN:
+ case CODE_POINTS.EQUALS_SIGN:
+ case CODE_POINTS.GRAVE_ACCENT: {
+ this._err(ERR.unexpectedCharacterInUnquotedAttributeValue);
+ this.currentAttr.value += String.fromCodePoint(cp);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInTag);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this.currentAttr.value += String.fromCodePoint(cp);
+ }
+ }
+ }
+ // After attribute value (quoted) state
+ //------------------------------------------------------------------
+ _stateAfterAttributeValueQuoted(cp) {
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ this._leaveAttrValue();
+ this.state = State.BEFORE_ATTRIBUTE_NAME;
+ break;
+ }
+ case CODE_POINTS.SOLIDUS: {
+ this._leaveAttrValue();
+ this.state = State.SELF_CLOSING_START_TAG;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._leaveAttrValue();
+ this.state = State.DATA;
+ this.emitCurrentTagToken();
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInTag);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._err(ERR.missingWhitespaceBetweenAttributes);
+ this.state = State.BEFORE_ATTRIBUTE_NAME;
+ this._stateBeforeAttributeName(cp);
+ }
+ }
+ }
+ // Self-closing start tag state
+ //------------------------------------------------------------------
+ _stateSelfClosingStartTag(cp) {
+ switch (cp) {
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ const token = this.currentToken;
+ token.selfClosing = true;
+ this.state = State.DATA;
+ this.emitCurrentTagToken();
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInTag);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._err(ERR.unexpectedSolidusInTag);
+ this.state = State.BEFORE_ATTRIBUTE_NAME;
+ this._stateBeforeAttributeName(cp);
+ }
+ }
+ }
+ // Bogus comment state
+ //------------------------------------------------------------------
+ _stateBogusComment(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this.state = State.DATA;
+ this.emitCurrentComment(token);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this.emitCurrentComment(token);
+ this._emitEOFToken();
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ token.data += REPLACEMENT_CHARACTER;
+ break;
+ }
+ default: {
+ token.data += String.fromCodePoint(cp);
+ }
+ }
+ }
+ // Markup declaration open state
+ //------------------------------------------------------------------
+ _stateMarkupDeclarationOpen(cp) {
+ if (this._consumeSequenceIfMatch(SEQUENCES.DASH_DASH, true)) {
+ this._createCommentToken(SEQUENCES.DASH_DASH.length + 1);
+ this.state = State.COMMENT_START;
+ }
+ else if (this._consumeSequenceIfMatch(SEQUENCES.DOCTYPE, false)) {
+ // NOTE: Doctypes tokens are created without fixed offsets. We keep track of the moment a doctype *might* start here.
+ this.currentLocation = this.getCurrentLocation(SEQUENCES.DOCTYPE.length + 1);
+ this.state = State.DOCTYPE;
+ }
+ else if (this._consumeSequenceIfMatch(SEQUENCES.CDATA_START, true)) {
+ if (this.inForeignNode) {
+ this.state = State.CDATA_SECTION;
+ }
+ else {
+ this._err(ERR.cdataInHtmlContent);
+ this._createCommentToken(SEQUENCES.CDATA_START.length + 1);
+ this.currentToken.data = '[CDATA[';
+ this.state = State.BOGUS_COMMENT;
+ }
+ }
+ //NOTE: Sequence lookups can be abrupted by hibernation. In that case, lookup
+ //results are no longer valid and we will need to start over.
+ else if (!this._ensureHibernation()) {
+ this._err(ERR.incorrectlyOpenedComment);
+ this._createCommentToken(2);
+ this.state = State.BOGUS_COMMENT;
+ this._stateBogusComment(cp);
+ }
+ }
+ // Comment start state
+ //------------------------------------------------------------------
+ _stateCommentStart(cp) {
+ switch (cp) {
+ case CODE_POINTS.HYPHEN_MINUS: {
+ this.state = State.COMMENT_START_DASH;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._err(ERR.abruptClosingOfEmptyComment);
+ this.state = State.DATA;
+ const token = this.currentToken;
+ this.emitCurrentComment(token);
+ break;
+ }
+ default: {
+ this.state = State.COMMENT;
+ this._stateComment(cp);
+ }
+ }
+ }
+ // Comment start dash state
+ //------------------------------------------------------------------
+ _stateCommentStartDash(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.HYPHEN_MINUS: {
+ this.state = State.COMMENT_END;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._err(ERR.abruptClosingOfEmptyComment);
+ this.state = State.DATA;
+ this.emitCurrentComment(token);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInComment);
+ this.emitCurrentComment(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ token.data += '-';
+ this.state = State.COMMENT;
+ this._stateComment(cp);
+ }
+ }
+ }
+ // Comment state
+ //------------------------------------------------------------------
+ _stateComment(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.HYPHEN_MINUS: {
+ this.state = State.COMMENT_END_DASH;
+ break;
+ }
+ case CODE_POINTS.LESS_THAN_SIGN: {
+ token.data += '<';
+ this.state = State.COMMENT_LESS_THAN_SIGN;
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ token.data += REPLACEMENT_CHARACTER;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInComment);
+ this.emitCurrentComment(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ token.data += String.fromCodePoint(cp);
+ }
+ }
+ }
+ // Comment less-than sign state
+ //------------------------------------------------------------------
+ _stateCommentLessThanSign(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.EXCLAMATION_MARK: {
+ token.data += '!';
+ this.state = State.COMMENT_LESS_THAN_SIGN_BANG;
+ break;
+ }
+ case CODE_POINTS.LESS_THAN_SIGN: {
+ token.data += '<';
+ break;
+ }
+ default: {
+ this.state = State.COMMENT;
+ this._stateComment(cp);
+ }
+ }
+ }
+ // Comment less-than sign bang state
+ //------------------------------------------------------------------
+ _stateCommentLessThanSignBang(cp) {
+ if (cp === CODE_POINTS.HYPHEN_MINUS) {
+ this.state = State.COMMENT_LESS_THAN_SIGN_BANG_DASH;
+ }
+ else {
+ this.state = State.COMMENT;
+ this._stateComment(cp);
+ }
+ }
+ // Comment less-than sign bang dash state
+ //------------------------------------------------------------------
+ _stateCommentLessThanSignBangDash(cp) {
+ if (cp === CODE_POINTS.HYPHEN_MINUS) {
+ this.state = State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH;
+ }
+ else {
+ this.state = State.COMMENT_END_DASH;
+ this._stateCommentEndDash(cp);
+ }
+ }
+ // Comment less-than sign bang dash dash state
+ //------------------------------------------------------------------
+ _stateCommentLessThanSignBangDashDash(cp) {
+ if (cp !== CODE_POINTS.GREATER_THAN_SIGN && cp !== CODE_POINTS.EOF) {
+ this._err(ERR.nestedComment);
+ }
+ this.state = State.COMMENT_END;
+ this._stateCommentEnd(cp);
+ }
+ // Comment end dash state
+ //------------------------------------------------------------------
+ _stateCommentEndDash(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.HYPHEN_MINUS: {
+ this.state = State.COMMENT_END;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInComment);
+ this.emitCurrentComment(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ token.data += '-';
+ this.state = State.COMMENT;
+ this._stateComment(cp);
+ }
+ }
+ }
+ // Comment end state
+ //------------------------------------------------------------------
+ _stateCommentEnd(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this.state = State.DATA;
+ this.emitCurrentComment(token);
+ break;
+ }
+ case CODE_POINTS.EXCLAMATION_MARK: {
+ this.state = State.COMMENT_END_BANG;
+ break;
+ }
+ case CODE_POINTS.HYPHEN_MINUS: {
+ token.data += '-';
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInComment);
+ this.emitCurrentComment(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ token.data += '--';
+ this.state = State.COMMENT;
+ this._stateComment(cp);
+ }
+ }
+ }
+ // Comment end bang state
+ //------------------------------------------------------------------
+ _stateCommentEndBang(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.HYPHEN_MINUS: {
+ token.data += '--!';
+ this.state = State.COMMENT_END_DASH;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._err(ERR.incorrectlyClosedComment);
+ this.state = State.DATA;
+ this.emitCurrentComment(token);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInComment);
+ this.emitCurrentComment(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ token.data += '--!';
+ this.state = State.COMMENT;
+ this._stateComment(cp);
+ }
+ }
+ }
+ // DOCTYPE state
+ //------------------------------------------------------------------
+ _stateDoctype(cp) {
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ this.state = State.BEFORE_DOCTYPE_NAME;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this.state = State.BEFORE_DOCTYPE_NAME;
+ this._stateBeforeDoctypeName(cp);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ this._createDoctypeToken(null);
+ const token = this.currentToken;
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._err(ERR.missingWhitespaceBeforeDoctypeName);
+ this.state = State.BEFORE_DOCTYPE_NAME;
+ this._stateBeforeDoctypeName(cp);
+ }
+ }
+ }
+ // Before DOCTYPE name state
+ //------------------------------------------------------------------
+ _stateBeforeDoctypeName(cp) {
+ if (isAsciiUpper(cp)) {
+ this._createDoctypeToken(String.fromCharCode(toAsciiLower(cp)));
+ this.state = State.DOCTYPE_NAME;
+ }
+ else
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ // Ignore whitespace
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ this._createDoctypeToken(REPLACEMENT_CHARACTER);
+ this.state = State.DOCTYPE_NAME;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._err(ERR.missingDoctypeName);
+ this._createDoctypeToken(null);
+ const token = this.currentToken;
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this.state = State.DATA;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ this._createDoctypeToken(null);
+ const token = this.currentToken;
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._createDoctypeToken(String.fromCodePoint(cp));
+ this.state = State.DOCTYPE_NAME;
+ }
+ }
+ }
+ // DOCTYPE name state
+ //------------------------------------------------------------------
+ _stateDoctypeName(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ this.state = State.AFTER_DOCTYPE_NAME;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this.state = State.DATA;
+ this.emitCurrentDoctype(token);
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ token.name += REPLACEMENT_CHARACTER;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ token.name += String.fromCodePoint(isAsciiUpper(cp) ? toAsciiLower(cp) : cp);
+ }
+ }
+ }
+ // After DOCTYPE name state
+ //------------------------------------------------------------------
+ _stateAfterDoctypeName(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ // Ignore whitespace
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this.state = State.DATA;
+ this.emitCurrentDoctype(token);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ if (this._consumeSequenceIfMatch(SEQUENCES.PUBLIC, false)) {
+ this.state = State.AFTER_DOCTYPE_PUBLIC_KEYWORD;
+ }
+ else if (this._consumeSequenceIfMatch(SEQUENCES.SYSTEM, false)) {
+ this.state = State.AFTER_DOCTYPE_SYSTEM_KEYWORD;
+ }
+ //NOTE: sequence lookup can be abrupted by hibernation. In that case lookup
+ //results are no longer valid and we will need to start over.
+ else if (!this._ensureHibernation()) {
+ this._err(ERR.invalidCharacterSequenceAfterDoctypeName);
+ token.forceQuirks = true;
+ this.state = State.BOGUS_DOCTYPE;
+ this._stateBogusDoctype(cp);
+ }
+ }
+ }
+ }
+ // After DOCTYPE public keyword state
+ //------------------------------------------------------------------
+ _stateAfterDoctypePublicKeyword(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ this.state = State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;
+ break;
+ }
+ case CODE_POINTS.QUOTATION_MARK: {
+ this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword);
+ token.publicId = '';
+ this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.APOSTROPHE: {
+ this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword);
+ token.publicId = '';
+ this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._err(ERR.missingDoctypePublicIdentifier);
+ token.forceQuirks = true;
+ this.state = State.DATA;
+ this.emitCurrentDoctype(token);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier);
+ token.forceQuirks = true;
+ this.state = State.BOGUS_DOCTYPE;
+ this._stateBogusDoctype(cp);
+ }
+ }
+ }
+ // Before DOCTYPE public identifier state
+ //------------------------------------------------------------------
+ _stateBeforeDoctypePublicIdentifier(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ // Ignore whitespace
+ break;
+ }
+ case CODE_POINTS.QUOTATION_MARK: {
+ token.publicId = '';
+ this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.APOSTROPHE: {
+ token.publicId = '';
+ this.state = State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._err(ERR.missingDoctypePublicIdentifier);
+ token.forceQuirks = true;
+ this.state = State.DATA;
+ this.emitCurrentDoctype(token);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier);
+ token.forceQuirks = true;
+ this.state = State.BOGUS_DOCTYPE;
+ this._stateBogusDoctype(cp);
+ }
+ }
+ }
+ // DOCTYPE public identifier (double-quoted) state
+ //------------------------------------------------------------------
+ _stateDoctypePublicIdentifierDoubleQuoted(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.QUOTATION_MARK: {
+ this.state = State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ token.publicId += REPLACEMENT_CHARACTER;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._err(ERR.abruptDoctypePublicIdentifier);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this.state = State.DATA;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ token.publicId += String.fromCodePoint(cp);
+ }
+ }
+ }
+ // DOCTYPE public identifier (single-quoted) state
+ //------------------------------------------------------------------
+ _stateDoctypePublicIdentifierSingleQuoted(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.APOSTROPHE: {
+ this.state = State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ token.publicId += REPLACEMENT_CHARACTER;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._err(ERR.abruptDoctypePublicIdentifier);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this.state = State.DATA;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ token.publicId += String.fromCodePoint(cp);
+ }
+ }
+ }
+ // After DOCTYPE public identifier state
+ //------------------------------------------------------------------
+ _stateAfterDoctypePublicIdentifier(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ this.state = State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this.state = State.DATA;
+ this.emitCurrentDoctype(token);
+ break;
+ }
+ case CODE_POINTS.QUOTATION_MARK: {
+ this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);
+ token.systemId = '';
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.APOSTROPHE: {
+ this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);
+ token.systemId = '';
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
+ token.forceQuirks = true;
+ this.state = State.BOGUS_DOCTYPE;
+ this._stateBogusDoctype(cp);
+ }
+ }
+ }
+ // Between DOCTYPE public and system identifiers state
+ //------------------------------------------------------------------
+ _stateBetweenDoctypePublicAndSystemIdentifiers(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ // Ignore whitespace
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this.emitCurrentDoctype(token);
+ this.state = State.DATA;
+ break;
+ }
+ case CODE_POINTS.QUOTATION_MARK: {
+ token.systemId = '';
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.APOSTROPHE: {
+ token.systemId = '';
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
+ token.forceQuirks = true;
+ this.state = State.BOGUS_DOCTYPE;
+ this._stateBogusDoctype(cp);
+ }
+ }
+ }
+ // After DOCTYPE system keyword state
+ //------------------------------------------------------------------
+ _stateAfterDoctypeSystemKeyword(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ this.state = State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;
+ break;
+ }
+ case CODE_POINTS.QUOTATION_MARK: {
+ this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword);
+ token.systemId = '';
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.APOSTROPHE: {
+ this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword);
+ token.systemId = '';
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._err(ERR.missingDoctypeSystemIdentifier);
+ token.forceQuirks = true;
+ this.state = State.DATA;
+ this.emitCurrentDoctype(token);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
+ token.forceQuirks = true;
+ this.state = State.BOGUS_DOCTYPE;
+ this._stateBogusDoctype(cp);
+ }
+ }
+ }
+ // Before DOCTYPE system identifier state
+ //------------------------------------------------------------------
+ _stateBeforeDoctypeSystemIdentifier(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ // Ignore whitespace
+ break;
+ }
+ case CODE_POINTS.QUOTATION_MARK: {
+ token.systemId = '';
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.APOSTROPHE: {
+ token.systemId = '';
+ this.state = State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._err(ERR.missingDoctypeSystemIdentifier);
+ token.forceQuirks = true;
+ this.state = State.DATA;
+ this.emitCurrentDoctype(token);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
+ token.forceQuirks = true;
+ this.state = State.BOGUS_DOCTYPE;
+ this._stateBogusDoctype(cp);
+ }
+ }
+ }
+ // DOCTYPE system identifier (double-quoted) state
+ //------------------------------------------------------------------
+ _stateDoctypeSystemIdentifierDoubleQuoted(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.QUOTATION_MARK: {
+ this.state = State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ token.systemId += REPLACEMENT_CHARACTER;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._err(ERR.abruptDoctypeSystemIdentifier);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this.state = State.DATA;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ token.systemId += String.fromCodePoint(cp);
+ }
+ }
+ }
+ // DOCTYPE system identifier (single-quoted) state
+ //------------------------------------------------------------------
+ _stateDoctypeSystemIdentifierSingleQuoted(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.APOSTROPHE: {
+ this.state = State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ token.systemId += REPLACEMENT_CHARACTER;
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this._err(ERR.abruptDoctypeSystemIdentifier);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this.state = State.DATA;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ token.systemId += String.fromCodePoint(cp);
+ }
+ }
+ }
+ // After DOCTYPE system identifier state
+ //------------------------------------------------------------------
+ _stateAfterDoctypeSystemIdentifier(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.SPACE:
+ case CODE_POINTS.LINE_FEED:
+ case CODE_POINTS.TABULATION:
+ case CODE_POINTS.FORM_FEED: {
+ // Ignore whitespace
+ break;
+ }
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this.emitCurrentDoctype(token);
+ this.state = State.DATA;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInDoctype);
+ token.forceQuirks = true;
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._err(ERR.unexpectedCharacterAfterDoctypeSystemIdentifier);
+ this.state = State.BOGUS_DOCTYPE;
+ this._stateBogusDoctype(cp);
+ }
+ }
+ }
+ // Bogus DOCTYPE state
+ //------------------------------------------------------------------
+ _stateBogusDoctype(cp) {
+ const token = this.currentToken;
+ switch (cp) {
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this.emitCurrentDoctype(token);
+ this.state = State.DATA;
+ break;
+ }
+ case CODE_POINTS.NULL: {
+ this._err(ERR.unexpectedNullCharacter);
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this.emitCurrentDoctype(token);
+ this._emitEOFToken();
+ break;
+ }
+ // Do nothing
+ }
+ }
+ // CDATA section state
+ //------------------------------------------------------------------
+ _stateCdataSection(cp) {
+ switch (cp) {
+ case CODE_POINTS.RIGHT_SQUARE_BRACKET: {
+ this.state = State.CDATA_SECTION_BRACKET;
+ break;
+ }
+ case CODE_POINTS.EOF: {
+ this._err(ERR.eofInCdata);
+ this._emitEOFToken();
+ break;
+ }
+ default: {
+ this._emitCodePoint(cp);
+ }
+ }
+ }
+ // CDATA section bracket state
+ //------------------------------------------------------------------
+ _stateCdataSectionBracket(cp) {
+ if (cp === CODE_POINTS.RIGHT_SQUARE_BRACKET) {
+ this.state = State.CDATA_SECTION_END;
+ }
+ else {
+ this._emitChars(']');
+ this.state = State.CDATA_SECTION;
+ this._stateCdataSection(cp);
+ }
+ }
+ // CDATA section end state
+ //------------------------------------------------------------------
+ _stateCdataSectionEnd(cp) {
+ switch (cp) {
+ case CODE_POINTS.GREATER_THAN_SIGN: {
+ this.state = State.DATA;
+ break;
+ }
+ case CODE_POINTS.RIGHT_SQUARE_BRACKET: {
+ this._emitChars(']');
+ break;
+ }
+ default: {
+ this._emitChars(']]');
+ this.state = State.CDATA_SECTION;
+ this._stateCdataSection(cp);
+ }
+ }
+ }
+ // Character reference state
+ //------------------------------------------------------------------
+ _stateCharacterReference(cp) {
+ if (cp === CODE_POINTS.NUMBER_SIGN) {
+ this.state = State.NUMERIC_CHARACTER_REFERENCE;
+ }
+ else if (isAsciiAlphaNumeric(cp)) {
+ this.state = State.NAMED_CHARACTER_REFERENCE;
+ this._stateNamedCharacterReference(cp);
+ }
+ else {
+ this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND);
+ this._reconsumeInState(this.returnState, cp);
+ }
+ }
+ // Named character reference state
+ //------------------------------------------------------------------
+ _stateNamedCharacterReference(cp) {
+ const matchResult = this._matchNamedCharacterReference(cp);
+ //NOTE: Matching can be abrupted by hibernation. In that case, match
+ //results are no longer valid and we will need to start over.
+ if (this._ensureHibernation()) ;
+ else if (matchResult) {
+ for (let i = 0; i < matchResult.length; i++) {
+ this._flushCodePointConsumedAsCharacterReference(matchResult[i]);
+ }
+ this.state = this.returnState;
+ }
+ else {
+ this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND);
+ this.state = State.AMBIGUOUS_AMPERSAND;
+ }
+ }
+ // Ambiguos ampersand state
+ //------------------------------------------------------------------
+ _stateAmbiguousAmpersand(cp) {
+ if (isAsciiAlphaNumeric(cp)) {
+ this._flushCodePointConsumedAsCharacterReference(cp);
+ }
+ else {
+ if (cp === CODE_POINTS.SEMICOLON) {
+ this._err(ERR.unknownNamedCharacterReference);
+ }
+ this._reconsumeInState(this.returnState, cp);
+ }
+ }
+ // Numeric character reference state
+ //------------------------------------------------------------------
+ _stateNumericCharacterReference(cp) {
+ this.charRefCode = 0;
+ if (cp === CODE_POINTS.LATIN_SMALL_X || cp === CODE_POINTS.LATIN_CAPITAL_X) {
+ this.state = State.HEXADEMICAL_CHARACTER_REFERENCE_START;
+ }
+ // Inlined decimal character reference start state
+ else if (isAsciiDigit(cp)) {
+ this.state = State.DECIMAL_CHARACTER_REFERENCE;
+ this._stateDecimalCharacterReference(cp);
+ }
+ else {
+ this._err(ERR.absenceOfDigitsInNumericCharacterReference);
+ this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND);
+ this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.NUMBER_SIGN);
+ this._reconsumeInState(this.returnState, cp);
+ }
+ }
+ // Hexademical character reference start state
+ //------------------------------------------------------------------
+ _stateHexademicalCharacterReferenceStart(cp) {
+ if (isAsciiHexDigit(cp)) {
+ this.state = State.HEXADEMICAL_CHARACTER_REFERENCE;
+ this._stateHexademicalCharacterReference(cp);
+ }
+ else {
+ this._err(ERR.absenceOfDigitsInNumericCharacterReference);
+ this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND);
+ this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.NUMBER_SIGN);
+ this._unconsume(2);
+ this.state = this.returnState;
+ }
+ }
+ // Hexademical character reference state
+ //------------------------------------------------------------------
+ _stateHexademicalCharacterReference(cp) {
+ if (isAsciiUpperHexDigit(cp)) {
+ this.charRefCode = this.charRefCode * 16 + cp - 0x37;
+ }
+ else if (isAsciiLowerHexDigit(cp)) {
+ this.charRefCode = this.charRefCode * 16 + cp - 0x57;
+ }
+ else if (isAsciiDigit(cp)) {
+ this.charRefCode = this.charRefCode * 16 + cp - 0x30;
+ }
+ else if (cp === CODE_POINTS.SEMICOLON) {
+ this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
+ }
+ else {
+ this._err(ERR.missingSemicolonAfterCharacterReference);
+ this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
+ this._stateNumericCharacterReferenceEnd(cp);
+ }
+ }
+ // Decimal character reference state
+ //------------------------------------------------------------------
+ _stateDecimalCharacterReference(cp) {
+ if (isAsciiDigit(cp)) {
+ this.charRefCode = this.charRefCode * 10 + cp - 0x30;
+ }
+ else if (cp === CODE_POINTS.SEMICOLON) {
+ this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
+ }
+ else {
+ this._err(ERR.missingSemicolonAfterCharacterReference);
+ this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
+ this._stateNumericCharacterReferenceEnd(cp);
+ }
+ }
+ // Numeric character reference end state
+ //------------------------------------------------------------------
+ _stateNumericCharacterReferenceEnd(cp) {
+ if (this.charRefCode === CODE_POINTS.NULL) {
+ this._err(ERR.nullCharacterReference);
+ this.charRefCode = CODE_POINTS.REPLACEMENT_CHARACTER;
+ }
+ else if (this.charRefCode > 1114111) {
+ this._err(ERR.characterReferenceOutsideUnicodeRange);
+ this.charRefCode = CODE_POINTS.REPLACEMENT_CHARACTER;
+ }
+ else if (isSurrogate(this.charRefCode)) {
+ this._err(ERR.surrogateCharacterReference);
+ this.charRefCode = CODE_POINTS.REPLACEMENT_CHARACTER;
+ }
+ else if (isUndefinedCodePoint(this.charRefCode)) {
+ this._err(ERR.noncharacterCharacterReference);
+ }
+ else if (isControlCodePoint(this.charRefCode) || this.charRefCode === CODE_POINTS.CARRIAGE_RETURN) {
+ this._err(ERR.controlCharacterReference);
+ const replacement = C1_CONTROLS_REFERENCE_REPLACEMENTS.get(this.charRefCode);
+ if (replacement !== undefined) {
+ this.charRefCode = replacement;
+ }
+ }
+ this._flushCodePointConsumedAsCharacterReference(this.charRefCode);
+ this._reconsumeInState(this.returnState, cp);
+ }
+}
+
+//Element utils
+const IMPLICIT_END_TAG_REQUIRED = new Set([TAG_ID.DD, TAG_ID.DT, TAG_ID.LI, TAG_ID.OPTGROUP, TAG_ID.OPTION, TAG_ID.P, TAG_ID.RB, TAG_ID.RP, TAG_ID.RT, TAG_ID.RTC]);
+const IMPLICIT_END_TAG_REQUIRED_THOROUGHLY = new Set([
+ ...IMPLICIT_END_TAG_REQUIRED,
+ TAG_ID.CAPTION,
+ TAG_ID.COLGROUP,
+ TAG_ID.TBODY,
+ TAG_ID.TD,
+ TAG_ID.TFOOT,
+ TAG_ID.TH,
+ TAG_ID.THEAD,
+ TAG_ID.TR,
+]);
+const SCOPING_ELEMENT_NS = new Map([
+ [TAG_ID.APPLET, NS.HTML],
+ [TAG_ID.CAPTION, NS.HTML],
+ [TAG_ID.HTML, NS.HTML],
+ [TAG_ID.MARQUEE, NS.HTML],
+ [TAG_ID.OBJECT, NS.HTML],
+ [TAG_ID.TABLE, NS.HTML],
+ [TAG_ID.TD, NS.HTML],
+ [TAG_ID.TEMPLATE, NS.HTML],
+ [TAG_ID.TH, NS.HTML],
+ [TAG_ID.ANNOTATION_XML, NS.MATHML],
+ [TAG_ID.MI, NS.MATHML],
+ [TAG_ID.MN, NS.MATHML],
+ [TAG_ID.MO, NS.MATHML],
+ [TAG_ID.MS, NS.MATHML],
+ [TAG_ID.MTEXT, NS.MATHML],
+ [TAG_ID.DESC, NS.SVG],
+ [TAG_ID.FOREIGN_OBJECT, NS.SVG],
+ [TAG_ID.TITLE, NS.SVG],
+]);
+const NAMED_HEADERS = [TAG_ID.H1, TAG_ID.H2, TAG_ID.H3, TAG_ID.H4, TAG_ID.H5, TAG_ID.H6];
+const TABLE_ROW_CONTEXT = [TAG_ID.TR, TAG_ID.TEMPLATE, TAG_ID.HTML];
+const TABLE_BODY_CONTEXT = [TAG_ID.TBODY, TAG_ID.TFOOT, TAG_ID.THEAD, TAG_ID.TEMPLATE, TAG_ID.HTML];
+const TABLE_CONTEXT = [TAG_ID.TABLE, TAG_ID.TEMPLATE, TAG_ID.HTML];
+const TABLE_CELLS = [TAG_ID.TD, TAG_ID.TH];
+//Stack of open elements
+class OpenElementStack {
+ get currentTmplContentOrNode() {
+ return this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : this.current;
+ }
+ constructor(document, treeAdapter, handler) {
+ this.treeAdapter = treeAdapter;
+ this.handler = handler;
+ this.items = [];
+ this.tagIDs = [];
+ this.stackTop = -1;
+ this.tmplCount = 0;
+ this.currentTagId = TAG_ID.UNKNOWN;
+ this.current = document;
+ }
+ //Index of element
+ _indexOf(element) {
+ return this.items.lastIndexOf(element, this.stackTop);
+ }
+ //Update current element
+ _isInTemplate() {
+ return this.currentTagId === TAG_ID.TEMPLATE && this.treeAdapter.getNamespaceURI(this.current) === NS.HTML;
+ }
+ _updateCurrentElement() {
+ this.current = this.items[this.stackTop];
+ this.currentTagId = this.tagIDs[this.stackTop];
+ }
+ //Mutations
+ push(element, tagID) {
+ this.stackTop++;
+ this.items[this.stackTop] = element;
+ this.current = element;
+ this.tagIDs[this.stackTop] = tagID;
+ this.currentTagId = tagID;
+ if (this._isInTemplate()) {
+ this.tmplCount++;
+ }
+ this.handler.onItemPush(element, tagID, true);
+ }
+ pop() {
+ const popped = this.current;
+ if (this.tmplCount > 0 && this._isInTemplate()) {
+ this.tmplCount--;
+ }
+ this.stackTop--;
+ this._updateCurrentElement();
+ this.handler.onItemPop(popped, true);
+ }
+ replace(oldElement, newElement) {
+ const idx = this._indexOf(oldElement);
+ this.items[idx] = newElement;
+ if (idx === this.stackTop) {
+ this.current = newElement;
+ }
+ }
+ insertAfter(referenceElement, newElement, newElementID) {
+ const insertionIdx = this._indexOf(referenceElement) + 1;
+ this.items.splice(insertionIdx, 0, newElement);
+ this.tagIDs.splice(insertionIdx, 0, newElementID);
+ this.stackTop++;
+ if (insertionIdx === this.stackTop) {
+ this._updateCurrentElement();
+ }
+ this.handler.onItemPush(this.current, this.currentTagId, insertionIdx === this.stackTop);
+ }
+ popUntilTagNamePopped(tagName) {
+ let targetIdx = this.stackTop + 1;
+ do {
+ targetIdx = this.tagIDs.lastIndexOf(tagName, targetIdx - 1);
+ } while (targetIdx > 0 && this.treeAdapter.getNamespaceURI(this.items[targetIdx]) !== NS.HTML);
+ this.shortenToLength(targetIdx < 0 ? 0 : targetIdx);
+ }
+ shortenToLength(idx) {
+ while (this.stackTop >= idx) {
+ const popped = this.current;
+ if (this.tmplCount > 0 && this._isInTemplate()) {
+ this.tmplCount -= 1;
+ }
+ this.stackTop--;
+ this._updateCurrentElement();
+ this.handler.onItemPop(popped, this.stackTop < idx);
+ }
+ }
+ popUntilElementPopped(element) {
+ const idx = this._indexOf(element);
+ this.shortenToLength(idx < 0 ? 0 : idx);
+ }
+ popUntilPopped(tagNames, targetNS) {
+ const idx = this._indexOfTagNames(tagNames, targetNS);
+ this.shortenToLength(idx < 0 ? 0 : idx);
+ }
+ popUntilNumberedHeaderPopped() {
+ this.popUntilPopped(NAMED_HEADERS, NS.HTML);
+ }
+ popUntilTableCellPopped() {
+ this.popUntilPopped(TABLE_CELLS, NS.HTML);
+ }
+ popAllUpToHtmlElement() {
+ //NOTE: here we assume that the root element is always first in the open element stack, so
+ //we perform this fast stack clean up.
+ this.tmplCount = 0;
+ this.shortenToLength(1);
+ }
+ _indexOfTagNames(tagNames, namespace) {
+ for (let i = this.stackTop; i >= 0; i--) {
+ if (tagNames.includes(this.tagIDs[i]) && this.treeAdapter.getNamespaceURI(this.items[i]) === namespace) {
+ return i;
+ }
+ }
+ return -1;
+ }
+ clearBackTo(tagNames, targetNS) {
+ const idx = this._indexOfTagNames(tagNames, targetNS);
+ this.shortenToLength(idx + 1);
+ }
+ clearBackToTableContext() {
+ this.clearBackTo(TABLE_CONTEXT, NS.HTML);
+ }
+ clearBackToTableBodyContext() {
+ this.clearBackTo(TABLE_BODY_CONTEXT, NS.HTML);
+ }
+ clearBackToTableRowContext() {
+ this.clearBackTo(TABLE_ROW_CONTEXT, NS.HTML);
+ }
+ remove(element) {
+ const idx = this._indexOf(element);
+ if (idx >= 0) {
+ if (idx === this.stackTop) {
+ this.pop();
+ }
+ else {
+ this.items.splice(idx, 1);
+ this.tagIDs.splice(idx, 1);
+ this.stackTop--;
+ this._updateCurrentElement();
+ this.handler.onItemPop(element, false);
+ }
+ }
+ }
+ //Search
+ tryPeekProperlyNestedBodyElement() {
+ //Properly nested element (should be second element in stack).
+ return this.stackTop >= 1 && this.tagIDs[1] === TAG_ID.BODY ? this.items[1] : null;
+ }
+ contains(element) {
+ return this._indexOf(element) > -1;
+ }
+ getCommonAncestor(element) {
+ const elementIdx = this._indexOf(element) - 1;
+ return elementIdx >= 0 ? this.items[elementIdx] : null;
+ }
+ isRootHtmlElementCurrent() {
+ return this.stackTop === 0 && this.tagIDs[0] === TAG_ID.HTML;
+ }
+ //Element in scope
+ hasInScope(tagName) {
+ for (let i = this.stackTop; i >= 0; i--) {
+ const tn = this.tagIDs[i];
+ const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
+ if (tn === tagName && ns === NS.HTML) {
+ return true;
+ }
+ if (SCOPING_ELEMENT_NS.get(tn) === ns) {
+ return false;
+ }
+ }
+ return true;
+ }
+ hasNumberedHeaderInScope() {
+ for (let i = this.stackTop; i >= 0; i--) {
+ const tn = this.tagIDs[i];
+ const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
+ if (isNumberedHeader(tn) && ns === NS.HTML) {
+ return true;
+ }
+ if (SCOPING_ELEMENT_NS.get(tn) === ns) {
+ return false;
+ }
+ }
+ return true;
+ }
+ hasInListItemScope(tagName) {
+ for (let i = this.stackTop; i >= 0; i--) {
+ const tn = this.tagIDs[i];
+ const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
+ if (tn === tagName && ns === NS.HTML) {
+ return true;
+ }
+ if (((tn === TAG_ID.UL || tn === TAG_ID.OL) && ns === NS.HTML) || SCOPING_ELEMENT_NS.get(tn) === ns) {
+ return false;
+ }
+ }
+ return true;
+ }
+ hasInButtonScope(tagName) {
+ for (let i = this.stackTop; i >= 0; i--) {
+ const tn = this.tagIDs[i];
+ const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
+ if (tn === tagName && ns === NS.HTML) {
+ return true;
+ }
+ if ((tn === TAG_ID.BUTTON && ns === NS.HTML) || SCOPING_ELEMENT_NS.get(tn) === ns) {
+ return false;
+ }
+ }
+ return true;
+ }
+ hasInTableScope(tagName) {
+ for (let i = this.stackTop; i >= 0; i--) {
+ const tn = this.tagIDs[i];
+ const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
+ if (ns !== NS.HTML) {
+ continue;
+ }
+ if (tn === tagName) {
+ return true;
+ }
+ if (tn === TAG_ID.TABLE || tn === TAG_ID.TEMPLATE || tn === TAG_ID.HTML) {
+ return false;
+ }
+ }
+ return true;
+ }
+ hasTableBodyContextInTableScope() {
+ for (let i = this.stackTop; i >= 0; i--) {
+ const tn = this.tagIDs[i];
+ const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
+ if (ns !== NS.HTML) {
+ continue;
+ }
+ if (tn === TAG_ID.TBODY || tn === TAG_ID.THEAD || tn === TAG_ID.TFOOT) {
+ return true;
+ }
+ if (tn === TAG_ID.TABLE || tn === TAG_ID.HTML) {
+ return false;
+ }
+ }
+ return true;
+ }
+ hasInSelectScope(tagName) {
+ for (let i = this.stackTop; i >= 0; i--) {
+ const tn = this.tagIDs[i];
+ const ns = this.treeAdapter.getNamespaceURI(this.items[i]);
+ if (ns !== NS.HTML) {
+ continue;
+ }
+ if (tn === tagName) {
+ return true;
+ }
+ if (tn !== TAG_ID.OPTION && tn !== TAG_ID.OPTGROUP) {
+ return false;
+ }
+ }
+ return true;
+ }
+ //Implied end tags
+ generateImpliedEndTags() {
+ while (IMPLICIT_END_TAG_REQUIRED.has(this.currentTagId)) {
+ this.pop();
+ }
+ }
+ generateImpliedEndTagsThoroughly() {
+ while (IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {
+ this.pop();
+ }
+ }
+ generateImpliedEndTagsWithExclusion(exclusionId) {
+ while (this.currentTagId !== exclusionId && IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {
+ this.pop();
+ }
+ }
+}
+
+//Const
+const NOAH_ARK_CAPACITY = 3;
+var EntryType;
+(function (EntryType) {
+ EntryType[EntryType["Marker"] = 0] = "Marker";
+ EntryType[EntryType["Element"] = 1] = "Element";
+})(EntryType = EntryType || (EntryType = {}));
+const MARKER = { type: EntryType.Marker };
+//List of formatting elements
+class FormattingElementList {
+ constructor(treeAdapter) {
+ this.treeAdapter = treeAdapter;
+ this.entries = [];
+ this.bookmark = null;
+ }
+ //Noah Ark's condition
+ //OPTIMIZATION: at first we try to find possible candidates for exclusion using
+ //lightweight heuristics without thorough attributes check.
+ _getNoahArkConditionCandidates(newElement, neAttrs) {
+ const candidates = [];
+ const neAttrsLength = neAttrs.length;
+ const neTagName = this.treeAdapter.getTagName(newElement);
+ const neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement);
+ for (let i = 0; i < this.entries.length; i++) {
+ const entry = this.entries[i];
+ if (entry.type === EntryType.Marker) {
+ break;
+ }
+ const { element } = entry;
+ if (this.treeAdapter.getTagName(element) === neTagName &&
+ this.treeAdapter.getNamespaceURI(element) === neNamespaceURI) {
+ const elementAttrs = this.treeAdapter.getAttrList(element);
+ if (elementAttrs.length === neAttrsLength) {
+ candidates.push({ idx: i, attrs: elementAttrs });
+ }
+ }
+ }
+ return candidates;
+ }
+ _ensureNoahArkCondition(newElement) {
+ if (this.entries.length < NOAH_ARK_CAPACITY)
+ return;
+ const neAttrs = this.treeAdapter.getAttrList(newElement);
+ const candidates = this._getNoahArkConditionCandidates(newElement, neAttrs);
+ if (candidates.length < NOAH_ARK_CAPACITY)
+ return;
+ //NOTE: build attrs map for the new element, so we can perform fast lookups
+ const neAttrsMap = new Map(neAttrs.map((neAttr) => [neAttr.name, neAttr.value]));
+ let validCandidates = 0;
+ //NOTE: remove bottommost candidates, until Noah's Ark condition will not be met
+ for (let i = 0; i < candidates.length; i++) {
+ const candidate = candidates[i];
+ // We know that `candidate.attrs.length === neAttrs.length`
+ if (candidate.attrs.every((cAttr) => neAttrsMap.get(cAttr.name) === cAttr.value)) {
+ validCandidates += 1;
+ if (validCandidates >= NOAH_ARK_CAPACITY) {
+ this.entries.splice(candidate.idx, 1);
+ }
+ }
+ }
+ }
+ //Mutations
+ insertMarker() {
+ this.entries.unshift(MARKER);
+ }
+ pushElement(element, token) {
+ this._ensureNoahArkCondition(element);
+ this.entries.unshift({
+ type: EntryType.Element,
+ element,
+ token,
+ });
+ }
+ insertElementAfterBookmark(element, token) {
+ const bookmarkIdx = this.entries.indexOf(this.bookmark);
+ this.entries.splice(bookmarkIdx, 0, {
+ type: EntryType.Element,
+ element,
+ token,
+ });
+ }
+ removeEntry(entry) {
+ const entryIndex = this.entries.indexOf(entry);
+ if (entryIndex >= 0) {
+ this.entries.splice(entryIndex, 1);
+ }
+ }
+ /**
+ * Clears the list of formatting elements up to the last marker.
+ *
+ * @see https://html.spec.whatwg.org/multipage/parsing.html#clear-the-list-of-active-formatting-elements-up-to-the-last-marker
+ */
+ clearToLastMarker() {
+ const markerIdx = this.entries.indexOf(MARKER);
+ if (markerIdx >= 0) {
+ this.entries.splice(0, markerIdx + 1);
+ }
+ else {
+ this.entries.length = 0;
+ }
+ }
+ //Search
+ getElementEntryInScopeWithTagName(tagName) {
+ const entry = this.entries.find((entry) => entry.type === EntryType.Marker || this.treeAdapter.getTagName(entry.element) === tagName);
+ return entry && entry.type === EntryType.Element ? entry : null;
+ }
+ getElementEntry(element) {
+ return this.entries.find((entry) => entry.type === EntryType.Element && entry.element === element);
+ }
+}
+
+function createTextNode(value) {
+ return {
+ nodeName: '#text',
+ value,
+ parentNode: null,
+ };
+}
+const defaultTreeAdapter = {
+ //Node construction
+ createDocument() {
+ return {
+ nodeName: '#document',
+ mode: DOCUMENT_MODE.NO_QUIRKS,
+ childNodes: [],
+ };
+ },
+ createDocumentFragment() {
+ return {
+ nodeName: '#document-fragment',
+ childNodes: [],
+ };
+ },
+ createElement(tagName, namespaceURI, attrs) {
+ return {
+ nodeName: tagName,
+ tagName,
+ attrs,
+ namespaceURI,
+ childNodes: [],
+ parentNode: null,
+ };
+ },
+ createCommentNode(data) {
+ return {
+ nodeName: '#comment',
+ data,
+ parentNode: null,
+ };
+ },
+ //Tree mutation
+ appendChild(parentNode, newNode) {
+ parentNode.childNodes.push(newNode);
+ newNode.parentNode = parentNode;
+ },
+ insertBefore(parentNode, newNode, referenceNode) {
+ const insertionIdx = parentNode.childNodes.indexOf(referenceNode);
+ parentNode.childNodes.splice(insertionIdx, 0, newNode);
+ newNode.parentNode = parentNode;
+ },
+ setTemplateContent(templateElement, contentElement) {
+ templateElement.content = contentElement;
+ },
+ getTemplateContent(templateElement) {
+ return templateElement.content;
+ },
+ setDocumentType(document, name, publicId, systemId) {
+ const doctypeNode = document.childNodes.find((node) => node.nodeName === '#documentType');
+ if (doctypeNode) {
+ doctypeNode.name = name;
+ doctypeNode.publicId = publicId;
+ doctypeNode.systemId = systemId;
+ }
+ else {
+ const node = {
+ nodeName: '#documentType',
+ name,
+ publicId,
+ systemId,
+ parentNode: null,
+ };
+ defaultTreeAdapter.appendChild(document, node);
+ }
+ },
+ setDocumentMode(document, mode) {
+ document.mode = mode;
+ },
+ getDocumentMode(document) {
+ return document.mode;
+ },
+ detachNode(node) {
+ if (node.parentNode) {
+ const idx = node.parentNode.childNodes.indexOf(node);
+ node.parentNode.childNodes.splice(idx, 1);
+ node.parentNode = null;
+ }
+ },
+ insertText(parentNode, text) {
+ if (parentNode.childNodes.length > 0) {
+ const prevNode = parentNode.childNodes[parentNode.childNodes.length - 1];
+ if (defaultTreeAdapter.isTextNode(prevNode)) {
+ prevNode.value += text;
+ return;
+ }
+ }
+ defaultTreeAdapter.appendChild(parentNode, createTextNode(text));
+ },
+ insertTextBefore(parentNode, text, referenceNode) {
+ const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
+ if (prevNode && defaultTreeAdapter.isTextNode(prevNode)) {
+ prevNode.value += text;
+ }
+ else {
+ defaultTreeAdapter.insertBefore(parentNode, createTextNode(text), referenceNode);
+ }
+ },
+ adoptAttributes(recipient, attrs) {
+ const recipientAttrsMap = new Set(recipient.attrs.map((attr) => attr.name));
+ for (let j = 0; j < attrs.length; j++) {
+ if (!recipientAttrsMap.has(attrs[j].name)) {
+ recipient.attrs.push(attrs[j]);
+ }
+ }
+ },
+ //Tree traversing
+ getFirstChild(node) {
+ return node.childNodes[0];
+ },
+ getChildNodes(node) {
+ return node.childNodes;
+ },
+ getParentNode(node) {
+ return node.parentNode;
+ },
+ getAttrList(element) {
+ return element.attrs;
+ },
+ //Node data
+ getTagName(element) {
+ return element.tagName;
+ },
+ getNamespaceURI(element) {
+ return element.namespaceURI;
+ },
+ getTextNodeContent(textNode) {
+ return textNode.value;
+ },
+ getCommentNodeContent(commentNode) {
+ return commentNode.data;
+ },
+ getDocumentTypeNodeName(doctypeNode) {
+ return doctypeNode.name;
+ },
+ getDocumentTypeNodePublicId(doctypeNode) {
+ return doctypeNode.publicId;
+ },
+ getDocumentTypeNodeSystemId(doctypeNode) {
+ return doctypeNode.systemId;
+ },
+ //Node types
+ isTextNode(node) {
+ return node.nodeName === '#text';
+ },
+ isCommentNode(node) {
+ return node.nodeName === '#comment';
+ },
+ isDocumentTypeNode(node) {
+ return node.nodeName === '#documentType';
+ },
+ isElementNode(node) {
+ return Object.prototype.hasOwnProperty.call(node, 'tagName');
+ },
+ // Source code location
+ setNodeSourceCodeLocation(node, location) {
+ node.sourceCodeLocation = location;
+ },
+ getNodeSourceCodeLocation(node) {
+ return node.sourceCodeLocation;
+ },
+ updateNodeSourceCodeLocation(node, endLocation) {
+ node.sourceCodeLocation = { ...node.sourceCodeLocation, ...endLocation };
+ },
+};
+
+//Const
+const VALID_DOCTYPE_NAME = 'html';
+const VALID_SYSTEM_ID = 'about:legacy-compat';
+const QUIRKS_MODE_SYSTEM_ID = 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd';
+const QUIRKS_MODE_PUBLIC_ID_PREFIXES = [
+ '+//silmaril//dtd html pro v0r11 19970101//',
+ '-//as//dtd html 3.0 aswedit + extensions//',
+ '-//advasoft ltd//dtd html 3.0 aswedit + extensions//',
+ '-//ietf//dtd html 2.0 level 1//',
+ '-//ietf//dtd html 2.0 level 2//',
+ '-//ietf//dtd html 2.0 strict level 1//',
+ '-//ietf//dtd html 2.0 strict level 2//',
+ '-//ietf//dtd html 2.0 strict//',
+ '-//ietf//dtd html 2.0//',
+ '-//ietf//dtd html 2.1e//',
+ '-//ietf//dtd html 3.0//',
+ '-//ietf//dtd html 3.2 final//',
+ '-//ietf//dtd html 3.2//',
+ '-//ietf//dtd html 3//',
+ '-//ietf//dtd html level 0//',
+ '-//ietf//dtd html level 1//',
+ '-//ietf//dtd html level 2//',
+ '-//ietf//dtd html level 3//',
+ '-//ietf//dtd html strict level 0//',
+ '-//ietf//dtd html strict level 1//',
+ '-//ietf//dtd html strict level 2//',
+ '-//ietf//dtd html strict level 3//',
+ '-//ietf//dtd html strict//',
+ '-//ietf//dtd html//',
+ '-//metrius//dtd metrius presentational//',
+ '-//microsoft//dtd internet explorer 2.0 html strict//',
+ '-//microsoft//dtd internet explorer 2.0 html//',
+ '-//microsoft//dtd internet explorer 2.0 tables//',
+ '-//microsoft//dtd internet explorer 3.0 html strict//',
+ '-//microsoft//dtd internet explorer 3.0 html//',
+ '-//microsoft//dtd internet explorer 3.0 tables//',
+ '-//netscape comm. corp.//dtd html//',
+ '-//netscape comm. corp.//dtd strict html//',
+ "-//o'reilly and associates//dtd html 2.0//",
+ "-//o'reilly and associates//dtd html extended 1.0//",
+ "-//o'reilly and associates//dtd html extended relaxed 1.0//",
+ '-//sq//dtd html 2.0 hotmetal + extensions//',
+ '-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//',
+ '-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//',
+ '-//spyglass//dtd html 2.0 extended//',
+ '-//sun microsystems corp.//dtd hotjava html//',
+ '-//sun microsystems corp.//dtd hotjava strict html//',
+ '-//w3c//dtd html 3 1995-03-24//',
+ '-//w3c//dtd html 3.2 draft//',
+ '-//w3c//dtd html 3.2 final//',
+ '-//w3c//dtd html 3.2//',
+ '-//w3c//dtd html 3.2s draft//',
+ '-//w3c//dtd html 4.0 frameset//',
+ '-//w3c//dtd html 4.0 transitional//',
+ '-//w3c//dtd html experimental 19960712//',
+ '-//w3c//dtd html experimental 970421//',
+ '-//w3c//dtd w3 html//',
+ '-//w3o//dtd w3 html 3.0//',
+ '-//webtechs//dtd mozilla html 2.0//',
+ '-//webtechs//dtd mozilla html//',
+];
+const QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = [
+ ...QUIRKS_MODE_PUBLIC_ID_PREFIXES,
+ '-//w3c//dtd html 4.01 frameset//',
+ '-//w3c//dtd html 4.01 transitional//',
+];
+const QUIRKS_MODE_PUBLIC_IDS = new Set([
+ '-//w3o//dtd w3 html strict 3.0//en//',
+ '-/w3c/dtd html 4.0 transitional/en',
+ 'html',
+]);
+const LIMITED_QUIRKS_PUBLIC_ID_PREFIXES = ['-//w3c//dtd xhtml 1.0 frameset//', '-//w3c//dtd xhtml 1.0 transitional//'];
+const LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = [
+ ...LIMITED_QUIRKS_PUBLIC_ID_PREFIXES,
+ '-//w3c//dtd html 4.01 frameset//',
+ '-//w3c//dtd html 4.01 transitional//',
+];
+//Utils
+function hasPrefix(publicId, prefixes) {
+ return prefixes.some((prefix) => publicId.startsWith(prefix));
+}
+//API
+function isConforming(token) {
+ return (token.name === VALID_DOCTYPE_NAME &&
+ token.publicId === null &&
+ (token.systemId === null || token.systemId === VALID_SYSTEM_ID));
+}
+function getDocumentMode(token) {
+ if (token.name !== VALID_DOCTYPE_NAME) {
+ return DOCUMENT_MODE.QUIRKS;
+ }
+ const { systemId } = token;
+ if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) {
+ return DOCUMENT_MODE.QUIRKS;
+ }
+ let { publicId } = token;
+ if (publicId !== null) {
+ publicId = publicId.toLowerCase();
+ if (QUIRKS_MODE_PUBLIC_IDS.has(publicId)) {
+ return DOCUMENT_MODE.QUIRKS;
+ }
+ let prefixes = systemId === null ? QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES : QUIRKS_MODE_PUBLIC_ID_PREFIXES;
+ if (hasPrefix(publicId, prefixes)) {
+ return DOCUMENT_MODE.QUIRKS;
+ }
+ prefixes =
+ systemId === null ? LIMITED_QUIRKS_PUBLIC_ID_PREFIXES : LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES;
+ if (hasPrefix(publicId, prefixes)) {
+ return DOCUMENT_MODE.LIMITED_QUIRKS;
+ }
+ }
+ return DOCUMENT_MODE.NO_QUIRKS;
+}
+
+//MIME types
+const MIME_TYPES = {
+ TEXT_HTML: 'text/html',
+ APPLICATION_XML: 'application/xhtml+xml',
+};
+//Attributes
+const DEFINITION_URL_ATTR = 'definitionurl';
+const ADJUSTED_DEFINITION_URL_ATTR = 'definitionURL';
+const SVG_ATTRS_ADJUSTMENT_MAP = new Map([
+ 'attributeName',
+ 'attributeType',
+ 'baseFrequency',
+ 'baseProfile',
+ 'calcMode',
+ 'clipPathUnits',
+ 'diffuseConstant',
+ 'edgeMode',
+ 'filterUnits',
+ 'glyphRef',
+ 'gradientTransform',
+ 'gradientUnits',
+ 'kernelMatrix',
+ 'kernelUnitLength',
+ 'keyPoints',
+ 'keySplines',
+ 'keyTimes',
+ 'lengthAdjust',
+ 'limitingConeAngle',
+ 'markerHeight',
+ 'markerUnits',
+ 'markerWidth',
+ 'maskContentUnits',
+ 'maskUnits',
+ 'numOctaves',
+ 'pathLength',
+ 'patternContentUnits',
+ 'patternTransform',
+ 'patternUnits',
+ 'pointsAtX',
+ 'pointsAtY',
+ 'pointsAtZ',
+ 'preserveAlpha',
+ 'preserveAspectRatio',
+ 'primitiveUnits',
+ 'refX',
+ 'refY',
+ 'repeatCount',
+ 'repeatDur',
+ 'requiredExtensions',
+ 'requiredFeatures',
+ 'specularConstant',
+ 'specularExponent',
+ 'spreadMethod',
+ 'startOffset',
+ 'stdDeviation',
+ 'stitchTiles',
+ 'surfaceScale',
+ 'systemLanguage',
+ 'tableValues',
+ 'targetX',
+ 'targetY',
+ 'textLength',
+ 'viewBox',
+ 'viewTarget',
+ 'xChannelSelector',
+ 'yChannelSelector',
+ 'zoomAndPan',
+].map((attr) => [attr.toLowerCase(), attr]));
+const XML_ATTRS_ADJUSTMENT_MAP = new Map([
+ ['xlink:actuate', { prefix: 'xlink', name: 'actuate', namespace: NS.XLINK }],
+ ['xlink:arcrole', { prefix: 'xlink', name: 'arcrole', namespace: NS.XLINK }],
+ ['xlink:href', { prefix: 'xlink', name: 'href', namespace: NS.XLINK }],
+ ['xlink:role', { prefix: 'xlink', name: 'role', namespace: NS.XLINK }],
+ ['xlink:show', { prefix: 'xlink', name: 'show', namespace: NS.XLINK }],
+ ['xlink:title', { prefix: 'xlink', name: 'title', namespace: NS.XLINK }],
+ ['xlink:type', { prefix: 'xlink', name: 'type', namespace: NS.XLINK }],
+ ['xml:base', { prefix: 'xml', name: 'base', namespace: NS.XML }],
+ ['xml:lang', { prefix: 'xml', name: 'lang', namespace: NS.XML }],
+ ['xml:space', { prefix: 'xml', name: 'space', namespace: NS.XML }],
+ ['xmlns', { prefix: '', name: 'xmlns', namespace: NS.XMLNS }],
+ ['xmlns:xlink', { prefix: 'xmlns', name: 'xlink', namespace: NS.XMLNS }],
+]);
+//SVG tag names adjustment map
+const SVG_TAG_NAMES_ADJUSTMENT_MAP = new Map([
+ 'altGlyph',
+ 'altGlyphDef',
+ 'altGlyphItem',
+ 'animateColor',
+ 'animateMotion',
+ 'animateTransform',
+ 'clipPath',
+ 'feBlend',
+ 'feColorMatrix',
+ 'feComponentTransfer',
+ 'feComposite',
+ 'feConvolveMatrix',
+ 'feDiffuseLighting',
+ 'feDisplacementMap',
+ 'feDistantLight',
+ 'feFlood',
+ 'feFuncA',
+ 'feFuncB',
+ 'feFuncG',
+ 'feFuncR',
+ 'feGaussianBlur',
+ 'feImage',
+ 'feMerge',
+ 'feMergeNode',
+ 'feMorphology',
+ 'feOffset',
+ 'fePointLight',
+ 'feSpecularLighting',
+ 'feSpotLight',
+ 'feTile',
+ 'feTurbulence',
+ 'foreignObject',
+ 'glyphRef',
+ 'linearGradient',
+ 'radialGradient',
+ 'textPath',
+].map((tn) => [tn.toLowerCase(), tn]));
+//Tags that causes exit from foreign content
+const EXITS_FOREIGN_CONTENT = new Set([
+ TAG_ID.B,
+ TAG_ID.BIG,
+ TAG_ID.BLOCKQUOTE,
+ TAG_ID.BODY,
+ TAG_ID.BR,
+ TAG_ID.CENTER,
+ TAG_ID.CODE,
+ TAG_ID.DD,
+ TAG_ID.DIV,
+ TAG_ID.DL,
+ TAG_ID.DT,
+ TAG_ID.EM,
+ TAG_ID.EMBED,
+ TAG_ID.H1,
+ TAG_ID.H2,
+ TAG_ID.H3,
+ TAG_ID.H4,
+ TAG_ID.H5,
+ TAG_ID.H6,
+ TAG_ID.HEAD,
+ TAG_ID.HR,
+ TAG_ID.I,
+ TAG_ID.IMG,
+ TAG_ID.LI,
+ TAG_ID.LISTING,
+ TAG_ID.MENU,
+ TAG_ID.META,
+ TAG_ID.NOBR,
+ TAG_ID.OL,
+ TAG_ID.P,
+ TAG_ID.PRE,
+ TAG_ID.RUBY,
+ TAG_ID.S,
+ TAG_ID.SMALL,
+ TAG_ID.SPAN,
+ TAG_ID.STRONG,
+ TAG_ID.STRIKE,
+ TAG_ID.SUB,
+ TAG_ID.SUP,
+ TAG_ID.TABLE,
+ TAG_ID.TT,
+ TAG_ID.U,
+ TAG_ID.UL,
+ TAG_ID.VAR,
+]);
+//Check exit from foreign content
+function causesExit(startTagToken) {
+ const tn = startTagToken.tagID;
+ const isFontWithAttrs = tn === TAG_ID.FONT &&
+ startTagToken.attrs.some(({ name }) => name === ATTRS.COLOR || name === ATTRS.SIZE || name === ATTRS.FACE);
+ return isFontWithAttrs || EXITS_FOREIGN_CONTENT.has(tn);
+}
+//Token adjustments
+function adjustTokenMathMLAttrs(token) {
+ for (let i = 0; i < token.attrs.length; i++) {
+ if (token.attrs[i].name === DEFINITION_URL_ATTR) {
+ token.attrs[i].name = ADJUSTED_DEFINITION_URL_ATTR;
+ break;
+ }
+ }
+}
+function adjustTokenSVGAttrs(token) {
+ for (let i = 0; i < token.attrs.length; i++) {
+ const adjustedAttrName = SVG_ATTRS_ADJUSTMENT_MAP.get(token.attrs[i].name);
+ if (adjustedAttrName != null) {
+ token.attrs[i].name = adjustedAttrName;
+ }
+ }
+}
+function adjustTokenXMLAttrs(token) {
+ for (let i = 0; i < token.attrs.length; i++) {
+ const adjustedAttrEntry = XML_ATTRS_ADJUSTMENT_MAP.get(token.attrs[i].name);
+ if (adjustedAttrEntry) {
+ token.attrs[i].prefix = adjustedAttrEntry.prefix;
+ token.attrs[i].name = adjustedAttrEntry.name;
+ token.attrs[i].namespace = adjustedAttrEntry.namespace;
+ }
+ }
+}
+function adjustTokenSVGTagName(token) {
+ const adjustedTagName = SVG_TAG_NAMES_ADJUSTMENT_MAP.get(token.tagName);
+ if (adjustedTagName != null) {
+ token.tagName = adjustedTagName;
+ token.tagID = getTagID(token.tagName);
+ }
+}
+//Integration points
+function isMathMLTextIntegrationPoint(tn, ns) {
+ return ns === NS.MATHML && (tn === TAG_ID.MI || tn === TAG_ID.MO || tn === TAG_ID.MN || tn === TAG_ID.MS || tn === TAG_ID.MTEXT);
+}
+function isHtmlIntegrationPoint(tn, ns, attrs) {
+ if (ns === NS.MATHML && tn === TAG_ID.ANNOTATION_XML) {
+ for (let i = 0; i < attrs.length; i++) {
+ if (attrs[i].name === ATTRS.ENCODING) {
+ const value = attrs[i].value.toLowerCase();
+ return value === MIME_TYPES.TEXT_HTML || value === MIME_TYPES.APPLICATION_XML;
+ }
+ }
+ }
+ return ns === NS.SVG && (tn === TAG_ID.FOREIGN_OBJECT || tn === TAG_ID.DESC || tn === TAG_ID.TITLE);
+}
+function isIntegrationPoint(tn, ns, attrs, foreignNS) {
+ return (((!foreignNS || foreignNS === NS.HTML) && isHtmlIntegrationPoint(tn, ns, attrs)) ||
+ ((!foreignNS || foreignNS === NS.MATHML) && isMathMLTextIntegrationPoint(tn, ns)));
+}
+
+//Misc constants
+const HIDDEN_INPUT_TYPE = 'hidden';
+//Adoption agency loops iteration count
+const AA_OUTER_LOOP_ITER = 8;
+const AA_INNER_LOOP_ITER = 3;
+//Insertion modes
+var InsertionMode;
+(function (InsertionMode) {
+ InsertionMode[InsertionMode["INITIAL"] = 0] = "INITIAL";
+ InsertionMode[InsertionMode["BEFORE_HTML"] = 1] = "BEFORE_HTML";
+ InsertionMode[InsertionMode["BEFORE_HEAD"] = 2] = "BEFORE_HEAD";
+ InsertionMode[InsertionMode["IN_HEAD"] = 3] = "IN_HEAD";
+ InsertionMode[InsertionMode["IN_HEAD_NO_SCRIPT"] = 4] = "IN_HEAD_NO_SCRIPT";
+ InsertionMode[InsertionMode["AFTER_HEAD"] = 5] = "AFTER_HEAD";
+ InsertionMode[InsertionMode["IN_BODY"] = 6] = "IN_BODY";
+ InsertionMode[InsertionMode["TEXT"] = 7] = "TEXT";
+ InsertionMode[InsertionMode["IN_TABLE"] = 8] = "IN_TABLE";
+ InsertionMode[InsertionMode["IN_TABLE_TEXT"] = 9] = "IN_TABLE_TEXT";
+ InsertionMode[InsertionMode["IN_CAPTION"] = 10] = "IN_CAPTION";
+ InsertionMode[InsertionMode["IN_COLUMN_GROUP"] = 11] = "IN_COLUMN_GROUP";
+ InsertionMode[InsertionMode["IN_TABLE_BODY"] = 12] = "IN_TABLE_BODY";
+ InsertionMode[InsertionMode["IN_ROW"] = 13] = "IN_ROW";
+ InsertionMode[InsertionMode["IN_CELL"] = 14] = "IN_CELL";
+ InsertionMode[InsertionMode["IN_SELECT"] = 15] = "IN_SELECT";
+ InsertionMode[InsertionMode["IN_SELECT_IN_TABLE"] = 16] = "IN_SELECT_IN_TABLE";
+ InsertionMode[InsertionMode["IN_TEMPLATE"] = 17] = "IN_TEMPLATE";
+ InsertionMode[InsertionMode["AFTER_BODY"] = 18] = "AFTER_BODY";
+ InsertionMode[InsertionMode["IN_FRAMESET"] = 19] = "IN_FRAMESET";
+ InsertionMode[InsertionMode["AFTER_FRAMESET"] = 20] = "AFTER_FRAMESET";
+ InsertionMode[InsertionMode["AFTER_AFTER_BODY"] = 21] = "AFTER_AFTER_BODY";
+ InsertionMode[InsertionMode["AFTER_AFTER_FRAMESET"] = 22] = "AFTER_AFTER_FRAMESET";
+})(InsertionMode || (InsertionMode = {}));
+const BASE_LOC = {
+ startLine: -1,
+ startCol: -1,
+ startOffset: -1,
+ endLine: -1,
+ endCol: -1,
+ endOffset: -1,
+};
+const TABLE_STRUCTURE_TAGS = new Set([TAG_ID.TABLE, TAG_ID.TBODY, TAG_ID.TFOOT, TAG_ID.THEAD, TAG_ID.TR]);
+const defaultParserOptions = {
+ scriptingEnabled: true,
+ sourceCodeLocationInfo: false,
+ treeAdapter: defaultTreeAdapter,
+ onParseError: null,
+};
+//Parser
+class Parser {
+ constructor(options, document, fragmentContext = null, scriptHandler = null) {
+ this.fragmentContext = fragmentContext;
+ this.scriptHandler = scriptHandler;
+ this.currentToken = null;
+ this.stopped = false;
+ this.insertionMode = InsertionMode.INITIAL;
+ this.originalInsertionMode = InsertionMode.INITIAL;
+ this.headElement = null;
+ this.formElement = null;
+ /** Indicates that the current node is not an element in the HTML namespace */
+ this.currentNotInHTML = false;
+ /**
+ * The template insertion mode stack is maintained from the left.
+ * Ie. the topmost element will always have index 0.
+ */
+ this.tmplInsertionModeStack = [];
+ this.pendingCharacterTokens = [];
+ this.hasNonWhitespacePendingCharacterToken = false;
+ this.framesetOk = true;
+ this.skipNextNewLine = false;
+ this.fosterParentingEnabled = false;
+ this.options = {
+ ...defaultParserOptions,
+ ...options,
+ };
+ this.treeAdapter = this.options.treeAdapter;
+ this.onParseError = this.options.onParseError;
+ // Always enable location info if we report parse errors.
+ if (this.onParseError) {
+ this.options.sourceCodeLocationInfo = true;
+ }
+ this.document = document !== null && document !== void 0 ? document : this.treeAdapter.createDocument();
+ this.tokenizer = new Tokenizer(this.options, this);
+ this.activeFormattingElements = new FormattingElementList(this.treeAdapter);
+ this.fragmentContextID = fragmentContext ? getTagID(this.treeAdapter.getTagName(fragmentContext)) : TAG_ID.UNKNOWN;
+ this._setContextModes(fragmentContext !== null && fragmentContext !== void 0 ? fragmentContext : this.document, this.fragmentContextID);
+ this.openElements = new OpenElementStack(this.document, this.treeAdapter, this);
+ }
+ // API
+ static parse(html, options) {
+ const parser = new this(options);
+ parser.tokenizer.write(html, true);
+ return parser.document;
+ }
+ static getFragmentParser(fragmentContext, options) {
+ const opts = {
+ ...defaultParserOptions,
+ ...options,
+ };
+ //NOTE: use a element as the fragment context if no context element was provided,
+ //so we will parse in a "forgiving" manner
+ fragmentContext !== null && fragmentContext !== void 0 ? fragmentContext : (fragmentContext = opts.treeAdapter.createElement(TAG_NAMES.TEMPLATE, NS.HTML, []));
+ //NOTE: create a fake element which will be used as the `document` for fragment parsing.
+ //This is important for jsdom, where a new `document` cannot be created. This led to
+ //fragment parsing messing with the main `document`.
+ const documentMock = opts.treeAdapter.createElement('documentmock', NS.HTML, []);
+ const parser = new this(opts, documentMock, fragmentContext);
+ if (parser.fragmentContextID === TAG_ID.TEMPLATE) {
+ parser.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);
+ }
+ parser._initTokenizerForFragmentParsing();
+ parser._insertFakeRootElement();
+ parser._resetInsertionMode();
+ parser._findFormInFragmentContext();
+ return parser;
+ }
+ getFragment() {
+ const rootElement = this.treeAdapter.getFirstChild(this.document);
+ const fragment = this.treeAdapter.createDocumentFragment();
+ this._adoptNodes(rootElement, fragment);
+ return fragment;
+ }
+ //Errors
+ _err(token, code, beforeToken) {
+ var _a;
+ if (!this.onParseError)
+ return;
+ const loc = (_a = token.location) !== null && _a !== void 0 ? _a : BASE_LOC;
+ const err = {
+ code,
+ startLine: loc.startLine,
+ startCol: loc.startCol,
+ startOffset: loc.startOffset,
+ endLine: beforeToken ? loc.startLine : loc.endLine,
+ endCol: beforeToken ? loc.startCol : loc.endCol,
+ endOffset: beforeToken ? loc.startOffset : loc.endOffset,
+ };
+ this.onParseError(err);
+ }
+ //Stack events
+ onItemPush(node, tid, isTop) {
+ var _a, _b;
+ (_b = (_a = this.treeAdapter).onItemPush) === null || _b === void 0 ? void 0 : _b.call(_a, node);
+ if (isTop && this.openElements.stackTop > 0)
+ this._setContextModes(node, tid);
+ }
+ onItemPop(node, isTop) {
+ var _a, _b;
+ if (this.options.sourceCodeLocationInfo) {
+ this._setEndLocation(node, this.currentToken);
+ }
+ (_b = (_a = this.treeAdapter).onItemPop) === null || _b === void 0 ? void 0 : _b.call(_a, node, this.openElements.current);
+ if (isTop) {
+ let current;
+ let currentTagId;
+ if (this.openElements.stackTop === 0 && this.fragmentContext) {
+ current = this.fragmentContext;
+ currentTagId = this.fragmentContextID;
+ }
+ else {
+ ({ current, currentTagId } = this.openElements);
+ }
+ this._setContextModes(current, currentTagId);
+ }
+ }
+ _setContextModes(current, tid) {
+ const isHTML = current === this.document || this.treeAdapter.getNamespaceURI(current) === NS.HTML;
+ this.currentNotInHTML = !isHTML;
+ this.tokenizer.inForeignNode = !isHTML && !this._isIntegrationPoint(tid, current);
+ }
+ _switchToTextParsing(currentToken, nextTokenizerState) {
+ this._insertElement(currentToken, NS.HTML);
+ this.tokenizer.state = nextTokenizerState;
+ this.originalInsertionMode = this.insertionMode;
+ this.insertionMode = InsertionMode.TEXT;
+ }
+ switchToPlaintextParsing() {
+ this.insertionMode = InsertionMode.TEXT;
+ this.originalInsertionMode = InsertionMode.IN_BODY;
+ this.tokenizer.state = TokenizerMode.PLAINTEXT;
+ }
+ //Fragment parsing
+ _getAdjustedCurrentElement() {
+ return this.openElements.stackTop === 0 && this.fragmentContext
+ ? this.fragmentContext
+ : this.openElements.current;
+ }
+ _findFormInFragmentContext() {
+ let node = this.fragmentContext;
+ while (node) {
+ if (this.treeAdapter.getTagName(node) === TAG_NAMES.FORM) {
+ this.formElement = node;
+ break;
+ }
+ node = this.treeAdapter.getParentNode(node);
+ }
+ }
+ _initTokenizerForFragmentParsing() {
+ if (!this.fragmentContext || this.treeAdapter.getNamespaceURI(this.fragmentContext) !== NS.HTML) {
+ return;
+ }
+ switch (this.fragmentContextID) {
+ case TAG_ID.TITLE:
+ case TAG_ID.TEXTAREA: {
+ this.tokenizer.state = TokenizerMode.RCDATA;
+ break;
+ }
+ case TAG_ID.STYLE:
+ case TAG_ID.XMP:
+ case TAG_ID.IFRAME:
+ case TAG_ID.NOEMBED:
+ case TAG_ID.NOFRAMES:
+ case TAG_ID.NOSCRIPT: {
+ this.tokenizer.state = TokenizerMode.RAWTEXT;
+ break;
+ }
+ case TAG_ID.SCRIPT: {
+ this.tokenizer.state = TokenizerMode.SCRIPT_DATA;
+ break;
+ }
+ case TAG_ID.PLAINTEXT: {
+ this.tokenizer.state = TokenizerMode.PLAINTEXT;
+ break;
+ }
+ // Do nothing
+ }
+ }
+ //Tree mutation
+ _setDocumentType(token) {
+ const name = token.name || '';
+ const publicId = token.publicId || '';
+ const systemId = token.systemId || '';
+ this.treeAdapter.setDocumentType(this.document, name, publicId, systemId);
+ if (token.location) {
+ const documentChildren = this.treeAdapter.getChildNodes(this.document);
+ const docTypeNode = documentChildren.find((node) => this.treeAdapter.isDocumentTypeNode(node));
+ if (docTypeNode) {
+ this.treeAdapter.setNodeSourceCodeLocation(docTypeNode, token.location);
+ }
+ }
+ }
+ _attachElementToTree(element, location) {
+ if (this.options.sourceCodeLocationInfo) {
+ const loc = location && {
+ ...location,
+ startTag: location,
+ };
+ this.treeAdapter.setNodeSourceCodeLocation(element, loc);
+ }
+ if (this._shouldFosterParentOnInsertion()) {
+ this._fosterParentElement(element);
+ }
+ else {
+ const parent = this.openElements.currentTmplContentOrNode;
+ this.treeAdapter.appendChild(parent, element);
+ }
+ }
+ _appendElement(token, namespaceURI) {
+ const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
+ this._attachElementToTree(element, token.location);
+ }
+ _insertElement(token, namespaceURI) {
+ const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs);
+ this._attachElementToTree(element, token.location);
+ this.openElements.push(element, token.tagID);
+ }
+ _insertFakeElement(tagName, tagID) {
+ const element = this.treeAdapter.createElement(tagName, NS.HTML, []);
+ this._attachElementToTree(element, null);
+ this.openElements.push(element, tagID);
+ }
+ _insertTemplate(token) {
+ const tmpl = this.treeAdapter.createElement(token.tagName, NS.HTML, token.attrs);
+ const content = this.treeAdapter.createDocumentFragment();
+ this.treeAdapter.setTemplateContent(tmpl, content);
+ this._attachElementToTree(tmpl, token.location);
+ this.openElements.push(tmpl, token.tagID);
+ if (this.options.sourceCodeLocationInfo)
+ this.treeAdapter.setNodeSourceCodeLocation(content, null);
+ }
+ _insertFakeRootElement() {
+ const element = this.treeAdapter.createElement(TAG_NAMES.HTML, NS.HTML, []);
+ if (this.options.sourceCodeLocationInfo)
+ this.treeAdapter.setNodeSourceCodeLocation(element, null);
+ this.treeAdapter.appendChild(this.openElements.current, element);
+ this.openElements.push(element, TAG_ID.HTML);
+ }
+ _appendCommentNode(token, parent) {
+ const commentNode = this.treeAdapter.createCommentNode(token.data);
+ this.treeAdapter.appendChild(parent, commentNode);
+ if (this.options.sourceCodeLocationInfo) {
+ this.treeAdapter.setNodeSourceCodeLocation(commentNode, token.location);
+ }
+ }
+ _insertCharacters(token) {
+ let parent;
+ let beforeElement;
+ if (this._shouldFosterParentOnInsertion()) {
+ ({ parent, beforeElement } = this._findFosterParentingLocation());
+ if (beforeElement) {
+ this.treeAdapter.insertTextBefore(parent, token.chars, beforeElement);
+ }
+ else {
+ this.treeAdapter.insertText(parent, token.chars);
+ }
+ }
+ else {
+ parent = this.openElements.currentTmplContentOrNode;
+ this.treeAdapter.insertText(parent, token.chars);
+ }
+ if (!token.location)
+ return;
+ const siblings = this.treeAdapter.getChildNodes(parent);
+ const textNodeIdx = beforeElement ? siblings.lastIndexOf(beforeElement) : siblings.length;
+ const textNode = siblings[textNodeIdx - 1];
+ //NOTE: if we have a location assigned by another token, then just update the end position
+ const tnLoc = this.treeAdapter.getNodeSourceCodeLocation(textNode);
+ if (tnLoc) {
+ const { endLine, endCol, endOffset } = token.location;
+ this.treeAdapter.updateNodeSourceCodeLocation(textNode, { endLine, endCol, endOffset });
+ }
+ else if (this.options.sourceCodeLocationInfo) {
+ this.treeAdapter.setNodeSourceCodeLocation(textNode, token.location);
+ }
+ }
+ _adoptNodes(donor, recipient) {
+ for (let child = this.treeAdapter.getFirstChild(donor); child; child = this.treeAdapter.getFirstChild(donor)) {
+ this.treeAdapter.detachNode(child);
+ this.treeAdapter.appendChild(recipient, child);
+ }
+ }
+ _setEndLocation(element, closingToken) {
+ if (this.treeAdapter.getNodeSourceCodeLocation(element) && closingToken.location) {
+ const ctLoc = closingToken.location;
+ const tn = this.treeAdapter.getTagName(element);
+ const endLoc =
+ // NOTE: For cases like
- First 'p' closes without a closing
+ // tag and for cases like
- 'p' closes without a closing tag.
+ closingToken.type === TokenType.END_TAG && tn === closingToken.tagName
+ ? {
+ endTag: { ...ctLoc },
+ endLine: ctLoc.endLine,
+ endCol: ctLoc.endCol,
+ endOffset: ctLoc.endOffset,
+ }
+ : {
+ endLine: ctLoc.startLine,
+ endCol: ctLoc.startCol,
+ endOffset: ctLoc.startOffset,
+ };
+ this.treeAdapter.updateNodeSourceCodeLocation(element, endLoc);
+ }
+ }
+ //Token processing
+ shouldProcessStartTagTokenInForeignContent(token) {
+ // Check that neither current === document, or ns === NS.HTML
+ if (!this.currentNotInHTML)
+ return false;
+ let current;
+ let currentTagId;
+ if (this.openElements.stackTop === 0 && this.fragmentContext) {
+ current = this.fragmentContext;
+ currentTagId = this.fragmentContextID;
+ }
+ else {
+ ({ current, currentTagId } = this.openElements);
+ }
+ if (token.tagID === TAG_ID.SVG &&
+ this.treeAdapter.getTagName(current) === TAG_NAMES.ANNOTATION_XML &&
+ this.treeAdapter.getNamespaceURI(current) === NS.MATHML) {
+ return false;
+ }
+ return (
+ // Check that `current` is not an integration point for HTML or MathML elements.
+ this.tokenizer.inForeignNode ||
+ // If it _is_ an integration point, then we might have to check that it is not an HTML
+ // integration point.
+ ((token.tagID === TAG_ID.MGLYPH || token.tagID === TAG_ID.MALIGNMARK) &&
+ !this._isIntegrationPoint(currentTagId, current, NS.HTML)));
+ }
+ _processToken(token) {
+ switch (token.type) {
+ case TokenType.CHARACTER: {
+ this.onCharacter(token);
+ break;
+ }
+ case TokenType.NULL_CHARACTER: {
+ this.onNullCharacter(token);
+ break;
+ }
+ case TokenType.COMMENT: {
+ this.onComment(token);
+ break;
+ }
+ case TokenType.DOCTYPE: {
+ this.onDoctype(token);
+ break;
+ }
+ case TokenType.START_TAG: {
+ this._processStartTag(token);
+ break;
+ }
+ case TokenType.END_TAG: {
+ this.onEndTag(token);
+ break;
+ }
+ case TokenType.EOF: {
+ this.onEof(token);
+ break;
+ }
+ case TokenType.WHITESPACE_CHARACTER: {
+ this.onWhitespaceCharacter(token);
+ break;
+ }
+ }
+ }
+ //Integration points
+ _isIntegrationPoint(tid, element, foreignNS) {
+ const ns = this.treeAdapter.getNamespaceURI(element);
+ const attrs = this.treeAdapter.getAttrList(element);
+ return isIntegrationPoint(tid, ns, attrs, foreignNS);
+ }
+ //Active formatting elements reconstruction
+ _reconstructActiveFormattingElements() {
+ const listLength = this.activeFormattingElements.entries.length;
+ if (listLength) {
+ const endIndex = this.activeFormattingElements.entries.findIndex((entry) => entry.type === EntryType.Marker || this.openElements.contains(entry.element));
+ const unopenIdx = endIndex < 0 ? listLength - 1 : endIndex - 1;
+ for (let i = unopenIdx; i >= 0; i--) {
+ const entry = this.activeFormattingElements.entries[i];
+ this._insertElement(entry.token, this.treeAdapter.getNamespaceURI(entry.element));
+ entry.element = this.openElements.current;
+ }
+ }
+ }
+ //Close elements
+ _closeTableCell() {
+ this.openElements.generateImpliedEndTags();
+ this.openElements.popUntilTableCellPopped();
+ this.activeFormattingElements.clearToLastMarker();
+ this.insertionMode = InsertionMode.IN_ROW;
+ }
+ _closePElement() {
+ this.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.P);
+ this.openElements.popUntilTagNamePopped(TAG_ID.P);
+ }
+ //Insertion modes
+ _resetInsertionMode() {
+ for (let i = this.openElements.stackTop; i >= 0; i--) {
+ //Insertion mode reset map
+ switch (i === 0 && this.fragmentContext ? this.fragmentContextID : this.openElements.tagIDs[i]) {
+ case TAG_ID.TR: {
+ this.insertionMode = InsertionMode.IN_ROW;
+ return;
+ }
+ case TAG_ID.TBODY:
+ case TAG_ID.THEAD:
+ case TAG_ID.TFOOT: {
+ this.insertionMode = InsertionMode.IN_TABLE_BODY;
+ return;
+ }
+ case TAG_ID.CAPTION: {
+ this.insertionMode = InsertionMode.IN_CAPTION;
+ return;
+ }
+ case TAG_ID.COLGROUP: {
+ this.insertionMode = InsertionMode.IN_COLUMN_GROUP;
+ return;
+ }
+ case TAG_ID.TABLE: {
+ this.insertionMode = InsertionMode.IN_TABLE;
+ return;
+ }
+ case TAG_ID.BODY: {
+ this.insertionMode = InsertionMode.IN_BODY;
+ return;
+ }
+ case TAG_ID.FRAMESET: {
+ this.insertionMode = InsertionMode.IN_FRAMESET;
+ return;
+ }
+ case TAG_ID.SELECT: {
+ this._resetInsertionModeForSelect(i);
+ return;
+ }
+ case TAG_ID.TEMPLATE: {
+ this.insertionMode = this.tmplInsertionModeStack[0];
+ return;
+ }
+ case TAG_ID.HTML: {
+ this.insertionMode = this.headElement ? InsertionMode.AFTER_HEAD : InsertionMode.BEFORE_HEAD;
+ return;
+ }
+ case TAG_ID.TD:
+ case TAG_ID.TH: {
+ if (i > 0) {
+ this.insertionMode = InsertionMode.IN_CELL;
+ return;
+ }
+ break;
+ }
+ case TAG_ID.HEAD: {
+ if (i > 0) {
+ this.insertionMode = InsertionMode.IN_HEAD;
+ return;
+ }
+ break;
+ }
+ }
+ }
+ this.insertionMode = InsertionMode.IN_BODY;
+ }
+ _resetInsertionModeForSelect(selectIdx) {
+ if (selectIdx > 0) {
+ for (let i = selectIdx - 1; i > 0; i--) {
+ const tn = this.openElements.tagIDs[i];
+ if (tn === TAG_ID.TEMPLATE) {
+ break;
+ }
+ else if (tn === TAG_ID.TABLE) {
+ this.insertionMode = InsertionMode.IN_SELECT_IN_TABLE;
+ return;
+ }
+ }
+ }
+ this.insertionMode = InsertionMode.IN_SELECT;
+ }
+ //Foster parenting
+ _isElementCausesFosterParenting(tn) {
+ return TABLE_STRUCTURE_TAGS.has(tn);
+ }
+ _shouldFosterParentOnInsertion() {
+ return this.fosterParentingEnabled && this._isElementCausesFosterParenting(this.openElements.currentTagId);
+ }
+ _findFosterParentingLocation() {
+ for (let i = this.openElements.stackTop; i >= 0; i--) {
+ const openElement = this.openElements.items[i];
+ switch (this.openElements.tagIDs[i]) {
+ case TAG_ID.TEMPLATE: {
+ if (this.treeAdapter.getNamespaceURI(openElement) === NS.HTML) {
+ return { parent: this.treeAdapter.getTemplateContent(openElement), beforeElement: null };
+ }
+ break;
+ }
+ case TAG_ID.TABLE: {
+ const parent = this.treeAdapter.getParentNode(openElement);
+ if (parent) {
+ return { parent, beforeElement: openElement };
+ }
+ return { parent: this.openElements.items[i - 1], beforeElement: null };
+ }
+ // Do nothing
+ }
+ }
+ return { parent: this.openElements.items[0], beforeElement: null };
+ }
+ _fosterParentElement(element) {
+ const location = this._findFosterParentingLocation();
+ if (location.beforeElement) {
+ this.treeAdapter.insertBefore(location.parent, element, location.beforeElement);
+ }
+ else {
+ this.treeAdapter.appendChild(location.parent, element);
+ }
+ }
+ //Special elements
+ _isSpecialElement(element, id) {
+ const ns = this.treeAdapter.getNamespaceURI(element);
+ return SPECIAL_ELEMENTS[ns].has(id);
+ }
+ onCharacter(token) {
+ this.skipNextNewLine = false;
+ if (this.tokenizer.inForeignNode) {
+ characterInForeignContent(this, token);
+ return;
+ }
+ switch (this.insertionMode) {
+ case InsertionMode.INITIAL: {
+ tokenInInitialMode(this, token);
+ break;
+ }
+ case InsertionMode.BEFORE_HTML: {
+ tokenBeforeHtml(this, token);
+ break;
+ }
+ case InsertionMode.BEFORE_HEAD: {
+ tokenBeforeHead(this, token);
+ break;
+ }
+ case InsertionMode.IN_HEAD: {
+ tokenInHead(this, token);
+ break;
+ }
+ case InsertionMode.IN_HEAD_NO_SCRIPT: {
+ tokenInHeadNoScript(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_HEAD: {
+ tokenAfterHead(this, token);
+ break;
+ }
+ case InsertionMode.IN_BODY:
+ case InsertionMode.IN_CAPTION:
+ case InsertionMode.IN_CELL:
+ case InsertionMode.IN_TEMPLATE: {
+ characterInBody(this, token);
+ break;
+ }
+ case InsertionMode.TEXT:
+ case InsertionMode.IN_SELECT:
+ case InsertionMode.IN_SELECT_IN_TABLE: {
+ this._insertCharacters(token);
+ break;
+ }
+ case InsertionMode.IN_TABLE:
+ case InsertionMode.IN_TABLE_BODY:
+ case InsertionMode.IN_ROW: {
+ characterInTable(this, token);
+ break;
+ }
+ case InsertionMode.IN_TABLE_TEXT: {
+ characterInTableText(this, token);
+ break;
+ }
+ case InsertionMode.IN_COLUMN_GROUP: {
+ tokenInColumnGroup(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_BODY: {
+ tokenAfterBody(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_AFTER_BODY: {
+ tokenAfterAfterBody(this, token);
+ break;
+ }
+ // Do nothing
+ }
+ }
+ onNullCharacter(token) {
+ this.skipNextNewLine = false;
+ if (this.tokenizer.inForeignNode) {
+ nullCharacterInForeignContent(this, token);
+ return;
+ }
+ switch (this.insertionMode) {
+ case InsertionMode.INITIAL: {
+ tokenInInitialMode(this, token);
+ break;
+ }
+ case InsertionMode.BEFORE_HTML: {
+ tokenBeforeHtml(this, token);
+ break;
+ }
+ case InsertionMode.BEFORE_HEAD: {
+ tokenBeforeHead(this, token);
+ break;
+ }
+ case InsertionMode.IN_HEAD: {
+ tokenInHead(this, token);
+ break;
+ }
+ case InsertionMode.IN_HEAD_NO_SCRIPT: {
+ tokenInHeadNoScript(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_HEAD: {
+ tokenAfterHead(this, token);
+ break;
+ }
+ case InsertionMode.TEXT: {
+ this._insertCharacters(token);
+ break;
+ }
+ case InsertionMode.IN_TABLE:
+ case InsertionMode.IN_TABLE_BODY:
+ case InsertionMode.IN_ROW: {
+ characterInTable(this, token);
+ break;
+ }
+ case InsertionMode.IN_COLUMN_GROUP: {
+ tokenInColumnGroup(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_BODY: {
+ tokenAfterBody(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_AFTER_BODY: {
+ tokenAfterAfterBody(this, token);
+ break;
+ }
+ // Do nothing
+ }
+ }
+ onComment(token) {
+ this.skipNextNewLine = false;
+ if (this.currentNotInHTML) {
+ appendComment(this, token);
+ return;
+ }
+ switch (this.insertionMode) {
+ case InsertionMode.INITIAL:
+ case InsertionMode.BEFORE_HTML:
+ case InsertionMode.BEFORE_HEAD:
+ case InsertionMode.IN_HEAD:
+ case InsertionMode.IN_HEAD_NO_SCRIPT:
+ case InsertionMode.AFTER_HEAD:
+ case InsertionMode.IN_BODY:
+ case InsertionMode.IN_TABLE:
+ case InsertionMode.IN_CAPTION:
+ case InsertionMode.IN_COLUMN_GROUP:
+ case InsertionMode.IN_TABLE_BODY:
+ case InsertionMode.IN_ROW:
+ case InsertionMode.IN_CELL:
+ case InsertionMode.IN_SELECT:
+ case InsertionMode.IN_SELECT_IN_TABLE:
+ case InsertionMode.IN_TEMPLATE:
+ case InsertionMode.IN_FRAMESET:
+ case InsertionMode.AFTER_FRAMESET: {
+ appendComment(this, token);
+ break;
+ }
+ case InsertionMode.IN_TABLE_TEXT: {
+ tokenInTableText(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_BODY: {
+ appendCommentToRootHtmlElement(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_AFTER_BODY:
+ case InsertionMode.AFTER_AFTER_FRAMESET: {
+ appendCommentToDocument(this, token);
+ break;
+ }
+ // Do nothing
+ }
+ }
+ onDoctype(token) {
+ this.skipNextNewLine = false;
+ switch (this.insertionMode) {
+ case InsertionMode.INITIAL: {
+ doctypeInInitialMode(this, token);
+ break;
+ }
+ case InsertionMode.BEFORE_HEAD:
+ case InsertionMode.IN_HEAD:
+ case InsertionMode.IN_HEAD_NO_SCRIPT:
+ case InsertionMode.AFTER_HEAD: {
+ this._err(token, ERR.misplacedDoctype);
+ break;
+ }
+ case InsertionMode.IN_TABLE_TEXT: {
+ tokenInTableText(this, token);
+ break;
+ }
+ // Do nothing
+ }
+ }
+ onStartTag(token) {
+ this.skipNextNewLine = false;
+ this.currentToken = token;
+ this._processStartTag(token);
+ if (token.selfClosing && !token.ackSelfClosing) {
+ this._err(token, ERR.nonVoidHtmlElementStartTagWithTrailingSolidus);
+ }
+ }
+ /**
+ * Processes a given start tag.
+ *
+ * `onStartTag` checks if a self-closing tag was recognized. When a token
+ * is moved inbetween multiple insertion modes, this check for self-closing
+ * could lead to false positives. To avoid this, `_processStartTag` is used
+ * for nested calls.
+ *
+ * @param token The token to process.
+ */
+ _processStartTag(token) {
+ if (this.shouldProcessStartTagTokenInForeignContent(token)) {
+ startTagInForeignContent(this, token);
+ }
+ else {
+ this._startTagOutsideForeignContent(token);
+ }
+ }
+ _startTagOutsideForeignContent(token) {
+ switch (this.insertionMode) {
+ case InsertionMode.INITIAL: {
+ tokenInInitialMode(this, token);
+ break;
+ }
+ case InsertionMode.BEFORE_HTML: {
+ startTagBeforeHtml(this, token);
+ break;
+ }
+ case InsertionMode.BEFORE_HEAD: {
+ startTagBeforeHead(this, token);
+ break;
+ }
+ case InsertionMode.IN_HEAD: {
+ startTagInHead(this, token);
+ break;
+ }
+ case InsertionMode.IN_HEAD_NO_SCRIPT: {
+ startTagInHeadNoScript(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_HEAD: {
+ startTagAfterHead(this, token);
+ break;
+ }
+ case InsertionMode.IN_BODY: {
+ startTagInBody(this, token);
+ break;
+ }
+ case InsertionMode.IN_TABLE: {
+ startTagInTable(this, token);
+ break;
+ }
+ case InsertionMode.IN_TABLE_TEXT: {
+ tokenInTableText(this, token);
+ break;
+ }
+ case InsertionMode.IN_CAPTION: {
+ startTagInCaption(this, token);
+ break;
+ }
+ case InsertionMode.IN_COLUMN_GROUP: {
+ startTagInColumnGroup(this, token);
+ break;
+ }
+ case InsertionMode.IN_TABLE_BODY: {
+ startTagInTableBody(this, token);
+ break;
+ }
+ case InsertionMode.IN_ROW: {
+ startTagInRow(this, token);
+ break;
+ }
+ case InsertionMode.IN_CELL: {
+ startTagInCell(this, token);
+ break;
+ }
+ case InsertionMode.IN_SELECT: {
+ startTagInSelect(this, token);
+ break;
+ }
+ case InsertionMode.IN_SELECT_IN_TABLE: {
+ startTagInSelectInTable(this, token);
+ break;
+ }
+ case InsertionMode.IN_TEMPLATE: {
+ startTagInTemplate(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_BODY: {
+ startTagAfterBody(this, token);
+ break;
+ }
+ case InsertionMode.IN_FRAMESET: {
+ startTagInFrameset(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_FRAMESET: {
+ startTagAfterFrameset(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_AFTER_BODY: {
+ startTagAfterAfterBody(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_AFTER_FRAMESET: {
+ startTagAfterAfterFrameset(this, token);
+ break;
+ }
+ // Do nothing
+ }
+ }
+ onEndTag(token) {
+ this.skipNextNewLine = false;
+ this.currentToken = token;
+ if (this.currentNotInHTML) {
+ endTagInForeignContent(this, token);
+ }
+ else {
+ this._endTagOutsideForeignContent(token);
+ }
+ }
+ _endTagOutsideForeignContent(token) {
+ switch (this.insertionMode) {
+ case InsertionMode.INITIAL: {
+ tokenInInitialMode(this, token);
+ break;
+ }
+ case InsertionMode.BEFORE_HTML: {
+ endTagBeforeHtml(this, token);
+ break;
+ }
+ case InsertionMode.BEFORE_HEAD: {
+ endTagBeforeHead(this, token);
+ break;
+ }
+ case InsertionMode.IN_HEAD: {
+ endTagInHead(this, token);
+ break;
+ }
+ case InsertionMode.IN_HEAD_NO_SCRIPT: {
+ endTagInHeadNoScript(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_HEAD: {
+ endTagAfterHead(this, token);
+ break;
+ }
+ case InsertionMode.IN_BODY: {
+ endTagInBody(this, token);
+ break;
+ }
+ case InsertionMode.TEXT: {
+ endTagInText(this, token);
+ break;
+ }
+ case InsertionMode.IN_TABLE: {
+ endTagInTable(this, token);
+ break;
+ }
+ case InsertionMode.IN_TABLE_TEXT: {
+ tokenInTableText(this, token);
+ break;
+ }
+ case InsertionMode.IN_CAPTION: {
+ endTagInCaption(this, token);
+ break;
+ }
+ case InsertionMode.IN_COLUMN_GROUP: {
+ endTagInColumnGroup(this, token);
+ break;
+ }
+ case InsertionMode.IN_TABLE_BODY: {
+ endTagInTableBody(this, token);
+ break;
+ }
+ case InsertionMode.IN_ROW: {
+ endTagInRow(this, token);
+ break;
+ }
+ case InsertionMode.IN_CELL: {
+ endTagInCell(this, token);
+ break;
+ }
+ case InsertionMode.IN_SELECT: {
+ endTagInSelect(this, token);
+ break;
+ }
+ case InsertionMode.IN_SELECT_IN_TABLE: {
+ endTagInSelectInTable(this, token);
+ break;
+ }
+ case InsertionMode.IN_TEMPLATE: {
+ endTagInTemplate(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_BODY: {
+ endTagAfterBody(this, token);
+ break;
+ }
+ case InsertionMode.IN_FRAMESET: {
+ endTagInFrameset(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_FRAMESET: {
+ endTagAfterFrameset(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_AFTER_BODY: {
+ tokenAfterAfterBody(this, token);
+ break;
+ }
+ // Do nothing
+ }
+ }
+ onEof(token) {
+ switch (this.insertionMode) {
+ case InsertionMode.INITIAL: {
+ tokenInInitialMode(this, token);
+ break;
+ }
+ case InsertionMode.BEFORE_HTML: {
+ tokenBeforeHtml(this, token);
+ break;
+ }
+ case InsertionMode.BEFORE_HEAD: {
+ tokenBeforeHead(this, token);
+ break;
+ }
+ case InsertionMode.IN_HEAD: {
+ tokenInHead(this, token);
+ break;
+ }
+ case InsertionMode.IN_HEAD_NO_SCRIPT: {
+ tokenInHeadNoScript(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_HEAD: {
+ tokenAfterHead(this, token);
+ break;
+ }
+ case InsertionMode.IN_BODY:
+ case InsertionMode.IN_TABLE:
+ case InsertionMode.IN_CAPTION:
+ case InsertionMode.IN_COLUMN_GROUP:
+ case InsertionMode.IN_TABLE_BODY:
+ case InsertionMode.IN_ROW:
+ case InsertionMode.IN_CELL:
+ case InsertionMode.IN_SELECT:
+ case InsertionMode.IN_SELECT_IN_TABLE: {
+ eofInBody(this, token);
+ break;
+ }
+ case InsertionMode.TEXT: {
+ eofInText(this, token);
+ break;
+ }
+ case InsertionMode.IN_TABLE_TEXT: {
+ tokenInTableText(this, token);
+ break;
+ }
+ case InsertionMode.IN_TEMPLATE: {
+ eofInTemplate(this, token);
+ break;
+ }
+ case InsertionMode.AFTER_BODY:
+ case InsertionMode.IN_FRAMESET:
+ case InsertionMode.AFTER_FRAMESET:
+ case InsertionMode.AFTER_AFTER_BODY:
+ case InsertionMode.AFTER_AFTER_FRAMESET: {
+ stopParsing(this, token);
+ break;
+ }
+ // Do nothing
+ }
+ }
+ onWhitespaceCharacter(token) {
+ if (this.skipNextNewLine) {
+ this.skipNextNewLine = false;
+ if (token.chars.charCodeAt(0) === CODE_POINTS.LINE_FEED) {
+ if (token.chars.length === 1) {
+ return;
+ }
+ token.chars = token.chars.substr(1);
+ }
+ }
+ if (this.tokenizer.inForeignNode) {
+ this._insertCharacters(token);
+ return;
+ }
+ switch (this.insertionMode) {
+ case InsertionMode.IN_HEAD:
+ case InsertionMode.IN_HEAD_NO_SCRIPT:
+ case InsertionMode.AFTER_HEAD:
+ case InsertionMode.TEXT:
+ case InsertionMode.IN_COLUMN_GROUP:
+ case InsertionMode.IN_SELECT:
+ case InsertionMode.IN_SELECT_IN_TABLE:
+ case InsertionMode.IN_FRAMESET:
+ case InsertionMode.AFTER_FRAMESET: {
+ this._insertCharacters(token);
+ break;
+ }
+ case InsertionMode.IN_BODY:
+ case InsertionMode.IN_CAPTION:
+ case InsertionMode.IN_CELL:
+ case InsertionMode.IN_TEMPLATE:
+ case InsertionMode.AFTER_BODY:
+ case InsertionMode.AFTER_AFTER_BODY:
+ case InsertionMode.AFTER_AFTER_FRAMESET: {
+ whitespaceCharacterInBody(this, token);
+ break;
+ }
+ case InsertionMode.IN_TABLE:
+ case InsertionMode.IN_TABLE_BODY:
+ case InsertionMode.IN_ROW: {
+ characterInTable(this, token);
+ break;
+ }
+ case InsertionMode.IN_TABLE_TEXT: {
+ whitespaceCharacterInTableText(this, token);
+ break;
+ }
+ // Do nothing
+ }
+ }
+}
+//Adoption agency algorithm
+//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#adoptionAgency)
+//------------------------------------------------------------------
+//Steps 5-8 of the algorithm
+function aaObtainFormattingElementEntry(p, token) {
+ let formattingElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(token.tagName);
+ if (formattingElementEntry) {
+ if (!p.openElements.contains(formattingElementEntry.element)) {
+ p.activeFormattingElements.removeEntry(formattingElementEntry);
+ formattingElementEntry = null;
+ }
+ else if (!p.openElements.hasInScope(token.tagID)) {
+ formattingElementEntry = null;
+ }
+ }
+ else {
+ genericEndTagInBody(p, token);
+ }
+ return formattingElementEntry;
+}
+//Steps 9 and 10 of the algorithm
+function aaObtainFurthestBlock(p, formattingElementEntry) {
+ let furthestBlock = null;
+ let idx = p.openElements.stackTop;
+ for (; idx >= 0; idx--) {
+ const element = p.openElements.items[idx];
+ if (element === formattingElementEntry.element) {
+ break;
+ }
+ if (p._isSpecialElement(element, p.openElements.tagIDs[idx])) {
+ furthestBlock = element;
+ }
+ }
+ if (!furthestBlock) {
+ p.openElements.shortenToLength(idx < 0 ? 0 : idx);
+ p.activeFormattingElements.removeEntry(formattingElementEntry);
+ }
+ return furthestBlock;
+}
+//Step 13 of the algorithm
+function aaInnerLoop(p, furthestBlock, formattingElement) {
+ let lastElement = furthestBlock;
+ let nextElement = p.openElements.getCommonAncestor(furthestBlock);
+ for (let i = 0, element = nextElement; element !== formattingElement; i++, element = nextElement) {
+ //NOTE: store the next element for the next loop iteration (it may be deleted from the stack by step 9.5)
+ nextElement = p.openElements.getCommonAncestor(element);
+ const elementEntry = p.activeFormattingElements.getElementEntry(element);
+ const counterOverflow = elementEntry && i >= AA_INNER_LOOP_ITER;
+ const shouldRemoveFromOpenElements = !elementEntry || counterOverflow;
+ if (shouldRemoveFromOpenElements) {
+ if (counterOverflow) {
+ p.activeFormattingElements.removeEntry(elementEntry);
+ }
+ p.openElements.remove(element);
+ }
+ else {
+ element = aaRecreateElementFromEntry(p, elementEntry);
+ if (lastElement === furthestBlock) {
+ p.activeFormattingElements.bookmark = elementEntry;
+ }
+ p.treeAdapter.detachNode(lastElement);
+ p.treeAdapter.appendChild(element, lastElement);
+ lastElement = element;
+ }
+ }
+ return lastElement;
+}
+//Step 13.7 of the algorithm
+function aaRecreateElementFromEntry(p, elementEntry) {
+ const ns = p.treeAdapter.getNamespaceURI(elementEntry.element);
+ const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);
+ p.openElements.replace(elementEntry.element, newElement);
+ elementEntry.element = newElement;
+ return newElement;
+}
+//Step 14 of the algorithm
+function aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement) {
+ const tn = p.treeAdapter.getTagName(commonAncestor);
+ const tid = getTagID(tn);
+ if (p._isElementCausesFosterParenting(tid)) {
+ p._fosterParentElement(lastElement);
+ }
+ else {
+ const ns = p.treeAdapter.getNamespaceURI(commonAncestor);
+ if (tid === TAG_ID.TEMPLATE && ns === NS.HTML) {
+ commonAncestor = p.treeAdapter.getTemplateContent(commonAncestor);
+ }
+ p.treeAdapter.appendChild(commonAncestor, lastElement);
+ }
+}
+//Steps 15-19 of the algorithm
+function aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry) {
+ const ns = p.treeAdapter.getNamespaceURI(formattingElementEntry.element);
+ const { token } = formattingElementEntry;
+ const newElement = p.treeAdapter.createElement(token.tagName, ns, token.attrs);
+ p._adoptNodes(furthestBlock, newElement);
+ p.treeAdapter.appendChild(furthestBlock, newElement);
+ p.activeFormattingElements.insertElementAfterBookmark(newElement, token);
+ p.activeFormattingElements.removeEntry(formattingElementEntry);
+ p.openElements.remove(formattingElementEntry.element);
+ p.openElements.insertAfter(furthestBlock, newElement, token.tagID);
+}
+//Algorithm entry point
+function callAdoptionAgency(p, token) {
+ for (let i = 0; i < AA_OUTER_LOOP_ITER; i++) {
+ const formattingElementEntry = aaObtainFormattingElementEntry(p, token);
+ if (!formattingElementEntry) {
+ break;
+ }
+ const furthestBlock = aaObtainFurthestBlock(p, formattingElementEntry);
+ if (!furthestBlock) {
+ break;
+ }
+ p.activeFormattingElements.bookmark = formattingElementEntry;
+ const lastElement = aaInnerLoop(p, furthestBlock, formattingElementEntry.element);
+ const commonAncestor = p.openElements.getCommonAncestor(formattingElementEntry.element);
+ p.treeAdapter.detachNode(lastElement);
+ if (commonAncestor)
+ aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement);
+ aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry);
+ }
+}
+//Generic token handlers
+//------------------------------------------------------------------
+function appendComment(p, token) {
+ p._appendCommentNode(token, p.openElements.currentTmplContentOrNode);
+}
+function appendCommentToRootHtmlElement(p, token) {
+ p._appendCommentNode(token, p.openElements.items[0]);
+}
+function appendCommentToDocument(p, token) {
+ p._appendCommentNode(token, p.document);
+}
+function stopParsing(p, token) {
+ p.stopped = true;
+ // NOTE: Set end locations for elements that remain on the open element stack.
+ if (token.location) {
+ // NOTE: If we are not in a fragment, `html` and `body` will stay on the stack.
+ // This is a problem, as we might overwrite their end position here.
+ const target = p.fragmentContext ? 0 : 2;
+ for (let i = p.openElements.stackTop; i >= target; i--) {
+ p._setEndLocation(p.openElements.items[i], token);
+ }
+ // Handle `html` and `body`
+ if (!p.fragmentContext && p.openElements.stackTop >= 0) {
+ const htmlElement = p.openElements.items[0];
+ const htmlLocation = p.treeAdapter.getNodeSourceCodeLocation(htmlElement);
+ if (htmlLocation && !htmlLocation.endTag) {
+ p._setEndLocation(htmlElement, token);
+ if (p.openElements.stackTop >= 1) {
+ const bodyElement = p.openElements.items[1];
+ const bodyLocation = p.treeAdapter.getNodeSourceCodeLocation(bodyElement);
+ if (bodyLocation && !bodyLocation.endTag) {
+ p._setEndLocation(bodyElement, token);
+ }
+ }
+ }
+ }
+ }
+}
+// The "initial" insertion mode
+//------------------------------------------------------------------
+function doctypeInInitialMode(p, token) {
+ p._setDocumentType(token);
+ const mode = token.forceQuirks ? DOCUMENT_MODE.QUIRKS : getDocumentMode(token);
+ if (!isConforming(token)) {
+ p._err(token, ERR.nonConformingDoctype);
+ }
+ p.treeAdapter.setDocumentMode(p.document, mode);
+ p.insertionMode = InsertionMode.BEFORE_HTML;
+}
+function tokenInInitialMode(p, token) {
+ p._err(token, ERR.missingDoctype, true);
+ p.treeAdapter.setDocumentMode(p.document, DOCUMENT_MODE.QUIRKS);
+ p.insertionMode = InsertionMode.BEFORE_HTML;
+ p._processToken(token);
+}
+// The "before html" insertion mode
+//------------------------------------------------------------------
+function startTagBeforeHtml(p, token) {
+ if (token.tagID === TAG_ID.HTML) {
+ p._insertElement(token, NS.HTML);
+ p.insertionMode = InsertionMode.BEFORE_HEAD;
+ }
+ else {
+ tokenBeforeHtml(p, token);
+ }
+}
+function endTagBeforeHtml(p, token) {
+ const tn = token.tagID;
+ if (tn === TAG_ID.HTML || tn === TAG_ID.HEAD || tn === TAG_ID.BODY || tn === TAG_ID.BR) {
+ tokenBeforeHtml(p, token);
+ }
+}
+function tokenBeforeHtml(p, token) {
+ p._insertFakeRootElement();
+ p.insertionMode = InsertionMode.BEFORE_HEAD;
+ p._processToken(token);
+}
+// The "before head" insertion mode
+//------------------------------------------------------------------
+function startTagBeforeHead(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.HTML: {
+ startTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.HEAD: {
+ p._insertElement(token, NS.HTML);
+ p.headElement = p.openElements.current;
+ p.insertionMode = InsertionMode.IN_HEAD;
+ break;
+ }
+ default: {
+ tokenBeforeHead(p, token);
+ }
+ }
+}
+function endTagBeforeHead(p, token) {
+ const tn = token.tagID;
+ if (tn === TAG_ID.HEAD || tn === TAG_ID.BODY || tn === TAG_ID.HTML || tn === TAG_ID.BR) {
+ tokenBeforeHead(p, token);
+ }
+ else {
+ p._err(token, ERR.endTagWithoutMatchingOpenElement);
+ }
+}
+function tokenBeforeHead(p, token) {
+ p._insertFakeElement(TAG_NAMES.HEAD, TAG_ID.HEAD);
+ p.headElement = p.openElements.current;
+ p.insertionMode = InsertionMode.IN_HEAD;
+ p._processToken(token);
+}
+// The "in head" insertion mode
+//------------------------------------------------------------------
+function startTagInHead(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.HTML: {
+ startTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.BASE:
+ case TAG_ID.BASEFONT:
+ case TAG_ID.BGSOUND:
+ case TAG_ID.LINK:
+ case TAG_ID.META: {
+ p._appendElement(token, NS.HTML);
+ token.ackSelfClosing = true;
+ break;
+ }
+ case TAG_ID.TITLE: {
+ p._switchToTextParsing(token, TokenizerMode.RCDATA);
+ break;
+ }
+ case TAG_ID.NOSCRIPT: {
+ if (p.options.scriptingEnabled) {
+ p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
+ }
+ else {
+ p._insertElement(token, NS.HTML);
+ p.insertionMode = InsertionMode.IN_HEAD_NO_SCRIPT;
+ }
+ break;
+ }
+ case TAG_ID.NOFRAMES:
+ case TAG_ID.STYLE: {
+ p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
+ break;
+ }
+ case TAG_ID.SCRIPT: {
+ p._switchToTextParsing(token, TokenizerMode.SCRIPT_DATA);
+ break;
+ }
+ case TAG_ID.TEMPLATE: {
+ p._insertTemplate(token);
+ p.activeFormattingElements.insertMarker();
+ p.framesetOk = false;
+ p.insertionMode = InsertionMode.IN_TEMPLATE;
+ p.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);
+ break;
+ }
+ case TAG_ID.HEAD: {
+ p._err(token, ERR.misplacedStartTagForHeadElement);
+ break;
+ }
+ default: {
+ tokenInHead(p, token);
+ }
+ }
+}
+function endTagInHead(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.HEAD: {
+ p.openElements.pop();
+ p.insertionMode = InsertionMode.AFTER_HEAD;
+ break;
+ }
+ case TAG_ID.BODY:
+ case TAG_ID.BR:
+ case TAG_ID.HTML: {
+ tokenInHead(p, token);
+ break;
+ }
+ case TAG_ID.TEMPLATE: {
+ templateEndTagInHead(p, token);
+ break;
+ }
+ default: {
+ p._err(token, ERR.endTagWithoutMatchingOpenElement);
+ }
+ }
+}
+function templateEndTagInHead(p, token) {
+ if (p.openElements.tmplCount > 0) {
+ p.openElements.generateImpliedEndTagsThoroughly();
+ if (p.openElements.currentTagId !== TAG_ID.TEMPLATE) {
+ p._err(token, ERR.closingOfElementWithOpenChildElements);
+ }
+ p.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE);
+ p.activeFormattingElements.clearToLastMarker();
+ p.tmplInsertionModeStack.shift();
+ p._resetInsertionMode();
+ }
+ else {
+ p._err(token, ERR.endTagWithoutMatchingOpenElement);
+ }
+}
+function tokenInHead(p, token) {
+ p.openElements.pop();
+ p.insertionMode = InsertionMode.AFTER_HEAD;
+ p._processToken(token);
+}
+// The "in head no script" insertion mode
+//------------------------------------------------------------------
+function startTagInHeadNoScript(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.HTML: {
+ startTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.BASEFONT:
+ case TAG_ID.BGSOUND:
+ case TAG_ID.HEAD:
+ case TAG_ID.LINK:
+ case TAG_ID.META:
+ case TAG_ID.NOFRAMES:
+ case TAG_ID.STYLE: {
+ startTagInHead(p, token);
+ break;
+ }
+ case TAG_ID.NOSCRIPT: {
+ p._err(token, ERR.nestedNoscriptInHead);
+ break;
+ }
+ default: {
+ tokenInHeadNoScript(p, token);
+ }
+ }
+}
+function endTagInHeadNoScript(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.NOSCRIPT: {
+ p.openElements.pop();
+ p.insertionMode = InsertionMode.IN_HEAD;
+ break;
+ }
+ case TAG_ID.BR: {
+ tokenInHeadNoScript(p, token);
+ break;
+ }
+ default: {
+ p._err(token, ERR.endTagWithoutMatchingOpenElement);
+ }
+ }
+}
+function tokenInHeadNoScript(p, token) {
+ const errCode = token.type === TokenType.EOF ? ERR.openElementsLeftAfterEof : ERR.disallowedContentInNoscriptInHead;
+ p._err(token, errCode);
+ p.openElements.pop();
+ p.insertionMode = InsertionMode.IN_HEAD;
+ p._processToken(token);
+}
+// The "after head" insertion mode
+//------------------------------------------------------------------
+function startTagAfterHead(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.HTML: {
+ startTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.BODY: {
+ p._insertElement(token, NS.HTML);
+ p.framesetOk = false;
+ p.insertionMode = InsertionMode.IN_BODY;
+ break;
+ }
+ case TAG_ID.FRAMESET: {
+ p._insertElement(token, NS.HTML);
+ p.insertionMode = InsertionMode.IN_FRAMESET;
+ break;
+ }
+ case TAG_ID.BASE:
+ case TAG_ID.BASEFONT:
+ case TAG_ID.BGSOUND:
+ case TAG_ID.LINK:
+ case TAG_ID.META:
+ case TAG_ID.NOFRAMES:
+ case TAG_ID.SCRIPT:
+ case TAG_ID.STYLE:
+ case TAG_ID.TEMPLATE:
+ case TAG_ID.TITLE: {
+ p._err(token, ERR.abandonedHeadElementChild);
+ p.openElements.push(p.headElement, TAG_ID.HEAD);
+ startTagInHead(p, token);
+ p.openElements.remove(p.headElement);
+ break;
+ }
+ case TAG_ID.HEAD: {
+ p._err(token, ERR.misplacedStartTagForHeadElement);
+ break;
+ }
+ default: {
+ tokenAfterHead(p, token);
+ }
+ }
+}
+function endTagAfterHead(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.BODY:
+ case TAG_ID.HTML:
+ case TAG_ID.BR: {
+ tokenAfterHead(p, token);
+ break;
+ }
+ case TAG_ID.TEMPLATE: {
+ templateEndTagInHead(p, token);
+ break;
+ }
+ default: {
+ p._err(token, ERR.endTagWithoutMatchingOpenElement);
+ }
+ }
+}
+function tokenAfterHead(p, token) {
+ p._insertFakeElement(TAG_NAMES.BODY, TAG_ID.BODY);
+ p.insertionMode = InsertionMode.IN_BODY;
+ modeInBody(p, token);
+}
+// The "in body" insertion mode
+//------------------------------------------------------------------
+function modeInBody(p, token) {
+ switch (token.type) {
+ case TokenType.CHARACTER: {
+ characterInBody(p, token);
+ break;
+ }
+ case TokenType.WHITESPACE_CHARACTER: {
+ whitespaceCharacterInBody(p, token);
+ break;
+ }
+ case TokenType.COMMENT: {
+ appendComment(p, token);
+ break;
+ }
+ case TokenType.START_TAG: {
+ startTagInBody(p, token);
+ break;
+ }
+ case TokenType.END_TAG: {
+ endTagInBody(p, token);
+ break;
+ }
+ case TokenType.EOF: {
+ eofInBody(p, token);
+ break;
+ }
+ // Do nothing
+ }
+}
+function whitespaceCharacterInBody(p, token) {
+ p._reconstructActiveFormattingElements();
+ p._insertCharacters(token);
+}
+function characterInBody(p, token) {
+ p._reconstructActiveFormattingElements();
+ p._insertCharacters(token);
+ p.framesetOk = false;
+}
+function htmlStartTagInBody(p, token) {
+ if (p.openElements.tmplCount === 0) {
+ p.treeAdapter.adoptAttributes(p.openElements.items[0], token.attrs);
+ }
+}
+function bodyStartTagInBody(p, token) {
+ const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
+ if (bodyElement && p.openElements.tmplCount === 0) {
+ p.framesetOk = false;
+ p.treeAdapter.adoptAttributes(bodyElement, token.attrs);
+ }
+}
+function framesetStartTagInBody(p, token) {
+ const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
+ if (p.framesetOk && bodyElement) {
+ p.treeAdapter.detachNode(bodyElement);
+ p.openElements.popAllUpToHtmlElement();
+ p._insertElement(token, NS.HTML);
+ p.insertionMode = InsertionMode.IN_FRAMESET;
+ }
+}
+function addressStartTagInBody(p, token) {
+ if (p.openElements.hasInButtonScope(TAG_ID.P)) {
+ p._closePElement();
+ }
+ p._insertElement(token, NS.HTML);
+}
+function numberedHeaderStartTagInBody(p, token) {
+ if (p.openElements.hasInButtonScope(TAG_ID.P)) {
+ p._closePElement();
+ }
+ if (isNumberedHeader(p.openElements.currentTagId)) {
+ p.openElements.pop();
+ }
+ p._insertElement(token, NS.HTML);
+}
+function preStartTagInBody(p, token) {
+ if (p.openElements.hasInButtonScope(TAG_ID.P)) {
+ p._closePElement();
+ }
+ p._insertElement(token, NS.HTML);
+ //NOTE: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move
+ //on to the next one. (Newlines at the start of pre blocks are ignored as an authoring convenience.)
+ p.skipNextNewLine = true;
+ p.framesetOk = false;
+}
+function formStartTagInBody(p, token) {
+ const inTemplate = p.openElements.tmplCount > 0;
+ if (!p.formElement || inTemplate) {
+ if (p.openElements.hasInButtonScope(TAG_ID.P)) {
+ p._closePElement();
+ }
+ p._insertElement(token, NS.HTML);
+ if (!inTemplate) {
+ p.formElement = p.openElements.current;
+ }
+ }
+}
+function listItemStartTagInBody(p, token) {
+ p.framesetOk = false;
+ const tn = token.tagID;
+ for (let i = p.openElements.stackTop; i >= 0; i--) {
+ const elementId = p.openElements.tagIDs[i];
+ if ((tn === TAG_ID.LI && elementId === TAG_ID.LI) ||
+ ((tn === TAG_ID.DD || tn === TAG_ID.DT) && (elementId === TAG_ID.DD || elementId === TAG_ID.DT))) {
+ p.openElements.generateImpliedEndTagsWithExclusion(elementId);
+ p.openElements.popUntilTagNamePopped(elementId);
+ break;
+ }
+ if (elementId !== TAG_ID.ADDRESS &&
+ elementId !== TAG_ID.DIV &&
+ elementId !== TAG_ID.P &&
+ p._isSpecialElement(p.openElements.items[i], elementId)) {
+ break;
+ }
+ }
+ if (p.openElements.hasInButtonScope(TAG_ID.P)) {
+ p._closePElement();
+ }
+ p._insertElement(token, NS.HTML);
+}
+function plaintextStartTagInBody(p, token) {
+ if (p.openElements.hasInButtonScope(TAG_ID.P)) {
+ p._closePElement();
+ }
+ p._insertElement(token, NS.HTML);
+ p.tokenizer.state = TokenizerMode.PLAINTEXT;
+}
+function buttonStartTagInBody(p, token) {
+ if (p.openElements.hasInScope(TAG_ID.BUTTON)) {
+ p.openElements.generateImpliedEndTags();
+ p.openElements.popUntilTagNamePopped(TAG_ID.BUTTON);
+ }
+ p._reconstructActiveFormattingElements();
+ p._insertElement(token, NS.HTML);
+ p.framesetOk = false;
+}
+function aStartTagInBody(p, token) {
+ const activeElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(TAG_NAMES.A);
+ if (activeElementEntry) {
+ callAdoptionAgency(p, token);
+ p.openElements.remove(activeElementEntry.element);
+ p.activeFormattingElements.removeEntry(activeElementEntry);
+ }
+ p._reconstructActiveFormattingElements();
+ p._insertElement(token, NS.HTML);
+ p.activeFormattingElements.pushElement(p.openElements.current, token);
+}
+function bStartTagInBody(p, token) {
+ p._reconstructActiveFormattingElements();
+ p._insertElement(token, NS.HTML);
+ p.activeFormattingElements.pushElement(p.openElements.current, token);
+}
+function nobrStartTagInBody(p, token) {
+ p._reconstructActiveFormattingElements();
+ if (p.openElements.hasInScope(TAG_ID.NOBR)) {
+ callAdoptionAgency(p, token);
+ p._reconstructActiveFormattingElements();
+ }
+ p._insertElement(token, NS.HTML);
+ p.activeFormattingElements.pushElement(p.openElements.current, token);
+}
+function appletStartTagInBody(p, token) {
+ p._reconstructActiveFormattingElements();
+ p._insertElement(token, NS.HTML);
+ p.activeFormattingElements.insertMarker();
+ p.framesetOk = false;
+}
+function tableStartTagInBody(p, token) {
+ if (p.treeAdapter.getDocumentMode(p.document) !== DOCUMENT_MODE.QUIRKS && p.openElements.hasInButtonScope(TAG_ID.P)) {
+ p._closePElement();
+ }
+ p._insertElement(token, NS.HTML);
+ p.framesetOk = false;
+ p.insertionMode = InsertionMode.IN_TABLE;
+}
+function areaStartTagInBody(p, token) {
+ p._reconstructActiveFormattingElements();
+ p._appendElement(token, NS.HTML);
+ p.framesetOk = false;
+ token.ackSelfClosing = true;
+}
+function isHiddenInput(token) {
+ const inputType = getTokenAttr(token, ATTRS.TYPE);
+ return inputType != null && inputType.toLowerCase() === HIDDEN_INPUT_TYPE;
+}
+function inputStartTagInBody(p, token) {
+ p._reconstructActiveFormattingElements();
+ p._appendElement(token, NS.HTML);
+ if (!isHiddenInput(token)) {
+ p.framesetOk = false;
+ }
+ token.ackSelfClosing = true;
+}
+function paramStartTagInBody(p, token) {
+ p._appendElement(token, NS.HTML);
+ token.ackSelfClosing = true;
+}
+function hrStartTagInBody(p, token) {
+ if (p.openElements.hasInButtonScope(TAG_ID.P)) {
+ p._closePElement();
+ }
+ p._appendElement(token, NS.HTML);
+ p.framesetOk = false;
+ token.ackSelfClosing = true;
+}
+function imageStartTagInBody(p, token) {
+ token.tagName = TAG_NAMES.IMG;
+ token.tagID = TAG_ID.IMG;
+ areaStartTagInBody(p, token);
+}
+function textareaStartTagInBody(p, token) {
+ p._insertElement(token, NS.HTML);
+ //NOTE: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move
+ //on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.)
+ p.skipNextNewLine = true;
+ p.tokenizer.state = TokenizerMode.RCDATA;
+ p.originalInsertionMode = p.insertionMode;
+ p.framesetOk = false;
+ p.insertionMode = InsertionMode.TEXT;
+}
+function xmpStartTagInBody(p, token) {
+ if (p.openElements.hasInButtonScope(TAG_ID.P)) {
+ p._closePElement();
+ }
+ p._reconstructActiveFormattingElements();
+ p.framesetOk = false;
+ p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
+}
+function iframeStartTagInBody(p, token) {
+ p.framesetOk = false;
+ p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
+}
+//NOTE: here we assume that we always act as an user agent with enabled plugins, so we parse
+// as rawtext.
+function noembedStartTagInBody(p, token) {
+ p._switchToTextParsing(token, TokenizerMode.RAWTEXT);
+}
+function selectStartTagInBody(p, token) {
+ p._reconstructActiveFormattingElements();
+ p._insertElement(token, NS.HTML);
+ p.framesetOk = false;
+ p.insertionMode =
+ p.insertionMode === InsertionMode.IN_TABLE ||
+ p.insertionMode === InsertionMode.IN_CAPTION ||
+ p.insertionMode === InsertionMode.IN_TABLE_BODY ||
+ p.insertionMode === InsertionMode.IN_ROW ||
+ p.insertionMode === InsertionMode.IN_CELL
+ ? InsertionMode.IN_SELECT_IN_TABLE
+ : InsertionMode.IN_SELECT;
+}
+function optgroupStartTagInBody(p, token) {
+ if (p.openElements.currentTagId === TAG_ID.OPTION) {
+ p.openElements.pop();
+ }
+ p._reconstructActiveFormattingElements();
+ p._insertElement(token, NS.HTML);
+}
+function rbStartTagInBody(p, token) {
+ if (p.openElements.hasInScope(TAG_ID.RUBY)) {
+ p.openElements.generateImpliedEndTags();
+ }
+ p._insertElement(token, NS.HTML);
+}
+function rtStartTagInBody(p, token) {
+ if (p.openElements.hasInScope(TAG_ID.RUBY)) {
+ p.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.RTC);
+ }
+ p._insertElement(token, NS.HTML);
+}
+function mathStartTagInBody(p, token) {
+ p._reconstructActiveFormattingElements();
+ adjustTokenMathMLAttrs(token);
+ adjustTokenXMLAttrs(token);
+ if (token.selfClosing) {
+ p._appendElement(token, NS.MATHML);
+ }
+ else {
+ p._insertElement(token, NS.MATHML);
+ }
+ token.ackSelfClosing = true;
+}
+function svgStartTagInBody(p, token) {
+ p._reconstructActiveFormattingElements();
+ adjustTokenSVGAttrs(token);
+ adjustTokenXMLAttrs(token);
+ if (token.selfClosing) {
+ p._appendElement(token, NS.SVG);
+ }
+ else {
+ p._insertElement(token, NS.SVG);
+ }
+ token.ackSelfClosing = true;
+}
+function genericStartTagInBody(p, token) {
+ p._reconstructActiveFormattingElements();
+ p._insertElement(token, NS.HTML);
+}
+function startTagInBody(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.I:
+ case TAG_ID.S:
+ case TAG_ID.B:
+ case TAG_ID.U:
+ case TAG_ID.EM:
+ case TAG_ID.TT:
+ case TAG_ID.BIG:
+ case TAG_ID.CODE:
+ case TAG_ID.FONT:
+ case TAG_ID.SMALL:
+ case TAG_ID.STRIKE:
+ case TAG_ID.STRONG: {
+ bStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.A: {
+ aStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.H1:
+ case TAG_ID.H2:
+ case TAG_ID.H3:
+ case TAG_ID.H4:
+ case TAG_ID.H5:
+ case TAG_ID.H6: {
+ numberedHeaderStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.P:
+ case TAG_ID.DL:
+ case TAG_ID.OL:
+ case TAG_ID.UL:
+ case TAG_ID.DIV:
+ case TAG_ID.DIR:
+ case TAG_ID.NAV:
+ case TAG_ID.MAIN:
+ case TAG_ID.MENU:
+ case TAG_ID.ASIDE:
+ case TAG_ID.CENTER:
+ case TAG_ID.FIGURE:
+ case TAG_ID.FOOTER:
+ case TAG_ID.HEADER:
+ case TAG_ID.HGROUP:
+ case TAG_ID.DIALOG:
+ case TAG_ID.DETAILS:
+ case TAG_ID.ADDRESS:
+ case TAG_ID.ARTICLE:
+ case TAG_ID.SECTION:
+ case TAG_ID.SUMMARY:
+ case TAG_ID.FIELDSET:
+ case TAG_ID.BLOCKQUOTE:
+ case TAG_ID.FIGCAPTION: {
+ addressStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.LI:
+ case TAG_ID.DD:
+ case TAG_ID.DT: {
+ listItemStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.BR:
+ case TAG_ID.IMG:
+ case TAG_ID.WBR:
+ case TAG_ID.AREA:
+ case TAG_ID.EMBED:
+ case TAG_ID.KEYGEN: {
+ areaStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.HR: {
+ hrStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.RB:
+ case TAG_ID.RTC: {
+ rbStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.RT:
+ case TAG_ID.RP: {
+ rtStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.PRE:
+ case TAG_ID.LISTING: {
+ preStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.XMP: {
+ xmpStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.SVG: {
+ svgStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.HTML: {
+ htmlStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.BASE:
+ case TAG_ID.LINK:
+ case TAG_ID.META:
+ case TAG_ID.STYLE:
+ case TAG_ID.TITLE:
+ case TAG_ID.SCRIPT:
+ case TAG_ID.BGSOUND:
+ case TAG_ID.BASEFONT:
+ case TAG_ID.TEMPLATE: {
+ startTagInHead(p, token);
+ break;
+ }
+ case TAG_ID.BODY: {
+ bodyStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.FORM: {
+ formStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.NOBR: {
+ nobrStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.MATH: {
+ mathStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.TABLE: {
+ tableStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.INPUT: {
+ inputStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.PARAM:
+ case TAG_ID.TRACK:
+ case TAG_ID.SOURCE: {
+ paramStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.IMAGE: {
+ imageStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.BUTTON: {
+ buttonStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.APPLET:
+ case TAG_ID.OBJECT:
+ case TAG_ID.MARQUEE: {
+ appletStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.IFRAME: {
+ iframeStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.SELECT: {
+ selectStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.OPTION:
+ case TAG_ID.OPTGROUP: {
+ optgroupStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.NOEMBED: {
+ noembedStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.FRAMESET: {
+ framesetStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.TEXTAREA: {
+ textareaStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.NOSCRIPT: {
+ if (p.options.scriptingEnabled) {
+ noembedStartTagInBody(p, token);
+ }
+ else {
+ genericStartTagInBody(p, token);
+ }
+ break;
+ }
+ case TAG_ID.PLAINTEXT: {
+ plaintextStartTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.COL:
+ case TAG_ID.TH:
+ case TAG_ID.TD:
+ case TAG_ID.TR:
+ case TAG_ID.HEAD:
+ case TAG_ID.FRAME:
+ case TAG_ID.TBODY:
+ case TAG_ID.TFOOT:
+ case TAG_ID.THEAD:
+ case TAG_ID.CAPTION:
+ case TAG_ID.COLGROUP: {
+ // Ignore token
+ break;
+ }
+ default: {
+ genericStartTagInBody(p, token);
+ }
+ }
+}
+function bodyEndTagInBody(p, token) {
+ if (p.openElements.hasInScope(TAG_ID.BODY)) {
+ p.insertionMode = InsertionMode.AFTER_BODY;
+ //NOTE: is never popped from the stack, so we need to updated
+ //the end location explicitly.
+ if (p.options.sourceCodeLocationInfo) {
+ const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement();
+ if (bodyElement) {
+ p._setEndLocation(bodyElement, token);
+ }
+ }
+ }
+}
+function htmlEndTagInBody(p, token) {
+ if (p.openElements.hasInScope(TAG_ID.BODY)) {
+ p.insertionMode = InsertionMode.AFTER_BODY;
+ endTagAfterBody(p, token);
+ }
+}
+function addressEndTagInBody(p, token) {
+ const tn = token.tagID;
+ if (p.openElements.hasInScope(tn)) {
+ p.openElements.generateImpliedEndTags();
+ p.openElements.popUntilTagNamePopped(tn);
+ }
+}
+function formEndTagInBody(p) {
+ const inTemplate = p.openElements.tmplCount > 0;
+ const { formElement } = p;
+ if (!inTemplate) {
+ p.formElement = null;
+ }
+ if ((formElement || inTemplate) && p.openElements.hasInScope(TAG_ID.FORM)) {
+ p.openElements.generateImpliedEndTags();
+ if (inTemplate) {
+ p.openElements.popUntilTagNamePopped(TAG_ID.FORM);
+ }
+ else if (formElement) {
+ p.openElements.remove(formElement);
+ }
+ }
+}
+function pEndTagInBody(p) {
+ if (!p.openElements.hasInButtonScope(TAG_ID.P)) {
+ p._insertFakeElement(TAG_NAMES.P, TAG_ID.P);
+ }
+ p._closePElement();
+}
+function liEndTagInBody(p) {
+ if (p.openElements.hasInListItemScope(TAG_ID.LI)) {
+ p.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.LI);
+ p.openElements.popUntilTagNamePopped(TAG_ID.LI);
+ }
+}
+function ddEndTagInBody(p, token) {
+ const tn = token.tagID;
+ if (p.openElements.hasInScope(tn)) {
+ p.openElements.generateImpliedEndTagsWithExclusion(tn);
+ p.openElements.popUntilTagNamePopped(tn);
+ }
+}
+function numberedHeaderEndTagInBody(p) {
+ if (p.openElements.hasNumberedHeaderInScope()) {
+ p.openElements.generateImpliedEndTags();
+ p.openElements.popUntilNumberedHeaderPopped();
+ }
+}
+function appletEndTagInBody(p, token) {
+ const tn = token.tagID;
+ if (p.openElements.hasInScope(tn)) {
+ p.openElements.generateImpliedEndTags();
+ p.openElements.popUntilTagNamePopped(tn);
+ p.activeFormattingElements.clearToLastMarker();
+ }
+}
+function brEndTagInBody(p) {
+ p._reconstructActiveFormattingElements();
+ p._insertFakeElement(TAG_NAMES.BR, TAG_ID.BR);
+ p.openElements.pop();
+ p.framesetOk = false;
+}
+function genericEndTagInBody(p, token) {
+ const tn = token.tagName;
+ const tid = token.tagID;
+ for (let i = p.openElements.stackTop; i > 0; i--) {
+ const element = p.openElements.items[i];
+ const elementId = p.openElements.tagIDs[i];
+ // Compare the tag name here, as the tag might not be a known tag with an ID.
+ if (tid === elementId && (tid !== TAG_ID.UNKNOWN || p.treeAdapter.getTagName(element) === tn)) {
+ p.openElements.generateImpliedEndTagsWithExclusion(tid);
+ if (p.openElements.stackTop >= i)
+ p.openElements.shortenToLength(i);
+ break;
+ }
+ if (p._isSpecialElement(element, elementId)) {
+ break;
+ }
+ }
+}
+function endTagInBody(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.A:
+ case TAG_ID.B:
+ case TAG_ID.I:
+ case TAG_ID.S:
+ case TAG_ID.U:
+ case TAG_ID.EM:
+ case TAG_ID.TT:
+ case TAG_ID.BIG:
+ case TAG_ID.CODE:
+ case TAG_ID.FONT:
+ case TAG_ID.NOBR:
+ case TAG_ID.SMALL:
+ case TAG_ID.STRIKE:
+ case TAG_ID.STRONG: {
+ callAdoptionAgency(p, token);
+ break;
+ }
+ case TAG_ID.P: {
+ pEndTagInBody(p);
+ break;
+ }
+ case TAG_ID.DL:
+ case TAG_ID.UL:
+ case TAG_ID.OL:
+ case TAG_ID.DIR:
+ case TAG_ID.DIV:
+ case TAG_ID.NAV:
+ case TAG_ID.PRE:
+ case TAG_ID.MAIN:
+ case TAG_ID.MENU:
+ case TAG_ID.ASIDE:
+ case TAG_ID.BUTTON:
+ case TAG_ID.CENTER:
+ case TAG_ID.FIGURE:
+ case TAG_ID.FOOTER:
+ case TAG_ID.HEADER:
+ case TAG_ID.HGROUP:
+ case TAG_ID.DIALOG:
+ case TAG_ID.ADDRESS:
+ case TAG_ID.ARTICLE:
+ case TAG_ID.DETAILS:
+ case TAG_ID.SECTION:
+ case TAG_ID.SUMMARY:
+ case TAG_ID.LISTING:
+ case TAG_ID.FIELDSET:
+ case TAG_ID.BLOCKQUOTE:
+ case TAG_ID.FIGCAPTION: {
+ addressEndTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.LI: {
+ liEndTagInBody(p);
+ break;
+ }
+ case TAG_ID.DD:
+ case TAG_ID.DT: {
+ ddEndTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.H1:
+ case TAG_ID.H2:
+ case TAG_ID.H3:
+ case TAG_ID.H4:
+ case TAG_ID.H5:
+ case TAG_ID.H6: {
+ numberedHeaderEndTagInBody(p);
+ break;
+ }
+ case TAG_ID.BR: {
+ brEndTagInBody(p);
+ break;
+ }
+ case TAG_ID.BODY: {
+ bodyEndTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.HTML: {
+ htmlEndTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.FORM: {
+ formEndTagInBody(p);
+ break;
+ }
+ case TAG_ID.APPLET:
+ case TAG_ID.OBJECT:
+ case TAG_ID.MARQUEE: {
+ appletEndTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.TEMPLATE: {
+ templateEndTagInHead(p, token);
+ break;
+ }
+ default: {
+ genericEndTagInBody(p, token);
+ }
+ }
+}
+function eofInBody(p, token) {
+ if (p.tmplInsertionModeStack.length > 0) {
+ eofInTemplate(p, token);
+ }
+ else {
+ stopParsing(p, token);
+ }
+}
+// The "text" insertion mode
+//------------------------------------------------------------------
+function endTagInText(p, token) {
+ var _a;
+ if (token.tagID === TAG_ID.SCRIPT) {
+ (_a = p.scriptHandler) === null || _a === void 0 ? void 0 : _a.call(p, p.openElements.current);
+ }
+ p.openElements.pop();
+ p.insertionMode = p.originalInsertionMode;
+}
+function eofInText(p, token) {
+ p._err(token, ERR.eofInElementThatCanContainOnlyText);
+ p.openElements.pop();
+ p.insertionMode = p.originalInsertionMode;
+ p.onEof(token);
+}
+// The "in table" insertion mode
+//------------------------------------------------------------------
+function characterInTable(p, token) {
+ if (TABLE_STRUCTURE_TAGS.has(p.openElements.currentTagId)) {
+ p.pendingCharacterTokens.length = 0;
+ p.hasNonWhitespacePendingCharacterToken = false;
+ p.originalInsertionMode = p.insertionMode;
+ p.insertionMode = InsertionMode.IN_TABLE_TEXT;
+ switch (token.type) {
+ case TokenType.CHARACTER: {
+ characterInTableText(p, token);
+ break;
+ }
+ case TokenType.WHITESPACE_CHARACTER: {
+ whitespaceCharacterInTableText(p, token);
+ break;
+ }
+ // Ignore null
+ }
+ }
+ else {
+ tokenInTable(p, token);
+ }
+}
+function captionStartTagInTable(p, token) {
+ p.openElements.clearBackToTableContext();
+ p.activeFormattingElements.insertMarker();
+ p._insertElement(token, NS.HTML);
+ p.insertionMode = InsertionMode.IN_CAPTION;
+}
+function colgroupStartTagInTable(p, token) {
+ p.openElements.clearBackToTableContext();
+ p._insertElement(token, NS.HTML);
+ p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
+}
+function colStartTagInTable(p, token) {
+ p.openElements.clearBackToTableContext();
+ p._insertFakeElement(TAG_NAMES.COLGROUP, TAG_ID.COLGROUP);
+ p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
+ startTagInColumnGroup(p, token);
+}
+function tbodyStartTagInTable(p, token) {
+ p.openElements.clearBackToTableContext();
+ p._insertElement(token, NS.HTML);
+ p.insertionMode = InsertionMode.IN_TABLE_BODY;
+}
+function tdStartTagInTable(p, token) {
+ p.openElements.clearBackToTableContext();
+ p._insertFakeElement(TAG_NAMES.TBODY, TAG_ID.TBODY);
+ p.insertionMode = InsertionMode.IN_TABLE_BODY;
+ startTagInTableBody(p, token);
+}
+function tableStartTagInTable(p, token) {
+ if (p.openElements.hasInTableScope(TAG_ID.TABLE)) {
+ p.openElements.popUntilTagNamePopped(TAG_ID.TABLE);
+ p._resetInsertionMode();
+ p._processStartTag(token);
+ }
+}
+function inputStartTagInTable(p, token) {
+ if (isHiddenInput(token)) {
+ p._appendElement(token, NS.HTML);
+ }
+ else {
+ tokenInTable(p, token);
+ }
+ token.ackSelfClosing = true;
+}
+function formStartTagInTable(p, token) {
+ if (!p.formElement && p.openElements.tmplCount === 0) {
+ p._insertElement(token, NS.HTML);
+ p.formElement = p.openElements.current;
+ p.openElements.pop();
+ }
+}
+function startTagInTable(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.TD:
+ case TAG_ID.TH:
+ case TAG_ID.TR: {
+ tdStartTagInTable(p, token);
+ break;
+ }
+ case TAG_ID.STYLE:
+ case TAG_ID.SCRIPT:
+ case TAG_ID.TEMPLATE: {
+ startTagInHead(p, token);
+ break;
+ }
+ case TAG_ID.COL: {
+ colStartTagInTable(p, token);
+ break;
+ }
+ case TAG_ID.FORM: {
+ formStartTagInTable(p, token);
+ break;
+ }
+ case TAG_ID.TABLE: {
+ tableStartTagInTable(p, token);
+ break;
+ }
+ case TAG_ID.TBODY:
+ case TAG_ID.TFOOT:
+ case TAG_ID.THEAD: {
+ tbodyStartTagInTable(p, token);
+ break;
+ }
+ case TAG_ID.INPUT: {
+ inputStartTagInTable(p, token);
+ break;
+ }
+ case TAG_ID.CAPTION: {
+ captionStartTagInTable(p, token);
+ break;
+ }
+ case TAG_ID.COLGROUP: {
+ colgroupStartTagInTable(p, token);
+ break;
+ }
+ default: {
+ tokenInTable(p, token);
+ }
+ }
+}
+function endTagInTable(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.TABLE: {
+ if (p.openElements.hasInTableScope(TAG_ID.TABLE)) {
+ p.openElements.popUntilTagNamePopped(TAG_ID.TABLE);
+ p._resetInsertionMode();
+ }
+ break;
+ }
+ case TAG_ID.TEMPLATE: {
+ templateEndTagInHead(p, token);
+ break;
+ }
+ case TAG_ID.BODY:
+ case TAG_ID.CAPTION:
+ case TAG_ID.COL:
+ case TAG_ID.COLGROUP:
+ case TAG_ID.HTML:
+ case TAG_ID.TBODY:
+ case TAG_ID.TD:
+ case TAG_ID.TFOOT:
+ case TAG_ID.TH:
+ case TAG_ID.THEAD:
+ case TAG_ID.TR: {
+ // Ignore token
+ break;
+ }
+ default: {
+ tokenInTable(p, token);
+ }
+ }
+}
+function tokenInTable(p, token) {
+ const savedFosterParentingState = p.fosterParentingEnabled;
+ p.fosterParentingEnabled = true;
+ // Process token in `In Body` mode
+ modeInBody(p, token);
+ p.fosterParentingEnabled = savedFosterParentingState;
+}
+// The "in table text" insertion mode
+//------------------------------------------------------------------
+function whitespaceCharacterInTableText(p, token) {
+ p.pendingCharacterTokens.push(token);
+}
+function characterInTableText(p, token) {
+ p.pendingCharacterTokens.push(token);
+ p.hasNonWhitespacePendingCharacterToken = true;
+}
+function tokenInTableText(p, token) {
+ let i = 0;
+ if (p.hasNonWhitespacePendingCharacterToken) {
+ for (; i < p.pendingCharacterTokens.length; i++) {
+ tokenInTable(p, p.pendingCharacterTokens[i]);
+ }
+ }
+ else {
+ for (; i < p.pendingCharacterTokens.length; i++) {
+ p._insertCharacters(p.pendingCharacterTokens[i]);
+ }
+ }
+ p.insertionMode = p.originalInsertionMode;
+ p._processToken(token);
+}
+// The "in caption" insertion mode
+//------------------------------------------------------------------
+const TABLE_VOID_ELEMENTS = new Set([TAG_ID.CAPTION, TAG_ID.COL, TAG_ID.COLGROUP, TAG_ID.TBODY, TAG_ID.TD, TAG_ID.TFOOT, TAG_ID.TH, TAG_ID.THEAD, TAG_ID.TR]);
+function startTagInCaption(p, token) {
+ const tn = token.tagID;
+ if (TABLE_VOID_ELEMENTS.has(tn)) {
+ if (p.openElements.hasInTableScope(TAG_ID.CAPTION)) {
+ p.openElements.generateImpliedEndTags();
+ p.openElements.popUntilTagNamePopped(TAG_ID.CAPTION);
+ p.activeFormattingElements.clearToLastMarker();
+ p.insertionMode = InsertionMode.IN_TABLE;
+ startTagInTable(p, token);
+ }
+ }
+ else {
+ startTagInBody(p, token);
+ }
+}
+function endTagInCaption(p, token) {
+ const tn = token.tagID;
+ switch (tn) {
+ case TAG_ID.CAPTION:
+ case TAG_ID.TABLE: {
+ if (p.openElements.hasInTableScope(TAG_ID.CAPTION)) {
+ p.openElements.generateImpliedEndTags();
+ p.openElements.popUntilTagNamePopped(TAG_ID.CAPTION);
+ p.activeFormattingElements.clearToLastMarker();
+ p.insertionMode = InsertionMode.IN_TABLE;
+ if (tn === TAG_ID.TABLE) {
+ endTagInTable(p, token);
+ }
+ }
+ break;
+ }
+ case TAG_ID.BODY:
+ case TAG_ID.COL:
+ case TAG_ID.COLGROUP:
+ case TAG_ID.HTML:
+ case TAG_ID.TBODY:
+ case TAG_ID.TD:
+ case TAG_ID.TFOOT:
+ case TAG_ID.TH:
+ case TAG_ID.THEAD:
+ case TAG_ID.TR: {
+ // Ignore token
+ break;
+ }
+ default: {
+ endTagInBody(p, token);
+ }
+ }
+}
+// The "in column group" insertion mode
+//------------------------------------------------------------------
+function startTagInColumnGroup(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.HTML: {
+ startTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.COL: {
+ p._appendElement(token, NS.HTML);
+ token.ackSelfClosing = true;
+ break;
+ }
+ case TAG_ID.TEMPLATE: {
+ startTagInHead(p, token);
+ break;
+ }
+ default: {
+ tokenInColumnGroup(p, token);
+ }
+ }
+}
+function endTagInColumnGroup(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.COLGROUP: {
+ if (p.openElements.currentTagId === TAG_ID.COLGROUP) {
+ p.openElements.pop();
+ p.insertionMode = InsertionMode.IN_TABLE;
+ }
+ break;
+ }
+ case TAG_ID.TEMPLATE: {
+ templateEndTagInHead(p, token);
+ break;
+ }
+ case TAG_ID.COL: {
+ // Ignore token
+ break;
+ }
+ default: {
+ tokenInColumnGroup(p, token);
+ }
+ }
+}
+function tokenInColumnGroup(p, token) {
+ if (p.openElements.currentTagId === TAG_ID.COLGROUP) {
+ p.openElements.pop();
+ p.insertionMode = InsertionMode.IN_TABLE;
+ p._processToken(token);
+ }
+}
+// The "in table body" insertion mode
+//------------------------------------------------------------------
+function startTagInTableBody(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.TR: {
+ p.openElements.clearBackToTableBodyContext();
+ p._insertElement(token, NS.HTML);
+ p.insertionMode = InsertionMode.IN_ROW;
+ break;
+ }
+ case TAG_ID.TH:
+ case TAG_ID.TD: {
+ p.openElements.clearBackToTableBodyContext();
+ p._insertFakeElement(TAG_NAMES.TR, TAG_ID.TR);
+ p.insertionMode = InsertionMode.IN_ROW;
+ startTagInRow(p, token);
+ break;
+ }
+ case TAG_ID.CAPTION:
+ case TAG_ID.COL:
+ case TAG_ID.COLGROUP:
+ case TAG_ID.TBODY:
+ case TAG_ID.TFOOT:
+ case TAG_ID.THEAD: {
+ if (p.openElements.hasTableBodyContextInTableScope()) {
+ p.openElements.clearBackToTableBodyContext();
+ p.openElements.pop();
+ p.insertionMode = InsertionMode.IN_TABLE;
+ startTagInTable(p, token);
+ }
+ break;
+ }
+ default: {
+ startTagInTable(p, token);
+ }
+ }
+}
+function endTagInTableBody(p, token) {
+ const tn = token.tagID;
+ switch (token.tagID) {
+ case TAG_ID.TBODY:
+ case TAG_ID.TFOOT:
+ case TAG_ID.THEAD: {
+ if (p.openElements.hasInTableScope(tn)) {
+ p.openElements.clearBackToTableBodyContext();
+ p.openElements.pop();
+ p.insertionMode = InsertionMode.IN_TABLE;
+ }
+ break;
+ }
+ case TAG_ID.TABLE: {
+ if (p.openElements.hasTableBodyContextInTableScope()) {
+ p.openElements.clearBackToTableBodyContext();
+ p.openElements.pop();
+ p.insertionMode = InsertionMode.IN_TABLE;
+ endTagInTable(p, token);
+ }
+ break;
+ }
+ case TAG_ID.BODY:
+ case TAG_ID.CAPTION:
+ case TAG_ID.COL:
+ case TAG_ID.COLGROUP:
+ case TAG_ID.HTML:
+ case TAG_ID.TD:
+ case TAG_ID.TH:
+ case TAG_ID.TR: {
+ // Ignore token
+ break;
+ }
+ default: {
+ endTagInTable(p, token);
+ }
+ }
+}
+// The "in row" insertion mode
+//------------------------------------------------------------------
+function startTagInRow(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.TH:
+ case TAG_ID.TD: {
+ p.openElements.clearBackToTableRowContext();
+ p._insertElement(token, NS.HTML);
+ p.insertionMode = InsertionMode.IN_CELL;
+ p.activeFormattingElements.insertMarker();
+ break;
+ }
+ case TAG_ID.CAPTION:
+ case TAG_ID.COL:
+ case TAG_ID.COLGROUP:
+ case TAG_ID.TBODY:
+ case TAG_ID.TFOOT:
+ case TAG_ID.THEAD:
+ case TAG_ID.TR: {
+ if (p.openElements.hasInTableScope(TAG_ID.TR)) {
+ p.openElements.clearBackToTableRowContext();
+ p.openElements.pop();
+ p.insertionMode = InsertionMode.IN_TABLE_BODY;
+ startTagInTableBody(p, token);
+ }
+ break;
+ }
+ default: {
+ startTagInTable(p, token);
+ }
+ }
+}
+function endTagInRow(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.TR: {
+ if (p.openElements.hasInTableScope(TAG_ID.TR)) {
+ p.openElements.clearBackToTableRowContext();
+ p.openElements.pop();
+ p.insertionMode = InsertionMode.IN_TABLE_BODY;
+ }
+ break;
+ }
+ case TAG_ID.TABLE: {
+ if (p.openElements.hasInTableScope(TAG_ID.TR)) {
+ p.openElements.clearBackToTableRowContext();
+ p.openElements.pop();
+ p.insertionMode = InsertionMode.IN_TABLE_BODY;
+ endTagInTableBody(p, token);
+ }
+ break;
+ }
+ case TAG_ID.TBODY:
+ case TAG_ID.TFOOT:
+ case TAG_ID.THEAD: {
+ if (p.openElements.hasInTableScope(token.tagID) || p.openElements.hasInTableScope(TAG_ID.TR)) {
+ p.openElements.clearBackToTableRowContext();
+ p.openElements.pop();
+ p.insertionMode = InsertionMode.IN_TABLE_BODY;
+ endTagInTableBody(p, token);
+ }
+ break;
+ }
+ case TAG_ID.BODY:
+ case TAG_ID.CAPTION:
+ case TAG_ID.COL:
+ case TAG_ID.COLGROUP:
+ case TAG_ID.HTML:
+ case TAG_ID.TD:
+ case TAG_ID.TH: {
+ // Ignore end tag
+ break;
+ }
+ default: {
+ endTagInTable(p, token);
+ }
+ }
+}
+// The "in cell" insertion mode
+//------------------------------------------------------------------
+function startTagInCell(p, token) {
+ const tn = token.tagID;
+ if (TABLE_VOID_ELEMENTS.has(tn)) {
+ if (p.openElements.hasInTableScope(TAG_ID.TD) || p.openElements.hasInTableScope(TAG_ID.TH)) {
+ p._closeTableCell();
+ startTagInRow(p, token);
+ }
+ }
+ else {
+ startTagInBody(p, token);
+ }
+}
+function endTagInCell(p, token) {
+ const tn = token.tagID;
+ switch (tn) {
+ case TAG_ID.TD:
+ case TAG_ID.TH: {
+ if (p.openElements.hasInTableScope(tn)) {
+ p.openElements.generateImpliedEndTags();
+ p.openElements.popUntilTagNamePopped(tn);
+ p.activeFormattingElements.clearToLastMarker();
+ p.insertionMode = InsertionMode.IN_ROW;
+ }
+ break;
+ }
+ case TAG_ID.TABLE:
+ case TAG_ID.TBODY:
+ case TAG_ID.TFOOT:
+ case TAG_ID.THEAD:
+ case TAG_ID.TR: {
+ if (p.openElements.hasInTableScope(tn)) {
+ p._closeTableCell();
+ endTagInRow(p, token);
+ }
+ break;
+ }
+ case TAG_ID.BODY:
+ case TAG_ID.CAPTION:
+ case TAG_ID.COL:
+ case TAG_ID.COLGROUP:
+ case TAG_ID.HTML: {
+ // Ignore token
+ break;
+ }
+ default: {
+ endTagInBody(p, token);
+ }
+ }
+}
+// The "in select" insertion mode
+//------------------------------------------------------------------
+function startTagInSelect(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.HTML: {
+ startTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.OPTION: {
+ if (p.openElements.currentTagId === TAG_ID.OPTION) {
+ p.openElements.pop();
+ }
+ p._insertElement(token, NS.HTML);
+ break;
+ }
+ case TAG_ID.OPTGROUP: {
+ if (p.openElements.currentTagId === TAG_ID.OPTION) {
+ p.openElements.pop();
+ }
+ if (p.openElements.currentTagId === TAG_ID.OPTGROUP) {
+ p.openElements.pop();
+ }
+ p._insertElement(token, NS.HTML);
+ break;
+ }
+ case TAG_ID.INPUT:
+ case TAG_ID.KEYGEN:
+ case TAG_ID.TEXTAREA:
+ case TAG_ID.SELECT: {
+ if (p.openElements.hasInSelectScope(TAG_ID.SELECT)) {
+ p.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
+ p._resetInsertionMode();
+ if (token.tagID !== TAG_ID.SELECT) {
+ p._processStartTag(token);
+ }
+ }
+ break;
+ }
+ case TAG_ID.SCRIPT:
+ case TAG_ID.TEMPLATE: {
+ startTagInHead(p, token);
+ break;
+ }
+ // Do nothing
+ }
+}
+function endTagInSelect(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.OPTGROUP: {
+ if (p.openElements.stackTop > 0 &&
+ p.openElements.currentTagId === TAG_ID.OPTION &&
+ p.openElements.tagIDs[p.openElements.stackTop - 1] === TAG_ID.OPTGROUP) {
+ p.openElements.pop();
+ }
+ if (p.openElements.currentTagId === TAG_ID.OPTGROUP) {
+ p.openElements.pop();
+ }
+ break;
+ }
+ case TAG_ID.OPTION: {
+ if (p.openElements.currentTagId === TAG_ID.OPTION) {
+ p.openElements.pop();
+ }
+ break;
+ }
+ case TAG_ID.SELECT: {
+ if (p.openElements.hasInSelectScope(TAG_ID.SELECT)) {
+ p.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
+ p._resetInsertionMode();
+ }
+ break;
+ }
+ case TAG_ID.TEMPLATE: {
+ templateEndTagInHead(p, token);
+ break;
+ }
+ // Do nothing
+ }
+}
+// The "in select in table" insertion mode
+//------------------------------------------------------------------
+function startTagInSelectInTable(p, token) {
+ const tn = token.tagID;
+ if (tn === TAG_ID.CAPTION ||
+ tn === TAG_ID.TABLE ||
+ tn === TAG_ID.TBODY ||
+ tn === TAG_ID.TFOOT ||
+ tn === TAG_ID.THEAD ||
+ tn === TAG_ID.TR ||
+ tn === TAG_ID.TD ||
+ tn === TAG_ID.TH) {
+ p.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
+ p._resetInsertionMode();
+ p._processStartTag(token);
+ }
+ else {
+ startTagInSelect(p, token);
+ }
+}
+function endTagInSelectInTable(p, token) {
+ const tn = token.tagID;
+ if (tn === TAG_ID.CAPTION ||
+ tn === TAG_ID.TABLE ||
+ tn === TAG_ID.TBODY ||
+ tn === TAG_ID.TFOOT ||
+ tn === TAG_ID.THEAD ||
+ tn === TAG_ID.TR ||
+ tn === TAG_ID.TD ||
+ tn === TAG_ID.TH) {
+ if (p.openElements.hasInTableScope(tn)) {
+ p.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
+ p._resetInsertionMode();
+ p.onEndTag(token);
+ }
+ }
+ else {
+ endTagInSelect(p, token);
+ }
+}
+// The "in template" insertion mode
+//------------------------------------------------------------------
+function startTagInTemplate(p, token) {
+ switch (token.tagID) {
+ // First, handle tags that can start without a mode change
+ case TAG_ID.BASE:
+ case TAG_ID.BASEFONT:
+ case TAG_ID.BGSOUND:
+ case TAG_ID.LINK:
+ case TAG_ID.META:
+ case TAG_ID.NOFRAMES:
+ case TAG_ID.SCRIPT:
+ case TAG_ID.STYLE:
+ case TAG_ID.TEMPLATE:
+ case TAG_ID.TITLE: {
+ startTagInHead(p, token);
+ break;
+ }
+ // Re-process the token in the appropriate mode
+ case TAG_ID.CAPTION:
+ case TAG_ID.COLGROUP:
+ case TAG_ID.TBODY:
+ case TAG_ID.TFOOT:
+ case TAG_ID.THEAD: {
+ p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE;
+ p.insertionMode = InsertionMode.IN_TABLE;
+ startTagInTable(p, token);
+ break;
+ }
+ case TAG_ID.COL: {
+ p.tmplInsertionModeStack[0] = InsertionMode.IN_COLUMN_GROUP;
+ p.insertionMode = InsertionMode.IN_COLUMN_GROUP;
+ startTagInColumnGroup(p, token);
+ break;
+ }
+ case TAG_ID.TR: {
+ p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE_BODY;
+ p.insertionMode = InsertionMode.IN_TABLE_BODY;
+ startTagInTableBody(p, token);
+ break;
+ }
+ case TAG_ID.TD:
+ case TAG_ID.TH: {
+ p.tmplInsertionModeStack[0] = InsertionMode.IN_ROW;
+ p.insertionMode = InsertionMode.IN_ROW;
+ startTagInRow(p, token);
+ break;
+ }
+ default: {
+ p.tmplInsertionModeStack[0] = InsertionMode.IN_BODY;
+ p.insertionMode = InsertionMode.IN_BODY;
+ startTagInBody(p, token);
+ }
+ }
+}
+function endTagInTemplate(p, token) {
+ if (token.tagID === TAG_ID.TEMPLATE) {
+ templateEndTagInHead(p, token);
+ }
+}
+function eofInTemplate(p, token) {
+ if (p.openElements.tmplCount > 0) {
+ p.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE);
+ p.activeFormattingElements.clearToLastMarker();
+ p.tmplInsertionModeStack.shift();
+ p._resetInsertionMode();
+ p.onEof(token);
+ }
+ else {
+ stopParsing(p, token);
+ }
+}
+// The "after body" insertion mode
+//------------------------------------------------------------------
+function startTagAfterBody(p, token) {
+ if (token.tagID === TAG_ID.HTML) {
+ startTagInBody(p, token);
+ }
+ else {
+ tokenAfterBody(p, token);
+ }
+}
+function endTagAfterBody(p, token) {
+ var _a;
+ if (token.tagID === TAG_ID.HTML) {
+ if (!p.fragmentContext) {
+ p.insertionMode = InsertionMode.AFTER_AFTER_BODY;
+ }
+ //NOTE: is never popped from the stack, so we need to updated
+ //the end location explicitly.
+ if (p.options.sourceCodeLocationInfo && p.openElements.tagIDs[0] === TAG_ID.HTML) {
+ p._setEndLocation(p.openElements.items[0], token);
+ // Update the body element, if it doesn't have an end tag
+ const bodyElement = p.openElements.items[1];
+ if (bodyElement && !((_a = p.treeAdapter.getNodeSourceCodeLocation(bodyElement)) === null || _a === void 0 ? void 0 : _a.endTag)) {
+ p._setEndLocation(bodyElement, token);
+ }
+ }
+ }
+ else {
+ tokenAfterBody(p, token);
+ }
+}
+function tokenAfterBody(p, token) {
+ p.insertionMode = InsertionMode.IN_BODY;
+ modeInBody(p, token);
+}
+// The "in frameset" insertion mode
+//------------------------------------------------------------------
+function startTagInFrameset(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.HTML: {
+ startTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.FRAMESET: {
+ p._insertElement(token, NS.HTML);
+ break;
+ }
+ case TAG_ID.FRAME: {
+ p._appendElement(token, NS.HTML);
+ token.ackSelfClosing = true;
+ break;
+ }
+ case TAG_ID.NOFRAMES: {
+ startTagInHead(p, token);
+ break;
+ }
+ // Do nothing
+ }
+}
+function endTagInFrameset(p, token) {
+ if (token.tagID === TAG_ID.FRAMESET && !p.openElements.isRootHtmlElementCurrent()) {
+ p.openElements.pop();
+ if (!p.fragmentContext && p.openElements.currentTagId !== TAG_ID.FRAMESET) {
+ p.insertionMode = InsertionMode.AFTER_FRAMESET;
+ }
+ }
+}
+// The "after frameset" insertion mode
+//------------------------------------------------------------------
+function startTagAfterFrameset(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.HTML: {
+ startTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.NOFRAMES: {
+ startTagInHead(p, token);
+ break;
+ }
+ // Do nothing
+ }
+}
+function endTagAfterFrameset(p, token) {
+ if (token.tagID === TAG_ID.HTML) {
+ p.insertionMode = InsertionMode.AFTER_AFTER_FRAMESET;
+ }
+}
+// The "after after body" insertion mode
+//------------------------------------------------------------------
+function startTagAfterAfterBody(p, token) {
+ if (token.tagID === TAG_ID.HTML) {
+ startTagInBody(p, token);
+ }
+ else {
+ tokenAfterAfterBody(p, token);
+ }
+}
+function tokenAfterAfterBody(p, token) {
+ p.insertionMode = InsertionMode.IN_BODY;
+ modeInBody(p, token);
+}
+// The "after after frameset" insertion mode
+//------------------------------------------------------------------
+function startTagAfterAfterFrameset(p, token) {
+ switch (token.tagID) {
+ case TAG_ID.HTML: {
+ startTagInBody(p, token);
+ break;
+ }
+ case TAG_ID.NOFRAMES: {
+ startTagInHead(p, token);
+ break;
+ }
+ // Do nothing
+ }
+}
+// The rules for parsing tokens in foreign content
+//------------------------------------------------------------------
+function nullCharacterInForeignContent(p, token) {
+ token.chars = REPLACEMENT_CHARACTER;
+ p._insertCharacters(token);
+}
+function characterInForeignContent(p, token) {
+ p._insertCharacters(token);
+ p.framesetOk = false;
+}
+function popUntilHtmlOrIntegrationPoint(p) {
+ while (p.treeAdapter.getNamespaceURI(p.openElements.current) !== NS.HTML &&
+ !p._isIntegrationPoint(p.openElements.currentTagId, p.openElements.current)) {
+ p.openElements.pop();
+ }
+}
+function startTagInForeignContent(p, token) {
+ if (causesExit(token)) {
+ popUntilHtmlOrIntegrationPoint(p);
+ p._startTagOutsideForeignContent(token);
+ }
+ else {
+ const current = p._getAdjustedCurrentElement();
+ const currentNs = p.treeAdapter.getNamespaceURI(current);
+ if (currentNs === NS.MATHML) {
+ adjustTokenMathMLAttrs(token);
+ }
+ else if (currentNs === NS.SVG) {
+ adjustTokenSVGTagName(token);
+ adjustTokenSVGAttrs(token);
+ }
+ adjustTokenXMLAttrs(token);
+ if (token.selfClosing) {
+ p._appendElement(token, currentNs);
+ }
+ else {
+ p._insertElement(token, currentNs);
+ }
+ token.ackSelfClosing = true;
+ }
+}
+function endTagInForeignContent(p, token) {
+ if (token.tagID === TAG_ID.P || token.tagID === TAG_ID.BR) {
+ popUntilHtmlOrIntegrationPoint(p);
+ p._endTagOutsideForeignContent(token);
+ return;
+ }
+ for (let i = p.openElements.stackTop; i > 0; i--) {
+ const element = p.openElements.items[i];
+ if (p.treeAdapter.getNamespaceURI(element) === NS.HTML) {
+ p._endTagOutsideForeignContent(token);
+ break;
+ }
+ const tagName = p.treeAdapter.getTagName(element);
+ if (tagName.toLowerCase() === token.tagName) {
+ //NOTE: update the token tag name for `_setEndLocation`.
+ token.tagName = tagName;
+ p.openElements.shortenToLength(i);
+ break;
+ }
+ }
+}
+
+// Shorthands
+/**
+ * Parses an HTML string.
+ *
+ * @param html Input HTML string.
+ * @param options Parsing options.
+ * @returns Document
+ *
+ * @example
+ *
+ * ```js
+ * const parse5 = require('parse5');
+ *
+ * const document = parse5.parse('Hi there!');
+ *
+ * console.log(document.childNodes[1].tagName); //> 'html'
+ *```
+ */
+function parse(html, options) {
+ return Parser.parse(html, options);
+}
+
+export { ERR as ErrorCodes, Parser, Tokenizer, TokenizerMode, defaultTreeAdapter, parse };
diff --git a/node_modules/vite/dist/node/cli.js b/node_modules/vite/dist/node/cli.js
new file mode 100644
index 0000000..85730a1
--- /dev/null
+++ b/node_modules/vite/dist/node/cli.js
@@ -0,0 +1,908 @@
+import path from 'node:path';
+import fs from 'node:fs';
+import { performance } from 'node:perf_hooks';
+import { EventEmitter } from 'events';
+import { C as colors, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-df561101.js';
+import { VERSION } from './constants.js';
+import 'node:fs/promises';
+import 'node:url';
+import 'node:util';
+import 'node:module';
+import 'tty';
+import 'esbuild';
+import 'path';
+import 'fs';
+import 'assert';
+import 'util';
+import 'net';
+import 'url';
+import 'http';
+import 'stream';
+import 'os';
+import 'child_process';
+import 'node:os';
+import 'node:child_process';
+import 'node:crypto';
+import 'node:dns';
+import 'crypto';
+import 'node:buffer';
+import 'module';
+import 'node:assert';
+import 'node:process';
+import 'node:v8';
+import 'rollup';
+import 'worker_threads';
+import 'node:http';
+import 'node:https';
+import 'zlib';
+import 'buffer';
+import 'https';
+import 'tls';
+import 'querystring';
+import 'node:readline';
+import 'node:zlib';
+
+function toArr(any) {
+ return any == null ? [] : Array.isArray(any) ? any : [any];
+}
+
+function toVal(out, key, val, opts) {
+ var x, old=out[key], nxt=(
+ !!~opts.string.indexOf(key) ? (val == null || val === true ? '' : String(val))
+ : typeof val === 'boolean' ? val
+ : !!~opts.boolean.indexOf(key) ? (val === 'false' ? false : val === 'true' || (out._.push((x = +val,x * 0 === 0) ? x : val),!!val))
+ : (x = +val,x * 0 === 0) ? x : val
+ );
+ out[key] = old == null ? nxt : (Array.isArray(old) ? old.concat(nxt) : [old, nxt]);
+}
+
+function mri2 (args, opts) {
+ args = args || [];
+ opts = opts || {};
+
+ var k, arr, arg, name, val, out={ _:[] };
+ var i=0, j=0, idx=0, len=args.length;
+
+ const alibi = opts.alias !== void 0;
+ const strict = opts.unknown !== void 0;
+ const defaults = opts.default !== void 0;
+
+ opts.alias = opts.alias || {};
+ opts.string = toArr(opts.string);
+ opts.boolean = toArr(opts.boolean);
+
+ if (alibi) {
+ for (k in opts.alias) {
+ arr = opts.alias[k] = toArr(opts.alias[k]);
+ for (i=0; i < arr.length; i++) {
+ (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
+ }
+ }
+ }
+
+ for (i=opts.boolean.length; i-- > 0;) {
+ arr = opts.alias[opts.boolean[i]] || [];
+ for (j=arr.length; j-- > 0;) opts.boolean.push(arr[j]);
+ }
+
+ for (i=opts.string.length; i-- > 0;) {
+ arr = opts.alias[opts.string[i]] || [];
+ for (j=arr.length; j-- > 0;) opts.string.push(arr[j]);
+ }
+
+ if (defaults) {
+ for (k in opts.default) {
+ name = typeof opts.default[k];
+ arr = opts.alias[k] = opts.alias[k] || [];
+ if (opts[name] !== void 0) {
+ opts[name].push(k);
+ for (i=0; i < arr.length; i++) {
+ opts[name].push(arr[i]);
+ }
+ }
+ }
+ }
+
+ const keys = strict ? Object.keys(opts.alias) : [];
+
+ for (i=0; i < len; i++) {
+ arg = args[i];
+
+ if (arg === '--') {
+ out._ = out._.concat(args.slice(++i));
+ break;
+ }
+
+ for (j=0; j < arg.length; j++) {
+ if (arg.charCodeAt(j) !== 45) break; // "-"
+ }
+
+ if (j === 0) {
+ out._.push(arg);
+ } else if (arg.substring(j, j + 3) === 'no-') {
+ name = arg.substring(j + 3);
+ if (strict && !~keys.indexOf(name)) {
+ return opts.unknown(arg);
+ }
+ out[name] = false;
+ } else {
+ for (idx=j+1; idx < arg.length; idx++) {
+ if (arg.charCodeAt(idx) === 61) break; // "="
+ }
+
+ name = arg.substring(j, idx);
+ val = arg.substring(++idx) || (i+1 === len || (''+args[i+1]).charCodeAt(0) === 45 || args[++i]);
+ arr = (j === 2 ? [name] : name);
+
+ for (idx=0; idx < arr.length; idx++) {
+ name = arr[idx];
+ if (strict && !~keys.indexOf(name)) return opts.unknown('-'.repeat(j) + name);
+ toVal(out, name, (idx + 1 < arr.length) || val, opts);
+ }
+ }
+ }
+
+ if (defaults) {
+ for (k in opts.default) {
+ if (out[k] === void 0) {
+ out[k] = opts.default[k];
+ }
+ }
+ }
+
+ if (alibi) {
+ for (k in out) {
+ arr = opts.alias[k] || [];
+ while (arr.length > 0) {
+ out[arr.shift()] = out[k];
+ }
+ }
+ }
+
+ return out;
+}
+
+const removeBrackets = (v) => v.replace(/[<[].+/, "").trim();
+const findAllBrackets = (v) => {
+ const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
+ const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
+ const res = [];
+ const parse = (match) => {
+ let variadic = false;
+ let value = match[1];
+ if (value.startsWith("...")) {
+ value = value.slice(3);
+ variadic = true;
+ }
+ return {
+ required: match[0].startsWith("<"),
+ value,
+ variadic
+ };
+ };
+ let angledMatch;
+ while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) {
+ res.push(parse(angledMatch));
+ }
+ let squareMatch;
+ while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) {
+ res.push(parse(squareMatch));
+ }
+ return res;
+};
+const getMriOptions = (options) => {
+ const result = {alias: {}, boolean: []};
+ for (const [index, option] of options.entries()) {
+ if (option.names.length > 1) {
+ result.alias[option.names[0]] = option.names.slice(1);
+ }
+ if (option.isBoolean) {
+ if (option.negated) {
+ const hasStringTypeOption = options.some((o, i) => {
+ return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
+ });
+ if (!hasStringTypeOption) {
+ result.boolean.push(option.names[0]);
+ }
+ } else {
+ result.boolean.push(option.names[0]);
+ }
+ }
+ }
+ return result;
+};
+const findLongest = (arr) => {
+ return arr.sort((a, b) => {
+ return a.length > b.length ? -1 : 1;
+ })[0];
+};
+const padRight = (str, length) => {
+ return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
+};
+const camelcase = (input) => {
+ return input.replace(/([a-z])-([a-z])/g, (_, p1, p2) => {
+ return p1 + p2.toUpperCase();
+ });
+};
+const setDotProp = (obj, keys, val) => {
+ let i = 0;
+ let length = keys.length;
+ let t = obj;
+ let x;
+ for (; i < length; ++i) {
+ x = t[keys[i]];
+ t = t[keys[i]] = i === length - 1 ? val : x != null ? x : !!~keys[i + 1].indexOf(".") || !(+keys[i + 1] > -1) ? {} : [];
+ }
+};
+const setByType = (obj, transforms) => {
+ for (const key of Object.keys(transforms)) {
+ const transform = transforms[key];
+ if (transform.shouldTransform) {
+ obj[key] = Array.prototype.concat.call([], obj[key]);
+ if (typeof transform.transformFunction === "function") {
+ obj[key] = obj[key].map(transform.transformFunction);
+ }
+ }
+ }
+};
+const getFileName = (input) => {
+ const m = /([^\\\/]+)$/.exec(input);
+ return m ? m[1] : "";
+};
+const camelcaseOptionName = (name) => {
+ return name.split(".").map((v, i) => {
+ return i === 0 ? camelcase(v) : v;
+ }).join(".");
+};
+class CACError extends Error {
+ constructor(message) {
+ super(message);
+ this.name = this.constructor.name;
+ if (typeof Error.captureStackTrace === "function") {
+ Error.captureStackTrace(this, this.constructor);
+ } else {
+ this.stack = new Error(message).stack;
+ }
+ }
+}
+
+class Option {
+ constructor(rawName, description, config) {
+ this.rawName = rawName;
+ this.description = description;
+ this.config = Object.assign({}, config);
+ rawName = rawName.replace(/\.\*/g, "");
+ this.negated = false;
+ this.names = removeBrackets(rawName).split(",").map((v) => {
+ let name = v.trim().replace(/^-{1,2}/, "");
+ if (name.startsWith("no-")) {
+ this.negated = true;
+ name = name.replace(/^no-/, "");
+ }
+ return camelcaseOptionName(name);
+ }).sort((a, b) => a.length > b.length ? 1 : -1);
+ this.name = this.names[this.names.length - 1];
+ if (this.negated && this.config.default == null) {
+ this.config.default = true;
+ }
+ if (rawName.includes("<")) {
+ this.required = true;
+ } else if (rawName.includes("[")) {
+ this.required = false;
+ } else {
+ this.isBoolean = true;
+ }
+ }
+}
+
+const processArgs = process.argv;
+const platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
+
+class Command {
+ constructor(rawName, description, config = {}, cli) {
+ this.rawName = rawName;
+ this.description = description;
+ this.config = config;
+ this.cli = cli;
+ this.options = [];
+ this.aliasNames = [];
+ this.name = removeBrackets(rawName);
+ this.args = findAllBrackets(rawName);
+ this.examples = [];
+ }
+ usage(text) {
+ this.usageText = text;
+ return this;
+ }
+ allowUnknownOptions() {
+ this.config.allowUnknownOptions = true;
+ return this;
+ }
+ ignoreOptionDefaultValue() {
+ this.config.ignoreOptionDefaultValue = true;
+ return this;
+ }
+ version(version, customFlags = "-v, --version") {
+ this.versionNumber = version;
+ this.option(customFlags, "Display version number");
+ return this;
+ }
+ example(example) {
+ this.examples.push(example);
+ return this;
+ }
+ option(rawName, description, config) {
+ const option = new Option(rawName, description, config);
+ this.options.push(option);
+ return this;
+ }
+ alias(name) {
+ this.aliasNames.push(name);
+ return this;
+ }
+ action(callback) {
+ this.commandAction = callback;
+ return this;
+ }
+ isMatched(name) {
+ return this.name === name || this.aliasNames.includes(name);
+ }
+ get isDefaultCommand() {
+ return this.name === "" || this.aliasNames.includes("!");
+ }
+ get isGlobalCommand() {
+ return this instanceof GlobalCommand;
+ }
+ hasOption(name) {
+ name = name.split(".")[0];
+ return this.options.find((option) => {
+ return option.names.includes(name);
+ });
+ }
+ outputHelp() {
+ const {name, commands} = this.cli;
+ const {
+ versionNumber,
+ options: globalOptions,
+ helpCallback
+ } = this.cli.globalCommand;
+ let sections = [
+ {
+ body: `${name}${versionNumber ? `/${versionNumber}` : ""}`
+ }
+ ];
+ sections.push({
+ title: "Usage",
+ body: ` $ ${name} ${this.usageText || this.rawName}`
+ });
+ const showCommands = (this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0;
+ if (showCommands) {
+ const longestCommandName = findLongest(commands.map((command) => command.rawName));
+ sections.push({
+ title: "Commands",
+ body: commands.map((command) => {
+ return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
+ }).join("\n")
+ });
+ sections.push({
+ title: `For more info, run any command with the \`--help\` flag`,
+ body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
+ });
+ }
+ let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
+ if (!this.isGlobalCommand && !this.isDefaultCommand) {
+ options = options.filter((option) => option.name !== "version");
+ }
+ if (options.length > 0) {
+ const longestOptionName = findLongest(options.map((option) => option.rawName));
+ sections.push({
+ title: "Options",
+ body: options.map((option) => {
+ return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
+ }).join("\n")
+ });
+ }
+ if (this.examples.length > 0) {
+ sections.push({
+ title: "Examples",
+ body: this.examples.map((example) => {
+ if (typeof example === "function") {
+ return example(name);
+ }
+ return example;
+ }).join("\n")
+ });
+ }
+ if (helpCallback) {
+ sections = helpCallback(sections) || sections;
+ }
+ console.log(sections.map((section) => {
+ return section.title ? `${section.title}:
+${section.body}` : section.body;
+ }).join("\n\n"));
+ }
+ outputVersion() {
+ const {name} = this.cli;
+ const {versionNumber} = this.cli.globalCommand;
+ if (versionNumber) {
+ console.log(`${name}/${versionNumber} ${platformInfo}`);
+ }
+ }
+ checkRequiredArgs() {
+ const minimalArgsCount = this.args.filter((arg) => arg.required).length;
+ if (this.cli.args.length < minimalArgsCount) {
+ throw new CACError(`missing required args for command \`${this.rawName}\``);
+ }
+ }
+ checkUnknownOptions() {
+ const {options, globalCommand} = this.cli;
+ if (!this.config.allowUnknownOptions) {
+ for (const name of Object.keys(options)) {
+ if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) {
+ throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
+ }
+ }
+ }
+ }
+ checkOptionValue() {
+ const {options: parsedOptions, globalCommand} = this.cli;
+ const options = [...globalCommand.options, ...this.options];
+ for (const option of options) {
+ const value = parsedOptions[option.name.split(".")[0]];
+ if (option.required) {
+ const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
+ if (value === true || value === false && !hasNegated) {
+ throw new CACError(`option \`${option.rawName}\` value is missing`);
+ }
+ }
+ }
+ }
+}
+class GlobalCommand extends Command {
+ constructor(cli) {
+ super("@@global@@", "", {}, cli);
+ }
+}
+
+var __assign = Object.assign;
+class CAC extends EventEmitter {
+ constructor(name = "") {
+ super();
+ this.name = name;
+ this.commands = [];
+ this.rawArgs = [];
+ this.args = [];
+ this.options = {};
+ this.globalCommand = new GlobalCommand(this);
+ this.globalCommand.usage(" [options]");
+ }
+ usage(text) {
+ this.globalCommand.usage(text);
+ return this;
+ }
+ command(rawName, description, config) {
+ const command = new Command(rawName, description || "", config, this);
+ command.globalCommand = this.globalCommand;
+ this.commands.push(command);
+ return command;
+ }
+ option(rawName, description, config) {
+ this.globalCommand.option(rawName, description, config);
+ return this;
+ }
+ help(callback) {
+ this.globalCommand.option("-h, --help", "Display this message");
+ this.globalCommand.helpCallback = callback;
+ this.showHelpOnExit = true;
+ return this;
+ }
+ version(version, customFlags = "-v, --version") {
+ this.globalCommand.version(version, customFlags);
+ this.showVersionOnExit = true;
+ return this;
+ }
+ example(example) {
+ this.globalCommand.example(example);
+ return this;
+ }
+ outputHelp() {
+ if (this.matchedCommand) {
+ this.matchedCommand.outputHelp();
+ } else {
+ this.globalCommand.outputHelp();
+ }
+ }
+ outputVersion() {
+ this.globalCommand.outputVersion();
+ }
+ setParsedInfo({args, options}, matchedCommand, matchedCommandName) {
+ this.args = args;
+ this.options = options;
+ if (matchedCommand) {
+ this.matchedCommand = matchedCommand;
+ }
+ if (matchedCommandName) {
+ this.matchedCommandName = matchedCommandName;
+ }
+ return this;
+ }
+ unsetMatchedCommand() {
+ this.matchedCommand = void 0;
+ this.matchedCommandName = void 0;
+ }
+ parse(argv = processArgs, {
+ run = true
+ } = {}) {
+ this.rawArgs = argv;
+ if (!this.name) {
+ this.name = argv[1] ? getFileName(argv[1]) : "cli";
+ }
+ let shouldParse = true;
+ for (const command of this.commands) {
+ const parsed = this.mri(argv.slice(2), command);
+ const commandName = parsed.args[0];
+ if (command.isMatched(commandName)) {
+ shouldParse = false;
+ const parsedInfo = __assign(__assign({}, parsed), {
+ args: parsed.args.slice(1)
+ });
+ this.setParsedInfo(parsedInfo, command, commandName);
+ this.emit(`command:${commandName}`, command);
+ }
+ }
+ if (shouldParse) {
+ for (const command of this.commands) {
+ if (command.name === "") {
+ shouldParse = false;
+ const parsed = this.mri(argv.slice(2), command);
+ this.setParsedInfo(parsed, command);
+ this.emit(`command:!`, command);
+ }
+ }
+ }
+ if (shouldParse) {
+ const parsed = this.mri(argv.slice(2));
+ this.setParsedInfo(parsed);
+ }
+ if (this.options.help && this.showHelpOnExit) {
+ this.outputHelp();
+ run = false;
+ this.unsetMatchedCommand();
+ }
+ if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
+ this.outputVersion();
+ run = false;
+ this.unsetMatchedCommand();
+ }
+ const parsedArgv = {args: this.args, options: this.options};
+ if (run) {
+ this.runMatchedCommand();
+ }
+ if (!this.matchedCommand && this.args[0]) {
+ this.emit("command:*");
+ }
+ return parsedArgv;
+ }
+ mri(argv, command) {
+ const cliOptions = [
+ ...this.globalCommand.options,
+ ...command ? command.options : []
+ ];
+ const mriOptions = getMriOptions(cliOptions);
+ let argsAfterDoubleDashes = [];
+ const doubleDashesIndex = argv.indexOf("--");
+ if (doubleDashesIndex > -1) {
+ argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
+ argv = argv.slice(0, doubleDashesIndex);
+ }
+ let parsed = mri2(argv, mriOptions);
+ parsed = Object.keys(parsed).reduce((res, name) => {
+ return __assign(__assign({}, res), {
+ [camelcaseOptionName(name)]: parsed[name]
+ });
+ }, {_: []});
+ const args = parsed._;
+ const options = {
+ "--": argsAfterDoubleDashes
+ };
+ const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
+ let transforms = Object.create(null);
+ for (const cliOption of cliOptions) {
+ if (!ignoreDefault && cliOption.config.default !== void 0) {
+ for (const name of cliOption.names) {
+ options[name] = cliOption.config.default;
+ }
+ }
+ if (Array.isArray(cliOption.config.type)) {
+ if (transforms[cliOption.name] === void 0) {
+ transforms[cliOption.name] = Object.create(null);
+ transforms[cliOption.name]["shouldTransform"] = true;
+ transforms[cliOption.name]["transformFunction"] = cliOption.config.type[0];
+ }
+ }
+ }
+ for (const key of Object.keys(parsed)) {
+ if (key !== "_") {
+ const keys = key.split(".");
+ setDotProp(options, keys, parsed[key]);
+ setByType(options, transforms);
+ }
+ }
+ return {
+ args,
+ options
+ };
+ }
+ runMatchedCommand() {
+ const {args, options, matchedCommand: command} = this;
+ if (!command || !command.commandAction)
+ return;
+ command.checkUnknownOptions();
+ command.checkOptionValue();
+ command.checkRequiredArgs();
+ const actionArgs = [];
+ command.args.forEach((arg, index) => {
+ if (arg.variadic) {
+ actionArgs.push(args.slice(index));
+ } else {
+ actionArgs.push(args[index]);
+ }
+ });
+ actionArgs.push(options);
+ return command.commandAction.apply(this, actionArgs);
+ }
+}
+
+const cac = (name = "") => new CAC(name);
+
+const cli = cac('vite');
+let profileSession = global.__vite_profile_session;
+let profileCount = 0;
+const stopProfiler = (log) => {
+ if (!profileSession)
+ return;
+ return new Promise((res, rej) => {
+ profileSession.post('Profiler.stop', (err, { profile }) => {
+ // Write profile to disk, upload, etc.
+ if (!err) {
+ const outPath = path.resolve(`./vite-profile-${profileCount++}.cpuprofile`);
+ fs.writeFileSync(outPath, JSON.stringify(profile));
+ log(colors.yellow(`CPU profile written to ${colors.white(colors.dim(outPath))}`));
+ profileSession = undefined;
+ res();
+ }
+ else {
+ rej(err);
+ }
+ });
+ });
+};
+const filterDuplicateOptions = (options) => {
+ for (const [key, value] of Object.entries(options)) {
+ if (Array.isArray(value)) {
+ options[key] = value[value.length - 1];
+ }
+ }
+};
+/**
+ * removing global flags before passing as command specific sub-configs
+ */
+function cleanOptions(options) {
+ const ret = { ...options };
+ delete ret['--'];
+ delete ret.c;
+ delete ret.config;
+ delete ret.base;
+ delete ret.l;
+ delete ret.logLevel;
+ delete ret.clearScreen;
+ delete ret.d;
+ delete ret.debug;
+ delete ret.f;
+ delete ret.filter;
+ delete ret.m;
+ delete ret.mode;
+ // convert the sourcemap option to a boolean if necessary
+ if ('sourcemap' in ret) {
+ const sourcemap = ret.sourcemap;
+ ret.sourcemap =
+ sourcemap === 'true'
+ ? true
+ : sourcemap === 'false'
+ ? false
+ : ret.sourcemap;
+ }
+ return ret;
+}
+cli
+ .option('-c, --config ', `[string] use specified config file`)
+ .option('--base ', `[string] public base path (default: /)`)
+ .option('-l, --logLevel ', `[string] info | warn | error | silent`)
+ .option('--clearScreen', `[boolean] allow/disable clear screen when logging`)
+ .option('-d, --debug [feat]', `[string | boolean] show debug logs`)
+ .option('-f, --filter ', `[string] filter debug logs`)
+ .option('-m, --mode ', `[string] set env mode`);
+// dev
+cli
+ .command('[root]', 'start dev server') // default command
+ .alias('serve') // the command is called 'serve' in Vite's API
+ .alias('dev') // alias to align with the script name
+ .option('--host [host]', `[string] specify hostname`)
+ .option('--port ', `[number] specify port`)
+ .option('--https', `[boolean] use TLS + HTTP/2`)
+ .option('--open [path]', `[boolean | string] open browser on startup`)
+ .option('--cors', `[boolean] enable CORS`)
+ .option('--strictPort', `[boolean] exit if specified port is already in use`)
+ .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
+ .action(async (root, options) => {
+ filterDuplicateOptions(options);
+ // output structure is preserved even after bundling so require()
+ // is ok here
+ const { createServer } = await import('./chunks/dep-df561101.js').then(function (n) { return n.I; });
+ try {
+ const server = await createServer({
+ root,
+ base: options.base,
+ mode: options.mode,
+ configFile: options.config,
+ logLevel: options.logLevel,
+ clearScreen: options.clearScreen,
+ optimizeDeps: { force: options.force },
+ server: cleanOptions(options),
+ });
+ if (!server.httpServer) {
+ throw new Error('HTTP server not available');
+ }
+ await server.listen();
+ const info = server.config.logger.info;
+ const viteStartTime = global.__vite_start_time ?? false;
+ const startupDurationString = viteStartTime
+ ? colors.dim(`ready in ${colors.reset(colors.bold(Math.ceil(performance.now() - viteStartTime)))} ms`)
+ : '';
+ info(`\n ${colors.green(`${colors.bold('VITE')} v${VERSION}`)} ${startupDurationString}\n`, { clear: !server.config.logger.hasWarned });
+ server.printUrls();
+ bindShortcuts(server, {
+ print: true,
+ customShortcuts: [
+ profileSession && {
+ key: 'p',
+ description: 'start/stop the profiler',
+ async action(server) {
+ if (profileSession) {
+ await stopProfiler(server.config.logger.info);
+ }
+ else {
+ const inspector = await import('node:inspector').then((r) => r.default);
+ await new Promise((res) => {
+ profileSession = new inspector.Session();
+ profileSession.connect();
+ profileSession.post('Profiler.enable', () => {
+ profileSession.post('Profiler.start', () => {
+ server.config.logger.info('Profiler started');
+ res();
+ });
+ });
+ });
+ }
+ },
+ },
+ ],
+ });
+ }
+ catch (e) {
+ const logger = createLogger(options.logLevel);
+ logger.error(colors.red(`error when starting dev server:\n${e.stack}`), {
+ error: e,
+ });
+ stopProfiler(logger.info);
+ process.exit(1);
+ }
+});
+// build
+cli
+ .command('build [root]', 'build for production')
+ .option('--target ', `[string] transpile target (default: 'modules')`)
+ .option('--outDir ', `[string] output directory (default: dist)`)
+ .option('--assetsDir ', `[string] directory under outDir to place assets in (default: assets)`)
+ .option('--assetsInlineLimit ', `[number] static asset base64 inline threshold in bytes (default: 4096)`)
+ .option('--ssr [entry]', `[string] build specified entry for server-side rendering`)
+ .option('--sourcemap [output]', `[boolean | "inline" | "hidden"] output source maps for build (default: false)`)
+ .option('--minify [minifier]', `[boolean | "terser" | "esbuild"] enable/disable minification, ` +
+ `or specify minifier to use (default: esbuild)`)
+ .option('--manifest [name]', `[boolean | string] emit build manifest json`)
+ .option('--ssrManifest [name]', `[boolean | string] emit ssr manifest json`)
+ .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle (experimental)`)
+ .option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
+ .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
+ .action(async (root, options) => {
+ filterDuplicateOptions(options);
+ const { build } = await import('./chunks/dep-df561101.js').then(function (n) { return n.H; });
+ const buildOptions = cleanOptions(options);
+ try {
+ await build({
+ root,
+ base: options.base,
+ mode: options.mode,
+ configFile: options.config,
+ logLevel: options.logLevel,
+ clearScreen: options.clearScreen,
+ optimizeDeps: { force: options.force },
+ build: buildOptions,
+ });
+ }
+ catch (e) {
+ createLogger(options.logLevel).error(colors.red(`error during build:\n${e.stack}`), { error: e });
+ process.exit(1);
+ }
+ finally {
+ stopProfiler((message) => createLogger(options.logLevel).info(message));
+ }
+});
+// optimize
+cli
+ .command('optimize [root]', 'pre-bundle dependencies')
+ .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
+ .action(async (root, options) => {
+ filterDuplicateOptions(options);
+ const { optimizeDeps } = await import('./chunks/dep-df561101.js').then(function (n) { return n.G; });
+ try {
+ const config = await resolveConfig({
+ root,
+ base: options.base,
+ configFile: options.config,
+ logLevel: options.logLevel,
+ mode: options.mode,
+ }, 'serve');
+ await optimizeDeps(config, options.force, true);
+ }
+ catch (e) {
+ createLogger(options.logLevel).error(colors.red(`error when optimizing deps:\n${e.stack}`), { error: e });
+ process.exit(1);
+ }
+});
+// preview
+cli
+ .command('preview [root]', 'locally preview production build')
+ .option('--host [host]', `[string] specify hostname`)
+ .option('--port ', `[number] specify port`)
+ .option('--strictPort', `[boolean] exit if specified port is already in use`)
+ .option('--https', `[boolean] use TLS + HTTP/2`)
+ .option('--open [path]', `[boolean | string] open browser on startup`)
+ .option('--outDir ', `[string] output directory (default: dist)`)
+ .action(async (root, options) => {
+ filterDuplicateOptions(options);
+ const { preview } = await import('./chunks/dep-df561101.js').then(function (n) { return n.J; });
+ try {
+ const server = await preview({
+ root,
+ base: options.base,
+ configFile: options.config,
+ logLevel: options.logLevel,
+ mode: options.mode,
+ build: {
+ outDir: options.outDir,
+ },
+ preview: {
+ port: options.port,
+ strictPort: options.strictPort,
+ host: options.host,
+ https: options.https,
+ open: options.open,
+ },
+ });
+ server.printUrls();
+ bindShortcuts(server, { print: true });
+ }
+ catch (e) {
+ createLogger(options.logLevel).error(colors.red(`error when starting preview server:\n${e.stack}`), { error: e });
+ process.exit(1);
+ }
+ finally {
+ stopProfiler((message) => createLogger(options.logLevel).info(message));
+ }
+});
+cli.help();
+cli.version(VERSION);
+cli.parse();
+
+export { stopProfiler };
diff --git a/node_modules/vite/dist/node/constants.js b/node_modules/vite/dist/node/constants.js
new file mode 100644
index 0000000..0032dcf
--- /dev/null
+++ b/node_modules/vite/dist/node/constants.js
@@ -0,0 +1,125 @@
+import path, { resolve } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { readFileSync } from 'node:fs';
+
+const { version } = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url)).toString());
+const VERSION = version;
+const DEFAULT_MAIN_FIELDS = [
+ 'module',
+ 'jsnext:main',
+ 'jsnext',
+];
+// Baseline support browserslist
+// "defaults and supports es6-module and supports es6-module-dynamic-import"
+// Higher browser versions may be needed for extra features.
+const ESBUILD_MODULES_TARGET = [
+ 'es2020',
+ 'edge88',
+ 'firefox78',
+ 'chrome87',
+ 'safari14',
+];
+const DEFAULT_EXTENSIONS = [
+ '.mjs',
+ '.js',
+ '.mts',
+ '.ts',
+ '.jsx',
+ '.tsx',
+ '.json',
+];
+const DEFAULT_CONFIG_FILES = [
+ 'vite.config.js',
+ 'vite.config.mjs',
+ 'vite.config.ts',
+ 'vite.config.cjs',
+ 'vite.config.mts',
+ 'vite.config.cts',
+];
+const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
+const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
+const OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/;
+const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
+/**
+ * Prefix for resolved fs paths, since windows paths may not be valid as URLs.
+ */
+const FS_PREFIX = `/@fs/`;
+/**
+ * Prefix for resolved Ids that are not valid browser import specifiers
+ */
+const VALID_ID_PREFIX = `/@id/`;
+/**
+ * Plugins that use 'virtual modules' (e.g. for helper functions), prefix the
+ * module ID with `\0`, a convention from the rollup ecosystem.
+ * This prevents other plugins from trying to process the id (like node resolution),
+ * and core features like sourcemaps can use this info to differentiate between
+ * virtual modules and regular files.
+ * `\0` is not a permitted char in import URLs so we have to replace them during
+ * import analysis. The id will be decoded back before entering the plugins pipeline.
+ * These encoded virtual ids are also prefixed by the VALID_ID_PREFIX, so virtual
+ * modules in the browser end up encoded as `/@id/__x00__{id}`
+ */
+const NULL_BYTE_PLACEHOLDER = `__x00__`;
+const CLIENT_PUBLIC_PATH = `/@vite/client`;
+const ENV_PUBLIC_PATH = `/@vite/env`;
+const VITE_PACKAGE_DIR = resolve(
+// import.meta.url is `dist/node/constants.js` after bundle
+fileURLToPath(import.meta.url), '../../..');
+const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
+const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
+const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
+// ** READ THIS ** before editing `KNOWN_ASSET_TYPES`.
+// If you add an asset to `KNOWN_ASSET_TYPES`, make sure to also add it
+// to the TypeScript declaration file `packages/vite/client.d.ts` and
+// add a mime type to the `registerCustomMime` in
+// `packages/vite/src/node/plugin/assets.ts` if mime type cannot be
+// looked up by mrmime.
+const KNOWN_ASSET_TYPES = [
+ // images
+ 'apng',
+ 'png',
+ 'jpe?g',
+ 'jfif',
+ 'pjpeg',
+ 'pjp',
+ 'gif',
+ 'svg',
+ 'ico',
+ 'webp',
+ 'avif',
+ // media
+ 'mp4',
+ 'webm',
+ 'ogg',
+ 'mp3',
+ 'wav',
+ 'flac',
+ 'aac',
+ 'opus',
+ // fonts
+ 'woff2?',
+ 'eot',
+ 'ttf',
+ 'otf',
+ // other
+ 'webmanifest',
+ 'pdf',
+ 'txt',
+];
+const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
+const DEP_VERSION_RE = /[?&](v=[\w.-]+)\b/;
+const loopbackHosts = new Set([
+ 'localhost',
+ '127.0.0.1',
+ '::1',
+ '0000:0000:0000:0000:0000:0000:0000:0001',
+]);
+const wildcardHosts = new Set([
+ '0.0.0.0',
+ '::',
+ '0000:0000:0000:0000:0000:0000:0000:0000',
+]);
+const DEFAULT_DEV_PORT = 5173;
+const DEFAULT_PREVIEW_PORT = 4173;
+
+export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEFAULT_PREVIEW_PORT, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
diff --git a/node_modules/vite/dist/node/index.d.ts b/node_modules/vite/dist/node/index.d.ts
new file mode 100644
index 0000000..cfd843e
--- /dev/null
+++ b/node_modules/vite/dist/node/index.d.ts
@@ -0,0 +1,3480 @@
+///
+
+import type { Agent } from 'node:http';
+import type { BuildOptions as BuildOptions_2 } from 'esbuild';
+import { ChunkMetadata } from "../../types/metadata.js";
+import type { ClientRequest } from 'node:http';
+import type { ClientRequestArgs } from 'node:http';
+import { ConnectedPayload } from "../../types/hmrPayload.js";
+import { CustomEventMap } from "../../types/customEvent.js";
+import { CustomPayload } from "../../types/hmrPayload.js";
+import type { CustomPluginOptions } from 'rollup';
+import type { Duplex } from 'node:stream';
+import type { DuplexOptions } from 'node:stream';
+import { ErrorPayload } from "../../types/hmrPayload.js";
+import { TransformOptions as EsbuildTransformOptions } from 'esbuild';
+import { version as esbuildVersion } from 'esbuild';
+import { EventEmitter } from 'node:events';
+import * as events from 'node:events';
+import type { ExistingRawSourceMap } from 'rollup';
+import type * as fs from 'node:fs';
+import { FullReloadPayload } from "../../types/hmrPayload.js";
+import { GeneralImportGlobOptions } from "../../types/importGlob.js";
+import type { GetManualChunk } from 'rollup';
+import { HMRPayload } from "../../types/hmrPayload.js";
+import * as http from 'node:http';
+import { ImportGlobEagerFunction } from "../../types/importGlob.js";
+import { ImportGlobFunction } from "../../types/importGlob.js";
+import { ImportGlobOptions } from "../../types/importGlob.js";
+import type { IncomingMessage } from 'node:http';
+import { InferCustomEventPayload } from "../../types/customEvent.js";
+import type { InputOption } from 'rollup';
+import type { InputOptions } from 'rollup';
+import { InvalidatePayload } from "../../types/customEvent.js";
+import { KnownAsTypeMap } from "../../types/importGlob.js";
+import type { LoadResult } from 'rollup';
+
+import type { ModuleFormat } from 'rollup';
+import type { ModuleInfo } from 'rollup';
+import type * as net from 'node:net';
+import type { ObjectHook } from 'rollup';
+import type { OutgoingHttpHeaders } from 'node:http';
+import type { OutputBundle } from 'rollup';
+import type { OutputChunk } from 'rollup';
+import type { PartialResolvedId } from 'rollup';
+import type { Plugin as Plugin_3 } from 'rollup';
+import type { PluginContext } from 'rollup';
+import type { PluginHooks } from 'rollup';
+import type * as PostCSS from 'postcss';
+import { PrunePayload } from "../../types/hmrPayload.js";
+import type { ResolveIdResult } from 'rollup';
+import type * as Rollup from 'rollup';
+import type { RollupError } from 'rollup';
+import type { RollupOptions } from 'rollup';
+import type { RollupOutput } from 'rollup';
+import { VERSION as rollupVersion } from 'rollup';
+import type { RollupWatcher } from 'rollup';
+import type { SecureContextOptions } from 'node:tls';
+import type { Server } from 'node:http';
+import type { Server as Server_2 } from 'node:https';
+import type { ServerOptions as ServerOptions_2 } from 'node:https';
+import type { ServerResponse } from 'node:http';
+import type { SourceDescription } from 'rollup';
+import type { SourceMap } from 'rollup';
+import type { SourceMapInput } from 'rollup';
+import type * as stream from 'node:stream';
+import type { TransformPluginContext } from 'rollup';
+import type { TransformResult as TransformResult_2 } from 'rollup';
+import type { TransformResult as TransformResult_3 } from 'esbuild';
+import { Update } from "../../types/hmrPayload.js";
+import { UpdatePayload } from "../../types/hmrPayload.js";
+import type * as url from 'node:url';
+import type { URL as URL_2 } from 'node:url';
+import type { WatcherOptions } from 'rollup';
+import type { ZlibOptions } from 'node:zlib';
+
+export declare interface Alias {
+ find: string | RegExp
+ replacement: string
+ /**
+ * Instructs the plugin to use an alternative resolving algorithm,
+ * rather than the Rollup's resolver.
+ * @default null
+ */
+ customResolver?: ResolverFunction | ResolverObject | null
+}
+
+/**
+ * Specifies an `Object`, or an `Array` of `Object`,
+ * which defines aliases used to replace values in `import` or `require` statements.
+ * With either format, the order of the entries is important,
+ * in that the first defined rules are applied first.
+ *
+ * This is passed to \@rollup/plugin-alias as the "entries" field
+ * https://github.com/rollup/plugins/tree/master/packages/alias#entries
+ */
+export declare type AliasOptions = readonly Alias[] | { [find: string]: string }
+
+export declare type AnymatchFn = (testString: string) => boolean
+
+export declare type AnymatchPattern = string | RegExp | AnymatchFn
+
+/**
+ * spa: include SPA fallback middleware and configure sirv with `single: true` in preview
+ *
+ * mpa: only include non-SPA HTML middlewares
+ *
+ * custom: don't include HTML middlewares
+ */
+export declare type AppType = 'spa' | 'mpa' | 'custom';
+
+export declare interface AwaitWriteFinishOptions {
+ /**
+ * Amount of time in milliseconds for a file size to remain constant before emitting its event.
+ */
+ stabilityThreshold?: number
+
+ /**
+ * File size polling interval.
+ */
+ pollInterval?: number
+}
+
+/**
+ * Bundles the app for production.
+ * Returns a Promise containing the build result.
+ */
+export declare function build(inlineConfig?: InlineConfig): Promise;
+
+export declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
+
+export declare interface BuildOptions {
+ /**
+ * Compatibility transform target. The transform is performed with esbuild
+ * and the lowest supported target is es2015/es6. Note this only handles
+ * syntax transformation and does not cover polyfills (except for dynamic
+ * import)
+ *
+ * Default: 'modules' - Similar to `@babel/preset-env`'s targets.esmodules,
+ * transpile targeting browsers that natively support dynamic es module imports.
+ * https://caniuse.com/es6-module-dynamic-import
+ *
+ * Another special value is 'esnext' - which only performs minimal transpiling
+ * (for minification compat) and assumes native dynamic imports support.
+ *
+ * For custom targets, see https://esbuild.github.io/api/#target and
+ * https://esbuild.github.io/content-types/#javascript for more details.
+ * @default 'modules'
+ */
+ target?: 'modules' | EsbuildTransformOptions['target'] | false;
+ /**
+ * whether to inject module preload polyfill.
+ * Note: does not apply to library mode.
+ * @default true
+ * @deprecated use `modulePreload.polyfill` instead
+ */
+ polyfillModulePreload?: boolean;
+ /**
+ * Configure module preload
+ * Note: does not apply to library mode.
+ * @default true
+ */
+ modulePreload?: boolean | ModulePreloadOptions;
+ /**
+ * Directory relative from `root` where build output will be placed. If the
+ * directory exists, it will be removed before the build.
+ * @default 'dist'
+ */
+ outDir?: string;
+ /**
+ * Directory relative from `outDir` where the built js/css/image assets will
+ * be placed.
+ * @default 'assets'
+ */
+ assetsDir?: string;
+ /**
+ * Static asset files smaller than this number (in bytes) will be inlined as
+ * base64 strings. Default limit is `4096` (4kb). Set to `0` to disable.
+ * @default 4096
+ */
+ assetsInlineLimit?: number;
+ /**
+ * Whether to code-split CSS. When enabled, CSS in async chunks will be
+ * inlined as strings in the chunk and inserted via dynamically created
+ * style tags when the chunk is loaded.
+ * @default true
+ */
+ cssCodeSplit?: boolean;
+ /**
+ * An optional separate target for CSS minification.
+ * As esbuild only supports configuring targets to mainstream
+ * browsers, users may need this option when they are targeting
+ * a niche browser that comes with most modern JavaScript features
+ * but has poor CSS support, e.g. Android WeChat WebView, which
+ * doesn't support the #RGBA syntax.
+ * @default target
+ */
+ cssTarget?: EsbuildTransformOptions['target'] | false;
+ /**
+ * Override CSS minification specifically instead of defaulting to `build.minify`,
+ * so you can configure minification for JS and CSS separately.
+ * @default 'esbuild'
+ */
+ cssMinify?: boolean | 'esbuild' | 'lightningcss';
+ /**
+ * If `true`, a separate sourcemap file will be created. If 'inline', the
+ * sourcemap will be appended to the resulting output file as data URI.
+ * 'hidden' works like `true` except that the corresponding sourcemap
+ * comments in the bundled files are suppressed.
+ * @default false
+ */
+ sourcemap?: boolean | 'inline' | 'hidden';
+ /**
+ * Set to `false` to disable minification, or specify the minifier to use.
+ * Available options are 'terser' or 'esbuild'.
+ * @default 'esbuild'
+ */
+ minify?: boolean | 'terser' | 'esbuild';
+ /**
+ * Options for terser
+ * https://terser.org/docs/api-reference#minify-options
+ */
+ terserOptions?: Terser.MinifyOptions;
+ /**
+ * Will be merged with internal rollup options.
+ * https://rollupjs.org/configuration-options/
+ */
+ rollupOptions?: RollupOptions;
+ /**
+ * Options to pass on to `@rollup/plugin-commonjs`
+ */
+ commonjsOptions?: RollupCommonJSOptions;
+ /**
+ * Options to pass on to `@rollup/plugin-dynamic-import-vars`
+ */
+ dynamicImportVarsOptions?: RollupDynamicImportVarsOptions;
+ /**
+ * Whether to write bundle to disk
+ * @default true
+ */
+ write?: boolean;
+ /**
+ * Empty outDir on write.
+ * @default true when outDir is a sub directory of project root
+ */
+ emptyOutDir?: boolean | null;
+ /**
+ * Copy the public directory to outDir on write.
+ * @default true
+ * @experimental
+ */
+ copyPublicDir?: boolean;
+ /**
+ * Whether to emit a manifest.json under assets dir to map hash-less filenames
+ * to their hashed versions. Useful when you want to generate your own HTML
+ * instead of using the one generated by Vite.
+ *
+ * Example:
+ *
+ * ```json
+ * {
+ * "main.js": {
+ * "file": "main.68fe3fad.js",
+ * "css": "main.e6b63442.css",
+ * "imports": [...],
+ * "dynamicImports": [...]
+ * }
+ * }
+ * ```
+ * @default false
+ */
+ manifest?: boolean | string;
+ /**
+ * Build in library mode. The value should be the global name of the lib in
+ * UMD mode. This will produce esm + cjs + umd bundle formats with default
+ * configurations that are suitable for distributing libraries.
+ * @default false
+ */
+ lib?: LibraryOptions | false;
+ /**
+ * Produce SSR oriented build. Note this requires specifying SSR entry via
+ * `rollupOptions.input`.
+ * @default false
+ */
+ ssr?: boolean | string;
+ /**
+ * Generate SSR manifest for determining style links and asset preload
+ * directives in production.
+ * @default false
+ */
+ ssrManifest?: boolean | string;
+ /**
+ * Emit assets during SSR.
+ * @experimental
+ * @default false
+ */
+ ssrEmitAssets?: boolean;
+ /**
+ * Set to false to disable reporting compressed chunk sizes.
+ * Can slightly improve build speed.
+ * @default true
+ */
+ reportCompressedSize?: boolean;
+ /**
+ * Adjust chunk size warning limit (in kbs).
+ * @default 500
+ */
+ chunkSizeWarningLimit?: number;
+ /**
+ * Rollup watch options
+ * https://rollupjs.org/configuration-options/#watch
+ * @default null
+ */
+ watch?: WatcherOptions | null;
+}
+
+export { ChunkMetadata }
+
+export declare interface CommonServerOptions {
+ /**
+ * Specify server port. Note if the port is already being used, Vite will
+ * automatically try the next available port so this may not be the actual
+ * port the server ends up listening on.
+ */
+ port?: number;
+ /**
+ * If enabled, vite will exit if specified port is already in use
+ */
+ strictPort?: boolean;
+ /**
+ * Specify which IP addresses the server should listen on.
+ * Set to 0.0.0.0 to listen on all addresses, including LAN and public addresses.
+ */
+ host?: string | boolean;
+ /**
+ * Enable TLS + HTTP/2.
+ * Note: this downgrades to TLS only when the proxy option is also used.
+ */
+ https?: boolean | ServerOptions_2;
+ /**
+ * Open browser window on startup
+ */
+ open?: boolean | string;
+ /**
+ * Configure custom proxy rules for the dev server. Expects an object
+ * of `{ key: options }` pairs.
+ * Uses [`http-proxy`](https://github.com/http-party/node-http-proxy).
+ * Full options [here](https://github.com/http-party/node-http-proxy#options).
+ *
+ * Example `vite.config.js`:
+ * ``` js
+ * module.exports = {
+ * proxy: {
+ * // string shorthand
+ * '/foo': 'http://localhost:4567/foo',
+ * // with options
+ * '/api': {
+ * target: 'http://jsonplaceholder.typicode.com',
+ * changeOrigin: true,
+ * rewrite: path => path.replace(/^\/api/, '')
+ * }
+ * }
+ * }
+ * ```
+ */
+ proxy?: Record;
+ /**
+ * Configure CORS for the dev server.
+ * Uses https://github.com/expressjs/cors.
+ * Set to `true` to allow all methods from any origin, or configure separately
+ * using an object.
+ */
+ cors?: CorsOptions | boolean;
+ /**
+ * Specify server response headers.
+ */
+ headers?: OutgoingHttpHeaders;
+}
+
+export declare interface ConfigEnv {
+ command: 'build' | 'serve';
+ mode: string;
+ /**
+ * @experimental
+ */
+ ssrBuild?: boolean;
+}
+
+export declare namespace Connect {
+ export type ServerHandle = HandleFunction | http.Server
+
+ export class IncomingMessage extends http.IncomingMessage {
+ originalUrl?: http.IncomingMessage['url'] | undefined
+ }
+
+ export type NextFunction = (err?: any) => void
+
+ export type SimpleHandleFunction = (
+ req: IncomingMessage,
+ res: http.ServerResponse,
+ ) => void
+ export type NextHandleFunction = (
+ req: IncomingMessage,
+ res: http.ServerResponse,
+ next: NextFunction,
+ ) => void
+ export type ErrorHandleFunction = (
+ err: any,
+ req: IncomingMessage,
+ res: http.ServerResponse,
+ next: NextFunction,
+ ) => void
+ export type HandleFunction =
+ | SimpleHandleFunction
+ | NextHandleFunction
+ | ErrorHandleFunction
+
+ export interface ServerStackItem {
+ route: string
+ handle: ServerHandle
+ }
+
+ export interface Server extends NodeJS.EventEmitter {
+ (req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void
+
+ route: string
+ stack: ServerStackItem[]
+
+ /**
+ * Utilize the given middleware `handle` to the given `route`,
+ * defaulting to _/_. This "route" is the mount-point for the
+ * middleware, when given a value other than _/_ the middleware
+ * is only effective when that segment is present in the request's
+ * pathname.
+ *
+ * For example if we were to mount a function at _/admin_, it would
+ * be invoked on _/admin_, and _/admin/settings_, however it would
+ * not be invoked for _/_, or _/posts_.
+ */
+ use(fn: NextHandleFunction): Server
+ use(fn: HandleFunction): Server
+ use(route: string, fn: NextHandleFunction): Server
+ use(route: string, fn: HandleFunction): Server
+
+ /**
+ * Handle server requests, punting them down
+ * the middleware stack.
+ */
+ handle(
+ req: http.IncomingMessage,
+ res: http.ServerResponse,
+ next: Function,
+ ): void
+
+ /**
+ * Listen for connections.
+ *
+ * This method takes the same arguments
+ * as node's `http.Server#listen()`.
+ *
+ * HTTP and HTTPS:
+ *
+ * If you run your application both as HTTP
+ * and HTTPS you may wrap them individually,
+ * since your Connect "server" is really just
+ * a JavaScript `Function`.
+ *
+ * var connect = require('connect')
+ * , http = require('http')
+ * , https = require('https');
+ *
+ * var app = connect();
+ *
+ * http.createServer(app).listen(80);
+ * https.createServer(options, app).listen(443);
+ */
+ listen(
+ port: number,
+ hostname?: string,
+ backlog?: number,
+ callback?: Function,
+ ): http.Server
+ listen(port: number, hostname?: string, callback?: Function): http.Server
+ listen(path: string, callback?: Function): http.Server
+ listen(handle: any, listeningListener?: Function): http.Server
+ }
+}
+
+export { ConnectedPayload }
+
+/**
+ * https://github.com/expressjs/cors#configuration-options
+ */
+export declare interface CorsOptions {
+ origin?: CorsOrigin | ((origin: string, cb: (err: Error, origins: CorsOrigin) => void) => void);
+ methods?: string | string[];
+ allowedHeaders?: string | string[];
+ exposedHeaders?: string | string[];
+ credentials?: boolean;
+ maxAge?: number;
+ preflightContinue?: boolean;
+ optionsSuccessStatus?: number;
+}
+
+export declare type CorsOrigin = boolean | string | RegExp | (string | RegExp)[];
+
+export declare const createFilter: (include?: FilterPattern, exclude?: FilterPattern, options?: {
+ resolve?: string | false | null;
+}) => (id: string | unknown) => boolean;
+
+export declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
+
+export declare function createServer(inlineConfig?: InlineConfig): Promise;
+
+declare interface CSSModulesConfig {
+ /** The pattern to use when renaming class names and other identifiers. Default is `[hash]_[local]`. */
+ pattern?: string,
+ /** Whether to rename dashed identifiers, e.g. custom properties. */
+ dashedIdents?: boolean
+}
+
+export declare interface CSSModulesOptions {
+ getJSON?: (cssFileName: string, json: Record, outputFileName: string) => void;
+ scopeBehaviour?: 'global' | 'local';
+ globalModulePaths?: RegExp[];
+ generateScopedName?: string | ((name: string, filename: string, css: string) => string);
+ hashPrefix?: string;
+ /**
+ * default: undefined
+ */
+ localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | ((originalClassName: string, generatedClassName: string, inputFile: string) => string);
+}
+
+export declare interface CSSOptions {
+ /**
+ * Using lightningcss is an experimental option to handle CSS modules,
+ * assets and imports via Lightning CSS. It requires to install it as a
+ * peer dependency. This is incompatible with the use of preprocessors.
+ *
+ * @default 'postcss'
+ * @experimental
+ */
+ transformer?: 'postcss' | 'lightningcss';
+ /**
+ * https://github.com/css-modules/postcss-modules
+ */
+ modules?: CSSModulesOptions | false;
+ preprocessorOptions?: Record;
+ postcss?: string | (PostCSS.ProcessOptions & {
+ plugins?: PostCSS.AcceptedPlugin[];
+ });
+ /**
+ * Enables css sourcemaps during dev
+ * @default false
+ * @experimental
+ */
+ devSourcemap?: boolean;
+ /**
+ * @experimental
+ */
+ lightningcss?: LightningCSSOptions;
+}
+
+export { CustomEventMap }
+
+export { CustomPayload }
+
+/**
+ * Type helper to make it easier to use vite.config.ts
+ * accepts a direct {@link UserConfig} object, or a function that returns it.
+ * The function receives a {@link ConfigEnv} object that exposes two properties:
+ * `command` (either `'build'` or `'serve'`), and `mode`.
+ */
+export declare function defineConfig(config: UserConfig): UserConfig;
+
+export declare function defineConfig(config: Promise): Promise;
+
+export declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
+
+export declare function defineConfig(config: UserConfigExport): UserConfigExport;
+
+export declare interface DepOptimizationConfig {
+ /**
+ * Force optimize listed dependencies (must be resolvable import paths,
+ * cannot be globs).
+ */
+ include?: string[];
+ /**
+ * Do not optimize these dependencies (must be resolvable import paths,
+ * cannot be globs).
+ */
+ exclude?: string[];
+ /**
+ * Forces ESM interop when importing these dependencies. Some legacy
+ * packages advertise themselves as ESM but use `require` internally
+ * @experimental
+ */
+ needsInterop?: string[];
+ /**
+ * Options to pass to esbuild during the dep scanning and optimization
+ *
+ * Certain options are omitted since changing them would not be compatible
+ * with Vite's dep optimization.
+ *
+ * - `external` is also omitted, use Vite's `optimizeDeps.exclude` option
+ * - `plugins` are merged with Vite's dep plugin
+ *
+ * https://esbuild.github.io/api
+ */
+ esbuildOptions?: Omit;
+ /**
+ * List of file extensions that can be optimized. A corresponding esbuild
+ * plugin must exist to handle the specific extension.
+ *
+ * By default, Vite can optimize `.mjs`, `.js`, `.ts`, and `.mts` files. This option
+ * allows specifying additional extensions.
+ *
+ * @experimental
+ */
+ extensions?: string[];
+ /**
+ * Disables dependencies optimizations, true disables the optimizer during
+ * build and dev. Pass 'build' or 'dev' to only disable the optimizer in
+ * one of the modes. Deps optimization is enabled by default in dev only.
+ * @default 'build'
+ * @experimental
+ */
+ disabled?: boolean | 'build' | 'dev';
+ /**
+ * Automatic dependency discovery. When `noDiscovery` is true, only dependencies
+ * listed in `include` will be optimized. The scanner isn't run for cold start
+ * in this case. CJS-only dependencies must be present in `include` during dev.
+ * @default false
+ * @experimental
+ */
+ noDiscovery?: boolean;
+}
+
+export declare interface DepOptimizationMetadata {
+ /**
+ * The main hash is determined by user config and dependency lockfiles.
+ * This is checked on server startup to avoid unnecessary re-bundles.
+ */
+ hash: string;
+ /**
+ * The browser hash is determined by the main hash plus additional dependencies
+ * discovered at runtime. This is used to invalidate browser requests to
+ * optimized deps.
+ */
+ browserHash: string;
+ /**
+ * Metadata for each already optimized dependency
+ */
+ optimized: Record;
+ /**
+ * Metadata for non-entry optimized chunks and dynamic imports
+ */
+ chunks: Record;
+ /**
+ * Metadata for each newly discovered dependency after processing
+ */
+ discovered: Record;
+ /**
+ * OptimizedDepInfo list
+ */
+ depInfoList: OptimizedDepInfo[];
+}
+
+export declare type DepOptimizationOptions = DepOptimizationConfig & {
+ /**
+ * By default, Vite will crawl your `index.html` to detect dependencies that
+ * need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
+ * will crawl those entry points instead.
+ *
+ * If neither of these fit your needs, you can specify custom entries using
+ * this option - the value should be a fast-glob pattern or array of patterns
+ * (https://github.com/mrmlnc/fast-glob#basic-syntax) that are relative from
+ * vite project root. This will overwrite default entries inference.
+ */
+ entries?: string | string[];
+ /**
+ * Force dep pre-optimization regardless of whether deps have changed.
+ * @experimental
+ */
+ force?: boolean;
+};
+
+export declare interface DepOptimizationProcessing {
+ promise: Promise;
+ resolve: () => void;
+}
+
+export declare interface DepOptimizationResult {
+ metadata: DepOptimizationMetadata;
+ /**
+ * When doing a re-run, if there are newly discovered dependencies
+ * the page reload will be delayed until the next rerun so we need
+ * to be able to discard the result
+ */
+ commit: () => Promise;
+ cancel: () => void;
+}
+
+export declare interface DepsOptimizer {
+ metadata: DepOptimizationMetadata;
+ scanProcessing?: Promise;
+ registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
+ run: () => void;
+ isOptimizedDepFile: (id: string) => boolean;
+ isOptimizedDepUrl: (url: string) => boolean;
+ getOptimizedDepId: (depInfo: OptimizedDepInfo) => string;
+ delayDepsOptimizerUntil: (id: string, done: () => Promise) => void;
+ registerWorkersSource: (id: string) => void;
+ resetRegisteredIds: () => void;
+ ensureFirstRun: () => void;
+ close: () => Promise;
+ options: DepOptimizationOptions;
+}
+
+declare interface Drafts {
+ /** Whether to enable CSS nesting. */
+ nesting?: boolean,
+ /** Whether to enable @custom-media rules. */
+ customMedia?: boolean
+}
+
+export { ErrorPayload }
+
+export declare interface ESBuildOptions extends EsbuildTransformOptions {
+ include?: string | RegExp | string[] | RegExp[];
+ exclude?: string | RegExp | string[] | RegExp[];
+ jsxInject?: string;
+ /**
+ * This option is not respected. Use `build.minify` instead.
+ */
+ minify?: never;
+}
+
+export { EsbuildTransformOptions }
+
+export declare type ESBuildTransformResult = Omit & {
+ map: SourceMap;
+};
+
+export { esbuildVersion }
+
+export declare interface ExperimentalOptions {
+ /**
+ * Append fake `&lang.(ext)` when queries are specified, to preserve the file extension for following plugins to process.
+ *
+ * @experimental
+ * @default false
+ */
+ importGlobRestoreExtension?: boolean;
+ /**
+ * Allow finegrain control over assets and public files paths
+ *
+ * @experimental
+ */
+ renderBuiltUrl?: RenderBuiltAssetUrl;
+ /**
+ * Enables support of HMR partial accept via `import.meta.hot.acceptExports`.
+ *
+ * @experimental
+ * @default false
+ */
+ hmrPartialAccept?: boolean;
+ /**
+ * Skips SSR transform to make it easier to use Vite with Node ESM loaders.
+ * @warning Enabling this will break normal operation of Vite's SSR in development mode.
+ *
+ * @experimental
+ * @default false
+ */
+ skipSsrTransform?: boolean;
+}
+
+export declare type ExportsData = {
+ hasImports: boolean;
+ exports: readonly string[];
+ jsxLoader?: boolean;
+};
+
+declare const enum Features {
+ Nesting = 1,
+ NotSelectorList = 2,
+ DirSelector = 4,
+ LangSelectorList = 8,
+ IsSelector = 16,
+ TextDecorationThicknessPercent = 32,
+ MediaIntervalSyntax = 64,
+ MediaRangeSyntax = 128,
+ CustomMediaQueries = 256,
+ ClampFunction = 512,
+ ColorFunction = 1024,
+ OklabColors = 2048,
+ LabColors = 4096,
+ P3Colors = 8192,
+ HexAlphaColors = 16384,
+ SpaceSeparatedColorNotation = 32768,
+ FontFamilySystemUi = 65536,
+ DoublePositionGradients = 131072,
+ VendorPrefixes = 262144,
+ LogicalProperties = 524288,
+ Selectors = 31,
+ MediaQueries = 448,
+ Colors = 64512,
+}
+
+export declare interface FileSystemServeOptions {
+ /**
+ * Strictly restrict file accessing outside of allowing paths.
+ *
+ * Set to `false` to disable the warning
+ *
+ * @default true
+ */
+ strict?: boolean;
+ /**
+ * Restrict accessing files outside the allowed directories.
+ *
+ * Accepts absolute path or a path relative to project root.
+ * Will try to search up for workspace root by default.
+ */
+ allow?: string[];
+ /**
+ * Restrict accessing files that matches the patterns.
+ *
+ * This will have higher priority than `allow`.
+ * picomatch patterns are supported.
+ *
+ * @default ['.env', '.env.*', '*.crt', '*.pem']
+ */
+ deny?: string[];
+}
+
+/**
+ * Inlined to keep `@rollup/pluginutils` in devDependencies
+ */
+export declare type FilterPattern = ReadonlyArray | string | RegExp | null;
+
+export declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise;
+
+export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
+ options: WatchOptions
+
+ /**
+ * Constructs a new FSWatcher instance with optional WatchOptions parameter.
+ */
+ constructor(options?: WatchOptions)
+
+ /**
+ * Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
+ * string.
+ */
+ add(paths: string | ReadonlyArray): this
+
+ /**
+ * Stop watching files, directories, or glob patterns. Takes an array of strings or just one
+ * string.
+ */
+ unwatch(paths: string | ReadonlyArray): this
+
+ /**
+ * Returns an object representing all the paths on the file system being watched by this
+ * `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless
+ * the `cwd` option was used), and the values are arrays of the names of the items contained in
+ * each directory.
+ */
+ getWatched(): {
+ [directory: string]: string[]
+ }
+
+ /**
+ * Removes all listeners from watched files.
+ */
+ close(): Promise
+
+ on(
+ event: 'add' | 'addDir' | 'change',
+ listener: (path: string, stats?: fs.Stats) => void,
+ ): this
+
+ on(
+ event: 'all',
+ listener: (
+ eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir',
+ path: string,
+ stats?: fs.Stats,
+ ) => void,
+ ): this
+
+ /**
+ * Error occurred
+ */
+ on(event: 'error', listener: (error: Error) => void): this
+
+ /**
+ * Exposes the native Node `fs.FSWatcher events`
+ */
+ on(
+ event: 'raw',
+ listener: (eventName: string, path: string, details: any) => void,
+ ): this
+
+ /**
+ * Fires when the initial scan is complete
+ */
+ on(event: 'ready', listener: () => void): this
+
+ on(event: 'unlink' | 'unlinkDir', listener: (path: string) => void): this
+
+ on(event: string, listener: (...args: any[]) => void): this
+}
+
+export { FullReloadPayload }
+
+export { GeneralImportGlobOptions }
+
+export declare function getDepOptimizationConfig(config: ResolvedConfig, ssr: boolean): DepOptimizationConfig;
+
+export declare interface HmrContext {
+ file: string;
+ timestamp: number;
+ modules: Array;
+ read: () => string | Promise;
+ server: ViteDevServer;
+}
+
+export declare interface HmrOptions {
+ protocol?: string;
+ host?: string;
+ port?: number;
+ clientPort?: number;
+ path?: string;
+ timeout?: number;
+ overlay?: boolean;
+ server?: Server;
+}
+
+export { HMRPayload }
+
+export declare type HookHandler = T extends ObjectHook ? H : T;
+
+export declare interface HtmlTagDescriptor {
+ tag: string;
+ attrs?: Record;
+ children?: string | HtmlTagDescriptor[];
+ /**
+ * default: 'head-prepend'
+ */
+ injectTo?: 'head' | 'body' | 'head-prepend' | 'body-prepend';
+}
+
+export declare namespace HttpProxy {
+ export type ProxyTarget = ProxyTargetUrl | ProxyTargetDetailed
+
+ export type ProxyTargetUrl = string | Partial