,
- e: 65537
-}
-*/
-```
-
-If you want to only import the public key use `'components-public'` as an option:
-
-```javascript
-key.importKey({
- n: Buffer.from('0086fa9ba066685845fc03833a9699c8baefb53cfbf19052a7f10f1eaa30488cec1ceb752bdff2df9fad6c64b3498956e7dbab4035b4823c99a44cc57088a23783', 'hex'),
- e: 65537,
-}, 'components-public');
-```
-
-### Properties
-
-#### Key testing
-```javascript
-key.isPrivate();
-key.isPublic([strict]);
-```
-strict — `{boolean}` — if true method will return false if key pair have private exponent. Default `false`.
-
-```javascript
-key.isEmpty();
-```
-Return `true` if key pair doesn't have any data.
-
-#### Key info
-```javascript
-key.getKeySize();
-```
-Return key size in bits.
-
-```javascript
-key.getMaxMessageSize();
-```
-Return max data size for encrypt in bytes.
-
-### Encrypting/decrypting
-
-```javascript
-key.encrypt(buffer, [encoding], [source_encoding]);
-key.encryptPrivate(buffer, [encoding], [source_encoding]); // use private key for encryption
-```
-Return encrypted data.
-
-* buffer — `{buffer}` — data for encrypting, may be string, Buffer, or any object/array. Arrays and objects will encoded to JSON string first.
-* encoding — `{string}` — encoding for output result, may be `'buffer'`, `'binary'`, `'hex'` or `'base64'`. Default `'buffer'`.
-* source_encoding — `{string}` — source encoding, works only with string buffer. Can take standard Node.js Buffer encodings (hex, utf8, base64, etc). `'utf8'` by default.
-
-```javascript
-key.decrypt(buffer, [encoding]);
-key.decryptPublic(buffer, [encoding]); // use public key for decryption
-```
-Return decrypted data.
-
-* buffer — `{buffer}` — data for decrypting. Takes Buffer object or base64 encoded string.
-* encoding — `{string}` — encoding for result string. Can also take `'buffer'` for raw Buffer object, or `'json'` for automatic JSON.parse result. Default `'buffer'`.
-
-> *Notice:* `encryptPrivate` and `decryptPublic` using only pkcs1 padding type 1 (not random)
-
-### Signing/Verifying
-```javascript
-key.sign(buffer, [encoding], [source_encoding]);
-```
-Return signature for buffer. All the arguments are the same as for `encrypt` method.
-
-```javascript
-key.verify(buffer, signature, [source_encoding], [signature_encoding])
-```
-Return result of check, `true` or `false`.
-
-* buffer — `{buffer}` — data for check, same as `encrypt` method.
-* signature — `{string}` — signature for check, result of `sign` method.
-* source_encoding — `{string}` — same as for `encrypt` method.
-* signature_encoding — `{string}` — encoding of given signature. May be `'buffer'`, `'binary'`, `'hex'` or `'base64'`. Default `'buffer'`.
-
-## Contributing
-
-Questions, comments, bug reports, and pull requests are all welcome.
-
-## Changelog
-
-### 1.1.0
- * Added OpenSSH key format support.
-
-### 1.0.2
- * Importing keys from PEM now is less dependent on non-key data in files.
-
-### 1.0.1
- * `importKey()` now returns `this`
-
-### 1.0.0
- * Using semver now 🎉
- * **Breaking change**: Drop support nodejs < 8.11.1
- * **Possible breaking change**: `new Buffer()` call as deprecated was replaced by `Buffer.from` & `Buffer.alloc`.
- * **Possible breaking change**: Drop support for hash scheme `sha` (was removed in node ~10). `sha1`, `sha256` and others still works.
- * **Possible breaking change**: Little change in environment detect algorithm.
-
-### 0.4.2
- * `no padding` scheme will padded data with zeros on all environments.
-
-### 0.4.1
- * `PKCS1 no padding` scheme support.
-
-### 0.4.0
- * License changed from BSD to MIT.
- * Some changes in internal api.
-
-### 0.3.3
- * Fixed PSS encode/verify methods with max salt length.
-
-### 0.3.2
- * Fixed environment detection in web worker.
-
-### 0.3.0
- * Added import/export from/to raw key components.
- * Removed lodash from dependencies.
-
-### 0.2.30
- * Fixed a issue when the key was generated by 1 bit smaller than specified. It may slow down the generation of large keys.
-
-### 0.2.24
- * Now used old hash APIs for webpack compatible.
-
-### 0.2.22
- * `encryptPrivate` and `decryptPublic` now using only pkcs1 (type 1) padding.
-
-### 0.2.20
- * Added `.encryptPrivate()` and `.decryptPublic()` methods.
- * Encrypt/decrypt methods in nodejs 0.12.x and io.js using native implementation (> 40x speed boost).
- * Fixed some regex issue causing catastrophic backtracking.
-
-### 0.2.10
- * **Methods `.exportPrivate()` and `.exportPublic()` was replaced by `.exportKey([format])`.**
- * By default `.exportKey()` returns private key as `.exportPrivate()`, if you need public key from `.exportPublic()` you must specify format as `'public'` or `'pkcs8-public-pem'`.
- * Method `.importKey(key, [format])` now has second argument.
-
-### 0.2.0
- * **`.getPublicPEM()` method was renamed to `.exportPublic()`**
- * **`.getPrivatePEM()` method was renamed to `.exportPrivate()`**
- * **`.loadFromPEM()` method was renamed to `.importKey()`**
- * Added PKCS1_OAEP encrypting/decrypting support.
- * **PKCS1_OAEP now default scheme, you need to specify 'encryptingScheme' option to 'pkcs1' for compatibility with 0.1.x version of NodeRSA.**
- * Added PSS signing/verifying support.
- * Signing now supports `'md5'`, `'ripemd160'`, `'sha1'`, `'sha256'`, `'sha512'` hash algorithms in both environments
- and additional `'md4'`, `'sha'`, `'sha224'`, `'sha384'` for nodejs env.
- * **`options.signingAlgorithm` was renamed to `options.signingScheme`**
- * Added `encryptingScheme` option.
- * Property `key.options` now mark as private. Added `key.setOptions(options)` method.
-
-
-### 0.1.54
- * Added support for loading PEM key from Buffer (`fs.readFileSync()` output).
- * Added `isEmpty()` method.
-
-### 0.1.52
- * Improve work with not properly trimming PEM strings.
-
-### 0.1.50
- * Implemented native js signing and verifying for browsers.
- * `options.signingAlgorithm` now takes only hash-algorithm name.
- * Added `.getKeySize()` and `.getMaxMessageSize()` methods.
- * `.loadFromPublicPEM` and `.loadFromPrivatePEM` methods marked as private.
-
-### 0.1.40
- * Added signing/verifying.
-
-### 0.1.30
- * Added long message support.
-
-
-## License
-
-Copyright (c) 2014 rzcoder
-
-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.
-
-## Licensing for code used in rsa.js and jsbn.js
-
-Copyright (c) 2003-2005 Tom Wu
-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" AND WITHOUT WARRANTY OF ANY KIND,
-EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
-WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
-INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
-THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
-OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-In addition, the following condition applies:
-
-All redistributions must retain an intact copy of this copyright notice
-and disclaimer.
-
-[](https://travis-ci.org/rzcoder/node-rsa)
diff --git a/node_modules/node-rsa/package.json b/node_modules/node-rsa/package.json
deleted file mode 100644
index 6ee65ef..0000000
--- a/node_modules/node-rsa/package.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "name": "node-rsa",
- "version": "1.1.1",
- "description": "Node.js RSA library",
- "main": "src/NodeRSA.js",
- "scripts": {
- "test": "grunt test"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/rzcoder/node-rsa.git"
- },
- "keywords": [
- "node",
- "rsa",
- "crypto",
- "assymetric",
- "encryption",
- "decryption",
- "sign",
- "verify",
- "pkcs1",
- "oaep",
- "pss"
- ],
- "author": "rzcoder",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/rzcoder/node-rsa/issues"
- },
- "homepage": "https://github.com/rzcoder/node-rsa",
- "devDependencies": {
- "chai": "^4.2.0",
- "grunt": "^1.1.0",
- "grunt-contrib-jshint": "^2.1.0",
- "grunt-simple-mocha": "0.4.1",
- "jit-grunt": "0.10.0",
- "lodash": "^4.17.15",
- "nyc": "^15.0.0"
- },
- "dependencies": {
- "asn1": "^0.2.4"
- }
-}
diff --git a/node_modules/node-rsa/src/NodeRSA.js b/node_modules/node-rsa/src/NodeRSA.js
deleted file mode 100644
index 190fd66..0000000
--- a/node_modules/node-rsa/src/NodeRSA.js
+++ /dev/null
@@ -1,398 +0,0 @@
-/*!
- * RSA library for Node.js
- *
- * Author: rzcoder
- * License MIT
- */
-
-var constants = require('constants');
-var rsa = require('./libs/rsa.js');
-var crypt = require('crypto');
-var ber = require('asn1').Ber;
-var _ = require('./utils')._;
-var utils = require('./utils');
-var schemes = require('./schemes/schemes.js');
-var formats = require('./formats/formats.js');
-
-if (typeof constants.RSA_NO_PADDING === "undefined") {
- //patch for node v0.10.x, constants do not defined
- constants.RSA_NO_PADDING = 3;
-}
-
-module.exports = (function () {
- var SUPPORTED_HASH_ALGORITHMS = {
- node10: ['md4', 'md5', 'ripemd160', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512'],
- node: ['md4', 'md5', 'ripemd160', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512'],
- iojs: ['md4', 'md5', 'ripemd160', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512'],
- browser: ['md5', 'ripemd160', 'sha1', 'sha256', 'sha512']
- };
-
- var DEFAULT_ENCRYPTION_SCHEME = 'pkcs1_oaep';
- var DEFAULT_SIGNING_SCHEME = 'pkcs1';
-
- var DEFAULT_EXPORT_FORMAT = 'private';
- var EXPORT_FORMAT_ALIASES = {
- 'private': 'pkcs1-private-pem',
- 'private-der': 'pkcs1-private-der',
- 'public': 'pkcs8-public-pem',
- 'public-der': 'pkcs8-public-der',
- };
-
- /**
- * @param key {string|buffer|object} Key in PEM format, or data for generate key {b: bits, e: exponent}
- * @constructor
- */
- function NodeRSA(key, format, options) {
- if (!(this instanceof NodeRSA)) {
- return new NodeRSA(key, format, options);
- }
-
- if (_.isObject(format)) {
- options = format;
- format = undefined;
- }
-
- this.$options = {
- signingScheme: DEFAULT_SIGNING_SCHEME,
- signingSchemeOptions: {
- hash: 'sha256',
- saltLength: null
- },
- encryptionScheme: DEFAULT_ENCRYPTION_SCHEME,
- encryptionSchemeOptions: {
- hash: 'sha1',
- label: null
- },
- environment: utils.detectEnvironment(),
- rsaUtils: this
- };
- this.keyPair = new rsa.Key();
- this.$cache = {};
-
- if (Buffer.isBuffer(key) || _.isString(key)) {
- this.importKey(key, format);
- } else if (_.isObject(key)) {
- this.generateKeyPair(key.b, key.e);
- }
-
- this.setOptions(options);
- }
-
- /**
- * Set and validate options for key instance
- * @param options
- */
- NodeRSA.prototype.setOptions = function (options) {
- options = options || {};
- if (options.environment) {
- this.$options.environment = options.environment;
- }
-
- if (options.signingScheme) {
- if (_.isString(options.signingScheme)) {
- var signingScheme = options.signingScheme.toLowerCase().split('-');
- if (signingScheme.length == 1) {
- if (SUPPORTED_HASH_ALGORITHMS.node.indexOf(signingScheme[0]) > -1) {
- this.$options.signingSchemeOptions = {
- hash: signingScheme[0]
- };
- this.$options.signingScheme = DEFAULT_SIGNING_SCHEME;
- } else {
- this.$options.signingScheme = signingScheme[0];
- this.$options.signingSchemeOptions = {
- hash: null
- };
- }
- } else {
- this.$options.signingSchemeOptions = {
- hash: signingScheme[1]
- };
- this.$options.signingScheme = signingScheme[0];
- }
- } else if (_.isObject(options.signingScheme)) {
- this.$options.signingScheme = options.signingScheme.scheme || DEFAULT_SIGNING_SCHEME;
- this.$options.signingSchemeOptions = _.omit(options.signingScheme, 'scheme');
- }
-
- if (!schemes.isSignature(this.$options.signingScheme)) {
- throw Error('Unsupported signing scheme');
- }
-
- if (this.$options.signingSchemeOptions.hash &&
- SUPPORTED_HASH_ALGORITHMS[this.$options.environment].indexOf(this.$options.signingSchemeOptions.hash) === -1) {
- throw Error('Unsupported hashing algorithm for ' + this.$options.environment + ' environment');
- }
- }
-
- if (options.encryptionScheme) {
- if (_.isString(options.encryptionScheme)) {
- this.$options.encryptionScheme = options.encryptionScheme.toLowerCase();
- this.$options.encryptionSchemeOptions = {};
- } else if (_.isObject(options.encryptionScheme)) {
- this.$options.encryptionScheme = options.encryptionScheme.scheme || DEFAULT_ENCRYPTION_SCHEME;
- this.$options.encryptionSchemeOptions = _.omit(options.encryptionScheme, 'scheme');
- }
-
- if (!schemes.isEncryption(this.$options.encryptionScheme)) {
- throw Error('Unsupported encryption scheme');
- }
-
- if (this.$options.encryptionSchemeOptions.hash &&
- SUPPORTED_HASH_ALGORITHMS[this.$options.environment].indexOf(this.$options.encryptionSchemeOptions.hash) === -1) {
- throw Error('Unsupported hashing algorithm for ' + this.$options.environment + ' environment');
- }
- }
-
- this.keyPair.setOptions(this.$options);
- };
-
- /**
- * Generate private/public keys pair
- *
- * @param bits {int} length key in bits. Default 2048.
- * @param exp {int} public exponent. Default 65537.
- * @returns {NodeRSA}
- */
- NodeRSA.prototype.generateKeyPair = function (bits, exp) {
- bits = bits || 2048;
- exp = exp || 65537;
-
- if (bits % 8 !== 0) {
- throw Error('Key size must be a multiple of 8.');
- }
-
- this.keyPair.generate(bits, exp.toString(16));
- this.$cache = {};
- return this;
- };
-
- /**
- * Importing key
- * @param keyData {string|buffer|Object}
- * @param format {string}
- */
- NodeRSA.prototype.importKey = function (keyData, format) {
- if (!keyData) {
- throw Error("Empty key given");
- }
-
- if (format) {
- format = EXPORT_FORMAT_ALIASES[format] || format;
- }
-
- if (!formats.detectAndImport(this.keyPair, keyData, format) && format === undefined) {
- throw Error("Key format must be specified");
- }
-
- this.$cache = {};
-
- return this;
- };
-
- /**
- * Exporting key
- * @param [format] {string}
- */
- NodeRSA.prototype.exportKey = function (format) {
- format = format || DEFAULT_EXPORT_FORMAT;
- format = EXPORT_FORMAT_ALIASES[format] || format;
-
- if (!this.$cache[format]) {
- this.$cache[format] = formats.detectAndExport(this.keyPair, format);
- }
-
- return this.$cache[format];
- };
-
- /**
- * Check if key pair contains private key
- */
- NodeRSA.prototype.isPrivate = function () {
- return this.keyPair.isPrivate();
- };
-
- /**
- * Check if key pair contains public key
- * @param [strict] {boolean} - public key only, return false if have private exponent
- */
- NodeRSA.prototype.isPublic = function (strict) {
- return this.keyPair.isPublic(strict);
- };
-
- /**
- * Check if key pair doesn't contains any data
- */
- NodeRSA.prototype.isEmpty = function (strict) {
- return !(this.keyPair.n || this.keyPair.e || this.keyPair.d);
- };
-
- /**
- * Encrypting data method with public key
- *
- * @param buffer {string|number|object|array|Buffer} - data for encrypting. Object and array will convert to JSON string.
- * @param encoding {string} - optional. Encoding for output result, may be 'buffer', 'binary', 'hex' or 'base64'. Default 'buffer'.
- * @param source_encoding {string} - optional. Encoding for given string. Default utf8.
- * @returns {string|Buffer}
- */
- NodeRSA.prototype.encrypt = function (buffer, encoding, source_encoding) {
- return this.$$encryptKey(false, buffer, encoding, source_encoding);
- };
-
- /**
- * Decrypting data method with private key
- *
- * @param buffer {Buffer} - buffer for decrypting
- * @param encoding - encoding for result string, can also take 'json' or 'buffer' for the automatic conversion of this type
- * @returns {Buffer|object|string}
- */
- NodeRSA.prototype.decrypt = function (buffer, encoding) {
- return this.$$decryptKey(false, buffer, encoding);
- };
-
- /**
- * Encrypting data method with private key
- *
- * Parameters same as `encrypt` method
- */
- NodeRSA.prototype.encryptPrivate = function (buffer, encoding, source_encoding) {
- return this.$$encryptKey(true, buffer, encoding, source_encoding);
- };
-
- /**
- * Decrypting data method with public key
- *
- * Parameters same as `decrypt` method
- */
- NodeRSA.prototype.decryptPublic = function (buffer, encoding) {
- return this.$$decryptKey(true, buffer, encoding);
- };
-
- /**
- * Encrypting data method with custom key
- */
- NodeRSA.prototype.$$encryptKey = function (usePrivate, buffer, encoding, source_encoding) {
- try {
- var res = this.keyPair.encrypt(this.$getDataForEncrypt(buffer, source_encoding), usePrivate);
-
- if (encoding == 'buffer' || !encoding) {
- return res;
- } else {
- return res.toString(encoding);
- }
- } catch (e) {
- throw Error('Error during encryption. Original error: ' + e);
- }
- };
-
- /**
- * Decrypting data method with custom key
- */
- NodeRSA.prototype.$$decryptKey = function (usePublic, buffer, encoding) {
- try {
- buffer = _.isString(buffer) ? Buffer.from(buffer, 'base64') : buffer;
- var res = this.keyPair.decrypt(buffer, usePublic);
-
- if (res === null) {
- throw Error('Key decrypt method returns null.');
- }
-
- return this.$getDecryptedData(res, encoding);
- } catch (e) {
- throw Error('Error during decryption (probably incorrect key). Original error: ' + e);
- }
- };
-
- /**
- * Signing data
- *
- * @param buffer {string|number|object|array|Buffer} - data for signing. Object and array will convert to JSON string.
- * @param encoding {string} - optional. Encoding for output result, may be 'buffer', 'binary', 'hex' or 'base64'. Default 'buffer'.
- * @param source_encoding {string} - optional. Encoding for given string. Default utf8.
- * @returns {string|Buffer}
- */
- NodeRSA.prototype.sign = function (buffer, encoding, source_encoding) {
- if (!this.isPrivate()) {
- throw Error("This is not private key");
- }
-
- var res = this.keyPair.sign(this.$getDataForEncrypt(buffer, source_encoding));
-
- if (encoding && encoding != 'buffer') {
- res = res.toString(encoding);
- }
-
- return res;
- };
-
- /**
- * Verifying signed data
- *
- * @param buffer - signed data
- * @param signature
- * @param source_encoding {string} - optional. Encoding for given string. Default utf8.
- * @param signature_encoding - optional. Encoding of given signature. May be 'buffer', 'binary', 'hex' or 'base64'. Default 'buffer'.
- * @returns {*}
- */
- NodeRSA.prototype.verify = function (buffer, signature, source_encoding, signature_encoding) {
- if (!this.isPublic()) {
- throw Error("This is not public key");
- }
- signature_encoding = (!signature_encoding || signature_encoding == 'buffer' ? null : signature_encoding);
- return this.keyPair.verify(this.$getDataForEncrypt(buffer, source_encoding), signature, signature_encoding);
- };
-
- /**
- * Returns key size in bits
- * @returns {int}
- */
- NodeRSA.prototype.getKeySize = function () {
- return this.keyPair.keySize;
- };
-
- /**
- * Returns max message length in bytes (for 1 chunk) depending on current encryption scheme
- * @returns {int}
- */
- NodeRSA.prototype.getMaxMessageSize = function () {
- return this.keyPair.maxMessageLength;
- };
-
- /**
- * Preparing given data for encrypting/signing. Just make new/return Buffer object.
- *
- * @param buffer {string|number|object|array|Buffer} - data for encrypting. Object and array will convert to JSON string.
- * @param encoding {string} - optional. Encoding for given string. Default utf8.
- * @returns {Buffer}
- */
- NodeRSA.prototype.$getDataForEncrypt = function (buffer, encoding) {
- if (_.isString(buffer) || _.isNumber(buffer)) {
- return Buffer.from('' + buffer, encoding || 'utf8');
- } else if (Buffer.isBuffer(buffer)) {
- return buffer;
- } else if (_.isObject(buffer)) {
- return Buffer.from(JSON.stringify(buffer));
- } else {
- throw Error("Unexpected data type");
- }
- };
-
- /**
- *
- * @param buffer {Buffer} - decrypted data.
- * @param encoding - optional. Encoding for result output. May be 'buffer', 'json' or any of Node.js Buffer supported encoding.
- * @returns {*}
- */
- NodeRSA.prototype.$getDecryptedData = function (buffer, encoding) {
- encoding = encoding || 'buffer';
-
- if (encoding == 'buffer') {
- return buffer;
- } else if (encoding == 'json') {
- return JSON.parse(buffer.toString());
- } else {
- return buffer.toString(encoding);
- }
- };
-
- return NodeRSA;
-})();
diff --git a/node_modules/node-rsa/src/encryptEngines/io.js b/node_modules/node-rsa/src/encryptEngines/io.js
deleted file mode 100644
index 799ae1d..0000000
--- a/node_modules/node-rsa/src/encryptEngines/io.js
+++ /dev/null
@@ -1,72 +0,0 @@
-var crypto = require('crypto');
-var constants = require('constants');
-var schemes = require('../schemes/schemes.js');
-
-module.exports = function (keyPair, options) {
- var pkcs1Scheme = schemes.pkcs1.makeScheme(keyPair, options);
-
- return {
- encrypt: function (buffer, usePrivate) {
- var padding;
- if (usePrivate) {
- padding = constants.RSA_PKCS1_PADDING;
- if (options.encryptionSchemeOptions && options.encryptionSchemeOptions.padding) {
- padding = options.encryptionSchemeOptions.padding;
- }
- return crypto.privateEncrypt({
- key: options.rsaUtils.exportKey('private'),
- padding: padding
- }, buffer);
- } else {
- padding = constants.RSA_PKCS1_OAEP_PADDING;
- if (options.encryptionScheme === 'pkcs1') {
- padding = constants.RSA_PKCS1_PADDING;
- }
- if (options.encryptionSchemeOptions && options.encryptionSchemeOptions.padding) {
- padding = options.encryptionSchemeOptions.padding;
- }
-
- var data = buffer;
- if (padding === constants.RSA_NO_PADDING) {
- data = pkcs1Scheme.pkcs0pad(buffer);
- }
-
- return crypto.publicEncrypt({
- key: options.rsaUtils.exportKey('public'),
- padding: padding
- }, data);
- }
- },
-
- decrypt: function (buffer, usePublic) {
- var padding;
- if (usePublic) {
- padding = constants.RSA_PKCS1_PADDING;
- if (options.encryptionSchemeOptions && options.encryptionSchemeOptions.padding) {
- padding = options.encryptionSchemeOptions.padding;
- }
- return crypto.publicDecrypt({
- key: options.rsaUtils.exportKey('public'),
- padding: padding
- }, buffer);
- } else {
- padding = constants.RSA_PKCS1_OAEP_PADDING;
- if (options.encryptionScheme === 'pkcs1') {
- padding = constants.RSA_PKCS1_PADDING;
- }
- if (options.encryptionSchemeOptions && options.encryptionSchemeOptions.padding) {
- padding = options.encryptionSchemeOptions.padding;
- }
- var res = crypto.privateDecrypt({
- key: options.rsaUtils.exportKey('private'),
- padding: padding
- }, buffer);
-
- if (padding === constants.RSA_NO_PADDING) {
- return pkcs1Scheme.pkcs0unpad(res);
- }
- return res;
- }
- }
- };
-};
\ No newline at end of file
diff --git a/node_modules/node-rsa/src/encryptEngines/node12.js b/node_modules/node-rsa/src/encryptEngines/node12.js
deleted file mode 100644
index 86e5836..0000000
--- a/node_modules/node-rsa/src/encryptEngines/node12.js
+++ /dev/null
@@ -1,56 +0,0 @@
-var crypto = require('crypto');
-var constants = require('constants');
-var schemes = require('../schemes/schemes.js');
-
-module.exports = function (keyPair, options) {
- var jsEngine = require('./js.js')(keyPair, options);
- var pkcs1Scheme = schemes.pkcs1.makeScheme(keyPair, options);
-
- return {
- encrypt: function (buffer, usePrivate) {
- if (usePrivate) {
- return jsEngine.encrypt(buffer, usePrivate);
- }
- var padding = constants.RSA_PKCS1_OAEP_PADDING;
- if (options.encryptionScheme === 'pkcs1') {
- padding = constants.RSA_PKCS1_PADDING;
- }
- if (options.encryptionSchemeOptions && options.encryptionSchemeOptions.padding) {
- padding = options.encryptionSchemeOptions.padding;
- }
-
- var data = buffer;
- if (padding === constants.RSA_NO_PADDING) {
- data = pkcs1Scheme.pkcs0pad(buffer);
- }
-
- return crypto.publicEncrypt({
- key: options.rsaUtils.exportKey('public'),
- padding: padding
- }, data);
- },
-
- decrypt: function (buffer, usePublic) {
- if (usePublic) {
- return jsEngine.decrypt(buffer, usePublic);
- }
- var padding = constants.RSA_PKCS1_OAEP_PADDING;
- if (options.encryptionScheme === 'pkcs1') {
- padding = constants.RSA_PKCS1_PADDING;
- }
- if (options.encryptionSchemeOptions && options.encryptionSchemeOptions.padding) {
- padding = options.encryptionSchemeOptions.padding;
- }
-
- var res = crypto.privateDecrypt({
- key: options.rsaUtils.exportKey('private'),
- padding: padding
- }, buffer);
-
- if (padding === constants.RSA_NO_PADDING) {
- return pkcs1Scheme.pkcs0unpad(res);
- }
- return res;
- }
- };
-};
\ No newline at end of file
diff --git a/node_modules/node-rsa/src/formats/formats.js b/node_modules/node-rsa/src/formats/formats.js
deleted file mode 100644
index e1fc3fb..0000000
--- a/node_modules/node-rsa/src/formats/formats.js
+++ /dev/null
@@ -1,97 +0,0 @@
-var _ = require('../utils')._;
-
-function formatParse(format) {
- format = format.split('-');
- var keyType = 'private';
- var keyOpt = {type: 'default'};
-
- for (var i = 1; i < format.length; i++) {
- if (format[i]) {
- switch (format[i]) {
- case 'public':
- keyType = format[i];
- break;
- case 'private':
- keyType = format[i];
- break;
- case 'pem':
- keyOpt.type = format[i];
- break;
- case 'der':
- keyOpt.type = format[i];
- break;
- }
- }
- }
-
- return {scheme: format[0], keyType: keyType, keyOpt: keyOpt};
-}
-
-module.exports = {
- pkcs1: require('./pkcs1'),
- pkcs8: require('./pkcs8'),
- components: require('./components'),
- openssh: require('./openssh'),
-
- isPrivateExport: function (format) {
- return module.exports[format] && typeof module.exports[format].privateExport === 'function';
- },
-
- isPrivateImport: function (format) {
- return module.exports[format] && typeof module.exports[format].privateImport === 'function';
- },
-
- isPublicExport: function (format) {
- return module.exports[format] && typeof module.exports[format].publicExport === 'function';
- },
-
- isPublicImport: function (format) {
- return module.exports[format] && typeof module.exports[format].publicImport === 'function';
- },
-
- detectAndImport: function (key, data, format) {
- if (format === undefined) {
- for (var scheme in module.exports) {
- if (typeof module.exports[scheme].autoImport === 'function' && module.exports[scheme].autoImport(key, data)) {
- return true;
- }
- }
- } else if (format) {
- var fmt = formatParse(format);
-
- if (module.exports[fmt.scheme]) {
- if (fmt.keyType === 'private') {
- module.exports[fmt.scheme].privateImport(key, data, fmt.keyOpt);
- } else {
- module.exports[fmt.scheme].publicImport(key, data, fmt.keyOpt);
- }
- } else {
- throw Error('Unsupported key format');
- }
- }
-
- return false;
- },
-
- detectAndExport: function (key, format) {
- if (format) {
- var fmt = formatParse(format);
-
- if (module.exports[fmt.scheme]) {
- if (fmt.keyType === 'private') {
- if (!key.isPrivate()) {
- throw Error("This is not private key");
- }
- return module.exports[fmt.scheme].privateExport(key, fmt.keyOpt);
- } else {
- if (!key.isPublic()) {
- throw Error("This is not public key");
- }
- return module.exports[fmt.scheme].publicExport(key, fmt.keyOpt);
- }
- } else {
- throw Error('Unsupported key format');
- }
- }
- }
-};
\ No newline at end of file
diff --git a/node_modules/node-rsa/src/formats/openssh.js b/node_modules/node-rsa/src/formats/openssh.js
deleted file mode 100644
index 60aa146..0000000
--- a/node_modules/node-rsa/src/formats/openssh.js
+++ /dev/null
@@ -1,292 +0,0 @@
-var _ = require("../utils")._;
-var utils = require("../utils");
-var BigInteger = require("../libs/jsbn");
-
-const PRIVATE_OPENING_BOUNDARY = "-----BEGIN OPENSSH PRIVATE KEY-----";
-const PRIVATE_CLOSING_BOUNDARY = "-----END OPENSSH PRIVATE KEY-----";
-
-module.exports = {
- privateExport: function (key, options) {
- const nbuf = key.n.toBuffer();
-
- let ebuf = Buffer.alloc(4)
- ebuf.writeUInt32BE(key.e, 0);
- //Slice leading zeroes
- while (ebuf[0] === 0) ebuf = ebuf.slice(1);
-
- const dbuf = key.d.toBuffer();
- const coeffbuf = key.coeff.toBuffer();
- const pbuf = key.p.toBuffer();
- const qbuf = key.q.toBuffer();
- let commentbuf;
- if (typeof key.sshcomment !== "undefined") {
- commentbuf = Buffer.from(key.sshcomment);
- } else {
- commentbuf = Buffer.from([]);
- }
-
- const pubkeyLength =
- 11 + // 32bit length, 'ssh-rsa'
- 4 + ebuf.byteLength +
- 4 + nbuf.byteLength;
-
- const privateKeyLength =
- 8 + //64bit unused checksum
- 11 + // 32bit length, 'ssh-rsa'
- 4 + nbuf.byteLength +
- 4 + ebuf.byteLength +
- 4 + dbuf.byteLength +
- 4 + coeffbuf.byteLength +
- 4 + pbuf.byteLength +
- 4 + qbuf.byteLength +
- 4 + commentbuf.byteLength;
-
- let length =
- 15 + //openssh-key-v1,0x00,
- 16 + // 2*(32bit length, 'none')
- 4 + // 32bit length, empty string
- 4 + // 32bit number of keys
- 4 + // 32bit pubkey length
- pubkeyLength +
- 4 + //32bit private+checksum+comment+padding length
- privateKeyLength;
-
- const paddingLength = Math.ceil(privateKeyLength / 8) * 8 - privateKeyLength;
- length += paddingLength;
-
- const buf = Buffer.alloc(length);
- const writer = {buf: buf, off: 0};
- buf.write("openssh-key-v1", "utf8");
- buf.writeUInt8(0, 14);
- writer.off += 15;
-
- writeOpenSSHKeyString(writer, Buffer.from("none"));
- writeOpenSSHKeyString(writer, Buffer.from("none"));
- writeOpenSSHKeyString(writer, Buffer.from(""));
-
- writer.off = writer.buf.writeUInt32BE(1, writer.off);
- writer.off = writer.buf.writeUInt32BE(pubkeyLength, writer.off);
-
- writeOpenSSHKeyString(writer, Buffer.from("ssh-rsa"));
- writeOpenSSHKeyString(writer, ebuf);
- writeOpenSSHKeyString(writer, nbuf);
-
- writer.off = writer.buf.writeUInt32BE(
- length - 47 - pubkeyLength,
- writer.off
- );
- writer.off += 8;
-
- writeOpenSSHKeyString(writer, Buffer.from("ssh-rsa"));
- writeOpenSSHKeyString(writer, nbuf);
- writeOpenSSHKeyString(writer, ebuf);
- writeOpenSSHKeyString(writer, dbuf);
- writeOpenSSHKeyString(writer, coeffbuf);
- writeOpenSSHKeyString(writer, pbuf);
- writeOpenSSHKeyString(writer, qbuf);
- writeOpenSSHKeyString(writer, commentbuf);
-
- let pad = 0x01;
- while (writer.off < length) {
- writer.off = writer.buf.writeUInt8(pad++, writer.off);
- }
-
- if (options.type === "der") {
- return writer.buf
- } else {
- return PRIVATE_OPENING_BOUNDARY + "\n" + utils.linebrk(buf.toString("base64"), 70) + "\n" + PRIVATE_CLOSING_BOUNDARY + "\n";
- }
- },
-
- privateImport: function (key, data, options) {
- options = options || {};
- var buffer;
-
- if (options.type !== "der") {
- if (Buffer.isBuffer(data)) {
- data = data.toString("utf8");
- }
-
- if (_.isString(data)) {
- var pem = utils.trimSurroundingText(data, PRIVATE_OPENING_BOUNDARY, PRIVATE_CLOSING_BOUNDARY)
- .replace(/\s+|\n\r|\n|\r$/gm, "");
- buffer = Buffer.from(pem, "base64");
- } else {
- throw Error("Unsupported key format");
- }
- } else if (Buffer.isBuffer(data)) {
- buffer = data;
- } else {
- throw Error("Unsupported key format");
- }
-
- const reader = {buf: buffer, off: 0};
-
- if (buffer.slice(0, 14).toString("ascii") !== "openssh-key-v1")
- throw "Invalid file format.";
-
- reader.off += 15;
-
- //ciphername
- if (readOpenSSHKeyString(reader).toString("ascii") !== "none")
- throw Error("Unsupported key type");
- //kdfname
- if (readOpenSSHKeyString(reader).toString("ascii") !== "none")
- throw Error("Unsupported key type");
- //kdf
- if (readOpenSSHKeyString(reader).toString("ascii") !== "")
- throw Error("Unsupported key type");
- //keynum
- reader.off += 4;
-
- //sshpublength
- reader.off += 4;
-
- //keytype
- if (readOpenSSHKeyString(reader).toString("ascii") !== "ssh-rsa")
- throw Error("Unsupported key type");
- readOpenSSHKeyString(reader);
- readOpenSSHKeyString(reader);
-
- reader.off += 12;
- if (readOpenSSHKeyString(reader).toString("ascii") !== "ssh-rsa")
- throw Error("Unsupported key type");
-
- const n = readOpenSSHKeyString(reader);
- const e = readOpenSSHKeyString(reader);
- const d = readOpenSSHKeyString(reader);
- const coeff = readOpenSSHKeyString(reader);
- const p = readOpenSSHKeyString(reader);
- const q = readOpenSSHKeyString(reader);
-
- //Calculate missing values
- const dint = new BigInteger(d);
- const qint = new BigInteger(q);
- const pint = new BigInteger(p);
- const dp = dint.mod(pint.subtract(BigInteger.ONE));
- const dq = dint.mod(qint.subtract(BigInteger.ONE));
-
- key.setPrivate(
- n, // modulus
- e, // publicExponent
- d, // privateExponent
- p, // prime1
- q, // prime2
- dp.toBuffer(), // exponent1 -- d mod (p1)
- dq.toBuffer(), // exponent2 -- d mod (q-1)
- coeff // coefficient -- (inverse of q) mod p
- );
-
- key.sshcomment = readOpenSSHKeyString(reader).toString("ascii");
- },
-
- publicExport: function (key, options) {
- let ebuf = Buffer.alloc(4)
- ebuf.writeUInt32BE(key.e, 0);
- //Slice leading zeroes
- while (ebuf[0] === 0) ebuf = ebuf.slice(1);
- const nbuf = key.n.toBuffer();
- const buf = Buffer.alloc(
- ebuf.byteLength + 4 +
- nbuf.byteLength + 4 +
- "ssh-rsa".length + 4
- );
-
- const writer = {buf: buf, off: 0};
- writeOpenSSHKeyString(writer, Buffer.from("ssh-rsa"));
- writeOpenSSHKeyString(writer, ebuf);
- writeOpenSSHKeyString(writer, nbuf);
-
- let comment = key.sshcomment || "";
-
- if (options.type === "der") {
- return writer.buf
- } else {
- return "ssh-rsa " + buf.toString("base64") + " " + comment + "\n";
- }
- },
-
- publicImport: function (key, data, options) {
- options = options || {};
- var buffer;
-
- if (options.type !== "der") {
- if (Buffer.isBuffer(data)) {
- data = data.toString("utf8");
- }
-
- if (_.isString(data)) {
- if (data.substring(0, 8) !== "ssh-rsa ")
- throw Error("Unsupported key format");
- let pemEnd = data.indexOf(" ", 8);
-
- //Handle keys with no comment
- if (pemEnd === -1) {
- pemEnd = data.length;
- } else {
- key.sshcomment = data.substring(pemEnd + 1)
- .replace(/\s+|\n\r|\n|\r$/gm, "");
- }
-
- const pem = data.substring(8, pemEnd)
- .replace(/\s+|\n\r|\n|\r$/gm, "");
- buffer = Buffer.from(pem, "base64");
- } else {
- throw Error("Unsupported key format");
- }
- } else if (Buffer.isBuffer(data)) {
- buffer = data;
- } else {
- throw Error("Unsupported key format");
- }
-
- const reader = {buf: buffer, off: 0};
-
- const type = readOpenSSHKeyString(reader).toString("ascii");
-
- if (type !== "ssh-rsa")
- throw Error("Invalid key type: " + type);
-
- const e = readOpenSSHKeyString(reader);
- const n = readOpenSSHKeyString(reader);
-
- key.setPublic(
- n,
- e
- );
- },
-
- /**
- * Trying autodetect and import key
- * @param key
- * @param data
- */
- autoImport: function (key, data) {
- // [\S\s]* matches zero or more of any character
- if (/^[\S\s]*-----BEGIN OPENSSH PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END OPENSSH PRIVATE KEY-----[\S\s]*$/g.test(data)) {
- module.exports.privateImport(key, data);
- return true;
- }
-
- if (/^[\S\s]*ssh-rsa \s*(?=(([A-Za-z0-9+/=]+\s*)+))\1[\S\s]*$/g.test(data)) {
- module.exports.publicImport(key, data);
- return true;
- }
-
- return false;
- }
-};
-
-function readOpenSSHKeyString(reader) {
- const len = reader.buf.readInt32BE(reader.off);
- reader.off += 4;
- const res = reader.buf.slice(reader.off, reader.off + len);
- reader.off += len;
- return res;
-}
-
-function writeOpenSSHKeyString(writer, data) {
- writer.buf.writeInt32BE(data.byteLength, writer.off);
- writer.off += 4;
- writer.off += data.copy(writer.buf, writer.off);
-}
\ No newline at end of file
diff --git a/node_modules/node-rsa/src/formats/pkcs1.js b/node_modules/node-rsa/src/formats/pkcs1.js
deleted file mode 100644
index 5fba246..0000000
--- a/node_modules/node-rsa/src/formats/pkcs1.js
+++ /dev/null
@@ -1,148 +0,0 @@
-var ber = require('asn1').Ber;
-var _ = require('../utils')._;
-var utils = require('../utils');
-
-const PRIVATE_OPENING_BOUNDARY = '-----BEGIN RSA PRIVATE KEY-----';
-const PRIVATE_CLOSING_BOUNDARY = '-----END RSA PRIVATE KEY-----';
-
-const PUBLIC_OPENING_BOUNDARY = '-----BEGIN RSA PUBLIC KEY-----';
-const PUBLIC_CLOSING_BOUNDARY = '-----END RSA PUBLIC KEY-----';
-
-module.exports = {
- privateExport: function (key, options) {
- options = options || {};
-
- var n = key.n.toBuffer();
- var d = key.d.toBuffer();
- var p = key.p.toBuffer();
- var q = key.q.toBuffer();
- var dmp1 = key.dmp1.toBuffer();
- var dmq1 = key.dmq1.toBuffer();
- var coeff = key.coeff.toBuffer();
-
- var length = n.length + d.length + p.length + q.length + dmp1.length + dmq1.length + coeff.length + 512; // magic
- var writer = new ber.Writer({size: length});
-
- writer.startSequence();
- writer.writeInt(0);
- writer.writeBuffer(n, 2);
- writer.writeInt(key.e);
- writer.writeBuffer(d, 2);
- writer.writeBuffer(p, 2);
- writer.writeBuffer(q, 2);
- writer.writeBuffer(dmp1, 2);
- writer.writeBuffer(dmq1, 2);
- writer.writeBuffer(coeff, 2);
- writer.endSequence();
-
- if (options.type === 'der') {
- return writer.buffer;
- } else {
- return PRIVATE_OPENING_BOUNDARY + '\n' + utils.linebrk(writer.buffer.toString('base64'), 64) + '\n' + PRIVATE_CLOSING_BOUNDARY;
- }
- },
-
- privateImport: function (key, data, options) {
- options = options || {};
- var buffer;
-
- if (options.type !== 'der') {
- if (Buffer.isBuffer(data)) {
- data = data.toString('utf8');
- }
-
- if (_.isString(data)) {
- var pem = utils.trimSurroundingText(data, PRIVATE_OPENING_BOUNDARY, PRIVATE_CLOSING_BOUNDARY)
- .replace(/\s+|\n\r|\n|\r$/gm, '');
- buffer = Buffer.from(pem, 'base64');
- } else {
- throw Error('Unsupported key format');
- }
- } else if (Buffer.isBuffer(data)) {
- buffer = data;
- } else {
- throw Error('Unsupported key format');
- }
-
- var reader = new ber.Reader(buffer);
- reader.readSequence();
- reader.readString(2, true); // just zero
- key.setPrivate(
- reader.readString(2, true), // modulus
- reader.readString(2, true), // publicExponent
- reader.readString(2, true), // privateExponent
- reader.readString(2, true), // prime1
- reader.readString(2, true), // prime2
- reader.readString(2, true), // exponent1 -- d mod (p1)
- reader.readString(2, true), // exponent2 -- d mod (q-1)
- reader.readString(2, true) // coefficient -- (inverse of q) mod p
- );
- },
-
- publicExport: function (key, options) {
- options = options || {};
-
- var n = key.n.toBuffer();
- var length = n.length + 512; // magic
-
- var bodyWriter = new ber.Writer({size: length});
- bodyWriter.startSequence();
- bodyWriter.writeBuffer(n, 2);
- bodyWriter.writeInt(key.e);
- bodyWriter.endSequence();
-
- if (options.type === 'der') {
- return bodyWriter.buffer;
- } else {
- return PUBLIC_OPENING_BOUNDARY + '\n' + utils.linebrk(bodyWriter.buffer.toString('base64'), 64) + '\n' + PUBLIC_CLOSING_BOUNDARY;
- }
- },
-
- publicImport: function (key, data, options) {
- options = options || {};
- var buffer;
-
- if (options.type !== 'der') {
- if (Buffer.isBuffer(data)) {
- data = data.toString('utf8');
- }
-
- if (_.isString(data)) {
- var pem = utils.trimSurroundingText(data, PUBLIC_OPENING_BOUNDARY, PUBLIC_CLOSING_BOUNDARY)
- .replace(/\s+|\n\r|\n|\r$/gm, '');
- buffer = Buffer.from(pem, 'base64');
- }
- } else if (Buffer.isBuffer(data)) {
- buffer = data;
- } else {
- throw Error('Unsupported key format');
- }
-
- var body = new ber.Reader(buffer);
- body.readSequence();
- key.setPublic(
- body.readString(0x02, true), // modulus
- body.readString(0x02, true) // publicExponent
- );
- },
-
- /**
- * Trying autodetect and import key
- * @param key
- * @param data
- */
- autoImport: function (key, data) {
- // [\S\s]* matches zero or more of any character
- if (/^[\S\s]*-----BEGIN RSA PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PRIVATE KEY-----[\S\s]*$/g.test(data)) {
- module.exports.privateImport(key, data);
- return true;
- }
-
- if (/^[\S\s]*-----BEGIN RSA PUBLIC KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PUBLIC KEY-----[\S\s]*$/g.test(data)) {
- module.exports.publicImport(key, data);
- return true;
- }
-
- return false;
- }
-};
\ No newline at end of file
diff --git a/node_modules/node-rsa/src/formats/pkcs8.js b/node_modules/node-rsa/src/formats/pkcs8.js
deleted file mode 100644
index 3dd1a3c..0000000
--- a/node_modules/node-rsa/src/formats/pkcs8.js
+++ /dev/null
@@ -1,187 +0,0 @@
-var ber = require('asn1').Ber;
-var _ = require('../utils')._;
-var PUBLIC_RSA_OID = '1.2.840.113549.1.1.1';
-var utils = require('../utils');
-
-const PRIVATE_OPENING_BOUNDARY = '-----BEGIN PRIVATE KEY-----';
-const PRIVATE_CLOSING_BOUNDARY = '-----END PRIVATE KEY-----';
-
-const PUBLIC_OPENING_BOUNDARY = '-----BEGIN PUBLIC KEY-----';
-const PUBLIC_CLOSING_BOUNDARY = '-----END PUBLIC KEY-----';
-
-module.exports = {
- privateExport: function (key, options) {
- options = options || {};
-
- var n = key.n.toBuffer();
- var d = key.d.toBuffer();
- var p = key.p.toBuffer();
- var q = key.q.toBuffer();
- var dmp1 = key.dmp1.toBuffer();
- var dmq1 = key.dmq1.toBuffer();
- var coeff = key.coeff.toBuffer();
-
- var length = n.length + d.length + p.length + q.length + dmp1.length + dmq1.length + coeff.length + 512; // magic
- var bodyWriter = new ber.Writer({size: length});
-
- bodyWriter.startSequence();
- bodyWriter.writeInt(0);
- bodyWriter.writeBuffer(n, 2);
- bodyWriter.writeInt(key.e);
- bodyWriter.writeBuffer(d, 2);
- bodyWriter.writeBuffer(p, 2);
- bodyWriter.writeBuffer(q, 2);
- bodyWriter.writeBuffer(dmp1, 2);
- bodyWriter.writeBuffer(dmq1, 2);
- bodyWriter.writeBuffer(coeff, 2);
- bodyWriter.endSequence();
-
- var writer = new ber.Writer({size: length});
- writer.startSequence();
- writer.writeInt(0);
- writer.startSequence();
- writer.writeOID(PUBLIC_RSA_OID);
- writer.writeNull();
- writer.endSequence();
- writer.writeBuffer(bodyWriter.buffer, 4);
- writer.endSequence();
-
- if (options.type === 'der') {
- return writer.buffer;
- } else {
- return PRIVATE_OPENING_BOUNDARY + '\n' + utils.linebrk(writer.buffer.toString('base64'), 64) + '\n' + PRIVATE_CLOSING_BOUNDARY;
- }
- },
-
- privateImport: function (key, data, options) {
- options = options || {};
- var buffer;
-
- if (options.type !== 'der') {
- if (Buffer.isBuffer(data)) {
- data = data.toString('utf8');
- }
-
- if (_.isString(data)) {
- var pem = utils.trimSurroundingText(data, PRIVATE_OPENING_BOUNDARY, PRIVATE_CLOSING_BOUNDARY)
- .replace('-----END PRIVATE KEY-----', '')
- .replace(/\s+|\n\r|\n|\r$/gm, '');
- buffer = Buffer.from(pem, 'base64');
- } else {
- throw Error('Unsupported key format');
- }
- } else if (Buffer.isBuffer(data)) {
- buffer = data;
- } else {
- throw Error('Unsupported key format');
- }
-
- var reader = new ber.Reader(buffer);
- reader.readSequence();
- reader.readInt(0);
- var header = new ber.Reader(reader.readString(0x30, true));
-
- if (header.readOID(0x06, true) !== PUBLIC_RSA_OID) {
- throw Error('Invalid Public key format');
- }
-
- var body = new ber.Reader(reader.readString(0x04, true));
- body.readSequence();
- body.readString(2, true); // just zero
- key.setPrivate(
- body.readString(2, true), // modulus
- body.readString(2, true), // publicExponent
- body.readString(2, true), // privateExponent
- body.readString(2, true), // prime1
- body.readString(2, true), // prime2
- body.readString(2, true), // exponent1 -- d mod (p1)
- body.readString(2, true), // exponent2 -- d mod (q-1)
- body.readString(2, true) // coefficient -- (inverse of q) mod p
- );
- },
-
- publicExport: function (key, options) {
- options = options || {};
-
- var n = key.n.toBuffer();
- var length = n.length + 512; // magic
-
- var bodyWriter = new ber.Writer({size: length});
- bodyWriter.writeByte(0);
- bodyWriter.startSequence();
- bodyWriter.writeBuffer(n, 2);
- bodyWriter.writeInt(key.e);
- bodyWriter.endSequence();
-
- var writer = new ber.Writer({size: length});
- writer.startSequence();
- writer.startSequence();
- writer.writeOID(PUBLIC_RSA_OID);
- writer.writeNull();
- writer.endSequence();
- writer.writeBuffer(bodyWriter.buffer, 3);
- writer.endSequence();
-
- if (options.type === 'der') {
- return writer.buffer;
- } else {
- return PUBLIC_OPENING_BOUNDARY + '\n' + utils.linebrk(writer.buffer.toString('base64'), 64) + '\n' + PUBLIC_CLOSING_BOUNDARY;
- }
- },
-
- publicImport: function (key, data, options) {
- options = options || {};
- var buffer;
-
- if (options.type !== 'der') {
- if (Buffer.isBuffer(data)) {
- data = data.toString('utf8');
- }
-
- if (_.isString(data)) {
- var pem = utils.trimSurroundingText(data, PUBLIC_OPENING_BOUNDARY, PUBLIC_CLOSING_BOUNDARY)
- .replace(/\s+|\n\r|\n|\r$/gm, '');
- buffer = Buffer.from(pem, 'base64');
- }
- } else if (Buffer.isBuffer(data)) {
- buffer = data;
- } else {
- throw Error('Unsupported key format');
- }
-
- var reader = new ber.Reader(buffer);
- reader.readSequence();
- var header = new ber.Reader(reader.readString(0x30, true));
-
- if (header.readOID(0x06, true) !== PUBLIC_RSA_OID) {
- throw Error('Invalid Public key format');
- }
-
- var body = new ber.Reader(reader.readString(0x03, true));
- body.readByte();
- body.readSequence();
- key.setPublic(
- body.readString(0x02, true), // modulus
- body.readString(0x02, true) // publicExponent
- );
- },
-
- /**
- * Trying autodetect and import key
- * @param key
- * @param data
- */
- autoImport: function (key, data) {
- if (/^[\S\s]*-----BEGIN PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END PRIVATE KEY-----[\S\s]*$/g.test(data)) {
- module.exports.privateImport(key, data);
- return true;
- }
-
- if (/^[\S\s]*-----BEGIN PUBLIC KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END PUBLIC KEY-----[\S\s]*$/g.test(data)) {
- module.exports.publicImport(key, data);
- return true;
- }
-
- return false;
- }
-};
diff --git a/node_modules/node-rsa/src/libs/rsa.js b/node_modules/node-rsa/src/libs/rsa.js
deleted file mode 100644
index 158f745..0000000
--- a/node_modules/node-rsa/src/libs/rsa.js
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * RSA Encryption / Decryption with PKCS1 v2 Padding.
- *
- * Copyright (c) 2003-2005 Tom Wu
- * 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" AND WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
- *
- * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
- * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * In addition, the following condition applies:
- *
- * All redistributions must retain an intact copy of this copyright notice
- * and disclaimer.
- */
-
-/*
- * Node.js adaptation
- * long message support implementation
- * signing/verifying
- *
- * 2014 rzcoder
- */
-
-var _ = require('../utils')._;
-var crypt = require('crypto');
-var BigInteger = require('./jsbn.js');
-var utils = require('../utils.js');
-var schemes = require('../schemes/schemes.js');
-var encryptEngines = require('../encryptEngines/encryptEngines.js');
-
-exports.BigInteger = BigInteger;
-module.exports.Key = (function () {
- /**
- * RSA key constructor
- *
- * n - modulus
- * e - publicExponent
- * d - privateExponent
- * p - prime1
- * q - prime2
- * dmp1 - exponent1 -- d mod (p1)
- * dmq1 - exponent2 -- d mod (q-1)
- * coeff - coefficient -- (inverse of q) mod p
- */
- function RSAKey() {
- this.n = null;
- this.e = 0;
- this.d = null;
- this.p = null;
- this.q = null;
- this.dmp1 = null;
- this.dmq1 = null;
- this.coeff = null;
- }
-
- RSAKey.prototype.setOptions = function (options) {
- var signingSchemeProvider = schemes[options.signingScheme];
- var encryptionSchemeProvider = schemes[options.encryptionScheme];
-
- if (signingSchemeProvider === encryptionSchemeProvider) {
- this.signingScheme = this.encryptionScheme = encryptionSchemeProvider.makeScheme(this, options);
- } else {
- this.encryptionScheme = encryptionSchemeProvider.makeScheme(this, options);
- this.signingScheme = signingSchemeProvider.makeScheme(this, options);
- }
-
- this.encryptEngine = encryptEngines.getEngine(this, options);
- };
-
- /**
- * Generate a new random private key B bits long, using public expt E
- * @param B
- * @param E
- */
- RSAKey.prototype.generate = function (B, E) {
- var qs = B >> 1;
- this.e = parseInt(E, 16);
- var ee = new BigInteger(E, 16);
- while (true) {
- while (true) {
- this.p = new BigInteger(B - qs, 1);
- if (this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) === 0 && this.p.isProbablePrime(10))
- break;
- }
- while (true) {
- this.q = new BigInteger(qs, 1);
- if (this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) === 0 && this.q.isProbablePrime(10))
- break;
- }
- if (this.p.compareTo(this.q) <= 0) {
- var t = this.p;
- this.p = this.q;
- this.q = t;
- }
- var p1 = this.p.subtract(BigInteger.ONE);
- var q1 = this.q.subtract(BigInteger.ONE);
- var phi = p1.multiply(q1);
- if (phi.gcd(ee).compareTo(BigInteger.ONE) === 0) {
- this.n = this.p.multiply(this.q);
- if (this.n.bitLength() < B) {
- continue;
- }
- this.d = ee.modInverse(phi);
- this.dmp1 = this.d.mod(p1);
- this.dmq1 = this.d.mod(q1);
- this.coeff = this.q.modInverse(this.p);
- break;
- }
- }
- this.$$recalculateCache();
- };
-
- /**
- * Set the private key fields N, e, d and CRT params from buffers
- *
- * @param N
- * @param E
- * @param D
- * @param P
- * @param Q
- * @param DP
- * @param DQ
- * @param C
- */
- RSAKey.prototype.setPrivate = function (N, E, D, P, Q, DP, DQ, C) {
- if (N && E && D && N.length > 0 && (_.isNumber(E) || E.length > 0) && D.length > 0) {
- this.n = new BigInteger(N);
- this.e = _.isNumber(E) ? E : utils.get32IntFromBuffer(E, 0);
- this.d = new BigInteger(D);
-
- if (P && Q && DP && DQ && C) {
- this.p = new BigInteger(P);
- this.q = new BigInteger(Q);
- this.dmp1 = new BigInteger(DP);
- this.dmq1 = new BigInteger(DQ);
- this.coeff = new BigInteger(C);
- } else {
- // TODO: re-calculate any missing CRT params
- }
- this.$$recalculateCache();
- } else {
- throw Error("Invalid RSA private key");
- }
- };
-
- /**
- * Set the public key fields N and e from hex strings
- * @param N
- * @param E
- */
- RSAKey.prototype.setPublic = function (N, E) {
- if (N && E && N.length > 0 && (_.isNumber(E) || E.length > 0)) {
- this.n = new BigInteger(N);
- this.e = _.isNumber(E) ? E : utils.get32IntFromBuffer(E, 0);
- this.$$recalculateCache();
- } else {
- throw Error("Invalid RSA public key");
- }
- };
-
- /**
- * private
- * Perform raw private operation on "x": return x^d (mod n)
- *
- * @param x
- * @returns {*}
- */
- RSAKey.prototype.$doPrivate = function (x) {
- if (this.p || this.q) {
- return x.modPow(this.d, this.n);
- }
-
- // TODO: re-calculate any missing CRT params
- var xp = x.mod(this.p).modPow(this.dmp1, this.p);
- var xq = x.mod(this.q).modPow(this.dmq1, this.q);
-
- while (xp.compareTo(xq) < 0) {
- xp = xp.add(this.p);
- }
- return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq);
- };
-
- /**
- * private
- * Perform raw public operation on "x": return x^e (mod n)
- *
- * @param x
- * @returns {*}
- */
- RSAKey.prototype.$doPublic = function (x) {
- return x.modPowInt(this.e, this.n);
- };
-
- /**
- * Return the PKCS#1 RSA encryption of buffer
- * @param buffer {Buffer}
- * @returns {Buffer}
- */
- RSAKey.prototype.encrypt = function (buffer, usePrivate) {
- var buffers = [];
- var results = [];
- var bufferSize = buffer.length;
- var buffersCount = Math.ceil(bufferSize / this.maxMessageLength) || 1; // total buffers count for encrypt
- var dividedSize = Math.ceil(bufferSize / buffersCount || 1); // each buffer size
-
- if (buffersCount == 1) {
- buffers.push(buffer);
- } else {
- for (var bufNum = 0; bufNum < buffersCount; bufNum++) {
- buffers.push(buffer.slice(bufNum * dividedSize, (bufNum + 1) * dividedSize));
- }
- }
-
- for (var i = 0; i < buffers.length; i++) {
- results.push(this.encryptEngine.encrypt(buffers[i], usePrivate));
- }
-
- return Buffer.concat(results);
- };
-
- /**
- * Return the PKCS#1 RSA decryption of buffer
- * @param buffer {Buffer}
- * @returns {Buffer}
- */
- RSAKey.prototype.decrypt = function (buffer, usePublic) {
- if (buffer.length % this.encryptedDataLength > 0) {
- throw Error('Incorrect data or key');
- }
-
- var result = [];
- var offset = 0;
- var length = 0;
- var buffersCount = buffer.length / this.encryptedDataLength;
-
- for (var i = 0; i < buffersCount; i++) {
- offset = i * this.encryptedDataLength;
- length = offset + this.encryptedDataLength;
- result.push(this.encryptEngine.decrypt(buffer.slice(offset, Math.min(length, buffer.length)), usePublic));
- }
-
- return Buffer.concat(result);
- };
-
- RSAKey.prototype.sign = function (buffer) {
- return this.signingScheme.sign.apply(this.signingScheme, arguments);
- };
-
- RSAKey.prototype.verify = function (buffer, signature, signature_encoding) {
- return this.signingScheme.verify.apply(this.signingScheme, arguments);
- };
-
- /**
- * Check if key pair contains private key
- */
- RSAKey.prototype.isPrivate = function () {
- return this.n && this.e && this.d && true || false;
- };
-
- /**
- * Check if key pair contains public key
- * @param strict {boolean} - public key only, return false if have private exponent
- */
- RSAKey.prototype.isPublic = function (strict) {
- return this.n && this.e && !(strict && this.d) || false;
- };
-
- Object.defineProperty(RSAKey.prototype, 'keySize', {
- get: function () {
- return this.cache.keyBitLength;
- }
- });
-
- Object.defineProperty(RSAKey.prototype, 'encryptedDataLength', {
- get: function () {
- return this.cache.keyByteLength;
- }
- });
-
- Object.defineProperty(RSAKey.prototype, 'maxMessageLength', {
- get: function () {
- return this.encryptionScheme.maxMessageLength();
- }
- });
-
- /**
- * Caching key data
- */
- RSAKey.prototype.$$recalculateCache = function () {
- this.cache = this.cache || {};
- // Bit & byte length
- this.cache.keyBitLength = this.n.bitLength();
- this.cache.keyByteLength = (this.cache.keyBitLength + 6) >> 3;
- };
-
- return RSAKey;
-})();
-
diff --git a/node_modules/node-rsa/src/schemes/oaep.js b/node_modules/node-rsa/src/schemes/oaep.js
deleted file mode 100644
index 30ef0c1..0000000
--- a/node_modules/node-rsa/src/schemes/oaep.js
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- * PKCS_OAEP signature scheme
- */
-
-var BigInteger = require('../libs/jsbn');
-var crypt = require('crypto');
-
-module.exports = {
- isEncryption: true,
- isSignature: false
-};
-
-module.exports.digestLength = {
- md4: 16,
- md5: 16,
- ripemd160: 20,
- rmd160: 20,
- sha1: 20,
- sha224: 28,
- sha256: 32,
- sha384: 48,
- sha512: 64
-};
-
-var DEFAULT_HASH_FUNCTION = 'sha1';
-
-/*
- * OAEP Mask Generation Function 1
- * Generates a buffer full of pseudorandom bytes given seed and maskLength.
- * Giving the same seed, maskLength, and hashFunction will result in the same exact byte values in the buffer.
- *
- * https://tools.ietf.org/html/rfc3447#appendix-B.2.1
- *
- * Parameters:
- * seed [Buffer] The pseudo random seed for this function
- * maskLength [int] The length of the output
- * hashFunction [String] The hashing function to use. Will accept any valid crypto hash. Default "sha1"
- * Supports "sha1" and "sha256".
- * To add another algorythm the algorythem must be accepted by crypto.createHash, and then the length of the output of the hash function (the digest) must be added to the digestLength object below.
- * Most RSA implementations will be expecting sha1
- */
-module.exports.eme_oaep_mgf1 = function (seed, maskLength, hashFunction) {
- hashFunction = hashFunction || DEFAULT_HASH_FUNCTION;
- var hLen = module.exports.digestLength[hashFunction];
- var count = Math.ceil(maskLength / hLen);
- var T = Buffer.alloc(hLen * count);
- var c = Buffer.alloc(4);
- for (var i = 0; i < count; ++i) {
- var hash = crypt.createHash(hashFunction);
- hash.update(seed);
- c.writeUInt32BE(i, 0);
- hash.update(c);
- hash.digest().copy(T, i * hLen);
- }
- return T.slice(0, maskLength);
-};
-
-module.exports.makeScheme = function (key, options) {
- function Scheme(key, options) {
- this.key = key;
- this.options = options;
- }
-
- Scheme.prototype.maxMessageLength = function () {
- return this.key.encryptedDataLength - 2 * module.exports.digestLength[this.options.encryptionSchemeOptions.hash || DEFAULT_HASH_FUNCTION] - 2;
- };
-
- /**
- * Pad input
- * alg: PKCS1_OAEP
- *
- * https://tools.ietf.org/html/rfc3447#section-7.1.1
- */
- Scheme.prototype.encPad = function (buffer) {
- var hash = this.options.encryptionSchemeOptions.hash || DEFAULT_HASH_FUNCTION;
- var mgf = this.options.encryptionSchemeOptions.mgf || module.exports.eme_oaep_mgf1;
- var label = this.options.encryptionSchemeOptions.label || Buffer.alloc(0);
- var emLen = this.key.encryptedDataLength;
-
- var hLen = module.exports.digestLength[hash];
-
- // Make sure we can put message into an encoded message of emLen bytes
- if (buffer.length > emLen - 2 * hLen - 2) {
- throw new Error("Message is too long to encode into an encoded message with a length of " + emLen + " bytes, increase" +
- "emLen to fix this error (minimum value for given parameters and options: " + (emLen - 2 * hLen - 2) + ")");
- }
-
- var lHash = crypt.createHash(hash);
- lHash.update(label);
- lHash = lHash.digest();
-
- var PS = Buffer.alloc(emLen - buffer.length - 2 * hLen - 1); // Padding "String"
- PS.fill(0); // Fill the buffer with octets of 0
- PS[PS.length - 1] = 1;
-
- var DB = Buffer.concat([lHash, PS, buffer]);
- var seed = crypt.randomBytes(hLen);
-
- // mask = dbMask
- var mask = mgf(seed, DB.length, hash);
- // XOR DB and dbMask together.
- for (var i = 0; i < DB.length; i++) {
- DB[i] ^= mask[i];
- }
- // DB = maskedDB
-
- // mask = seedMask
- mask = mgf(DB, hLen, hash);
- // XOR seed and seedMask together.
- for (i = 0; i < seed.length; i++) {
- seed[i] ^= mask[i];
- }
- // seed = maskedSeed
-
- var em = Buffer.alloc(1 + seed.length + DB.length);
- em[0] = 0;
- seed.copy(em, 1);
- DB.copy(em, 1 + seed.length);
-
- return em;
- };
-
- /**
- * Unpad input
- * alg: PKCS1_OAEP
- *
- * Note: This method works within the buffer given and modifies the values. It also returns a slice of the EM as the return Message.
- * If the implementation requires that the EM parameter be unmodified then the implementation should pass in a clone of the EM buffer.
- *
- * https://tools.ietf.org/html/rfc3447#section-7.1.2
- */
- Scheme.prototype.encUnPad = function (buffer) {
- var hash = this.options.encryptionSchemeOptions.hash || DEFAULT_HASH_FUNCTION;
- var mgf = this.options.encryptionSchemeOptions.mgf || module.exports.eme_oaep_mgf1;
- var label = this.options.encryptionSchemeOptions.label || Buffer.alloc(0);
-
- var hLen = module.exports.digestLength[hash];
-
- // Check to see if buffer is a properly encoded OAEP message
- if (buffer.length < 2 * hLen + 2) {
- throw new Error("Error decoding message, the supplied message is not long enough to be a valid OAEP encoded message");
- }
-
- var seed = buffer.slice(1, hLen + 1); // seed = maskedSeed
- var DB = buffer.slice(1 + hLen); // DB = maskedDB
-
- var mask = mgf(DB, hLen, hash); // seedMask
- // XOR maskedSeed and seedMask together to get the original seed.
- for (var i = 0; i < seed.length; i++) {
- seed[i] ^= mask[i];
- }
-
- mask = mgf(seed, DB.length, hash); // dbMask
- // XOR DB and dbMask together to get the original data block.
- for (i = 0; i < DB.length; i++) {
- DB[i] ^= mask[i];
- }
-
- var lHash = crypt.createHash(hash);
- lHash.update(label);
- lHash = lHash.digest();
-
- var lHashEM = DB.slice(0, hLen);
- if (lHashEM.toString("hex") != lHash.toString("hex")) {
- throw new Error("Error decoding message, the lHash calculated from the label provided and the lHash in the encrypted data do not match.");
- }
-
- // Filter out padding
- i = hLen;
- while (DB[i++] === 0 && i < DB.length);
- if (DB[i - 1] != 1) {
- throw new Error("Error decoding message, there is no padding message separator byte");
- }
-
- return DB.slice(i); // Message
- };
-
- return new Scheme(key, options);
-};
diff --git a/node_modules/node-rsa/src/schemes/pkcs1.js b/node_modules/node-rsa/src/schemes/pkcs1.js
deleted file mode 100644
index 86e55de..0000000
--- a/node_modules/node-rsa/src/schemes/pkcs1.js
+++ /dev/null
@@ -1,238 +0,0 @@
-/**
- * PKCS1 padding and signature scheme
- */
-
-var BigInteger = require('../libs/jsbn');
-var crypt = require('crypto');
-var constants = require('constants');
-var SIGN_INFO_HEAD = {
- md2: Buffer.from('3020300c06082a864886f70d020205000410', 'hex'),
- md5: Buffer.from('3020300c06082a864886f70d020505000410', 'hex'),
- sha1: Buffer.from('3021300906052b0e03021a05000414', 'hex'),
- sha224: Buffer.from('302d300d06096086480165030402040500041c', 'hex'),
- sha256: Buffer.from('3031300d060960864801650304020105000420', 'hex'),
- sha384: Buffer.from('3041300d060960864801650304020205000430', 'hex'),
- sha512: Buffer.from('3051300d060960864801650304020305000440', 'hex'),
- ripemd160: Buffer.from('3021300906052b2403020105000414', 'hex'),
- rmd160: Buffer.from('3021300906052b2403020105000414', 'hex')
-};
-
-var SIGN_ALG_TO_HASH_ALIASES = {
- 'ripemd160': 'rmd160'
-};
-
-var DEFAULT_HASH_FUNCTION = 'sha256';
-
-module.exports = {
- isEncryption: true,
- isSignature: true
-};
-
-module.exports.makeScheme = function (key, options) {
- function Scheme(key, options) {
- this.key = key;
- this.options = options;
- }
-
- Scheme.prototype.maxMessageLength = function () {
- if (this.options.encryptionSchemeOptions && this.options.encryptionSchemeOptions.padding == constants.RSA_NO_PADDING) {
- return this.key.encryptedDataLength;
- }
- return this.key.encryptedDataLength - 11;
- };
-
- /**
- * Pad input Buffer to encryptedDataLength bytes, and return Buffer.from
- * alg: PKCS#1
- * @param buffer
- * @returns {Buffer}
- */
- Scheme.prototype.encPad = function (buffer, options) {
- options = options || {};
- var filled;
- if (buffer.length > this.key.maxMessageLength) {
- throw new Error("Message too long for RSA (n=" + this.key.encryptedDataLength + ", l=" + buffer.length + ")");
- }
- if (this.options.encryptionSchemeOptions && this.options.encryptionSchemeOptions.padding == constants.RSA_NO_PADDING) {
- //RSA_NO_PADDING treated like JAVA left pad with zero character
- filled = Buffer.alloc(this.key.maxMessageLength - buffer.length);
- filled.fill(0);
- return Buffer.concat([filled, buffer]);
- }
-
- /* Type 1: zeros padding for private key encrypt */
- if (options.type === 1) {
- filled = Buffer.alloc(this.key.encryptedDataLength - buffer.length - 1);
- filled.fill(0xff, 0, filled.length - 1);
- filled[0] = 1;
- filled[filled.length - 1] = 0;
-
- return Buffer.concat([filled, buffer]);
- } else {
- /* random padding for public key encrypt */
- filled = Buffer.alloc(this.key.encryptedDataLength - buffer.length);
- filled[0] = 0;
- filled[1] = 2;
- var rand = crypt.randomBytes(filled.length - 3);
- for (var i = 0; i < rand.length; i++) {
- var r = rand[i];
- while (r === 0) { // non-zero only
- r = crypt.randomBytes(1)[0];
- }
- filled[i + 2] = r;
- }
- filled[filled.length - 1] = 0;
- return Buffer.concat([filled, buffer]);
- }
- };
-
- /**
- * Unpad input Buffer and, if valid, return the Buffer object
- * alg: PKCS#1 (type 2, random)
- * @param buffer
- * @returns {Buffer}
- */
- Scheme.prototype.encUnPad = function (buffer, options) {
- options = options || {};
- var i = 0;
-
- if (this.options.encryptionSchemeOptions && this.options.encryptionSchemeOptions.padding == constants.RSA_NO_PADDING) {
- //RSA_NO_PADDING treated like JAVA left pad with zero character
- var unPad;
- if (typeof buffer.lastIndexOf == "function") { //patch for old node version
- unPad = buffer.slice(buffer.lastIndexOf('\0') + 1, buffer.length);
- } else {
- unPad = buffer.slice(String.prototype.lastIndexOf.call(buffer, '\0') + 1, buffer.length);
- }
- return unPad;
- }
-
- if (buffer.length < 4) {
- return null;
- }
-
- /* Type 1: zeros padding for private key decrypt */
- if (options.type === 1) {
- if (buffer[0] !== 0 || buffer[1] !== 1) {
- return null;
- }
- i = 3;
- while (buffer[i] !== 0) {
- if (buffer[i] != 0xFF || ++i >= buffer.length) {
- return null;
- }
- }
- } else {
- /* random padding for public key decrypt */
- if (buffer[0] !== 0 || buffer[1] !== 2) {
- return null;
- }
- i = 3;
- while (buffer[i] !== 0) {
- if (++i >= buffer.length) {
- return null;
- }
- }
- }
- return buffer.slice(i + 1, buffer.length);
- };
-
- Scheme.prototype.sign = function (buffer) {
- var hashAlgorithm = this.options.signingSchemeOptions.hash || DEFAULT_HASH_FUNCTION;
- if (this.options.environment === 'browser') {
- hashAlgorithm = SIGN_ALG_TO_HASH_ALIASES[hashAlgorithm] || hashAlgorithm;
-
- var hasher = crypt.createHash(hashAlgorithm);
- hasher.update(buffer);
- var hash = this.pkcs1pad(hasher.digest(), hashAlgorithm);
- var res = this.key.$doPrivate(new BigInteger(hash)).toBuffer(this.key.encryptedDataLength);
-
- return res;
- } else {
- var signer = crypt.createSign('RSA-' + hashAlgorithm.toUpperCase());
- signer.update(buffer);
- return signer.sign(this.options.rsaUtils.exportKey('private'));
- }
- };
-
- Scheme.prototype.verify = function (buffer, signature, signature_encoding) {
- if (this.options.encryptionSchemeOptions && this.options.encryptionSchemeOptions.padding == constants.RSA_NO_PADDING) {
- //RSA_NO_PADDING has no verify data
- return false;
- }
- var hashAlgorithm = this.options.signingSchemeOptions.hash || DEFAULT_HASH_FUNCTION;
- if (this.options.environment === 'browser') {
- hashAlgorithm = SIGN_ALG_TO_HASH_ALIASES[hashAlgorithm] || hashAlgorithm;
-
- if (signature_encoding) {
- signature = Buffer.from(signature, signature_encoding);
- }
-
- var hasher = crypt.createHash(hashAlgorithm);
- hasher.update(buffer);
- var hash = this.pkcs1pad(hasher.digest(), hashAlgorithm);
- var m = this.key.$doPublic(new BigInteger(signature));
-
- return m.toBuffer().toString('hex') == hash.toString('hex');
- } else {
- var verifier = crypt.createVerify('RSA-' + hashAlgorithm.toUpperCase());
- verifier.update(buffer);
- return verifier.verify(this.options.rsaUtils.exportKey('public'), signature, signature_encoding);
- }
- };
-
- /**
- * PKCS#1 zero pad input buffer to max data length
- * @param hashBuf
- * @param hashAlgorithm
- * @returns {*}
- */
- Scheme.prototype.pkcs0pad = function (buffer) {
- var filled = Buffer.alloc(this.key.maxMessageLength - buffer.length);
- filled.fill(0);
- return Buffer.concat([filled, buffer]);
- };
-
- Scheme.prototype.pkcs0unpad = function (buffer) {
- var unPad;
- if (typeof buffer.lastIndexOf == "function") { //patch for old node version
- unPad = buffer.slice(buffer.lastIndexOf('\0') + 1, buffer.length);
- } else {
- unPad = buffer.slice(String.prototype.lastIndexOf.call(buffer, '\0') + 1, buffer.length);
- }
-
- return unPad;
- };
-
- /**
- * PKCS#1 pad input buffer to max data length
- * @param hashBuf
- * @param hashAlgorithm
- * @returns {*}
- */
- Scheme.prototype.pkcs1pad = function (hashBuf, hashAlgorithm) {
- var digest = SIGN_INFO_HEAD[hashAlgorithm];
- if (!digest) {
- throw Error('Unsupported hash algorithm');
- }
-
- var data = Buffer.concat([digest, hashBuf]);
-
- if (data.length + 10 > this.key.encryptedDataLength) {
- throw Error('Key is too short for signing algorithm (' + hashAlgorithm + ')');
- }
-
- var filled = Buffer.alloc(this.key.encryptedDataLength - data.length - 1);
- filled.fill(0xff, 0, filled.length - 1);
- filled[0] = 1;
- filled[filled.length - 1] = 0;
-
- var res = Buffer.concat([filled, data]);
-
- return res;
- };
-
- return new Scheme(key, options);
-};
-
-
diff --git a/node_modules/node-rsa/src/utils.js b/node_modules/node-rsa/src/utils.js
deleted file mode 100644
index eac573f..0000000
--- a/node_modules/node-rsa/src/utils.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Utils functions
- *
- */
-
-var crypt = require('crypto');
-
-/**
- * Break string str each maxLen symbols
- * @param str
- * @param maxLen
- * @returns {string}
- */
-module.exports.linebrk = function (str, maxLen) {
- var res = '';
- var i = 0;
- while (i + maxLen < str.length) {
- res += str.substring(i, i + maxLen) + "\n";
- i += maxLen;
- }
- return res + str.substring(i, str.length);
-};
-
-module.exports.detectEnvironment = function () {
- if (typeof(window) !== 'undefined' && window && !(process && process.title === 'node')) {
- return 'browser';
- }
-
- return 'node';
-};
-
-/**
- * Trying get a 32-bit unsigned integer from the partial buffer
- * @param buffer
- * @param offset
- * @returns {Number}
- */
-module.exports.get32IntFromBuffer = function (buffer, offset) {
- offset = offset || 0;
- var size = 0;
- if ((size = buffer.length - offset) > 0) {
- if (size >= 4) {
- return buffer.readUIntBE(offset, size);
- } else {
- var res = 0;
- for (var i = offset + size, d = 0; i > offset; i--, d += 2) {
- res += buffer[i - 1] * Math.pow(16, d);
- }
- return res;
- }
- } else {
- return NaN;
- }
-};
-
-module.exports._ = {
- isObject: function (value) {
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
- },
-
- isString: function (value) {
- return typeof value == 'string' || value instanceof String;
- },
-
- isNumber: function (value) {
- return typeof value == 'number' || !isNaN(parseFloat(value)) && isFinite(value);
- },
-
- /**
- * Returns copy of `obj` without `removeProp` field.
- * @param obj
- * @param removeProp
- * @returns Object
- */
- omit: function (obj, removeProp) {
- var newObj = {};
- for (var prop in obj) {
- if (!obj.hasOwnProperty(prop) || prop === removeProp) {
- continue;
- }
- newObj[prop] = obj[prop];
- }
-
- return newObj;
- }
-};
-
-/**
- * Strips everything around the opening and closing lines, including the lines
- * themselves.
- */
-module.exports.trimSurroundingText = function (data, opening, closing) {
- var trimStartIndex = 0;
- var trimEndIndex = data.length;
-
- var openingBoundaryIndex = data.indexOf(opening);
- if (openingBoundaryIndex >= 0) {
- trimStartIndex = openingBoundaryIndex + opening.length;
- }
-
- var closingBoundaryIndex = data.indexOf(closing, openingBoundaryIndex);
- if (closingBoundaryIndex >= 0) {
- trimEndIndex = closingBoundaryIndex;
- }
-
- return data.substring(trimStartIndex, trimEndIndex);
-}
\ No newline at end of file
diff --git a/node_modules/optionator/LICENSE b/node_modules/optionator/LICENSE
deleted file mode 100644
index 525b118..0000000
--- a/node_modules/optionator/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) George Zahariev
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/optionator/lib/help.js b/node_modules/optionator/lib/help.js
deleted file mode 100644
index 59e6f96..0000000
--- a/node_modules/optionator/lib/help.js
+++ /dev/null
@@ -1,260 +0,0 @@
-// Generated by LiveScript 1.6.0
-(function(){
- var ref$, id, find, sort, min, max, map, unlines, nameToRaw, dasherize, naturalJoin, wordWrap, wordwrap, getPreText, setHelpStyleDefaults, generateHelpForOption, generateHelp;
- ref$ = require('prelude-ls'), id = ref$.id, find = ref$.find, sort = ref$.sort, min = ref$.min, max = ref$.max, map = ref$.map, unlines = ref$.unlines;
- ref$ = require('./util'), nameToRaw = ref$.nameToRaw, dasherize = ref$.dasherize, naturalJoin = ref$.naturalJoin;
- wordWrap = require('word-wrap');
- wordwrap = function(a, b){
- var ref$, indent, width;
- ref$ = b === undefined
- ? ['', a - 1]
- : [repeatString$(' ', a), b - a - 1], indent = ref$[0], width = ref$[1];
- return function(text){
- return wordWrap(text, {
- indent: indent,
- width: width,
- trim: true
- });
- };
- };
- getPreText = function(option, arg$, maxWidth){
- var mainName, shortNames, ref$, longNames, type, description, aliasSeparator, typeSeparator, initialIndent, names, namesString, namesStringLen, typeSeparatorString, typeSeparatorStringLen, wrap;
- mainName = option.option, shortNames = (ref$ = option.shortNames) != null
- ? ref$
- : [], longNames = (ref$ = option.longNames) != null
- ? ref$
- : [], type = option.type, description = option.description;
- aliasSeparator = arg$.aliasSeparator, typeSeparator = arg$.typeSeparator, initialIndent = arg$.initialIndent;
- if (option.negateName) {
- mainName = "no-" + mainName;
- if (longNames) {
- longNames = map(function(it){
- return "no-" + it;
- }, longNames);
- }
- }
- names = mainName.length === 1
- ? [mainName].concat(shortNames, longNames)
- : shortNames.concat([mainName], longNames);
- namesString = map(nameToRaw, names).join(aliasSeparator);
- namesStringLen = namesString.length;
- typeSeparatorString = mainName === 'NUM' ? '::' : typeSeparator;
- typeSeparatorStringLen = typeSeparatorString.length;
- if (maxWidth != null && !option.boolean && initialIndent + namesStringLen + typeSeparatorStringLen + type.length > maxWidth) {
- wrap = wordwrap(initialIndent + namesStringLen + typeSeparatorStringLen, maxWidth);
- return namesString + "" + typeSeparatorString + wrap(type).replace(/^\s+/, '');
- } else {
- return namesString + "" + (option.boolean
- ? ''
- : typeSeparatorString + "" + type);
- }
- };
- setHelpStyleDefaults = function(helpStyle){
- helpStyle.aliasSeparator == null && (helpStyle.aliasSeparator = ', ');
- helpStyle.typeSeparator == null && (helpStyle.typeSeparator = ' ');
- helpStyle.descriptionSeparator == null && (helpStyle.descriptionSeparator = ' ');
- helpStyle.initialIndent == null && (helpStyle.initialIndent = 2);
- helpStyle.secondaryIndent == null && (helpStyle.secondaryIndent = 4);
- helpStyle.maxPadFactor == null && (helpStyle.maxPadFactor = 1.5);
- };
- generateHelpForOption = function(getOption, arg$){
- var stdout, helpStyle, ref$;
- stdout = arg$.stdout, helpStyle = (ref$ = arg$.helpStyle) != null
- ? ref$
- : {};
- setHelpStyleDefaults(helpStyle);
- return function(optionName){
- var maxWidth, wrap, option, e, pre, defaultString, restPositionalString, description, fullDescription, that, preDescription, descriptionString, exampleString, examples, seperator;
- maxWidth = stdout != null && stdout.isTTY ? stdout.columns - 1 : null;
- wrap = maxWidth ? wordwrap(maxWidth) : id;
- try {
- option = getOption(dasherize(optionName));
- } catch (e$) {
- e = e$;
- return e.message;
- }
- pre = getPreText(option, helpStyle);
- defaultString = option['default'] && !option.negateName ? "\ndefault: " + option['default'] : '';
- restPositionalString = option.restPositional ? 'Everything after this option is considered a positional argument, even if it looks like an option.' : '';
- description = option.longDescription || option.description && sentencize(option.description);
- fullDescription = description && restPositionalString
- ? description + " " + restPositionalString
- : (that = description || restPositionalString) ? that : '';
- preDescription = 'description:';
- descriptionString = !fullDescription
- ? ''
- : maxWidth && fullDescription.length - 1 - preDescription.length > maxWidth
- ? "\n" + preDescription + "\n" + wrap(fullDescription)
- : "\n" + preDescription + " " + fullDescription;
- exampleString = (that = option.example) ? (examples = [].concat(that), examples.length > 1
- ? "\nexamples:\n" + unlines(examples)
- : "\nexample: " + examples[0]) : '';
- seperator = defaultString || descriptionString || exampleString ? "\n" + repeatString$('=', pre.length) : '';
- return pre + "" + seperator + defaultString + descriptionString + exampleString;
- };
- };
- generateHelp = function(arg$){
- var options, prepend, append, helpStyle, ref$, stdout, aliasSeparator, typeSeparator, descriptionSeparator, maxPadFactor, initialIndent, secondaryIndent;
- options = arg$.options, prepend = arg$.prepend, append = arg$.append, helpStyle = (ref$ = arg$.helpStyle) != null
- ? ref$
- : {}, stdout = arg$.stdout;
- setHelpStyleDefaults(helpStyle);
- aliasSeparator = helpStyle.aliasSeparator, typeSeparator = helpStyle.typeSeparator, descriptionSeparator = helpStyle.descriptionSeparator, maxPadFactor = helpStyle.maxPadFactor, initialIndent = helpStyle.initialIndent, secondaryIndent = helpStyle.secondaryIndent;
- return function(arg$){
- var ref$, showHidden, interpolate, maxWidth, output, out, data, optionCount, totalPreLen, preLens, i$, len$, item, that, pre, descParts, desc, preLen, sortedPreLens, maxPreLen, preLenMean, x, padAmount, descSepLen, fullWrapCount, partialWrapCount, descLen, totalLen, initialSpace, wrapAllFull, i, wrap;
- ref$ = arg$ != null
- ? arg$
- : {}, showHidden = ref$.showHidden, interpolate = ref$.interpolate;
- maxWidth = stdout != null && stdout.isTTY ? stdout.columns - 1 : null;
- output = [];
- out = function(it){
- return output.push(it != null ? it : '');
- };
- if (prepend) {
- out(interpolate ? interp(prepend, interpolate) : prepend);
- out();
- }
- data = [];
- optionCount = 0;
- totalPreLen = 0;
- preLens = [];
- for (i$ = 0, len$ = (ref$ = options).length; i$ < len$; ++i$) {
- item = ref$[i$];
- if (showHidden || !item.hidden) {
- if (that = item.heading) {
- data.push({
- type: 'heading',
- value: that
- });
- } else {
- pre = getPreText(item, helpStyle, maxWidth);
- descParts = [];
- if ((that = item.description) != null) {
- descParts.push(that);
- }
- if (that = item['enum']) {
- descParts.push("either: " + naturalJoin(that));
- }
- if (item['default'] && !item.negateName) {
- descParts.push("default: " + item['default']);
- }
- desc = descParts.join(' - ');
- data.push({
- type: 'option',
- pre: pre,
- desc: desc,
- descLen: desc.length
- });
- preLen = pre.length;
- optionCount++;
- totalPreLen += preLen;
- preLens.push(preLen);
- }
- }
- }
- sortedPreLens = sort(preLens);
- maxPreLen = sortedPreLens[sortedPreLens.length - 1];
- preLenMean = initialIndent + totalPreLen / optionCount;
- x = optionCount > 2 ? min(preLenMean * maxPadFactor, maxPreLen) : maxPreLen;
- for (i$ = sortedPreLens.length - 1; i$ >= 0; --i$) {
- preLen = sortedPreLens[i$];
- if (preLen <= x) {
- padAmount = preLen;
- break;
- }
- }
- descSepLen = descriptionSeparator.length;
- if (maxWidth != null) {
- fullWrapCount = 0;
- partialWrapCount = 0;
- for (i$ = 0, len$ = data.length; i$ < len$; ++i$) {
- item = data[i$];
- if (item.type === 'option') {
- pre = item.pre, desc = item.desc, descLen = item.descLen;
- if (descLen === 0) {
- item.wrap = 'none';
- } else {
- preLen = max(padAmount, pre.length) + initialIndent + descSepLen;
- totalLen = preLen + descLen;
- if (totalLen > maxWidth) {
- if (descLen / 2.5 > maxWidth - preLen) {
- fullWrapCount++;
- item.wrap = 'full';
- } else {
- partialWrapCount++;
- item.wrap = 'partial';
- }
- } else {
- item.wrap = 'none';
- }
- }
- }
- }
- }
- initialSpace = repeatString$(' ', initialIndent);
- wrapAllFull = optionCount > 1 && fullWrapCount + partialWrapCount * 0.5 > optionCount * 0.5;
- for (i$ = 0, len$ = data.length; i$ < len$; ++i$) {
- i = i$;
- item = data[i$];
- if (item.type === 'heading') {
- if (i !== 0) {
- out();
- }
- out(item.value + ":");
- } else {
- pre = item.pre, desc = item.desc, descLen = item.descLen, wrap = item.wrap;
- if (maxWidth != null) {
- if (wrapAllFull || wrap === 'full') {
- wrap = wordwrap(initialIndent + secondaryIndent, maxWidth);
- out(initialSpace + "" + pre + "\n" + wrap(desc));
- continue;
- } else if (wrap === 'partial') {
- wrap = wordwrap(initialIndent + descSepLen + max(padAmount, pre.length), maxWidth);
- out(initialSpace + "" + pad(pre, padAmount) + descriptionSeparator + wrap(desc).replace(/^\s+/, ''));
- continue;
- }
- }
- if (descLen === 0) {
- out(initialSpace + "" + pre);
- } else {
- out(initialSpace + "" + pad(pre, padAmount) + descriptionSeparator + desc);
- }
- }
- }
- if (append) {
- out();
- out(interpolate ? interp(append, interpolate) : append);
- }
- return unlines(output);
- };
- };
- function pad(str, num){
- var len, padAmount;
- len = str.length;
- padAmount = num - len;
- return str + "" + repeatString$(' ', padAmount > 0 ? padAmount : 0);
- }
- function sentencize(str){
- var first, rest, period;
- first = str.charAt(0).toUpperCase();
- rest = str.slice(1);
- period = /[\.!\?]$/.test(str) ? '' : '.';
- return first + "" + rest + period;
- }
- function interp(string, object){
- return string.replace(/{{([a-zA-Z$_][a-zA-Z$_0-9]*)}}/g, function(arg$, key){
- var ref$;
- return (ref$ = object[key]) != null
- ? ref$
- : "{{" + key + "}}";
- });
- }
- module.exports = {
- generateHelp: generateHelp,
- generateHelpForOption: generateHelpForOption
- };
- function repeatString$(str, n){
- for (var r = ''; n > 0; (n >>= 1) && (str += str)) if (n & 1) r += str;
- return r;
- }
-}).call(this);
diff --git a/node_modules/optionator/lib/util.js b/node_modules/optionator/lib/util.js
deleted file mode 100644
index 5bc0cbb..0000000
--- a/node_modules/optionator/lib/util.js
+++ /dev/null
@@ -1,54 +0,0 @@
-// Generated by LiveScript 1.6.0
-(function(){
- var prelude, map, sortBy, fl, closestString, nameToRaw, dasherize, naturalJoin;
- prelude = require('prelude-ls'), map = prelude.map, sortBy = prelude.sortBy;
- fl = require('fast-levenshtein');
- closestString = function(possibilities, input){
- var distances, ref$, string, distance;
- if (!possibilities.length) {
- return;
- }
- distances = map(function(it){
- var ref$, longer, shorter;
- ref$ = input.length > it.length
- ? [input, it]
- : [it, input], longer = ref$[0], shorter = ref$[1];
- return {
- string: it,
- distance: fl.get(longer, shorter)
- };
- })(
- possibilities);
- ref$ = sortBy(function(it){
- return it.distance;
- }, distances)[0], string = ref$.string, distance = ref$.distance;
- return string;
- };
- nameToRaw = function(name){
- if (name.length === 1 || name === 'NUM') {
- return "-" + name;
- } else {
- return "--" + name;
- }
- };
- dasherize = function(string){
- if (/^[A-Z]/.test(string)) {
- return string;
- } else {
- return prelude.dasherize(string);
- }
- };
- naturalJoin = function(array){
- if (array.length < 3) {
- return array.join(' or ');
- } else {
- return array.slice(0, -1).join(', ') + ", or " + array[array.length - 1];
- }
- };
- module.exports = {
- closestString: closestString,
- nameToRaw: nameToRaw,
- dasherize: dasherize,
- naturalJoin: naturalJoin
- };
-}).call(this);
diff --git a/node_modules/prelude-ls/LICENSE b/node_modules/prelude-ls/LICENSE
deleted file mode 100644
index 525b118..0000000
--- a/node_modules/prelude-ls/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) George Zahariev
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/prelude-ls/README.md b/node_modules/prelude-ls/README.md
deleted file mode 100644
index fabc212..0000000
--- a/node_modules/prelude-ls/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# prelude.ls [](https://travis-ci.org/gkz/prelude-ls)
-
-is a functionally oriented utility library. It is powerful and flexible. Almost all of its functions are curried. It is written in, and is the recommended base library for, LiveScript.
-
-See **[the prelude.ls site](http://preludels.com)** for examples, a reference, and more.
-
-You can install via npm `npm install prelude-ls`
-
-### Development
-
-`make test` to test
-
-`make build` to build `lib` from `src`
-
-`make build-browser` to build browser versions
diff --git a/node_modules/prettier/LICENSE b/node_modules/prettier/LICENSE
deleted file mode 100644
index 5767e34..0000000
--- a/node_modules/prettier/LICENSE
+++ /dev/null
@@ -1,7 +0,0 @@
-Copyright © James Long 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.
diff --git a/node_modules/prettier/README.md b/node_modules/prettier/README.md
deleted file mode 100644
index 2297b58..0000000
--- a/node_modules/prettier/README.md
+++ /dev/null
@@ -1,104 +0,0 @@
-[](https://prettier.io)
-
-Opinionated Code Formatter
-
-
-
- JavaScript
- · TypeScript
- · Flow
- · JSX
- · JSON
-
-
-
- CSS
- · SCSS
- · Less
-
-
-
- HTML
- · Vue
- · Angular
-
-
-
- GraphQL
- · Markdown
- · YAML
-
-
-
-
- Your favorite language?
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## Intro
-
-Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
-
-### Input
-
-
-```js
-foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());
-```
-
-### Output
-
-```js
-foo(
- reallyLongArg(),
- omgSoManyParameters(),
- IShouldRefactorThis(),
- isThereSeriouslyAnotherOne(),
-);
-```
-
-Prettier can be run [in your editor](https://prettier.io/docs/editors) on-save, in a [pre-commit hook](https://prettier.io/docs/precommit), or in [CI environments](https://prettier.io/docs/cli#list-different) to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!
-
----
-
-**[Documentation](https://prettier.io/docs/)**
-
-[Install](https://prettier.io/docs/install) ·
-[Options](https://prettier.io/docs/options) ·
-[CLI](https://prettier.io/docs/cli) ·
-[API](https://prettier.io/docs/api)
-
-**[Playground](https://prettier.io/playground/)**
-
----
-
-## Badge
-
-Show the world you're using _Prettier_ → [](https://github.com/prettier/prettier)
-
-```md
-[](https://github.com/prettier/prettier)
-```
-
-## Contributing
-
-See [CONTRIBUTING.md](CONTRIBUTING.md).
diff --git a/node_modules/prettier/doc.d.ts b/node_modules/prettier/doc.d.ts
deleted file mode 100644
index 5011775..0000000
--- a/node_modules/prettier/doc.d.ts
+++ /dev/null
@@ -1,254 +0,0 @@
-// https://github.com/prettier/prettier/blob/next/src/document/public.js
-export namespace builders {
- type DocCommand =
- | Align
- | BreakParent
- | Cursor
- | Fill
- | Group
- | IfBreak
- | Indent
- | IndentIfBreak
- | Label
- | Line
- | LineSuffix
- | LineSuffixBoundary
- | Trim;
- type Doc = string | Doc[] | DocCommand;
-
- interface Align {
- type: "align";
- contents: Doc;
- n: number | string | { type: "root" };
- }
-
- interface BreakParent {
- type: "break-parent";
- }
-
- interface Cursor {
- type: "cursor";
- placeholder: symbol;
- }
-
- interface Fill {
- type: "fill";
- parts: Doc[];
- }
-
- interface Group {
- type: "group";
- id?: symbol;
- contents: Doc;
- break: boolean;
- expandedStates: Doc[];
- }
-
- interface HardlineWithoutBreakParent extends Line {
- hard: true;
- }
-
- interface IfBreak {
- type: "if-break";
- breakContents: Doc;
- flatContents: Doc;
- }
-
- interface Indent {
- type: "indent";
- contents: Doc;
- }
-
- interface IndentIfBreak {
- type: "indent-if-break";
- }
-
- interface Label {
- type: "label";
- label: any;
- contents: Doc;
- }
-
- interface Line {
- type: "line";
- soft?: boolean | undefined;
- hard?: boolean | undefined;
- literal?: boolean | undefined;
- }
-
- interface LineSuffix {
- type: "line-suffix";
- contents: Doc;
- }
-
- interface LineSuffixBoundary {
- type: "line-suffix-boundary";
- }
-
- interface LiterallineWithoutBreakParent extends Line {
- hard: true;
- literal: true;
- }
-
- type LiteralLine = [LiterallineWithoutBreakParent, BreakParent];
-
- interface Softline extends Line {
- soft: true;
- }
-
- type Hardline = [HardlineWithoutBreakParent, BreakParent];
-
- interface Trim {
- type: "trim";
- }
-
- interface GroupOptions {
- shouldBreak?: boolean | undefined;
- id?: symbol | undefined;
- }
-
- function addAlignmentToDoc(doc: Doc, size: number, tabWidth: number): Doc;
-
- /** @see [align](https://github.com/prettier/prettier/blob/main/commands.md#align) */
- function align(widthOrString: Align["n"], doc: Doc): Align;
-
- /** @see [breakParent](https://github.com/prettier/prettier/blob/main/commands.md#breakparent) */
- const breakParent: BreakParent;
-
- /** @see [conditionalGroup](https://github.com/prettier/prettier/blob/main/commands.md#conditionalgroup) */
- function conditionalGroup(alternatives: Doc[], options?: GroupOptions): Group;
-
- /** @see [dedent](https://github.com/prettier/prettier/blob/main/commands.md#dedent) */
- function dedent(doc: Doc): Align;
-
- /** @see [dedentToRoot](https://github.com/prettier/prettier/blob/main/commands.md#dedenttoroot) */
- function dedentToRoot(doc: Doc): Align;
-
- /** @see [fill](https://github.com/prettier/prettier/blob/main/commands.md#fill) */
- function fill(docs: Doc[]): Fill;
-
- /** @see [group](https://github.com/prettier/prettier/blob/main/commands.md#group) */
- function group(doc: Doc, opts?: GroupOptions): Group;
-
- /** @see [hardline](https://github.com/prettier/prettier/blob/main/commands.md#hardline) */
- const hardline: Hardline;
-
- /** @see [hardlineWithoutBreakParent](https://github.com/prettier/prettier/blob/main/commands.md#hardlinewithoutbreakparent-and-literallinewithoutbreakparent) */
- const hardlineWithoutBreakParent: HardlineWithoutBreakParent;
-
- /** @see [ifBreak](https://github.com/prettier/prettier/blob/main/commands.md#ifbreak) */
- function ifBreak(
- ifBreak: Doc,
- noBreak?: Doc,
- options?: { groupId?: symbol | undefined },
- ): IfBreak;
-
- /** @see [indent](https://github.com/prettier/prettier/blob/main/commands.md#indent) */
- function indent(doc: Doc): Indent;
-
- /** @see [indentIfBreak](https://github.com/prettier/prettier/blob/main/commands.md#indentifbreak) */
- function indentIfBreak(
- doc: Doc,
- opts: { groupId: symbol; negate?: boolean | undefined },
- ): IndentIfBreak;
-
- /** @see [join](https://github.com/prettier/prettier/blob/main/commands.md#join) */
- function join(sep: Doc, docs: Doc[]): Doc[];
-
- /** @see [label](https://github.com/prettier/prettier/blob/main/commands.md#label) */
- function label(label: any | undefined, contents: Doc): Doc;
-
- /** @see [line](https://github.com/prettier/prettier/blob/main/commands.md#line) */
- const line: Line;
-
- /** @see [lineSuffix](https://github.com/prettier/prettier/blob/main/commands.md#linesuffix) */
- function lineSuffix(suffix: Doc): LineSuffix;
-
- /** @see [lineSuffixBoundary](https://github.com/prettier/prettier/blob/main/commands.md#linesuffixboundary) */
- const lineSuffixBoundary: LineSuffixBoundary;
-
- /** @see [literalline](https://github.com/prettier/prettier/blob/main/commands.md#literalline) */
- const literalline: LiteralLine;
-
- /** @see [literallineWithoutBreakParent](https://github.com/prettier/prettier/blob/main/commands.md#hardlinewithoutbreakparent-and-literallinewithoutbreakparent) */
- const literallineWithoutBreakParent: LiterallineWithoutBreakParent;
-
- /** @see [markAsRoot](https://github.com/prettier/prettier/blob/main/commands.md#markasroot) */
- function markAsRoot(doc: Doc): Align;
-
- /** @see [softline](https://github.com/prettier/prettier/blob/main/commands.md#softline) */
- const softline: Softline;
-
- /** @see [trim](https://github.com/prettier/prettier/blob/main/commands.md#trim) */
- const trim: Trim;
-
- /** @see [cursor](https://github.com/prettier/prettier/blob/main/commands.md#cursor) */
- const cursor: Cursor;
-}
-
-export namespace printer {
- function printDocToString(
- doc: builders.Doc,
- options: Options,
- ): {
- formatted: string;
- /**
- * This property is a misnomer, and has been since the changes in
- * https://github.com/prettier/prettier/pull/15709.
- * The region of the document indicated by `cursorNodeStart` and `cursorNodeText` will
- * sometimes actually be what lies BETWEEN a pair of leaf nodes in the AST, rather than a node.
- */
- cursorNodeStart?: number | undefined;
-
- /**
- * Note that, like cursorNodeStart, this is a misnomer and may actually be the text between two
- * leaf nodes in the AST instead of the text of a node.
- */
- cursorNodeText?: string | undefined;
- };
- interface Options {
- /**
- * Specify the line length that the printer will wrap on.
- * @default 80
- */
- printWidth: number;
- /**
- * Specify the number of spaces per indentation-level.
- * @default 2
- */
- tabWidth: number;
- /**
- * Indent lines with tabs instead of spaces
- * @default false
- */
- useTabs?: boolean;
- parentParser?: string | undefined;
- __embeddedInHtml?: boolean | undefined;
- }
-}
-
-export namespace utils {
- function willBreak(doc: builders.Doc): boolean;
- function traverseDoc(
- doc: builders.Doc,
- onEnter?: (doc: builders.Doc) => void | boolean,
- onExit?: (doc: builders.Doc) => void,
- shouldTraverseConditionalGroups?: boolean,
- ): void;
- function findInDoc(
- doc: builders.Doc,
- callback: (doc: builders.Doc) => T,
- defaultValue: T,
- ): T;
- function mapDoc(
- doc: builders.Doc,
- callback: (doc: builders.Doc) => T,
- ): T;
- function removeLines(doc: builders.Doc): builders.Doc;
- function stripTrailingHardline(doc: builders.Doc): builders.Doc;
- function replaceEndOfLine(
- doc: builders.Doc,
- replacement?: builders.Doc,
- ): builders.Doc;
- function canBreak(doc: builders.Doc): boolean;
-}
diff --git a/node_modules/prettier/doc.js b/node_modules/prettier/doc.js
deleted file mode 100644
index e4c3772..0000000
--- a/node_modules/prettier/doc.js
+++ /dev/null
@@ -1,1270 +0,0 @@
-(function (factory) {
- function interopModuleDefault() {
- var module = factory();
- return module.default || module;
- }
-
- if (typeof exports === "object" && typeof module === "object") {
- module.exports = interopModuleDefault();
- } else if (typeof define === "function" && define.amd) {
- define(interopModuleDefault);
- } else {
- var root =
- typeof globalThis !== "undefined"
- ? globalThis
- : typeof global !== "undefined"
- ? global
- : typeof self !== "undefined"
- ? self
- : this || {};
- root.doc = interopModuleDefault();
- }
-})(function () {
- "use strict";
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __getOwnPropNames = Object.getOwnPropertyNames;
- var __hasOwnProp = Object.prototype.hasOwnProperty;
- var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
- };
- var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
- };
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
- // src/document/public.js
- var public_exports = {};
- __export(public_exports, {
- builders: () => builders,
- printer: () => printer,
- utils: () => utils
- });
-
- // src/document/constants.js
- var DOC_TYPE_STRING = "string";
- var DOC_TYPE_ARRAY = "array";
- var DOC_TYPE_CURSOR = "cursor";
- var DOC_TYPE_INDENT = "indent";
- var DOC_TYPE_ALIGN = "align";
- var DOC_TYPE_TRIM = "trim";
- var DOC_TYPE_GROUP = "group";
- var DOC_TYPE_FILL = "fill";
- var DOC_TYPE_IF_BREAK = "if-break";
- var DOC_TYPE_INDENT_IF_BREAK = "indent-if-break";
- var DOC_TYPE_LINE_SUFFIX = "line-suffix";
- var DOC_TYPE_LINE_SUFFIX_BOUNDARY = "line-suffix-boundary";
- var DOC_TYPE_LINE = "line";
- var DOC_TYPE_LABEL = "label";
- var DOC_TYPE_BREAK_PARENT = "break-parent";
- var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
- DOC_TYPE_CURSOR,
- DOC_TYPE_INDENT,
- DOC_TYPE_ALIGN,
- DOC_TYPE_TRIM,
- DOC_TYPE_GROUP,
- DOC_TYPE_FILL,
- DOC_TYPE_IF_BREAK,
- DOC_TYPE_INDENT_IF_BREAK,
- DOC_TYPE_LINE_SUFFIX,
- DOC_TYPE_LINE_SUFFIX_BOUNDARY,
- DOC_TYPE_LINE,
- DOC_TYPE_LABEL,
- DOC_TYPE_BREAK_PARENT
- ]);
-
- // scripts/build/shims/at.js
- var at = (isOptionalObject, object, index) => {
- if (isOptionalObject && (object === void 0 || object === null)) {
- return;
- }
- if (Array.isArray(object) || typeof object === "string") {
- return object[index < 0 ? object.length + index : index];
- }
- return object.at(index);
- };
- var at_default = at;
-
- // node_modules/trim-newlines/index.js
- function trimNewlinesEnd(string) {
- let end = string.length;
- while (end > 0 && (string[end - 1] === "\r" || string[end - 1] === "\n")) {
- end--;
- }
- return end < string.length ? string.slice(0, end) : string;
- }
-
- // src/document/utils/get-doc-type.js
- function getDocType(doc) {
- if (typeof doc === "string") {
- return DOC_TYPE_STRING;
- }
- if (Array.isArray(doc)) {
- return DOC_TYPE_ARRAY;
- }
- if (!doc) {
- return;
- }
- const { type } = doc;
- if (VALID_OBJECT_DOC_TYPES.has(type)) {
- return type;
- }
- }
- var get_doc_type_default = getDocType;
-
- // src/document/invalid-doc-error.js
- var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
- function getDocErrorMessage(doc) {
- const type = doc === null ? "null" : typeof doc;
- if (type !== "string" && type !== "object") {
- return `Unexpected doc '${type}',
-Expected it to be 'string' or 'object'.`;
- }
- if (get_doc_type_default(doc)) {
- throw new Error("doc is valid.");
- }
- const objectType = Object.prototype.toString.call(doc);
- if (objectType !== "[object Object]") {
- return `Unexpected doc '${objectType}'.`;
- }
- const EXPECTED_TYPE_VALUES = disjunctionListFormat(
- [...VALID_OBJECT_DOC_TYPES].map((type2) => `'${type2}'`)
- );
- return `Unexpected doc.type '${doc.type}'.
-Expected it to be ${EXPECTED_TYPE_VALUES}.`;
- }
- var InvalidDocError = class extends Error {
- name = "InvalidDocError";
- constructor(doc) {
- super(getDocErrorMessage(doc));
- this.doc = doc;
- }
- };
- var invalid_doc_error_default = InvalidDocError;
-
- // src/document/utils/traverse-doc.js
- var traverseDocOnExitStackMarker = {};
- function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
- const docsStack = [doc];
- while (docsStack.length > 0) {
- const doc2 = docsStack.pop();
- if (doc2 === traverseDocOnExitStackMarker) {
- onExit(docsStack.pop());
- continue;
- }
- if (onExit) {
- docsStack.push(doc2, traverseDocOnExitStackMarker);
- }
- const docType = get_doc_type_default(doc2);
- if (!docType) {
- throw new invalid_doc_error_default(doc2);
- }
- if ((onEnter == null ? void 0 : onEnter(doc2)) === false) {
- continue;
- }
- switch (docType) {
- case DOC_TYPE_ARRAY:
- case DOC_TYPE_FILL: {
- const parts = docType === DOC_TYPE_ARRAY ? doc2 : doc2.parts;
- for (let ic = parts.length, i = ic - 1; i >= 0; --i) {
- docsStack.push(parts[i]);
- }
- break;
- }
- case DOC_TYPE_IF_BREAK:
- docsStack.push(doc2.flatContents, doc2.breakContents);
- break;
- case DOC_TYPE_GROUP:
- if (shouldTraverseConditionalGroups && doc2.expandedStates) {
- for (let ic = doc2.expandedStates.length, i = ic - 1; i >= 0; --i) {
- docsStack.push(doc2.expandedStates[i]);
- }
- } else {
- docsStack.push(doc2.contents);
- }
- break;
- case DOC_TYPE_ALIGN:
- case DOC_TYPE_INDENT:
- case DOC_TYPE_INDENT_IF_BREAK:
- case DOC_TYPE_LABEL:
- case DOC_TYPE_LINE_SUFFIX:
- docsStack.push(doc2.contents);
- break;
- case DOC_TYPE_STRING:
- case DOC_TYPE_CURSOR:
- case DOC_TYPE_TRIM:
- case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
- case DOC_TYPE_LINE:
- case DOC_TYPE_BREAK_PARENT:
- break;
- default:
- throw new invalid_doc_error_default(doc2);
- }
- }
- }
- var traverse_doc_default = traverseDoc;
-
- // src/document/utils.js
- function mapDoc(doc, cb) {
- if (typeof doc === "string") {
- return cb(doc);
- }
- const mapped = /* @__PURE__ */ new Map();
- return rec(doc);
- function rec(doc2) {
- if (mapped.has(doc2)) {
- return mapped.get(doc2);
- }
- const result = process2(doc2);
- mapped.set(doc2, result);
- return result;
- }
- function process2(doc2) {
- switch (get_doc_type_default(doc2)) {
- case DOC_TYPE_ARRAY:
- return cb(doc2.map(rec));
- case DOC_TYPE_FILL:
- return cb({ ...doc2, parts: doc2.parts.map(rec) });
- case DOC_TYPE_IF_BREAK:
- return cb({
- ...doc2,
- breakContents: rec(doc2.breakContents),
- flatContents: rec(doc2.flatContents)
- });
- case DOC_TYPE_GROUP: {
- let { expandedStates, contents } = doc2;
- if (expandedStates) {
- expandedStates = expandedStates.map(rec);
- contents = expandedStates[0];
- } else {
- contents = rec(contents);
- }
- return cb({ ...doc2, contents, expandedStates });
- }
- case DOC_TYPE_ALIGN:
- case DOC_TYPE_INDENT:
- case DOC_TYPE_INDENT_IF_BREAK:
- case DOC_TYPE_LABEL:
- case DOC_TYPE_LINE_SUFFIX:
- return cb({ ...doc2, contents: rec(doc2.contents) });
- case DOC_TYPE_STRING:
- case DOC_TYPE_CURSOR:
- case DOC_TYPE_TRIM:
- case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
- case DOC_TYPE_LINE:
- case DOC_TYPE_BREAK_PARENT:
- return cb(doc2);
- default:
- throw new invalid_doc_error_default(doc2);
- }
- }
- }
- function findInDoc(doc, fn, defaultValue) {
- let result = defaultValue;
- let shouldSkipFurtherProcessing = false;
- function findInDocOnEnterFn(doc2) {
- if (shouldSkipFurtherProcessing) {
- return false;
- }
- const maybeResult = fn(doc2);
- if (maybeResult !== void 0) {
- shouldSkipFurtherProcessing = true;
- result = maybeResult;
- }
- }
- traverse_doc_default(doc, findInDocOnEnterFn);
- return result;
- }
- function willBreakFn(doc) {
- if (doc.type === DOC_TYPE_GROUP && doc.break) {
- return true;
- }
- if (doc.type === DOC_TYPE_LINE && doc.hard) {
- return true;
- }
- if (doc.type === DOC_TYPE_BREAK_PARENT) {
- return true;
- }
- }
- function willBreak(doc) {
- return findInDoc(doc, willBreakFn, false);
- }
- function breakParentGroup(groupStack) {
- if (groupStack.length > 0) {
- const parentGroup = at_default(
- /* isOptionalObject */
- false,
- groupStack,
- -1
- );
- if (!parentGroup.expandedStates && !parentGroup.break) {
- parentGroup.break = "propagated";
- }
- }
- return null;
- }
- function propagateBreaks(doc) {
- const alreadyVisitedSet = /* @__PURE__ */ new Set();
- const groupStack = [];
- function propagateBreaksOnEnterFn(doc2) {
- if (doc2.type === DOC_TYPE_BREAK_PARENT) {
- breakParentGroup(groupStack);
- }
- if (doc2.type === DOC_TYPE_GROUP) {
- groupStack.push(doc2);
- if (alreadyVisitedSet.has(doc2)) {
- return false;
- }
- alreadyVisitedSet.add(doc2);
- }
- }
- function propagateBreaksOnExitFn(doc2) {
- if (doc2.type === DOC_TYPE_GROUP) {
- const group2 = groupStack.pop();
- if (group2.break) {
- breakParentGroup(groupStack);
- }
- }
- }
- traverse_doc_default(
- doc,
- propagateBreaksOnEnterFn,
- propagateBreaksOnExitFn,
- /* shouldTraverseConditionalGroups */
- true
- );
- }
- function removeLinesFn(doc) {
- if (doc.type === DOC_TYPE_LINE && !doc.hard) {
- return doc.soft ? "" : " ";
- }
- if (doc.type === DOC_TYPE_IF_BREAK) {
- return doc.flatContents;
- }
- return doc;
- }
- function removeLines(doc) {
- return mapDoc(doc, removeLinesFn);
- }
- function stripTrailingHardlineFromParts(parts) {
- parts = [...parts];
- while (parts.length >= 2 && at_default(
- /* isOptionalObject */
- false,
- parts,
- -2
- ).type === DOC_TYPE_LINE && at_default(
- /* isOptionalObject */
- false,
- parts,
- -1
- ).type === DOC_TYPE_BREAK_PARENT) {
- parts.length -= 2;
- }
- if (parts.length > 0) {
- const lastPart = stripTrailingHardlineFromDoc(at_default(
- /* isOptionalObject */
- false,
- parts,
- -1
- ));
- parts[parts.length - 1] = lastPart;
- }
- return parts;
- }
- function stripTrailingHardlineFromDoc(doc) {
- switch (get_doc_type_default(doc)) {
- case DOC_TYPE_INDENT:
- case DOC_TYPE_INDENT_IF_BREAK:
- case DOC_TYPE_GROUP:
- case DOC_TYPE_LINE_SUFFIX:
- case DOC_TYPE_LABEL: {
- const contents = stripTrailingHardlineFromDoc(doc.contents);
- return { ...doc, contents };
- }
- case DOC_TYPE_IF_BREAK:
- return {
- ...doc,
- breakContents: stripTrailingHardlineFromDoc(doc.breakContents),
- flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
- };
- case DOC_TYPE_FILL:
- return { ...doc, parts: stripTrailingHardlineFromParts(doc.parts) };
- case DOC_TYPE_ARRAY:
- return stripTrailingHardlineFromParts(doc);
- case DOC_TYPE_STRING:
- return trimNewlinesEnd(doc);
- case DOC_TYPE_ALIGN:
- case DOC_TYPE_CURSOR:
- case DOC_TYPE_TRIM:
- case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
- case DOC_TYPE_LINE:
- case DOC_TYPE_BREAK_PARENT:
- break;
- default:
- throw new invalid_doc_error_default(doc);
- }
- return doc;
- }
- function stripTrailingHardline(doc) {
- return stripTrailingHardlineFromDoc(cleanDoc(doc));
- }
- function cleanDocFn(doc) {
- switch (get_doc_type_default(doc)) {
- case DOC_TYPE_FILL:
- if (doc.parts.every((part) => part === "")) {
- return "";
- }
- break;
- case DOC_TYPE_GROUP:
- if (!doc.contents && !doc.id && !doc.break && !doc.expandedStates) {
- return "";
- }
- if (doc.contents.type === DOC_TYPE_GROUP && doc.contents.id === doc.id && doc.contents.break === doc.break && doc.contents.expandedStates === doc.expandedStates) {
- return doc.contents;
- }
- break;
- case DOC_TYPE_ALIGN:
- case DOC_TYPE_INDENT:
- case DOC_TYPE_INDENT_IF_BREAK:
- case DOC_TYPE_LINE_SUFFIX:
- if (!doc.contents) {
- return "";
- }
- break;
- case DOC_TYPE_IF_BREAK:
- if (!doc.flatContents && !doc.breakContents) {
- return "";
- }
- break;
- case DOC_TYPE_ARRAY: {
- const parts = [];
- for (const part of doc) {
- if (!part) {
- continue;
- }
- const [currentPart, ...restParts] = Array.isArray(part) ? part : [part];
- if (typeof currentPart === "string" && typeof at_default(
- /* isOptionalObject */
- false,
- parts,
- -1
- ) === "string") {
- parts[parts.length - 1] += currentPart;
- } else {
- parts.push(currentPart);
- }
- parts.push(...restParts);
- }
- if (parts.length === 0) {
- return "";
- }
- if (parts.length === 1) {
- return parts[0];
- }
- return parts;
- }
- case DOC_TYPE_STRING:
- case DOC_TYPE_CURSOR:
- case DOC_TYPE_TRIM:
- case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
- case DOC_TYPE_LINE:
- case DOC_TYPE_LABEL:
- case DOC_TYPE_BREAK_PARENT:
- break;
- default:
- throw new invalid_doc_error_default(doc);
- }
- return doc;
- }
- function cleanDoc(doc) {
- return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
- }
- function replaceEndOfLine(doc, replacement = literalline) {
- return mapDoc(
- doc,
- (currentDoc) => typeof currentDoc === "string" ? join(replacement, currentDoc.split("\n")) : currentDoc
- );
- }
- function canBreakFn(doc) {
- if (doc.type === DOC_TYPE_LINE) {
- return true;
- }
- }
- function canBreak(doc) {
- return findInDoc(doc, canBreakFn, false);
- }
-
- // src/document/utils/assert-doc.js
- var noop = () => {
- };
- var assertDoc = true ? noop : function(doc) {
- traverse_doc_default(doc, (doc2) => {
- if (checked.has(doc2)) {
- return false;
- }
- if (typeof doc2 !== "string") {
- checked.add(doc2);
- }
- });
- };
- var assertDocArray = true ? noop : function(docs, optional = false) {
- if (optional && !docs) {
- return;
- }
- if (!Array.isArray(docs)) {
- throw new TypeError("Unexpected doc array.");
- }
- for (const doc of docs) {
- assertDoc(doc);
- }
- };
- var assertDocFillParts = true ? noop : (
- /**
- * @param {Doc[]} parts
- */
- function(parts) {
- assertDocArray(parts);
- if (parts.length > 1 && isEmptyDoc(at_default(
- /* isOptionalObject */
- false,
- parts,
- -1
- ))) {
- parts = parts.slice(0, -1);
- }
- for (const [i, doc] of parts.entries()) {
- if (i % 2 === 1 && !isValidSeparator(doc)) {
- const type = get_doc_type_default(doc);
- throw new Error(
- `Unexpected non-line-break doc at ${i}. Doc type is ${type}.`
- );
- }
- }
- }
- );
-
- // src/document/builders.js
- function indent(contents) {
- assertDoc(contents);
- return { type: DOC_TYPE_INDENT, contents };
- }
- function align(widthOrString, contents) {
- assertDoc(contents);
- return { type: DOC_TYPE_ALIGN, contents, n: widthOrString };
- }
- function group(contents, opts = {}) {
- assertDoc(contents);
- assertDocArray(
- opts.expandedStates,
- /* optional */
- true
- );
- return {
- type: DOC_TYPE_GROUP,
- id: opts.id,
- contents,
- break: Boolean(opts.shouldBreak),
- expandedStates: opts.expandedStates
- };
- }
- function dedentToRoot(contents) {
- return align(Number.NEGATIVE_INFINITY, contents);
- }
- function markAsRoot(contents) {
- return align({ type: "root" }, contents);
- }
- function dedent(contents) {
- return align(-1, contents);
- }
- function conditionalGroup(states, opts) {
- return group(states[0], { ...opts, expandedStates: states });
- }
- function fill(parts) {
- assertDocFillParts(parts);
- return { type: DOC_TYPE_FILL, parts };
- }
- function ifBreak(breakContents, flatContents = "", opts = {}) {
- assertDoc(breakContents);
- if (flatContents !== "") {
- assertDoc(flatContents);
- }
- return {
- type: DOC_TYPE_IF_BREAK,
- breakContents,
- flatContents,
- groupId: opts.groupId
- };
- }
- function indentIfBreak(contents, opts) {
- assertDoc(contents);
- return {
- type: DOC_TYPE_INDENT_IF_BREAK,
- contents,
- groupId: opts.groupId,
- negate: opts.negate
- };
- }
- function lineSuffix(contents) {
- assertDoc(contents);
- return { type: DOC_TYPE_LINE_SUFFIX, contents };
- }
- var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
- var breakParent = { type: DOC_TYPE_BREAK_PARENT };
- var trim = { type: DOC_TYPE_TRIM };
- var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
- var literallineWithoutBreakParent = {
- type: DOC_TYPE_LINE,
- hard: true,
- literal: true
- };
- var line = { type: DOC_TYPE_LINE };
- var softline = { type: DOC_TYPE_LINE, soft: true };
- var hardline = [hardlineWithoutBreakParent, breakParent];
- var literalline = [literallineWithoutBreakParent, breakParent];
- var cursor = { type: DOC_TYPE_CURSOR };
- function join(separator, docs) {
- assertDoc(separator);
- assertDocArray(docs);
- const parts = [];
- for (let i = 0; i < docs.length; i++) {
- if (i !== 0) {
- parts.push(separator);
- }
- parts.push(docs[i]);
- }
- return parts;
- }
- function addAlignmentToDoc(doc, size, tabWidth) {
- assertDoc(doc);
- let aligned = doc;
- if (size > 0) {
- for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
- aligned = indent(aligned);
- }
- aligned = align(size % tabWidth, aligned);
- aligned = align(Number.NEGATIVE_INFINITY, aligned);
- }
- return aligned;
- }
- function label(label2, contents) {
- assertDoc(contents);
- return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents;
- }
-
- // scripts/build/shims/string-replace-all.js
- var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => {
- if (isOptionalObject && (original === void 0 || original === null)) {
- return;
- }
- if (original.replaceAll) {
- return original.replaceAll(pattern, replacement);
- }
- if (pattern.global) {
- return original.replace(pattern, replacement);
- }
- return original.split(pattern).join(replacement);
- };
- var string_replace_all_default = stringReplaceAll;
-
- // src/common/end-of-line.js
- function convertEndOfLineToChars(value) {
- switch (value) {
- case "cr":
- return "\r";
- case "crlf":
- return "\r\n";
- default:
- return "\n";
- }
- }
-
- // node_modules/emoji-regex/index.mjs
- var emoji_regex_default = () => {
- return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
- };
-
- // node_modules/get-east-asian-width/lookup.js
- function isFullWidth(x) {
- return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
- }
- function isWide(x) {
- return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
- }
-
- // node_modules/get-east-asian-width/index.js
- var _isNarrowWidth = (codePoint) => !(isFullWidth(codePoint) || isWide(codePoint));
-
- // src/utils/get-string-width.js
- var notAsciiRegex = /[^\x20-\x7F]/u;
- function getStringWidth(text) {
- if (!text) {
- return 0;
- }
- if (!notAsciiRegex.test(text)) {
- return text.length;
- }
- text = text.replace(emoji_regex_default(), " ");
- let width = 0;
- for (const character of text) {
- const codePoint = character.codePointAt(0);
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
- continue;
- }
- if (codePoint >= 768 && codePoint <= 879) {
- continue;
- }
- width += _isNarrowWidth(codePoint) ? 1 : 2;
- }
- return width;
- }
- var get_string_width_default = getStringWidth;
-
- // src/document/printer.js
- var MODE_BREAK = Symbol("MODE_BREAK");
- var MODE_FLAT = Symbol("MODE_FLAT");
- var CURSOR_PLACEHOLDER = Symbol("cursor");
- var DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
- function rootIndent() {
- return { value: "", length: 0, queue: [] };
- }
- function makeIndent(ind, options) {
- return generateInd(ind, { type: "indent" }, options);
- }
- function makeAlign(indent2, widthOrDoc, options) {
- if (widthOrDoc === Number.NEGATIVE_INFINITY) {
- return indent2.root || rootIndent();
- }
- if (widthOrDoc < 0) {
- return generateInd(indent2, { type: "dedent" }, options);
- }
- if (!widthOrDoc) {
- return indent2;
- }
- if (widthOrDoc.type === "root") {
- return { ...indent2, root: indent2 };
- }
- const alignType = typeof widthOrDoc === "string" ? "stringAlign" : "numberAlign";
- return generateInd(indent2, { type: alignType, n: widthOrDoc }, options);
- }
- function generateInd(ind, newPart, options) {
- const queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : [...ind.queue, newPart];
- let value = "";
- let length = 0;
- let lastTabs = 0;
- let lastSpaces = 0;
- for (const part of queue) {
- switch (part.type) {
- case "indent":
- flush();
- if (options.useTabs) {
- addTabs(1);
- } else {
- addSpaces(options.tabWidth);
- }
- break;
- case "stringAlign":
- flush();
- value += part.n;
- length += part.n.length;
- break;
- case "numberAlign":
- lastTabs += 1;
- lastSpaces += part.n;
- break;
- default:
- throw new Error(`Unexpected type '${part.type}'`);
- }
- }
- flushSpaces();
- return { ...ind, value, length, queue };
- function addTabs(count) {
- value += " ".repeat(count);
- length += options.tabWidth * count;
- }
- function addSpaces(count) {
- value += " ".repeat(count);
- length += count;
- }
- function flush() {
- if (options.useTabs) {
- flushTabs();
- } else {
- flushSpaces();
- }
- }
- function flushTabs() {
- if (lastTabs > 0) {
- addTabs(lastTabs);
- }
- resetLast();
- }
- function flushSpaces() {
- if (lastSpaces > 0) {
- addSpaces(lastSpaces);
- }
- resetLast();
- }
- function resetLast() {
- lastTabs = 0;
- lastSpaces = 0;
- }
- }
- function trim2(out) {
- let trimCount = 0;
- let cursorCount = 0;
- let outIndex = out.length;
- outer: while (outIndex--) {
- const last = out[outIndex];
- if (last === CURSOR_PLACEHOLDER) {
- cursorCount++;
- continue;
- }
- if (false) {
- throw new Error(`Unexpected value in trim: '${typeof last}'`);
- }
- for (let charIndex = last.length - 1; charIndex >= 0; charIndex--) {
- const char = last[charIndex];
- if (char === " " || char === " ") {
- trimCount++;
- } else {
- out[outIndex] = last.slice(0, charIndex + 1);
- break outer;
- }
- }
- }
- if (trimCount > 0 || cursorCount > 0) {
- out.length = outIndex + 1;
- while (cursorCount-- > 0) {
- out.push(CURSOR_PLACEHOLDER);
- }
- }
- return trimCount;
- }
- function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat) {
- if (width === Number.POSITIVE_INFINITY) {
- return true;
- }
- let restIdx = restCommands.length;
- const cmds = [next];
- const out = [];
- while (width >= 0) {
- if (cmds.length === 0) {
- if (restIdx === 0) {
- return true;
- }
- cmds.push(restCommands[--restIdx]);
- continue;
- }
- const { mode, doc } = cmds.pop();
- const docType = get_doc_type_default(doc);
- switch (docType) {
- case DOC_TYPE_STRING:
- out.push(doc);
- width -= get_string_width_default(doc);
- break;
- case DOC_TYPE_ARRAY:
- case DOC_TYPE_FILL: {
- const parts = docType === DOC_TYPE_ARRAY ? doc : doc.parts;
- const end = doc[DOC_FILL_PRINTED_LENGTH] ?? 0;
- for (let i = parts.length - 1; i >= end; i--) {
- cmds.push({ mode, doc: parts[i] });
- }
- break;
- }
- case DOC_TYPE_INDENT:
- case DOC_TYPE_ALIGN:
- case DOC_TYPE_INDENT_IF_BREAK:
- case DOC_TYPE_LABEL:
- cmds.push({ mode, doc: doc.contents });
- break;
- case DOC_TYPE_TRIM:
- width += trim2(out);
- break;
- case DOC_TYPE_GROUP: {
- if (mustBeFlat && doc.break) {
- return false;
- }
- const groupMode = doc.break ? MODE_BREAK : mode;
- const contents = doc.expandedStates && groupMode === MODE_BREAK ? at_default(
- /* isOptionalObject */
- false,
- doc.expandedStates,
- -1
- ) : doc.contents;
- cmds.push({ mode: groupMode, doc: contents });
- break;
- }
- case DOC_TYPE_IF_BREAK: {
- const groupMode = doc.groupId ? groupModeMap[doc.groupId] || MODE_FLAT : mode;
- const contents = groupMode === MODE_BREAK ? doc.breakContents : doc.flatContents;
- if (contents) {
- cmds.push({ mode, doc: contents });
- }
- break;
- }
- case DOC_TYPE_LINE:
- if (mode === MODE_BREAK || doc.hard) {
- return true;
- }
- if (!doc.soft) {
- out.push(" ");
- width--;
- }
- break;
- case DOC_TYPE_LINE_SUFFIX:
- hasLineSuffix = true;
- break;
- case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
- if (hasLineSuffix) {
- return false;
- }
- break;
- }
- }
- return false;
- }
- function printDocToString(doc, options) {
- const groupModeMap = {};
- const width = options.printWidth;
- const newLine = convertEndOfLineToChars(options.endOfLine);
- let pos = 0;
- const cmds = [{ ind: rootIndent(), mode: MODE_BREAK, doc }];
- const out = [];
- let shouldRemeasure = false;
- const lineSuffix2 = [];
- let printedCursorCount = 0;
- propagateBreaks(doc);
- while (cmds.length > 0) {
- const { ind, mode, doc: doc2 } = cmds.pop();
- switch (get_doc_type_default(doc2)) {
- case DOC_TYPE_STRING: {
- const formatted = newLine !== "\n" ? string_replace_all_default(
- /* isOptionalObject */
- false,
- doc2,
- "\n",
- newLine
- ) : doc2;
- out.push(formatted);
- if (cmds.length > 0) {
- pos += get_string_width_default(formatted);
- }
- break;
- }
- case DOC_TYPE_ARRAY:
- for (let i = doc2.length - 1; i >= 0; i--) {
- cmds.push({ ind, mode, doc: doc2[i] });
- }
- break;
- case DOC_TYPE_CURSOR:
- if (printedCursorCount >= 2) {
- throw new Error("There are too many 'cursor' in doc.");
- }
- out.push(CURSOR_PLACEHOLDER);
- printedCursorCount++;
- break;
- case DOC_TYPE_INDENT:
- cmds.push({ ind: makeIndent(ind, options), mode, doc: doc2.contents });
- break;
- case DOC_TYPE_ALIGN:
- cmds.push({
- ind: makeAlign(ind, doc2.n, options),
- mode,
- doc: doc2.contents
- });
- break;
- case DOC_TYPE_TRIM:
- pos -= trim2(out);
- break;
- case DOC_TYPE_GROUP:
- switch (mode) {
- case MODE_FLAT:
- if (!shouldRemeasure) {
- cmds.push({
- ind,
- mode: doc2.break ? MODE_BREAK : MODE_FLAT,
- doc: doc2.contents
- });
- break;
- }
- // fallthrough
- case MODE_BREAK: {
- shouldRemeasure = false;
- const next = { ind, mode: MODE_FLAT, doc: doc2.contents };
- const rem = width - pos;
- const hasLineSuffix = lineSuffix2.length > 0;
- if (!doc2.break && fits(next, cmds, rem, hasLineSuffix, groupModeMap)) {
- cmds.push(next);
- } else {
- if (doc2.expandedStates) {
- const mostExpanded = at_default(
- /* isOptionalObject */
- false,
- doc2.expandedStates,
- -1
- );
- if (doc2.break) {
- cmds.push({ ind, mode: MODE_BREAK, doc: mostExpanded });
- break;
- } else {
- for (let i = 1; i < doc2.expandedStates.length + 1; i++) {
- if (i >= doc2.expandedStates.length) {
- cmds.push({ ind, mode: MODE_BREAK, doc: mostExpanded });
- break;
- } else {
- const state = doc2.expandedStates[i];
- const cmd = { ind, mode: MODE_FLAT, doc: state };
- if (fits(cmd, cmds, rem, hasLineSuffix, groupModeMap)) {
- cmds.push(cmd);
- break;
- }
- }
- }
- }
- } else {
- cmds.push({ ind, mode: MODE_BREAK, doc: doc2.contents });
- }
- }
- break;
- }
- }
- if (doc2.id) {
- groupModeMap[doc2.id] = at_default(
- /* isOptionalObject */
- false,
- cmds,
- -1
- ).mode;
- }
- break;
- // Fills each line with as much code as possible before moving to a new
- // line with the same indentation.
- //
- // Expects doc.parts to be an array of alternating content and
- // whitespace. The whitespace contains the linebreaks.
- //
- // For example:
- // ["I", line, "love", line, "monkeys"]
- // or
- // [{ type: group, ... }, softline, { type: group, ... }]
- //
- // It uses this parts structure to handle three main layout cases:
- // * The first two content items fit on the same line without
- // breaking
- // -> output the first content item and the whitespace "flat".
- // * Only the first content item fits on the line without breaking
- // -> output the first content item "flat" and the whitespace with
- // "break".
- // * Neither content item fits on the line without breaking
- // -> output the first content item and the whitespace with "break".
- case DOC_TYPE_FILL: {
- const rem = width - pos;
- const offset = doc2[DOC_FILL_PRINTED_LENGTH] ?? 0;
- const { parts } = doc2;
- const length = parts.length - offset;
- if (length === 0) {
- break;
- }
- const content = parts[offset + 0];
- const whitespace = parts[offset + 1];
- const contentFlatCmd = { ind, mode: MODE_FLAT, doc: content };
- const contentBreakCmd = { ind, mode: MODE_BREAK, doc: content };
- const contentFits = fits(
- contentFlatCmd,
- [],
- rem,
- lineSuffix2.length > 0,
- groupModeMap,
- true
- );
- if (length === 1) {
- if (contentFits) {
- cmds.push(contentFlatCmd);
- } else {
- cmds.push(contentBreakCmd);
- }
- break;
- }
- const whitespaceFlatCmd = { ind, mode: MODE_FLAT, doc: whitespace };
- const whitespaceBreakCmd = { ind, mode: MODE_BREAK, doc: whitespace };
- if (length === 2) {
- if (contentFits) {
- cmds.push(whitespaceFlatCmd, contentFlatCmd);
- } else {
- cmds.push(whitespaceBreakCmd, contentBreakCmd);
- }
- break;
- }
- const secondContent = parts[offset + 2];
- const remainingCmd = {
- ind,
- mode,
- doc: { ...doc2, [DOC_FILL_PRINTED_LENGTH]: offset + 2 }
- };
- const firstAndSecondContentFlatCmd = {
- ind,
- mode: MODE_FLAT,
- doc: [content, whitespace, secondContent]
- };
- const firstAndSecondContentFits = fits(
- firstAndSecondContentFlatCmd,
- [],
- rem,
- lineSuffix2.length > 0,
- groupModeMap,
- true
- );
- if (firstAndSecondContentFits) {
- cmds.push(remainingCmd, whitespaceFlatCmd, contentFlatCmd);
- } else if (contentFits) {
- cmds.push(remainingCmd, whitespaceBreakCmd, contentFlatCmd);
- } else {
- cmds.push(remainingCmd, whitespaceBreakCmd, contentBreakCmd);
- }
- break;
- }
- case DOC_TYPE_IF_BREAK:
- case DOC_TYPE_INDENT_IF_BREAK: {
- const groupMode = doc2.groupId ? groupModeMap[doc2.groupId] : mode;
- if (groupMode === MODE_BREAK) {
- const breakContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.breakContents : doc2.negate ? doc2.contents : indent(doc2.contents);
- if (breakContents) {
- cmds.push({ ind, mode, doc: breakContents });
- }
- }
- if (groupMode === MODE_FLAT) {
- const flatContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.flatContents : doc2.negate ? indent(doc2.contents) : doc2.contents;
- if (flatContents) {
- cmds.push({ ind, mode, doc: flatContents });
- }
- }
- break;
- }
- case DOC_TYPE_LINE_SUFFIX:
- lineSuffix2.push({ ind, mode, doc: doc2.contents });
- break;
- case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
- if (lineSuffix2.length > 0) {
- cmds.push({ ind, mode, doc: hardlineWithoutBreakParent });
- }
- break;
- case DOC_TYPE_LINE:
- switch (mode) {
- case MODE_FLAT:
- if (!doc2.hard) {
- if (!doc2.soft) {
- out.push(" ");
- pos += 1;
- }
- break;
- } else {
- shouldRemeasure = true;
- }
- // fallthrough
- case MODE_BREAK:
- if (lineSuffix2.length > 0) {
- cmds.push({ ind, mode, doc: doc2 }, ...lineSuffix2.reverse());
- lineSuffix2.length = 0;
- break;
- }
- if (doc2.literal) {
- if (ind.root) {
- out.push(newLine, ind.root.value);
- pos = ind.root.length;
- } else {
- out.push(newLine);
- pos = 0;
- }
- } else {
- pos -= trim2(out);
- out.push(newLine + ind.value);
- pos = ind.length;
- }
- break;
- }
- break;
- case DOC_TYPE_LABEL:
- cmds.push({ ind, mode, doc: doc2.contents });
- break;
- case DOC_TYPE_BREAK_PARENT:
- break;
- default:
- throw new invalid_doc_error_default(doc2);
- }
- if (cmds.length === 0 && lineSuffix2.length > 0) {
- cmds.push(...lineSuffix2.reverse());
- lineSuffix2.length = 0;
- }
- }
- const cursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER);
- if (cursorPlaceholderIndex !== -1) {
- const otherCursorPlaceholderIndex = out.indexOf(
- CURSOR_PLACEHOLDER,
- cursorPlaceholderIndex + 1
- );
- if (otherCursorPlaceholderIndex === -1) {
- return {
- formatted: out.filter((char) => char !== CURSOR_PLACEHOLDER).join("")
- };
- }
- const beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
- const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join("");
- const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join("");
- return {
- formatted: beforeCursor + aroundCursor + afterCursor,
- cursorNodeStart: beforeCursor.length,
- cursorNodeText: aroundCursor
- };
- }
- return { formatted: out.join("") };
- }
-
- // src/document/public.js
- var builders = {
- join,
- line,
- softline,
- hardline,
- literalline,
- group,
- conditionalGroup,
- fill,
- lineSuffix,
- lineSuffixBoundary,
- cursor,
- breakParent,
- ifBreak,
- trim,
- indent,
- indentIfBreak,
- align,
- addAlignmentToDoc,
- markAsRoot,
- dedentToRoot,
- dedent,
- hardlineWithoutBreakParent,
- literallineWithoutBreakParent,
- label,
- // TODO: Remove this in v4
- concat: (parts) => parts
- };
- var printer = { printDocToString };
- var utils = {
- willBreak,
- traverseDoc: traverse_doc_default,
- findInDoc,
- mapDoc,
- removeLines,
- stripTrailingHardline,
- replaceEndOfLine,
- canBreak
- };
- return __toCommonJS(public_exports);
-});
\ No newline at end of file
diff --git a/node_modules/prettier/doc.mjs b/node_modules/prettier/doc.mjs
deleted file mode 100644
index 8a5cf81..0000000
--- a/node_modules/prettier/doc.mjs
+++ /dev/null
@@ -1,1242 +0,0 @@
-var __defProp = Object.defineProperty;
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
-};
-
-// src/document/public.js
-var public_exports = {};
-__export(public_exports, {
- builders: () => builders,
- printer: () => printer,
- utils: () => utils
-});
-
-// src/document/constants.js
-var DOC_TYPE_STRING = "string";
-var DOC_TYPE_ARRAY = "array";
-var DOC_TYPE_CURSOR = "cursor";
-var DOC_TYPE_INDENT = "indent";
-var DOC_TYPE_ALIGN = "align";
-var DOC_TYPE_TRIM = "trim";
-var DOC_TYPE_GROUP = "group";
-var DOC_TYPE_FILL = "fill";
-var DOC_TYPE_IF_BREAK = "if-break";
-var DOC_TYPE_INDENT_IF_BREAK = "indent-if-break";
-var DOC_TYPE_LINE_SUFFIX = "line-suffix";
-var DOC_TYPE_LINE_SUFFIX_BOUNDARY = "line-suffix-boundary";
-var DOC_TYPE_LINE = "line";
-var DOC_TYPE_LABEL = "label";
-var DOC_TYPE_BREAK_PARENT = "break-parent";
-var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
- DOC_TYPE_CURSOR,
- DOC_TYPE_INDENT,
- DOC_TYPE_ALIGN,
- DOC_TYPE_TRIM,
- DOC_TYPE_GROUP,
- DOC_TYPE_FILL,
- DOC_TYPE_IF_BREAK,
- DOC_TYPE_INDENT_IF_BREAK,
- DOC_TYPE_LINE_SUFFIX,
- DOC_TYPE_LINE_SUFFIX_BOUNDARY,
- DOC_TYPE_LINE,
- DOC_TYPE_LABEL,
- DOC_TYPE_BREAK_PARENT
-]);
-
-// scripts/build/shims/at.js
-var at = (isOptionalObject, object, index) => {
- if (isOptionalObject && (object === void 0 || object === null)) {
- return;
- }
- if (Array.isArray(object) || typeof object === "string") {
- return object[index < 0 ? object.length + index : index];
- }
- return object.at(index);
-};
-var at_default = at;
-
-// node_modules/trim-newlines/index.js
-function trimNewlinesEnd(string) {
- let end = string.length;
- while (end > 0 && (string[end - 1] === "\r" || string[end - 1] === "\n")) {
- end--;
- }
- return end < string.length ? string.slice(0, end) : string;
-}
-
-// src/document/utils/get-doc-type.js
-function getDocType(doc) {
- if (typeof doc === "string") {
- return DOC_TYPE_STRING;
- }
- if (Array.isArray(doc)) {
- return DOC_TYPE_ARRAY;
- }
- if (!doc) {
- return;
- }
- const { type } = doc;
- if (VALID_OBJECT_DOC_TYPES.has(type)) {
- return type;
- }
-}
-var get_doc_type_default = getDocType;
-
-// src/document/invalid-doc-error.js
-var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
-function getDocErrorMessage(doc) {
- const type = doc === null ? "null" : typeof doc;
- if (type !== "string" && type !== "object") {
- return `Unexpected doc '${type}',
-Expected it to be 'string' or 'object'.`;
- }
- if (get_doc_type_default(doc)) {
- throw new Error("doc is valid.");
- }
- const objectType = Object.prototype.toString.call(doc);
- if (objectType !== "[object Object]") {
- return `Unexpected doc '${objectType}'.`;
- }
- const EXPECTED_TYPE_VALUES = disjunctionListFormat(
- [...VALID_OBJECT_DOC_TYPES].map((type2) => `'${type2}'`)
- );
- return `Unexpected doc.type '${doc.type}'.
-Expected it to be ${EXPECTED_TYPE_VALUES}.`;
-}
-var InvalidDocError = class extends Error {
- name = "InvalidDocError";
- constructor(doc) {
- super(getDocErrorMessage(doc));
- this.doc = doc;
- }
-};
-var invalid_doc_error_default = InvalidDocError;
-
-// src/document/utils/traverse-doc.js
-var traverseDocOnExitStackMarker = {};
-function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
- const docsStack = [doc];
- while (docsStack.length > 0) {
- const doc2 = docsStack.pop();
- if (doc2 === traverseDocOnExitStackMarker) {
- onExit(docsStack.pop());
- continue;
- }
- if (onExit) {
- docsStack.push(doc2, traverseDocOnExitStackMarker);
- }
- const docType = get_doc_type_default(doc2);
- if (!docType) {
- throw new invalid_doc_error_default(doc2);
- }
- if ((onEnter == null ? void 0 : onEnter(doc2)) === false) {
- continue;
- }
- switch (docType) {
- case DOC_TYPE_ARRAY:
- case DOC_TYPE_FILL: {
- const parts = docType === DOC_TYPE_ARRAY ? doc2 : doc2.parts;
- for (let ic = parts.length, i = ic - 1; i >= 0; --i) {
- docsStack.push(parts[i]);
- }
- break;
- }
- case DOC_TYPE_IF_BREAK:
- docsStack.push(doc2.flatContents, doc2.breakContents);
- break;
- case DOC_TYPE_GROUP:
- if (shouldTraverseConditionalGroups && doc2.expandedStates) {
- for (let ic = doc2.expandedStates.length, i = ic - 1; i >= 0; --i) {
- docsStack.push(doc2.expandedStates[i]);
- }
- } else {
- docsStack.push(doc2.contents);
- }
- break;
- case DOC_TYPE_ALIGN:
- case DOC_TYPE_INDENT:
- case DOC_TYPE_INDENT_IF_BREAK:
- case DOC_TYPE_LABEL:
- case DOC_TYPE_LINE_SUFFIX:
- docsStack.push(doc2.contents);
- break;
- case DOC_TYPE_STRING:
- case DOC_TYPE_CURSOR:
- case DOC_TYPE_TRIM:
- case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
- case DOC_TYPE_LINE:
- case DOC_TYPE_BREAK_PARENT:
- break;
- default:
- throw new invalid_doc_error_default(doc2);
- }
- }
-}
-var traverse_doc_default = traverseDoc;
-
-// src/document/utils.js
-function mapDoc(doc, cb) {
- if (typeof doc === "string") {
- return cb(doc);
- }
- const mapped = /* @__PURE__ */ new Map();
- return rec(doc);
- function rec(doc2) {
- if (mapped.has(doc2)) {
- return mapped.get(doc2);
- }
- const result = process2(doc2);
- mapped.set(doc2, result);
- return result;
- }
- function process2(doc2) {
- switch (get_doc_type_default(doc2)) {
- case DOC_TYPE_ARRAY:
- return cb(doc2.map(rec));
- case DOC_TYPE_FILL:
- return cb({ ...doc2, parts: doc2.parts.map(rec) });
- case DOC_TYPE_IF_BREAK:
- return cb({
- ...doc2,
- breakContents: rec(doc2.breakContents),
- flatContents: rec(doc2.flatContents)
- });
- case DOC_TYPE_GROUP: {
- let { expandedStates, contents } = doc2;
- if (expandedStates) {
- expandedStates = expandedStates.map(rec);
- contents = expandedStates[0];
- } else {
- contents = rec(contents);
- }
- return cb({ ...doc2, contents, expandedStates });
- }
- case DOC_TYPE_ALIGN:
- case DOC_TYPE_INDENT:
- case DOC_TYPE_INDENT_IF_BREAK:
- case DOC_TYPE_LABEL:
- case DOC_TYPE_LINE_SUFFIX:
- return cb({ ...doc2, contents: rec(doc2.contents) });
- case DOC_TYPE_STRING:
- case DOC_TYPE_CURSOR:
- case DOC_TYPE_TRIM:
- case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
- case DOC_TYPE_LINE:
- case DOC_TYPE_BREAK_PARENT:
- return cb(doc2);
- default:
- throw new invalid_doc_error_default(doc2);
- }
- }
-}
-function findInDoc(doc, fn, defaultValue) {
- let result = defaultValue;
- let shouldSkipFurtherProcessing = false;
- function findInDocOnEnterFn(doc2) {
- if (shouldSkipFurtherProcessing) {
- return false;
- }
- const maybeResult = fn(doc2);
- if (maybeResult !== void 0) {
- shouldSkipFurtherProcessing = true;
- result = maybeResult;
- }
- }
- traverse_doc_default(doc, findInDocOnEnterFn);
- return result;
-}
-function willBreakFn(doc) {
- if (doc.type === DOC_TYPE_GROUP && doc.break) {
- return true;
- }
- if (doc.type === DOC_TYPE_LINE && doc.hard) {
- return true;
- }
- if (doc.type === DOC_TYPE_BREAK_PARENT) {
- return true;
- }
-}
-function willBreak(doc) {
- return findInDoc(doc, willBreakFn, false);
-}
-function breakParentGroup(groupStack) {
- if (groupStack.length > 0) {
- const parentGroup = at_default(
- /* isOptionalObject */
- false,
- groupStack,
- -1
- );
- if (!parentGroup.expandedStates && !parentGroup.break) {
- parentGroup.break = "propagated";
- }
- }
- return null;
-}
-function propagateBreaks(doc) {
- const alreadyVisitedSet = /* @__PURE__ */ new Set();
- const groupStack = [];
- function propagateBreaksOnEnterFn(doc2) {
- if (doc2.type === DOC_TYPE_BREAK_PARENT) {
- breakParentGroup(groupStack);
- }
- if (doc2.type === DOC_TYPE_GROUP) {
- groupStack.push(doc2);
- if (alreadyVisitedSet.has(doc2)) {
- return false;
- }
- alreadyVisitedSet.add(doc2);
- }
- }
- function propagateBreaksOnExitFn(doc2) {
- if (doc2.type === DOC_TYPE_GROUP) {
- const group2 = groupStack.pop();
- if (group2.break) {
- breakParentGroup(groupStack);
- }
- }
- }
- traverse_doc_default(
- doc,
- propagateBreaksOnEnterFn,
- propagateBreaksOnExitFn,
- /* shouldTraverseConditionalGroups */
- true
- );
-}
-function removeLinesFn(doc) {
- if (doc.type === DOC_TYPE_LINE && !doc.hard) {
- return doc.soft ? "" : " ";
- }
- if (doc.type === DOC_TYPE_IF_BREAK) {
- return doc.flatContents;
- }
- return doc;
-}
-function removeLines(doc) {
- return mapDoc(doc, removeLinesFn);
-}
-function stripTrailingHardlineFromParts(parts) {
- parts = [...parts];
- while (parts.length >= 2 && at_default(
- /* isOptionalObject */
- false,
- parts,
- -2
- ).type === DOC_TYPE_LINE && at_default(
- /* isOptionalObject */
- false,
- parts,
- -1
- ).type === DOC_TYPE_BREAK_PARENT) {
- parts.length -= 2;
- }
- if (parts.length > 0) {
- const lastPart = stripTrailingHardlineFromDoc(at_default(
- /* isOptionalObject */
- false,
- parts,
- -1
- ));
- parts[parts.length - 1] = lastPart;
- }
- return parts;
-}
-function stripTrailingHardlineFromDoc(doc) {
- switch (get_doc_type_default(doc)) {
- case DOC_TYPE_INDENT:
- case DOC_TYPE_INDENT_IF_BREAK:
- case DOC_TYPE_GROUP:
- case DOC_TYPE_LINE_SUFFIX:
- case DOC_TYPE_LABEL: {
- const contents = stripTrailingHardlineFromDoc(doc.contents);
- return { ...doc, contents };
- }
- case DOC_TYPE_IF_BREAK:
- return {
- ...doc,
- breakContents: stripTrailingHardlineFromDoc(doc.breakContents),
- flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
- };
- case DOC_TYPE_FILL:
- return { ...doc, parts: stripTrailingHardlineFromParts(doc.parts) };
- case DOC_TYPE_ARRAY:
- return stripTrailingHardlineFromParts(doc);
- case DOC_TYPE_STRING:
- return trimNewlinesEnd(doc);
- case DOC_TYPE_ALIGN:
- case DOC_TYPE_CURSOR:
- case DOC_TYPE_TRIM:
- case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
- case DOC_TYPE_LINE:
- case DOC_TYPE_BREAK_PARENT:
- break;
- default:
- throw new invalid_doc_error_default(doc);
- }
- return doc;
-}
-function stripTrailingHardline(doc) {
- return stripTrailingHardlineFromDoc(cleanDoc(doc));
-}
-function cleanDocFn(doc) {
- switch (get_doc_type_default(doc)) {
- case DOC_TYPE_FILL:
- if (doc.parts.every((part) => part === "")) {
- return "";
- }
- break;
- case DOC_TYPE_GROUP:
- if (!doc.contents && !doc.id && !doc.break && !doc.expandedStates) {
- return "";
- }
- if (doc.contents.type === DOC_TYPE_GROUP && doc.contents.id === doc.id && doc.contents.break === doc.break && doc.contents.expandedStates === doc.expandedStates) {
- return doc.contents;
- }
- break;
- case DOC_TYPE_ALIGN:
- case DOC_TYPE_INDENT:
- case DOC_TYPE_INDENT_IF_BREAK:
- case DOC_TYPE_LINE_SUFFIX:
- if (!doc.contents) {
- return "";
- }
- break;
- case DOC_TYPE_IF_BREAK:
- if (!doc.flatContents && !doc.breakContents) {
- return "";
- }
- break;
- case DOC_TYPE_ARRAY: {
- const parts = [];
- for (const part of doc) {
- if (!part) {
- continue;
- }
- const [currentPart, ...restParts] = Array.isArray(part) ? part : [part];
- if (typeof currentPart === "string" && typeof at_default(
- /* isOptionalObject */
- false,
- parts,
- -1
- ) === "string") {
- parts[parts.length - 1] += currentPart;
- } else {
- parts.push(currentPart);
- }
- parts.push(...restParts);
- }
- if (parts.length === 0) {
- return "";
- }
- if (parts.length === 1) {
- return parts[0];
- }
- return parts;
- }
- case DOC_TYPE_STRING:
- case DOC_TYPE_CURSOR:
- case DOC_TYPE_TRIM:
- case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
- case DOC_TYPE_LINE:
- case DOC_TYPE_LABEL:
- case DOC_TYPE_BREAK_PARENT:
- break;
- default:
- throw new invalid_doc_error_default(doc);
- }
- return doc;
-}
-function cleanDoc(doc) {
- return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
-}
-function replaceEndOfLine(doc, replacement = literalline) {
- return mapDoc(
- doc,
- (currentDoc) => typeof currentDoc === "string" ? join(replacement, currentDoc.split("\n")) : currentDoc
- );
-}
-function canBreakFn(doc) {
- if (doc.type === DOC_TYPE_LINE) {
- return true;
- }
-}
-function canBreak(doc) {
- return findInDoc(doc, canBreakFn, false);
-}
-
-// src/document/utils/assert-doc.js
-var noop = () => {
-};
-var assertDoc = true ? noop : function(doc) {
- traverse_doc_default(doc, (doc2) => {
- if (checked.has(doc2)) {
- return false;
- }
- if (typeof doc2 !== "string") {
- checked.add(doc2);
- }
- });
-};
-var assertDocArray = true ? noop : function(docs, optional = false) {
- if (optional && !docs) {
- return;
- }
- if (!Array.isArray(docs)) {
- throw new TypeError("Unexpected doc array.");
- }
- for (const doc of docs) {
- assertDoc(doc);
- }
-};
-var assertDocFillParts = true ? noop : (
- /**
- * @param {Doc[]} parts
- */
- function(parts) {
- assertDocArray(parts);
- if (parts.length > 1 && isEmptyDoc(at_default(
- /* isOptionalObject */
- false,
- parts,
- -1
- ))) {
- parts = parts.slice(0, -1);
- }
- for (const [i, doc] of parts.entries()) {
- if (i % 2 === 1 && !isValidSeparator(doc)) {
- const type = get_doc_type_default(doc);
- throw new Error(
- `Unexpected non-line-break doc at ${i}. Doc type is ${type}.`
- );
- }
- }
- }
-);
-
-// src/document/builders.js
-function indent(contents) {
- assertDoc(contents);
- return { type: DOC_TYPE_INDENT, contents };
-}
-function align(widthOrString, contents) {
- assertDoc(contents);
- return { type: DOC_TYPE_ALIGN, contents, n: widthOrString };
-}
-function group(contents, opts = {}) {
- assertDoc(contents);
- assertDocArray(
- opts.expandedStates,
- /* optional */
- true
- );
- return {
- type: DOC_TYPE_GROUP,
- id: opts.id,
- contents,
- break: Boolean(opts.shouldBreak),
- expandedStates: opts.expandedStates
- };
-}
-function dedentToRoot(contents) {
- return align(Number.NEGATIVE_INFINITY, contents);
-}
-function markAsRoot(contents) {
- return align({ type: "root" }, contents);
-}
-function dedent(contents) {
- return align(-1, contents);
-}
-function conditionalGroup(states, opts) {
- return group(states[0], { ...opts, expandedStates: states });
-}
-function fill(parts) {
- assertDocFillParts(parts);
- return { type: DOC_TYPE_FILL, parts };
-}
-function ifBreak(breakContents, flatContents = "", opts = {}) {
- assertDoc(breakContents);
- if (flatContents !== "") {
- assertDoc(flatContents);
- }
- return {
- type: DOC_TYPE_IF_BREAK,
- breakContents,
- flatContents,
- groupId: opts.groupId
- };
-}
-function indentIfBreak(contents, opts) {
- assertDoc(contents);
- return {
- type: DOC_TYPE_INDENT_IF_BREAK,
- contents,
- groupId: opts.groupId,
- negate: opts.negate
- };
-}
-function lineSuffix(contents) {
- assertDoc(contents);
- return { type: DOC_TYPE_LINE_SUFFIX, contents };
-}
-var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
-var breakParent = { type: DOC_TYPE_BREAK_PARENT };
-var trim = { type: DOC_TYPE_TRIM };
-var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
-var literallineWithoutBreakParent = {
- type: DOC_TYPE_LINE,
- hard: true,
- literal: true
-};
-var line = { type: DOC_TYPE_LINE };
-var softline = { type: DOC_TYPE_LINE, soft: true };
-var hardline = [hardlineWithoutBreakParent, breakParent];
-var literalline = [literallineWithoutBreakParent, breakParent];
-var cursor = { type: DOC_TYPE_CURSOR };
-function join(separator, docs) {
- assertDoc(separator);
- assertDocArray(docs);
- const parts = [];
- for (let i = 0; i < docs.length; i++) {
- if (i !== 0) {
- parts.push(separator);
- }
- parts.push(docs[i]);
- }
- return parts;
-}
-function addAlignmentToDoc(doc, size, tabWidth) {
- assertDoc(doc);
- let aligned = doc;
- if (size > 0) {
- for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
- aligned = indent(aligned);
- }
- aligned = align(size % tabWidth, aligned);
- aligned = align(Number.NEGATIVE_INFINITY, aligned);
- }
- return aligned;
-}
-function label(label2, contents) {
- assertDoc(contents);
- return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents;
-}
-
-// scripts/build/shims/string-replace-all.js
-var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => {
- if (isOptionalObject && (original === void 0 || original === null)) {
- return;
- }
- if (original.replaceAll) {
- return original.replaceAll(pattern, replacement);
- }
- if (pattern.global) {
- return original.replace(pattern, replacement);
- }
- return original.split(pattern).join(replacement);
-};
-var string_replace_all_default = stringReplaceAll;
-
-// src/common/end-of-line.js
-function convertEndOfLineToChars(value) {
- switch (value) {
- case "cr":
- return "\r";
- case "crlf":
- return "\r\n";
- default:
- return "\n";
- }
-}
-
-// node_modules/emoji-regex/index.mjs
-var emoji_regex_default = () => {
- return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
-};
-
-// node_modules/get-east-asian-width/lookup.js
-function isFullWidth(x) {
- return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
-}
-function isWide(x) {
- return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
-}
-
-// node_modules/get-east-asian-width/index.js
-var _isNarrowWidth = (codePoint) => !(isFullWidth(codePoint) || isWide(codePoint));
-
-// src/utils/get-string-width.js
-var notAsciiRegex = /[^\x20-\x7F]/u;
-function getStringWidth(text) {
- if (!text) {
- return 0;
- }
- if (!notAsciiRegex.test(text)) {
- return text.length;
- }
- text = text.replace(emoji_regex_default(), " ");
- let width = 0;
- for (const character of text) {
- const codePoint = character.codePointAt(0);
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
- continue;
- }
- if (codePoint >= 768 && codePoint <= 879) {
- continue;
- }
- width += _isNarrowWidth(codePoint) ? 1 : 2;
- }
- return width;
-}
-var get_string_width_default = getStringWidth;
-
-// src/document/printer.js
-var MODE_BREAK = Symbol("MODE_BREAK");
-var MODE_FLAT = Symbol("MODE_FLAT");
-var CURSOR_PLACEHOLDER = Symbol("cursor");
-var DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
-function rootIndent() {
- return { value: "", length: 0, queue: [] };
-}
-function makeIndent(ind, options) {
- return generateInd(ind, { type: "indent" }, options);
-}
-function makeAlign(indent2, widthOrDoc, options) {
- if (widthOrDoc === Number.NEGATIVE_INFINITY) {
- return indent2.root || rootIndent();
- }
- if (widthOrDoc < 0) {
- return generateInd(indent2, { type: "dedent" }, options);
- }
- if (!widthOrDoc) {
- return indent2;
- }
- if (widthOrDoc.type === "root") {
- return { ...indent2, root: indent2 };
- }
- const alignType = typeof widthOrDoc === "string" ? "stringAlign" : "numberAlign";
- return generateInd(indent2, { type: alignType, n: widthOrDoc }, options);
-}
-function generateInd(ind, newPart, options) {
- const queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : [...ind.queue, newPart];
- let value = "";
- let length = 0;
- let lastTabs = 0;
- let lastSpaces = 0;
- for (const part of queue) {
- switch (part.type) {
- case "indent":
- flush();
- if (options.useTabs) {
- addTabs(1);
- } else {
- addSpaces(options.tabWidth);
- }
- break;
- case "stringAlign":
- flush();
- value += part.n;
- length += part.n.length;
- break;
- case "numberAlign":
- lastTabs += 1;
- lastSpaces += part.n;
- break;
- default:
- throw new Error(`Unexpected type '${part.type}'`);
- }
- }
- flushSpaces();
- return { ...ind, value, length, queue };
- function addTabs(count) {
- value += " ".repeat(count);
- length += options.tabWidth * count;
- }
- function addSpaces(count) {
- value += " ".repeat(count);
- length += count;
- }
- function flush() {
- if (options.useTabs) {
- flushTabs();
- } else {
- flushSpaces();
- }
- }
- function flushTabs() {
- if (lastTabs > 0) {
- addTabs(lastTabs);
- }
- resetLast();
- }
- function flushSpaces() {
- if (lastSpaces > 0) {
- addSpaces(lastSpaces);
- }
- resetLast();
- }
- function resetLast() {
- lastTabs = 0;
- lastSpaces = 0;
- }
-}
-function trim2(out) {
- let trimCount = 0;
- let cursorCount = 0;
- let outIndex = out.length;
- outer: while (outIndex--) {
- const last = out[outIndex];
- if (last === CURSOR_PLACEHOLDER) {
- cursorCount++;
- continue;
- }
- if (false) {
- throw new Error(`Unexpected value in trim: '${typeof last}'`);
- }
- for (let charIndex = last.length - 1; charIndex >= 0; charIndex--) {
- const char = last[charIndex];
- if (char === " " || char === " ") {
- trimCount++;
- } else {
- out[outIndex] = last.slice(0, charIndex + 1);
- break outer;
- }
- }
- }
- if (trimCount > 0 || cursorCount > 0) {
- out.length = outIndex + 1;
- while (cursorCount-- > 0) {
- out.push(CURSOR_PLACEHOLDER);
- }
- }
- return trimCount;
-}
-function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat) {
- if (width === Number.POSITIVE_INFINITY) {
- return true;
- }
- let restIdx = restCommands.length;
- const cmds = [next];
- const out = [];
- while (width >= 0) {
- if (cmds.length === 0) {
- if (restIdx === 0) {
- return true;
- }
- cmds.push(restCommands[--restIdx]);
- continue;
- }
- const { mode, doc } = cmds.pop();
- const docType = get_doc_type_default(doc);
- switch (docType) {
- case DOC_TYPE_STRING:
- out.push(doc);
- width -= get_string_width_default(doc);
- break;
- case DOC_TYPE_ARRAY:
- case DOC_TYPE_FILL: {
- const parts = docType === DOC_TYPE_ARRAY ? doc : doc.parts;
- const end = doc[DOC_FILL_PRINTED_LENGTH] ?? 0;
- for (let i = parts.length - 1; i >= end; i--) {
- cmds.push({ mode, doc: parts[i] });
- }
- break;
- }
- case DOC_TYPE_INDENT:
- case DOC_TYPE_ALIGN:
- case DOC_TYPE_INDENT_IF_BREAK:
- case DOC_TYPE_LABEL:
- cmds.push({ mode, doc: doc.contents });
- break;
- case DOC_TYPE_TRIM:
- width += trim2(out);
- break;
- case DOC_TYPE_GROUP: {
- if (mustBeFlat && doc.break) {
- return false;
- }
- const groupMode = doc.break ? MODE_BREAK : mode;
- const contents = doc.expandedStates && groupMode === MODE_BREAK ? at_default(
- /* isOptionalObject */
- false,
- doc.expandedStates,
- -1
- ) : doc.contents;
- cmds.push({ mode: groupMode, doc: contents });
- break;
- }
- case DOC_TYPE_IF_BREAK: {
- const groupMode = doc.groupId ? groupModeMap[doc.groupId] || MODE_FLAT : mode;
- const contents = groupMode === MODE_BREAK ? doc.breakContents : doc.flatContents;
- if (contents) {
- cmds.push({ mode, doc: contents });
- }
- break;
- }
- case DOC_TYPE_LINE:
- if (mode === MODE_BREAK || doc.hard) {
- return true;
- }
- if (!doc.soft) {
- out.push(" ");
- width--;
- }
- break;
- case DOC_TYPE_LINE_SUFFIX:
- hasLineSuffix = true;
- break;
- case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
- if (hasLineSuffix) {
- return false;
- }
- break;
- }
- }
- return false;
-}
-function printDocToString(doc, options) {
- const groupModeMap = {};
- const width = options.printWidth;
- const newLine = convertEndOfLineToChars(options.endOfLine);
- let pos = 0;
- const cmds = [{ ind: rootIndent(), mode: MODE_BREAK, doc }];
- const out = [];
- let shouldRemeasure = false;
- const lineSuffix2 = [];
- let printedCursorCount = 0;
- propagateBreaks(doc);
- while (cmds.length > 0) {
- const { ind, mode, doc: doc2 } = cmds.pop();
- switch (get_doc_type_default(doc2)) {
- case DOC_TYPE_STRING: {
- const formatted = newLine !== "\n" ? string_replace_all_default(
- /* isOptionalObject */
- false,
- doc2,
- "\n",
- newLine
- ) : doc2;
- out.push(formatted);
- if (cmds.length > 0) {
- pos += get_string_width_default(formatted);
- }
- break;
- }
- case DOC_TYPE_ARRAY:
- for (let i = doc2.length - 1; i >= 0; i--) {
- cmds.push({ ind, mode, doc: doc2[i] });
- }
- break;
- case DOC_TYPE_CURSOR:
- if (printedCursorCount >= 2) {
- throw new Error("There are too many 'cursor' in doc.");
- }
- out.push(CURSOR_PLACEHOLDER);
- printedCursorCount++;
- break;
- case DOC_TYPE_INDENT:
- cmds.push({ ind: makeIndent(ind, options), mode, doc: doc2.contents });
- break;
- case DOC_TYPE_ALIGN:
- cmds.push({
- ind: makeAlign(ind, doc2.n, options),
- mode,
- doc: doc2.contents
- });
- break;
- case DOC_TYPE_TRIM:
- pos -= trim2(out);
- break;
- case DOC_TYPE_GROUP:
- switch (mode) {
- case MODE_FLAT:
- if (!shouldRemeasure) {
- cmds.push({
- ind,
- mode: doc2.break ? MODE_BREAK : MODE_FLAT,
- doc: doc2.contents
- });
- break;
- }
- // fallthrough
- case MODE_BREAK: {
- shouldRemeasure = false;
- const next = { ind, mode: MODE_FLAT, doc: doc2.contents };
- const rem = width - pos;
- const hasLineSuffix = lineSuffix2.length > 0;
- if (!doc2.break && fits(next, cmds, rem, hasLineSuffix, groupModeMap)) {
- cmds.push(next);
- } else {
- if (doc2.expandedStates) {
- const mostExpanded = at_default(
- /* isOptionalObject */
- false,
- doc2.expandedStates,
- -1
- );
- if (doc2.break) {
- cmds.push({ ind, mode: MODE_BREAK, doc: mostExpanded });
- break;
- } else {
- for (let i = 1; i < doc2.expandedStates.length + 1; i++) {
- if (i >= doc2.expandedStates.length) {
- cmds.push({ ind, mode: MODE_BREAK, doc: mostExpanded });
- break;
- } else {
- const state = doc2.expandedStates[i];
- const cmd = { ind, mode: MODE_FLAT, doc: state };
- if (fits(cmd, cmds, rem, hasLineSuffix, groupModeMap)) {
- cmds.push(cmd);
- break;
- }
- }
- }
- }
- } else {
- cmds.push({ ind, mode: MODE_BREAK, doc: doc2.contents });
- }
- }
- break;
- }
- }
- if (doc2.id) {
- groupModeMap[doc2.id] = at_default(
- /* isOptionalObject */
- false,
- cmds,
- -1
- ).mode;
- }
- break;
- // Fills each line with as much code as possible before moving to a new
- // line with the same indentation.
- //
- // Expects doc.parts to be an array of alternating content and
- // whitespace. The whitespace contains the linebreaks.
- //
- // For example:
- // ["I", line, "love", line, "monkeys"]
- // or
- // [{ type: group, ... }, softline, { type: group, ... }]
- //
- // It uses this parts structure to handle three main layout cases:
- // * The first two content items fit on the same line without
- // breaking
- // -> output the first content item and the whitespace "flat".
- // * Only the first content item fits on the line without breaking
- // -> output the first content item "flat" and the whitespace with
- // "break".
- // * Neither content item fits on the line without breaking
- // -> output the first content item and the whitespace with "break".
- case DOC_TYPE_FILL: {
- const rem = width - pos;
- const offset = doc2[DOC_FILL_PRINTED_LENGTH] ?? 0;
- const { parts } = doc2;
- const length = parts.length - offset;
- if (length === 0) {
- break;
- }
- const content = parts[offset + 0];
- const whitespace = parts[offset + 1];
- const contentFlatCmd = { ind, mode: MODE_FLAT, doc: content };
- const contentBreakCmd = { ind, mode: MODE_BREAK, doc: content };
- const contentFits = fits(
- contentFlatCmd,
- [],
- rem,
- lineSuffix2.length > 0,
- groupModeMap,
- true
- );
- if (length === 1) {
- if (contentFits) {
- cmds.push(contentFlatCmd);
- } else {
- cmds.push(contentBreakCmd);
- }
- break;
- }
- const whitespaceFlatCmd = { ind, mode: MODE_FLAT, doc: whitespace };
- const whitespaceBreakCmd = { ind, mode: MODE_BREAK, doc: whitespace };
- if (length === 2) {
- if (contentFits) {
- cmds.push(whitespaceFlatCmd, contentFlatCmd);
- } else {
- cmds.push(whitespaceBreakCmd, contentBreakCmd);
- }
- break;
- }
- const secondContent = parts[offset + 2];
- const remainingCmd = {
- ind,
- mode,
- doc: { ...doc2, [DOC_FILL_PRINTED_LENGTH]: offset + 2 }
- };
- const firstAndSecondContentFlatCmd = {
- ind,
- mode: MODE_FLAT,
- doc: [content, whitespace, secondContent]
- };
- const firstAndSecondContentFits = fits(
- firstAndSecondContentFlatCmd,
- [],
- rem,
- lineSuffix2.length > 0,
- groupModeMap,
- true
- );
- if (firstAndSecondContentFits) {
- cmds.push(remainingCmd, whitespaceFlatCmd, contentFlatCmd);
- } else if (contentFits) {
- cmds.push(remainingCmd, whitespaceBreakCmd, contentFlatCmd);
- } else {
- cmds.push(remainingCmd, whitespaceBreakCmd, contentBreakCmd);
- }
- break;
- }
- case DOC_TYPE_IF_BREAK:
- case DOC_TYPE_INDENT_IF_BREAK: {
- const groupMode = doc2.groupId ? groupModeMap[doc2.groupId] : mode;
- if (groupMode === MODE_BREAK) {
- const breakContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.breakContents : doc2.negate ? doc2.contents : indent(doc2.contents);
- if (breakContents) {
- cmds.push({ ind, mode, doc: breakContents });
- }
- }
- if (groupMode === MODE_FLAT) {
- const flatContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.flatContents : doc2.negate ? indent(doc2.contents) : doc2.contents;
- if (flatContents) {
- cmds.push({ ind, mode, doc: flatContents });
- }
- }
- break;
- }
- case DOC_TYPE_LINE_SUFFIX:
- lineSuffix2.push({ ind, mode, doc: doc2.contents });
- break;
- case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
- if (lineSuffix2.length > 0) {
- cmds.push({ ind, mode, doc: hardlineWithoutBreakParent });
- }
- break;
- case DOC_TYPE_LINE:
- switch (mode) {
- case MODE_FLAT:
- if (!doc2.hard) {
- if (!doc2.soft) {
- out.push(" ");
- pos += 1;
- }
- break;
- } else {
- shouldRemeasure = true;
- }
- // fallthrough
- case MODE_BREAK:
- if (lineSuffix2.length > 0) {
- cmds.push({ ind, mode, doc: doc2 }, ...lineSuffix2.reverse());
- lineSuffix2.length = 0;
- break;
- }
- if (doc2.literal) {
- if (ind.root) {
- out.push(newLine, ind.root.value);
- pos = ind.root.length;
- } else {
- out.push(newLine);
- pos = 0;
- }
- } else {
- pos -= trim2(out);
- out.push(newLine + ind.value);
- pos = ind.length;
- }
- break;
- }
- break;
- case DOC_TYPE_LABEL:
- cmds.push({ ind, mode, doc: doc2.contents });
- break;
- case DOC_TYPE_BREAK_PARENT:
- break;
- default:
- throw new invalid_doc_error_default(doc2);
- }
- if (cmds.length === 0 && lineSuffix2.length > 0) {
- cmds.push(...lineSuffix2.reverse());
- lineSuffix2.length = 0;
- }
- }
- const cursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER);
- if (cursorPlaceholderIndex !== -1) {
- const otherCursorPlaceholderIndex = out.indexOf(
- CURSOR_PLACEHOLDER,
- cursorPlaceholderIndex + 1
- );
- if (otherCursorPlaceholderIndex === -1) {
- return {
- formatted: out.filter((char) => char !== CURSOR_PLACEHOLDER).join("")
- };
- }
- const beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
- const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join("");
- const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join("");
- return {
- formatted: beforeCursor + aroundCursor + afterCursor,
- cursorNodeStart: beforeCursor.length,
- cursorNodeText: aroundCursor
- };
- }
- return { formatted: out.join("") };
-}
-
-// src/document/public.js
-var builders = {
- join,
- line,
- softline,
- hardline,
- literalline,
- group,
- conditionalGroup,
- fill,
- lineSuffix,
- lineSuffixBoundary,
- cursor,
- breakParent,
- ifBreak,
- trim,
- indent,
- indentIfBreak,
- align,
- addAlignmentToDoc,
- markAsRoot,
- dedentToRoot,
- dedent,
- hardlineWithoutBreakParent,
- literallineWithoutBreakParent,
- label,
- // TODO: Remove this in v4
- concat: (parts) => parts
-};
-var printer = { printDocToString };
-var utils = {
- willBreak,
- traverseDoc: traverse_doc_default,
- findInDoc,
- mapDoc,
- removeLines,
- stripTrailingHardline,
- replaceEndOfLine,
- canBreak
-};
-
-// with-default-export:src/document/public.js
-var public_default = public_exports;
-export {
- builders,
- public_default as default,
- printer,
- utils
-};
diff --git a/node_modules/prettier/index.cjs b/node_modules/prettier/index.cjs
deleted file mode 100644
index f51de08..0000000
--- a/node_modules/prettier/index.cjs
+++ /dev/null
@@ -1,685 +0,0 @@
-"use strict";
-var __create = Object.create;
-var __defProp = Object.defineProperty;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __getProtoOf = Object.getPrototypeOf;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __esm = (fn, res) => function __init() {
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
-};
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
-};
-var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
-};
-var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
- // If the importer is in node compatibility mode or this is not an ESM
- // file that has been converted to a CommonJS file using a Babel-
- // compatible transform (i.e. "__esModule" has not been set), then set
- // "default" to the CommonJS "module.exports" for node compatibility.
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
- mod
-));
-var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-
-// src/utils/skip.js
-function skip(characters) {
- return (text, startIndex, options) => {
- const backwards = Boolean(options == null ? void 0 : options.backwards);
- if (startIndex === false) {
- return false;
- }
- const { length } = text;
- let cursor = startIndex;
- while (cursor >= 0 && cursor < length) {
- const character = text.charAt(cursor);
- if (characters instanceof RegExp) {
- if (!characters.test(character)) {
- return cursor;
- }
- } else if (!characters.includes(character)) {
- return cursor;
- }
- backwards ? cursor-- : cursor++;
- }
- if (cursor === -1 || cursor === length) {
- return cursor;
- }
- return false;
- };
-}
-var skipWhitespace, skipSpaces, skipToLineEnd, skipEverythingButNewLine;
-var init_skip = __esm({
- "src/utils/skip.js"() {
- skipWhitespace = skip(/\s/u);
- skipSpaces = skip(" ");
- skipToLineEnd = skip(",; ");
- skipEverythingButNewLine = skip(/[^\n\r]/u);
- }
-});
-
-// src/utils/skip-inline-comment.js
-function skipInlineComment(text, startIndex) {
- if (startIndex === false) {
- return false;
- }
- if (text.charAt(startIndex) === "/" && text.charAt(startIndex + 1) === "*") {
- for (let i = startIndex + 2; i < text.length; ++i) {
- if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") {
- return i + 2;
- }
- }
- }
- return startIndex;
-}
-var skip_inline_comment_default;
-var init_skip_inline_comment = __esm({
- "src/utils/skip-inline-comment.js"() {
- skip_inline_comment_default = skipInlineComment;
- }
-});
-
-// src/utils/skip-newline.js
-function skipNewline(text, startIndex, options) {
- const backwards = Boolean(options == null ? void 0 : options.backwards);
- if (startIndex === false) {
- return false;
- }
- const character = text.charAt(startIndex);
- if (backwards) {
- if (text.charAt(startIndex - 1) === "\r" && character === "\n") {
- return startIndex - 2;
- }
- if (character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029") {
- return startIndex - 1;
- }
- } else {
- if (character === "\r" && text.charAt(startIndex + 1) === "\n") {
- return startIndex + 2;
- }
- if (character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029") {
- return startIndex + 1;
- }
- }
- return startIndex;
-}
-var skip_newline_default;
-var init_skip_newline = __esm({
- "src/utils/skip-newline.js"() {
- skip_newline_default = skipNewline;
- }
-});
-
-// src/utils/skip-trailing-comment.js
-function skipTrailingComment(text, startIndex) {
- if (startIndex === false) {
- return false;
- }
- if (text.charAt(startIndex) === "/" && text.charAt(startIndex + 1) === "/") {
- return skipEverythingButNewLine(text, startIndex);
- }
- return startIndex;
-}
-var skip_trailing_comment_default;
-var init_skip_trailing_comment = __esm({
- "src/utils/skip-trailing-comment.js"() {
- init_skip();
- skip_trailing_comment_default = skipTrailingComment;
- }
-});
-
-// src/utils/get-next-non-space-non-comment-character-index.js
-function getNextNonSpaceNonCommentCharacterIndex(text, startIndex) {
- let oldIdx = null;
- let nextIdx = startIndex;
- while (nextIdx !== oldIdx) {
- oldIdx = nextIdx;
- nextIdx = skipSpaces(text, nextIdx);
- nextIdx = skip_inline_comment_default(text, nextIdx);
- nextIdx = skip_trailing_comment_default(text, nextIdx);
- nextIdx = skip_newline_default(text, nextIdx);
- }
- return nextIdx;
-}
-var get_next_non_space_non_comment_character_index_default;
-var init_get_next_non_space_non_comment_character_index = __esm({
- "src/utils/get-next-non-space-non-comment-character-index.js"() {
- init_skip();
- init_skip_inline_comment();
- init_skip_newline();
- init_skip_trailing_comment();
- get_next_non_space_non_comment_character_index_default = getNextNonSpaceNonCommentCharacterIndex;
- }
-});
-
-// src/utils/has-newline.js
-function hasNewline(text, startIndex, options = {}) {
- const idx = skipSpaces(
- text,
- options.backwards ? startIndex - 1 : startIndex,
- options
- );
- const idx2 = skip_newline_default(text, idx, options);
- return idx !== idx2;
-}
-var has_newline_default;
-var init_has_newline = __esm({
- "src/utils/has-newline.js"() {
- init_skip();
- init_skip_newline();
- has_newline_default = hasNewline;
- }
-});
-
-// src/utils/is-next-line-empty.js
-function isNextLineEmpty(text, startIndex) {
- let oldIdx = null;
- let idx = startIndex;
- while (idx !== oldIdx) {
- oldIdx = idx;
- idx = skipToLineEnd(text, idx);
- idx = skip_inline_comment_default(text, idx);
- idx = skipSpaces(text, idx);
- }
- idx = skip_trailing_comment_default(text, idx);
- idx = skip_newline_default(text, idx);
- return idx !== false && has_newline_default(text, idx);
-}
-var is_next_line_empty_default;
-var init_is_next_line_empty = __esm({
- "src/utils/is-next-line-empty.js"() {
- init_has_newline();
- init_skip();
- init_skip_inline_comment();
- init_skip_newline();
- init_skip_trailing_comment();
- is_next_line_empty_default = isNextLineEmpty;
- }
-});
-
-// src/utils/is-previous-line-empty.js
-function isPreviousLineEmpty(text, startIndex) {
- let idx = startIndex - 1;
- idx = skipSpaces(text, idx, { backwards: true });
- idx = skip_newline_default(text, idx, { backwards: true });
- idx = skipSpaces(text, idx, { backwards: true });
- const idx2 = skip_newline_default(text, idx, { backwards: true });
- return idx !== idx2;
-}
-var is_previous_line_empty_default;
-var init_is_previous_line_empty = __esm({
- "src/utils/is-previous-line-empty.js"() {
- init_skip();
- init_skip_newline();
- is_previous_line_empty_default = isPreviousLineEmpty;
- }
-});
-
-// src/main/comments/utils.js
-function describeNodeForDebugging(node) {
- const nodeType = node.type || node.kind || "(unknown type)";
- let nodeName = String(
- node.name || node.id && (typeof node.id === "object" ? node.id.name : node.id) || node.key && (typeof node.key === "object" ? node.key.name : node.key) || node.value && (typeof node.value === "object" ? "" : String(node.value)) || node.operator || ""
- );
- if (nodeName.length > 20) {
- nodeName = nodeName.slice(0, 19) + "\u2026";
- }
- return nodeType + (nodeName ? " " + nodeName : "");
-}
-function addCommentHelper(node, comment) {
- const comments = node.comments ?? (node.comments = []);
- comments.push(comment);
- comment.printed = false;
- comment.nodeDescription = describeNodeForDebugging(node);
-}
-function addLeadingComment(node, comment) {
- comment.leading = true;
- comment.trailing = false;
- addCommentHelper(node, comment);
-}
-function addDanglingComment(node, comment, marker) {
- comment.leading = false;
- comment.trailing = false;
- if (marker) {
- comment.marker = marker;
- }
- addCommentHelper(node, comment);
-}
-function addTrailingComment(node, comment) {
- comment.leading = false;
- comment.trailing = true;
- addCommentHelper(node, comment);
-}
-var init_utils = __esm({
- "src/main/comments/utils.js"() {
- }
-});
-
-// src/utils/get-alignment-size.js
-function getAlignmentSize(text, tabWidth, startIndex = 0) {
- let size = 0;
- for (let i = startIndex; i < text.length; ++i) {
- if (text[i] === " ") {
- size = size + tabWidth - size % tabWidth;
- } else {
- size++;
- }
- }
- return size;
-}
-var get_alignment_size_default;
-var init_get_alignment_size = __esm({
- "src/utils/get-alignment-size.js"() {
- get_alignment_size_default = getAlignmentSize;
- }
-});
-
-// src/utils/get-indent-size.js
-function getIndentSize(value, tabWidth) {
- const lastNewlineIndex = value.lastIndexOf("\n");
- if (lastNewlineIndex === -1) {
- return 0;
- }
- return get_alignment_size_default(
- // All the leading whitespaces
- value.slice(lastNewlineIndex + 1).match(/^[\t ]*/u)[0],
- tabWidth
- );
-}
-var get_indent_size_default;
-var init_get_indent_size = __esm({
- "src/utils/get-indent-size.js"() {
- init_get_alignment_size();
- get_indent_size_default = getIndentSize;
- }
-});
-
-// node_modules/escape-string-regexp/index.js
-function escapeStringRegexp(string) {
- if (typeof string !== "string") {
- throw new TypeError("Expected a string");
- }
- return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
-}
-var init_escape_string_regexp = __esm({
- "node_modules/escape-string-regexp/index.js"() {
- }
-});
-
-// src/utils/get-max-continuous-count.js
-function getMaxContinuousCount(text, searchString) {
- const results = text.match(
- new RegExp(`(${escapeStringRegexp(searchString)})+`, "gu")
- );
- if (results === null) {
- return 0;
- }
- return results.reduce(
- (maxCount, result) => Math.max(maxCount, result.length / searchString.length),
- 0
- );
-}
-var get_max_continuous_count_default;
-var init_get_max_continuous_count = __esm({
- "src/utils/get-max-continuous-count.js"() {
- init_escape_string_regexp();
- get_max_continuous_count_default = getMaxContinuousCount;
- }
-});
-
-// src/utils/get-next-non-space-non-comment-character.js
-function getNextNonSpaceNonCommentCharacter(text, startIndex) {
- const index = get_next_non_space_non_comment_character_index_default(text, startIndex);
- return index === false ? "" : text.charAt(index);
-}
-var get_next_non_space_non_comment_character_default;
-var init_get_next_non_space_non_comment_character = __esm({
- "src/utils/get-next-non-space-non-comment-character.js"() {
- init_get_next_non_space_non_comment_character_index();
- get_next_non_space_non_comment_character_default = getNextNonSpaceNonCommentCharacter;
- }
-});
-
-// src/utils/get-preferred-quote.js
-function getPreferredQuote(text, preferredQuoteOrPreferSingleQuote) {
- const preferred = preferredQuoteOrPreferSingleQuote === true || preferredQuoteOrPreferSingleQuote === SINGLE_QUOTE ? SINGLE_QUOTE : DOUBLE_QUOTE;
- const alternate = preferred === SINGLE_QUOTE ? DOUBLE_QUOTE : SINGLE_QUOTE;
- let preferredQuoteCount = 0;
- let alternateQuoteCount = 0;
- for (const character of text) {
- if (character === preferred) {
- preferredQuoteCount++;
- } else if (character === alternate) {
- alternateQuoteCount++;
- }
- }
- return preferredQuoteCount > alternateQuoteCount ? alternate : preferred;
-}
-var SINGLE_QUOTE, DOUBLE_QUOTE, get_preferred_quote_default;
-var init_get_preferred_quote = __esm({
- "src/utils/get-preferred-quote.js"() {
- SINGLE_QUOTE = "'";
- DOUBLE_QUOTE = '"';
- get_preferred_quote_default = getPreferredQuote;
- }
-});
-
-// node_modules/emoji-regex/index.mjs
-var emoji_regex_default;
-var init_emoji_regex = __esm({
- "node_modules/emoji-regex/index.mjs"() {
- emoji_regex_default = () => {
- return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
- };
- }
-});
-
-// node_modules/get-east-asian-width/lookup.js
-function isFullWidth(x) {
- return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
-}
-function isWide(x) {
- return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
-}
-var init_lookup = __esm({
- "node_modules/get-east-asian-width/lookup.js"() {
- }
-});
-
-// node_modules/get-east-asian-width/index.js
-var _isNarrowWidth;
-var init_get_east_asian_width = __esm({
- "node_modules/get-east-asian-width/index.js"() {
- init_lookup();
- _isNarrowWidth = (codePoint) => !(isFullWidth(codePoint) || isWide(codePoint));
- }
-});
-
-// src/utils/get-string-width.js
-function getStringWidth(text) {
- if (!text) {
- return 0;
- }
- if (!notAsciiRegex.test(text)) {
- return text.length;
- }
- text = text.replace(emoji_regex_default(), " ");
- let width = 0;
- for (const character of text) {
- const codePoint = character.codePointAt(0);
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
- continue;
- }
- if (codePoint >= 768 && codePoint <= 879) {
- continue;
- }
- width += _isNarrowWidth(codePoint) ? 1 : 2;
- }
- return width;
-}
-var notAsciiRegex, get_string_width_default;
-var init_get_string_width = __esm({
- "src/utils/get-string-width.js"() {
- init_emoji_regex();
- init_get_east_asian_width();
- notAsciiRegex = /[^\x20-\x7F]/u;
- get_string_width_default = getStringWidth;
- }
-});
-
-// src/utils/has-newline-in-range.js
-function hasNewlineInRange(text, startIndex, endIndex) {
- for (let i = startIndex; i < endIndex; ++i) {
- if (text.charAt(i) === "\n") {
- return true;
- }
- }
- return false;
-}
-var has_newline_in_range_default;
-var init_has_newline_in_range = __esm({
- "src/utils/has-newline-in-range.js"() {
- has_newline_in_range_default = hasNewlineInRange;
- }
-});
-
-// src/utils/has-spaces.js
-function hasSpaces(text, startIndex, options = {}) {
- const idx = skipSpaces(
- text,
- options.backwards ? startIndex - 1 : startIndex,
- options
- );
- return idx !== startIndex;
-}
-var has_spaces_default;
-var init_has_spaces = __esm({
- "src/utils/has-spaces.js"() {
- init_skip();
- has_spaces_default = hasSpaces;
- }
-});
-
-// scripts/build/shims/string-replace-all.js
-var stringReplaceAll, string_replace_all_default;
-var init_string_replace_all = __esm({
- "scripts/build/shims/string-replace-all.js"() {
- stringReplaceAll = (isOptionalObject, original, pattern, replacement) => {
- if (isOptionalObject && (original === void 0 || original === null)) {
- return;
- }
- if (original.replaceAll) {
- return original.replaceAll(pattern, replacement);
- }
- if (pattern.global) {
- return original.replace(pattern, replacement);
- }
- return original.split(pattern).join(replacement);
- };
- string_replace_all_default = stringReplaceAll;
- }
-});
-
-// src/utils/make-string.js
-function makeString(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
- const otherQuote = enclosingQuote === '"' ? "'" : '"';
- const regex = /\\(.)|(["'])/gsu;
- const raw = string_replace_all_default(
- /* isOptionalObject */
- false,
- rawText,
- regex,
- (match, escaped, quote) => {
- if (escaped === otherQuote) {
- return escaped;
- }
- if (quote === enclosingQuote) {
- return "\\" + quote;
- }
- if (quote) {
- return quote;
- }
- return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(escaped) ? escaped : "\\" + escaped;
- }
- );
- return enclosingQuote + raw + enclosingQuote;
-}
-var make_string_default;
-var init_make_string = __esm({
- "src/utils/make-string.js"() {
- init_string_replace_all();
- make_string_default = makeString;
- }
-});
-
-// src/utils/public.js
-var public_exports = {};
-__export(public_exports, {
- addDanglingComment: () => addDanglingComment,
- addLeadingComment: () => addLeadingComment,
- addTrailingComment: () => addTrailingComment,
- getAlignmentSize: () => get_alignment_size_default,
- getIndentSize: () => get_indent_size_default,
- getMaxContinuousCount: () => get_max_continuous_count_default,
- getNextNonSpaceNonCommentCharacter: () => get_next_non_space_non_comment_character_default,
- getNextNonSpaceNonCommentCharacterIndex: () => getNextNonSpaceNonCommentCharacterIndex2,
- getPreferredQuote: () => get_preferred_quote_default,
- getStringWidth: () => get_string_width_default,
- hasNewline: () => has_newline_default,
- hasNewlineInRange: () => has_newline_in_range_default,
- hasSpaces: () => has_spaces_default,
- isNextLineEmpty: () => isNextLineEmpty2,
- isNextLineEmptyAfterIndex: () => is_next_line_empty_default,
- isPreviousLineEmpty: () => isPreviousLineEmpty2,
- makeString: () => make_string_default,
- skip: () => skip,
- skipEverythingButNewLine: () => skipEverythingButNewLine,
- skipInlineComment: () => skip_inline_comment_default,
- skipNewline: () => skip_newline_default,
- skipSpaces: () => skipSpaces,
- skipToLineEnd: () => skipToLineEnd,
- skipTrailingComment: () => skip_trailing_comment_default,
- skipWhitespace: () => skipWhitespace
-});
-function legacyGetNextNonSpaceNonCommentCharacterIndex(text, node, locEnd) {
- return get_next_non_space_non_comment_character_index_default(
- text,
- locEnd(node)
- );
-}
-function getNextNonSpaceNonCommentCharacterIndex2(text, startIndex) {
- return arguments.length === 2 || typeof startIndex === "number" ? get_next_non_space_non_comment_character_index_default(text, startIndex) : (
- // @ts-expect-error -- expected
- // eslint-disable-next-line prefer-rest-params
- legacyGetNextNonSpaceNonCommentCharacterIndex(...arguments)
- );
-}
-function legacyIsPreviousLineEmpty(text, node, locStart) {
- return is_previous_line_empty_default(text, locStart(node));
-}
-function isPreviousLineEmpty2(text, startIndex) {
- return arguments.length === 2 || typeof startIndex === "number" ? is_previous_line_empty_default(text, startIndex) : (
- // @ts-expect-error -- expected
- // eslint-disable-next-line prefer-rest-params
- legacyIsPreviousLineEmpty(...arguments)
- );
-}
-function legacyIsNextLineEmpty(text, node, locEnd) {
- return is_next_line_empty_default(text, locEnd(node));
-}
-function isNextLineEmpty2(text, startIndex) {
- return arguments.length === 2 || typeof startIndex === "number" ? is_next_line_empty_default(text, startIndex) : (
- // @ts-expect-error -- expected
- // eslint-disable-next-line prefer-rest-params
- legacyIsNextLineEmpty(...arguments)
- );
-}
-var init_public = __esm({
- "src/utils/public.js"() {
- init_get_next_non_space_non_comment_character_index();
- init_is_next_line_empty();
- init_is_previous_line_empty();
- init_utils();
- init_get_alignment_size();
- init_get_indent_size();
- init_get_max_continuous_count();
- init_get_next_non_space_non_comment_character();
- init_get_preferred_quote();
- init_get_string_width();
- init_has_newline();
- init_has_newline_in_range();
- init_has_spaces();
- init_make_string();
- init_skip();
- init_skip_inline_comment();
- init_skip_newline();
- init_skip_trailing_comment();
- }
-});
-
-// src/main/version.evaluate.js
-var version_evaluate_exports = {};
-__export(version_evaluate_exports, {
- default: () => version_evaluate_default
-});
-var version_evaluate_default;
-var init_version_evaluate = __esm({
- "src/main/version.evaluate.js"() {
- version_evaluate_default = "3.6.2";
- }
-});
-
-// src/index.cjs
-var prettierPromise = import("./index.mjs");
-var functionNames = [
- "formatWithCursor",
- "format",
- "check",
- "resolveConfig",
- "resolveConfigFile",
- "clearConfigCache",
- "getFileInfo",
- "getSupportInfo"
-];
-var prettier = /* @__PURE__ */ Object.create(null);
-for (const name of functionNames) {
- prettier[name] = async (...args) => {
- const prettier2 = await prettierPromise;
- return prettier2[name](...args);
- };
-}
-var debugApiFunctionNames = [
- "parse",
- "formatAST",
- "formatDoc",
- "printToDoc",
- "printDocToString"
-];
-var debugApis = /* @__PURE__ */ Object.create(null);
-for (const name of debugApiFunctionNames) {
- debugApis[name] = async (...args) => {
- const prettier2 = await prettierPromise;
- return prettier2.__debug[name](...args);
- };
-}
-prettier.__debug = debugApis;
-if (true) {
- prettier.util = (init_public(), __toCommonJS(public_exports));
- prettier.doc = require("./doc.js");
- prettier.version = (init_version_evaluate(), __toCommonJS(version_evaluate_exports)).default;
-} else {
- Object.defineProperties(prettier, {
- util: {
- get() {
- try {
- return null;
- } catch {
- }
- throw new Error(
- "prettier.util is not available in development CommonJS version"
- );
- }
- },
- doc: {
- get() {
- try {
- return null;
- } catch {
- }
- throw new Error(
- "prettier.doc is not available in development CommonJS version"
- );
- }
- }
- });
- prettier.version = null.version;
-}
-module.exports = prettier;
diff --git a/node_modules/prettier/index.d.ts b/node_modules/prettier/index.d.ts
deleted file mode 100644
index b66e93e..0000000
--- a/node_modules/prettier/index.d.ts
+++ /dev/null
@@ -1,962 +0,0 @@
-// Copied from `@types/prettier`
-// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/5bb07fc4b087cb7ee91084afa6fe750551a7bbb1/types/prettier/index.d.ts
-
-// Minimum TypeScript Version: 4.2
-
-// Add `export {}` here to shut off automatic exporting from index.d.ts. There
-// are quite a few utility types here that don't need to be shipped with the
-// exported module.
-export {};
-
-import { builders, printer, utils } from "./doc.js";
-
-export namespace doc {
- export { builders, printer, utils };
-}
-
-// This utility is here to handle the case where you have an explicit union
-// between string literals and the generic string type. It would normally
-// resolve out to just the string type, but this generic LiteralUnion maintains
-// the intellisense of the original union.
-//
-// It comes from this issue: microsoft/TypeScript#29729:
-// https://github.com/microsoft/TypeScript/issues/29729#issuecomment-700527227
-export type LiteralUnion =
- | T
- | (Pick & { _?: never | undefined });
-
-export type AST = any;
-export type Doc = doc.builders.Doc;
-
-// The type of elements that make up the given array T.
-type ArrayElement = T extends Array ? E : never;
-
-// A union of the properties of the given object that are arrays.
-type ArrayProperties = {
- [K in keyof T]: NonNullable extends readonly any[] ? K : never;
-}[keyof T];
-
-// A union of the properties of the given array T that can be used to index it.
-// If the array is a tuple, then that's going to be the explicit indices of the
-// array, otherwise it's going to just be number.
-type IndexProperties =
- IsTuple extends true ? Exclude["length"], T["length"]> : number;
-
-// Effectively performing T[P], except that it's telling TypeScript that it's
-// safe to do this for tuples, arrays, or objects.
-type IndexValue = T extends any[]
- ? P extends number
- ? T[P]
- : never
- : P extends keyof T
- ? T[P]
- : never;
-
-// Determines if an object T is an array like string[] (in which case this
-// evaluates to false) or a tuple like [string] (in which case this evaluates to
-// true).
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-type IsTuple = T extends []
- ? true
- : T extends [infer First, ...infer Remain]
- ? IsTuple
- : false;
-
-type CallProperties = T extends any[] ? IndexProperties : keyof T;
-type IterProperties = T extends any[]
- ? IndexProperties
- : ArrayProperties;
-
-type CallCallback = (path: AstPath, index: number, value: any) => U;
-type EachCallback = (
- path: AstPath>,
- index: number,
- value: any,
-) => void;
-type MapCallback = (
- path: AstPath>,
- index: number,
- value: any,
-) => U;
-
-// https://github.com/prettier/prettier/blob/next/src/common/ast-path.js
-export class AstPath {
- constructor(value: T);
-
- get key(): string | null;
- get index(): number | null;
- get node(): T;
- get parent(): T | null;
- get grandparent(): T | null;
- get isInArray(): boolean;
- get siblings(): T[] | null;
- get next(): T | null;
- get previous(): T | null;
- get isFirst(): boolean;
- get isLast(): boolean;
- get isRoot(): boolean;
- get root(): T;
- get ancestors(): T[];
-
- stack: T[];
-
- callParent(callback: (path: this) => U, count?: number): U;
-
- /**
- * @deprecated Please use `AstPath#key` or `AstPath#index`
- */
- getName(): PropertyKey | null;
-
- /**
- * @deprecated Please use `AstPath#node` or `AstPath#siblings`
- */
- getValue(): T;
-
- getNode(count?: number): T | null;
-
- getParentNode(count?: number): T | null;
-
- match(
- ...predicates: Array<
- (node: any, name: string | null, number: number | null) => boolean
- >
- ): boolean;
-
- // For each of the tree walk functions (call, each, and map) this provides 5
- // strict type signatures, along with a fallback at the end if you end up
- // calling more than 5 properties deep. This helps a lot with typing because
- // for the majority of cases you're calling fewer than 5 properties, so the
- // tree walk functions have a clearer understanding of what you're doing.
- //
- // Note that resolving these types is somewhat complicated, and it wasn't
- // even supported until TypeScript 4.2 (before it would just say that the
- // type instantiation was excessively deep and possibly infinite).
-
- call(callback: CallCallback): U;
- call>(
- callback: CallCallback, U>,
- prop1: P1,
- ): U;
- call>(
- callback: CallCallback, P2>, U>,
- prop1: P1,
- prop2: P2,
- ): U;
- call<
- U,
- P1 extends keyof T,
- P2 extends CallProperties,
- P3 extends CallProperties>,
- >(
- callback: CallCallback<
- IndexValue, P2>, P3>,
- U
- >,
- prop1: P1,
- prop2: P2,
- prop3: P3,
- ): U;
- call<
- U,
- P1 extends keyof T,
- P2 extends CallProperties,
- P3 extends CallProperties>,
- P4 extends CallProperties, P3>>,
- >(
- callback: CallCallback<
- IndexValue, P2>, P3>, P4>,
- U
- >,
- prop1: P1,
- prop2: P2,
- prop3: P3,
- prop4: P4,
- ): U;
- call(
- callback: CallCallback,
- prop1: P,
- prop2: P,
- prop3: P,
- prop4: P,
- ...props: P[]
- ): U;
-
- each(callback: EachCallback): void;
- each>(
- callback: EachCallback>,
- prop1: P1,
- ): void;
- each>(
- callback: EachCallback, P2>>,
- prop1: P1,
- prop2: P2,
- ): void;
- each<
- P1 extends keyof T,
- P2 extends IterProperties,
- P3 extends IterProperties>,
- >(
- callback: EachCallback, P2>, P3>>,
- prop1: P1,
- prop2: P2,
- prop3: P3,
- ): void;
- each<
- P1 extends keyof T,
- P2 extends IterProperties,
- P3 extends IterProperties>,
- P4 extends IterProperties, P3>>,
- >(
- callback: EachCallback<
- IndexValue, P2>, P3>, P4>
- >,
- prop1: P1,
- prop2: P2,
- prop3: P3,
- prop4: P4,
- ): void;
- each(
- callback: EachCallback,
- prop1: PropertyKey,
- prop2: PropertyKey,
- prop3: PropertyKey,
- prop4: PropertyKey,
- ...props: PropertyKey[]
- ): void;
-
- map(callback: MapCallback): U[];
- map>(
- callback: MapCallback, U>,
- prop1: P1,
- ): U[];
- map>(
- callback: MapCallback, P2>, U>,
- prop1: P1,
- prop2: P2,
- ): U[];
- map<
- U,
- P1 extends keyof T,
- P2 extends IterProperties,
- P3 extends IterProperties>,
- >(
- callback: MapCallback, P2>, P3>, U>,
- prop1: P1,
- prop2: P2,
- prop3: P3,
- ): U[];
- map<
- U,
- P1 extends keyof T,
- P2 extends IterProperties,
- P3 extends IterProperties>,
- P4 extends IterProperties, P3>>,
- >(
- callback: MapCallback<
- IndexValue, P2>, P3>, P4>,
- U
- >,
- prop1: P1,
- prop2: P2,
- prop3: P3,
- prop4: P4,
- ): U[];
- map(
- callback: MapCallback,
- prop1: PropertyKey,
- prop2: PropertyKey,
- prop3: PropertyKey,
- prop4: PropertyKey,
- ...props: PropertyKey[]
- ): U[];
-}
-
-/** @deprecated `FastPath` was renamed to `AstPath` */
-export type FastPath = AstPath;
-
-export type BuiltInParser = (text: string, options?: any) => AST;
-export type BuiltInParserName =
- | "acorn"
- | "angular"
- | "babel-flow"
- | "babel-ts"
- | "babel"
- | "css"
- | "espree"
- | "flow"
- | "glimmer"
- | "graphql"
- | "html"
- | "json-stringify"
- | "json"
- | "json5"
- | "jsonc"
- | "less"
- | "lwc"
- | "markdown"
- | "mdx"
- | "meriyah"
- | "mjml"
- | "scss"
- | "typescript"
- | "vue"
- | "yaml";
-export type BuiltInParsers = Record;
-
-/**
- * For use in `.prettierrc.js`, `.prettierrc.ts`, `.prettierrc.cjs`, `.prettierrc.cts`, `prettierrc.mjs`, `prettierrc.mts`, `prettier.config.js`, `prettier.config.ts`, `prettier.config.cjs`, `prettier.config.cts`, `prettier.config.mjs`, `prettier.config.mts`
- */
-export interface Config extends Options {
- overrides?: Array<{
- files: string | string[];
- excludeFiles?: string | string[];
- options?: Options;
- }>;
-}
-
-export interface Options extends Partial {}
-
-export interface RequiredOptions extends doc.printer.Options {
- /**
- * Print semicolons at the ends of statements.
- * @default true
- */
- semi: boolean;
- /**
- * Use single quotes instead of double quotes.
- * @default false
- */
- singleQuote: boolean;
- /**
- * Use single quotes in JSX.
- * @default false
- */
- jsxSingleQuote: boolean;
- /**
- * Print trailing commas wherever possible.
- * @default "all"
- */
- trailingComma: "none" | "es5" | "all";
- /**
- * Print spaces between brackets in object literals.
- * @default true
- */
- bracketSpacing: boolean;
- /**
- * How to wrap object literals.
- * @default "preserve"
- */
- objectWrap: "preserve" | "collapse";
- /**
- * Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being
- * alone on the next line (does not apply to self closing elements).
- * @default false
- */
- bracketSameLine: boolean;
- /**
- * Format only a segment of a file.
- * @default 0
- */
- rangeStart: number;
- /**
- * Format only a segment of a file.
- * @default Number.POSITIVE_INFINITY
- */
- rangeEnd: number;
- /**
- * Specify which parser to use.
- */
- parser: LiteralUnion;
- /**
- * Specify the input filepath. This will be used to do parser inference.
- */
- filepath: string;
- /**
- * Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
- * This is very useful when gradually transitioning large, unformatted codebases to prettier.
- * @default false
- */
- requirePragma: boolean;
- /**
- * Prettier can insert a special @format marker at the top of files specifying that
- * the file has been formatted with prettier. This works well when used in tandem with
- * the --require-pragma option. If there is already a docblock at the top of
- * the file then this option will add a newline to it with the @format marker.
- * @default false
- */
- insertPragma: boolean;
- /**
- * Prettier can allow individual files to opt out of formatting if they contain a special comment, called a pragma, at the top of the file.
- * @default false
- */
- checkIgnorePragma: boolean;
- /**
- * By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
- * In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
- * @default "preserve"
- */
- proseWrap: "always" | "never" | "preserve";
- /**
- * Include parentheses around a sole arrow function parameter.
- * @default "always"
- */
- arrowParens: "avoid" | "always";
- /**
- * Provide ability to support new languages to prettier.
- */
- plugins: Array;
- /**
- * How to handle whitespaces in HTML.
- * @default "css"
- */
- htmlWhitespaceSensitivity: "css" | "strict" | "ignore";
- /**
- * Which end of line characters to apply.
- * @default "lf"
- */
- endOfLine: "auto" | "lf" | "crlf" | "cr";
- /**
- * Change when properties in objects are quoted.
- * @default "as-needed"
- */
- quoteProps: "as-needed" | "consistent" | "preserve";
- /**
- * Whether or not to indent the code inside