diff --git a/.bazelignore b/.bazelignore index 5f4685df7b52..377aaff5b603 100644 --- a/.bazelignore +++ b/.bazelignore @@ -35,10 +35,11 @@ integration/standalone-bootstrap/node_modules integration/terser/node_modules integration/trusted-types/node_modules integration/typings_test_rxjs7/node_modules -integration/typings_test_ts58/node_modules +integration/legacy-animations/node_modules +integration/legacy-animations-async/node_modules +integration/typings_test_ts59/node_modules modules/ssr-benchmarks/node_modules - # For rules_js adev/node_modules adev/shared-docs/node_modules @@ -61,7 +62,10 @@ packages/platform-server/node_modules packages/platform-browser-dynamic/node_modules packages/router/node_modules packages/zone.js/node_modules +packages/zone.js/test/typings/node_modules packages/upgrade/node_modules packages/benchpress/node_modules packages/service-worker/node_modules +packages/zone.js/test/typings/node_modules +packages/zone.js/node_modules tools/bazel/rules_angular_store/node_modules diff --git a/.bazelrc b/.bazelrc index 3c0d4583f82c..5f186c103ad1 100644 --- a/.bazelrc +++ b/.bazelrc @@ -12,6 +12,9 @@ common --@aspect_rules_ts//ts:default_to_tsc_transpiler # Needed as otherwise `env` of TS actions would be ignored. common --incompatible_merge_fixed_and_default_shell_env +# Frozen lockfile +common --lockfile_mode=error + ############################### # Filesystem interactions # ############################### @@ -166,8 +169,6 @@ test:saucelabs --flaky_test_attempts=1 # --ng_perf will ask the Ivy compiler to produce performance results for each build. build --flag_alias=ng_perf=//packages/compiler-cli:ng_perf -# --full_build_adev will run adev build/serve in a full mode, performing prerendering and DCE. -build --flag_alias=full_build_adev=//adev:full_build_adev #################################################### # User bazel configuration diff --git a/.bazelversion b/.bazelversion index f22d756da39d..e81e85b81044 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.5.0 +7.6.2 diff --git a/.github/actions/deploy-docs-site/BUILD.bazel b/.github/actions/deploy-docs-site/BUILD.bazel index 1b50399ed153..2c87772b1f38 100644 --- a/.github/actions/deploy-docs-site/BUILD.bazel +++ b/.github/actions/deploy-docs-site/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults2.bzl", "esbuild_checked_in", "ts_config", "ts_project") +load("//tools:defaults.bzl", "esbuild_checked_in", "ts_config", "ts_project") package(default_visibility = ["//.github/actions/deploy-docs-site:__subpackages__"]) @@ -12,6 +12,7 @@ esbuild_checked_in( entry_point = ":lib/main.mts", external = [ "undici", + "pnpapi", ], metafile = False, platform = "node", diff --git a/.github/actions/deploy-docs-site/lib/deploy.mts b/.github/actions/deploy-docs-site/lib/deploy.mts index afe44097913f..54ec964075b8 100644 --- a/.github/actions/deploy-docs-site/lib/deploy.mts +++ b/.github/actions/deploy-docs-site/lib/deploy.mts @@ -1,4 +1,4 @@ -import {cp, mkdtemp, readFile, rm, writeFile} from 'node:fs/promises'; +import {mkdtemp, readFile, rm, writeFile} from 'node:fs/promises'; import {Deployment} from './deployments.mjs'; import {join} from 'node:path'; @@ -9,7 +9,7 @@ import {getCredentialFilePath} from './credential.mjs'; export async function deployToFirebase( deployment: Deployment, configPath: string, - distDirPath: string, + stagingDir: string, ) { if (deployment.destination == undefined) { console.log(`No deployment necessary for docs created from: ${deployment.branch}`); @@ -18,37 +18,33 @@ export async function deployToFirebase( console.log('Preparing for deployment to firebase...'); - const tmpDeployDir = await mkdtemp(join(tmpdir(), 'deploy-directory')); - const deployConfigPath = join(tmpDeployDir, 'firebase.json'); + const deployConfigPath = join(stagingDir, 'firebase.json'); const config = JSON.parse(await readFile(configPath, {encoding: 'utf-8'})) as { hosting: {public: string}; }; - config['hosting']['public'] = './dist'; + config['hosting']['public'] = './browser'; await writeFile(deployConfigPath, JSON.stringify(config, null, 2)); - await cp(distDirPath, join(tmpDeployDir, 'dist'), {recursive: true}); - spawnSync(`chmod 777 -R ${tmpDeployDir}`, {encoding: 'utf-8', shell: true}); - firebase( `target:clear --config ${deployConfigPath} --project angular-dev-site hosting angular-docs`, - tmpDeployDir, + stagingDir, ); firebase( `target:apply --config ${deployConfigPath} --project angular-dev-site hosting angular-docs ${deployment.destination}`, - tmpDeployDir, + stagingDir, ); firebase( `deploy --config ${deployConfigPath} --project angular-dev-site --only hosting --non-interactive`, - tmpDeployDir, + stagingDir, ); firebase( `target:clear --config ${deployConfigPath} --project angular-dev-site hosting angular-docs`, - tmpDeployDir, + stagingDir, ); - await rm(tmpDeployDir, {recursive: true}); + await rm(stagingDir, {recursive: true}); } export async function setupRedirect(deployment: Deployment) { @@ -103,7 +99,7 @@ export async function setupRedirect(deployment: Deployment) { } function firebase(cmd: string, cwd?: string) { - spawnSync('npx', `-y firebase-tools@13.15.1 ${cmd}`.split(' '), { + const {status} = spawnSync('npx', `-y firebase-tools@13.15.1 ${cmd}`.split(' '), { cwd, encoding: 'utf-8', shell: true, @@ -113,4 +109,8 @@ function firebase(cmd: string, cwd?: string) { GOOGLE_APPLICATION_CREDENTIALS: getCredentialFilePath(), }, }); + if (status !== 0) { + console.error('Firebase command failed, see log above for details.'); + process.exit(status ?? undefined); + } } diff --git a/.github/actions/deploy-docs-site/lib/deployments.mts b/.github/actions/deploy-docs-site/lib/deployments.mts index 2690ca34726a..f1c974ab8926 100644 --- a/.github/actions/deploy-docs-site/lib/deployments.mts +++ b/.github/actions/deploy-docs-site/lib/deployments.mts @@ -9,6 +9,7 @@ export interface Deployment { to: string; }; destination?: string; + servingUrl: string; } export type Deployments = Map; @@ -31,6 +32,7 @@ export async function getDeployments(): Promise { docSites.set(branch.name, { branch: branch.name, destination: `v${branch.version.major}-angular-dev`, + servingUrl: `https://v${branch.version.major}.angular.dev/`, }); }); @@ -40,12 +42,14 @@ export async function getDeployments(): Promise { from: `v${releaseTrains.latest.version.major}-angular-dev`, to: 'https://angular.dev', }, + servingUrl: 'https://angular.dev/', destination: 'angular-dev-site', }); if (releaseTrains.releaseCandidate) { docSites.set(releaseTrains.next.branchName, { branch: releaseTrains.next.branchName, + servingUrl: 'https://next.angular.dev/', }); docSites.set(releaseTrains.releaseCandidate.branchName, { @@ -55,11 +59,13 @@ export async function getDeployments(): Promise { from: `v${releaseTrains.releaseCandidate.version.major}-angular-dev`, to: 'https://next.angular.dev', }, + servingUrl: 'https://next.angular.dev/', }); } else { docSites.set(releaseTrains.next.branchName, { branch: releaseTrains.next.branchName, destination: 'next-angular-dev', + servingUrl: 'https://next.angular.dev/', }); } diff --git a/.github/actions/deploy-docs-site/lib/main.mts b/.github/actions/deploy-docs-site/lib/main.mts index 45a7a070c77d..a8677de254bd 100644 --- a/.github/actions/deploy-docs-site/lib/main.mts +++ b/.github/actions/deploy-docs-site/lib/main.mts @@ -2,8 +2,13 @@ import {getInput, setFailed} from '@actions/core'; import {context} from '@actions/github'; import {deployToFirebase, setupRedirect} from './deploy.mjs'; import {getDeployments} from './deployments.mjs'; +import {generateSitemap} from './sitemap.mjs'; import {AuthenticatedGitClient, GithubConfig, setConfig} from '@angular/ng-dev'; import {githubReleaseTrainReadToken} from './credential.mjs'; +import {spawnSync} from 'child_process'; +import {cp, mkdtemp} from 'fs/promises'; +import {tmpdir} from 'os'; +import {join} from 'path'; const refMatcher = /refs\/heads\/(.*)/; @@ -28,7 +33,11 @@ async function deployDocs() { const currentBranch = matchedRef[1]; const configPath = getInput('configPath'); - const distDir = getInput('distDir'); + const stagingDir = await mkdtemp(join(tmpdir(), 'deploy-directory')); + + // Copy all files from the distDir into stagingDir and modify the permissions for editing + await cp(getInput('distDir'), stagingDir, {recursive: true}); + spawnSync(`chmod 777 -R ${stagingDir}`, {encoding: 'utf-8', shell: true}); const deployment = (await getDeployments()).get(currentBranch); if (deployment === undefined) { @@ -57,7 +66,8 @@ async function deployDocs() { console.log(` To: ${deployment.redirect.to}`); } - await deployToFirebase(deployment, configPath, distDir); + await generateSitemap(deployment, stagingDir); + await deployToFirebase(deployment, configPath, stagingDir); await setupRedirect(deployment); } diff --git a/.github/actions/deploy-docs-site/lib/sitemap.mts b/.github/actions/deploy-docs-site/lib/sitemap.mts new file mode 100644 index 000000000000..19bec71e4e1e --- /dev/null +++ b/.github/actions/deploy-docs-site/lib/sitemap.mts @@ -0,0 +1,33 @@ +import {Deployment} from './deployments.mjs'; +import {join} from 'path'; +import {readFileSync, writeFileSync} from 'fs'; + +export async function generateSitemap(deployment: Deployment, distDir: string) { + const servingUrlWithoutEndingSlash = deployment.servingUrl.endsWith('/') + ? deployment.servingUrl.slice(0, -1) + : deployment.servingUrl; + + /** Timestamp string used to of the last file update. */ + const lastModifiedTimestamp = new Date().toISOString(); + /** An object containing all of the routes available within the application. */ + const routes = JSON.parse(readFileSync(join(distDir, 'prerendered-routes.json'), 'utf-8')); + /** The generated sitemap string. */ + const sitemap = ` + + ${Object.keys(routes.routes) + .map((route) => { + const routeWithoutLeadingSlash = route.startsWith('/') ? route.slice(1) : route; + return ` + + ${servingUrlWithoutEndingSlash}/${routeWithoutLeadingSlash} + ${lastModifiedTimestamp} + daily + 1.0 + + `; + }) + .join('')} + `; + writeFileSync(join(distDir, 'browser', 'sitemap.xml'), sitemap, 'utf-8'); + console.log(`Generated sitemap with ${Object.keys(routes.routes).length} entries.`); +} diff --git a/.github/actions/deploy-docs-site/main.js b/.github/actions/deploy-docs-site/main.js index f3e713154cc6..cf4781ce6397 100644 --- a/.github/actions/deploy-docs-site/main.js +++ b/.github/actions/deploy-docs-site/main.js @@ -6,15 +6,23 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; -var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { - get: (a, b) => (typeof require !== "undefined" ? require : a)[b] -}) : x)(function(x) { - if (typeof require !== "undefined") return require.apply(this, arguments); - throw Error('Dynamic require of "' + x + '" is not supported'); +var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, { + get: (a7, b3) => (typeof require !== "undefined" ? require : a7)[b3] +}) : x2)(function(x2) { + if (typeof require !== "undefined") + return require.apply(this, arguments); + throw Error('Dynamic require of "' + x2 + '" is not supported'); }); +var __esm = (fn2, res) => function __init() { + return fn2 && (res = (0, fn2[__getOwnPropNames(fn2)[0]])(fn2 = 0)), res; +}; var __commonJS = (cb, mod) => function __require2() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; +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)) @@ -68,29 +76,34 @@ var require_utils = __commonJS({ var require_command = __commonJS({ ""(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + var desc = Object.getOwnPropertyDescriptor(m8, k3); + if (!desc || ("get" in desc ? !m8.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { - return m[k]; + return m8[k3]; } }; } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; + Object.defineProperty(o8, k22, desc); + } : function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + o8[k22] = m8[k3]; }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o8, v4) { + Object.defineProperty(o8, "default", { enumerable: true, value: v4 }); + } : function(o8, v4) { + o8["default"] = v4; }); var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; + if (mod && mod.__esModule) + return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k3 in mod) + if (k3 !== "default" && Object.prototype.hasOwnProperty.call(mod, k3)) + __createBinding(result, mod, k3); } __setModuleDefault(result, mod); return result; @@ -141,11 +154,11 @@ var require_command = __commonJS({ return cmdStr; } }; - function escapeData(s) { - return (0, utils_1.toCommandValue)(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A"); + function escapeData(s5) { + return (0, utils_1.toCommandValue)(s5).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A"); } - function escapeProperty(s) { - return (0, utils_1.toCommandValue)(s).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C"); + function escapeProperty(s5) { + return (0, utils_1.toCommandValue)(s5).replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C"); } } }); @@ -154,29 +167,34 @@ var require_command = __commonJS({ var require_file_command = __commonJS({ ""(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + var desc = Object.getOwnPropertyDescriptor(m8, k3); + if (!desc || ("get" in desc ? !m8.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { - return m[k]; + return m8[k3]; } }; } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; + Object.defineProperty(o8, k22, desc); + } : function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + o8[k22] = m8[k3]; }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o8, v4) { + Object.defineProperty(o8, "default", { enumerable: true, value: v4 }); + } : function(o8, v4) { + o8["default"] = v4; }); var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; + if (mod && mod.__esModule) + return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k3 in mod) + if (k3 !== "default" && Object.prototype.hasOwnProperty.call(mod, k3)) + __createBinding(result, mod, k3); } __setModuleDefault(result, mod); return result; @@ -269,8 +287,8 @@ var require_proxy = __commonJS({ if (typeof reqPort === "number") { upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); } - for (const upperNoProxyItem of noProxy.split(",").map((x) => x.trim().toUpperCase()).filter((x) => x)) { - if (upperNoProxyItem === "*" || upperReqHosts.some((x) => x === upperNoProxyItem || x.endsWith(`.${upperNoProxyItem}`) || upperNoProxyItem.startsWith(".") && x.endsWith(`${upperNoProxyItem}`))) { + for (const upperNoProxyItem of noProxy.split(",").map((x2) => x2.trim().toUpperCase()).filter((x2) => x2)) { + if (upperNoProxyItem === "*" || upperReqHosts.some((x2) => x2 === upperNoProxyItem || x2.endsWith(`.${upperNoProxyItem}`) || upperNoProxyItem.startsWith(".") && x2.endsWith(`${upperNoProxyItem}`))) { return true; } } @@ -345,10 +363,10 @@ var require_tunnel = __commonJS({ self2.sockets = []; self2.on("free", function onFree(socket, host, port, localAddress) { var options2 = toOptions(host, port, localAddress); - for (var i = 0, len = self2.requests.length; i < len; ++i) { - var pending = self2.requests[i]; + for (var i6 = 0, len = self2.requests.length; i6 < len; ++i6) { + var pending = self2.requests[i6]; if (pending.host === options2.host && pending.port === options2.port) { - self2.requests.splice(i, 1); + self2.requests.splice(i6, 1); pending.request.onSocket(socket); return; } @@ -494,14 +512,14 @@ var require_tunnel = __commonJS({ return host; } function mergeOptions(target) { - for (var i = 1, len = arguments.length; i < len; ++i) { - var overrides = arguments[i]; + for (var i6 = 1, len = arguments.length; i6 < len; ++i6) { + var overrides = arguments[i6]; if (typeof overrides === "object") { var keys = Object.keys(overrides); - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j]; - if (overrides[k] !== void 0) { - target[k] = overrides[k]; + for (var j2 = 0, keyLen = keys.length; j2 < keyLen; ++j2) { + var k3 = keys[j2]; + if (overrides[k3] !== void 0) { + target[k3] = overrides[k3]; } } } @@ -529,8 +547,8 @@ var require_tunnel = __commonJS({ // var require_tunnel2 = __commonJS({ - ""(exports, module) { - module.exports = require_tunnel(); + ""(exports, module2) { + module2.exports = require_tunnel(); } }); @@ -538,52 +556,57 @@ var require_tunnel2 = __commonJS({ var require_lib = __commonJS({ ""(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + var desc = Object.getOwnPropertyDescriptor(m8, k3); + if (!desc || ("get" in desc ? !m8.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { - return m[k]; + return m8[k3]; } }; } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; + Object.defineProperty(o8, k22, desc); + } : function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + o8[k22] = m8[k3]; }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o8, v4) { + Object.defineProperty(o8, "default", { enumerable: true, value: v4 }); + } : function(o8, v4) { + o8["default"] = v4; }); var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; + if (mod && mod.__esModule) + return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k3 in mod) + if (k3 !== "default" && Object.prototype.hasOwnProperty.call(mod, k3)) + __createBinding(result, mod, k3); } __setModuleDefault(result, mod); return result; }; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P3, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { + return value instanceof P3 ? value : new P3(function(resolve) { resolve(value); }); } - return new (P || (P = Promise))(function(resolve, reject) { + return new (P3 || (P3 = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function rejected(value) { try { step(generator["throw"](value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function step(result) { @@ -1107,9 +1130,9 @@ var require_lib = __commonJS({ } function dateTimeDeserializer(key, value) { if (typeof value === "string") { - const a = new Date(value); - if (!isNaN(a.valueOf())) { - return a; + const a7 = new Date(value); + if (!isNaN(a7.valueOf())) { + return a7; } } return value; @@ -1149,7 +1172,7 @@ var require_lib = __commonJS({ } }; exports.HttpClient = HttpClient; - var lowercaseKeys2 = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + var lowercaseKeys2 = (obj) => Object.keys(obj).reduce((c3, k3) => (c3[k3.toLowerCase()] = obj[k3], c3), {}); } }); @@ -1157,25 +1180,25 @@ var require_lib = __commonJS({ var require_auth = __commonJS({ ""(exports) { "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P3, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { + return value instanceof P3 ? value : new P3(function(resolve) { resolve(value); }); } - return new (P || (P = Promise))(function(resolve, reject) { + return new (P3 || (P3 = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function rejected(value) { try { step(generator["throw"](value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function step(result) { @@ -1261,25 +1284,25 @@ var require_auth = __commonJS({ var require_oidc_utils = __commonJS({ ""(exports) { "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P3, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { + return value instanceof P3 ? value : new P3(function(resolve) { resolve(value); }); } - return new (P || (P = Promise))(function(resolve, reject) { + return new (P3 || (P3 = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function rejected(value) { try { step(generator["throw"](value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function step(result) { @@ -1359,25 +1382,25 @@ var require_oidc_utils = __commonJS({ var require_summary = __commonJS({ ""(exports) { "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P3, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { + return value instanceof P3 ? value : new P3(function(resolve) { resolve(value); }); } - return new (P || (P = Promise))(function(resolve, reject) { + return new (P3 || (P3 = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function rejected(value) { try { step(generator["throw"](value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function step(result) { @@ -1653,29 +1676,34 @@ var require_summary = __commonJS({ var require_path_utils = __commonJS({ ""(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + var desc = Object.getOwnPropertyDescriptor(m8, k3); + if (!desc || ("get" in desc ? !m8.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { - return m[k]; + return m8[k3]; } }; } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; + Object.defineProperty(o8, k22, desc); + } : function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + o8[k22] = m8[k3]; }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o8, v4) { + Object.defineProperty(o8, "default", { enumerable: true, value: v4 }); + } : function(o8, v4) { + o8["default"] = v4; }); var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; + if (mod && mod.__esModule) + return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k3 in mod) + if (k3 !== "default" && Object.prototype.hasOwnProperty.call(mod, k3)) + __createBinding(result, mod, k3); } __setModuleDefault(result, mod); return result; @@ -1702,48 +1730,53 @@ var require_path_utils = __commonJS({ var require_io_util = __commonJS({ ""(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + Object.defineProperty(o8, k22, { enumerable: true, get: function() { + return m8[k3]; } }); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; + } : function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + o8[k22] = m8[k3]; }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o8, v4) { + Object.defineProperty(o8, "default", { enumerable: true, value: v4 }); + } : function(o8, v4) { + o8["default"] = v4; }); var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; + if (mod && mod.__esModule) + return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k3 in mod) + if (k3 !== "default" && Object.hasOwnProperty.call(mod, k3)) + __createBinding(result, mod, k3); } __setModuleDefault(result, mod); return result; }; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P3, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { + return value instanceof P3 ? value : new P3(function(resolve) { resolve(value); }); } - return new (P || (P = Promise))(function(resolve, reject) { + return new (P3 || (P3 = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function rejected(value) { try { step(generator["throw"](value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function step(result) { @@ -1782,15 +1815,15 @@ var require_io_util = __commonJS({ }); } exports.isDirectory = isDirectory; - function isRooted(p) { - p = normalizeSeparators(p); - if (!p) { + function isRooted(p5) { + p5 = normalizeSeparators(p5); + if (!p5) { throw new Error('isRooted() parameter "p" cannot be empty'); } if (exports.IS_WINDOWS) { - return p.startsWith("\\") || /^[A-Z]:/i.test(p); + return p5.startsWith("\\") || /^[A-Z]:/i.test(p5); } - return p.startsWith("/"); + return p5.startsWith("/"); } exports.isRooted = isRooted; function tryGetExecutablePath(filePath, extensions) { @@ -1852,13 +1885,13 @@ var require_io_util = __commonJS({ }); } exports.tryGetExecutablePath = tryGetExecutablePath; - function normalizeSeparators(p) { - p = p || ""; + function normalizeSeparators(p5) { + p5 = p5 || ""; if (exports.IS_WINDOWS) { - p = p.replace(/\//g, "\\"); - return p.replace(/\\\\+/g, "\\"); + p5 = p5.replace(/\//g, "\\"); + return p5.replace(/\\\\+/g, "\\"); } - return p.replace(/\/\/+/g, "/"); + return p5.replace(/\/\/+/g, "/"); } function isUnixExecutable(stats) { return (stats.mode & 1) > 0 || (stats.mode & 8) > 0 && stats.gid === process.getgid() || (stats.mode & 64) > 0 && stats.uid === process.getuid(); @@ -1875,48 +1908,53 @@ var require_io_util = __commonJS({ var require_io = __commonJS({ ""(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + Object.defineProperty(o8, k22, { enumerable: true, get: function() { + return m8[k3]; } }); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; + } : function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + o8[k22] = m8[k3]; }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o8, v4) { + Object.defineProperty(o8, "default", { enumerable: true, value: v4 }); + } : function(o8, v4) { + o8["default"] = v4; }); var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; + if (mod && mod.__esModule) + return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k3 in mod) + if (k3 !== "default" && Object.hasOwnProperty.call(mod, k3)) + __createBinding(result, mod, k3); } __setModuleDefault(result, mod); return result; }; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P3, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { + return value instanceof P3 ? value : new P3(function(resolve) { resolve(value); }); } - return new (P || (P = Promise))(function(resolve, reject) { + return new (P3 || (P3 = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function rejected(value) { try { step(generator["throw"](value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function step(result) { @@ -2054,9 +2092,9 @@ var require_io = __commonJS({ } const directories = []; if (process.env.PATH) { - for (const p of process.env.PATH.split(path.delimiter)) { - if (p) { - directories.push(p); + for (const p5 of process.env.PATH.split(path.delimiter)) { + if (p5) { + directories.push(p5); } } } @@ -2103,8 +2141,8 @@ var require_io = __commonJS({ try { yield ioUtil.lstat(destFile); yield ioUtil.unlink(destFile); - } catch (e) { - if (e.code === "EPERM") { + } catch (e5) { + if (e5.code === "EPERM") { yield ioUtil.chmod(destFile, "0666"); yield ioUtil.unlink(destFile); } @@ -2123,48 +2161,53 @@ var require_io = __commonJS({ var require_toolrunner = __commonJS({ ""(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + Object.defineProperty(o8, k22, { enumerable: true, get: function() { + return m8[k3]; } }); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; + } : function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + o8[k22] = m8[k3]; }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o8, v4) { + Object.defineProperty(o8, "default", { enumerable: true, value: v4 }); + } : function(o8, v4) { + o8["default"] = v4; }); var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; + if (mod && mod.__esModule) + return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k3 in mod) + if (k3 !== "default" && Object.hasOwnProperty.call(mod, k3)) + __createBinding(result, mod, k3); } __setModuleDefault(result, mod); return result; }; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P3, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { + return value instanceof P3 ? value : new P3(function(resolve) { resolve(value); }); } - return new (P || (P = Promise))(function(resolve, reject) { + return new (P3 || (P3 = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function rejected(value) { try { step(generator["throw"](value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function step(result) { @@ -2205,39 +2248,39 @@ var require_toolrunner = __commonJS({ if (IS_WINDOWS) { if (this._isCmdFile()) { cmd += toolPath; - for (const a of args) { - cmd += ` ${a}`; + for (const a7 of args) { + cmd += ` ${a7}`; } } else if (options.windowsVerbatimArguments) { cmd += `"${toolPath}"`; - for (const a of args) { - cmd += ` ${a}`; + for (const a7 of args) { + cmd += ` ${a7}`; } } else { cmd += this._windowsQuoteCmdArg(toolPath); - for (const a of args) { - cmd += ` ${this._windowsQuoteCmdArg(a)}`; + for (const a7 of args) { + cmd += ` ${this._windowsQuoteCmdArg(a7)}`; } } } else { cmd += toolPath; - for (const a of args) { - cmd += ` ${a}`; + for (const a7 of args) { + cmd += ` ${a7}`; } } return cmd; } _processLineBuffer(data, strBuffer, onLine) { try { - let s = strBuffer + data.toString(); - let n = s.indexOf(os3.EOL); - while (n > -1) { - const line = s.substring(0, n); + let s5 = strBuffer + data.toString(); + let n3 = s5.indexOf(os3.EOL); + while (n3 > -1) { + const line = s5.substring(0, n3); onLine(line); - s = s.substring(n + os3.EOL.length); - n = s.indexOf(os3.EOL); + s5 = s5.substring(n3 + os3.EOL.length); + n3 = s5.indexOf(os3.EOL); } - return s; + return s5; } catch (err) { this._debug(`error processing line. Failed with error ${err}`); return ""; @@ -2255,9 +2298,9 @@ var require_toolrunner = __commonJS({ if (IS_WINDOWS) { if (this._isCmdFile()) { let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`; - for (const a of this.args) { + for (const a7 of this.args) { argline += " "; - argline += options.windowsVerbatimArguments ? a : this._windowsQuoteCmdArg(a); + argline += options.windowsVerbatimArguments ? a7 : this._windowsQuoteCmdArg(a7); } argline += '"'; return [argline]; @@ -2305,7 +2348,7 @@ var require_toolrunner = __commonJS({ ]; let needsQuotes = false; for (const char of arg) { - if (cmdSpecialChars.some((x) => x === char)) { + if (cmdSpecialChars.some((x2) => x2 === char)) { needsQuotes = true; break; } @@ -2315,11 +2358,11 @@ var require_toolrunner = __commonJS({ } let reverse = '"'; let quoteHit = true; - for (let i = arg.length; i > 0; i--) { - reverse += arg[i - 1]; - if (quoteHit && arg[i - 1] === "\\") { + for (let i6 = arg.length; i6 > 0; i6--) { + reverse += arg[i6 - 1]; + if (quoteHit && arg[i6 - 1] === "\\") { reverse += "\\"; - } else if (arg[i - 1] === '"') { + } else if (arg[i6 - 1] === '"') { quoteHit = true; reverse += '"'; } else { @@ -2341,11 +2384,11 @@ var require_toolrunner = __commonJS({ } let reverse = '"'; let quoteHit = true; - for (let i = arg.length; i > 0; i--) { - reverse += arg[i - 1]; - if (quoteHit && arg[i - 1] === "\\") { + for (let i6 = arg.length; i6 > 0; i6--) { + reverse += arg[i6 - 1]; + if (quoteHit && arg[i6 - 1] === "\\") { reverse += "\\"; - } else if (arg[i - 1] === '"') { + } else if (arg[i6 - 1] === '"') { quoteHit = true; reverse += "\\"; } else { @@ -2439,8 +2482,8 @@ var require_toolrunner = __commonJS({ this.options.listeners.stderr(data); } if (!optionsNonNull.silent && optionsNonNull.errStream && optionsNonNull.outStream) { - const s = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream; - s.write(data); + const s5 = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream; + s5.write(data); } errbuffer = this._processLineBuffer(data, errbuffer, (line) => { if (this.options.listeners && this.options.listeners.errline) { @@ -2498,39 +2541,39 @@ var require_toolrunner = __commonJS({ let inQuotes = false; let escaped = false; let arg = ""; - function append(c) { - if (escaped && c !== '"') { + function append(c3) { + if (escaped && c3 !== '"') { arg += "\\"; } - arg += c; + arg += c3; escaped = false; } - for (let i = 0; i < argString.length; i++) { - const c = argString.charAt(i); - if (c === '"') { + for (let i6 = 0; i6 < argString.length; i6++) { + const c3 = argString.charAt(i6); + if (c3 === '"') { if (!escaped) { inQuotes = !inQuotes; } else { - append(c); + append(c3); } continue; } - if (c === "\\" && escaped) { - append(c); + if (c3 === "\\" && escaped) { + append(c3); continue; } - if (c === "\\" && inQuotes) { + if (c3 === "\\" && inQuotes) { escaped = true; continue; } - if (c === " " && !inQuotes) { + if (c3 === " " && !inQuotes) { if (arg.length > 0) { args.push(arg); arg = ""; } continue; } - append(c); + append(c3); } if (arg.length > 0) { args.push(arg.trim()); @@ -2607,48 +2650,53 @@ var require_toolrunner = __commonJS({ var require_exec = __commonJS({ ""(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + Object.defineProperty(o8, k22, { enumerable: true, get: function() { + return m8[k3]; } }); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; + } : function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + o8[k22] = m8[k3]; }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o8, v4) { + Object.defineProperty(o8, "default", { enumerable: true, value: v4 }); + } : function(o8, v4) { + o8["default"] = v4; }); var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; + if (mod && mod.__esModule) + return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k3 in mod) + if (k3 !== "default" && Object.hasOwnProperty.call(mod, k3)) + __createBinding(result, mod, k3); } __setModuleDefault(result, mod); return result; }; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P3, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { + return value instanceof P3 ? value : new P3(function(resolve) { resolve(value); }); } - return new (P || (P = Promise))(function(resolve, reject) { + return new (P3 || (P3 = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function rejected(value) { try { step(generator["throw"](value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function step(result) { @@ -2660,16 +2708,16 @@ var require_exec = __commonJS({ Object.defineProperty(exports, "__esModule", { value: true }); exports.getExecOutput = exports.exec = void 0; var string_decoder_1 = __require("string_decoder"); - var tr = __importStar(require_toolrunner()); + var tr2 = __importStar(require_toolrunner()); function exec(commandLine, args, options) { return __awaiter(this, void 0, void 0, function* () { - const commandArgs = tr.argStringToArray(commandLine); + const commandArgs = tr2.argStringToArray(commandLine); if (commandArgs.length === 0) { throw new Error(`Parameter 'commandLine' cannot be null or empty.`); } const toolPath = commandArgs[0]; args = commandArgs.slice(1).concat(args || []); - const runner = new tr.ToolRunner(toolPath, args, options); + const runner = new tr2.ToolRunner(toolPath, args, options); return runner.exec(); }); } @@ -2714,52 +2762,57 @@ var require_exec = __commonJS({ var require_platform = __commonJS({ ""(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + var desc = Object.getOwnPropertyDescriptor(m8, k3); + if (!desc || ("get" in desc ? !m8.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { - return m[k]; + return m8[k3]; } }; } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; + Object.defineProperty(o8, k22, desc); + } : function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + o8[k22] = m8[k3]; }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o8, v4) { + Object.defineProperty(o8, "default", { enumerable: true, value: v4 }); + } : function(o8, v4) { + o8["default"] = v4; }); var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; + if (mod && mod.__esModule) + return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k3 in mod) + if (k3 !== "default" && Object.prototype.hasOwnProperty.call(mod, k3)) + __createBinding(result, mod, k3); } __setModuleDefault(result, mod); return result; }; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P3, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { + return value instanceof P3 ? value : new P3(function(resolve) { resolve(value); }); } - return new (P || (P = Promise))(function(resolve, reject) { + return new (P3 || (P3 = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function rejected(value) { try { step(generator["throw"](value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function step(result) { @@ -2833,52 +2886,57 @@ var require_platform = __commonJS({ var require_core = __commonJS({ ""(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + var desc = Object.getOwnPropertyDescriptor(m8, k3); + if (!desc || ("get" in desc ? !m8.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { - return m[k]; + return m8[k3]; } }; } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; + Object.defineProperty(o8, k22, desc); + } : function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + o8[k22] = m8[k3]; }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o8, v4) { + Object.defineProperty(o8, "default", { enumerable: true, value: v4 }); + } : function(o8, v4) { + o8["default"] = v4; }); var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; + if (mod && mod.__esModule) + return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k3 in mod) + if (k3 !== "default" && Object.prototype.hasOwnProperty.call(mod, k3)) + __createBinding(result, mod, k3); } __setModuleDefault(result, mod); return result; }; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P3, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { + return value instanceof P3 ? value : new P3(function(resolve) { resolve(value); }); } - return new (P || (P = Promise))(function(resolve, reject) { + return new (P3 || (P3 = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function rejected(value) { try { step(generator["throw"](value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function step(result) { @@ -2936,7 +2994,7 @@ var require_core = __commonJS({ } exports.getInput = getInput3; function getMultilineInput(name, options) { - const inputs = getInput3(name, options).split("\n").filter((x) => x !== ""); + const inputs = getInput3(name, options).split("\n").filter((x2) => x2 !== ""); if (options && options.trimWhitespace === false) { return inputs; } @@ -3005,12 +3063,12 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); (0, command_1.issue)("endgroup"); } exports.endGroup = endGroup; - function group(name, fn) { + function group(name, fn2) { return __awaiter(this, void 0, void 0, function* () { startGroup(name); let result; try { - result = yield fn(); + result = yield fn2(); } finally { endGroup(); } @@ -3121,52 +3179,57 @@ var require_context = __commonJS({ var require_utils2 = __commonJS({ ""(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + var desc = Object.getOwnPropertyDescriptor(m8, k3); + if (!desc || ("get" in desc ? !m8.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { - return m[k]; + return m8[k3]; } }; } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; + Object.defineProperty(o8, k22, desc); + } : function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + o8[k22] = m8[k3]; }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o8, v4) { + Object.defineProperty(o8, "default", { enumerable: true, value: v4 }); + } : function(o8, v4) { + o8["default"] = v4; }); var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; + if (mod && mod.__esModule) + return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k3 in mod) + if (k3 !== "default" && Object.prototype.hasOwnProperty.call(mod, k3)) + __createBinding(result, mod, k3); } __setModuleDefault(result, mod); return result; }; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P3, generator) { function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { + return value instanceof P3 ? value : new P3(function(resolve) { resolve(value); }); } - return new (P || (P = Promise))(function(resolve, reject) { + return new (P3 || (P3 = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function rejected(value) { try { step(generator["throw"](value)); - } catch (e) { - reject(e); + } catch (e5) { + reject(e5); } } function step(result) { @@ -3233,8 +3296,8 @@ var require_dist_node = __commonJS({ // var require_register = __commonJS({ - ""(exports, module) { - module.exports = register2; + ""(exports, module2) { + module2.exports = register2; function register2(state, name, method, options) { if (typeof method !== "function") { throw new Error("method for before hook must be a function"); @@ -3261,8 +3324,8 @@ var require_register = __commonJS({ // var require_add = __commonJS({ - ""(exports, module) { - module.exports = addHook2; + ""(exports, module2) { + module2.exports = addHook2; function addHook2(state, kind, name, hook2) { var orig = hook2; if (!state.registry[name]) { @@ -3301,8 +3364,8 @@ var require_add = __commonJS({ // var require_remove = __commonJS({ - ""(exports, module) { - module.exports = removeHook2; + ""(exports, module2) { + module2.exports = removeHook2; function removeHook2(state, name, method) { if (!state.registry[name]) { return; @@ -3320,7 +3383,7 @@ var require_remove = __commonJS({ // var require_before_after_hook = __commonJS({ - ""(exports, module) { + ""(exports, module2) { var register2 = require_register(); var addHook2 = require_add(); var removeHook2 = require_remove(); @@ -3367,22 +3430,22 @@ var require_before_after_hook = __commonJS({ } Hook.Singular = HookSingular.bind(); Hook.Collection = HookCollection.bind(); - module.exports = Hook; - module.exports.Hook = Hook; - module.exports.Singular = Hook.Singular; - module.exports.Collection = Hook.Collection; + module2.exports = Hook; + module2.exports.Hook = Hook; + module2.exports.Singular = Hook.Singular; + module2.exports.Collection = Hook.Collection; } }); // var require_dist_node2 = __commonJS({ - ""(exports, module) { + ""(exports, module2) { "use strict"; var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __export = (target, all) => { + var __export2 = (target, all) => { for (var name in all) __defProp2(target, name, { get: all[name], enumerable: true }); }; @@ -3396,10 +3459,10 @@ var require_dist_node2 = __commonJS({ }; var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; - __export(dist_src_exports, { + __export2(dist_src_exports, { endpoint: () => endpoint2 }); - module.exports = __toCommonJS(dist_src_exports); + module2.exports = __toCommonJS(dist_src_exports); var import_universal_user_agent5 = require_dist_node(); var VERSION9 = "9.0.6"; var userAgent2 = `octokit-endpoint.js/${VERSION9} ${(0, import_universal_user_agent5.getUserAgent)()}`; @@ -3499,7 +3562,7 @@ var require_dist_node2 = __commonJS({ if (!matches) { return []; } - return matches.map(removeNonChars2).reduce((a, b) => a.concat(b), []); + return matches.map(removeNonChars2).reduce((a7, b3) => a7.concat(b3), []); } function omit2(object, keysToOmit) { const result = { __proto__: null }; @@ -3519,8 +3582,8 @@ var require_dist_node2 = __commonJS({ }).join(""); } function encodeUnreserved2(str) { - return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { - return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + return encodeURIComponent(str).replace(/[!'()*]/g, function(c3) { + return "%" + c3.charCodeAt(0).toString(16).toUpperCase(); }); } function encodeValue2(operator, value, key) { @@ -3557,9 +3620,9 @@ var require_dist_node2 = __commonJS({ ); }); } else { - Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - result.push(encodeValue2(operator, value[k], k)); + Object.keys(value).forEach(function(k3) { + if (isDefined2(value[k3])) { + result.push(encodeValue2(operator, value[k3], k3)); } }); } @@ -3570,10 +3633,10 @@ var require_dist_node2 = __commonJS({ tmp.push(encodeValue2(operator, value2)); }); } else { - Object.keys(value).forEach(function(k) { - if (isDefined2(value[k])) { - tmp.push(encodeUnreserved2(k)); - tmp.push(encodeValue2(operator, value[k].toString())); + Object.keys(value).forEach(function(k3) { + if (isDefined2(value[k3])) { + tmp.push(encodeUnreserved2(k3)); + tmp.push(encodeValue2(operator, value[k3].toString())); } }); } @@ -3606,7 +3669,7 @@ var require_dist_node2 = __commonJS({ var operators = ["+", "#", ".", "/", ";", "?", "&"]; template = template.replace( /\{([^\{\}]+)\}|([^\{\}]+)/g, - function(_, expression, literal) { + function(_4, expression, literal) { if (expression) { let operator = ""; const values = []; @@ -3740,26 +3803,27 @@ var require_dist_node3 = __commonJS({ // var require_wrappy = __commonJS({ - ""(exports, module) { - module.exports = wrappy; - function wrappy(fn, cb) { - if (fn && cb) return wrappy(fn)(cb); - if (typeof fn !== "function") + ""(exports, module2) { + module2.exports = wrappy; + function wrappy(fn2, cb) { + if (fn2 && cb) + return wrappy(fn2)(cb); + if (typeof fn2 !== "function") throw new TypeError("need wrapper function"); - Object.keys(fn).forEach(function(k) { - wrapper[k] = fn[k]; + Object.keys(fn2).forEach(function(k3) { + wrapper[k3] = fn2[k3]; }); return wrapper; function wrapper() { var args = new Array(arguments.length); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; + for (var i6 = 0; i6 < args.length; i6++) { + args[i6] = arguments[i6]; } - var ret = fn.apply(this, args); + var ret = fn2.apply(this, args); var cb2 = args[args.length - 1]; if (typeof ret === "function" && ret !== cb2) { - Object.keys(cb2).forEach(function(k) { - ret[k] = cb2[k]; + Object.keys(cb2).forEach(function(k3) { + ret[k3] = cb2[k3]; }); } return ret; @@ -3770,10 +3834,10 @@ var require_wrappy = __commonJS({ // var require_once = __commonJS({ - ""(exports, module) { + ""(exports, module2) { var wrappy = require_wrappy(); - module.exports = wrappy(once); - module.exports.strict = wrappy(onceStrict); + module2.exports = wrappy(once); + module2.exports.strict = wrappy(onceStrict); once.proto = once(function() { Object.defineProperty(Function.prototype, "once", { value: function() { @@ -3788,33 +3852,34 @@ var require_once = __commonJS({ configurable: true }); }); - function once(fn) { - var f = function() { - if (f.called) return f.value; - f.called = true; - return f.value = fn.apply(this, arguments); + function once(fn2) { + var f6 = function() { + if (f6.called) + return f6.value; + f6.called = true; + return f6.value = fn2.apply(this, arguments); }; - f.called = false; - return f; - } - function onceStrict(fn) { - var f = function() { - if (f.called) - throw new Error(f.onceError); - f.called = true; - return f.value = fn.apply(this, arguments); + f6.called = false; + return f6; + } + function onceStrict(fn2) { + var f6 = function() { + if (f6.called) + throw new Error(f6.onceError); + f6.called = true; + return f6.value = fn2.apply(this, arguments); }; - var name = fn.name || "Function wrapped with `once`"; - f.onceError = name + " shouldn't be called more than once"; - f.called = false; - return f; + var name = fn2.name || "Function wrapped with `once`"; + f6.onceError = name + " shouldn't be called more than once"; + f6.called = false; + return f6; } } }); // var require_dist_node4 = __commonJS({ - ""(exports, module) { + ""(exports, module2) { "use strict"; var __create2 = Object.create; var __defProp2 = Object.defineProperty; @@ -3822,7 +3887,7 @@ var require_dist_node4 = __commonJS({ var __getOwnPropNames2 = Object.getOwnPropertyNames; var __getProtoOf2 = Object.getPrototypeOf; var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __export = (target, all) => { + var __export2 = (target, all) => { for (var name in all) __defProp2(target, name, { get: all[name], enumerable: true }); }; @@ -3844,10 +3909,10 @@ var require_dist_node4 = __commonJS({ )); var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; - __export(dist_src_exports, { + __export2(dist_src_exports, { RequestError: () => RequestError2 }); - module.exports = __toCommonJS(dist_src_exports); + module2.exports = __toCommonJS(dist_src_exports); var import_deprecation = require_dist_node3(); var import_once = __toESM2(require_once()); var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation)); @@ -3906,13 +3971,13 @@ var require_dist_node4 = __commonJS({ // var require_dist_node5 = __commonJS({ - ""(exports, module) { + ""(exports, module2) { "use strict"; var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __export = (target, all) => { + var __export2 = (target, all) => { for (var name in all) __defProp2(target, name, { get: all[name], enumerable: true }); }; @@ -3926,10 +3991,10 @@ var require_dist_node5 = __commonJS({ }; var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; - __export(dist_src_exports, { + __export2(dist_src_exports, { request: () => request2 }); - module.exports = __toCommonJS(dist_src_exports); + module2.exports = __toCommonJS(dist_src_exports); var import_endpoint2 = require_dist_node2(); var import_universal_user_agent5 = require_dist_node(); var VERSION9 = "8.4.1"; @@ -4116,13 +4181,13 @@ var require_dist_node5 = __commonJS({ // var require_dist_node6 = __commonJS({ - ""(exports, module) { + ""(exports, module2) { "use strict"; var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __export = (target, all) => { + var __export2 = (target, all) => { for (var name in all) __defProp2(target, name, { get: all[name], enumerable: true }); }; @@ -4136,12 +4201,12 @@ var require_dist_node6 = __commonJS({ }; var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var index_exports = {}; - __export(index_exports, { + __export2(index_exports, { GraphqlResponseError: () => GraphqlResponseError2, graphql: () => graphql22, withCustomRequest: () => withCustomRequest2 }); - module.exports = __toCommonJS(index_exports); + module2.exports = __toCommonJS(index_exports); var import_request32 = require_dist_node5(); var import_universal_user_agent5 = require_dist_node(); var VERSION9 = "7.1.1"; @@ -4149,7 +4214,7 @@ var require_dist_node6 = __commonJS({ var import_request5 = require_dist_node5(); function _buildMessageForResponseErrors2(data) { return `Request failed due to following response errors: -` + data.errors.map((e) => ` - ${e.message}`).join("\n"); +` + data.errors.map((e5) => ` - ${e5.message}`).join("\n"); } var GraphqlResponseError2 = class extends Error { constructor(request2, headers, response) { @@ -4184,7 +4249,8 @@ var require_dist_node6 = __commonJS({ ); } for (const key in options) { - if (!FORBIDDEN_VARIABLE_OPTIONS2.includes(key)) continue; + if (!FORBIDDEN_VARIABLE_OPTIONS2.includes(key)) + continue; return Promise.reject( new Error( `[@octokit/graphql] "${key}" cannot be used as variable name` @@ -4253,13 +4319,13 @@ var require_dist_node6 = __commonJS({ // var require_dist_node7 = __commonJS({ - ""(exports, module) { + ""(exports, module2) { "use strict"; var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __export = (target, all) => { + var __export2 = (target, all) => { for (var name in all) __defProp2(target, name, { get: all[name], enumerable: true }); }; @@ -4273,10 +4339,10 @@ var require_dist_node7 = __commonJS({ }; var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; - __export(dist_src_exports, { + __export2(dist_src_exports, { createTokenAuth: () => createTokenAuth3 }); - module.exports = __toCommonJS(dist_src_exports); + module2.exports = __toCommonJS(dist_src_exports); var REGEX_IS_INSTALLATION_LEGACY = /^v1\./; var REGEX_IS_INSTALLATION = /^ghs_/; var REGEX_IS_USER_TO_SERVER = /^ghu_/; @@ -4324,13 +4390,13 @@ var require_dist_node7 = __commonJS({ // var require_dist_node8 = __commonJS({ - ""(exports, module) { + ""(exports, module2) { "use strict"; var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __export = (target, all) => { + var __export2 = (target, all) => { for (var name in all) __defProp2(target, name, { get: all[name], enumerable: true }); }; @@ -4344,10 +4410,10 @@ var require_dist_node8 = __commonJS({ }; var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var index_exports = {}; - __export(index_exports, { + __export2(index_exports, { Octokit: () => Octokit3 }); - module.exports = __toCommonJS(index_exports); + module2.exports = __toCommonJS(index_exports); var import_universal_user_agent5 = require_dist_node(); var import_before_after_hook2 = require_before_after_hook(); var import_request5 = require_dist_node5(); @@ -4480,8 +4546,8 @@ var require_dist_node8 = __commonJS({ this.auth = auth2; } const classConstructor = this.constructor; - for (let i = 0; i < classConstructor.plugins.length; ++i) { - Object.assign(this, classConstructor.plugins[i](this, options)); + for (let i6 = 0; i6 < classConstructor.plugins.length; ++i6) { + Object.assign(this, classConstructor.plugins[i6](this, options)); } } }; @@ -4490,13 +4556,13 @@ var require_dist_node8 = __commonJS({ // var require_dist_node9 = __commonJS({ - ""(exports, module) { + ""(exports, module2) { "use strict"; var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __export = (target, all) => { + var __export2 = (target, all) => { for (var name in all) __defProp2(target, name, { get: all[name], enumerable: true }); }; @@ -4510,11 +4576,11 @@ var require_dist_node9 = __commonJS({ }; var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; - __export(dist_src_exports, { + __export2(dist_src_exports, { legacyRestEndpointMethods: () => legacyRestEndpointMethods2, restEndpointMethods: () => restEndpointMethods2 }); - module.exports = __toCommonJS(dist_src_exports); + module2.exports = __toCommonJS(dist_src_exports); var VERSION9 = "10.4.1"; var Endpoints2 = { actions: { @@ -6646,13 +6712,13 @@ var require_dist_node9 = __commonJS({ // var require_dist_node10 = __commonJS({ - ""(exports, module) { + ""(exports, module2) { "use strict"; var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __export = (target, all) => { + var __export2 = (target, all) => { for (var name in all) __defProp2(target, name, { get: all[name], enumerable: true }); }; @@ -6666,13 +6732,13 @@ var require_dist_node10 = __commonJS({ }; var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var dist_src_exports = {}; - __export(dist_src_exports, { + __export2(dist_src_exports, { composePaginateRest: () => composePaginateRest2, isPaginatingEndpoint: () => isPaginatingEndpoint, paginateRest: () => paginateRest2, paginatingEndpoints: () => paginatingEndpoints }); - module.exports = __toCommonJS(dist_src_exports); + module2.exports = __toCommonJS(dist_src_exports); var VERSION9 = "9.2.2"; function normalizePaginatedListResponse2(response) { if (!response.data) { @@ -7027,29 +7093,34 @@ var require_dist_node10 = __commonJS({ var require_utils3 = __commonJS({ ""(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + var desc = Object.getOwnPropertyDescriptor(m8, k3); + if (!desc || ("get" in desc ? !m8.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { - return m[k]; + return m8[k3]; } }; } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; + Object.defineProperty(o8, k22, desc); + } : function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + o8[k22] = m8[k3]; }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o8, v4) { + Object.defineProperty(o8, "default", { enumerable: true, value: v4 }); + } : function(o8, v4) { + o8["default"] = v4; }); var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; + if (mod && mod.__esModule) + return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k3 in mod) + if (k3 !== "default" && Object.prototype.hasOwnProperty.call(mod, k3)) + __createBinding(result, mod, k3); } __setModuleDefault(result, mod); return result; @@ -7087,29 +7158,34 @@ var require_utils3 = __commonJS({ var require_github = __commonJS({ ""(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + var desc = Object.getOwnPropertyDescriptor(m8, k3); + if (!desc || ("get" in desc ? !m8.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { - return m[k]; + return m8[k3]; } }; } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; + Object.defineProperty(o8, k22, desc); + } : function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + o8[k22] = m8[k3]; }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o8, v4) { + Object.defineProperty(o8, "default", { enumerable: true, value: v4 }); + } : function(o8, v4) { + o8["default"] = v4; }); var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; + if (mod && mod.__esModule) + return mod; var result = {}; if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + for (var k3 in mod) + if (k3 !== "default" && Object.prototype.hasOwnProperty.call(mod, k3)) + __createBinding(result, mod, k3); } __setModuleDefault(result, mod); return result; @@ -7129,7 +7205,7 @@ var require_github = __commonJS({ // var require_tmp = __commonJS({ - ""(exports, module) { + ""(exports, module2) { var fs = __require("fs"); var os3 = __require("os"); var path = __require("path"); @@ -7156,36 +7232,36 @@ var require_tmp = __commonJS({ } function tmpName(options, callback) { const args = _parseArguments(options, callback), opts = args[0], cb = args[1]; - try { - _assertAndSanitizeOptions(opts); - } catch (err) { - return cb(err); - } - let tries = opts.tries; - (function _getUniqueName() { - try { - const name = _generateTmpName(opts); - fs.stat(name, function(err) { - if (!err) { - if (tries-- > 0) return _getUniqueName(); - return cb(new Error("Could not get a unique tmp filename, max tries reached " + name)); - } - cb(null, name); - }); - } catch (err) { - cb(err); - } - })(); + _assertAndSanitizeOptions(opts, function(err, sanitizedOptions) { + if (err) + return cb(err); + let tries = sanitizedOptions.tries; + (function _getUniqueName() { + try { + const name = _generateTmpName(sanitizedOptions); + fs.stat(name, function(err2) { + if (!err2) { + if (tries-- > 0) + return _getUniqueName(); + return cb(new Error("Could not get a unique tmp filename, max tries reached " + name)); + } + cb(null, name); + }); + } catch (err2) { + cb(err2); + } + })(); + }); } function tmpNameSync(options) { const args = _parseArguments(options), opts = args[0]; - _assertAndSanitizeOptions(opts); - let tries = opts.tries; + const sanitizedOptions = _assertAndSanitizeOptionsSync(opts); + let tries = sanitizedOptions.tries; do { - const name = _generateTmpName(opts); + const name = _generateTmpName(sanitizedOptions); try { fs.statSync(name); - } catch (e) { + } catch (e5) { return name; } } while (tries-- > 0); @@ -7194,9 +7270,11 @@ var require_tmp = __commonJS({ function file(options, callback) { const args = _parseArguments(options, callback), opts = args[0], cb = args[1]; tmpName(opts, function _tmpNameCreated(err, name) { - if (err) return cb(err); + if (err) + return cb(err); fs.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err2, fd) { - if (err2) return cb(err2); + if (err2) + return cb(err2); if (opts.discardDescriptor) { return fs.close(fd, function _discardCallback(possibleErr) { return cb(possibleErr, name, void 0, _prepareTmpFileRemoveCallback(name, -1, opts, false)); @@ -7212,7 +7290,7 @@ var require_tmp = __commonJS({ const args = _parseArguments(options), opts = args[0]; const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor; const name = tmpNameSync(opts); - var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE); + let fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE); if (opts.discardDescriptor) { fs.closeSync(fd); fd = void 0; @@ -7226,9 +7304,11 @@ var require_tmp = __commonJS({ function dir(options, callback) { const args = _parseArguments(options, callback), opts = args[0], cb = args[1]; tmpName(opts, function _tmpNameCreated(err, name) { - if (err) return cb(err); + if (err) + return cb(err); fs.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err2) { - if (err2) return cb(err2); + if (err2) + return cb(err2); cb(null, name, _prepareTmpDirRemoveCallback(name, opts, false)); }); }); @@ -7253,19 +7333,23 @@ var require_tmp = __commonJS({ fs.close(fdPath[0], function() { fs.unlink(fdPath[1], _handler); }); - else fs.unlink(fdPath[1], _handler); + else + fs.unlink(fdPath[1], _handler); } function _removeFileSync(fdPath) { let rethrownException = null; try { - if (0 <= fdPath[0]) fs.closeSync(fdPath[0]); - } catch (e) { - if (!_isEBADF(e) && !_isENOENT(e)) throw e; + if (0 <= fdPath[0]) + fs.closeSync(fdPath[0]); + } catch (e5) { + if (!_isEBADF(e5) && !_isENOENT(e5)) + throw e5; } finally { try { fs.unlinkSync(fdPath[1]); - } catch (e) { - if (!_isENOENT(e)) rethrownException = e; + } catch (e5) { + if (!_isENOENT(e5)) + rethrownException = e5; } } if (rethrownException !== null) { @@ -7275,7 +7359,8 @@ var require_tmp = __commonJS({ function _prepareTmpFileRemoveCallback(name, fd, opts, sync) { const removeCallbackSync = _prepareRemoveCallback(_removeFileSync, [fd, name], sync); const removeCallback = _prepareRemoveCallback(_removeFileAsync, [fd, name], sync, removeCallbackSync); - if (!opts.keep) _removeObjects.unshift(removeCallbackSync); + if (!opts.keep) + _removeObjects.unshift(removeCallbackSync); return sync ? removeCallbackSync : removeCallback; } function _prepareTmpDirRemoveCallback(name, opts, sync) { @@ -7283,7 +7368,8 @@ var require_tmp = __commonJS({ const removeFunctionSync = opts.unsafeCleanup ? FN_RIMRAF_SYNC : FN_RMDIR_SYNC; const removeCallbackSync = _prepareRemoveCallback(removeFunctionSync, name, sync); const removeCallback = _prepareRemoveCallback(removeFunction, name, sync, removeCallbackSync); - if (!opts.keep) _removeObjects.unshift(removeCallbackSync); + if (!opts.keep) + _removeObjects.unshift(removeCallbackSync); return sync ? removeCallbackSync : removeCallback; } function _prepareRemoveCallback(removeFunction, fileOrDirName, sync, cleanupCallbackSync) { @@ -7292,7 +7378,8 @@ var require_tmp = __commonJS({ if (!called) { const toRemove = cleanupCallbackSync || _cleanupCallback; const index = _removeObjects.indexOf(toRemove); - if (index >= 0) _removeObjects.splice(index, 1); + if (index >= 0) + _removeObjects.splice(index, 1); called = true; if (sync || removeFunction === FN_RMDIR_SYNC || removeFunction === FN_RIMRAF_SYNC) { return removeFunction(fileOrDirName); @@ -7304,11 +7391,12 @@ var require_tmp = __commonJS({ }; } function _garbageCollector() { - if (!_gracefulCleanup) return; + if (!_gracefulCleanup) + return; while (_removeObjects.length) { try { _removeObjects[0](); - } catch (e) { + } catch (e5) { } } } @@ -7316,17 +7404,14 @@ var require_tmp = __commonJS({ let value = [], rnd = null; try { rnd = crypto.randomBytes(howMany); - } catch (e) { + } catch (e5) { rnd = crypto.pseudoRandomBytes(howMany); } - for (var i = 0; i < howMany; i++) { - value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]); + for (let i6 = 0; i6 < howMany; i6++) { + value.push(RANDOM_CHARS[rnd[i6] % RANDOM_CHARS.length]); } return value.join(""); } - function _isBlank(s) { - return s === null || _isUndefined(s) || !s.trim(); - } function _isUndefined(obj) { return typeof obj === "undefined"; } @@ -7343,12 +7428,38 @@ var require_tmp = __commonJS({ } return [actualOptions, callback]; } + function _resolvePath(name, tmpDir, cb) { + const pathToResolve = path.isAbsolute(name) ? name : path.join(tmpDir, name); + fs.stat(pathToResolve, function(err) { + if (err) { + fs.realpath(path.dirname(pathToResolve), function(err2, parentDir) { + if (err2) + return cb(err2); + cb(null, path.join(parentDir, path.basename(pathToResolve))); + }); + } else { + fs.realpath(pathToResolve, cb); + } + }); + } + function _resolvePathSync(name, tmpDir) { + const pathToResolve = path.isAbsolute(name) ? name : path.join(tmpDir, name); + try { + fs.statSync(pathToResolve); + return fs.realpathSync(pathToResolve); + } catch (_err) { + const parentDir = fs.realpathSync(path.dirname(pathToResolve)); + return path.join(parentDir, path.basename(pathToResolve)); + } + } function _generateTmpName(opts) { const tmpDir = opts.tmpdir; - if (!_isUndefined(opts.name)) + if (!_isUndefined(opts.name)) { return path.join(tmpDir, opts.dir, opts.name); - if (!_isUndefined(opts.template)) + } + if (!_isUndefined(opts.template)) { return path.join(tmpDir, opts.dir, opts.template).replace(TEMPLATE_PATTERN, _randomChars(6)); + } const name = [ opts.prefix ? opts.prefix : "tmp", "-", @@ -7359,54 +7470,82 @@ var require_tmp = __commonJS({ ].join(""); return path.join(tmpDir, opts.dir, name); } - function _assertAndSanitizeOptions(options) { - options.tmpdir = _getTmpDir(options); - const tmpDir = options.tmpdir; - if (!_isUndefined(options.name)) - _assertIsRelative(options.name, "name", tmpDir); - if (!_isUndefined(options.dir)) - _assertIsRelative(options.dir, "dir", tmpDir); - if (!_isUndefined(options.template)) { - _assertIsRelative(options.template, "template", tmpDir); - if (!options.template.match(TEMPLATE_PATTERN)) - throw new Error(`Invalid template, found "${options.template}".`); - } - if (!_isUndefined(options.tries) && isNaN(options.tries) || options.tries < 0) + function _assertOptionsBase(options) { + if (!_isUndefined(options.name)) { + const name = options.name; + if (path.isAbsolute(name)) + throw new Error(`name option must not contain an absolute path, found "${name}".`); + const basename = path.basename(name); + if (basename === ".." || basename === "." || basename !== name) + throw new Error(`name option must not contain a path, found "${name}".`); + } + if (!_isUndefined(options.template) && !options.template.match(TEMPLATE_PATTERN)) { + throw new Error(`Invalid template, found "${options.template}".`); + } + if (!_isUndefined(options.tries) && isNaN(options.tries) || options.tries < 0) { throw new Error(`Invalid tries, found "${options.tries}".`); + } options.tries = _isUndefined(options.name) ? options.tries || DEFAULT_TRIES : 1; options.keep = !!options.keep; options.detachDescriptor = !!options.detachDescriptor; options.discardDescriptor = !!options.discardDescriptor; options.unsafeCleanup = !!options.unsafeCleanup; - options.dir = _isUndefined(options.dir) ? "" : path.relative(tmpDir, _resolvePath(options.dir, tmpDir)); - options.template = _isUndefined(options.template) ? void 0 : path.relative(tmpDir, _resolvePath(options.template, tmpDir)); - options.template = _isBlank(options.template) ? void 0 : path.relative(options.dir, options.template); - options.name = _isUndefined(options.name) ? void 0 : options.name; options.prefix = _isUndefined(options.prefix) ? "" : options.prefix; options.postfix = _isUndefined(options.postfix) ? "" : options.postfix; } - function _resolvePath(name, tmpDir) { - if (name.startsWith(tmpDir)) { - return path.resolve(name); - } else { - return path.resolve(path.join(tmpDir, name)); - } + function _getRelativePath(option, name, tmpDir, cb) { + if (_isUndefined(name)) + return cb(null); + _resolvePath(name, tmpDir, function(err, resolvedPath) { + if (err) + return cb(err); + const relativePath = path.relative(tmpDir, resolvedPath); + if (!resolvedPath.startsWith(tmpDir)) { + return cb(new Error(`${option} option must be relative to "${tmpDir}", found "${relativePath}".`)); + } + cb(null, relativePath); + }); } - function _assertIsRelative(name, option, tmpDir) { - if (option === "name") { - if (path.isAbsolute(name)) - throw new Error(`${option} option must not contain an absolute path, found "${name}".`); - let basename = path.basename(name); - if (basename === ".." || basename === "." || basename !== name) - throw new Error(`${option} option must not contain a path, found "${name}".`); - } else { - if (path.isAbsolute(name) && !name.startsWith(tmpDir)) { - throw new Error(`${option} option must be relative to "${tmpDir}", found "${name}".`); - } - let resolvedPath = _resolvePath(name, tmpDir); - if (!resolvedPath.startsWith(tmpDir)) - throw new Error(`${option} option must be relative to "${tmpDir}", found "${resolvedPath}".`); - } + function _getRelativePathSync(option, name, tmpDir) { + if (_isUndefined(name)) + return; + const resolvedPath = _resolvePathSync(name, tmpDir); + const relativePath = path.relative(tmpDir, resolvedPath); + if (!resolvedPath.startsWith(tmpDir)) { + throw new Error(`${option} option must be relative to "${tmpDir}", found "${relativePath}".`); + } + return relativePath; + } + function _assertAndSanitizeOptions(options, cb) { + _getTmpDir(options, function(err, tmpDir) { + if (err) + return cb(err); + options.tmpdir = tmpDir; + try { + _assertOptionsBase(options, tmpDir); + } catch (err2) { + return cb(err2); + } + _getRelativePath("dir", options.dir, tmpDir, function(err2, dir2) { + if (err2) + return cb(err2); + options.dir = _isUndefined(dir2) ? "" : dir2; + _getRelativePath("template", options.template, tmpDir, function(err3, template) { + if (err3) + return cb(err3); + options.template = template; + cb(null, options); + }); + }); + }); + } + function _assertAndSanitizeOptionsSync(options) { + const tmpDir = options.tmpdir = _getTmpDirSync(options); + _assertOptionsBase(options, tmpDir); + const dir2 = _getRelativePathSync("dir", options.dir, tmpDir); + options.dir = _isUndefined(dir2) ? "" : dir2; + options.template = _getRelativePathSync("template", options.template, tmpDir); + return options; } function _isEBADF(error) { return _isExpectedError(error, -EBADF, "EBADF"); @@ -7420,3000 +7559,11082 @@ var require_tmp = __commonJS({ function setGracefulCleanup() { _gracefulCleanup = true; } - function _getTmpDir(options) { - return path.resolve(options && options.tmpdir || os3.tmpdir()); + function _getTmpDir(options, cb) { + return fs.realpath(options && options.tmpdir || os3.tmpdir(), cb); + } + function _getTmpDirSync(options) { + return fs.realpathSync(options && options.tmpdir || os3.tmpdir()); } process.addListener(EXIT, _garbageCollector); - Object.defineProperty(module.exports, "tmpdir", { + Object.defineProperty(module2.exports, "tmpdir", { enumerable: true, configurable: false, get: function() { - return _getTmpDir(); + return _getTmpDirSync(); } }); - module.exports.dir = dir; - module.exports.dirSync = dirSync; - module.exports.file = file; - module.exports.fileSync = fileSync2; - module.exports.tmpName = tmpName; - module.exports.tmpNameSync = tmpNameSync; - module.exports.setGracefulCleanup = setGracefulCleanup; + module2.exports.dir = dir; + module2.exports.dirSync = dirSync; + module2.exports.file = file; + module2.exports.fileSync = fileSync2; + module2.exports.tmpName = tmpName; + module2.exports.tmpNameSync = tmpNameSync; + module2.exports.setGracefulCleanup = setGracefulCleanup; } }); // -var require_constants = __commonJS({ - ""(exports, module) { +var require_array = __commonJS({ + ""(exports) { "use strict"; - var SEMVER_SPEC_VERSION = "2.0.0"; - var MAX_LENGTH = 256; - var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */ - 9007199254740991; - var MAX_SAFE_COMPONENT_LENGTH = 16; - var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6; - var RELEASE_TYPES = [ - "major", - "premajor", - "minor", - "preminor", - "patch", - "prepatch", - "prerelease" - ]; - module.exports = { - MAX_LENGTH, - MAX_SAFE_COMPONENT_LENGTH, - MAX_SAFE_BUILD_LENGTH, - MAX_SAFE_INTEGER, - RELEASE_TYPES, - SEMVER_SPEC_VERSION, - FLAG_INCLUDE_PRERELEASE: 1, - FLAG_LOOSE: 2 - }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.splitWhen = exports.flatten = void 0; + function flatten(items) { + return items.reduce((collection, item) => [].concat(collection, item), []); + } + exports.flatten = flatten; + function splitWhen(items, predicate) { + const result = [[]]; + let groupIndex = 0; + for (const item of items) { + if (predicate(item)) { + groupIndex++; + result[groupIndex] = []; + } else { + result[groupIndex].push(item); + } + } + return result; + } + exports.splitWhen = splitWhen; } }); // -var require_debug = __commonJS({ - ""(exports, module) { +var require_errno = __commonJS({ + ""(exports) { "use strict"; - var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => { - }; - module.exports = debug; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.isEnoentCodeError = void 0; + function isEnoentCodeError(error) { + return error.code === "ENOENT"; + } + exports.isEnoentCodeError = isEnoentCodeError; } }); // -var require_re = __commonJS({ - ""(exports, module) { +var require_fs = __commonJS({ + ""(exports) { "use strict"; - var { - MAX_SAFE_COMPONENT_LENGTH, - MAX_SAFE_BUILD_LENGTH, - MAX_LENGTH - } = require_constants(); - var debug = require_debug(); - exports = module.exports = {}; - var re = exports.re = []; - var safeRe = exports.safeRe = []; - var src = exports.src = []; - var safeSrc = exports.safeSrc = []; - var t = exports.t = {}; - var R = 0; - var LETTERDASHNUMBER = "[a-zA-Z0-9-]"; - var safeRegexReplacements = [ - ["\\s", 1], - ["\\d", MAX_LENGTH], - [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH] - ]; - var makeSafeRegex = (value) => { - for (const [token, max] of safeRegexReplacements) { - value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createDirentFromStats = void 0; + var DirentFromStats = class { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); } - return value; - }; - var createToken = (name, value, isGlobal) => { - const safe = makeSafeRegex(value); - const index = R++; - debug(name, index, value); - t[name] = index; - src[index] = value; - safeSrc[index] = safe; - re[index] = new RegExp(value, isGlobal ? "g" : void 0); - safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0); }; - createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*"); - createToken("NUMERICIDENTIFIERLOOSE", "\\d+"); - createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`); - createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`); - createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`); - createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`); - createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`); - createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`); - createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`); - createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`); - createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`); - createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`); - createToken("FULL", `^${src[t.FULLPLAIN]}$`); - createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`); - createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`); - createToken("GTLT", "((?:<|>)?=?)"); - createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`); - createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`); - createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`); - createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`); - createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`); - createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`); - createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`); - createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`); - createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`); - createToken("COERCERTL", src[t.COERCE], true); - createToken("COERCERTLFULL", src[t.COERCEFULL], true); - createToken("LONETILDE", "(?:~>?)"); - createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true); - exports.tildeTrimReplace = "$1~"; - createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`); - createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`); - createToken("LONECARET", "(?:\\^)"); - createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true); - exports.caretTrimReplace = "$1^"; - createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`); - createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`); - createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`); - createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`); - createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true); - exports.comparatorTrimReplace = "$1$2$3"; - createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`); - createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`); - createToken("STAR", "(<|>)?=?\\s*\\*"); - createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"); - createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$"); + function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); + } + exports.createDirentFromStats = createDirentFromStats; } }); // -var require_parse_options = __commonJS({ - ""(exports, module) { +var require_path = __commonJS({ + ""(exports) { "use strict"; - var looseOption = Object.freeze({ loose: true }); - var emptyOpts = Object.freeze({}); - var parseOptions = (options) => { - if (!options) { - return emptyOpts; - } - if (typeof options !== "object") { - return looseOption; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0; + var os3 = __require("os"); + var path = __require("path"); + var IS_WINDOWS_PLATFORM = os3.platform() === "win32"; + var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; + var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g; + var WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g; + var DOS_DEVICE_PATH_RE = /^\\\\([.?])/; + var WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g; + function unixify(filepath) { + return filepath.replace(/\\/g, "/"); + } + exports.unixify = unixify; + function makeAbsolute(cwd, filepath) { + return path.resolve(cwd, filepath); + } + exports.makeAbsolute = makeAbsolute; + function removeLeadingDotSegment(entry) { + if (entry.charAt(0) === ".") { + const secondCharactery = entry.charAt(1); + if (secondCharactery === "/" || secondCharactery === "\\") { + return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT); + } } - return options; - }; - module.exports = parseOptions; + return entry; + } + exports.removeLeadingDotSegment = removeLeadingDotSegment; + exports.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath; + function escapeWindowsPath(pattern) { + return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2"); + } + exports.escapeWindowsPath = escapeWindowsPath; + function escapePosixPath(pattern) { + return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2"); + } + exports.escapePosixPath = escapePosixPath; + exports.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern; + function convertWindowsPathToPattern(filepath) { + return escapeWindowsPath(filepath).replace(DOS_DEVICE_PATH_RE, "//$1").replace(WINDOWS_BACKSLASHES_RE, "/"); + } + exports.convertWindowsPathToPattern = convertWindowsPathToPattern; + function convertPosixPathToPattern(filepath) { + return escapePosixPath(filepath); + } + exports.convertPosixPathToPattern = convertPosixPathToPattern; } }); // -var require_identifiers = __commonJS({ - ""(exports, module) { - "use strict"; - var numeric = /^[0-9]+$/; - var compareIdentifiers = (a, b) => { - const anum = numeric.test(a); - const bnum = numeric.test(b); - if (anum && bnum) { - a = +a; - b = +b; +var require_is_extglob = __commonJS({ + ""(exports, module2) { + module2.exports = function isExtglob(str) { + if (typeof str !== "string" || str === "") { + return false; } - return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1; - }; - var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a); - module.exports = { - compareIdentifiers, - rcompareIdentifiers + var match; + while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) { + if (match[2]) + return true; + str = str.slice(match.index + match[0].length); + } + return false; }; } }); // -var require_semver = __commonJS({ - ""(exports, module) { - "use strict"; - var debug = require_debug(); - var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants(); - var { safeRe: re, t } = require_re(); - var parseOptions = require_parse_options(); - var { compareIdentifiers } = require_identifiers(); - var SemVer = class _SemVer { - constructor(version, options) { - options = parseOptions(options); - if (version instanceof _SemVer) { - if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) { - return version; - } else { - version = version.version; - } - } else if (typeof version !== "string") { - throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`); - } - if (version.length > MAX_LENGTH) { - throw new TypeError( - `version is longer than ${MAX_LENGTH} characters` - ); +var require_is_glob = __commonJS({ + ""(exports, module2) { + var isExtglob = require_is_extglob(); + var chars = { "{": "}", "(": ")", "[": "]" }; + var strictCheck = function(str) { + if (str[0] === "!") { + return true; + } + var index = 0; + var pipeIndex = -2; + var closeSquareIndex = -2; + var closeCurlyIndex = -2; + var closeParenIndex = -2; + var backSlashIndex = -2; + while (index < str.length) { + if (str[index] === "*") { + return true; } - debug("SemVer", version, options); - this.options = options; - this.loose = !!options.loose; - this.includePrerelease = !!options.includePrerelease; - const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]); - if (!m) { - throw new TypeError(`Invalid Version: ${version}`); + if (str[index + 1] === "?" && /[\].+)]/.test(str[index])) { + return true; } - this.raw = version; - this.major = +m[1]; - this.minor = +m[2]; - this.patch = +m[3]; - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError("Invalid major version"); + if (closeSquareIndex !== -1 && str[index] === "[" && str[index + 1] !== "]") { + if (closeSquareIndex < index) { + closeSquareIndex = str.indexOf("]", index); + } + if (closeSquareIndex > index) { + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + backSlashIndex = str.indexOf("\\", index); + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + } } - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError("Invalid minor version"); + if (closeCurlyIndex !== -1 && str[index] === "{" && str[index + 1] !== "}") { + closeCurlyIndex = str.indexOf("}", index); + if (closeCurlyIndex > index) { + backSlashIndex = str.indexOf("\\", index); + if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) { + return true; + } + } } - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError("Invalid patch version"); + if (closeParenIndex !== -1 && str[index] === "(" && str[index + 1] === "?" && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ")") { + closeParenIndex = str.indexOf(")", index); + if (closeParenIndex > index) { + backSlashIndex = str.indexOf("\\", index); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } } - if (!m[4]) { - this.prerelease = []; - } else { - this.prerelease = m[4].split(".").map((id) => { - if (/^[0-9]+$/.test(id)) { - const num = +id; - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num; + if (pipeIndex !== -1 && str[index] === "(" && str[index + 1] !== "|") { + if (pipeIndex < index) { + pipeIndex = str.indexOf("|", index); + } + if (pipeIndex !== -1 && str[pipeIndex + 1] !== ")") { + closeParenIndex = str.indexOf(")", pipeIndex); + if (closeParenIndex > pipeIndex) { + backSlashIndex = str.indexOf("\\", pipeIndex); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; } } - return id; - }); + } } - this.build = m[5] ? m[5].split(".") : []; - this.format(); - } - format() { - this.version = `${this.major}.${this.minor}.${this.patch}`; - if (this.prerelease.length) { - this.version += `-${this.prerelease.join(".")}`; + if (str[index] === "\\") { + var open = str[index + 1]; + index += 2; + var close = chars[open]; + if (close) { + var n3 = str.indexOf(close, index); + if (n3 !== -1) { + index = n3 + 1; + } + } + if (str[index] === "!") { + return true; + } + } else { + index++; } - return this.version; } - toString() { - return this.version; + return false; + }; + var relaxedCheck = function(str) { + if (str[0] === "!") { + return true; } - compare(other) { - debug("SemVer.compare", this.version, this.options, other); - if (!(other instanceof _SemVer)) { - if (typeof other === "string" && other === this.version) { - return 0; - } - other = new _SemVer(other, this.options); + var index = 0; + while (index < str.length) { + if (/[*?{}()[\]]/.test(str[index])) { + return true; } - if (other.version === this.version) { - return 0; - } - return this.compareMain(other) || this.comparePre(other); - } - compareMain(other) { - if (!(other instanceof _SemVer)) { - other = new _SemVer(other, this.options); - } - return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch); - } - comparePre(other) { - if (!(other instanceof _SemVer)) { - other = new _SemVer(other, this.options); - } - if (this.prerelease.length && !other.prerelease.length) { - return -1; - } else if (!this.prerelease.length && other.prerelease.length) { - return 1; - } else if (!this.prerelease.length && !other.prerelease.length) { - return 0; - } - let i = 0; - do { - const a = this.prerelease[i]; - const b = other.prerelease[i]; - debug("prerelease compare", i, a, b); - if (a === void 0 && b === void 0) { - return 0; - } else if (b === void 0) { - return 1; - } else if (a === void 0) { - return -1; - } else if (a === b) { - continue; - } else { - return compareIdentifiers(a, b); - } - } while (++i); - } - compareBuild(other) { - if (!(other instanceof _SemVer)) { - other = new _SemVer(other, this.options); - } - let i = 0; - do { - const a = this.build[i]; - const b = other.build[i]; - debug("build compare", i, a, b); - if (a === void 0 && b === void 0) { - return 0; - } else if (b === void 0) { - return 1; - } else if (a === void 0) { - return -1; - } else if (a === b) { - continue; - } else { - return compareIdentifiers(a, b); - } - } while (++i); - } - // preminor will bump the version up to the next minor release, and immediately - // down to pre-release. premajor and prepatch work the same way. - inc(release, identifier, identifierBase) { - if (release.startsWith("pre")) { - if (!identifier && identifierBase === false) { - throw new Error("invalid increment argument: identifier is empty"); - } - if (identifier) { - const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]); - if (!match || match[1] !== identifier) { - throw new Error(`invalid identifier: ${identifier}`); + if (str[index] === "\\") { + var open = str[index + 1]; + index += 2; + var close = chars[open]; + if (close) { + var n3 = str.indexOf(close, index); + if (n3 !== -1) { + index = n3 + 1; } } - } - switch (release) { - case "premajor": - this.prerelease.length = 0; - this.patch = 0; - this.minor = 0; - this.major++; - this.inc("pre", identifier, identifierBase); - break; - case "preminor": - this.prerelease.length = 0; - this.patch = 0; - this.minor++; - this.inc("pre", identifier, identifierBase); - break; - case "prepatch": - this.prerelease.length = 0; - this.inc("patch", identifier, identifierBase); - this.inc("pre", identifier, identifierBase); - break; - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case "prerelease": - if (this.prerelease.length === 0) { - this.inc("patch", identifier, identifierBase); - } - this.inc("pre", identifier, identifierBase); - break; - case "release": - if (this.prerelease.length === 0) { - throw new Error(`version ${this.raw} is not a prerelease`); - } - this.prerelease.length = 0; - break; - case "major": - if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { - this.major++; - } - this.minor = 0; - this.patch = 0; - this.prerelease = []; - break; - case "minor": - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++; - } - this.patch = 0; - this.prerelease = []; - break; - case "patch": - if (this.prerelease.length === 0) { - this.patch++; - } - this.prerelease = []; - break; - // This probably shouldn't be used publicly. - // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. - case "pre": { - const base = Number(identifierBase) ? 1 : 0; - if (this.prerelease.length === 0) { - this.prerelease = [base]; - } else { - let i = this.prerelease.length; - while (--i >= 0) { - if (typeof this.prerelease[i] === "number") { - this.prerelease[i]++; - i = -2; - } - } - if (i === -1) { - if (identifier === this.prerelease.join(".") && identifierBase === false) { - throw new Error("invalid increment argument: identifier already exists"); - } - this.prerelease.push(base); - } - } - if (identifier) { - let prerelease = [identifier, base]; - if (identifierBase === false) { - prerelease = [identifier]; - } - if (compareIdentifiers(this.prerelease[0], identifier) === 0) { - if (isNaN(this.prerelease[1])) { - this.prerelease = prerelease; - } - } else { - this.prerelease = prerelease; - } - } - break; + if (str[index] === "!") { + return true; } - default: - throw new Error(`invalid increment argument: ${release}`); - } - this.raw = this.format(); - if (this.build.length) { - this.raw += `+${this.build.join(".")}`; + } else { + index++; } - return this; } + return false; }; - module.exports = SemVer; - } -}); - -// -var require_parse = __commonJS({ - ""(exports, module) { - "use strict"; - var SemVer = require_semver(); - var parse2 = (version, options, throwErrors = false) => { - if (version instanceof SemVer) { - return version; + module2.exports = function isGlob(str, options) { + if (typeof str !== "string" || str === "") { + return false; } - try { - return new SemVer(version, options); - } catch (er) { - if (!throwErrors) { - return null; - } - throw er; + if (isExtglob(str)) { + return true; } + var check = strictCheck; + if (options && options.strict === false) { + check = relaxedCheck; + } + return check(str); }; - module.exports = parse2; - } -}); - -// -var require_valid = __commonJS({ - ""(exports, module) { - "use strict"; - var parse2 = require_parse(); - var valid = (version, options) => { - const v = parse2(version, options); - return v ? v.version : null; - }; - module.exports = valid; } }); // -var require_clean = __commonJS({ - ""(exports, module) { +var require_glob_parent = __commonJS({ + ""(exports, module2) { "use strict"; - var parse2 = require_parse(); - var clean = (version, options) => { - const s = parse2(version.trim().replace(/^[=v]+/, ""), options); - return s ? s.version : null; + var isGlob = require_is_glob(); + var pathPosixDirname = __require("path").posix.dirname; + var isWin32 = __require("os").platform() === "win32"; + var slash = "/"; + var backslash = /\\/g; + var enclosure = /[\{\[].*[\}\]]$/; + var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; + var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g; + module2.exports = function globParent(str, opts) { + var options = Object.assign({ flipBackslashes: true }, opts); + if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { + str = str.replace(backslash, slash); + } + if (enclosure.test(str)) { + str += slash; + } + str += "a"; + do { + str = pathPosixDirname(str); + } while (isGlob(str) || globby.test(str)); + return str.replace(escaped, "$1"); }; - module.exports = clean; } }); // -var require_inc = __commonJS({ - ""(exports, module) { +var require_utils4 = __commonJS({ + ""(exports) { "use strict"; - var SemVer = require_semver(); - var inc = (version, release, options, identifier, identifierBase) => { - if (typeof options === "string") { - identifierBase = identifier; - identifier = options; - options = void 0; + exports.isInteger = (num) => { + if (typeof num === "number") { + return Number.isInteger(num); } - try { - return new SemVer( - version instanceof SemVer ? version.version : version, - options - ).inc(release, identifier, identifierBase).version; - } catch (er) { - return null; + if (typeof num === "string" && num.trim() !== "") { + return Number.isInteger(Number(num)); } + return false; }; - module.exports = inc; - } -}); - -// -var require_diff = __commonJS({ - ""(exports, module) { - "use strict"; - var parse2 = require_parse(); - var diff = (version1, version2) => { - const v1 = parse2(version1, null, true); - const v2 = parse2(version2, null, true); - const comparison = v1.compare(v2); - if (comparison === 0) { - return null; - } - const v1Higher = comparison > 0; - const highVersion = v1Higher ? v1 : v2; - const lowVersion = v1Higher ? v2 : v1; - const highHasPre = !!highVersion.prerelease.length; - const lowHasPre = !!lowVersion.prerelease.length; - if (lowHasPre && !highHasPre) { - if (!lowVersion.patch && !lowVersion.minor) { - return "major"; - } - if (lowVersion.compareMain(highVersion) === 0) { - if (lowVersion.minor && !lowVersion.patch) { - return "minor"; - } - return "patch"; + exports.find = (node, type) => node.nodes.find((node2) => node2.type === type); + exports.exceedsLimit = (min, max, step = 1, limit) => { + if (limit === false) + return false; + if (!exports.isInteger(min) || !exports.isInteger(max)) + return false; + return (Number(max) - Number(min)) / Number(step) >= limit; + }; + exports.escapeNode = (block, n3 = 0, type) => { + const node = block.nodes[n3]; + if (!node) + return; + if (type && node.type === type || node.type === "open" || node.type === "close") { + if (node.escaped !== true) { + node.value = "\\" + node.value; + node.escaped = true; } } - const prefix = highHasPre ? "pre" : ""; - if (v1.major !== v2.major) { - return prefix + "major"; + }; + exports.encloseBrace = (node) => { + if (node.type !== "brace") + return false; + if (node.commas >> 0 + node.ranges >> 0 === 0) { + node.invalid = true; + return true; } - if (v1.minor !== v2.minor) { - return prefix + "minor"; + return false; + }; + exports.isInvalidBrace = (block) => { + if (block.type !== "brace") + return false; + if (block.invalid === true || block.dollar) + return true; + if (block.commas >> 0 + block.ranges >> 0 === 0) { + block.invalid = true; + return true; } - if (v1.patch !== v2.patch) { - return prefix + "patch"; + if (block.open !== true || block.close !== true) { + block.invalid = true; + return true; } - return "prerelease"; + return false; + }; + exports.isOpenOrClose = (node) => { + if (node.type === "open" || node.type === "close") { + return true; + } + return node.open === true || node.close === true; + }; + exports.reduce = (nodes) => nodes.reduce((acc, node) => { + if (node.type === "text") + acc.push(node.value); + if (node.type === "range") + node.type = "text"; + return acc; + }, []); + exports.flatten = (...args) => { + const result = []; + const flat = (arr) => { + for (let i6 = 0; i6 < arr.length; i6++) { + const ele = arr[i6]; + if (Array.isArray(ele)) { + flat(ele); + continue; + } + if (ele !== void 0) { + result.push(ele); + } + } + return result; + }; + flat(args); + return result; }; - module.exports = diff; } }); // -var require_major = __commonJS({ - ""(exports, module) { +var require_stringify = __commonJS({ + ""(exports, module2) { "use strict"; - var SemVer = require_semver(); - var major = (a, loose) => new SemVer(a, loose).major; - module.exports = major; + var utils = require_utils4(); + module2.exports = (ast, options = {}) => { + const stringify = (node, parent = {}) => { + const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent); + const invalidNode = node.invalid === true && options.escapeInvalid === true; + let output = ""; + if (node.value) { + if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) { + return "\\" + node.value; + } + return node.value; + } + if (node.value) { + return node.value; + } + if (node.nodes) { + for (const child of node.nodes) { + output += stringify(child); + } + } + return output; + }; + return stringify(ast); + }; } }); // -var require_minor = __commonJS({ - ""(exports, module) { +var require_is_number = __commonJS({ + ""(exports, module2) { "use strict"; - var SemVer = require_semver(); - var minor = (a, loose) => new SemVer(a, loose).minor; - module.exports = minor; + module2.exports = function(num) { + if (typeof num === "number") { + return num - num === 0; + } + if (typeof num === "string" && num.trim() !== "") { + return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); + } + return false; + }; } }); // -var require_patch = __commonJS({ - ""(exports, module) { +var require_to_regex_range = __commonJS({ + ""(exports, module2) { "use strict"; - var SemVer = require_semver(); - var patch = (a, loose) => new SemVer(a, loose).patch; - module.exports = patch; + var isNumber = require_is_number(); + var toRegexRange = (min, max, options) => { + if (isNumber(min) === false) { + throw new TypeError("toRegexRange: expected the first argument to be a number"); + } + if (max === void 0 || min === max) { + return String(min); + } + if (isNumber(max) === false) { + throw new TypeError("toRegexRange: expected the second argument to be a number."); + } + let opts = { relaxZeros: true, ...options }; + if (typeof opts.strictZeros === "boolean") { + opts.relaxZeros = opts.strictZeros === false; + } + let relax = String(opts.relaxZeros); + let shorthand = String(opts.shorthand); + let capture = String(opts.capture); + let wrap = String(opts.wrap); + let cacheKey = min + ":" + max + "=" + relax + shorthand + capture + wrap; + if (toRegexRange.cache.hasOwnProperty(cacheKey)) { + return toRegexRange.cache[cacheKey].result; + } + let a7 = Math.min(min, max); + let b3 = Math.max(min, max); + if (Math.abs(a7 - b3) === 1) { + let result = min + "|" + max; + if (opts.capture) { + return `(${result})`; + } + if (opts.wrap === false) { + return result; + } + return `(?:${result})`; + } + let isPadded = hasPadding(min) || hasPadding(max); + let state = { min, max, a: a7, b: b3 }; + let positives = []; + let negatives = []; + if (isPadded) { + state.isPadded = isPadded; + state.maxLen = String(state.max).length; + } + if (a7 < 0) { + let newMin = b3 < 0 ? Math.abs(b3) : 1; + negatives = splitToPatterns(newMin, Math.abs(a7), state, opts); + a7 = state.a = 0; + } + if (b3 >= 0) { + positives = splitToPatterns(a7, b3, state, opts); + } + state.negatives = negatives; + state.positives = positives; + state.result = collatePatterns(negatives, positives, opts); + if (opts.capture === true) { + state.result = `(${state.result})`; + } else if (opts.wrap !== false && positives.length + negatives.length > 1) { + state.result = `(?:${state.result})`; + } + toRegexRange.cache[cacheKey] = state; + return state.result; + }; + function collatePatterns(neg, pos, options) { + let onlyNegative = filterPatterns(neg, pos, "-", false, options) || []; + let onlyPositive = filterPatterns(pos, neg, "", false, options) || []; + let intersected = filterPatterns(neg, pos, "-?", true, options) || []; + let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive); + return subpatterns.join("|"); + } + function splitToRanges(min, max) { + let nines = 1; + let zeros = 1; + let stop = countNines(min, nines); + let stops = /* @__PURE__ */ new Set([max]); + while (min <= stop && stop <= max) { + stops.add(stop); + nines += 1; + stop = countNines(min, nines); + } + stop = countZeros(max + 1, zeros) - 1; + while (min < stop && stop <= max) { + stops.add(stop); + zeros += 1; + stop = countZeros(max + 1, zeros) - 1; + } + stops = [...stops]; + stops.sort(compare); + return stops; + } + function rangeToPattern(start, stop, options) { + if (start === stop) { + return { pattern: start, count: [], digits: 0 }; + } + let zipped = zip(start, stop); + let digits = zipped.length; + let pattern = ""; + let count = 0; + for (let i6 = 0; i6 < digits; i6++) { + let [startDigit, stopDigit] = zipped[i6]; + if (startDigit === stopDigit) { + pattern += startDigit; + } else if (startDigit !== "0" || stopDigit !== "9") { + pattern += toCharacterClass(startDigit, stopDigit, options); + } else { + count++; + } + } + if (count) { + pattern += options.shorthand === true ? "\\d" : "[0-9]"; + } + return { pattern, count: [count], digits }; + } + function splitToPatterns(min, max, tok, options) { + let ranges = splitToRanges(min, max); + let tokens = []; + let start = min; + let prev; + for (let i6 = 0; i6 < ranges.length; i6++) { + let max2 = ranges[i6]; + let obj = rangeToPattern(String(start), String(max2), options); + let zeros = ""; + if (!tok.isPadded && prev && prev.pattern === obj.pattern) { + if (prev.count.length > 1) { + prev.count.pop(); + } + prev.count.push(obj.count[0]); + prev.string = prev.pattern + toQuantifier(prev.count); + start = max2 + 1; + continue; + } + if (tok.isPadded) { + zeros = padZeros(max2, tok, options); + } + obj.string = zeros + obj.pattern + toQuantifier(obj.count); + tokens.push(obj); + start = max2 + 1; + prev = obj; + } + return tokens; + } + function filterPatterns(arr, comparison, prefix, intersection, options) { + let result = []; + for (let ele of arr) { + let { string } = ele; + if (!intersection && !contains(comparison, "string", string)) { + result.push(prefix + string); + } + if (intersection && contains(comparison, "string", string)) { + result.push(prefix + string); + } + } + return result; + } + function zip(a7, b3) { + let arr = []; + for (let i6 = 0; i6 < a7.length; i6++) + arr.push([a7[i6], b3[i6]]); + return arr; + } + function compare(a7, b3) { + return a7 > b3 ? 1 : b3 > a7 ? -1 : 0; + } + function contains(arr, key, val) { + return arr.some((ele) => ele[key] === val); + } + function countNines(min, len) { + return Number(String(min).slice(0, -len) + "9".repeat(len)); + } + function countZeros(integer, zeros) { + return integer - integer % Math.pow(10, zeros); + } + function toQuantifier(digits) { + let [start = 0, stop = ""] = digits; + if (stop || start > 1) { + return `{${start + (stop ? "," + stop : "")}}`; + } + return ""; + } + function toCharacterClass(a7, b3, options) { + return `[${a7}${b3 - a7 === 1 ? "" : "-"}${b3}]`; + } + function hasPadding(str) { + return /^-?(0+)\d/.test(str); + } + function padZeros(value, tok, options) { + if (!tok.isPadded) { + return value; + } + let diff = Math.abs(tok.maxLen - String(value).length); + let relax = options.relaxZeros !== false; + switch (diff) { + case 0: + return ""; + case 1: + return relax ? "0?" : "0"; + case 2: + return relax ? "0{0,2}" : "00"; + default: { + return relax ? `0{0,${diff}}` : `0{${diff}}`; + } + } + } + toRegexRange.cache = {}; + toRegexRange.clearCache = () => toRegexRange.cache = {}; + module2.exports = toRegexRange; } }); // -var require_prerelease = __commonJS({ - ""(exports, module) { +var require_fill_range = __commonJS({ + ""(exports, module2) { "use strict"; - var parse2 = require_parse(); - var prerelease = (version, options) => { - const parsed = parse2(version, options); - return parsed && parsed.prerelease.length ? parsed.prerelease : null; + var util = __require("util"); + var toRegexRange = require_to_regex_range(); + var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val); + var transform = (toNumber) => { + return (value) => toNumber === true ? Number(value) : String(value); + }; + var isValidValue = (value) => { + return typeof value === "number" || typeof value === "string" && value !== ""; + }; + var isNumber = (num) => Number.isInteger(+num); + var zeros = (input) => { + let value = `${input}`; + let index = -1; + if (value[0] === "-") + value = value.slice(1); + if (value === "0") + return false; + while (value[++index] === "0") + ; + return index > 0; + }; + var stringify = (start, end, options) => { + if (typeof start === "string" || typeof end === "string") { + return true; + } + return options.stringify === true; + }; + var pad = (input, maxLength, toNumber) => { + if (maxLength > 0) { + let dash = input[0] === "-" ? "-" : ""; + if (dash) + input = input.slice(1); + input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0"); + } + if (toNumber === false) { + return String(input); + } + return input; + }; + var toMaxLen = (input, maxLength) => { + let negative = input[0] === "-" ? "-" : ""; + if (negative) { + input = input.slice(1); + maxLength--; + } + while (input.length < maxLength) + input = "0" + input; + return negative ? "-" + input : input; + }; + var toSequence = (parts, options, maxLen) => { + parts.negatives.sort((a7, b3) => a7 < b3 ? -1 : a7 > b3 ? 1 : 0); + parts.positives.sort((a7, b3) => a7 < b3 ? -1 : a7 > b3 ? 1 : 0); + let prefix = options.capture ? "" : "?:"; + let positives = ""; + let negatives = ""; + let result; + if (parts.positives.length) { + positives = parts.positives.map((v4) => toMaxLen(String(v4), maxLen)).join("|"); + } + if (parts.negatives.length) { + negatives = `-(${prefix}${parts.negatives.map((v4) => toMaxLen(String(v4), maxLen)).join("|")})`; + } + if (positives && negatives) { + result = `${positives}|${negatives}`; + } else { + result = positives || negatives; + } + if (options.wrap) { + return `(${prefix}${result})`; + } + return result; + }; + var toRange = (a7, b3, isNumbers, options) => { + if (isNumbers) { + return toRegexRange(a7, b3, { wrap: false, ...options }); + } + let start = String.fromCharCode(a7); + if (a7 === b3) + return start; + let stop = String.fromCharCode(b3); + return `[${start}-${stop}]`; + }; + var toRegex = (start, end, options) => { + if (Array.isArray(start)) { + let wrap = options.wrap === true; + let prefix = options.capture ? "" : "?:"; + return wrap ? `(${prefix}${start.join("|")})` : start.join("|"); + } + return toRegexRange(start, end, options); + }; + var rangeError = (...args) => { + return new RangeError("Invalid range arguments: " + util.inspect(...args)); + }; + var invalidRange = (start, end, options) => { + if (options.strictRanges === true) + throw rangeError([start, end]); + return []; + }; + var invalidStep = (step, options) => { + if (options.strictRanges === true) { + throw new TypeError(`Expected step "${step}" to be a number`); + } + return []; + }; + var fillNumbers = (start, end, step = 1, options = {}) => { + let a7 = Number(start); + let b3 = Number(end); + if (!Number.isInteger(a7) || !Number.isInteger(b3)) { + if (options.strictRanges === true) + throw rangeError([start, end]); + return []; + } + if (a7 === 0) + a7 = 0; + if (b3 === 0) + b3 = 0; + let descending = a7 > b3; + let startString = String(start); + let endString = String(end); + let stepString = String(step); + step = Math.max(Math.abs(step), 1); + let padded = zeros(startString) || zeros(endString) || zeros(stepString); + let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0; + let toNumber = padded === false && stringify(start, end, options) === false; + let format = options.transform || transform(toNumber); + if (options.toRegex && step === 1) { + return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options); + } + let parts = { negatives: [], positives: [] }; + let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num)); + let range = []; + let index = 0; + while (descending ? a7 >= b3 : a7 <= b3) { + if (options.toRegex === true && step > 1) { + push(a7); + } else { + range.push(pad(format(a7, index), maxLen, toNumber)); + } + a7 = descending ? a7 - step : a7 + step; + index++; + } + if (options.toRegex === true) { + return step > 1 ? toSequence(parts, options, maxLen) : toRegex(range, null, { wrap: false, ...options }); + } + return range; + }; + var fillLetters = (start, end, step = 1, options = {}) => { + if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) { + return invalidRange(start, end, options); + } + let format = options.transform || ((val) => String.fromCharCode(val)); + let a7 = `${start}`.charCodeAt(0); + let b3 = `${end}`.charCodeAt(0); + let descending = a7 > b3; + let min = Math.min(a7, b3); + let max = Math.max(a7, b3); + if (options.toRegex && step === 1) { + return toRange(min, max, false, options); + } + let range = []; + let index = 0; + while (descending ? a7 >= b3 : a7 <= b3) { + range.push(format(a7, index)); + a7 = descending ? a7 - step : a7 + step; + index++; + } + if (options.toRegex === true) { + return toRegex(range, null, { wrap: false, options }); + } + return range; + }; + var fill = (start, end, step, options = {}) => { + if (end == null && isValidValue(start)) { + return [start]; + } + if (!isValidValue(start) || !isValidValue(end)) { + return invalidRange(start, end, options); + } + if (typeof step === "function") { + return fill(start, end, 1, { transform: step }); + } + if (isObject(step)) { + return fill(start, end, 0, step); + } + let opts = { ...options }; + if (opts.capture === true) + opts.wrap = true; + step = step || opts.step || 1; + if (!isNumber(step)) { + if (step != null && !isObject(step)) + return invalidStep(step, opts); + return fill(start, end, 1, step); + } + if (isNumber(start) && isNumber(end)) { + return fillNumbers(start, end, step, opts); + } + return fillLetters(start, end, Math.max(Math.abs(step), 1), opts); }; - module.exports = prerelease; + module2.exports = fill; } }); // -var require_compare = __commonJS({ - ""(exports, module) { +var require_compile = __commonJS({ + ""(exports, module2) { "use strict"; - var SemVer = require_semver(); - var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)); - module.exports = compare; + var fill = require_fill_range(); + var utils = require_utils4(); + var compile = (ast, options = {}) => { + const walk = (node, parent = {}) => { + const invalidBlock = utils.isInvalidBrace(parent); + const invalidNode = node.invalid === true && options.escapeInvalid === true; + const invalid = invalidBlock === true || invalidNode === true; + const prefix = options.escapeInvalid === true ? "\\" : ""; + let output = ""; + if (node.isOpen === true) { + return prefix + node.value; + } + if (node.isClose === true) { + console.log("node.isClose", prefix, node.value); + return prefix + node.value; + } + if (node.type === "open") { + return invalid ? prefix + node.value : "("; + } + if (node.type === "close") { + return invalid ? prefix + node.value : ")"; + } + if (node.type === "comma") { + return node.prev.type === "comma" ? "" : invalid ? node.value : "|"; + } + if (node.value) { + return node.value; + } + if (node.nodes && node.ranges > 0) { + const args = utils.reduce(node.nodes); + const range = fill(...args, { ...options, wrap: false, toRegex: true, strictZeros: true }); + if (range.length !== 0) { + return args.length > 1 && range.length > 1 ? `(${range})` : range; + } + } + if (node.nodes) { + for (const child of node.nodes) { + output += walk(child, node); + } + } + return output; + }; + return walk(ast); + }; + module2.exports = compile; } }); // -var require_rcompare = __commonJS({ - ""(exports, module) { +var require_expand = __commonJS({ + ""(exports, module2) { "use strict"; - var compare = require_compare(); - var rcompare = (a, b, loose) => compare(b, a, loose); - module.exports = rcompare; + var fill = require_fill_range(); + var stringify = require_stringify(); + var utils = require_utils4(); + var append = (queue = "", stash = "", enclose = false) => { + const result = []; + queue = [].concat(queue); + stash = [].concat(stash); + if (!stash.length) + return queue; + if (!queue.length) { + return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash; + } + for (const item of queue) { + if (Array.isArray(item)) { + for (const value of item) { + result.push(append(value, stash, enclose)); + } + } else { + for (let ele of stash) { + if (enclose === true && typeof ele === "string") + ele = `{${ele}}`; + result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele); + } + } + } + return utils.flatten(result); + }; + var expand2 = (ast, options = {}) => { + const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit; + const walk = (node, parent = {}) => { + node.queue = []; + let p5 = parent; + let q2 = parent.queue; + while (p5.type !== "brace" && p5.type !== "root" && p5.parent) { + p5 = p5.parent; + q2 = p5.queue; + } + if (node.invalid || node.dollar) { + q2.push(append(q2.pop(), stringify(node, options))); + return; + } + if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) { + q2.push(append(q2.pop(), ["{}"])); + return; + } + if (node.nodes && node.ranges > 0) { + const args = utils.reduce(node.nodes); + if (utils.exceedsLimit(...args, options.step, rangeLimit)) { + throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit."); + } + let range = fill(...args, options); + if (range.length === 0) { + range = stringify(node, options); + } + q2.push(append(q2.pop(), range)); + node.nodes = []; + return; + } + const enclose = utils.encloseBrace(node); + let queue = node.queue; + let block = node; + while (block.type !== "brace" && block.type !== "root" && block.parent) { + block = block.parent; + queue = block.queue; + } + for (let i6 = 0; i6 < node.nodes.length; i6++) { + const child = node.nodes[i6]; + if (child.type === "comma" && node.type === "brace") { + if (i6 === 1) + queue.push(""); + queue.push(""); + continue; + } + if (child.type === "close") { + q2.push(append(q2.pop(), queue, enclose)); + continue; + } + if (child.value && child.type !== "open") { + queue.push(append(queue.pop(), child.value)); + continue; + } + if (child.nodes) { + walk(child, node); + } + } + return queue; + }; + return utils.flatten(walk(ast)); + }; + module2.exports = expand2; } }); // -var require_compare_loose = __commonJS({ - ""(exports, module) { +var require_constants = __commonJS({ + ""(exports, module2) { "use strict"; - var compare = require_compare(); - var compareLoose = (a, b) => compare(a, b, true); - module.exports = compareLoose; + module2.exports = { + MAX_LENGTH: 1e4, + // Digits + CHAR_0: "0", + /* 0 */ + CHAR_9: "9", + /* 9 */ + // Alphabet chars. + CHAR_UPPERCASE_A: "A", + /* A */ + CHAR_LOWERCASE_A: "a", + /* a */ + CHAR_UPPERCASE_Z: "Z", + /* Z */ + CHAR_LOWERCASE_Z: "z", + /* z */ + CHAR_LEFT_PARENTHESES: "(", + /* ( */ + CHAR_RIGHT_PARENTHESES: ")", + /* ) */ + CHAR_ASTERISK: "*", + /* * */ + // Non-alphabetic chars. + CHAR_AMPERSAND: "&", + /* & */ + CHAR_AT: "@", + /* @ */ + CHAR_BACKSLASH: "\\", + /* \ */ + CHAR_BACKTICK: "`", + /* ` */ + CHAR_CARRIAGE_RETURN: "\r", + /* \r */ + CHAR_CIRCUMFLEX_ACCENT: "^", + /* ^ */ + CHAR_COLON: ":", + /* : */ + CHAR_COMMA: ",", + /* , */ + CHAR_DOLLAR: "$", + /* . */ + CHAR_DOT: ".", + /* . */ + CHAR_DOUBLE_QUOTE: '"', + /* " */ + CHAR_EQUAL: "=", + /* = */ + CHAR_EXCLAMATION_MARK: "!", + /* ! */ + CHAR_FORM_FEED: "\f", + /* \f */ + CHAR_FORWARD_SLASH: "/", + /* / */ + CHAR_HASH: "#", + /* # */ + CHAR_HYPHEN_MINUS: "-", + /* - */ + CHAR_LEFT_ANGLE_BRACKET: "<", + /* < */ + CHAR_LEFT_CURLY_BRACE: "{", + /* { */ + CHAR_LEFT_SQUARE_BRACKET: "[", + /* [ */ + CHAR_LINE_FEED: "\n", + /* \n */ + CHAR_NO_BREAK_SPACE: "\xA0", + /* \u00A0 */ + CHAR_PERCENT: "%", + /* % */ + CHAR_PLUS: "+", + /* + */ + CHAR_QUESTION_MARK: "?", + /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: ">", + /* > */ + CHAR_RIGHT_CURLY_BRACE: "}", + /* } */ + CHAR_RIGHT_SQUARE_BRACKET: "]", + /* ] */ + CHAR_SEMICOLON: ";", + /* ; */ + CHAR_SINGLE_QUOTE: "'", + /* ' */ + CHAR_SPACE: " ", + /* */ + CHAR_TAB: " ", + /* \t */ + CHAR_UNDERSCORE: "_", + /* _ */ + CHAR_VERTICAL_LINE: "|", + /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF" + /* \uFEFF */ + }; } }); // -var require_compare_build = __commonJS({ - ""(exports, module) { +var require_parse = __commonJS({ + ""(exports, module2) { "use strict"; - var SemVer = require_semver(); - var compareBuild = (a, b, loose) => { - const versionA = new SemVer(a, loose); - const versionB = new SemVer(b, loose); - return versionA.compare(versionB) || versionA.compareBuild(versionB); + var stringify = require_stringify(); + var { + MAX_LENGTH, + CHAR_BACKSLASH, + /* \ */ + CHAR_BACKTICK, + /* ` */ + CHAR_COMMA, + /* , */ + CHAR_DOT, + /* . */ + CHAR_LEFT_PARENTHESES, + /* ( */ + CHAR_RIGHT_PARENTHESES, + /* ) */ + CHAR_LEFT_CURLY_BRACE, + /* { */ + CHAR_RIGHT_CURLY_BRACE, + /* } */ + CHAR_LEFT_SQUARE_BRACKET, + /* [ */ + CHAR_RIGHT_SQUARE_BRACKET, + /* ] */ + CHAR_DOUBLE_QUOTE, + /* " */ + CHAR_SINGLE_QUOTE, + /* ' */ + CHAR_NO_BREAK_SPACE, + CHAR_ZERO_WIDTH_NOBREAK_SPACE + } = require_constants(); + var parse2 = (input, options = {}) => { + if (typeof input !== "string") { + throw new TypeError("Expected a string"); + } + const opts = options || {}; + const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + if (input.length > max) { + throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); + } + const ast = { type: "root", input, nodes: [] }; + const stack = [ast]; + let block = ast; + let prev = ast; + let brackets = 0; + const length = input.length; + let index = 0; + let depth = 0; + let value; + const advance = () => input[index++]; + const push = (node) => { + if (node.type === "text" && prev.type === "dot") { + prev.type = "text"; + } + if (prev && prev.type === "text" && node.type === "text") { + prev.value += node.value; + return; + } + block.nodes.push(node); + node.parent = block; + node.prev = prev; + prev = node; + return node; + }; + push({ type: "bos" }); + while (index < length) { + block = stack[stack.length - 1]; + value = advance(); + if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { + continue; + } + if (value === CHAR_BACKSLASH) { + push({ type: "text", value: (options.keepEscaping ? value : "") + advance() }); + continue; + } + if (value === CHAR_RIGHT_SQUARE_BRACKET) { + push({ type: "text", value: "\\" + value }); + continue; + } + if (value === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; + let next; + while (index < length && (next = advance())) { + value += next; + if (next === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; + continue; + } + if (next === CHAR_BACKSLASH) { + value += advance(); + continue; + } + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + brackets--; + if (brackets === 0) { + break; + } + } + } + push({ type: "text", value }); + continue; + } + if (value === CHAR_LEFT_PARENTHESES) { + block = push({ type: "paren", nodes: [] }); + stack.push(block); + push({ type: "text", value }); + continue; + } + if (value === CHAR_RIGHT_PARENTHESES) { + if (block.type !== "paren") { + push({ type: "text", value }); + continue; + } + block = stack.pop(); + push({ type: "text", value }); + block = stack[stack.length - 1]; + continue; + } + if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { + const open = value; + let next; + if (options.keepQuotes !== true) { + value = ""; + } + while (index < length && (next = advance())) { + if (next === CHAR_BACKSLASH) { + value += next + advance(); + continue; + } + if (next === open) { + if (options.keepQuotes === true) + value += next; + break; + } + value += next; + } + push({ type: "text", value }); + continue; + } + if (value === CHAR_LEFT_CURLY_BRACE) { + depth++; + const dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true; + const brace = { + type: "brace", + open: true, + close: false, + dollar, + depth, + commas: 0, + ranges: 0, + nodes: [] + }; + block = push(brace); + stack.push(block); + push({ type: "open", value }); + continue; + } + if (value === CHAR_RIGHT_CURLY_BRACE) { + if (block.type !== "brace") { + push({ type: "text", value }); + continue; + } + const type = "close"; + block = stack.pop(); + block.close = true; + push({ type, value }); + depth--; + block = stack[stack.length - 1]; + continue; + } + if (value === CHAR_COMMA && depth > 0) { + if (block.ranges > 0) { + block.ranges = 0; + const open = block.nodes.shift(); + block.nodes = [open, { type: "text", value: stringify(block) }]; + } + push({ type: "comma", value }); + block.commas++; + continue; + } + if (value === CHAR_DOT && depth > 0 && block.commas === 0) { + const siblings = block.nodes; + if (depth === 0 || siblings.length === 0) { + push({ type: "text", value }); + continue; + } + if (prev.type === "dot") { + block.range = []; + prev.value += value; + prev.type = "range"; + if (block.nodes.length !== 3 && block.nodes.length !== 5) { + block.invalid = true; + block.ranges = 0; + prev.type = "text"; + continue; + } + block.ranges++; + block.args = []; + continue; + } + if (prev.type === "range") { + siblings.pop(); + const before = siblings[siblings.length - 1]; + before.value += prev.value + value; + prev = before; + block.ranges--; + continue; + } + push({ type: "dot", value }); + continue; + } + push({ type: "text", value }); + } + do { + block = stack.pop(); + if (block.type !== "root") { + block.nodes.forEach((node) => { + if (!node.nodes) { + if (node.type === "open") + node.isOpen = true; + if (node.type === "close") + node.isClose = true; + if (!node.nodes) + node.type = "text"; + node.invalid = true; + } + }); + const parent = stack[stack.length - 1]; + const index2 = parent.nodes.indexOf(block); + parent.nodes.splice(index2, 1, ...block.nodes); + } + } while (stack.length > 0); + push({ type: "eos" }); + return ast; }; - module.exports = compareBuild; + module2.exports = parse2; } }); // -var require_sort = __commonJS({ - ""(exports, module) { +var require_braces = __commonJS({ + ""(exports, module2) { "use strict"; - var compareBuild = require_compare_build(); - var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)); - module.exports = sort; + var stringify = require_stringify(); + var compile = require_compile(); + var expand2 = require_expand(); + var parse2 = require_parse(); + var braces = (input, options = {}) => { + let output = []; + if (Array.isArray(input)) { + for (const pattern of input) { + const result = braces.create(pattern, options); + if (Array.isArray(result)) { + output.push(...result); + } else { + output.push(result); + } + } + } else { + output = [].concat(braces.create(input, options)); + } + if (options && options.expand === true && options.nodupes === true) { + output = [...new Set(output)]; + } + return output; + }; + braces.parse = (input, options = {}) => parse2(input, options); + braces.stringify = (input, options = {}) => { + if (typeof input === "string") { + return stringify(braces.parse(input, options), options); + } + return stringify(input, options); + }; + braces.compile = (input, options = {}) => { + if (typeof input === "string") { + input = braces.parse(input, options); + } + return compile(input, options); + }; + braces.expand = (input, options = {}) => { + if (typeof input === "string") { + input = braces.parse(input, options); + } + let result = expand2(input, options); + if (options.noempty === true) { + result = result.filter(Boolean); + } + if (options.nodupes === true) { + result = [...new Set(result)]; + } + return result; + }; + braces.create = (input, options = {}) => { + if (input === "" || input.length < 3) { + return [input]; + } + return options.expand !== true ? braces.compile(input, options) : braces.expand(input, options); + }; + module2.exports = braces; } }); // -var require_rsort = __commonJS({ - ""(exports, module) { +var require_constants2 = __commonJS({ + ""(exports, module2) { "use strict"; - var compareBuild = require_compare_build(); - var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)); - module.exports = rsort; + var path = __require("path"); + var WIN_SLASH = "\\\\/"; + var WIN_NO_SLASH = `[^${WIN_SLASH}]`; + var DOT_LITERAL = "\\."; + var PLUS_LITERAL = "\\+"; + var QMARK_LITERAL = "\\?"; + var SLASH_LITERAL = "\\/"; + var ONE_CHAR = "(?=.)"; + var QMARK = "[^/]"; + var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; + var START_ANCHOR = `(?:^|${SLASH_LITERAL})`; + var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; + var NO_DOT = `(?!${DOT_LITERAL})`; + var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; + var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; + var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; + var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; + var STAR = `${QMARK}*?`; + var POSIX_CHARS = { + DOT_LITERAL, + PLUS_LITERAL, + QMARK_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + QMARK, + END_ANCHOR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK_NO_DOT, + STAR, + START_ANCHOR + }; + var WINDOWS_CHARS = { + ...POSIX_CHARS, + SLASH_LITERAL: `[${WIN_SLASH}]`, + QMARK: WIN_NO_SLASH, + STAR: `${WIN_NO_SLASH}*?`, + DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, + NO_DOT: `(?!${DOT_LITERAL})`, + NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, + NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + QMARK_NO_DOT: `[^.${WIN_SLASH}]`, + START_ANCHOR: `(?:^|[${WIN_SLASH}])`, + END_ANCHOR: `(?:[${WIN_SLASH}]|$)` + }; + var POSIX_REGEX_SOURCE = { + alnum: "a-zA-Z0-9", + alpha: "a-zA-Z", + ascii: "\\x00-\\x7F", + blank: " \\t", + cntrl: "\\x00-\\x1F\\x7F", + digit: "0-9", + graph: "\\x21-\\x7E", + lower: "a-z", + print: "\\x20-\\x7E ", + punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~", + space: " \\t\\r\\n\\v\\f", + upper: "A-Z", + word: "A-Za-z0-9_", + xdigit: "A-Fa-f0-9" + }; + module2.exports = { + MAX_LENGTH: 1024 * 64, + POSIX_REGEX_SOURCE, + // regular expressions + REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, + REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, + REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, + REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, + REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, + REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, + // Replace globs with equivalent patterns to reduce parsing time. + REPLACEMENTS: { + "***": "*", + "**/**": "**", + "**/**/**": "**" + }, + // Digits + CHAR_0: 48, + /* 0 */ + CHAR_9: 57, + /* 9 */ + // Alphabet chars. + CHAR_UPPERCASE_A: 65, + /* A */ + CHAR_LOWERCASE_A: 97, + /* a */ + CHAR_UPPERCASE_Z: 90, + /* Z */ + CHAR_LOWERCASE_Z: 122, + /* z */ + CHAR_LEFT_PARENTHESES: 40, + /* ( */ + CHAR_RIGHT_PARENTHESES: 41, + /* ) */ + CHAR_ASTERISK: 42, + /* * */ + // Non-alphabetic chars. + CHAR_AMPERSAND: 38, + /* & */ + CHAR_AT: 64, + /* @ */ + CHAR_BACKWARD_SLASH: 92, + /* \ */ + CHAR_CARRIAGE_RETURN: 13, + /* \r */ + CHAR_CIRCUMFLEX_ACCENT: 94, + /* ^ */ + CHAR_COLON: 58, + /* : */ + CHAR_COMMA: 44, + /* , */ + CHAR_DOT: 46, + /* . */ + CHAR_DOUBLE_QUOTE: 34, + /* " */ + CHAR_EQUAL: 61, + /* = */ + CHAR_EXCLAMATION_MARK: 33, + /* ! */ + CHAR_FORM_FEED: 12, + /* \f */ + CHAR_FORWARD_SLASH: 47, + /* / */ + CHAR_GRAVE_ACCENT: 96, + /* ` */ + CHAR_HASH: 35, + /* # */ + CHAR_HYPHEN_MINUS: 45, + /* - */ + CHAR_LEFT_ANGLE_BRACKET: 60, + /* < */ + CHAR_LEFT_CURLY_BRACE: 123, + /* { */ + CHAR_LEFT_SQUARE_BRACKET: 91, + /* [ */ + CHAR_LINE_FEED: 10, + /* \n */ + CHAR_NO_BREAK_SPACE: 160, + /* \u00A0 */ + CHAR_PERCENT: 37, + /* % */ + CHAR_PLUS: 43, + /* + */ + CHAR_QUESTION_MARK: 63, + /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: 62, + /* > */ + CHAR_RIGHT_CURLY_BRACE: 125, + /* } */ + CHAR_RIGHT_SQUARE_BRACKET: 93, + /* ] */ + CHAR_SEMICOLON: 59, + /* ; */ + CHAR_SINGLE_QUOTE: 39, + /* ' */ + CHAR_SPACE: 32, + /* */ + CHAR_TAB: 9, + /* \t */ + CHAR_UNDERSCORE: 95, + /* _ */ + CHAR_VERTICAL_LINE: 124, + /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, + /* \uFEFF */ + SEP: path.sep, + /** + * Create EXTGLOB_CHARS + */ + extglobChars(chars) { + return { + "!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` }, + "?": { type: "qmark", open: "(?:", close: ")?" }, + "+": { type: "plus", open: "(?:", close: ")+" }, + "*": { type: "star", open: "(?:", close: ")*" }, + "@": { type: "at", open: "(?:", close: ")" } + }; + }, + /** + * Create GLOB_CHARS + */ + globChars(win32) { + return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; + } + }; } }); // -var require_gt = __commonJS({ - ""(exports, module) { +var require_utils5 = __commonJS({ + ""(exports) { "use strict"; - var compare = require_compare(); - var gt = (a, b, loose) => compare(a, b, loose) > 0; - module.exports = gt; + var path = __require("path"); + var win32 = process.platform === "win32"; + var { + REGEX_BACKSLASH, + REGEX_REMOVE_BACKSLASH, + REGEX_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_GLOBAL + } = require_constants2(); + exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val); + exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str); + exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str); + exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1"); + exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/"); + exports.removeBackslashes = (str) => { + return str.replace(REGEX_REMOVE_BACKSLASH, (match) => { + return match === "\\" ? "" : match; + }); + }; + exports.supportsLookbehinds = () => { + const segs = process.version.slice(1).split(".").map(Number); + if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) { + return true; + } + return false; + }; + exports.isWindows = (options) => { + if (options && typeof options.windows === "boolean") { + return options.windows; + } + return win32 === true || path.sep === "\\"; + }; + exports.escapeLast = (input, char, lastIdx) => { + const idx = input.lastIndexOf(char, lastIdx); + if (idx === -1) + return input; + if (input[idx - 1] === "\\") + return exports.escapeLast(input, char, idx - 1); + return `${input.slice(0, idx)}\\${input.slice(idx)}`; + }; + exports.removePrefix = (input, state = {}) => { + let output = input; + if (output.startsWith("./")) { + output = output.slice(2); + state.prefix = "./"; + } + return output; + }; + exports.wrapOutput = (input, state = {}, options = {}) => { + const prepend = options.contains ? "" : "^"; + const append = options.contains ? "" : "$"; + let output = `${prepend}(?:${input})${append}`; + if (state.negated === true) { + output = `(?:^(?!${output}).*$)`; + } + return output; + }; } }); // -var require_lt = __commonJS({ - ""(exports, module) { - "use strict"; - var compare = require_compare(); - var lt = (a, b, loose) => compare(a, b, loose) < 0; - module.exports = lt; - } -}); - -// -var require_eq = __commonJS({ - ""(exports, module) { - "use strict"; - var compare = require_compare(); - var eq = (a, b, loose) => compare(a, b, loose) === 0; - module.exports = eq; - } -}); - -// -var require_neq = __commonJS({ - ""(exports, module) { - "use strict"; - var compare = require_compare(); - var neq = (a, b, loose) => compare(a, b, loose) !== 0; - module.exports = neq; - } -}); - -// -var require_gte = __commonJS({ - ""(exports, module) { - "use strict"; - var compare = require_compare(); - var gte = (a, b, loose) => compare(a, b, loose) >= 0; - module.exports = gte; - } -}); - -// -var require_lte = __commonJS({ - ""(exports, module) { - "use strict"; - var compare = require_compare(); - var lte = (a, b, loose) => compare(a, b, loose) <= 0; - module.exports = lte; - } -}); - -// -var require_cmp = __commonJS({ - ""(exports, module) { +var require_scan = __commonJS({ + ""(exports, module2) { "use strict"; - var eq = require_eq(); - var neq = require_neq(); - var gt = require_gt(); - var gte = require_gte(); - var lt = require_lt(); - var lte = require_lte(); - var cmp = (a, op, b, loose) => { - switch (op) { - case "===": - if (typeof a === "object") { - a = a.version; - } - if (typeof b === "object") { - b = b.version; - } - return a === b; - case "!==": - if (typeof a === "object") { - a = a.version; - } - if (typeof b === "object") { - b = b.version; - } - return a !== b; - case "": - case "=": - case "==": - return eq(a, b, loose); - case "!=": - return neq(a, b, loose); - case ">": - return gt(a, b, loose); - case ">=": - return gte(a, b, loose); - case "<": - return lt(a, b, loose); - case "<=": - return lte(a, b, loose); - default: - throw new TypeError(`Invalid operator: ${op}`); - } + var utils = require_utils5(); + var { + CHAR_ASTERISK, + /* * */ + CHAR_AT, + /* @ */ + CHAR_BACKWARD_SLASH, + /* \ */ + CHAR_COMMA, + /* , */ + CHAR_DOT, + /* . */ + CHAR_EXCLAMATION_MARK, + /* ! */ + CHAR_FORWARD_SLASH, + /* / */ + CHAR_LEFT_CURLY_BRACE, + /* { */ + CHAR_LEFT_PARENTHESES, + /* ( */ + CHAR_LEFT_SQUARE_BRACKET, + /* [ */ + CHAR_PLUS, + /* + */ + CHAR_QUESTION_MARK, + /* ? */ + CHAR_RIGHT_CURLY_BRACE, + /* } */ + CHAR_RIGHT_PARENTHESES, + /* ) */ + CHAR_RIGHT_SQUARE_BRACKET + /* ] */ + } = require_constants2(); + var isPathSeparator = (code) => { + return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; }; - module.exports = cmp; - } -}); - -// -var require_coerce = __commonJS({ - ""(exports, module) { - "use strict"; - var SemVer = require_semver(); - var parse2 = require_parse(); - var { safeRe: re, t } = require_re(); - var coerce = (version, options) => { - if (version instanceof SemVer) { - return version; - } - if (typeof version === "number") { - version = String(version); - } - if (typeof version !== "string") { - return null; + var depth = (token) => { + if (token.isPrefix !== true) { + token.depth = token.isGlobstar ? Infinity : 1; } - options = options || {}; - let match = null; - if (!options.rtl) { - match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]); - } else { - const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]; + }; + var scan = (input, options) => { + const opts = options || {}; + const length = input.length - 1; + const scanToEnd = opts.parts === true || opts.scanToEnd === true; + const slashes = []; + const tokens = []; + const parts = []; + let str = input; + let index = -1; + let start = 0; + let lastIndex = 0; + let isBrace = false; + let isBracket = false; + let isGlob = false; + let isExtglob = false; + let isGlobstar = false; + let braceEscaped = false; + let backslashes = false; + let negated = false; + let negatedExtglob = false; + let finished = false; + let braces = 0; + let prev; + let code; + let token = { value: "", depth: 0, isGlob: false }; + const eos = () => index >= length; + const peek = () => str.charCodeAt(index + 1); + const advance = () => { + prev = code; + return str.charCodeAt(++index); + }; + while (index < length) { + code = advance(); let next; - while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) { - if (!match || next.index + next[0].length !== match.index + match[0].length) { - match = next; + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + if (code === CHAR_LEFT_CURLY_BRACE) { + braceEscaped = true; } - coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length; + continue; } - coerceRtlRegex.lastIndex = -1; - } - if (match === null) { - return null; - } - const major = match[2]; - const minor = match[3] || "0"; - const patch = match[4] || "0"; - const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ""; - const build = options.includePrerelease && match[6] ? `+${match[6]}` : ""; - return parse2(`${major}.${minor}.${patch}${prerelease}${build}`, options); - }; - module.exports = coerce; - } -}); - -// -var require_lrucache = __commonJS({ - ""(exports, module) { - "use strict"; - var LRUCache = class { - constructor() { - this.max = 1e3; - this.map = /* @__PURE__ */ new Map(); - } - get(key) { - const value = this.map.get(key); - if (value === void 0) { - return void 0; - } else { - this.map.delete(key); - this.map.set(key, value); - return value; + if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { + braces++; + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + if (code === CHAR_LEFT_CURLY_BRACE) { + braces++; + continue; + } + if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + if (scanToEnd === true) { + continue; + } + break; + } + if (braceEscaped !== true && code === CHAR_COMMA) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + if (scanToEnd === true) { + continue; + } + break; + } + if (code === CHAR_RIGHT_CURLY_BRACE) { + braces--; + if (braces === 0) { + braceEscaped = false; + isBrace = token.isBrace = true; + finished = true; + break; + } + } + } + if (scanToEnd === true) { + continue; + } + break; } - } - delete(key) { - return this.map.delete(key); - } - set(key, value) { - const deleted = this.delete(key); - if (!deleted && value !== void 0) { - if (this.map.size >= this.max) { - const firstKey = this.map.keys().next().value; - this.delete(firstKey); + if (code === CHAR_FORWARD_SLASH) { + slashes.push(index); + tokens.push(token); + token = { value: "", depth: 0, isGlob: false }; + if (finished === true) + continue; + if (prev === CHAR_DOT && index === start + 1) { + start += 2; + continue; } - this.map.set(key, value); + lastIndex = index + 1; + continue; } - return this; - } - }; - module.exports = LRUCache; - } -}); - -// -var require_range = __commonJS({ - ""(exports, module) { - "use strict"; - var SPACE_CHARACTERS = /\s+/g; - var Range = class _Range { - constructor(range, options) { - options = parseOptions(options); - if (range instanceof _Range) { - if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) { - return range; - } else { - return new _Range(range.raw, options); + if (opts.noext !== true) { + const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK; + if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + isExtglob = token.isExtglob = true; + finished = true; + if (code === CHAR_EXCLAMATION_MARK && index === start) { + negatedExtglob = true; + } + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + if (code === CHAR_RIGHT_PARENTHESES) { + isGlob = token.isGlob = true; + finished = true; + break; + } + } + continue; + } + break; } } - if (range instanceof Comparator) { - this.raw = range.value; - this.set = [[range]]; - this.formatted = void 0; - return this; + if (code === CHAR_ASTERISK) { + if (prev === CHAR_ASTERISK) + isGlobstar = token.isGlobstar = true; + isGlob = token.isGlob = true; + finished = true; + if (scanToEnd === true) { + continue; + } + break; } - this.options = options; - this.loose = !!options.loose; - this.includePrerelease = !!options.includePrerelease; - this.raw = range.trim().replace(SPACE_CHARACTERS, " "); - this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length); - if (!this.set.length) { - throw new TypeError(`Invalid SemVer Range: ${this.raw}`); + if (code === CHAR_QUESTION_MARK) { + isGlob = token.isGlob = true; + finished = true; + if (scanToEnd === true) { + continue; + } + break; } - if (this.set.length > 1) { - const first = this.set[0]; - this.set = this.set.filter((c) => !isNullSet(c[0])); - if (this.set.length === 0) { - this.set = [first]; - } else if (this.set.length > 1) { - for (const c of this.set) { - if (c.length === 1 && isAny(c[0])) { - this.set = [c]; + if (code === CHAR_LEFT_SQUARE_BRACKET) { + while (eos() !== true && (next = advance())) { + if (next === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + isBracket = token.isBracket = true; + isGlob = token.isGlob = true; + finished = true; + break; + } + } + if (scanToEnd === true) { + continue; + } + break; + } + if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { + negated = token.negated = true; + start++; + continue; + } + if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_LEFT_PARENTHESES) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + if (code === CHAR_RIGHT_PARENTHESES) { + finished = true; break; } } + continue; } + break; + } + if (isGlob === true) { + finished = true; + if (scanToEnd === true) { + continue; + } + break; } - this.formatted = void 0; } - get range() { - if (this.formatted === void 0) { - this.formatted = ""; - for (let i = 0; i < this.set.length; i++) { - if (i > 0) { - this.formatted += "||"; - } - const comps = this.set[i]; - for (let k = 0; k < comps.length; k++) { - if (k > 0) { - this.formatted += " "; - } - this.formatted += comps[k].toString().trim(); + if (opts.noext === true) { + isExtglob = false; + isGlob = false; + } + let base = str; + let prefix = ""; + let glob2 = ""; + if (start > 0) { + prefix = str.slice(0, start); + str = str.slice(start); + lastIndex -= start; + } + if (base && isGlob === true && lastIndex > 0) { + base = str.slice(0, lastIndex); + glob2 = str.slice(lastIndex); + } else if (isGlob === true) { + base = ""; + glob2 = str; + } else { + base = str; + } + if (base && base !== "" && base !== "/" && base !== str) { + if (isPathSeparator(base.charCodeAt(base.length - 1))) { + base = base.slice(0, -1); + } + } + if (opts.unescape === true) { + if (glob2) + glob2 = utils.removeBackslashes(glob2); + if (base && backslashes === true) { + base = utils.removeBackslashes(base); + } + } + const state = { + prefix, + input, + start, + base, + glob: glob2, + isBrace, + isBracket, + isGlob, + isExtglob, + isGlobstar, + negated, + negatedExtglob + }; + if (opts.tokens === true) { + state.maxDepth = 0; + if (!isPathSeparator(code)) { + tokens.push(token); + } + state.tokens = tokens; + } + if (opts.parts === true || opts.tokens === true) { + let prevIndex; + for (let idx = 0; idx < slashes.length; idx++) { + const n3 = prevIndex ? prevIndex + 1 : start; + const i6 = slashes[idx]; + const value = input.slice(n3, i6); + if (opts.tokens) { + if (idx === 0 && start !== 0) { + tokens[idx].isPrefix = true; + tokens[idx].value = prefix; + } else { + tokens[idx].value = value; } + depth(tokens[idx]); + state.maxDepth += tokens[idx].depth; } + if (idx !== 0 || value !== "") { + parts.push(value); + } + prevIndex = i6; } - return this.formatted; - } - format() { - return this.range; + if (prevIndex && prevIndex + 1 < input.length) { + const value = input.slice(prevIndex + 1); + parts.push(value); + if (opts.tokens) { + tokens[tokens.length - 1].value = value; + depth(tokens[tokens.length - 1]); + state.maxDepth += tokens[tokens.length - 1].depth; + } + } + state.slashes = slashes; + state.parts = parts; } - toString() { - return this.range; + return state; + }; + module2.exports = scan; + } +}); + +// +var require_parse2 = __commonJS({ + ""(exports, module2) { + "use strict"; + var constants = require_constants2(); + var utils = require_utils5(); + var { + MAX_LENGTH, + POSIX_REGEX_SOURCE, + REGEX_NON_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_BACKREF, + REPLACEMENTS + } = constants; + var expandRange = (args, options) => { + if (typeof options.expandRange === "function") { + return options.expandRange(...args, options); + } + args.sort(); + const value = `[${args.join("-")}]`; + try { + new RegExp(value); + } catch (ex) { + return args.map((v4) => utils.escapeRegex(v4)).join(".."); } - parseRange(range) { - const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE); - const memoKey = memoOpts + ":" + range; - const cached = cache.get(memoKey); - if (cached) { - return cached; - } - const loose = this.options.loose; - const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]; - range = range.replace(hr, hyphenReplace(this.options.includePrerelease)); - debug("hyphen replace", range); - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace); - debug("comparator trim", range); - range = range.replace(re[t.TILDETRIM], tildeTrimReplace); - debug("tilde trim", range); - range = range.replace(re[t.CARETTRIM], caretTrimReplace); - debug("caret trim", range); - let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options)); - if (loose) { - rangeList = rangeList.filter((comp) => { - debug("loose invalid filter", comp, this.options); - return !!comp.match(re[t.COMPARATORLOOSE]); - }); + return value; + }; + var syntaxError = (type, char) => { + return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; + }; + var parse2 = (input, options) => { + if (typeof input !== "string") { + throw new TypeError("Expected a string"); + } + input = REPLACEMENTS[input] || input; + const opts = { ...options }; + const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + let len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + const bos = { type: "bos", value: "", output: opts.prepend || "" }; + const tokens = [bos]; + const capture = opts.capture ? "" : "?:"; + const win32 = utils.isWindows(options); + const PLATFORM_CHARS = constants.globChars(win32); + const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); + const { + DOT_LITERAL, + PLUS_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK, + QMARK_NO_DOT, + STAR, + START_ANCHOR + } = PLATFORM_CHARS; + const globstar = (opts2) => { + return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + const nodot = opts.dot ? "" : NO_DOT; + const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; + let star = opts.bash === true ? globstar(opts) : STAR; + if (opts.capture) { + star = `(${star})`; + } + if (typeof opts.noext === "boolean") { + opts.noextglob = opts.noext; + } + const state = { + input, + index: -1, + start: 0, + dot: opts.dot === true, + consumed: "", + output: "", + prefix: "", + backtrack: false, + negated: false, + brackets: 0, + braces: 0, + parens: 0, + quotes: 0, + globstar: false, + tokens + }; + input = utils.removePrefix(input, state); + len = input.length; + const extglobs = []; + const braces = []; + const stack = []; + let prev = bos; + let value; + const eos = () => state.index === len - 1; + const peek = state.peek = (n3 = 1) => input[state.index + n3]; + const advance = state.advance = () => input[++state.index] || ""; + const remaining = () => input.slice(state.index + 1); + const consume = (value2 = "", num = 0) => { + state.consumed += value2; + state.index += num; + }; + const append = (token) => { + state.output += token.output != null ? token.output : token.value; + consume(token.value); + }; + const negate = () => { + let count = 1; + while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) { + advance(); + state.start++; + count++; } - debug("range list", rangeList); - const rangeMap = /* @__PURE__ */ new Map(); - const comparators = rangeList.map((comp) => new Comparator(comp, this.options)); - for (const comp of comparators) { - if (isNullSet(comp)) { - return [comp]; - } - rangeMap.set(comp.value, comp); + if (count % 2 === 0) { + return false; } - if (rangeMap.size > 1 && rangeMap.has("")) { - rangeMap.delete(""); + state.negated = true; + state.start++; + return true; + }; + const increment = (type) => { + state[type]++; + stack.push(type); + }; + const decrement = (type) => { + state[type]--; + stack.pop(); + }; + const push = (tok) => { + if (prev.type === "globstar") { + const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace"); + const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren"); + if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) { + state.output = state.output.slice(0, -prev.output.length); + prev.type = "star"; + prev.value = "*"; + prev.output = star; + state.output += prev.output; + } + } + if (extglobs.length && tok.type !== "paren") { + extglobs[extglobs.length - 1].inner += tok.value; + } + if (tok.value || tok.output) + append(tok); + if (prev && prev.type === "text" && tok.type === "text") { + prev.value += tok.value; + prev.output = (prev.output || "") + tok.value; + return; } - const result = [...rangeMap.values()]; - cache.set(memoKey, result); - return result; - } - intersects(range, options) { - if (!(range instanceof _Range)) { - throw new TypeError("a Range is required"); + tok.prev = prev; + tokens.push(tok); + prev = tok; + }; + const extglobOpen = (type, value2) => { + const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" }; + token.prev = prev; + token.parens = state.parens; + token.output = state.output; + const output = (opts.capture ? "(" : "") + token.open; + increment("parens"); + push({ type, value: value2, output: state.output ? "" : ONE_CHAR }); + push({ type: "paren", extglob: true, value: advance(), output }); + extglobs.push(token); + }; + const extglobClose = (token) => { + let output = token.close + (opts.capture ? ")" : ""); + let rest; + if (token.type === "negate") { + let extglobStar = star; + if (token.inner && token.inner.length > 1 && token.inner.includes("/")) { + extglobStar = globstar(opts); + } + if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { + output = token.close = `)$))${extglobStar}`; + } + if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { + const expression = parse2(rest, { ...options, fastpaths: false }).output; + output = token.close = `)${expression})${extglobStar})`; + } + if (token.prev.type === "bos") { + state.negatedExtglob = true; + } } - return this.set.some((thisComparators) => { - return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => { - return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => { - return rangeComparators.every((rangeComparator) => { - return thisComparator.intersects(rangeComparator, options); - }); - }); - }); + push({ type: "paren", extglob: true, value, output }); + decrement("parens"); + }; + if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { + let backslashes = false; + let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m8, esc, chars, first, rest, index) => { + if (first === "\\") { + backslashes = true; + return m8; + } + if (first === "?") { + if (esc) { + return esc + first + (rest ? QMARK.repeat(rest.length) : ""); + } + if (index === 0) { + return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ""); + } + return QMARK.repeat(chars.length); + } + if (first === ".") { + return DOT_LITERAL.repeat(chars.length); + } + if (first === "*") { + if (esc) { + return esc + first + (rest ? star : ""); + } + return star; + } + return esc ? m8 : `\\${m8}`; }); - } - // if ANY of the sets match ALL of its comparators, then pass - test(version) { - if (!version) { - return false; - } - if (typeof version === "string") { - try { - version = new SemVer(version, this.options); - } catch (er) { - return false; + if (backslashes === true) { + if (opts.unescape === true) { + output = output.replace(/\\/g, ""); + } else { + output = output.replace(/\\+/g, (m8) => { + return m8.length % 2 === 0 ? "\\\\" : m8 ? "\\" : ""; + }); } } - for (let i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) { - return true; - } + if (output === input && opts.contains === true) { + state.output = input; + return state; } - return false; - } - }; - module.exports = Range; - var LRU = require_lrucache(); - var cache = new LRU(); - var parseOptions = require_parse_options(); - var Comparator = require_comparator(); - var debug = require_debug(); - var SemVer = require_semver(); - var { - safeRe: re, - t, - comparatorTrimReplace, - tildeTrimReplace, - caretTrimReplace - } = require_re(); - var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants(); - var isNullSet = (c) => c.value === "<0.0.0-0"; - var isAny = (c) => c.value === ""; - var isSatisfiable = (comparators, options) => { - let result = true; - const remainingComparators = comparators.slice(); - let testComparator = remainingComparators.pop(); - while (result && remainingComparators.length) { - result = remainingComparators.every((otherComparator) => { - return testComparator.intersects(otherComparator, options); - }); - testComparator = remainingComparators.pop(); + state.output = utils.wrapOutput(output, state, options); + return state; } - return result; - }; - var parseComparator = (comp, options) => { - debug("comp", comp, options); - comp = replaceCarets(comp, options); - debug("caret", comp); - comp = replaceTildes(comp, options); - debug("tildes", comp); - comp = replaceXRanges(comp, options); - debug("xrange", comp); - comp = replaceStars(comp, options); - debug("stars", comp); - return comp; - }; - var isX = (id) => !id || id.toLowerCase() === "x" || id === "*"; - var replaceTildes = (comp, options) => { - return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" "); - }; - var replaceTilde = (comp, options) => { - const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]; - return comp.replace(r, (_, M, m, p, pr) => { - debug("tilde", comp, _, M, m, p, pr); - let ret; - if (isX(M)) { - ret = ""; - } else if (isX(m)) { - ret = `>=${M}.0.0 <${+M + 1}.0.0-0`; - } else if (isX(p)) { - ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`; - } else if (pr) { - debug("replaceTilde pr", pr); - ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`; - } else { - ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`; + while (!eos()) { + value = advance(); + if (value === "\0") { + continue; } - debug("tilde return", ret); - return ret; - }); - }; - var replaceCarets = (comp, options) => { - return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" "); - }; - var replaceCaret = (comp, options) => { - debug("caret", comp, options); - const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]; - const z = options.includePrerelease ? "-0" : ""; - return comp.replace(r, (_, M, m, p, pr) => { - debug("caret", comp, _, M, m, p, pr); - let ret; - if (isX(M)) { - ret = ""; - } else if (isX(m)) { - ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`; - } else if (isX(p)) { - if (M === "0") { - ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`; - } else { - ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`; + if (value === "\\") { + const next = peek(); + if (next === "/" && opts.bash !== true) { + continue; } - } else if (pr) { - debug("replaceCaret pr", pr); - if (M === "0") { - if (m === "0") { - ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`; - } else { - ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`; + if (next === "." || next === ";") { + continue; + } + if (!next) { + value += "\\"; + push({ type: "text", value }); + continue; + } + const match = /^\\+/.exec(remaining()); + let slashes = 0; + if (match && match[0].length > 2) { + slashes = match[0].length; + state.index += slashes; + if (slashes % 2 !== 0) { + value += "\\"; } + } + if (opts.unescape === true) { + value = advance(); } else { - ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`; + value += advance(); } - } else { - debug("no pr"); - if (M === "0") { - if (m === "0") { - ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`; - } else { - ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`; + if (state.brackets === 0) { + push({ type: "text", value }); + continue; + } + } + if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) { + if (opts.posix !== false && value === ":") { + const inner = prev.value.slice(1); + if (inner.includes("[")) { + prev.posix = true; + if (inner.includes(":")) { + const idx = prev.value.lastIndexOf("["); + const pre = prev.value.slice(0, idx); + const rest2 = prev.value.slice(idx + 2); + const posix = POSIX_REGEX_SOURCE[rest2]; + if (posix) { + prev.value = pre + posix; + state.backtrack = true; + advance(); + if (!bos.output && tokens.indexOf(prev) === 1) { + bos.output = ONE_CHAR; + } + continue; + } + } } - } else { - ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`; } + if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") { + value = `\\${value}`; + } + if (value === "]" && (prev.value === "[" || prev.value === "[^")) { + value = `\\${value}`; + } + if (opts.posix === true && value === "!" && prev.value === "[") { + value = "^"; + } + prev.value += value; + append({ value }); + continue; } - debug("caret return", ret); - return ret; - }); - }; - var replaceXRanges = (comp, options) => { - debug("replaceXRanges", comp, options); - return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" "); - }; - var replaceXRange = (comp, options) => { - comp = comp.trim(); - const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]; - return comp.replace(r, (ret, gtlt, M, m, p, pr) => { - debug("xRange", comp, ret, gtlt, M, m, p, pr); - const xM = isX(M); - const xm = xM || isX(m); - const xp = xm || isX(p); - const anyX = xp; - if (gtlt === "=" && anyX) { - gtlt = ""; + if (state.quotes === 1 && value !== '"') { + value = utils.escapeRegex(value); + prev.value += value; + append({ value }); + continue; } - pr = options.includePrerelease ? "-0" : ""; - if (xM) { - if (gtlt === ">" || gtlt === "<") { - ret = "<0.0.0-0"; - } else { - ret = "*"; - } - } else if (gtlt && anyX) { - if (xm) { - m = 0; + if (value === '"') { + state.quotes = state.quotes === 1 ? 0 : 1; + if (opts.keepQuotes === true) { + push({ type: "text", value }); } - p = 0; - if (gtlt === ">") { - gtlt = ">="; - if (xm) { - M = +M + 1; - m = 0; - p = 0; - } else { - m = +m + 1; - p = 0; - } - } else if (gtlt === "<=") { - gtlt = "<"; - if (xm) { - M = +M + 1; - } else { - m = +m + 1; - } + continue; + } + if (value === "(") { + increment("parens"); + push({ type: "paren", value }); + continue; + } + if (value === ")") { + if (state.parens === 0 && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError("opening", "(")); } - if (gtlt === "<") { - pr = "-0"; + const extglob = extglobs[extglobs.length - 1]; + if (extglob && state.parens === extglob.parens + 1) { + extglobClose(extglobs.pop()); + continue; } - ret = `${gtlt + M}.${m}.${p}${pr}`; - } else if (xm) { - ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`; - } else if (xp) { - ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`; + push({ type: "paren", value, output: state.parens ? ")" : "\\)" }); + decrement("parens"); + continue; } - debug("xRange return", ret); - return ret; - }); - }; - var replaceStars = (comp, options) => { - debug("replaceStars", comp, options); - return comp.trim().replace(re[t.STAR], ""); - }; - var replaceGTE0 = (comp, options) => { - debug("replaceGTE0", comp, options); - return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], ""); - }; - var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => { - if (isX(fM)) { - from = ""; - } else if (isX(fm)) { - from = `>=${fM}.0.0${incPr ? "-0" : ""}`; - } else if (isX(fp)) { - from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`; - } else if (fpr) { - from = `>=${from}`; - } else { - from = `>=${from}${incPr ? "-0" : ""}`; - } - if (isX(tM)) { - to = ""; - } else if (isX(tm)) { - to = `<${+tM + 1}.0.0-0`; - } else if (isX(tp)) { - to = `<${tM}.${+tm + 1}.0-0`; - } else if (tpr) { - to = `<=${tM}.${tm}.${tp}-${tpr}`; - } else if (incPr) { - to = `<${tM}.${tm}.${+tp + 1}-0`; - } else { - to = `<=${to}`; - } - return `${from} ${to}`.trim(); - }; - var testSet = (set, version, options) => { - for (let i = 0; i < set.length; i++) { - if (!set[i].test(version)) { - return false; + if (value === "[") { + if (opts.nobracket === true || !remaining().includes("]")) { + if (opts.nobracket !== true && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError("closing", "]")); + } + value = `\\${value}`; + } else { + increment("brackets"); + } + push({ type: "bracket", value }); + continue; } - } - if (version.prerelease.length && !options.includePrerelease) { - for (let i = 0; i < set.length; i++) { - debug(set[i].semver); - if (set[i].semver === Comparator.ANY) { + if (value === "]") { + if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) { + push({ type: "text", value, output: `\\${value}` }); continue; } - if (set[i].semver.prerelease.length > 0) { - const allowed = set[i].semver; - if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) { - return true; + if (state.brackets === 0) { + if (opts.strictBrackets === true) { + throw new SyntaxError(syntaxError("opening", "[")); } + push({ type: "text", value, output: `\\${value}` }); + continue; + } + decrement("brackets"); + const prevValue = prev.value.slice(1); + if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) { + value = `/${value}`; + } + prev.value += value; + append({ value }); + if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { + continue; } + const escaped = utils.escapeRegex(prev.value); + state.output = state.output.slice(0, -prev.value.length); + if (opts.literalBrackets === true) { + state.output += escaped; + prev.value = escaped; + continue; + } + prev.value = `(${capture}${escaped}|${prev.value})`; + state.output += prev.value; + continue; } - return false; - } - return true; - }; - } -}); - -// -var require_comparator = __commonJS({ - ""(exports, module) { - "use strict"; - var ANY = Symbol("SemVer ANY"); - var Comparator = class _Comparator { - static get ANY() { - return ANY; - } - constructor(comp, options) { - options = parseOptions(options); - if (comp instanceof _Comparator) { - if (comp.loose === !!options.loose) { - return comp; - } else { - comp = comp.value; + if (value === "{" && opts.nobrace !== true) { + increment("braces"); + const open = { + type: "brace", + value, + output: "(", + outputIndex: state.output.length, + tokensIndex: state.tokens.length + }; + braces.push(open); + push(open); + continue; + } + if (value === "}") { + const brace = braces[braces.length - 1]; + if (opts.nobrace === true || !brace) { + push({ type: "text", value, output: value }); + continue; + } + let output = ")"; + if (brace.dots === true) { + const arr = tokens.slice(); + const range = []; + for (let i6 = arr.length - 1; i6 >= 0; i6--) { + tokens.pop(); + if (arr[i6].type === "brace") { + break; + } + if (arr[i6].type !== "dots") { + range.unshift(arr[i6].value); + } + } + output = expandRange(range, opts); + state.backtrack = true; + } + if (brace.comma !== true && brace.dots !== true) { + const out = state.output.slice(0, brace.outputIndex); + const toks = state.tokens.slice(brace.tokensIndex); + brace.value = brace.output = "\\{"; + value = output = "\\}"; + state.output = out; + for (const t3 of toks) { + state.output += t3.output || t3.value; + } } + push({ type: "brace", value, output }); + decrement("braces"); + braces.pop(); + continue; } - comp = comp.trim().split(/\s+/).join(" "); - debug("comparator", comp, options); - this.options = options; - this.loose = !!options.loose; - this.parse(comp); - if (this.semver === ANY) { - this.value = ""; - } else { - this.value = this.operator + this.semver.version; + if (value === "|") { + if (extglobs.length > 0) { + extglobs[extglobs.length - 1].conditions++; + } + push({ type: "text", value }); + continue; } - debug("comp", this); - } - parse(comp) { - const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; - const m = comp.match(r); - if (!m) { - throw new TypeError(`Invalid comparator: ${comp}`); + if (value === ",") { + let output = value; + const brace = braces[braces.length - 1]; + if (brace && stack[stack.length - 1] === "braces") { + brace.comma = true; + output = "|"; + } + push({ type: "comma", value, output }); + continue; } - this.operator = m[1] !== void 0 ? m[1] : ""; - if (this.operator === "=") { - this.operator = ""; + if (value === "/") { + if (prev.type === "dot" && state.index === state.start + 1) { + state.start = state.index + 1; + state.consumed = ""; + state.output = ""; + tokens.pop(); + prev = bos; + continue; + } + push({ type: "slash", value, output: SLASH_LITERAL }); + continue; } - if (!m[2]) { - this.semver = ANY; - } else { - this.semver = new SemVer(m[2], this.options.loose); + if (value === ".") { + if (state.braces > 0 && prev.type === "dot") { + if (prev.value === ".") + prev.output = DOT_LITERAL; + const brace = braces[braces.length - 1]; + prev.type = "dots"; + prev.output += value; + prev.value += value; + brace.dots = true; + continue; + } + if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") { + push({ type: "text", value, output: DOT_LITERAL }); + continue; + } + push({ type: "dot", value, output: DOT_LITERAL }); + continue; } - } - toString() { - return this.value; - } - test(version) { - debug("Comparator.test", version, this.options.loose); - if (this.semver === ANY || version === ANY) { - return true; + if (value === "?") { + const isGroup = prev && prev.value === "("; + if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") { + extglobOpen("qmark", value); + continue; + } + if (prev && prev.type === "paren") { + const next = peek(); + let output = value; + if (next === "<" && !utils.supportsLookbehinds()) { + throw new Error("Node.js v10 or higher is required for regex lookbehinds"); + } + if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) { + output = `\\${value}`; + } + push({ type: "text", value, output }); + continue; + } + if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) { + push({ type: "qmark", value, output: QMARK_NO_DOT }); + continue; + } + push({ type: "qmark", value, output: QMARK }); + continue; } - if (typeof version === "string") { - try { - version = new SemVer(version, this.options); - } catch (er) { - return false; + if (value === "!") { + if (opts.noextglob !== true && peek() === "(") { + if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) { + extglobOpen("negate", value); + continue; + } + } + if (opts.nonegate !== true && state.index === 0) { + negate(); + continue; } } - return cmp(version, this.operator, this.semver, this.options); - } - intersects(comp, options) { - if (!(comp instanceof _Comparator)) { - throw new TypeError("a Comparator is required"); + if (value === "+") { + if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") { + extglobOpen("plus", value); + continue; + } + if (prev && prev.value === "(" || opts.regex === false) { + push({ type: "plus", value, output: PLUS_LITERAL }); + continue; + } + if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) { + push({ type: "plus", value }); + continue; + } + push({ type: "plus", value: PLUS_LITERAL }); + continue; } - if (this.operator === "") { - if (this.value === "") { - return true; + if (value === "@") { + if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") { + push({ type: "at", extglob: true, value, output: "" }); + continue; } - return new Range(comp.value, options).test(this.value); - } else if (comp.operator === "") { - if (comp.value === "") { - return true; + push({ type: "text", value }); + continue; + } + if (value !== "*") { + if (value === "$" || value === "^") { + value = `\\${value}`; } - return new Range(this.value, options).test(comp.semver); + const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); + if (match) { + value += match[0]; + state.index += match[0].length; + } + push({ type: "text", value }); + continue; } - options = parseOptions(options); - if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) { - return false; + if (prev && (prev.type === "globstar" || prev.star === true)) { + prev.type = "star"; + prev.star = true; + prev.value += value; + prev.output = star; + state.backtrack = true; + state.globstar = true; + consume(value); + continue; } - if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) { - return false; + let rest = remaining(); + if (opts.noextglob !== true && /^\([^?]/.test(rest)) { + extglobOpen("star", value); + continue; } - if (this.operator.startsWith(">") && comp.operator.startsWith(">")) { - return true; + if (prev.type === "star") { + if (opts.noglobstar === true) { + consume(value); + continue; + } + const prior = prev.prev; + const before = prior.prev; + const isStart = prior.type === "slash" || prior.type === "bos"; + const afterStar = before && (before.type === "star" || before.type === "globstar"); + if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) { + push({ type: "star", value, output: "" }); + continue; + } + const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace"); + const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren"); + if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) { + push({ type: "star", value, output: "" }); + continue; + } + while (rest.slice(0, 3) === "/**") { + const after = input[state.index + 4]; + if (after && after !== "/") { + break; + } + rest = rest.slice(3); + consume("/**", 3); + } + if (prior.type === "bos" && eos()) { + prev.type = "globstar"; + prev.value += value; + prev.output = globstar(opts); + state.output = prev.output; + state.globstar = true; + consume(value); + continue; + } + if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) { + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + prev.type = "globstar"; + prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)"); + prev.value += value; + state.globstar = true; + state.output += prior.output + prev.output; + consume(value); + continue; + } + if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") { + const end = rest[1] !== void 0 ? "|$" : ""; + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + prev.type = "globstar"; + prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; + prev.value += value; + state.output += prior.output + prev.output; + state.globstar = true; + consume(value + advance()); + push({ type: "slash", value: "/", output: "" }); + continue; + } + if (prior.type === "bos" && rest[0] === "/") { + prev.type = "globstar"; + prev.value += value; + prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; + state.output = prev.output; + state.globstar = true; + consume(value + advance()); + push({ type: "slash", value: "/", output: "" }); + continue; + } + state.output = state.output.slice(0, -prev.output.length); + prev.type = "globstar"; + prev.output = globstar(opts); + prev.value += value; + state.output += prev.output; + state.globstar = true; + consume(value); + continue; } - if (this.operator.startsWith("<") && comp.operator.startsWith("<")) { - return true; + const token = { type: "star", value, output: star }; + if (opts.bash === true) { + token.output = ".*?"; + if (prev.type === "bos" || prev.type === "slash") { + token.output = nodot + token.output; + } + push(token); + continue; } - if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) { - return true; + if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) { + token.output = value; + push(token); + continue; } - if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) { - return true; + if (state.index === state.start || prev.type === "slash" || prev.type === "dot") { + if (prev.type === "dot") { + state.output += NO_DOT_SLASH; + prev.output += NO_DOT_SLASH; + } else if (opts.dot === true) { + state.output += NO_DOTS_SLASH; + prev.output += NO_DOTS_SLASH; + } else { + state.output += nodot; + prev.output += nodot; + } + if (peek() !== "*") { + state.output += ONE_CHAR; + prev.output += ONE_CHAR; + } } - if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) { - return true; + push(token); + } + while (state.brackets > 0) { + if (opts.strictBrackets === true) + throw new SyntaxError(syntaxError("closing", "]")); + state.output = utils.escapeLast(state.output, "["); + decrement("brackets"); + } + while (state.parens > 0) { + if (opts.strictBrackets === true) + throw new SyntaxError(syntaxError("closing", ")")); + state.output = utils.escapeLast(state.output, "("); + decrement("parens"); + } + while (state.braces > 0) { + if (opts.strictBrackets === true) + throw new SyntaxError(syntaxError("closing", "}")); + state.output = utils.escapeLast(state.output, "{"); + decrement("braces"); + } + if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) { + push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` }); + } + if (state.backtrack === true) { + state.output = ""; + for (const token of state.tokens) { + state.output += token.output != null ? token.output : token.value; + if (token.suffix) { + state.output += token.suffix; + } } - return false; } + return state; }; - module.exports = Comparator; - var parseOptions = require_parse_options(); - var { safeRe: re, t } = require_re(); - var cmp = require_cmp(); - var debug = require_debug(); - var SemVer = require_semver(); - var Range = require_range(); + parse2.fastpaths = (input, options) => { + const opts = { ...options }; + const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + const len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + input = REPLACEMENTS[input] || input; + const win32 = utils.isWindows(options); + const { + DOT_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOTS_SLASH, + STAR, + START_ANCHOR + } = constants.globChars(win32); + const nodot = opts.dot ? NO_DOTS : NO_DOT; + const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; + const capture = opts.capture ? "" : "?:"; + const state = { negated: false, prefix: "" }; + let star = opts.bash === true ? ".*?" : STAR; + if (opts.capture) { + star = `(${star})`; + } + const globstar = (opts2) => { + if (opts2.noglobstar === true) + return star; + return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + const create = (str) => { + switch (str) { + case "*": + return `${nodot}${ONE_CHAR}${star}`; + case ".*": + return `${DOT_LITERAL}${ONE_CHAR}${star}`; + case "*.*": + return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + case "*/*": + return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; + case "**": + return nodot + globstar(opts); + case "**/*": + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; + case "**/*.*": + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + case "**/.*": + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; + default: { + const match = /^(.*?)\.(\w+)$/.exec(str); + if (!match) + return; + const source2 = create(match[1]); + if (!source2) + return; + return source2 + DOT_LITERAL + match[2]; + } + } + }; + const output = utils.removePrefix(input, state); + let source = create(output); + if (source && opts.strictSlashes !== true) { + source += `${SLASH_LITERAL}?`; + } + return source; + }; + module2.exports = parse2; } }); // -var require_satisfies = __commonJS({ - ""(exports, module) { +var require_picomatch = __commonJS({ + ""(exports, module2) { "use strict"; - var Range = require_range(); - var satisfies = (version, range, options) => { + var path = __require("path"); + var scan = require_scan(); + var parse2 = require_parse2(); + var utils = require_utils5(); + var constants = require_constants2(); + var isObject = (val) => val && typeof val === "object" && !Array.isArray(val); + var picomatch = (glob2, options, returnState = false) => { + if (Array.isArray(glob2)) { + const fns = glob2.map((input) => picomatch(input, options, returnState)); + const arrayMatcher = (str) => { + for (const isMatch of fns) { + const state2 = isMatch(str); + if (state2) + return state2; + } + return false; + }; + return arrayMatcher; + } + const isState = isObject(glob2) && glob2.tokens && glob2.input; + if (glob2 === "" || typeof glob2 !== "string" && !isState) { + throw new TypeError("Expected pattern to be a non-empty string"); + } + const opts = options || {}; + const posix = utils.isWindows(options); + const regex = isState ? picomatch.compileRe(glob2, options) : picomatch.makeRe(glob2, options, false, true); + const state = regex.state; + delete regex.state; + let isIgnored = () => false; + if (opts.ignore) { + const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; + isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); + } + const matcher = (input, returnObject = false) => { + const { isMatch, match, output } = picomatch.test(input, regex, options, { glob: glob2, posix }); + const result = { glob: glob2, state, regex, posix, input, output, match, isMatch }; + if (typeof opts.onResult === "function") { + opts.onResult(result); + } + if (isMatch === false) { + result.isMatch = false; + return returnObject ? result : false; + } + if (isIgnored(input)) { + if (typeof opts.onIgnore === "function") { + opts.onIgnore(result); + } + result.isMatch = false; + return returnObject ? result : false; + } + if (typeof opts.onMatch === "function") { + opts.onMatch(result); + } + return returnObject ? result : true; + }; + if (returnState) { + matcher.state = state; + } + return matcher; + }; + picomatch.test = (input, regex, options, { glob: glob2, posix } = {}) => { + if (typeof input !== "string") { + throw new TypeError("Expected input to be a string"); + } + if (input === "") { + return { isMatch: false, output: "" }; + } + const opts = options || {}; + const format = opts.format || (posix ? utils.toPosixSlashes : null); + let match = input === glob2; + let output = match && format ? format(input) : input; + if (match === false) { + output = format ? format(input) : input; + match = output === glob2; + } + if (match === false || opts.capture === true) { + if (opts.matchBase === true || opts.basename === true) { + match = picomatch.matchBase(input, regex, options, posix); + } else { + match = regex.exec(output); + } + } + return { isMatch: Boolean(match), match, output }; + }; + picomatch.matchBase = (input, glob2, options, posix = utils.isWindows(options)) => { + const regex = glob2 instanceof RegExp ? glob2 : picomatch.makeRe(glob2, options); + return regex.test(path.basename(input)); + }; + picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); + picomatch.parse = (pattern, options) => { + if (Array.isArray(pattern)) + return pattern.map((p5) => picomatch.parse(p5, options)); + return parse2(pattern, { ...options, fastpaths: false }); + }; + picomatch.scan = (input, options) => scan(input, options); + picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => { + if (returnOutput === true) { + return state.output; + } + const opts = options || {}; + const prepend = opts.contains ? "" : "^"; + const append = opts.contains ? "" : "$"; + let source = `${prepend}(?:${state.output})${append}`; + if (state && state.negated === true) { + source = `^(?!${source}).*$`; + } + const regex = picomatch.toRegex(source, options); + if (returnState === true) { + regex.state = state; + } + return regex; + }; + picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { + if (!input || typeof input !== "string") { + throw new TypeError("Expected a non-empty string"); + } + let parsed = { negated: false, fastpaths: true }; + if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) { + parsed.output = parse2.fastpaths(input, options); + } + if (!parsed.output) { + parsed = parse2(input, options); + } + return picomatch.compileRe(parsed, options, returnOutput, returnState); + }; + picomatch.toRegex = (source, options) => { try { - range = new Range(range, options); - } catch (er) { - return false; + const opts = options || {}; + return new RegExp(source, opts.flags || (opts.nocase ? "i" : "")); + } catch (err) { + if (options && options.debug === true) + throw err; + return /$^/; } - return range.test(version); }; - module.exports = satisfies; + picomatch.constants = constants; + module2.exports = picomatch; } }); // -var require_to_comparators = __commonJS({ - ""(exports, module) { +var require_picomatch2 = __commonJS({ + ""(exports, module2) { "use strict"; - var Range = require_range(); - var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" ")); - module.exports = toComparators; + module2.exports = require_picomatch(); } }); // -var require_max_satisfying = __commonJS({ - ""(exports, module) { +var require_micromatch = __commonJS({ + ""(exports, module2) { "use strict"; - var SemVer = require_semver(); - var Range = require_range(); - var maxSatisfying = (versions, range, options) => { - let max = null; - let maxSV = null; - let rangeObj = null; - try { - rangeObj = new Range(range, options); - } catch (er) { - return null; - } - versions.forEach((v) => { - if (rangeObj.test(v)) { - if (!max || maxSV.compare(v) === -1) { - max = v; - maxSV = new SemVer(max, options); + var util = __require("util"); + var braces = require_braces(); + var picomatch = require_picomatch2(); + var utils = require_utils5(); + var isEmptyString = (v4) => v4 === "" || v4 === "./"; + var hasBraces = (v4) => { + const index = v4.indexOf("{"); + return index > -1 && v4.indexOf("}", index) > -1; + }; + var micromatch = (list, patterns, options) => { + patterns = [].concat(patterns); + list = [].concat(list); + let omit2 = /* @__PURE__ */ new Set(); + let keep = /* @__PURE__ */ new Set(); + let items = /* @__PURE__ */ new Set(); + let negatives = 0; + let onResult = (state) => { + items.add(state.output); + if (options && options.onResult) { + options.onResult(state); + } + }; + for (let i6 = 0; i6 < patterns.length; i6++) { + let isMatch = picomatch(String(patterns[i6]), { ...options, onResult }, true); + let negated = isMatch.state.negated || isMatch.state.negatedExtglob; + if (negated) + negatives++; + for (let item of list) { + let matched = isMatch(item, true); + let match = negated ? !matched.isMatch : matched.isMatch; + if (!match) + continue; + if (negated) { + omit2.add(matched.output); + } else { + omit2.delete(matched.output); + keep.add(matched.output); } } - }); - return max; + } + let result = negatives === patterns.length ? [...items] : [...keep]; + let matches = result.filter((item) => !omit2.has(item)); + if (options && matches.length === 0) { + if (options.failglob === true) { + throw new Error(`No matches found for "${patterns.join(", ")}"`); + } + if (options.nonull === true || options.nullglob === true) { + return options.unescape ? patterns.map((p5) => p5.replace(/\\/g, "")) : patterns; + } + } + return matches; }; - module.exports = maxSatisfying; - } -}); - -// -var require_min_satisfying = __commonJS({ - ""(exports, module) { - "use strict"; - var SemVer = require_semver(); - var Range = require_range(); - var minSatisfying = (versions, range, options) => { - let min = null; - let minSV = null; - let rangeObj = null; - try { - rangeObj = new Range(range, options); - } catch (er) { - return null; + micromatch.match = micromatch; + micromatch.matcher = (pattern, options) => picomatch(pattern, options); + micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); + micromatch.any = micromatch.isMatch; + micromatch.not = (list, patterns, options = {}) => { + patterns = [].concat(patterns).map(String); + let result = /* @__PURE__ */ new Set(); + let items = []; + let onResult = (state) => { + if (options.onResult) + options.onResult(state); + items.push(state.output); + }; + let matches = new Set(micromatch(list, patterns, { ...options, onResult })); + for (let item of items) { + if (!matches.has(item)) { + result.add(item); + } } - versions.forEach((v) => { - if (rangeObj.test(v)) { - if (!min || minSV.compare(v) === 1) { - min = v; - minSV = new SemVer(min, options); - } + return [...result]; + }; + micromatch.contains = (str, pattern, options) => { + if (typeof str !== "string") { + throw new TypeError(`Expected a string: "${util.inspect(str)}"`); + } + if (Array.isArray(pattern)) { + return pattern.some((p5) => micromatch.contains(str, p5, options)); + } + if (typeof pattern === "string") { + if (isEmptyString(str) || isEmptyString(pattern)) { + return false; } - }); - return min; + if (str.includes(pattern) || str.startsWith("./") && str.slice(2).includes(pattern)) { + return true; + } + } + return micromatch.isMatch(str, pattern, { ...options, contains: true }); }; - module.exports = minSatisfying; - } -}); - -// -var require_min_version = __commonJS({ - ""(exports, module) { - "use strict"; - var SemVer = require_semver(); - var Range = require_range(); - var gt = require_gt(); - var minVersion = (range, loose) => { - range = new Range(range, loose); - let minver = new SemVer("0.0.0"); - if (range.test(minver)) { - return minver; + micromatch.matchKeys = (obj, patterns, options) => { + if (!utils.isObject(obj)) { + throw new TypeError("Expected the first argument to be an object"); + } + let keys = micromatch(Object.keys(obj), patterns, options); + let res = {}; + for (let key of keys) + res[key] = obj[key]; + return res; + }; + micromatch.some = (list, patterns, options) => { + let items = [].concat(list); + for (let pattern of [].concat(patterns)) { + let isMatch = picomatch(String(pattern), options); + if (items.some((item) => isMatch(item))) { + return true; + } } - minver = new SemVer("0.0.0-0"); - if (range.test(minver)) { - return minver; + return false; + }; + micromatch.every = (list, patterns, options) => { + let items = [].concat(list); + for (let pattern of [].concat(patterns)) { + let isMatch = picomatch(String(pattern), options); + if (!items.every((item) => isMatch(item))) { + return false; + } } - minver = null; - for (let i = 0; i < range.set.length; ++i) { - const comparators = range.set[i]; - let setMin = null; - comparators.forEach((comparator) => { - const compver = new SemVer(comparator.semver.version); - switch (comparator.operator) { - case ">": - if (compver.prerelease.length === 0) { - compver.patch++; - } else { - compver.prerelease.push(0); - } - compver.raw = compver.format(); - /* fallthrough */ - case "": - case ">=": - if (!setMin || gt(compver, setMin)) { - setMin = compver; - } - break; - case "<": - case "<=": - break; - /* istanbul ignore next */ - default: - throw new Error(`Unexpected operation: ${comparator.operator}`); - } - }); - if (setMin && (!minver || gt(minver, setMin))) { - minver = setMin; + return true; + }; + micromatch.all = (str, patterns, options) => { + if (typeof str !== "string") { + throw new TypeError(`Expected a string: "${util.inspect(str)}"`); + } + return [].concat(patterns).every((p5) => picomatch(p5, options)(str)); + }; + micromatch.capture = (glob2, input, options) => { + let posix = utils.isWindows(options); + let regex = picomatch.makeRe(String(glob2), { ...options, capture: true }); + let match = regex.exec(posix ? utils.toPosixSlashes(input) : input); + if (match) { + return match.slice(1).map((v4) => v4 === void 0 ? "" : v4); + } + }; + micromatch.makeRe = (...args) => picomatch.makeRe(...args); + micromatch.scan = (...args) => picomatch.scan(...args); + micromatch.parse = (patterns, options) => { + let res = []; + for (let pattern of [].concat(patterns || [])) { + for (let str of braces(String(pattern), options)) { + res.push(picomatch.parse(str, options)); } } - if (minver && range.test(minver)) { - return minver; + return res; + }; + micromatch.braces = (pattern, options) => { + if (typeof pattern !== "string") + throw new TypeError("Expected a string"); + if (options && options.nobrace === true || !hasBraces(pattern)) { + return [pattern]; } - return null; + return braces(pattern, options); + }; + micromatch.braceExpand = (pattern, options) => { + if (typeof pattern !== "string") + throw new TypeError("Expected a string"); + return micromatch.braces(pattern, { ...options, expand: true }); }; - module.exports = minVersion; + micromatch.hasBraces = hasBraces; + module2.exports = micromatch; } }); // -var require_valid2 = __commonJS({ - ""(exports, module) { +var require_pattern = __commonJS({ + ""(exports) { "use strict"; - var Range = require_range(); - var validRange = (range, options) => { - try { - return new Range(range, options).range || "*"; - } catch (er) { - return null; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0; + var path = __require("path"); + var globParent = require_glob_parent(); + var micromatch = require_micromatch(); + var GLOBSTAR = "**"; + var ESCAPE_SYMBOL = "\\"; + var COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/; + var REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/; + var REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/; + var GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/; + var BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./; + var DOUBLE_SLASH_RE = /(?!^)\/{2,}/g; + function isStaticPattern(pattern, options = {}) { + return !isDynamicPattern(pattern, options); + } + exports.isStaticPattern = isStaticPattern; + function isDynamicPattern(pattern, options = {}) { + if (pattern === "") { + return false; } - }; - module.exports = validRange; + if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) { + return true; + } + if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) { + return true; + } + if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) { + return true; + } + if (options.braceExpansion !== false && hasBraceExpansion(pattern)) { + return true; + } + return false; + } + exports.isDynamicPattern = isDynamicPattern; + function hasBraceExpansion(pattern) { + const openingBraceIndex = pattern.indexOf("{"); + if (openingBraceIndex === -1) { + return false; + } + const closingBraceIndex = pattern.indexOf("}", openingBraceIndex + 1); + if (closingBraceIndex === -1) { + return false; + } + const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex); + return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent); + } + function convertToPositivePattern(pattern) { + return isNegativePattern(pattern) ? pattern.slice(1) : pattern; + } + exports.convertToPositivePattern = convertToPositivePattern; + function convertToNegativePattern(pattern) { + return "!" + pattern; + } + exports.convertToNegativePattern = convertToNegativePattern; + function isNegativePattern(pattern) { + return pattern.startsWith("!") && pattern[1] !== "("; + } + exports.isNegativePattern = isNegativePattern; + function isPositivePattern(pattern) { + return !isNegativePattern(pattern); + } + exports.isPositivePattern = isPositivePattern; + function getNegativePatterns(patterns) { + return patterns.filter(isNegativePattern); + } + exports.getNegativePatterns = getNegativePatterns; + function getPositivePatterns(patterns) { + return patterns.filter(isPositivePattern); + } + exports.getPositivePatterns = getPositivePatterns; + function getPatternsInsideCurrentDirectory(patterns) { + return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern)); + } + exports.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory; + function getPatternsOutsideCurrentDirectory(patterns) { + return patterns.filter(isPatternRelatedToParentDirectory); + } + exports.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory; + function isPatternRelatedToParentDirectory(pattern) { + return pattern.startsWith("..") || pattern.startsWith("./.."); + } + exports.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory; + function getBaseDirectory(pattern) { + return globParent(pattern, { flipBackslashes: false }); + } + exports.getBaseDirectory = getBaseDirectory; + function hasGlobStar(pattern) { + return pattern.includes(GLOBSTAR); + } + exports.hasGlobStar = hasGlobStar; + function endsWithSlashGlobStar(pattern) { + return pattern.endsWith("/" + GLOBSTAR); + } + exports.endsWithSlashGlobStar = endsWithSlashGlobStar; + function isAffectDepthOfReadingPattern(pattern) { + const basename = path.basename(pattern); + return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); + } + exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; + function expandPatternsWithBraceExpansion(patterns) { + return patterns.reduce((collection, pattern) => { + return collection.concat(expandBraceExpansion(pattern)); + }, []); + } + exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion; + function expandBraceExpansion(pattern) { + const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true }); + patterns.sort((a7, b3) => a7.length - b3.length); + return patterns.filter((pattern2) => pattern2 !== ""); + } + exports.expandBraceExpansion = expandBraceExpansion; + function getPatternParts(pattern, options) { + let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true })); + if (parts.length === 0) { + parts = [pattern]; + } + if (parts[0].startsWith("/")) { + parts[0] = parts[0].slice(1); + parts.unshift(""); + } + return parts; + } + exports.getPatternParts = getPatternParts; + function makeRe(pattern, options) { + return micromatch.makeRe(pattern, options); + } + exports.makeRe = makeRe; + function convertPatternsToRe(patterns, options) { + return patterns.map((pattern) => makeRe(pattern, options)); + } + exports.convertPatternsToRe = convertPatternsToRe; + function matchAny(entry, patternsRe) { + return patternsRe.some((patternRe) => patternRe.test(entry)); + } + exports.matchAny = matchAny; + function removeDuplicateSlashes(pattern) { + return pattern.replace(DOUBLE_SLASH_RE, "/"); + } + exports.removeDuplicateSlashes = removeDuplicateSlashes; + function partitionAbsoluteAndRelative(patterns) { + const absolute = []; + const relative = []; + for (const pattern of patterns) { + if (isAbsolute(pattern)) { + absolute.push(pattern); + } else { + relative.push(pattern); + } + } + return [absolute, relative]; + } + exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative; + function isAbsolute(pattern) { + return path.isAbsolute(pattern); + } + exports.isAbsolute = isAbsolute; } }); // -var require_outside = __commonJS({ - ""(exports, module) { +var require_merge2 = __commonJS({ + ""(exports, module2) { "use strict"; - var SemVer = require_semver(); - var Comparator = require_comparator(); - var { ANY } = Comparator; - var Range = require_range(); - var satisfies = require_satisfies(); - var gt = require_gt(); - var lt = require_lt(); - var lte = require_lte(); - var gte = require_gte(); - var outside = (version, range, hilo, options) => { - version = new SemVer(version, options); - range = new Range(range, options); - let gtfn, ltefn, ltfn, comp, ecomp; - switch (hilo) { - case ">": - gtfn = gt; - ltefn = lte; - ltfn = lt; - comp = ">"; - ecomp = ">="; - break; - case "<": - gtfn = lt; - ltefn = gte; - ltfn = gt; - comp = "<"; - ecomp = "<="; - break; - default: - throw new TypeError('Must provide a hilo val of "<" or ">"'); + var Stream = __require("stream"); + var PassThrough = Stream.PassThrough; + var slice = Array.prototype.slice; + module2.exports = merge2; + function merge2() { + const streamsQueue = []; + const args = slice.call(arguments); + let merging = false; + let options = args[args.length - 1]; + if (options && !Array.isArray(options) && options.pipe == null) { + args.pop(); + } else { + options = {}; } - if (satisfies(version, range, options)) { - return false; + const doEnd = options.end !== false; + const doPipeError = options.pipeError === true; + if (options.objectMode == null) { + options.objectMode = true; } - for (let i = 0; i < range.set.length; ++i) { - const comparators = range.set[i]; - let high = null; - let low = null; - comparators.forEach((comparator) => { - if (comparator.semver === ANY) { - comparator = new Comparator(">=0.0.0"); + if (options.highWaterMark == null) { + options.highWaterMark = 64 * 1024; + } + const mergedStream = PassThrough(options); + function addStream() { + for (let i6 = 0, len = arguments.length; i6 < len; i6++) { + streamsQueue.push(pauseStreams(arguments[i6], options)); + } + mergeStream(); + return this; + } + function mergeStream() { + if (merging) { + return; + } + merging = true; + let streams = streamsQueue.shift(); + if (!streams) { + process.nextTick(endStream); + return; + } + if (!Array.isArray(streams)) { + streams = [streams]; + } + let pipesCount = streams.length + 1; + function next() { + if (--pipesCount > 0) { + return; } - high = high || comparator; - low = low || comparator; - if (gtfn(comparator.semver, high.semver, options)) { - high = comparator; - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator; + merging = false; + mergeStream(); + } + function pipe(stream) { + function onend() { + stream.removeListener("merge2UnpipeEnd", onend); + stream.removeListener("end", onend); + if (doPipeError) { + stream.removeListener("error", onerror); + } + next(); } - }); - if (high.operator === comp || high.operator === ecomp) { - return false; + function onerror(err) { + mergedStream.emit("error", err); + } + if (stream._readableState.endEmitted) { + return next(); + } + stream.on("merge2UnpipeEnd", onend); + stream.on("end", onend); + if (doPipeError) { + stream.on("error", onerror); + } + stream.pipe(mergedStream, { end: false }); + stream.resume(); } - if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) { - return false; - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false; + for (let i6 = 0; i6 < streams.length; i6++) { + pipe(streams[i6]); } + next(); } - return true; - }; - module.exports = outside; + function endStream() { + merging = false; + mergedStream.emit("queueDrain"); + if (doEnd) { + mergedStream.end(); + } + } + mergedStream.setMaxListeners(0); + mergedStream.add = addStream; + mergedStream.on("unpipe", function(stream) { + stream.emit("merge2UnpipeEnd"); + }); + if (args.length) { + addStream.apply(null, args); + } + return mergedStream; + } + function pauseStreams(streams, options) { + if (!Array.isArray(streams)) { + if (!streams._readableState && streams.pipe) { + streams = streams.pipe(PassThrough(options)); + } + if (!streams._readableState || !streams.pause || !streams.pipe) { + throw new Error("Only readable stream can be merged."); + } + streams.pause(); + } else { + for (let i6 = 0, len = streams.length; i6 < len; i6++) { + streams[i6] = pauseStreams(streams[i6], options); + } + } + return streams; + } } }); // -var require_gtr = __commonJS({ - ""(exports, module) { +var require_stream = __commonJS({ + ""(exports) { "use strict"; - var outside = require_outside(); - var gtr = (version, range, options) => outside(version, range, ">", options); - module.exports = gtr; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.merge = void 0; + var merge2 = require_merge2(); + function merge3(streams) { + const mergedStream = merge2(streams); + streams.forEach((stream) => { + stream.once("error", (error) => mergedStream.emit("error", error)); + }); + mergedStream.once("close", () => propagateCloseEventToSources(streams)); + mergedStream.once("end", () => propagateCloseEventToSources(streams)); + return mergedStream; + } + exports.merge = merge3; + function propagateCloseEventToSources(streams) { + streams.forEach((stream) => stream.emit("close")); + } } }); // -var require_ltr = __commonJS({ - ""(exports, module) { +var require_string = __commonJS({ + ""(exports) { "use strict"; - var outside = require_outside(); - var ltr = (version, range, options) => outside(version, range, "<", options); - module.exports = ltr; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.isEmpty = exports.isString = void 0; + function isString(input) { + return typeof input === "string"; + } + exports.isString = isString; + function isEmpty(input) { + return input === ""; + } + exports.isEmpty = isEmpty; } }); // -var require_intersects = __commonJS({ - ""(exports, module) { +var require_utils6 = __commonJS({ + ""(exports) { "use strict"; - var Range = require_range(); - var intersects = (r1, r2, options) => { - r1 = new Range(r1, options); - r2 = new Range(r2, options); - return r1.intersects(r2, options); - }; - module.exports = intersects; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0; + var array = require_array(); + exports.array = array; + var errno = require_errno(); + exports.errno = errno; + var fs = require_fs(); + exports.fs = fs; + var path = require_path(); + exports.path = path; + var pattern = require_pattern(); + exports.pattern = pattern; + var stream = require_stream(); + exports.stream = stream; + var string = require_string(); + exports.string = string; } }); // -var require_simplify = __commonJS({ - ""(exports, module) { +var require_tasks = __commonJS({ + ""(exports) { "use strict"; - var satisfies = require_satisfies(); - var compare = require_compare(); - module.exports = (versions, range, options) => { - const set = []; - let first = null; - let prev = null; - const v = versions.sort((a, b) => compare(a, b, options)); - for (const version of v) { - const included = satisfies(version, range, options); - if (included) { - prev = version; - if (!first) { - first = version; - } - } else { - if (prev) { - set.push([first, prev]); - } - prev = null; - first = null; - } - } - if (first) { - set.push([first, null]); - } - const ranges = []; - for (const [min, max] of set) { - if (min === max) { - ranges.push(min); - } else if (!max && min === v[0]) { - ranges.push("*"); - } else if (!max) { - ranges.push(`>=${min}`); - } else if (min === v[0]) { - ranges.push(`<=${max}`); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0; + var utils = require_utils6(); + function generate(input, settings) { + const patterns = processPatterns(input, settings); + const ignore = processPatterns(settings.ignore, settings); + const positivePatterns = getPositivePatterns(patterns); + const negativePatterns = getNegativePatternsAsPositive(patterns, ignore); + const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings)); + const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings)); + const staticTasks = convertPatternsToTasks( + staticPatterns, + negativePatterns, + /* dynamic */ + false + ); + const dynamicTasks = convertPatternsToTasks( + dynamicPatterns, + negativePatterns, + /* dynamic */ + true + ); + return staticTasks.concat(dynamicTasks); + } + exports.generate = generate; + function processPatterns(input, settings) { + let patterns = input; + if (settings.braceExpansion) { + patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns); + } + if (settings.baseNameMatch) { + patterns = patterns.map((pattern) => pattern.includes("/") ? pattern : `**/${pattern}`); + } + return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern)); + } + function convertPatternsToTasks(positive, negative, dynamic) { + const tasks = []; + const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive); + const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive); + const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory); + const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory); + tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic)); + if ("." in insideCurrentDirectoryGroup) { + tasks.push(convertPatternGroupToTask(".", patternsInsideCurrentDirectory, negative, dynamic)); + } else { + tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic)); + } + return tasks; + } + exports.convertPatternsToTasks = convertPatternsToTasks; + function getPositivePatterns(patterns) { + return utils.pattern.getPositivePatterns(patterns); + } + exports.getPositivePatterns = getPositivePatterns; + function getNegativePatternsAsPositive(patterns, ignore) { + const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore); + const positive = negative.map(utils.pattern.convertToPositivePattern); + return positive; + } + exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; + function groupPatternsByBaseDirectory(patterns) { + const group = {}; + return patterns.reduce((collection, pattern) => { + const base = utils.pattern.getBaseDirectory(pattern); + if (base in collection) { + collection[base].push(pattern); } else { - ranges.push(`${min} - ${max}`); + collection[base] = [pattern]; } - } - const simplified = ranges.join(" || "); - const original = typeof range.raw === "string" ? range.raw : String(range); - return simplified.length < original.length ? simplified : range; - }; + return collection; + }, group); + } + exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; + function convertPatternGroupsToTasks(positive, negative, dynamic) { + return Object.keys(positive).map((base) => { + return convertPatternGroupToTask(base, positive[base], negative, dynamic); + }); + } + exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; + function convertPatternGroupToTask(base, positive, negative, dynamic) { + return { + dynamic, + positive, + negative, + base, + patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern)) + }; + } + exports.convertPatternGroupToTask = convertPatternGroupToTask; } }); // -var require_subset = __commonJS({ - ""(exports, module) { +var require_async = __commonJS({ + ""(exports) { "use strict"; - var Range = require_range(); - var Comparator = require_comparator(); - var { ANY } = Comparator; - var satisfies = require_satisfies(); - var compare = require_compare(); - var subset = (sub, dom, options = {}) => { - if (sub === dom) { - return true; - } - sub = new Range(sub, options); - dom = new Range(dom, options); - let sawNonNull = false; - OUTER: for (const simpleSub of sub.set) { - for (const simpleDom of dom.set) { - const isSub = simpleSubset(simpleSub, simpleDom, options); - sawNonNull = sawNonNull || isSub !== null; - if (isSub) { - continue OUTER; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.read = void 0; + function read(path, settings, callback) { + settings.fs.lstat(path, (lstatError, lstat) => { + if (lstatError !== null) { + callFailureCallback(callback, lstatError); + return; + } + if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { + callSuccessCallback(callback, lstat); + return; + } + settings.fs.stat(path, (statError, stat) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + callFailureCallback(callback, statError); + return; + } + callSuccessCallback(callback, lstat); + return; } + if (settings.markSymbolicLink) { + stat.isSymbolicLink = () => true; + } + callSuccessCallback(callback, stat); + }); + }); + } + exports.read = read; + function callFailureCallback(callback, error) { + callback(error); + } + function callSuccessCallback(callback, result) { + callback(null, result); + } + } +}); + +// +var require_sync = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.read = void 0; + function read(path, settings) { + const lstat = settings.fs.lstatSync(path); + if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { + return lstat; + } + try { + const stat = settings.fs.statSync(path); + if (settings.markSymbolicLink) { + stat.isSymbolicLink = () => true; } - if (sawNonNull) { - return false; + return stat; + } catch (error) { + if (!settings.throwErrorOnBrokenSymbolicLink) { + return lstat; } + throw error; } - return true; + } + exports.read = read; + } +}); + +// +var require_fs2 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; + var fs = __require("fs"); + exports.FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + stat: fs.stat, + lstatSync: fs.lstatSync, + statSync: fs.statSync }; - var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")]; - var minimumVersion = [new Comparator(">=0.0.0")]; - var simpleSubset = (sub, dom, options) => { - if (sub === dom) { - return true; + function createFileSystemAdapter(fsMethods) { + if (fsMethods === void 0) { + return exports.FILE_SYSTEM_ADAPTER; } - if (sub.length === 1 && sub[0].semver === ANY) { - if (dom.length === 1 && dom[0].semver === ANY) { - return true; - } else if (options.includePrerelease) { - sub = minimumVersionWithPreRelease; - } else { - sub = minimumVersion; - } + return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); + } + exports.createFileSystemAdapter = createFileSystemAdapter; + } +}); + +// +var require_settings = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var fs = require_fs2(); + var Settings = class { + constructor(_options = {}) { + this._options = _options; + this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true); + this.fs = fs.createFileSystemAdapter(this._options.fs); + this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; } - if (dom.length === 1 && dom[0].semver === ANY) { - if (options.includePrerelease) { - return true; - } else { - dom = minimumVersion; - } + }; + exports.default = Settings; + } +}); + +// +var require_out = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.statSync = exports.stat = exports.Settings = void 0; + var async = require_async(); + var sync = require_sync(); + var settings_1 = require_settings(); + exports.Settings = settings_1.default; + function stat(path, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === "function") { + async.read(path, getSettings(), optionsOrSettingsOrCallback); + return; } - const eqSet = /* @__PURE__ */ new Set(); - let gt, lt; - for (const c of sub) { - if (c.operator === ">" || c.operator === ">=") { - gt = higherGT(gt, c, options); - } else if (c.operator === "<" || c.operator === "<=") { - lt = lowerLT(lt, c, options); - } else { - eqSet.add(c.semver); - } + async.read(path, getSettings(optionsOrSettingsOrCallback), callback); + } + exports.stat = stat; + function statSync(path, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + return sync.read(path, settings); + } + exports.statSync = statSync; + function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; } - if (eqSet.size > 1) { - return null; + return new settings_1.default(settingsOrOptions); + } + } +}); + +// +var require_queue_microtask = __commonJS({ + ""(exports, module2) { + var promise; + module2.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => { + throw err; + }, 0)); + } +}); + +// +var require_run_parallel = __commonJS({ + ""(exports, module2) { + module2.exports = runParallel; + var queueMicrotask2 = require_queue_microtask(); + function runParallel(tasks, cb) { + let results, pending, keys; + let isSync = true; + if (Array.isArray(tasks)) { + results = []; + pending = tasks.length; + } else { + keys = Object.keys(tasks); + results = {}; + pending = keys.length; + } + function done(err) { + function end() { + if (cb) + cb(err, results); + cb = null; + } + if (isSync) + queueMicrotask2(end); + else + end(); } - let gtltComp; - if (gt && lt) { - gtltComp = compare(gt.semver, lt.semver, options); - if (gtltComp > 0) { - return null; - } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) { - return null; + function each(i6, err, result) { + results[i6] = result; + if (--pending === 0 || err) { + done(err); } } - for (const eq of eqSet) { - if (gt && !satisfies(eq, String(gt), options)) { - return null; + if (!pending) { + done(null); + } else if (keys) { + keys.forEach(function(key) { + tasks[key](function(err, result) { + each(key, err, result); + }); + }); + } else { + tasks.forEach(function(task, i6) { + task(function(err, result) { + each(i6, err, result); + }); + }); + } + isSync = false; + } + } +}); + +// +var require_constants3 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0; + var NODE_PROCESS_VERSION_PARTS = process.versions.node.split("."); + if (NODE_PROCESS_VERSION_PARTS[0] === void 0 || NODE_PROCESS_VERSION_PARTS[1] === void 0) { + throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`); + } + var MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); + var MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); + var SUPPORTED_MAJOR_VERSION = 10; + var SUPPORTED_MINOR_VERSION = 10; + var IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; + var IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; + exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; + } +}); + +// +var require_fs3 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createDirentFromStats = void 0; + var DirentFromStats = class { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } + }; + function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); + } + exports.createDirentFromStats = createDirentFromStats; + } +}); + +// +var require_utils7 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.fs = void 0; + var fs = require_fs3(); + exports.fs = fs; + } +}); + +// +var require_common = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.joinPathSegments = void 0; + function joinPathSegments(a7, b3, separator) { + if (a7.endsWith(separator)) { + return a7 + b3; + } + return a7 + separator + b3; + } + exports.joinPathSegments = joinPathSegments; + } +}); + +// +var require_async2 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; + var fsStat = require_out(); + var rpl = require_run_parallel(); + var constants_1 = require_constants3(); + var utils = require_utils7(); + var common = require_common(); + function read(directory, settings, callback) { + if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + readdirWithFileTypes(directory, settings, callback); + return; + } + readdir(directory, settings, callback); + } + exports.read = read; + function readdirWithFileTypes(directory, settings, callback) { + settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { + if (readdirError !== null) { + callFailureCallback(callback, readdirError); + return; } - if (lt && !satisfies(eq, String(lt), options)) { - return null; + const entries = dirents.map((dirent) => ({ + dirent, + name: dirent.name, + path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) + })); + if (!settings.followSymbolicLinks) { + callSuccessCallback(callback, entries); + return; } - for (const c of dom) { - if (!satisfies(eq, String(c), options)) { - return false; + const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings)); + rpl(tasks, (rplError, rplEntries) => { + if (rplError !== null) { + callFailureCallback(callback, rplError); + return; } + callSuccessCallback(callback, rplEntries); + }); + }); + } + exports.readdirWithFileTypes = readdirWithFileTypes; + function makeRplTaskEntry(entry, settings) { + return (done) => { + if (!entry.dirent.isSymbolicLink()) { + done(null, entry); + return; } - return true; - } - let higher, lower; - let hasDomLT, hasDomGT; - let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false; - let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false; - if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) { - needDomLTPre = false; - } - for (const c of dom) { - hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">="; - hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<="; - if (gt) { - if (needDomGTPre) { - if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) { - needDomGTPre = false; - } - } - if (c.operator === ">" || c.operator === ">=") { - higher = higherGT(gt, c, options); - if (higher === c && higher !== gt) { - return false; + settings.fs.stat(entry.path, (statError, stats) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + done(statError); + return; } - } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) { - return false; + done(null, entry); + return; } + entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); + done(null, entry); + }); + }; + } + function readdir(directory, settings, callback) { + settings.fs.readdir(directory, (readdirError, names) => { + if (readdirError !== null) { + callFailureCallback(callback, readdirError); + return; } - if (lt) { - if (needDomLTPre) { - if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) { - needDomLTPre = false; - } + const tasks = names.map((name) => { + const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); + return (done) => { + fsStat.stat(path, settings.fsStatSettings, (error, stats) => { + if (error !== null) { + done(error); + return; + } + const entry = { + name, + path, + dirent: utils.fs.createDirentFromStats(name, stats) + }; + if (settings.stats) { + entry.stats = stats; + } + done(null, entry); + }); + }; + }); + rpl(tasks, (rplError, entries) => { + if (rplError !== null) { + callFailureCallback(callback, rplError); + return; } - if (c.operator === "<" || c.operator === "<=") { - lower = lowerLT(lt, c, options); - if (lower === c && lower !== lt) { - return false; + callSuccessCallback(callback, entries); + }); + }); + } + exports.readdir = readdir; + function callFailureCallback(callback, error) { + callback(error); + } + function callSuccessCallback(callback, result) { + callback(null, result); + } + } +}); + +// +var require_sync2 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; + var fsStat = require_out(); + var constants_1 = require_constants3(); + var utils = require_utils7(); + var common = require_common(); + function read(directory, settings) { + if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + return readdirWithFileTypes(directory, settings); + } + return readdir(directory, settings); + } + exports.read = read; + function readdirWithFileTypes(directory, settings) { + const dirents = settings.fs.readdirSync(directory, { withFileTypes: true }); + return dirents.map((dirent) => { + const entry = { + dirent, + name: dirent.name, + path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) + }; + if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { + try { + const stats = settings.fs.statSync(entry.path); + entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); + } catch (error) { + if (settings.throwErrorOnBrokenSymbolicLink) { + throw error; } - } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) { - return false; } } - if (!c.operator && (lt || gt) && gtltComp !== 0) { - return false; + return entry; + }); + } + exports.readdirWithFileTypes = readdirWithFileTypes; + function readdir(directory, settings) { + const names = settings.fs.readdirSync(directory); + return names.map((name) => { + const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); + const stats = fsStat.statSync(entryPath, settings.fsStatSettings); + const entry = { + name, + path: entryPath, + dirent: utils.fs.createDirentFromStats(name, stats) + }; + if (settings.stats) { + entry.stats = stats; } - } - if (gt && hasDomLT && !lt && gtltComp !== 0) { - return false; - } - if (lt && hasDomGT && !gt && gtltComp !== 0) { - return false; - } - if (needDomGTPre || needDomLTPre) { - return false; - } - return true; + return entry; + }); + } + exports.readdir = readdir; + } +}); + +// +var require_fs4 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; + var fs = __require("fs"); + exports.FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + stat: fs.stat, + lstatSync: fs.lstatSync, + statSync: fs.statSync, + readdir: fs.readdir, + readdirSync: fs.readdirSync }; - var higherGT = (a, b, options) => { - if (!a) { - return b; + function createFileSystemAdapter(fsMethods) { + if (fsMethods === void 0) { + return exports.FILE_SYSTEM_ADAPTER; } - const comp = compare(a.semver, b.semver, options); - return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a; - }; - var lowerLT = (a, b, options) => { - if (!a) { - return b; + return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); + } + exports.createFileSystemAdapter = createFileSystemAdapter; + } +}); + +// +var require_settings2 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var path = __require("path"); + var fsStat = require_out(); + var fs = require_fs4(); + var Settings = class { + constructor(_options = {}) { + this._options = _options; + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); + this.fs = fs.createFileSystemAdapter(this._options.fs); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); + this.stats = this._getValue(this._options.stats, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + this.fsStatSettings = new fsStat.Settings({ + followSymbolicLink: this.followSymbolicLinks, + fs: this.fs, + throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink + }); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; } - const comp = compare(a.semver, b.semver, options); - return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a; }; - module.exports = subset; + exports.default = Settings; } }); // -var require_semver2 = __commonJS({ - ""(exports, module) { +var require_out2 = __commonJS({ + ""(exports) { "use strict"; - var internalRe = require_re(); - var constants = require_constants(); - var SemVer = require_semver(); - var identifiers = require_identifiers(); - var parse2 = require_parse(); - var valid = require_valid(); - var clean = require_clean(); - var inc = require_inc(); - var diff = require_diff(); - var major = require_major(); - var minor = require_minor(); - var patch = require_patch(); - var prerelease = require_prerelease(); - var compare = require_compare(); - var rcompare = require_rcompare(); - var compareLoose = require_compare_loose(); - var compareBuild = require_compare_build(); - var sort = require_sort(); - var rsort = require_rsort(); - var gt = require_gt(); - var lt = require_lt(); - var eq = require_eq(); - var neq = require_neq(); - var gte = require_gte(); - var lte = require_lte(); - var cmp = require_cmp(); - var coerce = require_coerce(); - var Comparator = require_comparator(); - var Range = require_range(); - var satisfies = require_satisfies(); - var toComparators = require_to_comparators(); - var maxSatisfying = require_max_satisfying(); - var minSatisfying = require_min_satisfying(); - var minVersion = require_min_version(); - var validRange = require_valid2(); - var outside = require_outside(); - var gtr = require_gtr(); - var ltr = require_ltr(); - var intersects = require_intersects(); - var simplifyRange = require_simplify(); - var subset = require_subset(); - module.exports = { - parse: parse2, - valid, - clean, - inc, - diff, - major, - minor, - patch, - prerelease, - compare, - rcompare, - compareLoose, - compareBuild, - sort, - rsort, - gt, - lt, - eq, - neq, - gte, - lte, - cmp, - coerce, - Comparator, - Range, - satisfies, - toComparators, - maxSatisfying, - minSatisfying, - minVersion, - validRange, - outside, - gtr, - ltr, - intersects, - simplifyRange, - subset, - SemVer, - re: internalRe.re, - src: internalRe.src, - tokens: internalRe.t, - SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, - RELEASE_TYPES: constants.RELEASE_TYPES, - compareIdentifiers: identifiers.compareIdentifiers, - rcompareIdentifiers: identifiers.rcompareIdentifiers - }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Settings = exports.scandirSync = exports.scandir = void 0; + var async = require_async2(); + var sync = require_sync2(); + var settings_1 = require_settings2(); + exports.Settings = settings_1.default; + function scandir(path, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === "function") { + async.read(path, getSettings(), optionsOrSettingsOrCallback); + return; + } + async.read(path, getSettings(optionsOrSettingsOrCallback), callback); + } + exports.scandir = scandir; + function scandirSync(path, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + return sync.read(path, settings); + } + exports.scandirSync = scandirSync; + function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; + } + return new settings_1.default(settingsOrOptions); + } } }); // -var require_dist = __commonJS({ - ""(exports) { +var require_reusify = __commonJS({ + ""(exports, module2) { "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.GraphQLType = void 0; - (function(GraphQLType) { - GraphQLType[GraphQLType["SCALAR"] = 0] = "SCALAR"; - GraphQLType[GraphQLType["INLINE_FRAGMENT"] = 1] = "INLINE_FRAGMENT"; - GraphQLType[GraphQLType["FRAGMENT"] = 2] = "FRAGMENT"; - })(exports.GraphQLType || (exports.GraphQLType = {})); - var typeSymbol = Symbol("GraphQL Type"); - var paramsSymbol = Symbol("GraphQL Params"); - function isInlineFragmentObject(value) { - return typeof value === "object" && value !== null && value[typeSymbol] === exports.GraphQLType.INLINE_FRAGMENT; - } - function isFragmentObject(value) { - return typeof value === "object" && value !== null && value[typeSymbol] === exports.GraphQLType.FRAGMENT; - } - function isScalarObject(value) { - return typeof value === "object" && value !== null && value[typeSymbol] === exports.GraphQLType.SCALAR; - } - function renderName(name) { - return name === void 0 ? "" : name; + function reusify(Constructor) { + var head = new Constructor(); + var tail = head; + function get() { + var current = head; + if (current.next) { + head = current.next; + } else { + head = new Constructor(); + tail = head; + } + current.next = null; + return current; + } + function release(obj) { + tail.next = obj; + tail = obj; + } + return { + get, + release + }; } - function renderParams(params3, brackets, array) { - if (brackets === void 0) { - brackets = true; + module2.exports = reusify; + } +}); + +// +var require_queue = __commonJS({ + ""(exports, module2) { + "use strict"; + var reusify = require_reusify(); + function fastqueue(context2, worker, _concurrency) { + if (typeof context2 === "function") { + _concurrency = worker; + worker = context2; + context2 = null; + } + if (!(_concurrency >= 1)) { + throw new Error("fastqueue concurrency must be equal to or greater than 1"); + } + var cache = reusify(Task); + var queueHead = null; + var queueTail = null; + var _running = 0; + var errorHandler = null; + var self2 = { + push, + drain: noop2, + saturated: noop2, + pause, + paused: false, + get concurrency() { + return _concurrency; + }, + set concurrency(value) { + if (!(value >= 1)) { + throw new Error("fastqueue concurrency must be equal to or greater than 1"); + } + _concurrency = value; + if (self2.paused) + return; + for (; queueHead && _running < _concurrency; ) { + _running++; + release(); + } + }, + running, + resume, + idle, + length, + getQueue, + unshift, + empty: noop2, + kill, + killAndDrain, + error + }; + return self2; + function running() { + return _running; } - if (array === void 0) { - array = false; + function pause() { + self2.paused = true; } - if (!params3) { - return ""; + function length() { + var current = queueHead; + var counter = 0; + while (current) { + current = current.next; + counter++; + } + return counter; } - var builder = []; - for (var _i = 0, _a = Object.entries(params3); _i < _a.length; _i++) { - var _b = _a[_i], key = _b[0], value = _b[1]; - var params_1 = void 0; - if (value === null) { - params_1 = "null"; - } else if (Array.isArray(value)) { - params_1 = "[".concat(renderParams(value, false, true), "]"); - } else if (typeof value === "object") { - params_1 = "{".concat(renderParams(value, false), "}"); + function getQueue() { + var current = queueHead; + var tasks = []; + while (current) { + tasks.push(current.value); + current = current.next; + } + return tasks; + } + function resume() { + if (!self2.paused) + return; + self2.paused = false; + if (queueHead === null) { + _running++; + release(); + return; + } + for (; queueHead && _running < _concurrency; ) { + _running++; + release(); + } + } + function idle() { + return _running === 0 && self2.length() === 0; + } + function push(value, done) { + var current = cache.get(); + current.context = context2; + current.release = release; + current.value = value; + current.callback = done || noop2; + current.errorHandler = errorHandler; + if (_running >= _concurrency || self2.paused) { + if (queueTail) { + queueTail.next = current; + queueTail = current; + } else { + queueHead = current; + queueTail = current; + self2.saturated(); + } } else { - params_1 = "".concat(value); + _running++; + worker.call(context2, current.value, current.worked); + } + } + function unshift(value, done) { + var current = cache.get(); + current.context = context2; + current.release = release; + current.value = value; + current.callback = done || noop2; + current.errorHandler = errorHandler; + if (_running >= _concurrency || self2.paused) { + if (queueHead) { + current.next = queueHead; + queueHead = current; + } else { + queueHead = current; + queueTail = current; + self2.saturated(); + } + } else { + _running++; + worker.call(context2, current.value, current.worked); } - builder.push(array ? "".concat(params_1) : "".concat(key, ":").concat(params_1)); } - var built = builder.join(","); - if (brackets) { - built = "(".concat(built, ")"); + function release(holder) { + if (holder) { + cache.release(holder); + } + var next = queueHead; + if (next && _running <= _concurrency) { + if (!self2.paused) { + if (queueTail === queueHead) { + queueTail = null; + } + queueHead = next.next; + next.next = null; + worker.call(context2, next.value, next.worked); + if (queueTail === null) { + self2.empty(); + } + } else { + _running--; + } + } else if (--_running === 0) { + self2.drain(); + } + } + function kill() { + queueHead = null; + queueTail = null; + self2.drain = noop2; + } + function killAndDrain() { + queueHead = null; + queueTail = null; + self2.drain(); + self2.drain = noop2; + } + function error(handler2) { + errorHandler = handler2; } - return built; - } - function renderScalar(name, params3) { - return renderName(name) + renderParams(params3); } - function renderInlineFragment(fragment2, context2) { - return "...on ".concat(fragment2.typeName).concat(renderObject(void 0, fragment2.internal, context2)); + function noop2() { } - function renderFragment(fragment2, context2) { - return "fragment ".concat(fragment2.name, " on ").concat(fragment2.typeName).concat(renderObject(void 0, fragment2.internal, context2)); + function Task() { + this.value = null; + this.callback = noop2; + this.next = null; + this.release = noop2; + this.context = null; + this.errorHandler = null; + var self2 = this; + this.worked = function worked(err, result) { + var callback = self2.callback; + var errorHandler = self2.errorHandler; + var val = self2.value; + self2.value = null; + self2.callback = noop2; + if (self2.errorHandler) { + errorHandler(err, val); + } + callback.call(self2.context, err, result); + self2.release(self2); + }; } - function renderArray(name, arr, context2) { - var first = arr[0]; - if (first === void 0 || first === null) { - throw new Error("Cannot render array with no first value"); + function queueAsPromised(context2, worker, _concurrency) { + if (typeof context2 === "function") { + _concurrency = worker; + worker = context2; + context2 = null; + } + function asyncWrapper(arg, cb) { + worker.call(this, arg).then(function(res) { + cb(null, res); + }, cb); + } + var queue = fastqueue(context2, asyncWrapper, _concurrency); + var pushCb = queue.push; + var unshiftCb = queue.unshift; + queue.push = push; + queue.unshift = unshift; + queue.drained = drained; + return queue; + function push(value) { + var p5 = new Promise(function(resolve, reject) { + pushCb(value, function(err, result) { + if (err) { + reject(err); + return; + } + resolve(result); + }); + }); + p5.catch(noop2); + return p5; } - first[paramsSymbol] = arr[paramsSymbol]; - return renderType(name, first, context2); - } - function renderType(name, value, context2) { - switch (typeof value) { - case "bigint": - case "boolean": - case "number": - case "string": - throw new Error("Rendering type ".concat(typeof value, " directly is disallowed")); - case "object": - if (value === null) { - throw new Error("Cannot render null"); - } - if (isScalarObject(value)) { - return "".concat(renderScalar(name, value[paramsSymbol]), " "); - } else if (Array.isArray(value)) { - return renderArray(name, value, context2); - } else { - return renderObject(name, value, context2); - } - case "undefined": - return ""; - default: - throw new Error("Cannot render type ".concat(typeof value)); + function unshift(value) { + var p5 = new Promise(function(resolve, reject) { + unshiftCb(value, function(err, result) { + if (err) { + reject(err); + return; + } + resolve(result); + }); + }); + p5.catch(noop2); + return p5; + } + function drained() { + var p5 = new Promise(function(resolve) { + process.nextTick(function() { + if (queue.idle()) { + resolve(); + } else { + var previousDrain = queue.drain; + queue.drain = function() { + if (typeof previousDrain === "function") + previousDrain(); + resolve(); + queue.drain = previousDrain; + }; + } + }); + }); + return p5; } } - function renderObject(name, obj, context2) { - var fields = []; - for (var _i = 0, _a = Object.entries(obj); _i < _a.length; _i++) { - var _b = _a[_i], key = _b[0], value = _b[1]; - fields.push(renderType(key, value, context2)); + module2.exports = fastqueue; + module2.exports.promise = queueAsPromised; + } +}); + +// +var require_common2 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0; + function isFatalError(settings, error) { + if (settings.errorFilter === null) { + return true; } - for (var _c = 0, _d = Object.getOwnPropertySymbols(obj); _c < _d.length; _c++) { - var sym = _d[_c]; - var value = obj[sym]; - if (isInlineFragmentObject(value)) { - fields.push(renderInlineFragment(value, context2)); - } else if (isFragmentObject(value)) { - context2.fragments.set(sym, value); - fields.push("...".concat(value.name)); - } + return !settings.errorFilter(error); + } + exports.isFatalError = isFatalError; + function isAppliedFilter(filter, value) { + return filter === null || filter(value); + } + exports.isAppliedFilter = isAppliedFilter; + function replacePathSegmentSeparator(filepath, separator) { + return filepath.split(/[/\\]/).join(separator); + } + exports.replacePathSegmentSeparator = replacePathSegmentSeparator; + function joinPathSegments(a7, b3, separator) { + if (a7 === "") { + return b3; } - if (fields.length === 0) { - throw new Error("Object cannot have no fields"); + if (a7.endsWith(separator)) { + return a7 + b3; } - return "".concat(renderName(name)).concat(renderParams(obj[paramsSymbol]), "{").concat(fields.join("").trim(), "}"); + return a7 + separator + b3; } - function render(value) { - var context2 = { - fragments: /* @__PURE__ */ new Map() - }; - var rend = renderObject(void 0, value, context2); - var rendered = /* @__PURE__ */ new Map(); - var executingContext = context2; - var currentContext = { - // The current context for execution. - fragments: /* @__PURE__ */ new Map() - }; - while (executingContext.fragments.size > 0) { - for (var _i = 0, _a = Array.from(executingContext.fragments.entries()); _i < _a.length; _i++) { - var _b = _a[_i], sym = _b[0], fragment2 = _b[1]; - if (!rendered.has(sym)) { - rendered.set(sym, renderFragment(fragment2, currentContext)); + exports.joinPathSegments = joinPathSegments; + } +}); + +// +var require_reader = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var common = require_common2(); + var Reader = class { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator); + } + }; + exports.default = Reader; + } +}); + +// +var require_async3 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var events_1 = __require("events"); + var fsScandir = require_out2(); + var fastq = require_queue(); + var common = require_common2(); + var reader_1 = require_reader(); + var AsyncReader = class extends reader_1.default { + constructor(_root, _settings) { + super(_root, _settings); + this._settings = _settings; + this._scandir = fsScandir.scandir; + this._emitter = new events_1.EventEmitter(); + this._queue = fastq(this._worker.bind(this), this._settings.concurrency); + this._isFatalError = false; + this._isDestroyed = false; + this._queue.drain = () => { + if (!this._isFatalError) { + this._emitter.emit("end"); } - } - executingContext = currentContext; - currentContext = { - // Reset current context. - fragments: /* @__PURE__ */ new Map() }; } - return rend + Array.from(rendered.values()).join(""); - } - function fragmentToString(value) { - var context2 = { - fragments: /* @__PURE__ */ new Map() - }; - renderObject(void 0, value, context2); - var currentContext = { - // The current context for execution. - fragments: /* @__PURE__ */ new Map() - }; - var output = ""; - for (var _i = 0, _a = Array.from(context2.fragments.entries()); _i < _a.length; _i++) { - var _b = _a[_i], fragment2 = _b[1]; - output = output + renderFragment(fragment2, currentContext); + read() { + this._isFatalError = false; + this._isDestroyed = false; + setImmediate(() => { + this._pushToQueue(this._root, this._settings.basePath); + }); + return this._emitter; } - return output; - } - function createOperate(operateType) { - function operate(opNameOrQueryObject, queryObject) { - if (typeof opNameOrQueryObject === "string") { - if (!queryObject) { - throw new Error("queryObject is not set"); - } - return { - toString: function() { - return "".concat(operateType, " ").concat(opNameOrQueryObject).concat(render(queryObject)); - } - }; + get isDestroyed() { + return this._isDestroyed; + } + destroy() { + if (this._isDestroyed) { + throw new Error("The reader is already destroyed"); } - return { - toString: function() { - return "".concat(operateType).concat(render(opNameOrQueryObject)); + this._isDestroyed = true; + this._queue.killAndDrain(); + } + onEntry(callback) { + this._emitter.on("entry", callback); + } + onError(callback) { + this._emitter.once("error", callback); + } + onEnd(callback) { + this._emitter.once("end", callback); + } + _pushToQueue(directory, base) { + const queueItem = { directory, base }; + this._queue.push(queueItem, (error) => { + if (error !== null) { + this._handleError(error); } - }; + }); } - return operate; - } - var query2 = createOperate("query"); - var mutation = createOperate("mutation"); - var subscription = createOperate("subscription"); - function params2(params3, input) { - if (typeof params3 !== "object") { - throw new Error("Params have to be an object"); + _worker(item, done) { + this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => { + if (error !== null) { + done(error, void 0); + return; + } + for (const entry of entries) { + this._handleEntry(entry, item.base); + } + done(null, void 0); + }); } - if (typeof input !== "object") { - throw new Error("Cannot apply params to JS ".concat(typeof params3)); + _handleError(error) { + if (this._isDestroyed || !common.isFatalError(this._settings, error)) { + return; + } + this._isFatalError = true; + this._isDestroyed = true; + this._emitter.emit("error", error); } - input[paramsSymbol] = params3; - return input; - } - function alias(alias2, target) { - return "".concat(alias2, ":").concat(target); - } - function fragment(name, typeName, input) { - var _a, _b; - var fragment2 = (_a = {}, _a[typeSymbol] = exports.GraphQLType.FRAGMENT, _a.name = name, _a.typeName = typeName, _a.internal = input, _a); - return _b = {}, _b[Symbol("Fragment(".concat(name, " on ").concat(typeName, ")"))] = fragment2, _b; - } - function rawString(input) { - return JSON.stringify(input); - } - var __assign = function() { - __assign = Object.assign || function __assign2(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + _handleEntry(entry, base) { + if (this._isDestroyed || this._isFatalError) { + return; } - return t; - }; - return __assign.apply(this, arguments); + const fullpath = entry.path; + if (base !== void 0) { + entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + if (common.isAppliedFilter(this._settings.entryFilter, entry)) { + this._emitEntry(entry); + } + if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path); + } + } + _emitEntry(entry) { + this._emitter.emit("entry", entry); + } }; - function optional(obj) { - return obj; - } - function on(typeName, internal) { - var _a, _b; - var fragment2 = (_a = {}, _a[typeSymbol] = exports.GraphQLType.INLINE_FRAGMENT, _a.typeName = typeName, _a.internal = internal, _a); - return _b = {}, _b[Symbol("InlineFragment(".concat(typeName, ")"))] = fragment2, _b; - } - function onUnion(types3) { - var fragments = {}; - for (var _i = 0, _a = Object.entries(types3); _i < _a.length; _i++) { - var _b = _a[_i], typeName = _b[0], internal = _b[1]; - fragments = __assign(__assign({}, fragments), on(typeName, internal)); + exports.default = AsyncReader; + } +}); + +// +var require_async4 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var async_1 = require_async3(); + var AsyncProvider = class { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new async_1.default(this._root, this._settings); + this._storage = []; + } + read(callback) { + this._reader.onError((error) => { + callFailureCallback(callback, error); + }); + this._reader.onEntry((entry) => { + this._storage.push(entry); + }); + this._reader.onEnd(() => { + callSuccessCallback(callback, this._storage); + }); + this._reader.read(); } - return fragments; + }; + exports.default = AsyncProvider; + function callFailureCallback(callback, error) { + callback(error); } - function scalarType() { - var _a; - var scalar = (_a = {}, _a[typeSymbol] = exports.GraphQLType.SCALAR, _a); - return scalar; + function callSuccessCallback(callback, entries) { + callback(null, entries); } - var types2 = ( - /** @class */ - function() { - function types3() { - } - Object.defineProperty(types3, "number", { - get: function() { - return scalarType(); + } +}); + +// +var require_stream2 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var stream_1 = __require("stream"); + var async_1 = require_async3(); + var StreamProvider = class { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new async_1.default(this._root, this._settings); + this._stream = new stream_1.Readable({ + objectMode: true, + read: () => { }, - enumerable: false, - configurable: true + destroy: () => { + if (!this._reader.isDestroyed) { + this._reader.destroy(); + } + } }); - Object.defineProperty(types3, "string", { - get: function() { - return scalarType(); - }, - enumerable: false, - configurable: true + } + read() { + this._reader.onError((error) => { + this._stream.emit("error", error); }); - Object.defineProperty(types3, "boolean", { - get: function() { - return scalarType(); - }, - enumerable: false, - configurable: true + this._reader.onEntry((entry) => { + this._stream.push(entry); }); - types3.constant = function(_c) { - return scalarType(); - }; - types3.oneOf = function(_e) { - return scalarType(); - }; - types3.custom = function() { - return scalarType(); - }; - types3.optional = types3; - return types3; - }() - ); - exports.alias = alias; - exports.fragment = fragment; - exports.fragmentToString = fragmentToString; - exports.mutation = mutation; - exports.on = on; - exports.onUnion = onUnion; - exports.optional = optional; - exports.params = params2; - exports.paramsSymbol = paramsSymbol; - exports.query = query2; - exports.rawString = rawString; - exports.render = render; - exports.subscription = subscription; - exports.typeSymbol = typeSymbol; - exports.types = types2; + this._reader.onEnd(() => { + this._stream.push(null); + }); + this._reader.read(); + return this._stream; + } + }; + exports.default = StreamProvider; } }); // -var require_fast_content_type_parse = __commonJS({ - ""(exports, module) { +var require_sync3 = __commonJS({ + ""(exports) { "use strict"; - var NullObject = function NullObject2() { - }; - NullObject.prototype = /* @__PURE__ */ Object.create(null); - var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu; - var quotedPairRE = /\\([\v\u0020-\u00ff])/gu; - var mediaTypeRE = /^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u; - var defaultContentType = { type: "", parameters: new NullObject() }; - Object.freeze(defaultContentType.parameters); - Object.freeze(defaultContentType); - function parse2(header) { - if (typeof header !== "string") { - throw new TypeError("argument header is required and must be a string"); + Object.defineProperty(exports, "__esModule", { value: true }); + var fsScandir = require_out2(); + var common = require_common2(); + var reader_1 = require_reader(); + var SyncReader = class extends reader_1.default { + constructor() { + super(...arguments); + this._scandir = fsScandir.scandirSync; + this._storage = []; + this._queue = /* @__PURE__ */ new Set(); } - let index = header.indexOf(";"); - const type = index !== -1 ? header.slice(0, index).trim() : header.trim(); - if (mediaTypeRE.test(type) === false) { - throw new TypeError("invalid media type"); + read() { + this._pushToQueue(this._root, this._settings.basePath); + this._handleQueue(); + return this._storage; } - const result = { - type: type.toLowerCase(), - parameters: new NullObject() - }; - if (index === -1) { - return result; + _pushToQueue(directory, base) { + this._queue.add({ directory, base }); } - let key; - let match; - let value; - paramRE.lastIndex = index; - while (match = paramRE.exec(header)) { - if (match.index !== index) { - throw new TypeError("invalid parameter format"); + _handleQueue() { + for (const item of this._queue.values()) { + this._handleDirectory(item.directory, item.base); } - index += match[0].length; - key = match[1].toLowerCase(); - value = match[2]; - if (value[0] === '"') { - value = value.slice(1, value.length - 1); - quotedPairRE.test(value) && (value = value.replace(quotedPairRE, "$1")); + } + _handleDirectory(directory, base) { + try { + const entries = this._scandir(directory, this._settings.fsScandirSettings); + for (const entry of entries) { + this._handleEntry(entry, base); + } + } catch (error) { + this._handleError(error); } - result.parameters[key] = value; } - if (index !== header.length) { - throw new TypeError("invalid parameter format"); + _handleError(error) { + if (!common.isFatalError(this._settings, error)) { + return; + } + throw error; } - return result; - } - function safeParse2(header) { - if (typeof header !== "string") { - return defaultContentType; + _handleEntry(entry, base) { + const fullpath = entry.path; + if (base !== void 0) { + entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + if (common.isAppliedFilter(this._settings.entryFilter, entry)) { + this._pushToStorage(entry); + } + if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path); + } } - let index = header.indexOf(";"); - const type = index !== -1 ? header.slice(0, index).trim() : header.trim(); - if (mediaTypeRE.test(type) === false) { - return defaultContentType; - } - const result = { - type: type.toLowerCase(), - parameters: new NullObject() - }; - if (index === -1) { - return result; - } - let key; - let match; - let value; - paramRE.lastIndex = index; - while (match = paramRE.exec(header)) { - if (match.index !== index) { - return defaultContentType; - } - index += match[0].length; - key = match[1].toLowerCase(); - value = match[2]; - if (value[0] === '"') { - value = value.slice(1, value.length - 1); - quotedPairRE.test(value) && (value = value.replace(quotedPairRE, "$1")); - } - result.parameters[key] = value; + _pushToStorage(entry) { + this._storage.push(entry); } - if (index !== header.length) { - return defaultContentType; - } - return result; - } - module.exports.default = { parse: parse2, safeParse: safeParse2 }; - module.exports.parse = parse2; - module.exports.safeParse = safeParse2; - module.exports.defaultContentType = defaultContentType; + }; + exports.default = SyncReader; } }); // -var require_posix = __commonJS({ +var require_sync4 = __commonJS({ ""(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - exports.sync = exports.isexe = void 0; - var fs_1 = __require("fs"); - var promises_1 = __require("fs/promises"); - var isexe = async (path, options = {}) => { - const { ignoreErrors = false } = options; - try { - return checkStat(await (0, promises_1.stat)(path), options); - } catch (e) { - const er = e; - if (ignoreErrors || er.code === "EACCES") - return false; - throw er; + var sync_1 = require_sync3(); + var SyncProvider = class { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new sync_1.default(this._root, this._settings); } - }; - exports.isexe = isexe; - var sync = (path, options = {}) => { - const { ignoreErrors = false } = options; - try { - return checkStat((0, fs_1.statSync)(path), options); - } catch (e) { - const er = e; - if (ignoreErrors || er.code === "EACCES") - return false; - throw er; + read() { + return this._reader.read(); } }; - exports.sync = sync; - var checkStat = (stat, options) => stat.isFile() && checkMode(stat, options); - var checkMode = (stat, options) => { - const myUid = options.uid ?? process.getuid?.(); - const myGroups = options.groups ?? process.getgroups?.() ?? []; - const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]; - if (myUid === void 0 || myGid === void 0) { - throw new Error("cannot get uid or gid"); + exports.default = SyncProvider; + } +}); + +// +var require_settings3 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var path = __require("path"); + var fsScandir = require_out2(); + var Settings = class { + constructor(_options = {}) { + this._options = _options; + this.basePath = this._getValue(this._options.basePath, void 0); + this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY); + this.deepFilter = this._getValue(this._options.deepFilter, null); + this.entryFilter = this._getValue(this._options.entryFilter, null); + this.errorFilter = this._getValue(this._options.errorFilter, null); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); + this.fsScandirSettings = new fsScandir.Settings({ + followSymbolicLinks: this._options.followSymbolicLinks, + fs: this._options.fs, + pathSegmentSeparator: this._options.pathSegmentSeparator, + stats: this._options.stats, + throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink + }); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; } - const groups = /* @__PURE__ */ new Set([myGid, ...myGroups]); - const mod = stat.mode; - const uid = stat.uid; - const gid = stat.gid; - const u = parseInt("100", 8); - const g = parseInt("010", 8); - const o = parseInt("001", 8); - const ug = u | g; - return !!(mod & o || mod & g && groups.has(gid) || mod & u && uid === myUid || mod & ug && myUid === 0); }; + exports.default = Settings; } }); // -var require_win32 = __commonJS({ +var require_out3 = __commonJS({ ""(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - exports.sync = exports.isexe = void 0; - var fs_1 = __require("fs"); - var promises_1 = __require("fs/promises"); - var isexe = async (path, options = {}) => { - const { ignoreErrors = false } = options; - try { - return checkStat(await (0, promises_1.stat)(path), path, options); - } catch (e) { - const er = e; - if (ignoreErrors || er.code === "EACCES") - return false; - throw er; + exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0; + var async_1 = require_async4(); + var stream_1 = require_stream2(); + var sync_1 = require_sync4(); + var settings_1 = require_settings3(); + exports.Settings = settings_1.default; + function walk(directory, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === "function") { + new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback); + return; } - }; - exports.isexe = isexe; - var sync = (path, options = {}) => { - const { ignoreErrors = false } = options; - try { - return checkStat((0, fs_1.statSync)(path), path, options); - } catch (e) { - const er = e; - if (ignoreErrors || er.code === "EACCES") - return false; - throw er; + new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback); + } + exports.walk = walk; + function walkSync(directory, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + const provider = new sync_1.default(directory, settings); + return provider.read(); + } + exports.walkSync = walkSync; + function walkStream(directory, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + const provider = new stream_1.default(directory, settings); + return provider.read(); + } + exports.walkStream = walkStream; + function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; } - }; - exports.sync = sync; - var checkPathExt = (path, options) => { - const { pathExt = process.env.PATHEXT || "" } = options; - const peSplit = pathExt.split(";"); - if (peSplit.indexOf("") !== -1) { - return true; + return new settings_1.default(settingsOrOptions); + } + } +}); + +// +var require_reader2 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var path = __require("path"); + var fsStat = require_out(); + var utils = require_utils6(); + var Reader = class { + constructor(_settings) { + this._settings = _settings; + this._fsStatSettings = new fsStat.Settings({ + followSymbolicLink: this._settings.followSymbolicLinks, + fs: this._settings.fs, + throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks + }); } - for (let i = 0; i < peSplit.length; i++) { - const p = peSplit[i].toLowerCase(); - const ext = path.substring(path.length - p.length).toLowerCase(); - if (p && ext === p) { - return true; + _getFullEntryPath(filepath) { + return path.resolve(this._settings.cwd, filepath); + } + _makeEntry(stats, pattern) { + const entry = { + name: pattern, + path: pattern, + dirent: utils.fs.createDirentFromStats(pattern, stats) + }; + if (this._settings.stats) { + entry.stats = stats; } + return entry; + } + _isFatalError(error) { + return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors; } - return false; }; - var checkStat = (stat, path, options) => stat.isFile() && checkPathExt(path, options); + exports.default = Reader; } }); // -var require_options = __commonJS({ +var require_stream3 = __commonJS({ ""(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); + var stream_1 = __require("stream"); + var fsStat = require_out(); + var fsWalk = require_out3(); + var reader_1 = require_reader2(); + var ReaderStream = class extends reader_1.default { + constructor() { + super(...arguments); + this._walkStream = fsWalk.walkStream; + this._stat = fsStat.stat; + } + dynamic(root, options) { + return this._walkStream(root, options); + } + static(patterns, options) { + const filepaths = patterns.map(this._getFullEntryPath, this); + const stream = new stream_1.PassThrough({ objectMode: true }); + stream._write = (index, _enc, done) => { + return this._getEntry(filepaths[index], patterns[index], options).then((entry) => { + if (entry !== null && options.entryFilter(entry)) { + stream.push(entry); + } + if (index === filepaths.length - 1) { + stream.end(); + } + done(); + }).catch(done); + }; + for (let i6 = 0; i6 < filepaths.length; i6++) { + stream.write(i6); + } + return stream; + } + _getEntry(filepath, pattern, options) { + return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((error) => { + if (options.errorFilter(error)) { + return null; + } + throw error; + }); + } + _getStat(filepath) { + return new Promise((resolve, reject) => { + this._stat(filepath, this._fsStatSettings, (error, stats) => { + return error === null ? resolve(stats) : reject(error); + }); + }); + } + }; + exports.default = ReaderStream; } }); // -var require_cjs = __commonJS({ +var require_async5 = __commonJS({ ""(exports) { "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; + Object.defineProperty(exports, "__esModule", { value: true }); + var fsWalk = require_out3(); + var reader_1 = require_reader2(); + var stream_1 = require_stream3(); + var ReaderAsync = class extends reader_1.default { + constructor() { + super(...arguments); + this._walkAsync = fsWalk.walk; + this._readerStream = new stream_1.default(this._settings); + } + dynamic(root, options) { + return new Promise((resolve, reject) => { + this._walkAsync(root, options, (error, entries) => { + if (error === null) { + resolve(entries); + } else { + reject(error); + } + }); + }); } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; - }); - var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + async static(patterns, options) { + const entries = []; + const stream = this._readerStream.static(patterns, options); + return new Promise((resolve, reject) => { + stream.once("error", reject); + stream.on("data", (entry) => entries.push(entry)); + stream.once("end", () => resolve(entries)); + }); } - __setModuleDefault(result, mod); - return result; }; - var __exportStar = exports && exports.__exportStar || function(m, exports2) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.sync = exports.isexe = exports.posix = exports.win32 = void 0; - var posix = __importStar(require_posix()); - exports.posix = posix; - var win32 = __importStar(require_win32()); - exports.win32 = win32; - __exportStar(require_options(), exports); - var platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform; - var impl = platform === "win32" ? win32 : posix; - exports.isexe = impl.isexe; - exports.sync = impl.sync; + exports.default = ReaderAsync; } }); // -var require_lib2 = __commonJS({ - ""(exports, module) { - var { isexe, sync: isexeSync } = require_cjs(); - var { join: join3, delimiter, sep: sep2, posix } = __require("path"); - var isWindows = process.platform === "win32"; - var rSlash = new RegExp(`[${posix.sep}${sep2 === posix.sep ? "" : sep2}]`.replace(/(\\)/g, "\\$1")); - var rRel = new RegExp(`^\\.${rSlash.source}`); - var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" }); - var getPathInfo = (cmd, { - path: optPath = process.env.PATH, - pathExt: optPathExt = process.env.PATHEXT, - delimiter: optDelimiter = delimiter - }) => { - const pathEnv = cmd.match(rSlash) ? [""] : [ - // windows always checks the cwd first - ...isWindows ? [process.cwd()] : [], - ...(optPath || /* istanbul ignore next: very unusual */ - "").split(optDelimiter) - ]; - if (isWindows) { - const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter); - const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()]); - if (cmd.includes(".") && pathExt[0] !== "") { - pathExt.unshift(""); +var require_matcher = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var utils = require_utils6(); + var Matcher = class { + constructor(_patterns, _settings, _micromatchOptions) { + this._patterns = _patterns; + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + this._storage = []; + this._fillStorage(); + } + _fillStorage() { + for (const pattern of this._patterns) { + const segments = this._getPatternSegments(pattern); + const sections = this._splitSegmentsIntoSections(segments); + this._storage.push({ + complete: sections.length <= 1, + pattern, + segments, + sections + }); } - return { pathEnv, pathExt, pathExtExe }; } - return { pathEnv, pathExt: [""] }; - }; - var getPathPart = (raw, cmd) => { - const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw; - const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : ""; - return prefix + join3(pathPart, cmd); - }; - var which2 = async (cmd, opt = {}) => { - const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); - const found = []; - for (const envPart of pathEnv) { - const p = getPathPart(envPart, cmd); - for (const ext of pathExt) { - const withExt = p + ext; - const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true }); - if (is) { - if (!opt.all) { - return withExt; - } - found.push(withExt); + _getPatternSegments(pattern) { + const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions); + return parts.map((part) => { + const dynamic = utils.pattern.isDynamicPattern(part, this._settings); + if (!dynamic) { + return { + dynamic: false, + pattern: part + }; } - } - } - if (opt.all && found.length) { - return found; + return { + dynamic: true, + pattern: part, + patternRe: utils.pattern.makeRe(part, this._micromatchOptions) + }; + }); } - if (opt.nothrow) { - return null; + _splitSegmentsIntoSections(segments) { + return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern)); } - throw getNotFoundError(cmd); }; - var whichSync = (cmd, opt = {}) => { - const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); - const found = []; - for (const pathEnvPart of pathEnv) { - const p = getPathPart(pathEnvPart, cmd); - for (const ext of pathExt) { - const withExt = p + ext; - const is = isexeSync(withExt, { pathExt: pathExtExe, ignoreErrors: true }); - if (is) { - if (!opt.all) { - return withExt; + exports.default = Matcher; + } +}); + +// +var require_partial = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var matcher_1 = require_matcher(); + var PartialMatcher = class extends matcher_1.default { + match(filepath) { + const parts = filepath.split("/"); + const levels = parts.length; + const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels); + for (const pattern of patterns) { + const section = pattern.sections[0]; + if (!pattern.complete && levels > section.length) { + return true; + } + const match = parts.every((part, index) => { + const segment = pattern.segments[index]; + if (segment.dynamic && segment.patternRe.test(part)) { + return true; } - found.push(withExt); + if (!segment.dynamic && segment.pattern === part) { + return true; + } + return false; + }); + if (match) { + return true; } } + return false; } - if (opt.all && found.length) { - return found; - } - if (opt.nothrow) { - return null; - } - throw getNotFoundError(cmd); }; - module.exports = which2; - which2.sync = whichSync; + exports.default = PartialMatcher; } }); // -var require_lockfile = __commonJS({ - ""(exports, module) { - module.exports = /******/ - function(modules) { - var installedModules = {}; - function __webpack_require__(moduleId) { - if (installedModules[moduleId]) { - return installedModules[moduleId].exports; - } - var module2 = installedModules[moduleId] = { - /******/ - i: moduleId, - /******/ - l: false, - /******/ - exports: {} - /******/ - }; - modules[moduleId].call(module2.exports, module2, module2.exports, __webpack_require__); - module2.l = true; - return module2.exports; +var require_deep = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var utils = require_utils6(); + var partial_1 = require_partial(); + var DeepFilter = class { + constructor(_settings, _micromatchOptions) { + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + } + getFilter(basePath, positive, negative) { + const matcher = this._getMatcher(positive); + const negativeRe = this._getNegativePatternsRe(negative); + return (entry) => this._filter(basePath, entry, matcher, negativeRe); + } + _getMatcher(patterns) { + return new partial_1.default(patterns, this._settings, this._micromatchOptions); + } + _getNegativePatternsRe(patterns) { + const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern); + return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions); + } + _filter(basePath, entry, matcher, negativeRe) { + if (this._isSkippedByDeep(basePath, entry.path)) { + return false; + } + if (this._isSkippedSymbolicLink(entry)) { + return false; + } + const filepath = utils.path.removeLeadingDotSegment(entry.path); + if (this._isSkippedByPositivePatterns(filepath, matcher)) { + return false; + } + return this._isSkippedByNegativePatterns(filepath, negativeRe); } - __webpack_require__.m = modules; - __webpack_require__.c = installedModules; - __webpack_require__.i = function(value) { - return value; - }; - __webpack_require__.d = function(exports2, name, getter) { - if (!__webpack_require__.o(exports2, name)) { - Object.defineProperty(exports2, name, { - /******/ - configurable: false, - /******/ - enumerable: true, - /******/ - get: getter - /******/ - }); + _isSkippedByDeep(basePath, entryPath) { + if (this._settings.deep === Infinity) { + return false; } - }; - __webpack_require__.n = function(module2) { - var getter = module2 && module2.__esModule ? ( - /******/ - function getDefault() { - return module2["default"]; - } - ) : ( - /******/ - function getModuleExports() { - return module2; - } - ); - __webpack_require__.d(getter, "a", getter); - return getter; - }; - __webpack_require__.o = function(object, property) { - return Object.prototype.hasOwnProperty.call(object, property); - }; - __webpack_require__.p = ""; - return __webpack_require__(__webpack_require__.s = 14); - }([ - /* 0 */ - /***/ - function(module2, exports2) { - module2.exports = __require("path"); - }, - /* 1 */ - /***/ - function(module2, exports2, __webpack_require__) { - "use strict"; - exports2.__esModule = true; - var _promise = __webpack_require__(173); - var _promise2 = _interopRequireDefault(_promise); - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { default: obj }; + return this._getEntryLevel(basePath, entryPath) >= this._settings.deep; + } + _getEntryLevel(basePath, entryPath) { + const entryPathDepth = entryPath.split("/").length; + if (basePath === "") { + return entryPathDepth; } - exports2.default = function(fn) { - return function() { - var gen = fn.apply(this, arguments); - return new _promise2.default(function(resolve, reject) { - function step(key, arg) { - try { - var info = gen[key](arg); - var value = info.value; - } catch (error) { - reject(error); - return; - } - if (info.done) { - resolve(value); - } else { - return _promise2.default.resolve(value).then(function(value2) { - step("next", value2); - }, function(err) { - step("throw", err); - }); - } - } - return step("next"); - }); - }; - }; - }, - /* 2 */ - /***/ - function(module2, exports2) { - module2.exports = __require("util"); - }, - /* 3 */ - /***/ - function(module2, exports2) { - module2.exports = __require("fs"); - }, - /* 4 */ - /***/ - function(module2, exports2, __webpack_require__) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - class MessageError extends Error { - constructor(msg, code) { - super(msg); - this.code = code; + const basePathDepth = basePath.split("/").length; + return entryPathDepth - basePathDepth; + } + _isSkippedSymbolicLink(entry) { + return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink(); + } + _isSkippedByPositivePatterns(entryPath, matcher) { + return !this._settings.baseNameMatch && !matcher.match(entryPath); + } + _isSkippedByNegativePatterns(entryPath, patternsRe) { + return !utils.pattern.matchAny(entryPath, patternsRe); + } + }; + exports.default = DeepFilter; + } +}); + +// +var require_entry = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var utils = require_utils6(); + var EntryFilter = class { + constructor(_settings, _micromatchOptions) { + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + this.index = /* @__PURE__ */ new Map(); + } + getFilter(positive, negative) { + const [absoluteNegative, relativeNegative] = utils.pattern.partitionAbsoluteAndRelative(negative); + const patterns = { + positive: { + all: utils.pattern.convertPatternsToRe(positive, this._micromatchOptions) + }, + negative: { + absolute: utils.pattern.convertPatternsToRe(absoluteNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })), + relative: utils.pattern.convertPatternsToRe(relativeNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })) } + }; + return (entry) => this._filter(entry, patterns); + } + _filter(entry, patterns) { + const filepath = utils.path.removeLeadingDotSegment(entry.path); + if (this._settings.unique && this._isDuplicateEntry(filepath)) { + return false; } - exports2.MessageError = MessageError; - class ProcessSpawnError extends MessageError { - constructor(msg, code, process4) { - super(msg, code); - this.process = process4; - } + if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) { + return false; } - exports2.ProcessSpawnError = ProcessSpawnError; - class SecurityError extends MessageError { + const isMatched = this._isMatchToPatternsSet(filepath, patterns, entry.dirent.isDirectory()); + if (this._settings.unique && isMatched) { + this._createIndexRecord(filepath); } - exports2.SecurityError = SecurityError; - class ProcessTermError extends MessageError { + return isMatched; + } + _isDuplicateEntry(filepath) { + return this.index.has(filepath); + } + _createIndexRecord(filepath) { + this.index.set(filepath, void 0); + } + _onlyFileFilter(entry) { + return this._settings.onlyFiles && !entry.dirent.isFile(); + } + _onlyDirectoryFilter(entry) { + return this._settings.onlyDirectories && !entry.dirent.isDirectory(); + } + _isMatchToPatternsSet(filepath, patterns, isDirectory) { + const isMatched = this._isMatchToPatterns(filepath, patterns.positive.all, isDirectory); + if (!isMatched) { + return false; } - exports2.ProcessTermError = ProcessTermError; - class ResponseError extends Error { - constructor(msg, responseCode) { - super(msg); - this.responseCode = responseCode; + const isMatchedByRelativeNegative = this._isMatchToPatterns(filepath, patterns.negative.relative, isDirectory); + if (isMatchedByRelativeNegative) { + return false; + } + const isMatchedByAbsoluteNegative = this._isMatchToAbsoluteNegative(filepath, patterns.negative.absolute, isDirectory); + if (isMatchedByAbsoluteNegative) { + return false; + } + return true; + } + _isMatchToAbsoluteNegative(filepath, patternsRe, isDirectory) { + if (patternsRe.length === 0) { + return false; + } + const fullpath = utils.path.makeAbsolute(this._settings.cwd, filepath); + return this._isMatchToPatterns(fullpath, patternsRe, isDirectory); + } + _isMatchToPatterns(filepath, patternsRe, isDirectory) { + if (patternsRe.length === 0) { + return false; + } + const isMatched = utils.pattern.matchAny(filepath, patternsRe); + if (!isMatched && isDirectory) { + return utils.pattern.matchAny(filepath + "/", patternsRe); + } + return isMatched; + } + }; + exports.default = EntryFilter; + } +}); + +// +var require_error = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var utils = require_utils6(); + var ErrorFilter = class { + constructor(_settings) { + this._settings = _settings; + } + getFilter() { + return (error) => this._isNonFatalError(error); + } + _isNonFatalError(error) { + return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors; + } + }; + exports.default = ErrorFilter; + } +}); + +// +var require_entry2 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var utils = require_utils6(); + var EntryTransformer = class { + constructor(_settings) { + this._settings = _settings; + } + getTransformer() { + return (entry) => this._transform(entry); + } + _transform(entry) { + let filepath = entry.path; + if (this._settings.absolute) { + filepath = utils.path.makeAbsolute(this._settings.cwd, filepath); + filepath = utils.path.unixify(filepath); + } + if (this._settings.markDirectories && entry.dirent.isDirectory()) { + filepath += "/"; + } + if (!this._settings.objectMode) { + return filepath; + } + return Object.assign(Object.assign({}, entry), { path: filepath }); + } + }; + exports.default = EntryTransformer; + } +}); + +// +var require_provider = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var path = __require("path"); + var deep_1 = require_deep(); + var entry_1 = require_entry(); + var error_1 = require_error(); + var entry_2 = require_entry2(); + var Provider = class { + constructor(_settings) { + this._settings = _settings; + this.errorFilter = new error_1.default(this._settings); + this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions()); + this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions()); + this.entryTransformer = new entry_2.default(this._settings); + } + _getRootDirectory(task) { + return path.resolve(this._settings.cwd, task.base); + } + _getReaderOptions(task) { + const basePath = task.base === "." ? "" : task.base; + return { + basePath, + pathSegmentSeparator: "/", + concurrency: this._settings.concurrency, + deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative), + entryFilter: this.entryFilter.getFilter(task.positive, task.negative), + errorFilter: this.errorFilter.getFilter(), + followSymbolicLinks: this._settings.followSymbolicLinks, + fs: this._settings.fs, + stats: this._settings.stats, + throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink, + transform: this.entryTransformer.getTransformer() + }; + } + _getMicromatchOptions() { + return { + dot: this._settings.dot, + matchBase: this._settings.baseNameMatch, + nobrace: !this._settings.braceExpansion, + nocase: !this._settings.caseSensitiveMatch, + noext: !this._settings.extglob, + noglobstar: !this._settings.globstar, + posix: true, + strictSlashes: false + }; + } + }; + exports.default = Provider; + } +}); + +// +var require_async6 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var async_1 = require_async5(); + var provider_1 = require_provider(); + var ProviderAsync = class extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new async_1.default(this._settings); + } + async read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const entries = await this.api(root, task, options); + return entries.map((entry) => options.transform(entry)); + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } + }; + exports.default = ProviderAsync; + } +}); + +// +var require_stream4 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var stream_1 = __require("stream"); + var stream_2 = require_stream3(); + var provider_1 = require_provider(); + var ProviderStream = class extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new stream_2.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const source = this.api(root, task, options); + const destination = new stream_1.Readable({ objectMode: true, read: () => { + } }); + source.once("error", (error) => destination.emit("error", error)).on("data", (entry) => destination.emit("data", options.transform(entry))).once("end", () => destination.emit("end")); + destination.once("close", () => source.destroy()); + return destination; + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } + }; + exports.default = ProviderStream; + } +}); + +// +var require_sync5 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var fsStat = require_out(); + var fsWalk = require_out3(); + var reader_1 = require_reader2(); + var ReaderSync = class extends reader_1.default { + constructor() { + super(...arguments); + this._walkSync = fsWalk.walkSync; + this._statSync = fsStat.statSync; + } + dynamic(root, options) { + return this._walkSync(root, options); + } + static(patterns, options) { + const entries = []; + for (const pattern of patterns) { + const filepath = this._getFullEntryPath(pattern); + const entry = this._getEntry(filepath, pattern, options); + if (entry === null || !options.entryFilter(entry)) { + continue; } + entries.push(entry); } - exports2.ResponseError = ResponseError; - }, - /* 5 */ - /***/ - function(module2, exports2, __webpack_require__) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.getFirstSuitableFolder = exports2.readFirstAvailableStream = exports2.makeTempDir = exports2.hardlinksWork = exports2.writeFilePreservingEol = exports2.getFileSizeOnDisk = exports2.walk = exports2.symlink = exports2.find = exports2.readJsonAndFile = exports2.readJson = exports2.readFileAny = exports2.hardlinkBulk = exports2.copyBulk = exports2.unlink = exports2.glob = exports2.link = exports2.chmod = exports2.lstat = exports2.exists = exports2.mkdirp = exports2.stat = exports2.access = exports2.rename = exports2.readdir = exports2.realpath = exports2.readlink = exports2.writeFile = exports2.open = exports2.readFileBuffer = exports2.lockQueue = exports2.constants = void 0; - var _asyncToGenerator2; - function _load_asyncToGenerator() { - return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(1)); + return entries; + } + _getEntry(filepath, pattern, options) { + try { + const stats = this._getStat(filepath); + return this._makeEntry(stats, pattern); + } catch (error) { + if (options.errorFilter(error)) { + return null; + } + throw error; } - let buildActionsForCopy = (() => { - var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, events, possibleExtraneous, reporter) { - let build = (() => { - var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) { - const src = data.src, dest = data.dest, type = data.type; - const onFresh = data.onFresh || noop2; - const onDone = data.onDone || noop2; - if (files.has(dest.toLowerCase())) { - reporter.verbose(`The case-insensitive file ${dest} shouldn't be copied twice in one bulk copy`); - } else { - files.add(dest.toLowerCase()); - } - if (type === "symlink") { - yield mkdirp((_path || _load_path()).default.dirname(dest)); - onFresh(); - actions.symlink.push({ - dest, - linkname: src - }); - onDone(); - return; - } - if (events.ignoreBasenames.indexOf((_path || _load_path()).default.basename(src)) >= 0) { - return; - } - const srcStat = yield lstat(src); - let srcFiles; - if (srcStat.isDirectory()) { - srcFiles = yield readdir(src); - } - let destStat; - try { - destStat = yield lstat(dest); - } catch (e) { - if (e.code !== "ENOENT") { - throw e; - } + } + _getStat(filepath) { + return this._statSync(filepath, this._fsStatSettings); + } + }; + exports.default = ReaderSync; + } +}); + +// +var require_sync6 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var sync_1 = require_sync5(); + var provider_1 = require_provider(); + var ProviderSync = class extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new sync_1.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const entries = this.api(root, task, options); + return entries.map(options.transform); + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } + }; + exports.default = ProviderSync; + } +}); + +// +var require_settings4 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0; + var fs = __require("fs"); + var os3 = __require("os"); + var CPU_COUNT = Math.max(os3.cpus().length, 1); + exports.DEFAULT_FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + lstatSync: fs.lstatSync, + stat: fs.stat, + statSync: fs.statSync, + readdir: fs.readdir, + readdirSync: fs.readdirSync + }; + var Settings = class { + constructor(_options = {}) { + this._options = _options; + this.absolute = this._getValue(this._options.absolute, false); + this.baseNameMatch = this._getValue(this._options.baseNameMatch, false); + this.braceExpansion = this._getValue(this._options.braceExpansion, true); + this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true); + this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT); + this.cwd = this._getValue(this._options.cwd, process.cwd()); + this.deep = this._getValue(this._options.deep, Infinity); + this.dot = this._getValue(this._options.dot, false); + this.extglob = this._getValue(this._options.extglob, true); + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true); + this.fs = this._getFileSystemMethods(this._options.fs); + this.globstar = this._getValue(this._options.globstar, true); + this.ignore = this._getValue(this._options.ignore, []); + this.markDirectories = this._getValue(this._options.markDirectories, false); + this.objectMode = this._getValue(this._options.objectMode, false); + this.onlyDirectories = this._getValue(this._options.onlyDirectories, false); + this.onlyFiles = this._getValue(this._options.onlyFiles, true); + this.stats = this._getValue(this._options.stats, false); + this.suppressErrors = this._getValue(this._options.suppressErrors, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false); + this.unique = this._getValue(this._options.unique, true); + if (this.onlyDirectories) { + this.onlyFiles = false; + } + if (this.stats) { + this.objectMode = true; + } + this.ignore = [].concat(this.ignore); + } + _getValue(option, value) { + return option === void 0 ? value : option; + } + _getFileSystemMethods(methods = {}) { + return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods); + } + }; + exports.default = Settings; + } +}); + +// +var require_out4 = __commonJS({ + ""(exports, module2) { + "use strict"; + var taskManager = require_tasks(); + var async_1 = require_async6(); + var stream_1 = require_stream4(); + var sync_1 = require_sync6(); + var settings_1 = require_settings4(); + var utils = require_utils6(); + async function FastGlob(source, options) { + assertPatternsInput(source); + const works = getWorks(source, async_1.default, options); + const result = await Promise.all(works); + return utils.array.flatten(result); + } + (function(FastGlob2) { + FastGlob2.glob = FastGlob2; + FastGlob2.globSync = sync; + FastGlob2.globStream = stream; + FastGlob2.async = FastGlob2; + function sync(source, options) { + assertPatternsInput(source); + const works = getWorks(source, sync_1.default, options); + return utils.array.flatten(works); + } + FastGlob2.sync = sync; + function stream(source, options) { + assertPatternsInput(source); + const works = getWorks(source, stream_1.default, options); + return utils.stream.merge(works); + } + FastGlob2.stream = stream; + function generateTasks(source, options) { + assertPatternsInput(source); + const patterns = [].concat(source); + const settings = new settings_1.default(options); + return taskManager.generate(patterns, settings); + } + FastGlob2.generateTasks = generateTasks; + function isDynamicPattern(source, options) { + assertPatternsInput(source); + const settings = new settings_1.default(options); + return utils.pattern.isDynamicPattern(source, settings); + } + FastGlob2.isDynamicPattern = isDynamicPattern; + function escapePath(source) { + assertPatternsInput(source); + return utils.path.escape(source); + } + FastGlob2.escapePath = escapePath; + function convertPathToPattern(source) { + assertPatternsInput(source); + return utils.path.convertPathToPattern(source); + } + FastGlob2.convertPathToPattern = convertPathToPattern; + let posix; + (function(posix2) { + function escapePath2(source) { + assertPatternsInput(source); + return utils.path.escapePosixPath(source); + } + posix2.escapePath = escapePath2; + function convertPathToPattern2(source) { + assertPatternsInput(source); + return utils.path.convertPosixPathToPattern(source); + } + posix2.convertPathToPattern = convertPathToPattern2; + })(posix = FastGlob2.posix || (FastGlob2.posix = {})); + let win32; + (function(win322) { + function escapePath2(source) { + assertPatternsInput(source); + return utils.path.escapeWindowsPath(source); + } + win322.escapePath = escapePath2; + function convertPathToPattern2(source) { + assertPatternsInput(source); + return utils.path.convertWindowsPathToPattern(source); + } + win322.convertPathToPattern = convertPathToPattern2; + })(win32 = FastGlob2.win32 || (FastGlob2.win32 = {})); + })(FastGlob || (FastGlob = {})); + function getWorks(source, _Provider, options) { + const patterns = [].concat(source); + const settings = new settings_1.default(options); + const tasks = taskManager.generate(patterns, settings); + const provider = new _Provider(settings); + return tasks.map(provider.read, provider); + } + function assertPatternsInput(input) { + const source = [].concat(input); + const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item)); + if (!isValidSource) { + throw new TypeError("Patterns must be a string (non empty) or an array of strings"); + } + } + module2.exports = FastGlob; + } +}); + +// +var require_main = __commonJS({ + ""(exports, module2) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var node_exports = {}; + __export2(node_exports, { + analyzeMetafile: () => analyzeMetafile, + analyzeMetafileSync: () => analyzeMetafileSync, + build: () => build, + buildSync: () => buildSync, + context: () => context2, + default: () => node_default, + formatMessages: () => formatMessages, + formatMessagesSync: () => formatMessagesSync, + initialize: () => initialize, + stop: () => stop, + transform: () => transform, + transformSync: () => transformSync, + version: () => version + }); + module2.exports = __toCommonJS(node_exports); + function encodePacket(packet) { + let visit = (value) => { + if (value === null) { + bb.write8(0); + } else if (typeof value === "boolean") { + bb.write8(1); + bb.write8(+value); + } else if (typeof value === "number") { + bb.write8(2); + bb.write32(value | 0); + } else if (typeof value === "string") { + bb.write8(3); + bb.write(encodeUTF8(value)); + } else if (value instanceof Uint8Array) { + bb.write8(4); + bb.write(value); + } else if (value instanceof Array) { + bb.write8(5); + bb.write32(value.length); + for (let item of value) { + visit(item); + } + } else { + let keys = Object.keys(value); + bb.write8(6); + bb.write32(keys.length); + for (let key of keys) { + bb.write(encodeUTF8(key)); + visit(value[key]); + } + } + }; + let bb = new ByteBuffer(); + bb.write32(0); + bb.write32(packet.id << 1 | +!packet.isRequest); + visit(packet.value); + writeUInt32LE(bb.buf, bb.len - 4, 0); + return bb.buf.subarray(0, bb.len); + } + function decodePacket(bytes) { + let visit = () => { + switch (bb.read8()) { + case 0: + return null; + case 1: + return !!bb.read8(); + case 2: + return bb.read32(); + case 3: + return decodeUTF8(bb.read()); + case 4: + return bb.read(); + case 5: { + let count = bb.read32(); + let value2 = []; + for (let i6 = 0; i6 < count; i6++) { + value2.push(visit()); + } + return value2; + } + case 6: { + let count = bb.read32(); + let value2 = {}; + for (let i6 = 0; i6 < count; i6++) { + value2[decodeUTF8(bb.read())] = visit(); + } + return value2; + } + default: + throw new Error("Invalid packet"); + } + }; + let bb = new ByteBuffer(bytes); + let id = bb.read32(); + let isRequest = (id & 1) === 0; + id >>>= 1; + let value = visit(); + if (bb.ptr !== bytes.length) { + throw new Error("Invalid packet"); + } + return { id, isRequest, value }; + } + var ByteBuffer = class { + constructor(buf = new Uint8Array(1024)) { + this.buf = buf; + this.len = 0; + this.ptr = 0; + } + _write(delta) { + if (this.len + delta > this.buf.length) { + let clone = new Uint8Array((this.len + delta) * 2); + clone.set(this.buf); + this.buf = clone; + } + this.len += delta; + return this.len - delta; + } + write8(value) { + let offset = this._write(1); + this.buf[offset] = value; + } + write32(value) { + let offset = this._write(4); + writeUInt32LE(this.buf, value, offset); + } + write(bytes) { + let offset = this._write(4 + bytes.length); + writeUInt32LE(this.buf, bytes.length, offset); + this.buf.set(bytes, offset + 4); + } + _read(delta) { + if (this.ptr + delta > this.buf.length) { + throw new Error("Invalid packet"); + } + this.ptr += delta; + return this.ptr - delta; + } + read8() { + return this.buf[this._read(1)]; + } + read32() { + return readUInt32LE(this.buf, this._read(4)); + } + read() { + let length = this.read32(); + let bytes = new Uint8Array(length); + let ptr = this._read(bytes.length); + bytes.set(this.buf.subarray(ptr, ptr + length)); + return bytes; + } + }; + var encodeUTF8; + var decodeUTF8; + var encodeInvariant; + if (typeof TextEncoder !== "undefined" && typeof TextDecoder !== "undefined") { + let encoder = new TextEncoder(); + let decoder = new TextDecoder(); + encodeUTF8 = (text) => encoder.encode(text); + decodeUTF8 = (bytes) => decoder.decode(bytes); + encodeInvariant = 'new TextEncoder().encode("")'; + } else if (typeof Buffer !== "undefined") { + encodeUTF8 = (text) => Buffer.from(text); + decodeUTF8 = (bytes) => { + let { buffer, byteOffset, byteLength } = bytes; + return Buffer.from(buffer, byteOffset, byteLength).toString(); + }; + encodeInvariant = 'Buffer.from("")'; + } else { + throw new Error("No UTF-8 codec found"); + } + if (!(encodeUTF8("") instanceof Uint8Array)) + throw new Error(`Invariant violation: "${encodeInvariant} instanceof Uint8Array" is incorrectly false + +This indicates that your JavaScript environment is broken. You cannot use +esbuild in this environment because esbuild relies on this invariant. This +is not a problem with esbuild. You need to fix your environment instead. +`); + function readUInt32LE(buffer, offset) { + return buffer[offset++] | buffer[offset++] << 8 | buffer[offset++] << 16 | buffer[offset++] << 24; + } + function writeUInt32LE(buffer, value, offset) { + buffer[offset++] = value; + buffer[offset++] = value >> 8; + buffer[offset++] = value >> 16; + buffer[offset++] = value >> 24; + } + var quote = JSON.stringify; + var buildLogLevelDefault = "warning"; + var transformLogLevelDefault = "silent"; + function validateAndJoinStringArray(values, what) { + const toJoin = []; + for (const value of values) { + validateStringValue(value, what); + if (value.indexOf(",") >= 0) + throw new Error(`Invalid ${what}: ${value}`); + toJoin.push(value); + } + return toJoin.join(","); + } + var canBeAnything = () => null; + var mustBeBoolean = (value) => typeof value === "boolean" ? null : "a boolean"; + var mustBeString = (value) => typeof value === "string" ? null : "a string"; + var mustBeRegExp = (value) => value instanceof RegExp ? null : "a RegExp object"; + var mustBeInteger = (value) => typeof value === "number" && value === (value | 0) ? null : "an integer"; + var mustBeValidPortNumber = (value) => typeof value === "number" && value === (value | 0) && value >= 0 && value <= 65535 ? null : "a valid port number"; + var mustBeFunction = (value) => typeof value === "function" ? null : "a function"; + var mustBeArray = (value) => Array.isArray(value) ? null : "an array"; + var mustBeArrayOfStrings = (value) => Array.isArray(value) && value.every((x2) => typeof x2 === "string") ? null : "an array of strings"; + var mustBeObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? null : "an object"; + var mustBeEntryPoints = (value) => typeof value === "object" && value !== null ? null : "an array or an object"; + var mustBeWebAssemblyModule = (value) => value instanceof WebAssembly.Module ? null : "a WebAssembly.Module"; + var mustBeObjectOrNull = (value) => typeof value === "object" && !Array.isArray(value) ? null : "an object or null"; + var mustBeStringOrBoolean = (value) => typeof value === "string" || typeof value === "boolean" ? null : "a string or a boolean"; + var mustBeStringOrObject = (value) => typeof value === "string" || typeof value === "object" && value !== null && !Array.isArray(value) ? null : "a string or an object"; + var mustBeStringOrArrayOfStrings = (value) => typeof value === "string" || Array.isArray(value) && value.every((x2) => typeof x2 === "string") ? null : "a string or an array of strings"; + var mustBeStringOrUint8Array = (value) => typeof value === "string" || value instanceof Uint8Array ? null : "a string or a Uint8Array"; + var mustBeStringOrURL = (value) => typeof value === "string" || value instanceof URL ? null : "a string or a URL"; + function getFlag(object, keys, key, mustBeFn) { + let value = object[key]; + keys[key + ""] = true; + if (value === void 0) + return void 0; + let mustBe = mustBeFn(value); + if (mustBe !== null) + throw new Error(`${quote(key)} must be ${mustBe}`); + return value; + } + function checkForInvalidFlags(object, keys, where) { + for (let key in object) { + if (!(key in keys)) { + throw new Error(`Invalid option ${where}: ${quote(key)}`); + } + } + } + function validateInitializeOptions(options) { + let keys = /* @__PURE__ */ Object.create(null); + let wasmURL = getFlag(options, keys, "wasmURL", mustBeStringOrURL); + let wasmModule = getFlag(options, keys, "wasmModule", mustBeWebAssemblyModule); + let worker = getFlag(options, keys, "worker", mustBeBoolean); + checkForInvalidFlags(options, keys, "in initialize() call"); + return { + wasmURL, + wasmModule, + worker + }; + } + function validateMangleCache(mangleCache) { + let validated; + if (mangleCache !== void 0) { + validated = /* @__PURE__ */ Object.create(null); + for (let key in mangleCache) { + let value = mangleCache[key]; + if (typeof value === "string" || value === false) { + validated[key] = value; + } else { + throw new Error(`Expected ${quote(key)} in mangle cache to map to either a string or false`); + } + } + } + return validated; + } + function pushLogFlags(flags, options, keys, isTTY2, logLevelDefault) { + let color = getFlag(options, keys, "color", mustBeBoolean); + let logLevel = getFlag(options, keys, "logLevel", mustBeString); + let logLimit = getFlag(options, keys, "logLimit", mustBeInteger); + if (color !== void 0) + flags.push(`--color=${color}`); + else if (isTTY2) + flags.push(`--color=true`); + flags.push(`--log-level=${logLevel || logLevelDefault}`); + flags.push(`--log-limit=${logLimit || 0}`); + } + function validateStringValue(value, what, key) { + if (typeof value !== "string") { + throw new Error(`Expected value for ${what}${key !== void 0 ? " " + quote(key) : ""} to be a string, got ${typeof value} instead`); + } + return value; + } + function pushCommonFlags(flags, options, keys) { + let legalComments = getFlag(options, keys, "legalComments", mustBeString); + let sourceRoot = getFlag(options, keys, "sourceRoot", mustBeString); + let sourcesContent = getFlag(options, keys, "sourcesContent", mustBeBoolean); + let target = getFlag(options, keys, "target", mustBeStringOrArrayOfStrings); + let format = getFlag(options, keys, "format", mustBeString); + let globalName = getFlag(options, keys, "globalName", mustBeString); + let mangleProps = getFlag(options, keys, "mangleProps", mustBeRegExp); + let reserveProps = getFlag(options, keys, "reserveProps", mustBeRegExp); + let mangleQuoted = getFlag(options, keys, "mangleQuoted", mustBeBoolean); + let minify = getFlag(options, keys, "minify", mustBeBoolean); + let minifySyntax = getFlag(options, keys, "minifySyntax", mustBeBoolean); + let minifyWhitespace = getFlag(options, keys, "minifyWhitespace", mustBeBoolean); + let minifyIdentifiers = getFlag(options, keys, "minifyIdentifiers", mustBeBoolean); + let lineLimit = getFlag(options, keys, "lineLimit", mustBeInteger); + let drop = getFlag(options, keys, "drop", mustBeArrayOfStrings); + let dropLabels = getFlag(options, keys, "dropLabels", mustBeArrayOfStrings); + let charset = getFlag(options, keys, "charset", mustBeString); + let treeShaking = getFlag(options, keys, "treeShaking", mustBeBoolean); + let ignoreAnnotations = getFlag(options, keys, "ignoreAnnotations", mustBeBoolean); + let jsx = getFlag(options, keys, "jsx", mustBeString); + let jsxFactory = getFlag(options, keys, "jsxFactory", mustBeString); + let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString); + let jsxImportSource = getFlag(options, keys, "jsxImportSource", mustBeString); + let jsxDev = getFlag(options, keys, "jsxDev", mustBeBoolean); + let jsxSideEffects = getFlag(options, keys, "jsxSideEffects", mustBeBoolean); + let define = getFlag(options, keys, "define", mustBeObject); + let logOverride = getFlag(options, keys, "logOverride", mustBeObject); + let supported = getFlag(options, keys, "supported", mustBeObject); + let pure = getFlag(options, keys, "pure", mustBeArrayOfStrings); + let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean); + let platform = getFlag(options, keys, "platform", mustBeString); + let tsconfigRaw = getFlag(options, keys, "tsconfigRaw", mustBeStringOrObject); + let absPaths = getFlag(options, keys, "absPaths", mustBeArrayOfStrings); + if (legalComments) + flags.push(`--legal-comments=${legalComments}`); + if (sourceRoot !== void 0) + flags.push(`--source-root=${sourceRoot}`); + if (sourcesContent !== void 0) + flags.push(`--sources-content=${sourcesContent}`); + if (target) + flags.push(`--target=${validateAndJoinStringArray(Array.isArray(target) ? target : [target], "target")}`); + if (format) + flags.push(`--format=${format}`); + if (globalName) + flags.push(`--global-name=${globalName}`); + if (platform) + flags.push(`--platform=${platform}`); + if (tsconfigRaw) + flags.push(`--tsconfig-raw=${typeof tsconfigRaw === "string" ? tsconfigRaw : JSON.stringify(tsconfigRaw)}`); + if (minify) + flags.push("--minify"); + if (minifySyntax) + flags.push("--minify-syntax"); + if (minifyWhitespace) + flags.push("--minify-whitespace"); + if (minifyIdentifiers) + flags.push("--minify-identifiers"); + if (lineLimit) + flags.push(`--line-limit=${lineLimit}`); + if (charset) + flags.push(`--charset=${charset}`); + if (treeShaking !== void 0) + flags.push(`--tree-shaking=${treeShaking}`); + if (ignoreAnnotations) + flags.push(`--ignore-annotations`); + if (drop) + for (let what of drop) + flags.push(`--drop:${validateStringValue(what, "drop")}`); + if (dropLabels) + flags.push(`--drop-labels=${validateAndJoinStringArray(dropLabels, "drop label")}`); + if (absPaths) + flags.push(`--abs-paths=${validateAndJoinStringArray(absPaths, "abs paths")}`); + if (mangleProps) + flags.push(`--mangle-props=${jsRegExpToGoRegExp(mangleProps)}`); + if (reserveProps) + flags.push(`--reserve-props=${jsRegExpToGoRegExp(reserveProps)}`); + if (mangleQuoted !== void 0) + flags.push(`--mangle-quoted=${mangleQuoted}`); + if (jsx) + flags.push(`--jsx=${jsx}`); + if (jsxFactory) + flags.push(`--jsx-factory=${jsxFactory}`); + if (jsxFragment) + flags.push(`--jsx-fragment=${jsxFragment}`); + if (jsxImportSource) + flags.push(`--jsx-import-source=${jsxImportSource}`); + if (jsxDev) + flags.push(`--jsx-dev`); + if (jsxSideEffects) + flags.push(`--jsx-side-effects`); + if (define) { + for (let key in define) { + if (key.indexOf("=") >= 0) + throw new Error(`Invalid define: ${key}`); + flags.push(`--define:${key}=${validateStringValue(define[key], "define", key)}`); + } + } + if (logOverride) { + for (let key in logOverride) { + if (key.indexOf("=") >= 0) + throw new Error(`Invalid log override: ${key}`); + flags.push(`--log-override:${key}=${validateStringValue(logOverride[key], "log override", key)}`); + } + } + if (supported) { + for (let key in supported) { + if (key.indexOf("=") >= 0) + throw new Error(`Invalid supported: ${key}`); + const value = supported[key]; + if (typeof value !== "boolean") + throw new Error(`Expected value for supported ${quote(key)} to be a boolean, got ${typeof value} instead`); + flags.push(`--supported:${key}=${value}`); + } + } + if (pure) + for (let fn2 of pure) + flags.push(`--pure:${validateStringValue(fn2, "pure")}`); + if (keepNames) + flags.push(`--keep-names`); + } + function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeDefault) { + var _a2; + let flags = []; + let entries = []; + let keys = /* @__PURE__ */ Object.create(null); + let stdinContents = null; + let stdinResolveDir = null; + pushLogFlags(flags, options, keys, isTTY2, logLevelDefault); + pushCommonFlags(flags, options, keys); + let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean); + let bundle = getFlag(options, keys, "bundle", mustBeBoolean); + let splitting = getFlag(options, keys, "splitting", mustBeBoolean); + let preserveSymlinks = getFlag(options, keys, "preserveSymlinks", mustBeBoolean); + let metafile = getFlag(options, keys, "metafile", mustBeBoolean); + let outfile = getFlag(options, keys, "outfile", mustBeString); + let outdir = getFlag(options, keys, "outdir", mustBeString); + let outbase = getFlag(options, keys, "outbase", mustBeString); + let tsconfig = getFlag(options, keys, "tsconfig", mustBeString); + let resolveExtensions = getFlag(options, keys, "resolveExtensions", mustBeArrayOfStrings); + let nodePathsInput = getFlag(options, keys, "nodePaths", mustBeArrayOfStrings); + let mainFields = getFlag(options, keys, "mainFields", mustBeArrayOfStrings); + let conditions = getFlag(options, keys, "conditions", mustBeArrayOfStrings); + let external = getFlag(options, keys, "external", mustBeArrayOfStrings); + let packages = getFlag(options, keys, "packages", mustBeString); + let alias = getFlag(options, keys, "alias", mustBeObject); + let loader = getFlag(options, keys, "loader", mustBeObject); + let outExtension = getFlag(options, keys, "outExtension", mustBeObject); + let publicPath = getFlag(options, keys, "publicPath", mustBeString); + let entryNames = getFlag(options, keys, "entryNames", mustBeString); + let chunkNames = getFlag(options, keys, "chunkNames", mustBeString); + let assetNames = getFlag(options, keys, "assetNames", mustBeString); + let inject = getFlag(options, keys, "inject", mustBeArrayOfStrings); + let banner = getFlag(options, keys, "banner", mustBeObject); + let footer = getFlag(options, keys, "footer", mustBeObject); + let entryPoints = getFlag(options, keys, "entryPoints", mustBeEntryPoints); + let absWorkingDir = getFlag(options, keys, "absWorkingDir", mustBeString); + let stdin = getFlag(options, keys, "stdin", mustBeObject); + let write = (_a2 = getFlag(options, keys, "write", mustBeBoolean)) != null ? _a2 : writeDefault; + let allowOverwrite = getFlag(options, keys, "allowOverwrite", mustBeBoolean); + let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject); + keys.plugins = true; + checkForInvalidFlags(options, keys, `in ${callName}() call`); + if (sourcemap) + flags.push(`--sourcemap${sourcemap === true ? "" : `=${sourcemap}`}`); + if (bundle) + flags.push("--bundle"); + if (allowOverwrite) + flags.push("--allow-overwrite"); + if (splitting) + flags.push("--splitting"); + if (preserveSymlinks) + flags.push("--preserve-symlinks"); + if (metafile) + flags.push(`--metafile`); + if (outfile) + flags.push(`--outfile=${outfile}`); + if (outdir) + flags.push(`--outdir=${outdir}`); + if (outbase) + flags.push(`--outbase=${outbase}`); + if (tsconfig) + flags.push(`--tsconfig=${tsconfig}`); + if (packages) + flags.push(`--packages=${packages}`); + if (resolveExtensions) + flags.push(`--resolve-extensions=${validateAndJoinStringArray(resolveExtensions, "resolve extension")}`); + if (publicPath) + flags.push(`--public-path=${publicPath}`); + if (entryNames) + flags.push(`--entry-names=${entryNames}`); + if (chunkNames) + flags.push(`--chunk-names=${chunkNames}`); + if (assetNames) + flags.push(`--asset-names=${assetNames}`); + if (mainFields) + flags.push(`--main-fields=${validateAndJoinStringArray(mainFields, "main field")}`); + if (conditions) + flags.push(`--conditions=${validateAndJoinStringArray(conditions, "condition")}`); + if (external) + for (let name of external) + flags.push(`--external:${validateStringValue(name, "external")}`); + if (alias) { + for (let old in alias) { + if (old.indexOf("=") >= 0) + throw new Error(`Invalid package name in alias: ${old}`); + flags.push(`--alias:${old}=${validateStringValue(alias[old], "alias", old)}`); + } + } + if (banner) { + for (let type in banner) { + if (type.indexOf("=") >= 0) + throw new Error(`Invalid banner file type: ${type}`); + flags.push(`--banner:${type}=${validateStringValue(banner[type], "banner", type)}`); + } + } + if (footer) { + for (let type in footer) { + if (type.indexOf("=") >= 0) + throw new Error(`Invalid footer file type: ${type}`); + flags.push(`--footer:${type}=${validateStringValue(footer[type], "footer", type)}`); + } + } + if (inject) + for (let path3 of inject) + flags.push(`--inject:${validateStringValue(path3, "inject")}`); + if (loader) { + for (let ext in loader) { + if (ext.indexOf("=") >= 0) + throw new Error(`Invalid loader extension: ${ext}`); + flags.push(`--loader:${ext}=${validateStringValue(loader[ext], "loader", ext)}`); + } + } + if (outExtension) { + for (let ext in outExtension) { + if (ext.indexOf("=") >= 0) + throw new Error(`Invalid out extension: ${ext}`); + flags.push(`--out-extension:${ext}=${validateStringValue(outExtension[ext], "out extension", ext)}`); + } + } + if (entryPoints) { + if (Array.isArray(entryPoints)) { + for (let i6 = 0, n3 = entryPoints.length; i6 < n3; i6++) { + let entryPoint = entryPoints[i6]; + if (typeof entryPoint === "object" && entryPoint !== null) { + let entryPointKeys = /* @__PURE__ */ Object.create(null); + let input = getFlag(entryPoint, entryPointKeys, "in", mustBeString); + let output = getFlag(entryPoint, entryPointKeys, "out", mustBeString); + checkForInvalidFlags(entryPoint, entryPointKeys, "in entry point at index " + i6); + if (input === void 0) + throw new Error('Missing property "in" for entry point at index ' + i6); + if (output === void 0) + throw new Error('Missing property "out" for entry point at index ' + i6); + entries.push([output, input]); + } else { + entries.push(["", validateStringValue(entryPoint, "entry point at index " + i6)]); + } + } + } else { + for (let key in entryPoints) { + entries.push([key, validateStringValue(entryPoints[key], "entry point", key)]); + } + } + } + if (stdin) { + let stdinKeys = /* @__PURE__ */ Object.create(null); + let contents = getFlag(stdin, stdinKeys, "contents", mustBeStringOrUint8Array); + let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString); + let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString); + let loader2 = getFlag(stdin, stdinKeys, "loader", mustBeString); + checkForInvalidFlags(stdin, stdinKeys, 'in "stdin" object'); + if (sourcefile) + flags.push(`--sourcefile=${sourcefile}`); + if (loader2) + flags.push(`--loader=${loader2}`); + if (resolveDir) + stdinResolveDir = resolveDir; + if (typeof contents === "string") + stdinContents = encodeUTF8(contents); + else if (contents instanceof Uint8Array) + stdinContents = contents; + } + let nodePaths = []; + if (nodePathsInput) { + for (let value of nodePathsInput) { + value += ""; + nodePaths.push(value); + } + } + return { + entries, + flags, + write, + stdinContents, + stdinResolveDir, + absWorkingDir, + nodePaths, + mangleCache: validateMangleCache(mangleCache) + }; + } + function flagsForTransformOptions(callName, options, isTTY2, logLevelDefault) { + let flags = []; + let keys = /* @__PURE__ */ Object.create(null); + pushLogFlags(flags, options, keys, isTTY2, logLevelDefault); + pushCommonFlags(flags, options, keys); + let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean); + let sourcefile = getFlag(options, keys, "sourcefile", mustBeString); + let loader = getFlag(options, keys, "loader", mustBeString); + let banner = getFlag(options, keys, "banner", mustBeString); + let footer = getFlag(options, keys, "footer", mustBeString); + let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject); + checkForInvalidFlags(options, keys, `in ${callName}() call`); + if (sourcemap) + flags.push(`--sourcemap=${sourcemap === true ? "external" : sourcemap}`); + if (sourcefile) + flags.push(`--sourcefile=${sourcefile}`); + if (loader) + flags.push(`--loader=${loader}`); + if (banner) + flags.push(`--banner=${banner}`); + if (footer) + flags.push(`--footer=${footer}`); + return { + flags, + mangleCache: validateMangleCache(mangleCache) + }; + } + function createChannel(streamIn) { + const requestCallbacksByKey = {}; + const closeData = { didClose: false, reason: "" }; + let responseCallbacks = {}; + let nextRequestID = 0; + let nextBuildKey = 0; + let stdout = new Uint8Array(16 * 1024); + let stdoutUsed = 0; + let readFromStdout = (chunk) => { + let limit = stdoutUsed + chunk.length; + if (limit > stdout.length) { + let swap = new Uint8Array(limit * 2); + swap.set(stdout); + stdout = swap; + } + stdout.set(chunk, stdoutUsed); + stdoutUsed += chunk.length; + let offset = 0; + while (offset + 4 <= stdoutUsed) { + let length = readUInt32LE(stdout, offset); + if (offset + 4 + length > stdoutUsed) { + break; + } + offset += 4; + handleIncomingPacket(stdout.subarray(offset, offset + length)); + offset += length; + } + if (offset > 0) { + stdout.copyWithin(0, offset, stdoutUsed); + stdoutUsed -= offset; + } + }; + let afterClose = (error) => { + closeData.didClose = true; + if (error) + closeData.reason = ": " + (error.message || error); + const text = "The service was stopped" + closeData.reason; + for (let id in responseCallbacks) { + responseCallbacks[id](text, null); + } + responseCallbacks = {}; + }; + let sendRequest = (refs, value, callback) => { + if (closeData.didClose) + return callback("The service is no longer running" + closeData.reason, null); + let id = nextRequestID++; + responseCallbacks[id] = (error, response) => { + try { + callback(error, response); + } finally { + if (refs) + refs.unref(); + } + }; + if (refs) + refs.ref(); + streamIn.writeToStdin(encodePacket({ id, isRequest: true, value })); + }; + let sendResponse = (id, value) => { + if (closeData.didClose) + throw new Error("The service is no longer running" + closeData.reason); + streamIn.writeToStdin(encodePacket({ id, isRequest: false, value })); + }; + let handleRequest = async (id, request2) => { + try { + if (request2.command === "ping") { + sendResponse(id, {}); + return; + } + if (typeof request2.key === "number") { + const requestCallbacks = requestCallbacksByKey[request2.key]; + if (!requestCallbacks) { + return; + } + const callback = requestCallbacks[request2.command]; + if (callback) { + await callback(id, request2); + return; + } + } + throw new Error(`Invalid command: ` + request2.command); + } catch (e5) { + const errors = [extractErrorMessageV8(e5, streamIn, null, void 0, "")]; + try { + sendResponse(id, { errors }); + } catch { + } + } + }; + let isFirstPacket = true; + let handleIncomingPacket = (bytes) => { + if (isFirstPacket) { + isFirstPacket = false; + let binaryVersion = String.fromCharCode(...bytes); + if (binaryVersion !== "0.25.9") { + throw new Error(`Cannot start service: Host version "${"0.25.9"}" does not match binary version ${quote(binaryVersion)}`); + } + return; + } + let packet = decodePacket(bytes); + if (packet.isRequest) { + handleRequest(packet.id, packet.value); + } else { + let callback = responseCallbacks[packet.id]; + delete responseCallbacks[packet.id]; + if (packet.value.error) + callback(packet.value.error, {}); + else + callback(null, packet.value); + } + }; + let buildOrContext = ({ callName, refs, options, isTTY: isTTY2, defaultWD: defaultWD2, callback }) => { + let refCount = 0; + const buildKey = nextBuildKey++; + const requestCallbacks = {}; + const buildRefs = { + ref() { + if (++refCount === 1) { + if (refs) + refs.ref(); + } + }, + unref() { + if (--refCount === 0) { + delete requestCallbacksByKey[buildKey]; + if (refs) + refs.unref(); + } + } + }; + requestCallbacksByKey[buildKey] = requestCallbacks; + buildRefs.ref(); + buildOrContextImpl( + callName, + buildKey, + sendRequest, + sendResponse, + buildRefs, + streamIn, + requestCallbacks, + options, + isTTY2, + defaultWD2, + (err, res) => { + try { + callback(err, res); + } finally { + buildRefs.unref(); + } + } + ); + }; + let transform2 = ({ callName, refs, input, options, isTTY: isTTY2, fs: fs3, callback }) => { + const details = createObjectStash(); + let start = (inputPath) => { + try { + if (typeof input !== "string" && !(input instanceof Uint8Array)) + throw new Error('The input to "transform" must be a string or a Uint8Array'); + let { + flags, + mangleCache + } = flagsForTransformOptions(callName, options, isTTY2, transformLogLevelDefault); + let request2 = { + command: "transform", + flags, + inputFS: inputPath !== null, + input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input + }; + if (mangleCache) + request2.mangleCache = mangleCache; + sendRequest(refs, request2, (error, response) => { + if (error) + return callback(new Error(error), null); + let errors = replaceDetailsInMessages(response.errors, details); + let warnings = replaceDetailsInMessages(response.warnings, details); + let outstanding = 1; + let next = () => { + if (--outstanding === 0) { + let result = { + warnings, + code: response.code, + map: response.map, + mangleCache: void 0, + legalComments: void 0 + }; + if ("legalComments" in response) + result.legalComments = response == null ? void 0 : response.legalComments; + if (response.mangleCache) + result.mangleCache = response == null ? void 0 : response.mangleCache; + callback(null, result); } - if (destStat) { - const bothSymlinks = srcStat.isSymbolicLink() && destStat.isSymbolicLink(); - const bothFolders = srcStat.isDirectory() && destStat.isDirectory(); - const bothFiles = srcStat.isFile() && destStat.isFile(); - if (bothFiles && artifactFiles.has(dest)) { - onDone(); - reporter.verbose(reporter.lang("verboseFileSkipArtifact", src)); - return; - } - if (bothFiles && srcStat.size === destStat.size && (0, (_fsNormalized || _load_fsNormalized()).fileDatesEqual)(srcStat.mtime, destStat.mtime)) { - onDone(); - reporter.verbose(reporter.lang("verboseFileSkip", src, dest, srcStat.size, +srcStat.mtime)); - return; + }; + if (errors.length > 0) + return callback(failureErrorWithLog("Transform failed", errors, warnings), null); + if (response.codeFS) { + outstanding++; + fs3.readFile(response.code, (err, contents) => { + if (err !== null) { + callback(err, null); + } else { + response.code = contents; + next(); } - if (bothSymlinks) { - const srcReallink = yield readlink(src); - if (srcReallink === (yield readlink(dest))) { - onDone(); - reporter.verbose(reporter.lang("verboseFileSkipSymlink", src, dest, srcReallink)); - return; - } + }); + } + if (response.mapFS) { + outstanding++; + fs3.readFile(response.map, (err, contents) => { + if (err !== null) { + callback(err, null); + } else { + response.map = contents; + next(); } - if (bothFolders) { - const destFiles = yield readdir(dest); - invariant(srcFiles, "src files not initialised"); - for (var _iterator4 = destFiles, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator](); ; ) { - var _ref6; - if (_isArray4) { - if (_i4 >= _iterator4.length) break; - _ref6 = _iterator4[_i4++]; + }); + } + next(); + }); + } catch (e5) { + let flags = []; + try { + pushLogFlags(flags, options, {}, isTTY2, transformLogLevelDefault); + } catch { + } + const error = extractErrorMessageV8(e5, streamIn, details, void 0, ""); + sendRequest(refs, { command: "error", flags, error }, () => { + error.detail = details.load(error.detail); + callback(failureErrorWithLog("Transform failed", [error], []), null); + }); + } + }; + if ((typeof input === "string" || input instanceof Uint8Array) && input.length > 1024 * 1024) { + let next = start; + start = () => fs3.writeFile(input, next); + } + start(null); + }; + let formatMessages2 = ({ callName, refs, messages, options, callback }) => { + if (!options) + throw new Error(`Missing second argument in ${callName}() call`); + let keys = {}; + let kind = getFlag(options, keys, "kind", mustBeString); + let color = getFlag(options, keys, "color", mustBeBoolean); + let terminalWidth = getFlag(options, keys, "terminalWidth", mustBeInteger); + checkForInvalidFlags(options, keys, `in ${callName}() call`); + if (kind === void 0) + throw new Error(`Missing "kind" in ${callName}() call`); + if (kind !== "error" && kind !== "warning") + throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`); + let request2 = { + command: "format-msgs", + messages: sanitizeMessages(messages, "messages", null, "", terminalWidth), + isWarning: kind === "warning" + }; + if (color !== void 0) + request2.color = color; + if (terminalWidth !== void 0) + request2.terminalWidth = terminalWidth; + sendRequest(refs, request2, (error, response) => { + if (error) + return callback(new Error(error), null); + callback(null, response.messages); + }); + }; + let analyzeMetafile2 = ({ callName, refs, metafile, options, callback }) => { + if (options === void 0) + options = {}; + let keys = {}; + let color = getFlag(options, keys, "color", mustBeBoolean); + let verbose = getFlag(options, keys, "verbose", mustBeBoolean); + checkForInvalidFlags(options, keys, `in ${callName}() call`); + let request2 = { + command: "analyze-metafile", + metafile + }; + if (color !== void 0) + request2.color = color; + if (verbose !== void 0) + request2.verbose = verbose; + sendRequest(refs, request2, (error, response) => { + if (error) + return callback(new Error(error), null); + callback(null, response.result); + }); + }; + return { + readFromStdout, + afterClose, + service: { + buildOrContext, + transform: transform2, + formatMessages: formatMessages2, + analyzeMetafile: analyzeMetafile2 + } + }; + } + function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs, streamIn, requestCallbacks, options, isTTY2, defaultWD2, callback) { + const details = createObjectStash(); + const isContext = callName === "context"; + const handleError = (e5, pluginName) => { + const flags = []; + try { + pushLogFlags(flags, options, {}, isTTY2, buildLogLevelDefault); + } catch { + } + const message = extractErrorMessageV8(e5, streamIn, details, void 0, pluginName); + sendRequest(refs, { command: "error", flags, error: message }, () => { + message.detail = details.load(message.detail); + callback(failureErrorWithLog(isContext ? "Context failed" : "Build failed", [message], []), null); + }); + }; + let plugins; + if (typeof options === "object") { + const value = options.plugins; + if (value !== void 0) { + if (!Array.isArray(value)) + return handleError(new Error(`"plugins" must be an array`), ""); + plugins = value; + } + } + if (plugins && plugins.length > 0) { + if (streamIn.isSync) + return handleError(new Error("Cannot use plugins in synchronous API calls"), ""); + handlePlugins( + buildKey, + sendRequest, + sendResponse, + refs, + streamIn, + requestCallbacks, + options, + plugins, + details + ).then( + (result) => { + if (!result.ok) + return handleError(result.error, result.pluginName); + try { + buildOrContextContinue(result.requestPlugins, result.runOnEndCallbacks, result.scheduleOnDisposeCallbacks); + } catch (e5) { + handleError(e5, ""); + } + }, + (e5) => handleError(e5, "") + ); + return; + } + try { + buildOrContextContinue(null, (result, done) => done([], []), () => { + }); + } catch (e5) { + handleError(e5, ""); + } + function buildOrContextContinue(requestPlugins, runOnEndCallbacks, scheduleOnDisposeCallbacks) { + const writeDefault = streamIn.hasFS; + const { + entries, + flags, + write, + stdinContents, + stdinResolveDir, + absWorkingDir, + nodePaths, + mangleCache + } = flagsForBuildOptions(callName, options, isTTY2, buildLogLevelDefault, writeDefault); + if (write && !streamIn.hasFS) + throw new Error(`The "write" option is unavailable in this environment`); + const request2 = { + command: "build", + key: buildKey, + entries, + flags, + write, + stdinContents, + stdinResolveDir, + absWorkingDir: absWorkingDir || defaultWD2, + nodePaths, + context: isContext + }; + if (requestPlugins) + request2.plugins = requestPlugins; + if (mangleCache) + request2.mangleCache = mangleCache; + const buildResponseToResult = (response, callback2) => { + const result = { + errors: replaceDetailsInMessages(response.errors, details), + warnings: replaceDetailsInMessages(response.warnings, details), + outputFiles: void 0, + metafile: void 0, + mangleCache: void 0 + }; + const originalErrors = result.errors.slice(); + const originalWarnings = result.warnings.slice(); + if (response.outputFiles) + result.outputFiles = response.outputFiles.map(convertOutputFiles); + if (response.metafile) + result.metafile = JSON.parse(response.metafile); + if (response.mangleCache) + result.mangleCache = response.mangleCache; + if (response.writeToStdout !== void 0) + console.log(decodeUTF8(response.writeToStdout).replace(/\n$/, "")); + runOnEndCallbacks(result, (onEndErrors, onEndWarnings) => { + if (originalErrors.length > 0 || onEndErrors.length > 0) { + const error = failureErrorWithLog("Build failed", originalErrors.concat(onEndErrors), originalWarnings.concat(onEndWarnings)); + return callback2(error, null, onEndErrors, onEndWarnings); + } + callback2(null, result, onEndErrors, onEndWarnings); + }); + }; + let latestResultPromise; + let provideLatestResult; + if (isContext) + requestCallbacks["on-end"] = (id, request22) => new Promise((resolve) => { + buildResponseToResult(request22, (err, result, onEndErrors, onEndWarnings) => { + const response = { + errors: onEndErrors, + warnings: onEndWarnings + }; + if (provideLatestResult) + provideLatestResult(err, result); + latestResultPromise = void 0; + provideLatestResult = void 0; + sendResponse(id, response); + resolve(); + }); + }); + sendRequest(refs, request2, (error, response) => { + if (error) + return callback(new Error(error), null); + if (!isContext) { + return buildResponseToResult(response, (err, res) => { + scheduleOnDisposeCallbacks(); + return callback(err, res); + }); + } + if (response.errors.length > 0) { + return callback(failureErrorWithLog("Context failed", response.errors, response.warnings), null); + } + let didDispose = false; + const result = { + rebuild: () => { + if (!latestResultPromise) + latestResultPromise = new Promise((resolve, reject) => { + let settlePromise; + provideLatestResult = (err, result2) => { + if (!settlePromise) + settlePromise = () => err ? reject(err) : resolve(result2); + }; + const triggerAnotherBuild = () => { + const request22 = { + command: "rebuild", + key: buildKey + }; + sendRequest(refs, request22, (error2, response2) => { + if (error2) { + reject(new Error(error2)); + } else if (settlePromise) { + settlePromise(); } else { - _i4 = _iterator4.next(); - if (_i4.done) break; - _ref6 = _i4.value; + triggerAnotherBuild(); } - const file = _ref6; - if (srcFiles.indexOf(file) < 0) { - const loc = (_path || _load_path()).default.join(dest, file); - possibleExtraneous.add(loc); - if ((yield lstat(loc)).isDirectory()) { - for (var _iterator5 = yield readdir(loc), _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator](); ; ) { - var _ref7; - if (_isArray5) { - if (_i5 >= _iterator5.length) break; - _ref7 = _iterator5[_i5++]; - } else { - _i5 = _iterator5.next(); - if (_i5.done) break; - _ref7 = _i5.value; - } - const file2 = _ref7; - possibleExtraneous.add((_path || _load_path()).default.join(loc, file2)); - } - } - } - } - } - } - if (destStat && destStat.isSymbolicLink()) { - yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(dest); - destStat = null; - } - if (srcStat.isSymbolicLink()) { - onFresh(); - const linkname = yield readlink(src); - actions.symlink.push({ - dest, - linkname - }); - onDone(); - } else if (srcStat.isDirectory()) { - if (!destStat) { - reporter.verbose(reporter.lang("verboseFileFolder", dest)); - yield mkdirp(dest); - } - const destParts = dest.split((_path || _load_path()).default.sep); - while (destParts.length) { - files.add(destParts.join((_path || _load_path()).default.sep).toLowerCase()); - destParts.pop(); - } - invariant(srcFiles, "src files not initialised"); - let remaining = srcFiles.length; - if (!remaining) { - onDone(); - } - for (var _iterator6 = srcFiles, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator](); ; ) { - var _ref8; - if (_isArray6) { - if (_i6 >= _iterator6.length) break; - _ref8 = _iterator6[_i6++]; - } else { - _i6 = _iterator6.next(); - if (_i6.done) break; - _ref8 = _i6.value; - } - const file = _ref8; - queue.push({ - dest: (_path || _load_path()).default.join(dest, file), - onFresh, - onDone: function(_onDone) { - function onDone2() { - return _onDone.apply(this, arguments); - } - onDone2.toString = function() { - return _onDone.toString(); - }; - return onDone2; - }(function() { - if (--remaining === 0) { - onDone(); - } - }), - src: (_path || _load_path()).default.join(src, file) }); - } - } else if (srcStat.isFile()) { - onFresh(); - actions.file.push({ - src, - dest, - atime: srcStat.atime, - mtime: srcStat.mtime, - mode: srcStat.mode - }); - onDone(); - } else { - throw new Error(`unsure how to copy this: ${src}`); - } + }; + triggerAnotherBuild(); + }); + return latestResultPromise; + }, + watch: (options2 = {}) => new Promise((resolve, reject) => { + if (!streamIn.hasFS) + throw new Error(`Cannot use the "watch" API in this environment`); + const keys = {}; + const delay = getFlag(options2, keys, "delay", mustBeInteger); + checkForInvalidFlags(options2, keys, `in watch() call`); + const request22 = { + command: "watch", + key: buildKey + }; + if (delay) + request22.delay = delay; + sendRequest(refs, request22, (error2) => { + if (error2) + reject(new Error(error2)); + else + resolve(void 0); }); - return function build2(_x5) { - return _ref5.apply(this, arguments); + }), + serve: (options2 = {}) => new Promise((resolve, reject) => { + if (!streamIn.hasFS) + throw new Error(`Cannot use the "serve" API in this environment`); + const keys = {}; + const port = getFlag(options2, keys, "port", mustBeValidPortNumber); + const host = getFlag(options2, keys, "host", mustBeString); + const servedir = getFlag(options2, keys, "servedir", mustBeString); + const keyfile = getFlag(options2, keys, "keyfile", mustBeString); + const certfile = getFlag(options2, keys, "certfile", mustBeString); + const fallback = getFlag(options2, keys, "fallback", mustBeString); + const cors = getFlag(options2, keys, "cors", mustBeObject); + const onRequest = getFlag(options2, keys, "onRequest", mustBeFunction); + checkForInvalidFlags(options2, keys, `in serve() call`); + const request22 = { + command: "serve", + key: buildKey, + onRequest: !!onRequest }; - })(); - const artifactFiles = new Set(events.artifactFiles || []); - const files = /* @__PURE__ */ new Set(); - for (var _iterator = queue, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ; ) { - var _ref2; - if (_isArray) { - if (_i >= _iterator.length) break; - _ref2 = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref2 = _i.value; + if (port !== void 0) + request22.port = port; + if (host !== void 0) + request22.host = host; + if (servedir !== void 0) + request22.servedir = servedir; + if (keyfile !== void 0) + request22.keyfile = keyfile; + if (certfile !== void 0) + request22.certfile = certfile; + if (fallback !== void 0) + request22.fallback = fallback; + if (cors) { + const corsKeys = {}; + const origin = getFlag(cors, corsKeys, "origin", mustBeStringOrArrayOfStrings); + checkForInvalidFlags(cors, corsKeys, `on "cors" object`); + if (Array.isArray(origin)) + request22.corsOrigin = origin; + else if (origin !== void 0) + request22.corsOrigin = [origin]; } - const item = _ref2; - const onDone = item.onDone; - item.onDone = function() { - events.onProgress(item.dest); - if (onDone) { - onDone(); + sendRequest(refs, request22, (error2, response2) => { + if (error2) + return reject(new Error(error2)); + if (onRequest) { + requestCallbacks["serve-request"] = (id, request3) => { + onRequest(request3.args); + sendResponse(id, {}); + }; } + resolve(response2); + }); + }), + cancel: () => new Promise((resolve) => { + if (didDispose) + return resolve(); + const request22 = { + command: "cancel", + key: buildKey + }; + sendRequest(refs, request22, () => { + resolve(); + }); + }), + dispose: () => new Promise((resolve) => { + if (didDispose) + return resolve(); + didDispose = true; + const request22 = { + command: "dispose", + key: buildKey + }; + sendRequest(refs, request22, () => { + resolve(); + scheduleOnDisposeCallbacks(); + refs.unref(); + }); + }) + }; + refs.ref(); + callback(null, result); + }); + } + } + var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn, requestCallbacks, initialOptions, plugins, details) => { + let onStartCallbacks = []; + let onEndCallbacks = []; + let onResolveCallbacks = {}; + let onLoadCallbacks = {}; + let onDisposeCallbacks = []; + let nextCallbackID = 0; + let i6 = 0; + let requestPlugins = []; + let isSetupDone = false; + plugins = [...plugins]; + for (let item of plugins) { + let keys = {}; + if (typeof item !== "object") + throw new Error(`Plugin at index ${i6} must be an object`); + const name = getFlag(item, keys, "name", mustBeString); + if (typeof name !== "string" || name === "") + throw new Error(`Plugin at index ${i6} is missing a name`); + try { + let setup = getFlag(item, keys, "setup", mustBeFunction); + if (typeof setup !== "function") + throw new Error(`Plugin is missing a setup function`); + checkForInvalidFlags(item, keys, `on plugin ${quote(name)}`); + let plugin = { + name, + onStart: false, + onEnd: false, + onResolve: [], + onLoad: [] + }; + i6++; + let resolve = (path3, options = {}) => { + if (!isSetupDone) + throw new Error('Cannot call "resolve" before plugin setup has completed'); + if (typeof path3 !== "string") + throw new Error(`The path to resolve must be a string`); + let keys2 = /* @__PURE__ */ Object.create(null); + let pluginName = getFlag(options, keys2, "pluginName", mustBeString); + let importer = getFlag(options, keys2, "importer", mustBeString); + let namespace = getFlag(options, keys2, "namespace", mustBeString); + let resolveDir = getFlag(options, keys2, "resolveDir", mustBeString); + let kind = getFlag(options, keys2, "kind", mustBeString); + let pluginData = getFlag(options, keys2, "pluginData", canBeAnything); + let importAttributes = getFlag(options, keys2, "with", mustBeObject); + checkForInvalidFlags(options, keys2, "in resolve() call"); + return new Promise((resolve2, reject) => { + const request2 = { + command: "resolve", + path: path3, + key: buildKey, + pluginName: name }; + if (pluginName != null) + request2.pluginName = pluginName; + if (importer != null) + request2.importer = importer; + if (namespace != null) + request2.namespace = namespace; + if (resolveDir != null) + request2.resolveDir = resolveDir; + if (kind != null) + request2.kind = kind; + else + throw new Error(`Must specify "kind" when calling "resolve"`); + if (pluginData != null) + request2.pluginData = details.store(pluginData); + if (importAttributes != null) + request2.with = sanitizeStringMap(importAttributes, "with"); + sendRequest(refs, request2, (error, response) => { + if (error !== null) + reject(new Error(error)); + else + resolve2({ + errors: replaceDetailsInMessages(response.errors, details), + warnings: replaceDetailsInMessages(response.warnings, details), + path: response.path, + external: response.external, + sideEffects: response.sideEffects, + namespace: response.namespace, + suffix: response.suffix, + pluginData: details.load(response.pluginData) + }); + }); + }); + }; + let promise = setup({ + initialOptions, + resolve, + onStart(callback) { + let registeredText = `This error came from the "onStart" callback registered here:`; + let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart"); + onStartCallbacks.push({ name, callback, note: registeredNote }); + plugin.onStart = true; + }, + onEnd(callback) { + let registeredText = `This error came from the "onEnd" callback registered here:`; + let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onEnd"); + onEndCallbacks.push({ name, callback, note: registeredNote }); + plugin.onEnd = true; + }, + onResolve(options, callback) { + let registeredText = `This error came from the "onResolve" callback registered here:`; + let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onResolve"); + let keys2 = {}; + let filter = getFlag(options, keys2, "filter", mustBeRegExp); + let namespace = getFlag(options, keys2, "namespace", mustBeString); + checkForInvalidFlags(options, keys2, `in onResolve() call for plugin ${quote(name)}`); + if (filter == null) + throw new Error(`onResolve() call is missing a filter`); + let id = nextCallbackID++; + onResolveCallbacks[id] = { name, callback, note: registeredNote }; + plugin.onResolve.push({ id, filter: jsRegExpToGoRegExp(filter), namespace: namespace || "" }); + }, + onLoad(options, callback) { + let registeredText = `This error came from the "onLoad" callback registered here:`; + let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onLoad"); + let keys2 = {}; + let filter = getFlag(options, keys2, "filter", mustBeRegExp); + let namespace = getFlag(options, keys2, "namespace", mustBeString); + checkForInvalidFlags(options, keys2, `in onLoad() call for plugin ${quote(name)}`); + if (filter == null) + throw new Error(`onLoad() call is missing a filter`); + let id = nextCallbackID++; + onLoadCallbacks[id] = { name, callback, note: registeredNote }; + plugin.onLoad.push({ id, filter: jsRegExpToGoRegExp(filter), namespace: namespace || "" }); + }, + onDispose(callback) { + onDisposeCallbacks.push(callback); + }, + esbuild: streamIn.esbuild + }); + if (promise) + await promise; + requestPlugins.push(plugin); + } catch (e5) { + return { ok: false, error: e5, pluginName: name }; + } + } + requestCallbacks["on-start"] = async (id, request2) => { + details.clear(); + let response = { errors: [], warnings: [] }; + await Promise.all(onStartCallbacks.map(async ({ name, callback, note }) => { + try { + let result = await callback(); + if (result != null) { + if (typeof result !== "object") + throw new Error(`Expected onStart() callback in plugin ${quote(name)} to return an object`); + let keys = {}; + let errors = getFlag(result, keys, "errors", mustBeArray); + let warnings = getFlag(result, keys, "warnings", mustBeArray); + checkForInvalidFlags(result, keys, `from onStart() callback in plugin ${quote(name)}`); + if (errors != null) + response.errors.push(...sanitizeMessages(errors, "errors", details, name, void 0)); + if (warnings != null) + response.warnings.push(...sanitizeMessages(warnings, "warnings", details, name, void 0)); + } + } catch (e5) { + response.errors.push(extractErrorMessageV8(e5, streamIn, details, note && note(), name)); + } + })); + sendResponse(id, response); + }; + requestCallbacks["on-resolve"] = async (id, request2) => { + let response = {}, name = "", callback, note; + for (let id2 of request2.ids) { + try { + ({ name, callback, note } = onResolveCallbacks[id2]); + let result = await callback({ + path: request2.path, + importer: request2.importer, + namespace: request2.namespace, + resolveDir: request2.resolveDir, + kind: request2.kind, + pluginData: details.load(request2.pluginData), + with: request2.with + }); + if (result != null) { + if (typeof result !== "object") + throw new Error(`Expected onResolve() callback in plugin ${quote(name)} to return an object`); + let keys = {}; + let pluginName = getFlag(result, keys, "pluginName", mustBeString); + let path3 = getFlag(result, keys, "path", mustBeString); + let namespace = getFlag(result, keys, "namespace", mustBeString); + let suffix = getFlag(result, keys, "suffix", mustBeString); + let external = getFlag(result, keys, "external", mustBeBoolean); + let sideEffects = getFlag(result, keys, "sideEffects", mustBeBoolean); + let pluginData = getFlag(result, keys, "pluginData", canBeAnything); + let errors = getFlag(result, keys, "errors", mustBeArray); + let warnings = getFlag(result, keys, "warnings", mustBeArray); + let watchFiles = getFlag(result, keys, "watchFiles", mustBeArrayOfStrings); + let watchDirs = getFlag(result, keys, "watchDirs", mustBeArrayOfStrings); + checkForInvalidFlags(result, keys, `from onResolve() callback in plugin ${quote(name)}`); + response.id = id2; + if (pluginName != null) + response.pluginName = pluginName; + if (path3 != null) + response.path = path3; + if (namespace != null) + response.namespace = namespace; + if (suffix != null) + response.suffix = suffix; + if (external != null) + response.external = external; + if (sideEffects != null) + response.sideEffects = sideEffects; + if (pluginData != null) + response.pluginData = details.store(pluginData); + if (errors != null) + response.errors = sanitizeMessages(errors, "errors", details, name, void 0); + if (warnings != null) + response.warnings = sanitizeMessages(warnings, "warnings", details, name, void 0); + if (watchFiles != null) + response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles"); + if (watchDirs != null) + response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs"); + break; } - events.onStart(queue.length); - const actions = { - file: [], - symlink: [], - link: [] - }; - while (queue.length) { - const items = queue.splice(0, CONCURRENT_QUEUE_ITEMS); - yield Promise.all(items.map(build)); + } catch (e5) { + response = { id: id2, errors: [extractErrorMessageV8(e5, streamIn, details, note && note(), name)] }; + break; + } + } + sendResponse(id, response); + }; + requestCallbacks["on-load"] = async (id, request2) => { + let response = {}, name = "", callback, note; + for (let id2 of request2.ids) { + try { + ({ name, callback, note } = onLoadCallbacks[id2]); + let result = await callback({ + path: request2.path, + namespace: request2.namespace, + suffix: request2.suffix, + pluginData: details.load(request2.pluginData), + with: request2.with + }); + if (result != null) { + if (typeof result !== "object") + throw new Error(`Expected onLoad() callback in plugin ${quote(name)} to return an object`); + let keys = {}; + let pluginName = getFlag(result, keys, "pluginName", mustBeString); + let contents = getFlag(result, keys, "contents", mustBeStringOrUint8Array); + let resolveDir = getFlag(result, keys, "resolveDir", mustBeString); + let pluginData = getFlag(result, keys, "pluginData", canBeAnything); + let loader = getFlag(result, keys, "loader", mustBeString); + let errors = getFlag(result, keys, "errors", mustBeArray); + let warnings = getFlag(result, keys, "warnings", mustBeArray); + let watchFiles = getFlag(result, keys, "watchFiles", mustBeArrayOfStrings); + let watchDirs = getFlag(result, keys, "watchDirs", mustBeArrayOfStrings); + checkForInvalidFlags(result, keys, `from onLoad() callback in plugin ${quote(name)}`); + response.id = id2; + if (pluginName != null) + response.pluginName = pluginName; + if (contents instanceof Uint8Array) + response.contents = contents; + else if (contents != null) + response.contents = encodeUTF8(contents); + if (resolveDir != null) + response.resolveDir = resolveDir; + if (pluginData != null) + response.pluginData = details.store(pluginData); + if (loader != null) + response.loader = loader; + if (errors != null) + response.errors = sanitizeMessages(errors, "errors", details, name, void 0); + if (warnings != null) + response.warnings = sanitizeMessages(warnings, "warnings", details, name, void 0); + if (watchFiles != null) + response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles"); + if (watchDirs != null) + response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs"); + break; } - for (var _iterator2 = artifactFiles, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ; ) { - var _ref3; - if (_isArray2) { - if (_i2 >= _iterator2.length) break; - _ref3 = _iterator2[_i2++]; - } else { - _i2 = _iterator2.next(); - if (_i2.done) break; - _ref3 = _i2.value; + } catch (e5) { + response = { id: id2, errors: [extractErrorMessageV8(e5, streamIn, details, note && note(), name)] }; + break; + } + } + sendResponse(id, response); + }; + let runOnEndCallbacks = (result, done) => done([], []); + if (onEndCallbacks.length > 0) { + runOnEndCallbacks = (result, done) => { + (async () => { + const onEndErrors = []; + const onEndWarnings = []; + for (const { name, callback, note } of onEndCallbacks) { + let newErrors; + let newWarnings; + try { + const value = await callback(result); + if (value != null) { + if (typeof value !== "object") + throw new Error(`Expected onEnd() callback in plugin ${quote(name)} to return an object`); + let keys = {}; + let errors = getFlag(value, keys, "errors", mustBeArray); + let warnings = getFlag(value, keys, "warnings", mustBeArray); + checkForInvalidFlags(value, keys, `from onEnd() callback in plugin ${quote(name)}`); + if (errors != null) + newErrors = sanitizeMessages(errors, "errors", details, name, void 0); + if (warnings != null) + newWarnings = sanitizeMessages(warnings, "warnings", details, name, void 0); + } + } catch (e5) { + newErrors = [extractErrorMessageV8(e5, streamIn, details, note && note(), name)]; } - const file = _ref3; - if (possibleExtraneous.has(file)) { - reporter.verbose(reporter.lang("verboseFilePhantomExtraneous", file)); - possibleExtraneous.delete(file); + if (newErrors) { + onEndErrors.push(...newErrors); + try { + result.errors.push(...newErrors); + } catch { + } } - } - for (var _iterator3 = possibleExtraneous, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator](); ; ) { - var _ref4; - if (_isArray3) { - if (_i3 >= _iterator3.length) break; - _ref4 = _iterator3[_i3++]; - } else { - _i3 = _iterator3.next(); - if (_i3.done) break; - _ref4 = _i3.value; + if (newWarnings) { + onEndWarnings.push(...newWarnings); + try { + result.warnings.push(...newWarnings); + } catch { + } } - const loc = _ref4; - if (files.has(loc.toLowerCase())) { - possibleExtraneous.delete(loc); + } + done(onEndErrors, onEndWarnings); + })(); + }; + } + let scheduleOnDisposeCallbacks = () => { + for (const cb of onDisposeCallbacks) { + setTimeout(() => cb(), 0); + } + }; + isSetupDone = true; + return { + ok: true, + requestPlugins, + runOnEndCallbacks, + scheduleOnDisposeCallbacks + }; + }; + function createObjectStash() { + const map = /* @__PURE__ */ new Map(); + let nextID = 0; + return { + clear() { + map.clear(); + }, + load(id) { + return map.get(id); + }, + store(value) { + if (value === void 0) + return -1; + const id = nextID++; + map.set(id, value); + return id; + } + }; + } + function extractCallerV8(e5, streamIn, ident) { + let note; + let tried = false; + return () => { + if (tried) + return note; + tried = true; + try { + let lines = (e5.stack + "").split("\n"); + lines.splice(1, 1); + let location = parseStackLinesV8(streamIn, lines, ident); + if (location) { + note = { text: e5.message, location }; + return note; + } + } catch { + } + }; + } + function extractErrorMessageV8(e5, streamIn, stash, note, pluginName) { + let text = "Internal error"; + let location = null; + try { + text = (e5 && e5.message || e5) + ""; + } catch { + } + try { + location = parseStackLinesV8(streamIn, (e5.stack + "").split("\n"), ""); + } catch { + } + return { id: "", pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e5) : -1 }; + } + function parseStackLinesV8(streamIn, lines, ident) { + let at2 = " at "; + if (streamIn.readFileSync && !lines[0].startsWith(at2) && lines[1].startsWith(at2)) { + for (let i6 = 1; i6 < lines.length; i6++) { + let line = lines[i6]; + if (!line.startsWith(at2)) + continue; + line = line.slice(at2.length); + while (true) { + let match = /^(?:new |async )?\S+ \((.*)\)$/.exec(line); + if (match) { + line = match[1]; + continue; + } + match = /^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(line); + if (match) { + line = match[1]; + continue; + } + match = /^(\S+):(\d+):(\d+)$/.exec(line); + if (match) { + let contents; + try { + contents = streamIn.readFileSync(match[1], "utf8"); + } catch { + break; } + let lineText = contents.split(/\r\n|\r|\n|\u2028|\u2029/)[+match[2] - 1] || ""; + let column = +match[3] - 1; + let length = lineText.slice(column, column + ident.length) === ident ? ident.length : 0; + return { + file: match[1], + namespace: "file", + line: +match[2], + column: encodeUTF8(lineText.slice(0, column)).length, + length: encodeUTF8(lineText.slice(column, column + length)).length, + lineText: lineText + "\n" + lines.slice(1).join("\n"), + suggestion: "" + }; } - return actions; - }); - return function buildActionsForCopy2(_x, _x2, _x3, _x4) { - return _ref.apply(this, arguments); - }; - })(); - let buildActionsForHardlink = (() => { - var _ref9 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, events, possibleExtraneous, reporter) { - let build = (() => { - var _ref13 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) { - const src = data.src, dest = data.dest; - const onFresh = data.onFresh || noop2; - const onDone = data.onDone || noop2; - if (files.has(dest.toLowerCase())) { - onDone(); - return; - } - files.add(dest.toLowerCase()); - if (events.ignoreBasenames.indexOf((_path || _load_path()).default.basename(src)) >= 0) { - return; - } - const srcStat = yield lstat(src); - let srcFiles; - if (srcStat.isDirectory()) { - srcFiles = yield readdir(src); - } - const destExists = yield exists(dest); - if (destExists) { - const destStat = yield lstat(dest); - const bothSymlinks = srcStat.isSymbolicLink() && destStat.isSymbolicLink(); - const bothFolders = srcStat.isDirectory() && destStat.isDirectory(); - const bothFiles = srcStat.isFile() && destStat.isFile(); - if (srcStat.mode !== destStat.mode) { - try { - yield access(dest, srcStat.mode); + break; + } + } + } + return null; + } + function failureErrorWithLog(text, errors, warnings) { + let limit = 5; + text += errors.length < 1 ? "" : ` with ${errors.length} error${errors.length < 2 ? "" : "s"}:` + errors.slice(0, limit + 1).map((e5, i6) => { + if (i6 === limit) + return "\n..."; + if (!e5.location) + return ` +error: ${e5.text}`; + let { file, line, column } = e5.location; + let pluginText = e5.pluginName ? `[plugin: ${e5.pluginName}] ` : ""; + return ` +${file}:${line}:${column}: ERROR: ${pluginText}${e5.text}`; + }).join(""); + let error = new Error(text); + for (const [key, value] of [["errors", errors], ["warnings", warnings]]) { + Object.defineProperty(error, key, { + configurable: true, + enumerable: true, + get: () => value, + set: (value2) => Object.defineProperty(error, key, { + configurable: true, + enumerable: true, + value: value2 + }) + }); + } + return error; + } + function replaceDetailsInMessages(messages, stash) { + for (const message of messages) { + message.detail = stash.load(message.detail); + } + return messages; + } + function sanitizeLocation(location, where, terminalWidth) { + if (location == null) + return null; + let keys = {}; + let file = getFlag(location, keys, "file", mustBeString); + let namespace = getFlag(location, keys, "namespace", mustBeString); + let line = getFlag(location, keys, "line", mustBeInteger); + let column = getFlag(location, keys, "column", mustBeInteger); + let length = getFlag(location, keys, "length", mustBeInteger); + let lineText = getFlag(location, keys, "lineText", mustBeString); + let suggestion = getFlag(location, keys, "suggestion", mustBeString); + checkForInvalidFlags(location, keys, where); + if (lineText) { + const relevantASCII = lineText.slice( + 0, + (column && column > 0 ? column : 0) + (length && length > 0 ? length : 0) + (terminalWidth && terminalWidth > 0 ? terminalWidth : 80) + ); + if (!/[\x7F-\uFFFF]/.test(relevantASCII) && !/\n/.test(lineText)) { + lineText = relevantASCII; + } + } + return { + file: file || "", + namespace: namespace || "", + line: line || 0, + column: column || 0, + length: length || 0, + lineText: lineText || "", + suggestion: suggestion || "" + }; + } + function sanitizeMessages(messages, property, stash, fallbackPluginName, terminalWidth) { + let messagesClone = []; + let index = 0; + for (const message of messages) { + let keys = {}; + let id = getFlag(message, keys, "id", mustBeString); + let pluginName = getFlag(message, keys, "pluginName", mustBeString); + let text = getFlag(message, keys, "text", mustBeString); + let location = getFlag(message, keys, "location", mustBeObjectOrNull); + let notes = getFlag(message, keys, "notes", mustBeArray); + let detail = getFlag(message, keys, "detail", canBeAnything); + let where = `in element ${index} of "${property}"`; + checkForInvalidFlags(message, keys, where); + let notesClone = []; + if (notes) { + for (const note of notes) { + let noteKeys = {}; + let noteText = getFlag(note, noteKeys, "text", mustBeString); + let noteLocation = getFlag(note, noteKeys, "location", mustBeObjectOrNull); + checkForInvalidFlags(note, noteKeys, where); + notesClone.push({ + text: noteText || "", + location: sanitizeLocation(noteLocation, where, terminalWidth) + }); + } + } + messagesClone.push({ + id: id || "", + pluginName: pluginName || fallbackPluginName, + text: text || "", + location: sanitizeLocation(location, where, terminalWidth), + notes: notesClone, + detail: stash ? stash.store(detail) : -1 + }); + index++; + } + return messagesClone; + } + function sanitizeStringArray(values, property) { + const result = []; + for (const value of values) { + if (typeof value !== "string") + throw new Error(`${quote(property)} must be an array of strings`); + result.push(value); + } + return result; + } + function sanitizeStringMap(map, property) { + const result = /* @__PURE__ */ Object.create(null); + for (const key in map) { + const value = map[key]; + if (typeof value !== "string") + throw new Error(`key ${quote(key)} in object ${quote(property)} must be a string`); + result[key] = value; + } + return result; + } + function convertOutputFiles({ path: path3, contents, hash }) { + let text = null; + return { + path: path3, + contents, + hash, + get text() { + const binary = this.contents; + if (text === null || binary !== contents) { + contents = binary; + text = decodeUTF8(binary); + } + return text; + } + }; + } + function jsRegExpToGoRegExp(regexp) { + let result = regexp.source; + if (regexp.flags) + result = `(?${regexp.flags})${result}`; + return result; + } + var fs = __require("fs"); + var os3 = __require("os"); + var path = __require("path"); + var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH; + var isValidBinaryPath = (x2) => !!x2 && x2 !== "/usr/bin/esbuild"; + var packageDarwin_arm64 = "@esbuild/darwin-arm64"; + var packageDarwin_x64 = "@esbuild/darwin-x64"; + var knownWindowsPackages = { + "win32 arm64 LE": "@esbuild/win32-arm64", + "win32 ia32 LE": "@esbuild/win32-ia32", + "win32 x64 LE": "@esbuild/win32-x64" + }; + var knownUnixlikePackages = { + "aix ppc64 BE": "@esbuild/aix-ppc64", + "android arm64 LE": "@esbuild/android-arm64", + "darwin arm64 LE": "@esbuild/darwin-arm64", + "darwin x64 LE": "@esbuild/darwin-x64", + "freebsd arm64 LE": "@esbuild/freebsd-arm64", + "freebsd x64 LE": "@esbuild/freebsd-x64", + "linux arm LE": "@esbuild/linux-arm", + "linux arm64 LE": "@esbuild/linux-arm64", + "linux ia32 LE": "@esbuild/linux-ia32", + "linux mips64el LE": "@esbuild/linux-mips64el", + "linux ppc64 LE": "@esbuild/linux-ppc64", + "linux riscv64 LE": "@esbuild/linux-riscv64", + "linux s390x BE": "@esbuild/linux-s390x", + "linux x64 LE": "@esbuild/linux-x64", + "linux loong64 LE": "@esbuild/linux-loong64", + "netbsd arm64 LE": "@esbuild/netbsd-arm64", + "netbsd x64 LE": "@esbuild/netbsd-x64", + "openbsd arm64 LE": "@esbuild/openbsd-arm64", + "openbsd x64 LE": "@esbuild/openbsd-x64", + "sunos x64 LE": "@esbuild/sunos-x64" + }; + var knownWebAssemblyFallbackPackages = { + "android arm LE": "@esbuild/android-arm", + "android x64 LE": "@esbuild/android-x64", + "openharmony arm64 LE": "@esbuild/openharmony-arm64" + }; + function pkgAndSubpathForCurrentPlatform() { + let pkg; + let subpath; + let isWASM = false; + let platformKey = `${process.platform} ${os3.arch()} ${os3.endianness()}`; + if (platformKey in knownWindowsPackages) { + pkg = knownWindowsPackages[platformKey]; + subpath = "esbuild.exe"; + } else if (platformKey in knownUnixlikePackages) { + pkg = knownUnixlikePackages[platformKey]; + subpath = "bin/esbuild"; + } else if (platformKey in knownWebAssemblyFallbackPackages) { + pkg = knownWebAssemblyFallbackPackages[platformKey]; + subpath = "bin/esbuild"; + isWASM = true; + } else { + throw new Error(`Unsupported platform: ${platformKey}`); + } + return { pkg, subpath, isWASM }; + } + function pkgForSomeOtherPlatform() { + const libMainJS = __require.resolve("esbuild"); + const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS))); + if (path.basename(nodeModulesDirectory) === "node_modules") { + for (const unixKey in knownUnixlikePackages) { + try { + const pkg = knownUnixlikePackages[unixKey]; + if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) + return pkg; + } catch { + } + } + for (const windowsKey in knownWindowsPackages) { + try { + const pkg = knownWindowsPackages[windowsKey]; + if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) + return pkg; + } catch { + } + } + } + return null; + } + function downloadedBinPath(pkg, subpath) { + const esbuildLibDir = path.dirname(__require.resolve("esbuild")); + return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`); + } + function generateBinPath() { + if (isValidBinaryPath(ESBUILD_BINARY_PATH)) { + if (!fs.existsSync(ESBUILD_BINARY_PATH)) { + console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`); + } else { + return { binPath: ESBUILD_BINARY_PATH, isWASM: false }; + } + } + const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform(); + let binPath; + try { + binPath = __require.resolve(`${pkg}/${subpath}`); + } catch (e5) { + binPath = downloadedBinPath(pkg, subpath); + if (!fs.existsSync(binPath)) { + try { + __require.resolve(pkg); + } catch { + const otherPkg = pkgForSomeOtherPlatform(); + if (otherPkg) { + let suggestions = ` +Specifically the "${otherPkg}" package is present but this platform +needs the "${pkg}" package instead. People often get into this +situation by installing esbuild on Windows or macOS and copying "node_modules" +into a Docker image that runs Linux, or by copying "node_modules" between +Windows and WSL environments. + +If you are installing with npm, you can try not copying the "node_modules" +directory when you copy the files over, and running "npm ci" or "npm install" +on the destination platform after the copy. Or you could consider using yarn +instead of npm which has built-in support for installing a package on multiple +platforms simultaneously. + +If you are installing with yarn, you can try listing both this platform and the +other platform in your ".yarnrc.yml" file using the "supportedArchitectures" +feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures +Keep in mind that this means multiple copies of esbuild will be present. +`; + if (pkg === packageDarwin_x64 && otherPkg === packageDarwin_arm64 || pkg === packageDarwin_arm64 && otherPkg === packageDarwin_x64) { + suggestions = ` +Specifically the "${otherPkg}" package is present but this platform +needs the "${pkg}" package instead. People often get into this +situation by installing esbuild with npm running inside of Rosetta 2 and then +trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta +2 is Apple's on-the-fly x86_64-to-arm64 translation service). + +If you are installing with npm, you can try ensuring that both npm and node are +not running under Rosetta 2 and then reinstalling esbuild. This likely involves +changing how you installed npm and/or node. For example, installing node with +the universal installer here should work: https://nodejs.org/en/download/. Or +you could consider using yarn instead of npm which has built-in support for +installing a package on multiple platforms simultaneously. + +If you are installing with yarn, you can try listing both "arm64" and "x64" +in your ".yarnrc.yml" file using the "supportedArchitectures" feature: +https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures +Keep in mind that this means multiple copies of esbuild will be present. +`; + } + throw new Error(` +You installed esbuild for another platform than the one you're currently using. +This won't work because esbuild is written with native code and needs to +install a platform-specific binary executable. +${suggestions} +Another alternative is to use the "esbuild-wasm" package instead, which works +the same way on all platforms. But it comes with a heavy performance cost and +can sometimes be 10x slower than the "esbuild" package, so you may also not +want to do that. +`); + } + throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild. + +If you are installing esbuild with npm, make sure that you don't specify the +"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature +of "package.json" is used by esbuild to install the correct binary executable +for your current platform.`); + } + throw e5; + } + } + if (/\.zip\//.test(binPath)) { + let pnpapi; + try { + pnpapi = __require("pnpapi"); + } catch (e5) { + } + if (pnpapi) { + const root = pnpapi.getPackageInformation(pnpapi.topLevel).packageLocation; + const binTargetPath = path.join( + root, + "node_modules", + ".cache", + "esbuild", + `pnpapi-${pkg.replace("/", "-")}-${"0.25.9"}-${path.basename(subpath)}` + ); + if (!fs.existsSync(binTargetPath)) { + fs.mkdirSync(path.dirname(binTargetPath), { recursive: true }); + fs.copyFileSync(binPath, binTargetPath); + fs.chmodSync(binTargetPath, 493); + } + return { binPath: binTargetPath, isWASM }; + } + } + return { binPath, isWASM }; + } + var child_process = __require("child_process"); + var crypto = __require("crypto"); + var path2 = __require("path"); + var fs2 = __require("fs"); + var os22 = __require("os"); + var tty3 = __require("tty"); + var worker_threads; + if (process.env.ESBUILD_WORKER_THREADS !== "0") { + try { + worker_threads = __require("worker_threads"); + } catch { + } + let [major, minor] = process.versions.node.split("."); + if ( + // { + if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) { + throw new Error( + `The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle. + +More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.` + ); + } + if (false) { + return ["node", [path2.join(__dirname, "..", "bin", "esbuild")]]; + } else { + const { binPath, isWASM } = generateBinPath(); + if (isWASM) { + return ["node", [binPath]]; + } else { + return [binPath, []]; + } + } + }; + var isTTY = () => tty3.isatty(2); + var fsSync = { + readFile(tempFile, callback) { + try { + let contents = fs2.readFileSync(tempFile, "utf8"); + try { + fs2.unlinkSync(tempFile); + } catch { + } + callback(null, contents); + } catch (err) { + callback(err, null); + } + }, + writeFile(contents, callback) { + try { + let tempFile = randomFileName(); + fs2.writeFileSync(tempFile, contents); + callback(tempFile); + } catch { + callback(null); + } + } + }; + var fsAsync = { + readFile(tempFile, callback) { + try { + fs2.readFile(tempFile, "utf8", (err, contents) => { + try { + fs2.unlink(tempFile, () => callback(err, contents)); + } catch { + callback(err, contents); + } + }); + } catch (err) { + callback(err, null); + } + }, + writeFile(contents, callback) { + try { + let tempFile = randomFileName(); + fs2.writeFile(tempFile, contents, (err) => err !== null ? callback(null) : callback(tempFile)); + } catch { + callback(null); + } + } + }; + var version = "0.25.9"; + var build = (options) => ensureServiceIsRunning().build(options); + var context2 = (buildOptions) => ensureServiceIsRunning().context(buildOptions); + var transform = (input, options) => ensureServiceIsRunning().transform(input, options); + var formatMessages = (messages, options) => ensureServiceIsRunning().formatMessages(messages, options); + var analyzeMetafile = (messages, options) => ensureServiceIsRunning().analyzeMetafile(messages, options); + var buildSync = (options) => { + if (worker_threads && !isInternalWorkerThread) { + if (!workerThreadService) + workerThreadService = startWorkerThreadService(worker_threads); + return workerThreadService.buildSync(options); + } + let result; + runServiceSync((service) => service.buildOrContext({ + callName: "buildSync", + refs: null, + options, + isTTY: isTTY(), + defaultWD, + callback: (err, res) => { + if (err) + throw err; + result = res; + } + })); + return result; + }; + var transformSync = (input, options) => { + if (worker_threads && !isInternalWorkerThread) { + if (!workerThreadService) + workerThreadService = startWorkerThreadService(worker_threads); + return workerThreadService.transformSync(input, options); + } + let result; + runServiceSync((service) => service.transform({ + callName: "transformSync", + refs: null, + input, + options: options || {}, + isTTY: isTTY(), + fs: fsSync, + callback: (err, res) => { + if (err) + throw err; + result = res; + } + })); + return result; + }; + var formatMessagesSync = (messages, options) => { + if (worker_threads && !isInternalWorkerThread) { + if (!workerThreadService) + workerThreadService = startWorkerThreadService(worker_threads); + return workerThreadService.formatMessagesSync(messages, options); + } + let result; + runServiceSync((service) => service.formatMessages({ + callName: "formatMessagesSync", + refs: null, + messages, + options, + callback: (err, res) => { + if (err) + throw err; + result = res; + } + })); + return result; + }; + var analyzeMetafileSync = (metafile, options) => { + if (worker_threads && !isInternalWorkerThread) { + if (!workerThreadService) + workerThreadService = startWorkerThreadService(worker_threads); + return workerThreadService.analyzeMetafileSync(metafile, options); + } + let result; + runServiceSync((service) => service.analyzeMetafile({ + callName: "analyzeMetafileSync", + refs: null, + metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile), + options, + callback: (err, res) => { + if (err) + throw err; + result = res; + } + })); + return result; + }; + var stop = () => { + if (stopService) + stopService(); + if (workerThreadService) + workerThreadService.stop(); + return Promise.resolve(); + }; + var initializeWasCalled = false; + var initialize = (options) => { + options = validateInitializeOptions(options || {}); + if (options.wasmURL) + throw new Error(`The "wasmURL" option only works in the browser`); + if (options.wasmModule) + throw new Error(`The "wasmModule" option only works in the browser`); + if (options.worker) + throw new Error(`The "worker" option only works in the browser`); + if (initializeWasCalled) + throw new Error('Cannot call "initialize" more than once'); + ensureServiceIsRunning(); + initializeWasCalled = true; + return Promise.resolve(); + }; + var defaultWD = process.cwd(); + var longLivedService; + var stopService; + var ensureServiceIsRunning = () => { + if (longLivedService) + return longLivedService; + let [command, args] = esbuildCommandAndArgs(); + let child = child_process.spawn(command, args.concat(`--service=${"0.25.9"}`, "--ping"), { + windowsHide: true, + stdio: ["pipe", "pipe", "inherit"], + cwd: defaultWD + }); + let { readFromStdout, afterClose, service } = createChannel({ + writeToStdin(bytes) { + child.stdin.write(bytes, (err) => { + if (err) + afterClose(err); + }); + }, + readFileSync: fs2.readFileSync, + isSync: false, + hasFS: true, + esbuild: node_exports + }); + child.stdin.on("error", afterClose); + child.on("error", afterClose); + const stdin = child.stdin; + const stdout = child.stdout; + stdout.on("data", readFromStdout); + stdout.on("end", afterClose); + stopService = () => { + stdin.destroy(); + stdout.destroy(); + child.kill(); + initializeWasCalled = false; + longLivedService = void 0; + stopService = void 0; + }; + let refCount = 0; + child.unref(); + if (stdin.unref) { + stdin.unref(); + } + if (stdout.unref) { + stdout.unref(); + } + const refs = { + ref() { + if (++refCount === 1) + child.ref(); + }, + unref() { + if (--refCount === 0) + child.unref(); + } + }; + longLivedService = { + build: (options) => new Promise((resolve, reject) => { + service.buildOrContext({ + callName: "build", + refs, + options, + isTTY: isTTY(), + defaultWD, + callback: (err, res) => err ? reject(err) : resolve(res) + }); + }), + context: (options) => new Promise((resolve, reject) => service.buildOrContext({ + callName: "context", + refs, + options, + isTTY: isTTY(), + defaultWD, + callback: (err, res) => err ? reject(err) : resolve(res) + })), + transform: (input, options) => new Promise((resolve, reject) => service.transform({ + callName: "transform", + refs, + input, + options: options || {}, + isTTY: isTTY(), + fs: fsAsync, + callback: (err, res) => err ? reject(err) : resolve(res) + })), + formatMessages: (messages, options) => new Promise((resolve, reject) => service.formatMessages({ + callName: "formatMessages", + refs, + messages, + options, + callback: (err, res) => err ? reject(err) : resolve(res) + })), + analyzeMetafile: (metafile, options) => new Promise((resolve, reject) => service.analyzeMetafile({ + callName: "analyzeMetafile", + refs, + metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile), + options, + callback: (err, res) => err ? reject(err) : resolve(res) + })) + }; + return longLivedService; + }; + var runServiceSync = (callback) => { + let [command, args] = esbuildCommandAndArgs(); + let stdin = new Uint8Array(); + let { readFromStdout, afterClose, service } = createChannel({ + writeToStdin(bytes) { + if (stdin.length !== 0) + throw new Error("Must run at most one command"); + stdin = bytes; + }, + isSync: true, + hasFS: true, + esbuild: node_exports + }); + callback(service); + let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.25.9"}`), { + cwd: defaultWD, + windowsHide: true, + input: stdin, + // We don't know how large the output could be. If it's too large, the + // command will fail with ENOBUFS. Reserve 16mb for now since that feels + // like it should be enough. Also allow overriding this with an environment + // variable. + maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024 + }); + readFromStdout(stdout); + afterClose(null); + }; + var randomFileName = () => { + return path2.join(os22.tmpdir(), `esbuild-${crypto.randomBytes(32).toString("hex")}`); + }; + var workerThreadService = null; + var startWorkerThreadService = (worker_threads2) => { + let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel(); + let worker = new worker_threads2.Worker(__filename, { + workerData: { workerPort, defaultWD, esbuildVersion: "0.25.9" }, + transferList: [workerPort], + // From node's documentation: https://nodejs.org/api/worker_threads.html + // + // Take care when launching worker threads from preload scripts (scripts loaded + // and run using the `-r` command line flag). Unless the `execArgv` option is + // explicitly set, new Worker threads automatically inherit the command line flags + // from the running process and will preload the same preload scripts as the main + // thread. If the preload script unconditionally launches a worker thread, every + // thread spawned will spawn another until the application crashes. + // + execArgv: [] + }); + let nextID = 0; + let fakeBuildError = (text) => { + let error = new Error(`Build failed with 1 error: +error: ${text}`); + let errors = [{ id: "", pluginName: "", text, location: null, notes: [], detail: void 0 }]; + error.errors = errors; + error.warnings = []; + return error; + }; + let validateBuildSyncOptions = (options) => { + if (!options) + return; + let plugins = options.plugins; + if (plugins && plugins.length > 0) + throw fakeBuildError(`Cannot use plugins in synchronous API calls`); + }; + let applyProperties = (object, properties) => { + for (let key in properties) { + object[key] = properties[key]; + } + }; + let runCallSync = (command, args) => { + let id = nextID++; + let sharedBuffer = new SharedArrayBuffer(8); + let sharedBufferView = new Int32Array(sharedBuffer); + let msg = { sharedBuffer, id, command, args }; + worker.postMessage(msg); + let status = Atomics.wait(sharedBufferView, 0, 0); + if (status !== "ok" && status !== "not-equal") + throw new Error("Internal error: Atomics.wait() failed: " + status); + let { message: { id: id2, resolve, reject, properties } } = worker_threads2.receiveMessageOnPort(mainPort); + if (id !== id2) + throw new Error(`Internal error: Expected id ${id} but got id ${id2}`); + if (reject) { + applyProperties(reject, properties); + throw reject; + } + return resolve; + }; + worker.unref(); + return { + buildSync(options) { + validateBuildSyncOptions(options); + return runCallSync("build", [options]); + }, + transformSync(input, options) { + return runCallSync("transform", [input, options]); + }, + formatMessagesSync(messages, options) { + return runCallSync("formatMessages", [messages, options]); + }, + analyzeMetafileSync(metafile, options) { + return runCallSync("analyzeMetafile", [metafile, options]); + }, + stop() { + worker.terminate(); + workerThreadService = null; + } + }; + }; + var startSyncServiceWorker = () => { + let workerPort = worker_threads.workerData.workerPort; + let parentPort = worker_threads.parentPort; + let extractProperties = (object) => { + let properties = {}; + if (object && typeof object === "object") { + for (let key in object) { + properties[key] = object[key]; + } + } + return properties; + }; + try { + let service = ensureServiceIsRunning(); + defaultWD = worker_threads.workerData.defaultWD; + parentPort.on("message", (msg) => { + (async () => { + let { sharedBuffer, id, command, args } = msg; + let sharedBufferView = new Int32Array(sharedBuffer); + try { + switch (command) { + case "build": + workerPort.postMessage({ id, resolve: await service.build(args[0]) }); + break; + case "transform": + workerPort.postMessage({ id, resolve: await service.transform(args[0], args[1]) }); + break; + case "formatMessages": + workerPort.postMessage({ id, resolve: await service.formatMessages(args[0], args[1]) }); + break; + case "analyzeMetafile": + workerPort.postMessage({ id, resolve: await service.analyzeMetafile(args[0], args[1]) }); + break; + default: + throw new Error(`Invalid command: ${command}`); + } + } catch (reject) { + workerPort.postMessage({ id, reject, properties: extractProperties(reject) }); + } + Atomics.add(sharedBufferView, 0, 1); + Atomics.notify(sharedBufferView, 0, Infinity); + })(); + }); + } catch (reject) { + parentPort.on("message", (msg) => { + let { sharedBuffer, id } = msg; + let sharedBufferView = new Int32Array(sharedBuffer); + workerPort.postMessage({ id, reject, properties: extractProperties(reject) }); + Atomics.add(sharedBufferView, 0, 1); + Atomics.notify(sharedBufferView, 0, Infinity); + }); + } + }; + if (isInternalWorkerThread) { + startSyncServiceWorker(); + } + var node_default = node_exports; + } +}); + +// +var lexer_DQCqS3nf_exports = {}; +__export(lexer_DQCqS3nf_exports, { + ImportType: () => L, + init: () => G2, + parse: () => F +}); +function F(A3, E6 = "@") { + if (!Q2) + return G2.then(() => F(A3)); + const g2 = A3.length + 1, B3 = (Q2.__heap_base.value || Q2.__heap_base) + 4 * g2 - Q2.memory.buffer.byteLength; + B3 > 0 && Q2.memory.grow(Math.ceil(B3 / 65536)); + const s5 = Q2.sa(g2 - 1); + if ((R3 ? c : r2)(A3, new Uint16Array(Q2.memory.buffer, s5, g2)), !Q2.parse()) + throw Object.assign(new Error(`Parse error ${E6}:${A3.slice(0, Q2.e()).split(` +`).length}:${Q2.e() - A3.lastIndexOf(` +`, Q2.e() - 1)}`), { idx: Q2.e() }); + const U3 = [], t3 = []; + for (; Q2.ri(); ) { + const C4 = Q2.is(), I5 = Q2.ie(), D3 = Q2.it(), i6 = Q2.ai(), w4 = Q2.id(), J4 = Q2.ss(), K4 = Q2.se(); + let o8; + Q2.ip() && (o8 = N2(A3.slice(w4 === -1 ? C4 - 1 : C4, w4 === -1 ? I5 + 1 : I5))), U3.push({ n: o8, t: D3, s: C4, e: I5, ss: J4, se: K4, d: w4, a: i6 }); + } + for (; Q2.re(); ) { + const C4 = Q2.es(), I5 = Q2.ee(), D3 = Q2.els(), i6 = Q2.ele(), w4 = A3.slice(C4, I5), J4 = w4[0], K4 = D3 < 0 ? void 0 : A3.slice(D3, i6), o8 = K4 ? K4[0] : ""; + t3.push({ s: C4, e: I5, ls: D3, le: i6, n: J4 === '"' || J4 === "'" ? N2(w4) : w4, ln: o8 === '"' || o8 === "'" ? N2(K4) : K4 }); + } + function N2(C4) { + try { + return (0, eval)(C4); + } catch { + } + } + return k(N2, "k"), [U3, t3, !!Q2.f(), !!Q2.ms()]; +} +function r2(A3, E6) { + const g2 = A3.length; + let B3 = 0; + for (; B3 < g2; ) { + const s5 = A3.charCodeAt(B3); + E6[B3++] = (255 & s5) << 8 | s5 >>> 8; + } +} +function c(A3, E6) { + const g2 = A3.length; + let B3 = 0; + for (; B3 < g2; ) + E6[B3] = A3.charCodeAt(B3++); +} +var Y2, k, L, R3, Q2, G2, a3; +var init_lexer_DQCqS3nf = __esm({ + ""() { + Y2 = Object.defineProperty; + k = (A3, E6) => Y2(A3, "name", { value: E6, configurable: true }); + (function(A3) { + A3[A3.Static = 1] = "Static", A3[A3.Dynamic = 2] = "Dynamic", A3[A3.ImportMeta = 3] = "ImportMeta", A3[A3.StaticSourcePhase = 4] = "StaticSourcePhase", A3[A3.DynamicSourcePhase = 5] = "DynamicSourcePhase"; + })(L || (L = {})); + R3 = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1; + k(F, "parse"); + k(r2, "Q"); + k(c, "B"); + G2 = WebAssembly.compile((a3 = "AGFzbQEAAAABKwhgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gA39/fwADMTAAAQECAgICAgICAgICAgICAgICAgIAAwMDBAQAAAUAAAAAAAMDAwAGAAAABwAGAgUEBQFwAQEBBQMBAAEGDwJ/AUHA8gALfwBBwPIACwd6FQZtZW1vcnkCAAJzYQAAAWUAAwJpcwAEAmllAAUCc3MABgJzZQAHAml0AAgCYWkACQJpZAAKAmlwAAsCZXMADAJlZQANA2VscwAOA2VsZQAPAnJpABACcmUAEQFmABICbXMAEwVwYXJzZQAUC19faGVhcF9iYXNlAwEKm0EwaAEBf0EAIAA2AoAKQQAoAtwJIgEgAEEBdGoiAEEAOwEAQQAgAEECaiIANgKECkEAIAA2AogKQQBBADYC4AlBAEEANgLwCUEAQQA2AugJQQBBADYC5AlBAEEANgL4CUEAQQA2AuwJIAEL0wEBA39BACgC8AkhBEEAQQAoAogKIgU2AvAJQQAgBDYC9AlBACAFQSRqNgKICiAEQSBqQeAJIAQbIAU2AgBBACgC1AkhBEEAKALQCSEGIAUgATYCACAFIAA2AgggBSACIAJBAmpBACAGIANGIgAbIAQgA0YiBBs2AgwgBSADNgIUIAVBADYCECAFIAI2AgQgBUEANgIgIAVBA0EBQQIgABsgBBs2AhwgBUEAKALQCSADRiICOgAYAkACQCACDQBBACgC1AkgA0cNAQtBAEEBOgCMCgsLXgEBf0EAKAL4CSIEQRBqQeQJIAQbQQAoAogKIgQ2AgBBACAENgL4CUEAIARBFGo2AogKQQBBAToAjAogBEEANgIQIAQgAzYCDCAEIAI2AgggBCABNgIEIAQgADYCAAsIAEEAKAKQCgsVAEEAKALoCSgCAEEAKALcCWtBAXULHgEBf0EAKALoCSgCBCIAQQAoAtwJa0EBdUF/IAAbCxUAQQAoAugJKAIIQQAoAtwJa0EBdQseAQF/QQAoAugJKAIMIgBBACgC3AlrQQF1QX8gABsLCwBBACgC6AkoAhwLHgEBf0EAKALoCSgCECIAQQAoAtwJa0EBdUF/IAAbCzsBAX8CQEEAKALoCSgCFCIAQQAoAtAJRw0AQX8PCwJAIABBACgC1AlHDQBBfg8LIABBACgC3AlrQQF1CwsAQQAoAugJLQAYCxUAQQAoAuwJKAIAQQAoAtwJa0EBdQsVAEEAKALsCSgCBEEAKALcCWtBAXULHgEBf0EAKALsCSgCCCIAQQAoAtwJa0EBdUF/IAAbCx4BAX9BACgC7AkoAgwiAEEAKALcCWtBAXVBfyAAGwslAQF/QQBBACgC6AkiAEEgakHgCSAAGygCACIANgLoCSAAQQBHCyUBAX9BAEEAKALsCSIAQRBqQeQJIAAbKAIAIgA2AuwJIABBAEcLCABBAC0AlAoLCABBAC0AjAoL3Q0BBX8jAEGA0ABrIgAkAEEAQQE6AJQKQQBBACgC2Ak2ApwKQQBBACgC3AlBfmoiATYCsApBACABQQAoAoAKQQF0aiICNgK0CkEAQQA6AIwKQQBBADsBlgpBAEEAOwGYCkEAQQA6AKAKQQBBADYCkApBAEEAOgD8CUEAIABBgBBqNgKkCkEAIAA2AqgKQQBBADoArAoCQAJAAkACQANAQQAgAUECaiIDNgKwCiABIAJPDQECQCADLwEAIgJBd2pBBUkNAAJAAkACQAJAAkAgAkGbf2oOBQEICAgCAAsgAkEgRg0EIAJBL0YNAyACQTtGDQIMBwtBAC8BmAoNASADEBVFDQEgAUEEakGCCEEKEC8NARAWQQAtAJQKDQFBAEEAKAKwCiIBNgKcCgwHCyADEBVFDQAgAUEEakGMCEEKEC8NABAXC0EAQQAoArAKNgKcCgwBCwJAIAEvAQQiA0EqRg0AIANBL0cNBBAYDAELQQEQGQtBACgCtAohAkEAKAKwCiEBDAALC0EAIQIgAyEBQQAtAPwJDQIMAQtBACABNgKwCkEAQQA6AJQKCwNAQQAgAUECaiIDNgKwCgJAAkACQAJAAkACQAJAIAFBACgCtApPDQAgAy8BACICQXdqQQVJDQYCQAJAAkACQAJAAkACQAJAAkACQCACQWBqDgoQDwYPDw8PBQECAAsCQAJAAkACQCACQaB/ag4KCxISAxIBEhISAgALIAJBhX9qDgMFEQYJC0EALwGYCg0QIAMQFUUNECABQQRqQYIIQQoQLw0QEBYMEAsgAxAVRQ0PIAFBBGpBjAhBChAvDQ8QFwwPCyADEBVFDQ4gASkABELsgISDsI7AOVINDiABLwEMIgNBd2oiAUEXSw0MQQEgAXRBn4CABHFFDQwMDQtBAEEALwGYCiIBQQFqOwGYCkEAKAKkCiABQQN0aiIBQQE2AgAgAUEAKAKcCjYCBAwNC0EALwGYCiIDRQ0JQQAgA0F/aiIDOwGYCkEALwGWCiICRQ0MQQAoAqQKIANB//8DcUEDdGooAgBBBUcNDAJAIAJBAnRBACgCqApqQXxqKAIAIgMoAgQNACADQQAoApwKQQJqNgIEC0EAIAJBf2o7AZYKIAMgAUEEajYCDAwMCwJAQQAoApwKIgEvAQBBKUcNAEEAKALwCSIDRQ0AIAMoAgQgAUcNAEEAQQAoAvQJIgM2AvAJAkAgA0UNACADQQA2AiAMAQtBAEEANgLgCQtBAEEALwGYCiIDQQFqOwGYCkEAKAKkCiADQQN0aiIDQQZBAkEALQCsChs2AgAgAyABNgIEQQBBADoArAoMCwtBAC8BmAoiAUUNB0EAIAFBf2oiATsBmApBACgCpAogAUH//wNxQQN0aigCAEEERg0EDAoLQScQGgwJC0EiEBoMCAsgAkEvRw0HAkACQCABLwEEIgFBKkYNACABQS9HDQEQGAwKC0EBEBkMCQsCQAJAAkACQEEAKAKcCiIBLwEAIgMQG0UNAAJAAkAgA0FVag4EAAkBAwkLIAFBfmovAQBBK0YNAwwICyABQX5qLwEAQS1GDQIMBwsgA0EpRw0BQQAoAqQKQQAvAZgKIgJBA3RqKAIEEBxFDQIMBgsgAUF+ai8BAEFQakH//wNxQQpPDQULQQAvAZgKIQILAkACQCACQf//A3EiAkUNACADQeYARw0AQQAoAqQKIAJBf2pBA3RqIgQoAgBBAUcNACABQX5qLwEAQe8ARw0BIAQoAgRBlghBAxAdRQ0BDAULIANB/QBHDQBBACgCpAogAkEDdGoiAigCBBAeDQQgAigCAEEGRg0ECyABEB8NAyADRQ0DIANBL0ZBAC0AoApBAEdxDQMCQEEAKAL4CSICRQ0AIAEgAigCAEkNACABIAIoAgRNDQQLIAFBfmohAUEAKALcCSECAkADQCABQQJqIgQgAk0NAUEAIAE2ApwKIAEvAQAhAyABQX5qIgQhASADECBFDQALIARBAmohBAsCQCADQf//A3EQIUUNACAEQX5qIQECQANAIAFBAmoiAyACTQ0BQQAgATYCnAogAS8BACEDIAFBfmoiBCEBIAMQIQ0ACyAEQQJqIQMLIAMQIg0EC0EAQQE6AKAKDAcLQQAoAqQKQQAvAZgKIgFBA3QiA2pBACgCnAo2AgRBACABQQFqOwGYCkEAKAKkCiADakEDNgIACxAjDAULQQAtAPwJQQAvAZYKQQAvAZgKcnJFIQIMBwsQJEEAQQA6AKAKDAMLECVBACECDAULIANBoAFHDQELQQBBAToArAoLQQBBACgCsAo2ApwKC0EAKAKwCiEBDAALCyAAQYDQAGokACACCxoAAkBBACgC3AkgAEcNAEEBDwsgAEF+ahAmC/4KAQZ/QQBBACgCsAoiAEEMaiIBNgKwCkEAKAL4CSECQQEQKSEDAkACQAJAAkACQAJAAkACQAJAQQAoArAKIgQgAUcNACADEChFDQELAkACQAJAAkACQAJAAkAgA0EqRg0AIANB+wBHDQFBACAEQQJqNgKwCkEBECkhA0EAKAKwCiEEA0ACQAJAIANB//8DcSIDQSJGDQAgA0EnRg0AIAMQLBpBACgCsAohAwwBCyADEBpBAEEAKAKwCkECaiIDNgKwCgtBARApGgJAIAQgAxAtIgNBLEcNAEEAQQAoArAKQQJqNgKwCkEBECkhAwsgA0H9AEYNA0EAKAKwCiIFIARGDQ8gBSEEIAVBACgCtApNDQAMDwsLQQAgBEECajYCsApBARApGkEAKAKwCiIDIAMQLRoMAgtBAEEAOgCUCgJAAkACQAJAAkACQCADQZ9/ag4MAgsEAQsDCwsLCwsFAAsgA0H2AEYNBAwKC0EAIARBDmoiAzYCsAoCQAJAAkBBARApQZ9/ag4GABICEhIBEgtBACgCsAoiBSkAAkLzgOSD4I3AMVINESAFLwEKECFFDRFBACAFQQpqNgKwCkEAECkaC0EAKAKwCiIFQQJqQbIIQQ4QLw0QIAUvARAiAkF3aiIBQRdLDQ1BASABdEGfgIAEcUUNDQwOC0EAKAKwCiIFKQACQuyAhIOwjsA5Ug0PIAUvAQoiAkF3aiIBQRdNDQYMCgtBACAEQQpqNgKwCkEAECkaQQAoArAKIQQLQQAgBEEQajYCsAoCQEEBECkiBEEqRw0AQQBBACgCsApBAmo2ArAKQQEQKSEEC0EAKAKwCiEDIAQQLBogA0EAKAKwCiIEIAMgBBACQQBBACgCsApBfmo2ArAKDwsCQCAEKQACQuyAhIOwjsA5Ug0AIAQvAQoQIEUNAEEAIARBCmo2ArAKQQEQKSEEQQAoArAKIQMgBBAsGiADQQAoArAKIgQgAyAEEAJBAEEAKAKwCkF+ajYCsAoPC0EAIARBBGoiBDYCsAoLQQAgBEEGajYCsApBAEEAOgCUCkEBECkhBEEAKAKwCiEDIAQQLCEEQQAoArAKIQIgBEHf/wNxIgFB2wBHDQNBACACQQJqNgKwCkEBECkhBUEAKAKwCiEDQQAhBAwEC0EAQQE6AIwKQQBBACgCsApBAmo2ArAKC0EBECkhBEEAKAKwCiEDAkAgBEHmAEcNACADQQJqQawIQQYQLw0AQQAgA0EIajYCsAogAEEBEClBABArIAJBEGpB5AkgAhshAwNAIAMoAgAiA0UNBSADQgA3AgggA0EQaiEDDAALC0EAIANBfmo2ArAKDAMLQQEgAXRBn4CABHFFDQMMBAtBASEECwNAAkACQCAEDgIAAQELIAVB//8DcRAsGkEBIQQMAQsCQAJAQQAoArAKIgQgA0YNACADIAQgAyAEEAJBARApIQQCQCABQdsARw0AIARBIHJB/QBGDQQLQQAoArAKIQMCQCAEQSxHDQBBACADQQJqNgKwCkEBECkhBUEAKAKwCiEDIAVBIHJB+wBHDQILQQAgA0F+ajYCsAoLIAFB2wBHDQJBACACQX5qNgKwCg8LQQAhBAwACwsPCyACQaABRg0AIAJB+wBHDQQLQQAgBUEKajYCsApBARApIgVB+wBGDQMMAgsCQCACQVhqDgMBAwEACyACQaABRw0CC0EAIAVBEGo2ArAKAkBBARApIgVBKkcNAEEAQQAoArAKQQJqNgKwCkEBECkhBQsgBUEoRg0BC0EAKAKwCiEBIAUQLBpBACgCsAoiBSABTQ0AIAQgAyABIAUQAkEAQQAoArAKQX5qNgKwCg8LIAQgA0EAQQAQAkEAIARBDGo2ArAKDwsQJQvcCAEGf0EAIQBBAEEAKAKwCiIBQQxqIgI2ArAKQQEQKSEDQQAoArAKIQQCQAJAAkACQAJAAkACQAJAIANBLkcNAEEAIARBAmo2ArAKAkBBARApIgNB8wBGDQAgA0HtAEcNB0EAKAKwCiIDQQJqQZwIQQYQLw0HAkBBACgCnAoiBBAqDQAgBC8BAEEuRg0ICyABIAEgA0EIakEAKALUCRABDwtBACgCsAoiA0ECakGiCEEKEC8NBgJAQQAoApwKIgQQKg0AIAQvAQBBLkYNBwsgA0EMaiEDDAELIANB8wBHDQEgBCACTQ0BQQYhAEEAIQIgBEECakGiCEEKEC8NAiAEQQxqIQMCQCAELwEMIgVBd2oiBEEXSw0AQQEgBHRBn4CABHENAQsgBUGgAUcNAgtBACADNgKwCkEBIQBBARApIQMLAkACQAJAAkAgA0H7AEYNACADQShHDQFBACgCpApBAC8BmAoiA0EDdGoiBEEAKAKwCjYCBEEAIANBAWo7AZgKIARBBTYCAEEAKAKcCi8BAEEuRg0HQQBBACgCsAoiBEECajYCsApBARApIQMgAUEAKAKwCkEAIAQQAQJAAkAgAA0AQQAoAvAJIQQMAQtBACgC8AkiBEEFNgIcC0EAQQAvAZYKIgBBAWo7AZYKQQAoAqgKIABBAnRqIAQ2AgACQCADQSJGDQAgA0EnRg0AQQBBACgCsApBfmo2ArAKDwsgAxAaQQBBACgCsApBAmoiAzYCsAoCQAJAAkBBARApQVdqDgQBAgIAAgtBAEEAKAKwCkECajYCsApBARApGkEAKALwCSIEIAM2AgQgBEEBOgAYIARBACgCsAoiAzYCEEEAIANBfmo2ArAKDwtBACgC8AkiBCADNgIEIARBAToAGEEAQQAvAZgKQX9qOwGYCiAEQQAoArAKQQJqNgIMQQBBAC8BlgpBf2o7AZYKDwtBAEEAKAKwCkF+ajYCsAoPCyAADQJBACgCsAohA0EALwGYCg0BA0ACQAJAAkAgA0EAKAK0Ck8NAEEBECkiA0EiRg0BIANBJ0YNASADQf0ARw0CQQBBACgCsApBAmo2ArAKC0EBECkhBEEAKAKwCiEDAkAgBEHmAEcNACADQQJqQawIQQYQLw0JC0EAIANBCGo2ArAKAkBBARApIgNBIkYNACADQSdHDQkLIAEgA0EAECsPCyADEBoLQQBBACgCsApBAmoiAzYCsAoMAAsLIAANAUEGIQBBACECAkAgA0FZag4EBAMDBAALIANBIkYNAwwCC0EAIANBfmo2ArAKDwtBDCEAQQEhAgtBACgCsAoiAyABIABBAXRqRw0AQQAgA0F+ajYCsAoPC0EALwGYCg0CQQAoArAKIQNBACgCtAohAANAIAMgAE8NAQJAAkAgAy8BACIEQSdGDQAgBEEiRw0BCyABIAQgAhArDwtBACADQQJqIgM2ArAKDAALCxAlCw8LQQBBACgCsApBfmo2ArAKC0cBA39BACgCsApBAmohAEEAKAK0CiEBAkADQCAAIgJBfmogAU8NASACQQJqIQAgAi8BAEF2ag4EAQAAAQALC0EAIAI2ArAKC5gBAQN/QQBBACgCsAoiAUECajYCsAogAUEGaiEBQQAoArQKIQIDQAJAAkACQCABQXxqIAJPDQAgAUF+ai8BACEDAkACQCAADQAgA0EqRg0BIANBdmoOBAIEBAIECyADQSpHDQMLIAEvAQBBL0cNAkEAIAFBfmo2ArAKDAELIAFBfmohAQtBACABNgKwCg8LIAFBAmohAQwACwuIAQEEf0EAKAKwCiEBQQAoArQKIQICQAJAA0AgASIDQQJqIQEgAyACTw0BIAEvAQAiBCAARg0CAkAgBEHcAEYNACAEQXZqDgQCAQECAQsgA0EEaiEBIAMvAQRBDUcNACADQQZqIAEgAy8BBkEKRhshAQwACwtBACABNgKwChAlDwtBACABNgKwCgtsAQF/AkACQCAAQV9qIgFBBUsNAEEBIAF0QTFxDQELIABBRmpB//8DcUEGSQ0AIABBKUcgAEFYakH//wNxQQdJcQ0AAkAgAEGlf2oOBAEAAAEACyAAQf0ARyAAQYV/akH//wNxQQRJcQ8LQQELLgEBf0EBIQECQCAAQaYJQQUQHQ0AIABBlghBAxAdDQAgAEGwCUECEB0hAQsgAQtGAQN/QQAhAwJAIAAgAkEBdCICayIEQQJqIgBBACgC3AkiBUkNACAAIAEgAhAvDQACQCAAIAVHDQBBAQ8LIAQQJiEDCyADC4MBAQJ/QQEhAQJAAkACQAJAAkACQCAALwEAIgJBRWoOBAUEBAEACwJAIAJBm39qDgQDBAQCAAsgAkEpRg0EIAJB+QBHDQMgAEF+akG8CUEGEB0PCyAAQX5qLwEAQT1GDwsgAEF+akG0CUEEEB0PCyAAQX5qQcgJQQMQHQ8LQQAhAQsgAQu0AwECf0EAIQECQAJAAkACQAJAAkACQAJAAkACQCAALwEAQZx/ag4UAAECCQkJCQMJCQQFCQkGCQcJCQgJCwJAAkAgAEF+ai8BAEGXf2oOBAAKCgEKCyAAQXxqQcoIQQIQHQ8LIABBfGpBzghBAxAdDwsCQAJAAkAgAEF+ai8BAEGNf2oOAwABAgoLAkAgAEF8ai8BACICQeEARg0AIAJB7ABHDQogAEF6akHlABAnDwsgAEF6akHjABAnDwsgAEF8akHUCEEEEB0PCyAAQXxqQdwIQQYQHQ8LIABBfmovAQBB7wBHDQYgAEF8ai8BAEHlAEcNBgJAIABBemovAQAiAkHwAEYNACACQeMARw0HIABBeGpB6AhBBhAdDwsgAEF4akH0CEECEB0PCyAAQX5qQfgIQQQQHQ8LQQEhASAAQX5qIgBB6QAQJw0EIABBgAlBBRAdDwsgAEF+akHkABAnDwsgAEF+akGKCUEHEB0PCyAAQX5qQZgJQQQQHQ8LAkAgAEF+ai8BACICQe8ARg0AIAJB5QBHDQEgAEF8akHuABAnDwsgAEF8akGgCUEDEB0hAQsgAQs0AQF/QQEhAQJAIABBd2pB//8DcUEFSQ0AIABBgAFyQaABRg0AIABBLkcgABAocSEBCyABCzABAX8CQAJAIABBd2oiAUEXSw0AQQEgAXRBjYCABHENAQsgAEGgAUYNAEEADwtBAQtOAQJ/QQAhAQJAAkAgAC8BACICQeUARg0AIAJB6wBHDQEgAEF+akH4CEEEEB0PCyAAQX5qLwEAQfUARw0AIABBfGpB3AhBBhAdIQELIAEL3gEBBH9BACgCsAohAEEAKAK0CiEBAkACQAJAA0AgACICQQJqIQAgAiABTw0BAkACQAJAIAAvAQAiA0Gkf2oOBQIDAwMBAAsgA0EkRw0CIAIvAQRB+wBHDQJBACACQQRqIgA2ArAKQQBBAC8BmAoiAkEBajsBmApBACgCpAogAkEDdGoiAkEENgIAIAIgADYCBA8LQQAgADYCsApBAEEALwGYCkF/aiIAOwGYCkEAKAKkCiAAQf//A3FBA3RqKAIAQQNHDQMMBAsgAkEEaiEADAALC0EAIAA2ArAKCxAlCwtwAQJ/AkACQANAQQBBACgCsAoiAEECaiIBNgKwCiAAQQAoArQKTw0BAkACQAJAIAEvAQAiAUGlf2oOAgECAAsCQCABQXZqDgQEAwMEAAsgAUEvRw0CDAQLEC4aDAELQQAgAEEEajYCsAoMAAsLECULCzUBAX9BAEEBOgD8CUEAKAKwCiEAQQBBACgCtApBAmo2ArAKQQAgAEEAKALcCWtBAXU2ApAKC0MBAn9BASEBAkAgAC8BACICQXdqQf//A3FBBUkNACACQYABckGgAUYNAEEAIQEgAhAoRQ0AIAJBLkcgABAqcg8LIAELPQECf0EAIQICQEEAKALcCSIDIABLDQAgAC8BACABRw0AAkAgAyAARw0AQQEPCyAAQX5qLwEAECAhAgsgAgtoAQJ/QQEhAQJAAkAgAEFfaiICQQVLDQBBASACdEExcQ0BCyAAQfj/A3FBKEYNACAAQUZqQf//A3FBBkkNAAJAIABBpX9qIgJBA0sNACACQQFHDQELIABBhX9qQf//A3FBBEkhAQsgAQucAQEDf0EAKAKwCiEBAkADQAJAAkAgAS8BACICQS9HDQACQCABLwECIgFBKkYNACABQS9HDQQQGAwCCyAAEBkMAQsCQAJAIABFDQAgAkF3aiIBQRdLDQFBASABdEGfgIAEcUUNAQwCCyACECFFDQMMAQsgAkGgAUcNAgtBAEEAKAKwCiIDQQJqIgE2ArAKIANBACgCtApJDQALCyACCzEBAX9BACEBAkAgAC8BAEEuRw0AIABBfmovAQBBLkcNACAAQXxqLwEAQS5GIQELIAELnAQBAX8CQCABQSJGDQAgAUEnRg0AECUPC0EAKAKwCiEDIAEQGiAAIANBAmpBACgCsApBACgC0AkQAQJAIAJFDQBBACgC8AlBBDYCHAtBAEEAKAKwCkECajYCsAoCQAJAAkACQEEAECkiAUHhAEYNACABQfcARg0BQQAoArAKIQEMAgtBACgCsAoiAUECakHACEEKEC8NAUEGIQAMAgtBACgCsAoiAS8BAkHpAEcNACABLwEEQfQARw0AQQQhACABLwEGQegARg0BC0EAIAFBfmo2ArAKDwtBACABIABBAXRqNgKwCgJAQQEQKUH7AEYNAEEAIAE2ArAKDwtBACgCsAoiAiEAA0BBACAAQQJqNgKwCgJAAkACQEEBECkiAEEiRg0AIABBJ0cNAUEnEBpBAEEAKAKwCkECajYCsApBARApIQAMAgtBIhAaQQBBACgCsApBAmo2ArAKQQEQKSEADAELIAAQLCEACwJAIABBOkYNAEEAIAE2ArAKDwtBAEEAKAKwCkECajYCsAoCQEEBECkiAEEiRg0AIABBJ0YNAEEAIAE2ArAKDwsgABAaQQBBACgCsApBAmo2ArAKAkACQEEBECkiAEEsRg0AIABB/QBGDQFBACABNgKwCg8LQQBBACgCsApBAmo2ArAKQQEQKUH9AEYNAEEAKAKwCiEADAELC0EAKALwCSIBIAI2AhAgAUEAKAKwCkECajYCDAttAQJ/AkACQANAAkAgAEH//wNxIgFBd2oiAkEXSw0AQQEgAnRBn4CABHENAgsgAUGgAUYNASAAIQIgARAoDQJBACECQQBBACgCsAoiAEECajYCsAogAC8BAiIADQAMAgsLIAAhAgsgAkH//wNxC6sBAQR/AkACQEEAKAKwCiICLwEAIgNB4QBGDQAgASEEIAAhBQwBC0EAIAJBBGo2ArAKQQEQKSECQQAoArAKIQUCQAJAIAJBIkYNACACQSdGDQAgAhAsGkEAKAKwCiEEDAELIAIQGkEAQQAoArAKQQJqIgQ2ArAKC0EBECkhA0EAKAKwCiECCwJAIAIgBUYNACAFIARBACAAIAAgAUYiAhtBACABIAIbEAILIAMLcgEEf0EAKAKwCiEAQQAoArQKIQECQAJAA0AgAEECaiECIAAgAU8NAQJAAkAgAi8BACIDQaR/ag4CAQQACyACIQAgA0F2ag4EAgEBAgELIABBBGohAAwACwtBACACNgKwChAlQQAPC0EAIAI2ArAKQd0AC0kBA39BACEDAkAgAkUNAAJAA0AgAC0AACIEIAEtAAAiBUcNASABQQFqIQEgAEEBaiEAIAJBf2oiAg0ADAILCyAEIAVrIQMLIAMLC+wBAgBBgAgLzgEAAHgAcABvAHIAdABtAHAAbwByAHQAZgBvAHIAZQB0AGEAbwB1AHIAYwBlAHIAbwBtAHUAbgBjAHQAaQBvAG4AcwBzAGUAcgB0AHYAbwB5AGkAZQBkAGUAbABlAGMAbwBuAHQAaQBuAGkAbgBzAHQAYQBuAHQAeQBiAHIAZQBhAHIAZQB0AHUAcgBkAGUAYgB1AGcAZwBlAGEAdwBhAGkAdABoAHIAdwBoAGkAbABlAGkAZgBjAGEAdABjAGYAaQBuAGEAbABsAGUAbABzAABB0AkLEAEAAAACAAAAAAQAAEA5AAA=", typeof Buffer < "u" ? Buffer.from(a3, "base64") : Uint8Array.from(atob(a3), (A3) => A3.charCodeAt(0)))).then(WebAssembly.instantiate).then(({ exports: A3 }) => { + Q2 = A3; + }); + } +}); + +// +var require_constants4 = __commonJS({ + ""(exports, module2) { + "use strict"; + var SEMVER_SPEC_VERSION = "2.0.0"; + var MAX_LENGTH = 256; + var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */ + 9007199254740991; + var MAX_SAFE_COMPONENT_LENGTH = 16; + var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6; + var RELEASE_TYPES = [ + "major", + "premajor", + "minor", + "preminor", + "patch", + "prepatch", + "prerelease" + ]; + module2.exports = { + MAX_LENGTH, + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_SAFE_INTEGER, + RELEASE_TYPES, + SEMVER_SPEC_VERSION, + FLAG_INCLUDE_PRERELEASE: 1, + FLAG_LOOSE: 2 + }; + } +}); + +// +var require_debug = __commonJS({ + ""(exports, module2) { + "use strict"; + var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => { + }; + module2.exports = debug; + } +}); + +// +var require_re = __commonJS({ + ""(exports, module2) { + "use strict"; + var { + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_LENGTH + } = require_constants4(); + var debug = require_debug(); + exports = module2.exports = {}; + var re3 = exports.re = []; + var safeRe = exports.safeRe = []; + var src = exports.src = []; + var safeSrc = exports.safeSrc = []; + var t3 = exports.t = {}; + var R6 = 0; + var LETTERDASHNUMBER = "[a-zA-Z0-9-]"; + var safeRegexReplacements = [ + ["\\s", 1], + ["\\d", MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH] + ]; + var makeSafeRegex = (value) => { + for (const [token, max] of safeRegexReplacements) { + value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`); + } + return value; + }; + var createToken = (name, value, isGlobal) => { + const safe = makeSafeRegex(value); + const index = R6++; + debug(name, index, value); + t3[name] = index; + src[index] = value; + safeSrc[index] = safe; + re3[index] = new RegExp(value, isGlobal ? "g" : void 0); + safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0); + }; + createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*"); + createToken("NUMERICIDENTIFIERLOOSE", "\\d+"); + createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`); + createToken("MAINVERSION", `(${src[t3.NUMERICIDENTIFIER]})\\.(${src[t3.NUMERICIDENTIFIER]})\\.(${src[t3.NUMERICIDENTIFIER]})`); + createToken("MAINVERSIONLOOSE", `(${src[t3.NUMERICIDENTIFIERLOOSE]})\\.(${src[t3.NUMERICIDENTIFIERLOOSE]})\\.(${src[t3.NUMERICIDENTIFIERLOOSE]})`); + createToken("PRERELEASEIDENTIFIER", `(?:${src[t3.NONNUMERICIDENTIFIER]}|${src[t3.NUMERICIDENTIFIER]})`); + createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t3.NONNUMERICIDENTIFIER]}|${src[t3.NUMERICIDENTIFIERLOOSE]})`); + createToken("PRERELEASE", `(?:-(${src[t3.PRERELEASEIDENTIFIER]}(?:\\.${src[t3.PRERELEASEIDENTIFIER]})*))`); + createToken("PRERELEASELOOSE", `(?:-?(${src[t3.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t3.PRERELEASEIDENTIFIERLOOSE]})*))`); + createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`); + createToken("BUILD", `(?:\\+(${src[t3.BUILDIDENTIFIER]}(?:\\.${src[t3.BUILDIDENTIFIER]})*))`); + createToken("FULLPLAIN", `v?${src[t3.MAINVERSION]}${src[t3.PRERELEASE]}?${src[t3.BUILD]}?`); + createToken("FULL", `^${src[t3.FULLPLAIN]}$`); + createToken("LOOSEPLAIN", `[v=\\s]*${src[t3.MAINVERSIONLOOSE]}${src[t3.PRERELEASELOOSE]}?${src[t3.BUILD]}?`); + createToken("LOOSE", `^${src[t3.LOOSEPLAIN]}$`); + createToken("GTLT", "((?:<|>)?=?)"); + createToken("XRANGEIDENTIFIERLOOSE", `${src[t3.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`); + createToken("XRANGEIDENTIFIER", `${src[t3.NUMERICIDENTIFIER]}|x|X|\\*`); + createToken("XRANGEPLAIN", `[v=\\s]*(${src[t3.XRANGEIDENTIFIER]})(?:\\.(${src[t3.XRANGEIDENTIFIER]})(?:\\.(${src[t3.XRANGEIDENTIFIER]})(?:${src[t3.PRERELEASE]})?${src[t3.BUILD]}?)?)?`); + createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t3.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t3.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t3.XRANGEIDENTIFIERLOOSE]})(?:${src[t3.PRERELEASELOOSE]})?${src[t3.BUILD]}?)?)?`); + createToken("XRANGE", `^${src[t3.GTLT]}\\s*${src[t3.XRANGEPLAIN]}$`); + createToken("XRANGELOOSE", `^${src[t3.GTLT]}\\s*${src[t3.XRANGEPLAINLOOSE]}$`); + createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`); + createToken("COERCE", `${src[t3.COERCEPLAIN]}(?:$|[^\\d])`); + createToken("COERCEFULL", src[t3.COERCEPLAIN] + `(?:${src[t3.PRERELEASE]})?(?:${src[t3.BUILD]})?(?:$|[^\\d])`); + createToken("COERCERTL", src[t3.COERCE], true); + createToken("COERCERTLFULL", src[t3.COERCEFULL], true); + createToken("LONETILDE", "(?:~>?)"); + createToken("TILDETRIM", `(\\s*)${src[t3.LONETILDE]}\\s+`, true); + exports.tildeTrimReplace = "$1~"; + createToken("TILDE", `^${src[t3.LONETILDE]}${src[t3.XRANGEPLAIN]}$`); + createToken("TILDELOOSE", `^${src[t3.LONETILDE]}${src[t3.XRANGEPLAINLOOSE]}$`); + createToken("LONECARET", "(?:\\^)"); + createToken("CARETTRIM", `(\\s*)${src[t3.LONECARET]}\\s+`, true); + exports.caretTrimReplace = "$1^"; + createToken("CARET", `^${src[t3.LONECARET]}${src[t3.XRANGEPLAIN]}$`); + createToken("CARETLOOSE", `^${src[t3.LONECARET]}${src[t3.XRANGEPLAINLOOSE]}$`); + createToken("COMPARATORLOOSE", `^${src[t3.GTLT]}\\s*(${src[t3.LOOSEPLAIN]})$|^$`); + createToken("COMPARATOR", `^${src[t3.GTLT]}\\s*(${src[t3.FULLPLAIN]})$|^$`); + createToken("COMPARATORTRIM", `(\\s*)${src[t3.GTLT]}\\s*(${src[t3.LOOSEPLAIN]}|${src[t3.XRANGEPLAIN]})`, true); + exports.comparatorTrimReplace = "$1$2$3"; + createToken("HYPHENRANGE", `^\\s*(${src[t3.XRANGEPLAIN]})\\s+-\\s+(${src[t3.XRANGEPLAIN]})\\s*$`); + createToken("HYPHENRANGELOOSE", `^\\s*(${src[t3.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t3.XRANGEPLAINLOOSE]})\\s*$`); + createToken("STAR", "(<|>)?=?\\s*\\*"); + createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"); + createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$"); + } +}); + +// +var require_parse_options = __commonJS({ + ""(exports, module2) { + "use strict"; + var looseOption = Object.freeze({ loose: true }); + var emptyOpts = Object.freeze({}); + var parseOptions = (options) => { + if (!options) { + return emptyOpts; + } + if (typeof options !== "object") { + return looseOption; + } + return options; + }; + module2.exports = parseOptions; + } +}); + +// +var require_identifiers = __commonJS({ + ""(exports, module2) { + "use strict"; + var numeric = /^[0-9]+$/; + var compareIdentifiers = (a7, b3) => { + if (typeof a7 === "number" && typeof b3 === "number") { + return a7 === b3 ? 0 : a7 < b3 ? -1 : 1; + } + const anum = numeric.test(a7); + const bnum = numeric.test(b3); + if (anum && bnum) { + a7 = +a7; + b3 = +b3; + } + return a7 === b3 ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a7 < b3 ? -1 : 1; + }; + var rcompareIdentifiers = (a7, b3) => compareIdentifiers(b3, a7); + module2.exports = { + compareIdentifiers, + rcompareIdentifiers + }; + } +}); + +// +var require_semver = __commonJS({ + ""(exports, module2) { + "use strict"; + var debug = require_debug(); + var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants4(); + var { safeRe: re3, t: t3 } = require_re(); + var parseOptions = require_parse_options(); + var { compareIdentifiers } = require_identifiers(); + var SemVer = class _SemVer { + constructor(version, options) { + options = parseOptions(options); + if (version instanceof _SemVer) { + if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) { + return version; + } else { + version = version.version; + } + } else if (typeof version !== "string") { + throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`); + } + if (version.length > MAX_LENGTH) { + throw new TypeError( + `version is longer than ${MAX_LENGTH} characters` + ); + } + debug("SemVer", version, options); + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; + const m8 = version.trim().match(options.loose ? re3[t3.LOOSE] : re3[t3.FULL]); + if (!m8) { + throw new TypeError(`Invalid Version: ${version}`); + } + this.raw = version; + this.major = +m8[1]; + this.minor = +m8[2]; + this.patch = +m8[3]; + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError("Invalid major version"); + } + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError("Invalid minor version"); + } + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError("Invalid patch version"); + } + if (!m8[4]) { + this.prerelease = []; + } else { + this.prerelease = m8[4].split(".").map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id; + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num; + } + } + return id; + }); + } + this.build = m8[5] ? m8[5].split(".") : []; + this.format(); + } + format() { + this.version = `${this.major}.${this.minor}.${this.patch}`; + if (this.prerelease.length) { + this.version += `-${this.prerelease.join(".")}`; + } + return this.version; + } + toString() { + return this.version; + } + compare(other) { + debug("SemVer.compare", this.version, this.options, other); + if (!(other instanceof _SemVer)) { + if (typeof other === "string" && other === this.version) { + return 0; + } + other = new _SemVer(other, this.options); + } + if (other.version === this.version) { + return 0; + } + return this.compareMain(other) || this.comparePre(other); + } + compareMain(other) { + if (!(other instanceof _SemVer)) { + other = new _SemVer(other, this.options); + } + if (this.major < other.major) { + return -1; + } + if (this.major > other.major) { + return 1; + } + if (this.minor < other.minor) { + return -1; + } + if (this.minor > other.minor) { + return 1; + } + if (this.patch < other.patch) { + return -1; + } + if (this.patch > other.patch) { + return 1; + } + return 0; + } + comparePre(other) { + if (!(other instanceof _SemVer)) { + other = new _SemVer(other, this.options); + } + if (this.prerelease.length && !other.prerelease.length) { + return -1; + } else if (!this.prerelease.length && other.prerelease.length) { + return 1; + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0; + } + let i6 = 0; + do { + const a7 = this.prerelease[i6]; + const b3 = other.prerelease[i6]; + debug("prerelease compare", i6, a7, b3); + if (a7 === void 0 && b3 === void 0) { + return 0; + } else if (b3 === void 0) { + return 1; + } else if (a7 === void 0) { + return -1; + } else if (a7 === b3) { + continue; + } else { + return compareIdentifiers(a7, b3); + } + } while (++i6); + } + compareBuild(other) { + if (!(other instanceof _SemVer)) { + other = new _SemVer(other, this.options); + } + let i6 = 0; + do { + const a7 = this.build[i6]; + const b3 = other.build[i6]; + debug("build compare", i6, a7, b3); + if (a7 === void 0 && b3 === void 0) { + return 0; + } else if (b3 === void 0) { + return 1; + } else if (a7 === void 0) { + return -1; + } else if (a7 === b3) { + continue; + } else { + return compareIdentifiers(a7, b3); + } + } while (++i6); + } + // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + inc(release, identifier, identifierBase) { + if (release.startsWith("pre")) { + if (!identifier && identifierBase === false) { + throw new Error("invalid increment argument: identifier is empty"); + } + if (identifier) { + const match = `-${identifier}`.match(this.options.loose ? re3[t3.PRERELEASELOOSE] : re3[t3.PRERELEASE]); + if (!match || match[1] !== identifier) { + throw new Error(`invalid identifier: ${identifier}`); + } + } + } + switch (release) { + case "premajor": + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc("pre", identifier, identifierBase); + break; + case "preminor": + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc("pre", identifier, identifierBase); + break; + case "prepatch": + this.prerelease.length = 0; + this.inc("patch", identifier, identifierBase); + this.inc("pre", identifier, identifierBase); + break; + case "prerelease": + if (this.prerelease.length === 0) { + this.inc("patch", identifier, identifierBase); + } + this.inc("pre", identifier, identifierBase); + break; + case "release": + if (this.prerelease.length === 0) { + throw new Error(`version ${this.raw} is not a prerelease`); + } + this.prerelease.length = 0; + break; + case "major": + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { + this.major++; + } + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; + case "minor": + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++; + } + this.patch = 0; + this.prerelease = []; + break; + case "patch": + if (this.prerelease.length === 0) { + this.patch++; + } + this.prerelease = []; + break; + case "pre": { + const base = Number(identifierBase) ? 1 : 0; + if (this.prerelease.length === 0) { + this.prerelease = [base]; + } else { + let i6 = this.prerelease.length; + while (--i6 >= 0) { + if (typeof this.prerelease[i6] === "number") { + this.prerelease[i6]++; + i6 = -2; + } + } + if (i6 === -1) { + if (identifier === this.prerelease.join(".") && identifierBase === false) { + throw new Error("invalid increment argument: identifier already exists"); + } + this.prerelease.push(base); + } + } + if (identifier) { + let prerelease = [identifier, base]; + if (identifierBase === false) { + prerelease = [identifier]; + } + if (compareIdentifiers(this.prerelease[0], identifier) === 0) { + if (isNaN(this.prerelease[1])) { + this.prerelease = prerelease; + } + } else { + this.prerelease = prerelease; + } + } + break; + } + default: + throw new Error(`invalid increment argument: ${release}`); + } + this.raw = this.format(); + if (this.build.length) { + this.raw += `+${this.build.join(".")}`; + } + return this; + } + }; + module2.exports = SemVer; + } +}); + +// +var require_parse3 = __commonJS({ + ""(exports, module2) { + "use strict"; + var SemVer = require_semver(); + var parse2 = (version, options, throwErrors = false) => { + if (version instanceof SemVer) { + return version; + } + try { + return new SemVer(version, options); + } catch (er2) { + if (!throwErrors) { + return null; + } + throw er2; + } + }; + module2.exports = parse2; + } +}); + +// +var require_valid = __commonJS({ + ""(exports, module2) { + "use strict"; + var parse2 = require_parse3(); + var valid = (version, options) => { + const v4 = parse2(version, options); + return v4 ? v4.version : null; + }; + module2.exports = valid; + } +}); + +// +var require_clean = __commonJS({ + ""(exports, module2) { + "use strict"; + var parse2 = require_parse3(); + var clean = (version, options) => { + const s5 = parse2(version.trim().replace(/^[=v]+/, ""), options); + return s5 ? s5.version : null; + }; + module2.exports = clean; + } +}); + +// +var require_inc = __commonJS({ + ""(exports, module2) { + "use strict"; + var SemVer = require_semver(); + var inc = (version, release, options, identifier, identifierBase) => { + if (typeof options === "string") { + identifierBase = identifier; + identifier = options; + options = void 0; + } + try { + return new SemVer( + version instanceof SemVer ? version.version : version, + options + ).inc(release, identifier, identifierBase).version; + } catch (er2) { + return null; + } + }; + module2.exports = inc; + } +}); + +// +var require_diff = __commonJS({ + ""(exports, module2) { + "use strict"; + var parse2 = require_parse3(); + var diff = (version1, version2) => { + const v1 = parse2(version1, null, true); + const v22 = parse2(version2, null, true); + const comparison = v1.compare(v22); + if (comparison === 0) { + return null; + } + const v1Higher = comparison > 0; + const highVersion = v1Higher ? v1 : v22; + const lowVersion = v1Higher ? v22 : v1; + const highHasPre = !!highVersion.prerelease.length; + const lowHasPre = !!lowVersion.prerelease.length; + if (lowHasPre && !highHasPre) { + if (!lowVersion.patch && !lowVersion.minor) { + return "major"; + } + if (lowVersion.compareMain(highVersion) === 0) { + if (lowVersion.minor && !lowVersion.patch) { + return "minor"; + } + return "patch"; + } + } + const prefix = highHasPre ? "pre" : ""; + if (v1.major !== v22.major) { + return prefix + "major"; + } + if (v1.minor !== v22.minor) { + return prefix + "minor"; + } + if (v1.patch !== v22.patch) { + return prefix + "patch"; + } + return "prerelease"; + }; + module2.exports = diff; + } +}); + +// +var require_major = __commonJS({ + ""(exports, module2) { + "use strict"; + var SemVer = require_semver(); + var major = (a7, loose) => new SemVer(a7, loose).major; + module2.exports = major; + } +}); + +// +var require_minor = __commonJS({ + ""(exports, module2) { + "use strict"; + var SemVer = require_semver(); + var minor = (a7, loose) => new SemVer(a7, loose).minor; + module2.exports = minor; + } +}); + +// +var require_patch = __commonJS({ + ""(exports, module2) { + "use strict"; + var SemVer = require_semver(); + var patch = (a7, loose) => new SemVer(a7, loose).patch; + module2.exports = patch; + } +}); + +// +var require_prerelease = __commonJS({ + ""(exports, module2) { + "use strict"; + var parse2 = require_parse3(); + var prerelease = (version, options) => { + const parsed = parse2(version, options); + return parsed && parsed.prerelease.length ? parsed.prerelease : null; + }; + module2.exports = prerelease; + } +}); + +// +var require_compare = __commonJS({ + ""(exports, module2) { + "use strict"; + var SemVer = require_semver(); + var compare = (a7, b3, loose) => new SemVer(a7, loose).compare(new SemVer(b3, loose)); + module2.exports = compare; + } +}); + +// +var require_rcompare = __commonJS({ + ""(exports, module2) { + "use strict"; + var compare = require_compare(); + var rcompare = (a7, b3, loose) => compare(b3, a7, loose); + module2.exports = rcompare; + } +}); + +// +var require_compare_loose = __commonJS({ + ""(exports, module2) { + "use strict"; + var compare = require_compare(); + var compareLoose = (a7, b3) => compare(a7, b3, true); + module2.exports = compareLoose; + } +}); + +// +var require_compare_build = __commonJS({ + ""(exports, module2) { + "use strict"; + var SemVer = require_semver(); + var compareBuild = (a7, b3, loose) => { + const versionA = new SemVer(a7, loose); + const versionB = new SemVer(b3, loose); + return versionA.compare(versionB) || versionA.compareBuild(versionB); + }; + module2.exports = compareBuild; + } +}); + +// +var require_sort = __commonJS({ + ""(exports, module2) { + "use strict"; + var compareBuild = require_compare_build(); + var sort = (list, loose) => list.sort((a7, b3) => compareBuild(a7, b3, loose)); + module2.exports = sort; + } +}); + +// +var require_rsort = __commonJS({ + ""(exports, module2) { + "use strict"; + var compareBuild = require_compare_build(); + var rsort = (list, loose) => list.sort((a7, b3) => compareBuild(b3, a7, loose)); + module2.exports = rsort; + } +}); + +// +var require_gt = __commonJS({ + ""(exports, module2) { + "use strict"; + var compare = require_compare(); + var gt2 = (a7, b3, loose) => compare(a7, b3, loose) > 0; + module2.exports = gt2; + } +}); + +// +var require_lt = __commonJS({ + ""(exports, module2) { + "use strict"; + var compare = require_compare(); + var lt2 = (a7, b3, loose) => compare(a7, b3, loose) < 0; + module2.exports = lt2; + } +}); + +// +var require_eq = __commonJS({ + ""(exports, module2) { + "use strict"; + var compare = require_compare(); + var eq = (a7, b3, loose) => compare(a7, b3, loose) === 0; + module2.exports = eq; + } +}); + +// +var require_neq = __commonJS({ + ""(exports, module2) { + "use strict"; + var compare = require_compare(); + var neq = (a7, b3, loose) => compare(a7, b3, loose) !== 0; + module2.exports = neq; + } +}); + +// +var require_gte = __commonJS({ + ""(exports, module2) { + "use strict"; + var compare = require_compare(); + var gte = (a7, b3, loose) => compare(a7, b3, loose) >= 0; + module2.exports = gte; + } +}); + +// +var require_lte = __commonJS({ + ""(exports, module2) { + "use strict"; + var compare = require_compare(); + var lte = (a7, b3, loose) => compare(a7, b3, loose) <= 0; + module2.exports = lte; + } +}); + +// +var require_cmp = __commonJS({ + ""(exports, module2) { + "use strict"; + var eq = require_eq(); + var neq = require_neq(); + var gt2 = require_gt(); + var gte = require_gte(); + var lt2 = require_lt(); + var lte = require_lte(); + var cmp = (a7, op, b3, loose) => { + switch (op) { + case "===": + if (typeof a7 === "object") { + a7 = a7.version; + } + if (typeof b3 === "object") { + b3 = b3.version; + } + return a7 === b3; + case "!==": + if (typeof a7 === "object") { + a7 = a7.version; + } + if (typeof b3 === "object") { + b3 = b3.version; + } + return a7 !== b3; + case "": + case "=": + case "==": + return eq(a7, b3, loose); + case "!=": + return neq(a7, b3, loose); + case ">": + return gt2(a7, b3, loose); + case ">=": + return gte(a7, b3, loose); + case "<": + return lt2(a7, b3, loose); + case "<=": + return lte(a7, b3, loose); + default: + throw new TypeError(`Invalid operator: ${op}`); + } + }; + module2.exports = cmp; + } +}); + +// +var require_coerce = __commonJS({ + ""(exports, module2) { + "use strict"; + var SemVer = require_semver(); + var parse2 = require_parse3(); + var { safeRe: re3, t: t3 } = require_re(); + var coerce = (version, options) => { + if (version instanceof SemVer) { + return version; + } + if (typeof version === "number") { + version = String(version); + } + if (typeof version !== "string") { + return null; + } + options = options || {}; + let match = null; + if (!options.rtl) { + match = version.match(options.includePrerelease ? re3[t3.COERCEFULL] : re3[t3.COERCE]); + } else { + const coerceRtlRegex = options.includePrerelease ? re3[t3.COERCERTLFULL] : re3[t3.COERCERTL]; + let next; + while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) { + if (!match || next.index + next[0].length !== match.index + match[0].length) { + match = next; + } + coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length; + } + coerceRtlRegex.lastIndex = -1; + } + if (match === null) { + return null; + } + const major = match[2]; + const minor = match[3] || "0"; + const patch = match[4] || "0"; + const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ""; + const build = options.includePrerelease && match[6] ? `+${match[6]}` : ""; + return parse2(`${major}.${minor}.${patch}${prerelease}${build}`, options); + }; + module2.exports = coerce; + } +}); + +// +var require_lrucache = __commonJS({ + ""(exports, module2) { + "use strict"; + var LRUCache = class { + constructor() { + this.max = 1e3; + this.map = /* @__PURE__ */ new Map(); + } + get(key) { + const value = this.map.get(key); + if (value === void 0) { + return void 0; + } else { + this.map.delete(key); + this.map.set(key, value); + return value; + } + } + delete(key) { + return this.map.delete(key); + } + set(key, value) { + const deleted = this.delete(key); + if (!deleted && value !== void 0) { + if (this.map.size >= this.max) { + const firstKey = this.map.keys().next().value; + this.delete(firstKey); + } + this.map.set(key, value); + } + return this; + } + }; + module2.exports = LRUCache; + } +}); + +// +var require_range = __commonJS({ + ""(exports, module2) { + "use strict"; + var SPACE_CHARACTERS = /\s+/g; + var Range = class _Range { + constructor(range, options) { + options = parseOptions(options); + if (range instanceof _Range) { + if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) { + return range; + } else { + return new _Range(range.raw, options); + } + } + if (range instanceof Comparator) { + this.raw = range.value; + this.set = [[range]]; + this.formatted = void 0; + return this; + } + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; + this.raw = range.trim().replace(SPACE_CHARACTERS, " "); + this.set = this.raw.split("||").map((r3) => this.parseRange(r3.trim())).filter((c3) => c3.length); + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${this.raw}`); + } + if (this.set.length > 1) { + const first = this.set[0]; + this.set = this.set.filter((c3) => !isNullSet(c3[0])); + if (this.set.length === 0) { + this.set = [first]; + } else if (this.set.length > 1) { + for (const c3 of this.set) { + if (c3.length === 1 && isAny(c3[0])) { + this.set = [c3]; + break; + } + } + } + } + this.formatted = void 0; + } + get range() { + if (this.formatted === void 0) { + this.formatted = ""; + for (let i6 = 0; i6 < this.set.length; i6++) { + if (i6 > 0) { + this.formatted += "||"; + } + const comps = this.set[i6]; + for (let k3 = 0; k3 < comps.length; k3++) { + if (k3 > 0) { + this.formatted += " "; + } + this.formatted += comps[k3].toString().trim(); + } + } + } + return this.formatted; + } + format() { + return this.range; + } + toString() { + return this.range; + } + parseRange(range) { + const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE); + const memoKey = memoOpts + ":" + range; + const cached = cache.get(memoKey); + if (cached) { + return cached; + } + const loose = this.options.loose; + const hr2 = loose ? re3[t3.HYPHENRANGELOOSE] : re3[t3.HYPHENRANGE]; + range = range.replace(hr2, hyphenReplace(this.options.includePrerelease)); + debug("hyphen replace", range); + range = range.replace(re3[t3.COMPARATORTRIM], comparatorTrimReplace); + debug("comparator trim", range); + range = range.replace(re3[t3.TILDETRIM], tildeTrimReplace); + debug("tilde trim", range); + range = range.replace(re3[t3.CARETTRIM], caretTrimReplace); + debug("caret trim", range); + let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options)); + if (loose) { + rangeList = rangeList.filter((comp) => { + debug("loose invalid filter", comp, this.options); + return !!comp.match(re3[t3.COMPARATORLOOSE]); + }); + } + debug("range list", rangeList); + const rangeMap = /* @__PURE__ */ new Map(); + const comparators = rangeList.map((comp) => new Comparator(comp, this.options)); + for (const comp of comparators) { + if (isNullSet(comp)) { + return [comp]; + } + rangeMap.set(comp.value, comp); + } + if (rangeMap.size > 1 && rangeMap.has("")) { + rangeMap.delete(""); + } + const result = [...rangeMap.values()]; + cache.set(memoKey, result); + return result; + } + intersects(range, options) { + if (!(range instanceof _Range)) { + throw new TypeError("a Range is required"); + } + return this.set.some((thisComparators) => { + return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => { + return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options); + }); + }); + }); + }); + } + // if ANY of the sets match ALL of its comparators, then pass + test(version) { + if (!version) { + return false; + } + if (typeof version === "string") { + try { + version = new SemVer(version, this.options); + } catch (er2) { + return false; + } + } + for (let i6 = 0; i6 < this.set.length; i6++) { + if (testSet(this.set[i6], version, this.options)) { + return true; + } + } + return false; + } + }; + module2.exports = Range; + var LRU = require_lrucache(); + var cache = new LRU(); + var parseOptions = require_parse_options(); + var Comparator = require_comparator(); + var debug = require_debug(); + var SemVer = require_semver(); + var { + safeRe: re3, + t: t3, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace + } = require_re(); + var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants4(); + var isNullSet = (c3) => c3.value === "<0.0.0-0"; + var isAny = (c3) => c3.value === ""; + var isSatisfiable = (comparators, options) => { + let result = true; + const remainingComparators = comparators.slice(); + let testComparator = remainingComparators.pop(); + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options); + }); + testComparator = remainingComparators.pop(); + } + return result; + }; + var parseComparator = (comp, options) => { + comp = comp.replace(re3[t3.BUILD], ""); + debug("comp", comp, options); + comp = replaceCarets(comp, options); + debug("caret", comp); + comp = replaceTildes(comp, options); + debug("tildes", comp); + comp = replaceXRanges(comp, options); + debug("xrange", comp); + comp = replaceStars(comp, options); + debug("stars", comp); + return comp; + }; + var isX = (id) => !id || id.toLowerCase() === "x" || id === "*"; + var replaceTildes = (comp, options) => { + return comp.trim().split(/\s+/).map((c3) => replaceTilde(c3, options)).join(" "); + }; + var replaceTilde = (comp, options) => { + const r3 = options.loose ? re3[t3.TILDELOOSE] : re3[t3.TILDE]; + return comp.replace(r3, (_4, M3, m8, p5, pr) => { + debug("tilde", comp, _4, M3, m8, p5, pr); + let ret; + if (isX(M3)) { + ret = ""; + } else if (isX(m8)) { + ret = `>=${M3}.0.0 <${+M3 + 1}.0.0-0`; + } else if (isX(p5)) { + ret = `>=${M3}.${m8}.0 <${M3}.${+m8 + 1}.0-0`; + } else if (pr) { + debug("replaceTilde pr", pr); + ret = `>=${M3}.${m8}.${p5}-${pr} <${M3}.${+m8 + 1}.0-0`; + } else { + ret = `>=${M3}.${m8}.${p5} <${M3}.${+m8 + 1}.0-0`; + } + debug("tilde return", ret); + return ret; + }); + }; + var replaceCarets = (comp, options) => { + return comp.trim().split(/\s+/).map((c3) => replaceCaret(c3, options)).join(" "); + }; + var replaceCaret = (comp, options) => { + debug("caret", comp, options); + const r3 = options.loose ? re3[t3.CARETLOOSE] : re3[t3.CARET]; + const z3 = options.includePrerelease ? "-0" : ""; + return comp.replace(r3, (_4, M3, m8, p5, pr) => { + debug("caret", comp, _4, M3, m8, p5, pr); + let ret; + if (isX(M3)) { + ret = ""; + } else if (isX(m8)) { + ret = `>=${M3}.0.0${z3} <${+M3 + 1}.0.0-0`; + } else if (isX(p5)) { + if (M3 === "0") { + ret = `>=${M3}.${m8}.0${z3} <${M3}.${+m8 + 1}.0-0`; + } else { + ret = `>=${M3}.${m8}.0${z3} <${+M3 + 1}.0.0-0`; + } + } else if (pr) { + debug("replaceCaret pr", pr); + if (M3 === "0") { + if (m8 === "0") { + ret = `>=${M3}.${m8}.${p5}-${pr} <${M3}.${m8}.${+p5 + 1}-0`; + } else { + ret = `>=${M3}.${m8}.${p5}-${pr} <${M3}.${+m8 + 1}.0-0`; + } + } else { + ret = `>=${M3}.${m8}.${p5}-${pr} <${+M3 + 1}.0.0-0`; + } + } else { + debug("no pr"); + if (M3 === "0") { + if (m8 === "0") { + ret = `>=${M3}.${m8}.${p5}${z3} <${M3}.${m8}.${+p5 + 1}-0`; + } else { + ret = `>=${M3}.${m8}.${p5}${z3} <${M3}.${+m8 + 1}.0-0`; + } + } else { + ret = `>=${M3}.${m8}.${p5} <${+M3 + 1}.0.0-0`; + } + } + debug("caret return", ret); + return ret; + }); + }; + var replaceXRanges = (comp, options) => { + debug("replaceXRanges", comp, options); + return comp.split(/\s+/).map((c3) => replaceXRange(c3, options)).join(" "); + }; + var replaceXRange = (comp, options) => { + comp = comp.trim(); + const r3 = options.loose ? re3[t3.XRANGELOOSE] : re3[t3.XRANGE]; + return comp.replace(r3, (ret, gtlt, M3, m8, p5, pr) => { + debug("xRange", comp, ret, gtlt, M3, m8, p5, pr); + const xM = isX(M3); + const xm = xM || isX(m8); + const xp = xm || isX(p5); + const anyX = xp; + if (gtlt === "=" && anyX) { + gtlt = ""; + } + pr = options.includePrerelease ? "-0" : ""; + if (xM) { + if (gtlt === ">" || gtlt === "<") { + ret = "<0.0.0-0"; + } else { + ret = "*"; + } + } else if (gtlt && anyX) { + if (xm) { + m8 = 0; + } + p5 = 0; + if (gtlt === ">") { + gtlt = ">="; + if (xm) { + M3 = +M3 + 1; + m8 = 0; + p5 = 0; + } else { + m8 = +m8 + 1; + p5 = 0; + } + } else if (gtlt === "<=") { + gtlt = "<"; + if (xm) { + M3 = +M3 + 1; + } else { + m8 = +m8 + 1; + } + } + if (gtlt === "<") { + pr = "-0"; + } + ret = `${gtlt + M3}.${m8}.${p5}${pr}`; + } else if (xm) { + ret = `>=${M3}.0.0${pr} <${+M3 + 1}.0.0-0`; + } else if (xp) { + ret = `>=${M3}.${m8}.0${pr} <${M3}.${+m8 + 1}.0-0`; + } + debug("xRange return", ret); + return ret; + }); + }; + var replaceStars = (comp, options) => { + debug("replaceStars", comp, options); + return comp.trim().replace(re3[t3.STAR], ""); + }; + var replaceGTE0 = (comp, options) => { + debug("replaceGTE0", comp, options); + return comp.trim().replace(re3[options.includePrerelease ? t3.GTE0PRE : t3.GTE0], ""); + }; + var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => { + if (isX(fM)) { + from = ""; + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? "-0" : ""}`; + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`; + } else if (fpr) { + from = `>=${from}`; + } else { + from = `>=${from}${incPr ? "-0" : ""}`; + } + if (isX(tM)) { + to = ""; + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0`; + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0`; + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}`; + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0`; + } else { + to = `<=${to}`; + } + return `${from} ${to}`.trim(); + }; + var testSet = (set, version, options) => { + for (let i6 = 0; i6 < set.length; i6++) { + if (!set[i6].test(version)) { + return false; + } + } + if (version.prerelease.length && !options.includePrerelease) { + for (let i6 = 0; i6 < set.length; i6++) { + debug(set[i6].semver); + if (set[i6].semver === Comparator.ANY) { + continue; + } + if (set[i6].semver.prerelease.length > 0) { + const allowed = set[i6].semver; + if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) { + return true; + } + } + } + return false; + } + return true; + }; + } +}); + +// +var require_comparator = __commonJS({ + ""(exports, module2) { + "use strict"; + var ANY = Symbol("SemVer ANY"); + var Comparator = class _Comparator { + static get ANY() { + return ANY; + } + constructor(comp, options) { + options = parseOptions(options); + if (comp instanceof _Comparator) { + if (comp.loose === !!options.loose) { + return comp; + } else { + comp = comp.value; + } + } + comp = comp.trim().split(/\s+/).join(" "); + debug("comparator", comp, options); + this.options = options; + this.loose = !!options.loose; + this.parse(comp); + if (this.semver === ANY) { + this.value = ""; + } else { + this.value = this.operator + this.semver.version; + } + debug("comp", this); + } + parse(comp) { + const r3 = this.options.loose ? re3[t3.COMPARATORLOOSE] : re3[t3.COMPARATOR]; + const m8 = comp.match(r3); + if (!m8) { + throw new TypeError(`Invalid comparator: ${comp}`); + } + this.operator = m8[1] !== void 0 ? m8[1] : ""; + if (this.operator === "=") { + this.operator = ""; + } + if (!m8[2]) { + this.semver = ANY; + } else { + this.semver = new SemVer(m8[2], this.options.loose); + } + } + toString() { + return this.value; + } + test(version) { + debug("Comparator.test", version, this.options.loose); + if (this.semver === ANY || version === ANY) { + return true; + } + if (typeof version === "string") { + try { + version = new SemVer(version, this.options); + } catch (er2) { + return false; + } + } + return cmp(version, this.operator, this.semver, this.options); + } + intersects(comp, options) { + if (!(comp instanceof _Comparator)) { + throw new TypeError("a Comparator is required"); + } + if (this.operator === "") { + if (this.value === "") { + return true; + } + return new Range(comp.value, options).test(this.value); + } else if (comp.operator === "") { + if (comp.value === "") { + return true; + } + return new Range(this.value, options).test(comp.semver); + } + options = parseOptions(options); + if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) { + return false; + } + if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) { + return false; + } + if (this.operator.startsWith(">") && comp.operator.startsWith(">")) { + return true; + } + if (this.operator.startsWith("<") && comp.operator.startsWith("<")) { + return true; + } + if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) { + return true; + } + if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) { + return true; + } + if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) { + return true; + } + return false; + } + }; + module2.exports = Comparator; + var parseOptions = require_parse_options(); + var { safeRe: re3, t: t3 } = require_re(); + var cmp = require_cmp(); + var debug = require_debug(); + var SemVer = require_semver(); + var Range = require_range(); + } +}); + +// +var require_satisfies = __commonJS({ + ""(exports, module2) { + "use strict"; + var Range = require_range(); + var satisfies = (version, range, options) => { + try { + range = new Range(range, options); + } catch (er2) { + return false; + } + return range.test(version); + }; + module2.exports = satisfies; + } +}); + +// +var require_to_comparators = __commonJS({ + ""(exports, module2) { + "use strict"; + var Range = require_range(); + var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c3) => c3.value).join(" ").trim().split(" ")); + module2.exports = toComparators; + } +}); + +// +var require_max_satisfying = __commonJS({ + ""(exports, module2) { + "use strict"; + var SemVer = require_semver(); + var Range = require_range(); + var maxSatisfying = (versions, range, options) => { + let max = null; + let maxSV = null; + let rangeObj = null; + try { + rangeObj = new Range(range, options); + } catch (er2) { + return null; + } + versions.forEach((v4) => { + if (rangeObj.test(v4)) { + if (!max || maxSV.compare(v4) === -1) { + max = v4; + maxSV = new SemVer(max, options); + } + } + }); + return max; + }; + module2.exports = maxSatisfying; + } +}); + +// +var require_min_satisfying = __commonJS({ + ""(exports, module2) { + "use strict"; + var SemVer = require_semver(); + var Range = require_range(); + var minSatisfying = (versions, range, options) => { + let min = null; + let minSV = null; + let rangeObj = null; + try { + rangeObj = new Range(range, options); + } catch (er2) { + return null; + } + versions.forEach((v4) => { + if (rangeObj.test(v4)) { + if (!min || minSV.compare(v4) === 1) { + min = v4; + minSV = new SemVer(min, options); + } + } + }); + return min; + }; + module2.exports = minSatisfying; + } +}); + +// +var require_min_version = __commonJS({ + ""(exports, module2) { + "use strict"; + var SemVer = require_semver(); + var Range = require_range(); + var gt2 = require_gt(); + var minVersion = (range, loose) => { + range = new Range(range, loose); + let minver = new SemVer("0.0.0"); + if (range.test(minver)) { + return minver; + } + minver = new SemVer("0.0.0-0"); + if (range.test(minver)) { + return minver; + } + minver = null; + for (let i6 = 0; i6 < range.set.length; ++i6) { + const comparators = range.set[i6]; + let setMin = null; + comparators.forEach((comparator) => { + const compver = new SemVer(comparator.semver.version); + switch (comparator.operator) { + case ">": + if (compver.prerelease.length === 0) { + compver.patch++; + } else { + compver.prerelease.push(0); + } + compver.raw = compver.format(); + case "": + case ">=": + if (!setMin || gt2(compver, setMin)) { + setMin = compver; + } + break; + case "<": + case "<=": + break; + default: + throw new Error(`Unexpected operation: ${comparator.operator}`); + } + }); + if (setMin && (!minver || gt2(minver, setMin))) { + minver = setMin; + } + } + if (minver && range.test(minver)) { + return minver; + } + return null; + }; + module2.exports = minVersion; + } +}); + +// +var require_valid2 = __commonJS({ + ""(exports, module2) { + "use strict"; + var Range = require_range(); + var validRange = (range, options) => { + try { + return new Range(range, options).range || "*"; + } catch (er2) { + return null; + } + }; + module2.exports = validRange; + } +}); + +// +var require_outside = __commonJS({ + ""(exports, module2) { + "use strict"; + var SemVer = require_semver(); + var Comparator = require_comparator(); + var { ANY } = Comparator; + var Range = require_range(); + var satisfies = require_satisfies(); + var gt2 = require_gt(); + var lt2 = require_lt(); + var lte = require_lte(); + var gte = require_gte(); + var outside = (version, range, hilo, options) => { + version = new SemVer(version, options); + range = new Range(range, options); + let gtfn, ltefn, ltfn, comp, ecomp; + switch (hilo) { + case ">": + gtfn = gt2; + ltefn = lte; + ltfn = lt2; + comp = ">"; + ecomp = ">="; + break; + case "<": + gtfn = lt2; + ltefn = gte; + ltfn = gt2; + comp = "<"; + ecomp = "<="; + break; + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } + if (satisfies(version, range, options)) { + return false; + } + for (let i6 = 0; i6 < range.set.length; ++i6) { + const comparators = range.set[i6]; + let high = null; + let low = null; + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator(">=0.0.0"); + } + high = high || comparator; + low = low || comparator; + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator; + } + }); + if (high.operator === comp || high.operator === ecomp) { + return false; + } + if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false; + } + } + return true; + }; + module2.exports = outside; + } +}); + +// +var require_gtr = __commonJS({ + ""(exports, module2) { + "use strict"; + var outside = require_outside(); + var gtr = (version, range, options) => outside(version, range, ">", options); + module2.exports = gtr; + } +}); + +// +var require_ltr = __commonJS({ + ""(exports, module2) { + "use strict"; + var outside = require_outside(); + var ltr = (version, range, options) => outside(version, range, "<", options); + module2.exports = ltr; + } +}); + +// +var require_intersects = __commonJS({ + ""(exports, module2) { + "use strict"; + var Range = require_range(); + var intersects = (r1, r22, options) => { + r1 = new Range(r1, options); + r22 = new Range(r22, options); + return r1.intersects(r22, options); + }; + module2.exports = intersects; + } +}); + +// +var require_simplify = __commonJS({ + ""(exports, module2) { + "use strict"; + var satisfies = require_satisfies(); + var compare = require_compare(); + module2.exports = (versions, range, options) => { + const set = []; + let first = null; + let prev = null; + const v4 = versions.sort((a7, b3) => compare(a7, b3, options)); + for (const version of v4) { + const included = satisfies(version, range, options); + if (included) { + prev = version; + if (!first) { + first = version; + } + } else { + if (prev) { + set.push([first, prev]); + } + prev = null; + first = null; + } + } + if (first) { + set.push([first, null]); + } + const ranges = []; + for (const [min, max] of set) { + if (min === max) { + ranges.push(min); + } else if (!max && min === v4[0]) { + ranges.push("*"); + } else if (!max) { + ranges.push(`>=${min}`); + } else if (min === v4[0]) { + ranges.push(`<=${max}`); + } else { + ranges.push(`${min} - ${max}`); + } + } + const simplified = ranges.join(" || "); + const original = typeof range.raw === "string" ? range.raw : String(range); + return simplified.length < original.length ? simplified : range; + }; + } +}); + +// +var require_subset = __commonJS({ + ""(exports, module2) { + "use strict"; + var Range = require_range(); + var Comparator = require_comparator(); + var { ANY } = Comparator; + var satisfies = require_satisfies(); + var compare = require_compare(); + var subset = (sub, dom, options = {}) => { + if (sub === dom) { + return true; + } + sub = new Range(sub, options); + dom = new Range(dom, options); + let sawNonNull = false; + OUTER: + for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options); + sawNonNull = sawNonNull || isSub !== null; + if (isSub) { + continue OUTER; + } + } + if (sawNonNull) { + return false; + } + } + return true; + }; + var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")]; + var minimumVersion = [new Comparator(">=0.0.0")]; + var simpleSubset = (sub, dom, options) => { + if (sub === dom) { + return true; + } + if (sub.length === 1 && sub[0].semver === ANY) { + if (dom.length === 1 && dom[0].semver === ANY) { + return true; + } else if (options.includePrerelease) { + sub = minimumVersionWithPreRelease; + } else { + sub = minimumVersion; + } + } + if (dom.length === 1 && dom[0].semver === ANY) { + if (options.includePrerelease) { + return true; + } else { + dom = minimumVersion; + } + } + const eqSet = /* @__PURE__ */ new Set(); + let gt2, lt2; + for (const c3 of sub) { + if (c3.operator === ">" || c3.operator === ">=") { + gt2 = higherGT(gt2, c3, options); + } else if (c3.operator === "<" || c3.operator === "<=") { + lt2 = lowerLT(lt2, c3, options); + } else { + eqSet.add(c3.semver); + } + } + if (eqSet.size > 1) { + return null; + } + let gtltComp; + if (gt2 && lt2) { + gtltComp = compare(gt2.semver, lt2.semver, options); + if (gtltComp > 0) { + return null; + } else if (gtltComp === 0 && (gt2.operator !== ">=" || lt2.operator !== "<=")) { + return null; + } + } + for (const eq of eqSet) { + if (gt2 && !satisfies(eq, String(gt2), options)) { + return null; + } + if (lt2 && !satisfies(eq, String(lt2), options)) { + return null; + } + for (const c3 of dom) { + if (!satisfies(eq, String(c3), options)) { + return false; + } + } + return true; + } + let higher, lower; + let hasDomLT, hasDomGT; + let needDomLTPre = lt2 && !options.includePrerelease && lt2.semver.prerelease.length ? lt2.semver : false; + let needDomGTPre = gt2 && !options.includePrerelease && gt2.semver.prerelease.length ? gt2.semver : false; + if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt2.operator === "<" && needDomLTPre.prerelease[0] === 0) { + needDomLTPre = false; + } + for (const c3 of dom) { + hasDomGT = hasDomGT || c3.operator === ">" || c3.operator === ">="; + hasDomLT = hasDomLT || c3.operator === "<" || c3.operator === "<="; + if (gt2) { + if (needDomGTPre) { + if (c3.semver.prerelease && c3.semver.prerelease.length && c3.semver.major === needDomGTPre.major && c3.semver.minor === needDomGTPre.minor && c3.semver.patch === needDomGTPre.patch) { + needDomGTPre = false; + } + } + if (c3.operator === ">" || c3.operator === ">=") { + higher = higherGT(gt2, c3, options); + if (higher === c3 && higher !== gt2) { + return false; + } + } else if (gt2.operator === ">=" && !satisfies(gt2.semver, String(c3), options)) { + return false; + } + } + if (lt2) { + if (needDomLTPre) { + if (c3.semver.prerelease && c3.semver.prerelease.length && c3.semver.major === needDomLTPre.major && c3.semver.minor === needDomLTPre.minor && c3.semver.patch === needDomLTPre.patch) { + needDomLTPre = false; + } + } + if (c3.operator === "<" || c3.operator === "<=") { + lower = lowerLT(lt2, c3, options); + if (lower === c3 && lower !== lt2) { + return false; + } + } else if (lt2.operator === "<=" && !satisfies(lt2.semver, String(c3), options)) { + return false; + } + } + if (!c3.operator && (lt2 || gt2) && gtltComp !== 0) { + return false; + } + } + if (gt2 && hasDomLT && !lt2 && gtltComp !== 0) { + return false; + } + if (lt2 && hasDomGT && !gt2 && gtltComp !== 0) { + return false; + } + if (needDomGTPre || needDomLTPre) { + return false; + } + return true; + }; + var higherGT = (a7, b3, options) => { + if (!a7) { + return b3; + } + const comp = compare(a7.semver, b3.semver, options); + return comp > 0 ? a7 : comp < 0 ? b3 : b3.operator === ">" && a7.operator === ">=" ? b3 : a7; + }; + var lowerLT = (a7, b3, options) => { + if (!a7) { + return b3; + } + const comp = compare(a7.semver, b3.semver, options); + return comp < 0 ? a7 : comp > 0 ? b3 : b3.operator === "<" && a7.operator === "<=" ? b3 : a7; + }; + module2.exports = subset; + } +}); + +// +var require_semver2 = __commonJS({ + ""(exports, module2) { + "use strict"; + var internalRe = require_re(); + var constants = require_constants4(); + var SemVer = require_semver(); + var identifiers = require_identifiers(); + var parse2 = require_parse3(); + var valid = require_valid(); + var clean = require_clean(); + var inc = require_inc(); + var diff = require_diff(); + var major = require_major(); + var minor = require_minor(); + var patch = require_patch(); + var prerelease = require_prerelease(); + var compare = require_compare(); + var rcompare = require_rcompare(); + var compareLoose = require_compare_loose(); + var compareBuild = require_compare_build(); + var sort = require_sort(); + var rsort = require_rsort(); + var gt2 = require_gt(); + var lt2 = require_lt(); + var eq = require_eq(); + var neq = require_neq(); + var gte = require_gte(); + var lte = require_lte(); + var cmp = require_cmp(); + var coerce = require_coerce(); + var Comparator = require_comparator(); + var Range = require_range(); + var satisfies = require_satisfies(); + var toComparators = require_to_comparators(); + var maxSatisfying = require_max_satisfying(); + var minSatisfying = require_min_satisfying(); + var minVersion = require_min_version(); + var validRange = require_valid2(); + var outside = require_outside(); + var gtr = require_gtr(); + var ltr = require_ltr(); + var intersects = require_intersects(); + var simplifyRange = require_simplify(); + var subset = require_subset(); + module2.exports = { + parse: parse2, + valid, + clean, + inc, + diff, + major, + minor, + patch, + prerelease, + compare, + rcompare, + compareLoose, + compareBuild, + sort, + rsort, + gt: gt2, + lt: lt2, + eq, + neq, + gte, + lte, + cmp, + coerce, + Comparator, + Range, + satisfies, + toComparators, + maxSatisfying, + minSatisfying, + minVersion, + validRange, + outside, + gtr, + ltr, + intersects, + simplifyRange, + subset, + SemVer, + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, + RELEASE_TYPES: constants.RELEASE_TYPES, + compareIdentifiers: identifiers.compareIdentifiers, + rcompareIdentifiers: identifiers.rcompareIdentifiers + }; + } +}); + +// +var require_dist = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.GraphQLType = void 0; + (function(GraphQLType) { + GraphQLType[GraphQLType["SCALAR"] = 0] = "SCALAR"; + GraphQLType[GraphQLType["INLINE_FRAGMENT"] = 1] = "INLINE_FRAGMENT"; + GraphQLType[GraphQLType["FRAGMENT"] = 2] = "FRAGMENT"; + })(exports.GraphQLType || (exports.GraphQLType = {})); + var typeSymbol = Symbol("GraphQL Type"); + var paramsSymbol = Symbol("GraphQL Params"); + function isInlineFragmentObject(value) { + return typeof value === "object" && value !== null && value[typeSymbol] === exports.GraphQLType.INLINE_FRAGMENT; + } + function isFragmentObject(value) { + return typeof value === "object" && value !== null && value[typeSymbol] === exports.GraphQLType.FRAGMENT; + } + function isScalarObject(value) { + return typeof value === "object" && value !== null && value[typeSymbol] === exports.GraphQLType.SCALAR; + } + function renderName(name) { + return name === void 0 ? "" : name; + } + function renderParams(params3, brackets, array) { + if (brackets === void 0) { + brackets = true; + } + if (array === void 0) { + array = false; + } + if (!params3) { + return ""; + } + var builder = []; + for (var _i = 0, _a = Object.entries(params3); _i < _a.length; _i++) { + var _b = _a[_i], key = _b[0], value = _b[1]; + var params_1 = void 0; + if (value === null) { + params_1 = "null"; + } else if (Array.isArray(value)) { + params_1 = "[".concat(renderParams(value, false, true), "]"); + } else if (typeof value === "object") { + params_1 = "{".concat(renderParams(value, false), "}"); + } else { + params_1 = "".concat(value); + } + builder.push(array ? "".concat(params_1) : "".concat(key, ":").concat(params_1)); + } + var built = builder.join(","); + if (brackets) { + built = "(".concat(built, ")"); + } + return built; + } + function renderScalar(name, params3) { + return renderName(name) + renderParams(params3); + } + function renderInlineFragment(fragment2, context2) { + return "...on ".concat(fragment2.typeName).concat(renderObject(void 0, fragment2.internal, context2)); + } + function renderFragment(fragment2, context2) { + return "fragment ".concat(fragment2.name, " on ").concat(fragment2.typeName).concat(renderObject(void 0, fragment2.internal, context2)); + } + function renderArray(name, arr, context2) { + var first = arr[0]; + if (first === void 0 || first === null) { + throw new Error("Cannot render array with no first value"); + } + first[paramsSymbol] = arr[paramsSymbol]; + return renderType(name, first, context2); + } + function renderType(name, value, context2) { + switch (typeof value) { + case "bigint": + case "boolean": + case "number": + case "string": + throw new Error("Rendering type ".concat(typeof value, " directly is disallowed")); + case "object": + if (value === null) { + throw new Error("Cannot render null"); + } + if (isScalarObject(value)) { + return "".concat(renderScalar(name, value[paramsSymbol]), " "); + } else if (Array.isArray(value)) { + return renderArray(name, value, context2); + } else { + return renderObject(name, value, context2); + } + case "undefined": + return ""; + default: + throw new Error("Cannot render type ".concat(typeof value)); + } + } + function renderObject(name, obj, context2) { + var fields = []; + for (var _i = 0, _a = Object.entries(obj); _i < _a.length; _i++) { + var _b = _a[_i], key = _b[0], value = _b[1]; + fields.push(renderType(key, value, context2)); + } + for (var _c = 0, _d = Object.getOwnPropertySymbols(obj); _c < _d.length; _c++) { + var sym = _d[_c]; + var value = obj[sym]; + if (isInlineFragmentObject(value)) { + fields.push(renderInlineFragment(value, context2)); + } else if (isFragmentObject(value)) { + context2.fragments.set(sym, value); + fields.push("...".concat(value.name)); + } + } + if (fields.length === 0) { + throw new Error("Object cannot have no fields"); + } + return "".concat(renderName(name)).concat(renderParams(obj[paramsSymbol]), "{").concat(fields.join("").trim(), "}"); + } + function render(value) { + var context2 = { + fragments: /* @__PURE__ */ new Map() + }; + var rend = renderObject(void 0, value, context2); + var rendered = /* @__PURE__ */ new Map(); + var executingContext = context2; + var currentContext = { + // The current context for execution. + fragments: /* @__PURE__ */ new Map() + }; + while (executingContext.fragments.size > 0) { + for (var _i = 0, _a = Array.from(executingContext.fragments.entries()); _i < _a.length; _i++) { + var _b = _a[_i], sym = _b[0], fragment2 = _b[1]; + if (!rendered.has(sym)) { + rendered.set(sym, renderFragment(fragment2, currentContext)); + } + } + executingContext = currentContext; + currentContext = { + // Reset current context. + fragments: /* @__PURE__ */ new Map() + }; + } + return rend + Array.from(rendered.values()).join(""); + } + function fragmentToString(value) { + var context2 = { + fragments: /* @__PURE__ */ new Map() + }; + renderObject(void 0, value, context2); + var currentContext = { + // The current context for execution. + fragments: /* @__PURE__ */ new Map() + }; + var output = ""; + for (var _i = 0, _a = Array.from(context2.fragments.entries()); _i < _a.length; _i++) { + var _b = _a[_i], fragment2 = _b[1]; + output = output + renderFragment(fragment2, currentContext); + } + return output; + } + function createOperate(operateType) { + function operate(opNameOrQueryObject, queryObject) { + if (typeof opNameOrQueryObject === "string") { + if (!queryObject) { + throw new Error("queryObject is not set"); + } + return { + toString: function() { + return "".concat(operateType, " ").concat(opNameOrQueryObject).concat(render(queryObject)); + } + }; + } + return { + toString: function() { + return "".concat(operateType).concat(render(opNameOrQueryObject)); + } + }; + } + return operate; + } + var query2 = createOperate("query"); + var mutation = createOperate("mutation"); + var subscription = createOperate("subscription"); + function params2(params3, input) { + if (typeof params3 !== "object") { + throw new Error("Params have to be an object"); + } + if (typeof input !== "object") { + throw new Error("Cannot apply params to JS ".concat(typeof params3)); + } + input[paramsSymbol] = params3; + return input; + } + function alias(alias2, target) { + return "".concat(alias2, ":").concat(target); + } + function fragment(name, typeName, input) { + var _a, _b; + var fragment2 = (_a = {}, _a[typeSymbol] = exports.GraphQLType.FRAGMENT, _a.name = name, _a.typeName = typeName, _a.internal = input, _a); + return _b = {}, _b[Symbol("Fragment(".concat(name, " on ").concat(typeName, ")"))] = fragment2, _b; + } + function rawString(input) { + return JSON.stringify(input); + } + var __assign = function() { + __assign = Object.assign || function __assign2(t3) { + for (var s5, i6 = 1, n3 = arguments.length; i6 < n3; i6++) { + s5 = arguments[i6]; + for (var p5 in s5) + if (Object.prototype.hasOwnProperty.call(s5, p5)) + t3[p5] = s5[p5]; + } + return t3; + }; + return __assign.apply(this, arguments); + }; + function optional(obj) { + return obj; + } + function on2(typeName, internal) { + var _a, _b; + var fragment2 = (_a = {}, _a[typeSymbol] = exports.GraphQLType.INLINE_FRAGMENT, _a.typeName = typeName, _a.internal = internal, _a); + return _b = {}, _b[Symbol("InlineFragment(".concat(typeName, ")"))] = fragment2, _b; + } + function onUnion(types3) { + var fragments = {}; + for (var _i = 0, _a = Object.entries(types3); _i < _a.length; _i++) { + var _b = _a[_i], typeName = _b[0], internal = _b[1]; + fragments = __assign(__assign({}, fragments), on2(typeName, internal)); + } + return fragments; + } + function scalarType() { + var _a; + var scalar = (_a = {}, _a[typeSymbol] = exports.GraphQLType.SCALAR, _a); + return scalar; + } + var types2 = ( + /** @class */ + function() { + function types3() { + } + Object.defineProperty(types3, "number", { + get: function() { + return scalarType(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(types3, "string", { + get: function() { + return scalarType(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(types3, "boolean", { + get: function() { + return scalarType(); + }, + enumerable: false, + configurable: true + }); + types3.constant = function(_c) { + return scalarType(); + }; + types3.oneOf = function(_e3) { + return scalarType(); + }; + types3.custom = function() { + return scalarType(); + }; + types3.optional = types3; + return types3; + }() + ); + exports.alias = alias; + exports.fragment = fragment; + exports.fragmentToString = fragmentToString; + exports.mutation = mutation; + exports.on = on2; + exports.onUnion = onUnion; + exports.optional = optional; + exports.params = params2; + exports.paramsSymbol = paramsSymbol; + exports.query = query2; + exports.rawString = rawString; + exports.render = render; + exports.subscription = subscription; + exports.typeSymbol = typeSymbol; + exports.types = types2; + } +}); + +// +var require_fast_content_type_parse = __commonJS({ + ""(exports, module2) { + "use strict"; + var NullObject = function NullObject2() { + }; + NullObject.prototype = /* @__PURE__ */ Object.create(null); + var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu; + var quotedPairRE = /\\([\v\u0020-\u00ff])/gu; + var mediaTypeRE = /^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u; + var defaultContentType = { type: "", parameters: new NullObject() }; + Object.freeze(defaultContentType.parameters); + Object.freeze(defaultContentType); + function parse2(header) { + if (typeof header !== "string") { + throw new TypeError("argument header is required and must be a string"); + } + let index = header.indexOf(";"); + const type = index !== -1 ? header.slice(0, index).trim() : header.trim(); + if (mediaTypeRE.test(type) === false) { + throw new TypeError("invalid media type"); + } + const result = { + type: type.toLowerCase(), + parameters: new NullObject() + }; + if (index === -1) { + return result; + } + let key; + let match; + let value; + paramRE.lastIndex = index; + while (match = paramRE.exec(header)) { + if (match.index !== index) { + throw new TypeError("invalid parameter format"); + } + index += match[0].length; + key = match[1].toLowerCase(); + value = match[2]; + if (value[0] === '"') { + value = value.slice(1, value.length - 1); + quotedPairRE.test(value) && (value = value.replace(quotedPairRE, "$1")); + } + result.parameters[key] = value; + } + if (index !== header.length) { + throw new TypeError("invalid parameter format"); + } + return result; + } + function safeParse2(header) { + if (typeof header !== "string") { + return defaultContentType; + } + let index = header.indexOf(";"); + const type = index !== -1 ? header.slice(0, index).trim() : header.trim(); + if (mediaTypeRE.test(type) === false) { + return defaultContentType; + } + const result = { + type: type.toLowerCase(), + parameters: new NullObject() + }; + if (index === -1) { + return result; + } + let key; + let match; + let value; + paramRE.lastIndex = index; + while (match = paramRE.exec(header)) { + if (match.index !== index) { + return defaultContentType; + } + index += match[0].length; + key = match[1].toLowerCase(); + value = match[2]; + if (value[0] === '"') { + value = value.slice(1, value.length - 1); + quotedPairRE.test(value) && (value = value.replace(quotedPairRE, "$1")); + } + result.parameters[key] = value; + } + if (index !== header.length) { + return defaultContentType; + } + return result; + } + module2.exports.default = { parse: parse2, safeParse: safeParse2 }; + module2.exports.parse = parse2; + module2.exports.safeParse = safeParse2; + module2.exports.defaultContentType = defaultContentType; + } +}); + +// +var require_posix = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.sync = exports.isexe = void 0; + var fs_1 = __require("fs"); + var promises_1 = __require("fs/promises"); + var isexe = async (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(await (0, promises_1.stat)(path), options); + } catch (e5) { + const er2 = e5; + if (ignoreErrors || er2.code === "EACCES") + return false; + throw er2; + } + }; + exports.isexe = isexe; + var sync = (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat((0, fs_1.statSync)(path), options); + } catch (e5) { + const er2 = e5; + if (ignoreErrors || er2.code === "EACCES") + return false; + throw er2; + } + }; + exports.sync = sync; + var checkStat = (stat, options) => stat.isFile() && checkMode(stat, options); + var checkMode = (stat, options) => { + const myUid = options.uid ?? process.getuid?.(); + const myGroups = options.groups ?? process.getgroups?.() ?? []; + const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]; + if (myUid === void 0 || myGid === void 0) { + throw new Error("cannot get uid or gid"); + } + const groups = /* @__PURE__ */ new Set([myGid, ...myGroups]); + const mod = stat.mode; + const uid = stat.uid; + const gid = stat.gid; + const u5 = parseInt("100", 8); + const g2 = parseInt("010", 8); + const o8 = parseInt("001", 8); + const ug = u5 | g2; + return !!(mod & o8 || mod & g2 && groups.has(gid) || mod & u5 && uid === myUid || mod & ug && myUid === 0); + }; + } +}); + +// +var require_win32 = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.sync = exports.isexe = void 0; + var fs_1 = __require("fs"); + var promises_1 = __require("fs/promises"); + var isexe = async (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(await (0, promises_1.stat)(path), path, options); + } catch (e5) { + const er2 = e5; + if (ignoreErrors || er2.code === "EACCES") + return false; + throw er2; + } + }; + exports.isexe = isexe; + var sync = (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat((0, fs_1.statSync)(path), path, options); + } catch (e5) { + const er2 = e5; + if (ignoreErrors || er2.code === "EACCES") + return false; + throw er2; + } + }; + exports.sync = sync; + var checkPathExt = (path, options) => { + const { pathExt = process.env.PATHEXT || "" } = options; + const peSplit = pathExt.split(";"); + if (peSplit.indexOf("") !== -1) { + return true; + } + for (let i6 = 0; i6 < peSplit.length; i6++) { + const p5 = peSplit[i6].toLowerCase(); + const ext = path.substring(path.length - p5.length).toLowerCase(); + if (p5 && ext === p5) { + return true; + } + } + return false; + }; + var checkStat = (stat, path, options) => stat.isFile() && checkPathExt(path, options); + } +}); + +// +var require_options = __commonJS({ + ""(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + } +}); + +// +var require_cjs = __commonJS({ + ""(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + var desc = Object.getOwnPropertyDescriptor(m8, k3); + if (!desc || ("get" in desc ? !m8.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m8[k3]; + } }; + } + Object.defineProperty(o8, k22, desc); + } : function(o8, m8, k3, k22) { + if (k22 === void 0) + k22 = k3; + o8[k22] = m8[k3]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o8, v4) { + Object.defineProperty(o8, "default", { enumerable: true, value: v4 }); + } : function(o8, v4) { + o8["default"] = v4; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k3 in mod) + if (k3 !== "default" && Object.prototype.hasOwnProperty.call(mod, k3)) + __createBinding(result, mod, k3); + } + __setModuleDefault(result, mod); + return result; + }; + var __exportStar = exports && exports.__exportStar || function(m8, exports2) { + for (var p5 in m8) + if (p5 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p5)) + __createBinding(exports2, m8, p5); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.sync = exports.isexe = exports.posix = exports.win32 = void 0; + var posix = __importStar(require_posix()); + exports.posix = posix; + var win32 = __importStar(require_win32()); + exports.win32 = win32; + __exportStar(require_options(), exports); + var platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform; + var impl = platform === "win32" ? win32 : posix; + exports.isexe = impl.isexe; + exports.sync = impl.sync; + } +}); + +// +var require_lib2 = __commonJS({ + ""(exports, module2) { + var { isexe, sync: isexeSync } = require_cjs(); + var { join: join5, delimiter, sep: sep2, posix } = __require("path"); + var isWindows = process.platform === "win32"; + var rSlash = new RegExp(`[${posix.sep}${sep2 === posix.sep ? "" : sep2}]`.replace(/(\\)/g, "\\$1")); + var rRel = new RegExp(`^\\.${rSlash.source}`); + var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" }); + var getPathInfo = (cmd, { + path: optPath = process.env.PATH, + pathExt: optPathExt = process.env.PATHEXT, + delimiter: optDelimiter = delimiter + }) => { + const pathEnv = cmd.match(rSlash) ? [""] : [ + // windows always checks the cwd first + ...isWindows ? [process.cwd()] : [], + ...(optPath || /* istanbul ignore next: very unusual */ + "").split(optDelimiter) + ]; + if (isWindows) { + const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter); + const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()]); + if (cmd.includes(".") && pathExt[0] !== "") { + pathExt.unshift(""); + } + return { pathEnv, pathExt, pathExtExe }; + } + return { pathEnv, pathExt: [""] }; + }; + var getPathPart = (raw, cmd) => { + const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw; + const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : ""; + return prefix + join5(pathPart, cmd); + }; + var which2 = async (cmd, opt = {}) => { + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); + const found = []; + for (const envPart of pathEnv) { + const p5 = getPathPart(envPart, cmd); + for (const ext of pathExt) { + const withExt = p5 + ext; + const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true }); + if (is) { + if (!opt.all) { + return withExt; + } + found.push(withExt); + } + } + } + if (opt.all && found.length) { + return found; + } + if (opt.nothrow) { + return null; + } + throw getNotFoundError(cmd); + }; + var whichSync = (cmd, opt = {}) => { + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt); + const found = []; + for (const pathEnvPart of pathEnv) { + const p5 = getPathPart(pathEnvPart, cmd); + for (const ext of pathExt) { + const withExt = p5 + ext; + const is = isexeSync(withExt, { pathExt: pathExtExe, ignoreErrors: true }); + if (is) { + if (!opt.all) { + return withExt; + } + found.push(withExt); + } + } + } + if (opt.all && found.length) { + return found; + } + if (opt.nothrow) { + return null; + } + throw getNotFoundError(cmd); + }; + module2.exports = which2; + which2.sync = whichSync; + } +}); + +// +var require_lockfile = __commonJS({ + ""(exports, module2) { + module2.exports = /******/ + function(modules) { + var installedModules = {}; + function __webpack_require__(moduleId) { + if (installedModules[moduleId]) { + return installedModules[moduleId].exports; + } + var module3 = installedModules[moduleId] = { + /******/ + i: moduleId, + /******/ + l: false, + /******/ + exports: {} + /******/ + }; + modules[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__); + module3.l = true; + return module3.exports; + } + __webpack_require__.m = modules; + __webpack_require__.c = installedModules; + __webpack_require__.i = function(value) { + return value; + }; + __webpack_require__.d = function(exports2, name, getter) { + if (!__webpack_require__.o(exports2, name)) { + Object.defineProperty(exports2, name, { + /******/ + configurable: false, + /******/ + enumerable: true, + /******/ + get: getter + /******/ + }); + } + }; + __webpack_require__.n = function(module3) { + var getter = module3 && module3.__esModule ? ( + /******/ + function getDefault() { + return module3["default"]; + } + ) : ( + /******/ + function getModuleExports() { + return module3; + } + ); + __webpack_require__.d(getter, "a", getter); + return getter; + }; + __webpack_require__.o = function(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); + }; + __webpack_require__.p = ""; + return __webpack_require__(__webpack_require__.s = 14); + }([ + /* 0 */ + /***/ + function(module3, exports2) { + module3.exports = __require("path"); + }, + /* 1 */ + /***/ + function(module3, exports2, __webpack_require__) { + "use strict"; + exports2.__esModule = true; + var _promise = __webpack_require__(173); + var _promise2 = _interopRequireDefault(_promise); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + exports2.default = function(fn2) { + return function() { + var gen = fn2.apply(this, arguments); + return new _promise2.default(function(resolve, reject) { + function step(key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + if (info.done) { + resolve(value); + } else { + return _promise2.default.resolve(value).then(function(value2) { + step("next", value2); + }, function(err) { + step("throw", err); + }); + } + } + return step("next"); + }); + }; + }; + }, + /* 2 */ + /***/ + function(module3, exports2) { + module3.exports = __require("util"); + }, + /* 3 */ + /***/ + function(module3, exports2) { + module3.exports = __require("fs"); + }, + /* 4 */ + /***/ + function(module3, exports2, __webpack_require__) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + class MessageError extends Error { + constructor(msg, code) { + super(msg); + this.code = code; + } + } + exports2.MessageError = MessageError; + class ProcessSpawnError extends MessageError { + constructor(msg, code, process4) { + super(msg, code); + this.process = process4; + } + } + exports2.ProcessSpawnError = ProcessSpawnError; + class SecurityError extends MessageError { + } + exports2.SecurityError = SecurityError; + class ProcessTermError extends MessageError { + } + exports2.ProcessTermError = ProcessTermError; + class ResponseError extends Error { + constructor(msg, responseCode) { + super(msg); + this.responseCode = responseCode; + } + } + exports2.ResponseError = ResponseError; + }, + /* 5 */ + /***/ + function(module3, exports2, __webpack_require__) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.getFirstSuitableFolder = exports2.readFirstAvailableStream = exports2.makeTempDir = exports2.hardlinksWork = exports2.writeFilePreservingEol = exports2.getFileSizeOnDisk = exports2.walk = exports2.symlink = exports2.find = exports2.readJsonAndFile = exports2.readJson = exports2.readFileAny = exports2.hardlinkBulk = exports2.copyBulk = exports2.unlink = exports2.glob = exports2.link = exports2.chmod = exports2.lstat = exports2.exists = exports2.mkdirp = exports2.stat = exports2.access = exports2.rename = exports2.readdir = exports2.realpath = exports2.readlink = exports2.writeFile = exports2.open = exports2.readFileBuffer = exports2.lockQueue = exports2.constants = void 0; + var _asyncToGenerator2; + function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(1)); + } + let buildActionsForCopy = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, events, possibleExtraneous, reporter) { + let build = (() => { + var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) { + const src = data.src, dest = data.dest, type = data.type; + const onFresh = data.onFresh || noop2; + const onDone = data.onDone || noop2; + if (files.has(dest.toLowerCase())) { + reporter.verbose(`The case-insensitive file ${dest} shouldn't be copied twice in one bulk copy`); + } else { + files.add(dest.toLowerCase()); + } + if (type === "symlink") { + yield mkdirp((_path || _load_path()).default.dirname(dest)); + onFresh(); + actions.symlink.push({ + dest, + linkname: src + }); + onDone(); + return; + } + if (events.ignoreBasenames.indexOf((_path || _load_path()).default.basename(src)) >= 0) { + return; + } + const srcStat = yield lstat(src); + let srcFiles; + if (srcStat.isDirectory()) { + srcFiles = yield readdir(src); + } + let destStat; + try { + destStat = yield lstat(dest); + } catch (e5) { + if (e5.code !== "ENOENT") { + throw e5; + } + } + if (destStat) { + const bothSymlinks = srcStat.isSymbolicLink() && destStat.isSymbolicLink(); + const bothFolders = srcStat.isDirectory() && destStat.isDirectory(); + const bothFiles = srcStat.isFile() && destStat.isFile(); + if (bothFiles && artifactFiles.has(dest)) { + onDone(); + reporter.verbose(reporter.lang("verboseFileSkipArtifact", src)); + return; + } + if (bothFiles && srcStat.size === destStat.size && (0, (_fsNormalized || _load_fsNormalized()).fileDatesEqual)(srcStat.mtime, destStat.mtime)) { + onDone(); + reporter.verbose(reporter.lang("verboseFileSkip", src, dest, srcStat.size, +srcStat.mtime)); + return; + } + if (bothSymlinks) { + const srcReallink = yield readlink(src); + if (srcReallink === (yield readlink(dest))) { + onDone(); + reporter.verbose(reporter.lang("verboseFileSkipSymlink", src, dest, srcReallink)); + return; + } + } + if (bothFolders) { + const destFiles = yield readdir(dest); + invariant(srcFiles, "src files not initialised"); + for (var _iterator4 = destFiles, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator](); ; ) { + var _ref6; + if (_isArray4) { + if (_i4 >= _iterator4.length) + break; + _ref6 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) + break; + _ref6 = _i4.value; + } + const file = _ref6; + if (srcFiles.indexOf(file) < 0) { + const loc = (_path || _load_path()).default.join(dest, file); + possibleExtraneous.add(loc); + if ((yield lstat(loc)).isDirectory()) { + for (var _iterator5 = yield readdir(loc), _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator](); ; ) { + var _ref7; + if (_isArray5) { + if (_i5 >= _iterator5.length) + break; + _ref7 = _iterator5[_i5++]; + } else { + _i5 = _iterator5.next(); + if (_i5.done) + break; + _ref7 = _i5.value; + } + const file2 = _ref7; + possibleExtraneous.add((_path || _load_path()).default.join(loc, file2)); + } + } + } + } + } + } + if (destStat && destStat.isSymbolicLink()) { + yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(dest); + destStat = null; + } + if (srcStat.isSymbolicLink()) { + onFresh(); + const linkname = yield readlink(src); + actions.symlink.push({ + dest, + linkname + }); + onDone(); + } else if (srcStat.isDirectory()) { + if (!destStat) { + reporter.verbose(reporter.lang("verboseFileFolder", dest)); + yield mkdirp(dest); + } + const destParts = dest.split((_path || _load_path()).default.sep); + while (destParts.length) { + files.add(destParts.join((_path || _load_path()).default.sep).toLowerCase()); + destParts.pop(); + } + invariant(srcFiles, "src files not initialised"); + let remaining = srcFiles.length; + if (!remaining) { + onDone(); + } + for (var _iterator6 = srcFiles, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator](); ; ) { + var _ref8; + if (_isArray6) { + if (_i6 >= _iterator6.length) + break; + _ref8 = _iterator6[_i6++]; + } else { + _i6 = _iterator6.next(); + if (_i6.done) + break; + _ref8 = _i6.value; + } + const file = _ref8; + queue.push({ + dest: (_path || _load_path()).default.join(dest, file), + onFresh, + onDone: function(_onDone) { + function onDone2() { + return _onDone.apply(this, arguments); + } + onDone2.toString = function() { + return _onDone.toString(); + }; + return onDone2; + }(function() { + if (--remaining === 0) { + onDone(); + } + }), + src: (_path || _load_path()).default.join(src, file) + }); + } + } else if (srcStat.isFile()) { + onFresh(); + actions.file.push({ + src, + dest, + atime: srcStat.atime, + mtime: srcStat.mtime, + mode: srcStat.mode + }); + onDone(); + } else { + throw new Error(`unsure how to copy this: ${src}`); + } + }); + return function build2(_x5) { + return _ref5.apply(this, arguments); + }; + })(); + const artifactFiles = new Set(events.artifactFiles || []); + const files = /* @__PURE__ */ new Set(); + for (var _iterator = queue, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ; ) { + var _ref2; + if (_isArray) { + if (_i >= _iterator.length) + break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) + break; + _ref2 = _i.value; + } + const item = _ref2; + const onDone = item.onDone; + item.onDone = function() { + events.onProgress(item.dest); + if (onDone) { + onDone(); + } + }; + } + events.onStart(queue.length); + const actions = { + file: [], + symlink: [], + link: [] + }; + while (queue.length) { + const items = queue.splice(0, CONCURRENT_QUEUE_ITEMS); + yield Promise.all(items.map(build)); + } + for (var _iterator2 = artifactFiles, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ; ) { + var _ref3; + if (_isArray2) { + if (_i2 >= _iterator2.length) + break; + _ref3 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) + break; + _ref3 = _i2.value; + } + const file = _ref3; + if (possibleExtraneous.has(file)) { + reporter.verbose(reporter.lang("verboseFilePhantomExtraneous", file)); + possibleExtraneous.delete(file); + } + } + for (var _iterator3 = possibleExtraneous, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator](); ; ) { + var _ref4; + if (_isArray3) { + if (_i3 >= _iterator3.length) + break; + _ref4 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) + break; + _ref4 = _i3.value; + } + const loc = _ref4; + if (files.has(loc.toLowerCase())) { + possibleExtraneous.delete(loc); + } + } + return actions; + }); + return function buildActionsForCopy2(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; + })(); + let buildActionsForHardlink = (() => { + var _ref9 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, events, possibleExtraneous, reporter) { + let build = (() => { + var _ref13 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) { + const src = data.src, dest = data.dest; + const onFresh = data.onFresh || noop2; + const onDone = data.onDone || noop2; + if (files.has(dest.toLowerCase())) { + onDone(); + return; + } + files.add(dest.toLowerCase()); + if (events.ignoreBasenames.indexOf((_path || _load_path()).default.basename(src)) >= 0) { + return; + } + const srcStat = yield lstat(src); + let srcFiles; + if (srcStat.isDirectory()) { + srcFiles = yield readdir(src); + } + const destExists = yield exists(dest); + if (destExists) { + const destStat = yield lstat(dest); + const bothSymlinks = srcStat.isSymbolicLink() && destStat.isSymbolicLink(); + const bothFolders = srcStat.isDirectory() && destStat.isDirectory(); + const bothFiles = srcStat.isFile() && destStat.isFile(); + if (srcStat.mode !== destStat.mode) { + try { + yield access(dest, srcStat.mode); } catch (err) { reporter.verbose(err); } @@ -10442,11 +18663,13 @@ var require_lockfile = __commonJS({ for (var _iterator10 = destFiles, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : _iterator10[Symbol.iterator](); ; ) { var _ref14; if (_isArray10) { - if (_i10 >= _iterator10.length) break; + if (_i10 >= _iterator10.length) + break; _ref14 = _iterator10[_i10++]; } else { _i10 = _iterator10.next(); - if (_i10.done) break; + if (_i10.done) + break; _ref14 = _i10.value; } const file = _ref14; @@ -10457,11 +18680,13 @@ var require_lockfile = __commonJS({ for (var _iterator11 = yield readdir(loc), _isArray11 = Array.isArray(_iterator11), _i11 = 0, _iterator11 = _isArray11 ? _iterator11 : _iterator11[Symbol.iterator](); ; ) { var _ref15; if (_isArray11) { - if (_i11 >= _iterator11.length) break; + if (_i11 >= _iterator11.length) + break; _ref15 = _iterator11[_i11++]; } else { _i11 = _iterator11.next(); - if (_i11.done) break; + if (_i11.done) + break; _ref15 = _i11.value; } const file2 = _ref15; @@ -10496,11 +18721,13 @@ var require_lockfile = __commonJS({ for (var _iterator12 = srcFiles, _isArray12 = Array.isArray(_iterator12), _i12 = 0, _iterator12 = _isArray12 ? _iterator12 : _iterator12[Symbol.iterator](); ; ) { var _ref16; if (_isArray12) { - if (_i12 >= _iterator12.length) break; + if (_i12 >= _iterator12.length) + break; _ref16 = _iterator12[_i12++]; } else { _i12 = _iterator12.next(); - if (_i12.done) break; + if (_i12.done) + break; _ref16 = _i12.value; } const file = _ref16; @@ -10544,11 +18771,13 @@ var require_lockfile = __commonJS({ for (var _iterator7 = queue, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator](); ; ) { var _ref10; if (_isArray7) { - if (_i7 >= _iterator7.length) break; + if (_i7 >= _iterator7.length) + break; _ref10 = _iterator7[_i7++]; } else { _i7 = _iterator7.next(); - if (_i7.done) break; + if (_i7.done) + break; _ref10 = _i7.value; } const item = _ref10; @@ -10571,11 +18800,13 @@ var require_lockfile = __commonJS({ for (var _iterator8 = artifactFiles, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator](); ; ) { var _ref11; if (_isArray8) { - if (_i8 >= _iterator8.length) break; + if (_i8 >= _iterator8.length) + break; _ref11 = _iterator8[_i8++]; } else { _i8 = _iterator8.next(); - if (_i8.done) break; + if (_i8.done) + break; _ref11 = _i8.value; } const file = _ref11; @@ -10587,11 +18818,13 @@ var require_lockfile = __commonJS({ for (var _iterator9 = possibleExtraneous, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator](); ; ) { var _ref12; if (_isArray9) { - if (_i9 >= _iterator9.length) break; + if (_i9 >= _iterator9.length) + break; _ref12 = _iterator9[_i9++]; } else { _i9 = _iterator9.next(); - if (_i9.done) break; + if (_i9.done) + break; _ref12 = _i9.value; } const loc = _ref12; @@ -10687,11 +18920,13 @@ var require_lockfile = __commonJS({ for (var _iterator13 = files, _isArray13 = Array.isArray(_iterator13), _i13 = 0, _iterator13 = _isArray13 ? _iterator13 : _iterator13[Symbol.iterator](); ; ) { var _ref22; if (_isArray13) { - if (_i13 >= _iterator13.length) break; + if (_i13 >= _iterator13.length) + break; _ref22 = _iterator13[_i13++]; } else { _i13 = _iterator13.next(); - if (_i13.done) break; + if (_i13.done) + break; _ref22 = _i13.value; } const file = _ref22; @@ -10794,11 +19029,13 @@ var require_lockfile = __commonJS({ for (var _iterator14 = filenames, _isArray14 = Array.isArray(_iterator14), _i14 = 0, _iterator14 = _isArray14 ? _iterator14 : _iterator14[Symbol.iterator](); ; ) { var _ref28; if (_isArray14) { - if (_i14 >= _iterator14.length) break; + if (_i14 >= _iterator14.length) + break; _ref28 = _iterator14[_i14++]; } else { _i14 = _iterator14.next(); - if (_i14.done) break; + if (_i14.done) + break; _ref28 = _i14.value; } const name = _ref28; @@ -10837,11 +19074,11 @@ var require_lockfile = __commonJS({ return void 0; } const buffer = yield readFileBuffer(path); - for (let i = 0; i < buffer.length; ++i) { - if (buffer[i] === cr) { + for (let i6 = 0; i6 < buffer.length; ++i6) { + if (buffer[i6] === cr2) { return "\r\n"; } - if (buffer[i] === lf) { + if (buffer[i6] === lf) { return "\n"; } } @@ -10899,11 +19136,13 @@ var require_lockfile = __commonJS({ for (var _iterator15 = paths, _isArray15 = Array.isArray(_iterator15), _i15 = 0, _iterator15 = _isArray15 ? _iterator15 : _iterator15[Symbol.iterator](); ; ) { var _ref35; if (_isArray15) { - if (_i15 >= _iterator15.length) break; + if (_i15 >= _iterator15.length) + break; _ref35 = _iterator15[_i15++]; } else { _i15 = _iterator15.next(); - if (_i15.done) break; + if (_i15.done) + break; _ref35 = _i15.value; } const path = _ref35; @@ -10928,11 +19167,13 @@ var require_lockfile = __commonJS({ for (var _iterator16 = paths, _isArray16 = Array.isArray(_iterator16), _i16 = 0, _iterator16 = _isArray16 ? _iterator16 : _iterator16[Symbol.iterator](); ; ) { var _ref37; if (_isArray16) { - if (_i16 >= _iterator16.length) break; + if (_i16 >= _iterator16.length) + break; _ref37 = _iterator16[_i16++]; } else { _i16 = _iterator16.next(); - if (_i16.done) break; + if (_i16.done) + break; _ref37 = _i16.value; } const folder = _ref37; @@ -11001,7 +19242,8 @@ var require_lockfile = __commonJS({ var newObj = {}; if (obj != null) { for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + if (Object.prototype.hasOwnProperty.call(obj, key)) + newObj[key] = obj[key]; } } newObj.default = obj; @@ -11031,7 +19273,7 @@ var require_lockfile = __commonJS({ const lstat = exports2.lstat = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.lstat); const chmod = exports2.chmod = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.chmod); const link = exports2.link = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.link); - const glob = exports2.glob = (0, (_promise2 || _load_promise2()).promisify)((_glob || _load_glob()).default); + const glob2 = exports2.glob = (0, (_promise2 || _load_promise2()).promisify)((_glob || _load_glob()).default); exports2.unlink = (_fsNormalized || _load_fsNormalized()).unlink; const CONCURRENT_QUEUE_ITEMS = (_fs || _load_fs()).default.copyFile ? 128 : 4; const fsSymlink = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.symlink); @@ -11062,12 +19304,12 @@ var require_lockfile = __commonJS({ function normalizeOS(body) { return body.replace(/\r\n/g, "\n"); } - const cr = "\r".charCodeAt(0); + const cr2 = "\r".charCodeAt(0); const lf = "\n".charCodeAt(0); }, /* 6 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true @@ -11158,10 +19400,10 @@ var require_lockfile = __commonJS({ }, /* 7 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; var NODE_ENV = process.env.NODE_ENV; - var invariant = function(condition, format, a, b, c, d, e, f) { + var invariant = function(condition, format, a7, b3, c3, d5, e5, f6) { if (NODE_ENV !== "production") { if (format === void 0) { throw new Error("invariant requires an error message argument"); @@ -11174,7 +19416,7 @@ var require_lockfile = __commonJS({ "Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings." ); } else { - var args = [a, b, c, d, e, f]; + var args = [a7, b3, c3, d5, e5, f6]; var argIndex = 0; error = new Error( format.replace(/%s/g, function() { @@ -11187,24 +19429,25 @@ var require_lockfile = __commonJS({ throw error; } }; - module2.exports = invariant; + module3.exports = invariant; }, , /* 9 */ /***/ - function(module2, exports2) { - module2.exports = __require("crypto"); + function(module3, exports2) { + module3.exports = __require("crypto"); }, , /* 11 */ /***/ - function(module2, exports2) { - var global = module2.exports = typeof window != "undefined" && window.Math == Math ? window : typeof self != "undefined" && self.Math == Math ? self : Function("return this")(); - if (typeof __g == "number") __g = global; + function(module3, exports2) { + var global2 = module3.exports = typeof window != "undefined" && window.Math == Math ? window : typeof self != "undefined" && self.Math == Math ? self : Function("return this")(); + if (typeof __g == "number") + __g = global2; }, /* 12 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true @@ -11219,16 +19462,16 @@ var require_lockfile = __commonJS({ exports2.compareSortedArrays = compareSortedArrays; exports2.sleep = sleep; const _camelCase = __webpack_require__(176); - function sortAlpha(a, b) { - const shortLen = Math.min(a.length, b.length); - for (let i = 0; i < shortLen; i++) { - const aChar = a.charCodeAt(i); - const bChar = b.charCodeAt(i); + function sortAlpha(a7, b3) { + const shortLen = Math.min(a7.length, b3.length); + for (let i6 = 0; i6 < shortLen; i6++) { + const aChar = a7.charCodeAt(i6); + const bChar = b3.charCodeAt(i6); if (aChar !== bChar) { return aChar - bChar; } } - return a.length - b.length; + return a7.length - b3.length; } function entries(obj) { const entries2 = []; @@ -11273,8 +19516,8 @@ var require_lockfile = __commonJS({ if (array1.length !== array2.length) { return false; } - for (let i = 0, len = array1.length; i < len; i++) { - if (array1[i] !== array2[i]) { + for (let i6 = 0, len = array1.length; i6 < len; i6++) { + if (array1[i6] !== array2[i6]) { return false; } } @@ -11288,19 +19531,19 @@ var require_lockfile = __commonJS({ }, /* 13 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var store = __webpack_require__(107)("wks"); var uid = __webpack_require__(111); var Symbol2 = __webpack_require__(11).Symbol; var USE_SYMBOL = typeof Symbol2 == "function"; - var $exports = module2.exports = function(name) { + var $exports = module3.exports = function(name) { return store[name] || (store[name] = USE_SYMBOL && Symbol2[name] || (USE_SYMBOL ? Symbol2 : uid)("Symbol." + name)); }; $exports.store = store; }, /* 14 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true @@ -11359,7 +19602,8 @@ var require_lockfile = __commonJS({ var newObj = {}; if (obj != null) { for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; + if (Object.prototype.hasOwnProperty.call(obj, key)) + newObj[key] = obj[key]; } } newObj.default = obj; @@ -11486,11 +19730,13 @@ var require_lockfile = __commonJS({ for (var _iterator = sortedPatternsKeys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ; ) { var _ref; if (_isArray) { - if (_i >= _iterator.length) break; + if (_i >= _iterator.length) + break; _ref = _iterator[_i++]; } else { _i = _iterator.next(); - if (_i.done) break; + if (_i.done) + break; _ref = _i.value; } const pattern = _ref; @@ -11534,14 +19780,14 @@ var require_lockfile = __commonJS({ , /* 17 */ /***/ - function(module2, exports2) { - module2.exports = __require("stream"); + function(module3, exports2) { + module3.exports = __require("stream"); }, , , /* 20 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true @@ -11552,11 +19798,13 @@ var require_lockfile = __commonJS({ for (var _iterator = obj, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ; ) { var _ref; if (_isArray) { - if (_i >= _iterator.length) break; + if (_i >= _iterator.length) + break; _ref = _iterator[_i++]; } else { _i = _iterator.next(); - if (_i.done) break; + if (_i.done) + break; _ref = _i.value; } const item = _ref; @@ -11576,31 +19824,33 @@ var require_lockfile = __commonJS({ , /* 22 */ /***/ - function(module2, exports2) { - module2.exports = __require("assert"); + function(module3, exports2) { + module3.exports = __require("assert"); }, /* 23 */ /***/ - function(module2, exports2) { - var core = module2.exports = { version: "2.5.7" }; - if (typeof __e == "number") __e = core; + function(module3, exports2) { + var core = module3.exports = { version: "2.5.7" }; + if (typeof __e == "number") + __e = core; }, , , , /* 27 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var isObject = __webpack_require__(34); - module2.exports = function(it) { - if (!isObject(it)) throw TypeError(it + " is not an object!"); - return it; + module3.exports = function(it2) { + if (!isObject(it2)) + throw TypeError(it2 + " is not an object!"); + return it2; }; }, , /* 29 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true @@ -11634,10 +19884,10 @@ var require_lockfile = __commonJS({ , /* 31 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var dP = __webpack_require__(50); var createDesc = __webpack_require__(106); - module2.exports = __webpack_require__(33) ? function(object, key, value) { + module3.exports = __webpack_require__(33) ? function(object, key, value) { return dP.f(object, key, createDesc(1, value)); } : function(object, key, value) { object[key] = value; @@ -11646,7 +19896,7 @@ var require_lockfile = __commonJS({ }, /* 32 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var buffer = __webpack_require__(63); var Buffer2 = buffer.Buffer; function copyProps(src, dst) { @@ -11655,7 +19905,7 @@ var require_lockfile = __commonJS({ } } if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) { - module2.exports = buffer; + module3.exports = buffer; } else { copyProps(buffer, exports2); exports2.Buffer = SafeBuffer; @@ -11701,8 +19951,8 @@ var require_lockfile = __commonJS({ }, /* 33 */ /***/ - function(module2, exports2, __webpack_require__) { - module2.exports = !__webpack_require__(85)(function() { + function(module3, exports2, __webpack_require__) { + module3.exports = !__webpack_require__(85)(function() { return Object.defineProperty({}, "a", { get: function() { return 7; } }).a != 7; @@ -11710,27 +19960,27 @@ var require_lockfile = __commonJS({ }, /* 34 */ /***/ - function(module2, exports2) { - module2.exports = function(it) { - return typeof it === "object" ? it !== null : typeof it === "function"; + function(module3, exports2) { + module3.exports = function(it2) { + return typeof it2 === "object" ? it2 !== null : typeof it2 === "function"; }; }, /* 35 */ /***/ - function(module2, exports2) { - module2.exports = {}; + function(module3, exports2) { + module3.exports = {}; }, /* 36 */ /***/ - function(module2, exports2) { - module2.exports = __require("os"); + function(module3, exports2) { + module3.exports = __require("os"); }, , , , /* 40 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true @@ -11743,7 +19993,7 @@ var require_lockfile = __commonJS({ setTimeout(resolve, delay); }); } - function promisify(fn, firstData) { + function promisify(fn2, firstData) { return function(...args) { return new Promise(function(resolve, reject) { args.push(function(err, ...result) { @@ -11761,7 +20011,7 @@ var require_lockfile = __commonJS({ resolve(res); } }); - fn.apply(null, args); + fn2.apply(null, args); }); }; } @@ -11774,7 +20024,7 @@ var require_lockfile = __commonJS({ return Promise.resolve(results); } return new Promise((resolve, reject) => { - for (let i = 0; i < concurrency; i++) { + for (let i6 = 0; i6 < concurrency; i6++) { next(); } function next() { @@ -11797,8 +20047,8 @@ var require_lockfile = __commonJS({ }, /* 41 */ /***/ - function(module2, exports2, __webpack_require__) { - var global = __webpack_require__(11); + function(module3, exports2, __webpack_require__) { + var global2 = __webpack_require__(11); var core = __webpack_require__(23); var ctx = __webpack_require__(48); var hide = __webpack_require__(31); @@ -11813,34 +20063,37 @@ var require_lockfile = __commonJS({ var IS_WRAP = type & $export.W; var exports3 = IS_GLOBAL ? core : core[name] || (core[name] = {}); var expProto = exports3[PROTOTYPE]; - var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]; + var target = IS_GLOBAL ? global2 : IS_STATIC ? global2[name] : (global2[name] || {})[PROTOTYPE]; var key, own, out; - if (IS_GLOBAL) source = name; + if (IS_GLOBAL) + source = name; for (key in source) { own = !IS_FORCED && target && target[key] !== void 0; - if (own && has(exports3, key)) continue; + if (own && has(exports3, key)) + continue; out = own ? target[key] : source[key]; - exports3[key] = IS_GLOBAL && typeof target[key] != "function" ? source[key] : IS_BIND && own ? ctx(out, global) : IS_WRAP && target[key] == out ? function(C) { - var F = function(a, b, c) { - if (this instanceof C) { + exports3[key] = IS_GLOBAL && typeof target[key] != "function" ? source[key] : IS_BIND && own ? ctx(out, global2) : IS_WRAP && target[key] == out ? function(C4) { + var F4 = function(a7, b3, c3) { + if (this instanceof C4) { switch (arguments.length) { case 0: - return new C(); + return new C4(); case 1: - return new C(a); + return new C4(a7); case 2: - return new C(a, b); + return new C4(a7, b3); } - return new C(a, b, c); + return new C4(a7, b3, c3); } - return C.apply(this, arguments); + return C4.apply(this, arguments); }; - F[PROTOTYPE] = C[PROTOTYPE]; - return F; + F4[PROTOTYPE] = C4[PROTOTYPE]; + return F4; }(out) : IS_PROTO && typeof out == "function" ? ctx(Function.call, out) : out; if (IS_PROTO) { (exports3.virtual || (exports3.virtual = {}))[key] = out; - if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out); + if (type & $export.R && expProto && !expProto[key]) + hide(expProto, key, out); } } }; @@ -11852,24 +20105,25 @@ var require_lockfile = __commonJS({ $export.W = 32; $export.U = 64; $export.R = 128; - module2.exports = $export; + module3.exports = $export; }, /* 42 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { try { var util = __webpack_require__(2); - if (typeof util.inherits !== "function") throw ""; - module2.exports = util.inherits; - } catch (e) { - module2.exports = __webpack_require__(224); + if (typeof util.inherits !== "function") + throw ""; + module3.exports = util.inherits; + } catch (e5) { + module3.exports = __webpack_require__(224); } }, , , /* 45 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true @@ -11889,72 +20143,77 @@ var require_lockfile = __commonJS({ }, /* 46 */ /***/ - function(module2, exports2) { - module2.exports = function(it) { - if (typeof it != "function") throw TypeError(it + " is not a function!"); - return it; + function(module3, exports2) { + module3.exports = function(it2) { + if (typeof it2 != "function") + throw TypeError(it2 + " is not a function!"); + return it2; }; }, /* 47 */ /***/ - function(module2, exports2) { + function(module3, exports2) { var toString = {}.toString; - module2.exports = function(it) { - return toString.call(it).slice(8, -1); + module3.exports = function(it2) { + return toString.call(it2).slice(8, -1); }; }, /* 48 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var aFunction = __webpack_require__(46); - module2.exports = function(fn, that, length) { - aFunction(fn); - if (that === void 0) return fn; + module3.exports = function(fn2, that, length) { + aFunction(fn2); + if (that === void 0) + return fn2; switch (length) { case 1: - return function(a) { - return fn.call(that, a); + return function(a7) { + return fn2.call(that, a7); }; case 2: - return function(a, b) { - return fn.call(that, a, b); + return function(a7, b3) { + return fn2.call(that, a7, b3); }; case 3: - return function(a, b, c) { - return fn.call(that, a, b, c); + return function(a7, b3, c3) { + return fn2.call(that, a7, b3, c3); }; } return function() { - return fn.apply(that, arguments); + return fn2.apply(that, arguments); }; }; }, /* 49 */ /***/ - function(module2, exports2) { + function(module3, exports2) { var hasOwnProperty = {}.hasOwnProperty; - module2.exports = function(it, key) { - return hasOwnProperty.call(it, key); + module3.exports = function(it2, key) { + return hasOwnProperty.call(it2, key); }; }, /* 50 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var anObject = __webpack_require__(27); var IE8_DOM_DEFINE = __webpack_require__(184); var toPrimitive = __webpack_require__(201); var dP = Object.defineProperty; - exports2.f = __webpack_require__(33) ? Object.defineProperty : function defineProperty(O, P, Attributes) { - anObject(O); - P = toPrimitive(P, true); + exports2.f = __webpack_require__(33) ? Object.defineProperty : function defineProperty(O4, P3, Attributes) { + anObject(O4); + P3 = toPrimitive(P3, true); anObject(Attributes); - if (IE8_DOM_DEFINE) try { - return dP(O, P, Attributes); - } catch (e) { - } - if ("get" in Attributes || "set" in Attributes) throw TypeError("Accessors not supported!"); - if ("value" in Attributes) O[P] = Attributes.value; - return O; + if (IE8_DOM_DEFINE) + try { + return dP(O4, P3, Attributes); + } catch (e5) { + } + if ("get" in Attributes || "set" in Attributes) + throw TypeError("Accessors not supported!"); + if ("value" in Attributes) + O4[P3] = Attributes.value; + return O4; }; }, , @@ -11962,12 +20221,12 @@ var require_lockfile = __commonJS({ , /* 54 */ /***/ - function(module2, exports2) { - module2.exports = __require("events"); + function(module3, exports2) { + module3.exports = __require("events"); }, /* 55 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; const Buffer2 = __webpack_require__(32).Buffer; const crypto = __webpack_require__(9); @@ -11990,7 +20249,7 @@ var require_lockfile = __commonJS({ if (!match) { return; } - if (strict && !SPEC_ALGORITHMS.some((a) => a === match[1])) { + if (strict && !SPEC_ALGORITHMS.some((a7) => a7 === match[1])) { return; } this.algorithm = match[1]; @@ -12008,7 +20267,7 @@ var require_lockfile = __commonJS({ if (opts && opts.strict) { if (!// The spec has very restricted productions for algorithms. // https://www.w3.org/TR/CSP2/#source-list-syntax - (SPEC_ALGORITHMS.some((x) => x === this.algorithm) && // Usually, if someone insists on using a "different" base64, we + (SPEC_ALGORITHMS.some((x2) => x2 === this.algorithm) && // Usually, if someone insists on using a "different" base64, we // leave it as-is, since there's multiple standards, and the // specified is not a URL-safe variant. // https://www.w3.org/TR/CSP2/#base64_value @@ -12036,11 +20295,11 @@ var require_lockfile = __commonJS({ if (opts.strict) { sep2 = sep2.replace(/\S+/g, " "); } - return Object.keys(this).map((k) => { - return this[k].map((hash) => { + return Object.keys(this).map((k3) => { + return this[k3].map((hash) => { return Hash.prototype.toString.call(hash, opts); - }).filter((x) => x.length).join(sep2); - }).filter((x) => x.length).join(sep2); + }).filter((x2) => x2.length).join(sep2); + }).filter((x2) => x2.length).join(sep2); } concat(integrity, opts) { const other = typeof integrity === "string" ? integrity : stringify(integrity, opts); @@ -12069,7 +20328,7 @@ var require_lockfile = __commonJS({ }); } } - module2.exports.parse = parse2; + module3.exports.parse = parse2; function parse2(sri, opts) { opts = opts || {}; if (typeof sri === "string") { @@ -12098,7 +20357,7 @@ var require_lockfile = __commonJS({ return acc; }, new Integrity()); } - module2.exports.stringify = stringify; + module3.exports.stringify = stringify; function stringify(obj, opts) { if (obj.algorithm && obj.digest) { return Hash.prototype.toString.call(obj, opts); @@ -12108,7 +20367,7 @@ var require_lockfile = __commonJS({ return Integrity.prototype.toString.call(obj, opts); } } - module2.exports.fromHex = fromHex; + module3.exports.fromHex = fromHex; function fromHex(hexDigest, algorithm, opts) { const optString = opts && opts.options && opts.options.length ? `?${opts.options.join("?")}` : ""; return parse2( @@ -12116,7 +20375,7 @@ var require_lockfile = __commonJS({ opts ); } - module2.exports.fromData = fromData; + module3.exports.fromData = fromData; function fromData(data, opts) { opts = opts || {}; const algorithms = opts.algorithms || ["sha512"]; @@ -12137,25 +20396,25 @@ var require_lockfile = __commonJS({ return acc; }, new Integrity()); } - module2.exports.fromStream = fromStream; + module3.exports.fromStream = fromStream; function fromStream(stream, opts) { opts = opts || {}; - const P = opts.Promise || Promise; + const P3 = opts.Promise || Promise; const istream = integrityStream(opts); - return new P((resolve, reject) => { + return new P3((resolve, reject) => { stream.pipe(istream); stream.on("error", reject); istream.on("error", reject); let sri; - istream.on("integrity", (s) => { - sri = s; + istream.on("integrity", (s5) => { + sri = s5; }); istream.on("end", () => resolve(sri)); istream.on("data", () => { }); }); } - module2.exports.checkData = checkData; + module3.exports.checkData = checkData; function checkData(data, sri, opts) { opts = opts || {}; sri = parse2(sri, opts); @@ -12196,27 +20455,27 @@ var require_lockfile = __commonJS({ throw err; } } - module2.exports.checkStream = checkStream; + module3.exports.checkStream = checkStream; function checkStream(stream, sri, opts) { opts = opts || {}; - const P = opts.Promise || Promise; + const P3 = opts.Promise || Promise; const checker = integrityStream(Object.assign({}, opts, { integrity: sri })); - return new P((resolve, reject) => { + return new P3((resolve, reject) => { stream.pipe(checker); stream.on("error", reject); checker.on("error", reject); let sri2; - checker.on("verified", (s) => { - sri2 = s; + checker.on("verified", (s5) => { + sri2 = s5; }); checker.on("end", () => resolve(sri2)); checker.on("data", () => { }); }); } - module2.exports.integrityStream = integrityStream; + module3.exports.integrityStream = integrityStream; function integrityStream(opts) { opts = opts || {}; const sri = opts.integrity && parse2(opts.integrity, opts); @@ -12233,13 +20492,13 @@ var require_lockfile = __commonJS({ const stream = new Transform({ transform(chunk, enc, cb) { streamSize += chunk.length; - hashes.forEach((h) => h.update(chunk, enc)); + hashes.forEach((h3) => h3.update(chunk, enc)); cb(null, chunk, enc); } }).on("end", () => { const optString = opts.options && opts.options.length ? `?${opts.options.join("?")}` : ""; - const newSri = parse2(hashes.map((h, i) => { - return `${algorithms[i]}-${h.digest("base64")}${optString}`; + const newSri = parse2(hashes.map((h3, i6) => { + return `${algorithms[i6]}-${h3.digest("base64")}${optString}`; }).join(" "), opts); const match = goodSri && newSri.match(sri, opts); if (typeof opts.size === "number" && streamSize !== opts.size) { @@ -12267,7 +20526,7 @@ var require_lockfile = __commonJS({ }); return stream; } - module2.exports.create = createIntegrity; + module3.exports.create = createIntegrity; function createIntegrity(opts) { opts = opts || {}; const algorithms = opts.algorithms || ["sha512"]; @@ -12275,7 +20534,7 @@ var require_lockfile = __commonJS({ const hashes = algorithms.map(crypto.createHash); return { update: function(chunk, enc) { - hashes.forEach((h) => h.update(chunk, enc)); + hashes.forEach((h3) => h3.update(chunk, enc)); return this; }, digest: function(enc) { @@ -12327,13 +20586,13 @@ var require_lockfile = __commonJS({ , /* 60 */ /***/ - function(module2, exports2, __webpack_require__) { - module2.exports = minimatch; + function(module3, exports2, __webpack_require__) { + module3.exports = minimatch; minimatch.Minimatch = Minimatch; var path = { sep: "/" }; try { path = __webpack_require__(0); - } catch (er) { + } catch (er2) { } var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}; var expand2 = __webpack_require__(175); @@ -12349,9 +20608,9 @@ var require_lockfile = __commonJS({ var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?"; var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?"; var reSpecials = charSet("().*{}+?[]^$\\!"); - function charSet(s) { - return s.split("").reduce(function(set, c) { - set[c] = true; + function charSet(s5) { + return s5.split("").reduce(function(set, c3) { + set[c3] = true; return set; }, {}); } @@ -12359,47 +20618,51 @@ var require_lockfile = __commonJS({ minimatch.filter = filter; function filter(pattern, options) { options = options || {}; - return function(p, i, list) { - return minimatch(p, pattern, options); + return function(p5, i6, list) { + return minimatch(p5, pattern, options); }; } - function ext(a, b) { - a = a || {}; - b = b || {}; - var t = {}; - Object.keys(b).forEach(function(k) { - t[k] = b[k]; + function ext(a7, b3) { + a7 = a7 || {}; + b3 = b3 || {}; + var t3 = {}; + Object.keys(b3).forEach(function(k3) { + t3[k3] = b3[k3]; }); - Object.keys(a).forEach(function(k) { - t[k] = a[k]; + Object.keys(a7).forEach(function(k3) { + t3[k3] = a7[k3]; }); - return t; + return t3; } minimatch.defaults = function(def) { - if (!def || !Object.keys(def).length) return minimatch; + if (!def || !Object.keys(def).length) + return minimatch; var orig = minimatch; - var m = function minimatch2(p, pattern, options) { - return orig.minimatch(p, pattern, ext(def, options)); + var m8 = function minimatch2(p5, pattern, options) { + return orig.minimatch(p5, pattern, ext(def, options)); }; - m.Minimatch = function Minimatch2(pattern, options) { + m8.Minimatch = function Minimatch2(pattern, options) { return new orig.Minimatch(pattern, ext(def, options)); }; - return m; + return m8; }; Minimatch.defaults = function(def) { - if (!def || !Object.keys(def).length) return Minimatch; + if (!def || !Object.keys(def).length) + return Minimatch; return minimatch.defaults(def).Minimatch; }; - function minimatch(p, pattern, options) { + function minimatch(p5, pattern, options) { if (typeof pattern !== "string") { throw new TypeError("glob pattern string required"); } - if (!options) options = {}; + if (!options) + options = {}; if (!options.nocomment && pattern.charAt(0) === "#") { return false; } - if (pattern.trim() === "") return p === ""; - return new Minimatch(pattern, options).match(p); + if (pattern.trim() === "") + return p5 === ""; + return new Minimatch(pattern, options).match(p5); } function Minimatch(pattern, options) { if (!(this instanceof Minimatch)) { @@ -12408,7 +20671,8 @@ var require_lockfile = __commonJS({ if (typeof pattern !== "string") { throw new TypeError("glob pattern string required"); } - if (!options) options = {}; + if (!options) + options = {}; pattern = pattern.trim(); if (path.sep !== "/") { pattern = pattern.split(path.sep).join("/"); @@ -12426,7 +20690,8 @@ var require_lockfile = __commonJS({ }; Minimatch.prototype.make = make; function make() { - if (this._made) return; + if (this._made) + return; var pattern = this.pattern; var options = this.options; if (!options.nocomment && pattern.charAt(0) === "#") { @@ -12439,18 +20704,19 @@ var require_lockfile = __commonJS({ } this.parseNegate(); var set = this.globSet = this.braceExpand(); - if (options.debug) this.debug = console.error; + if (options.debug) + this.debug = console.error; this.debug(this.pattern, set); - set = this.globParts = set.map(function(s) { - return s.split(slashSplit); + set = this.globParts = set.map(function(s5) { + return s5.split(slashSplit); }); this.debug(this.pattern, set); - set = set.map(function(s, si, set2) { - return s.map(this.parse, this); + set = set.map(function(s5, si, set2) { + return s5.map(this.parse, this); }, this); this.debug(this.pattern, set); - set = set.filter(function(s) { - return s.indexOf(false) === -1; + set = set.filter(function(s5) { + return s5.indexOf(false) === -1; }); this.debug(this.pattern, set); this.set = set; @@ -12461,12 +20727,14 @@ var require_lockfile = __commonJS({ var negate = false; var options = this.options; var negateOffset = 0; - if (options.nonegate) return; - for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) { + if (options.nonegate) + return; + for (var i6 = 0, l3 = pattern.length; i6 < l3 && pattern.charAt(i6) === "!"; i6++) { negate = !negate; negateOffset++; } - if (negateOffset) this.pattern = pattern.substr(negateOffset); + if (negateOffset) + this.pattern = pattern.substr(negateOffset); this.negate = negate; } minimatch.braceExpand = function(pattern, options) { @@ -12497,9 +20765,11 @@ var require_lockfile = __commonJS({ throw new TypeError("pattern is too long"); } var options = this.options; - if (!options.noglobstar && pattern === "**") return GLOBSTAR; - if (pattern === "") return ""; - var re = ""; + if (!options.noglobstar && pattern === "**") + return GLOBSTAR; + if (pattern === "") + return ""; + var re3 = ""; var hasMagic = !!options.nocase; var escaping = false; var patternListStack = []; @@ -12514,122 +20784,121 @@ var require_lockfile = __commonJS({ if (stateChar) { switch (stateChar) { case "*": - re += star; + re3 += star; hasMagic = true; break; case "?": - re += qmark; + re3 += qmark; hasMagic = true; break; default: - re += "\\" + stateChar; + re3 += "\\" + stateChar; break; } - self2.debug("clearStateChar %j %j", stateChar, re); + self2.debug("clearStateChar %j %j", stateChar, re3); stateChar = false; } } - for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) { - this.debug("%s %s %s %j", pattern, i, re, c); - if (escaping && reSpecials[c]) { - re += "\\" + c; + for (var i6 = 0, len = pattern.length, c3; i6 < len && (c3 = pattern.charAt(i6)); i6++) { + this.debug("%s %s %s %j", pattern, i6, re3, c3); + if (escaping && reSpecials[c3]) { + re3 += "\\" + c3; escaping = false; continue; } - switch (c) { + switch (c3) { case "/": return false; case "\\": clearStateChar(); escaping = true; continue; - // the various stateChar values - // for the "extglob" stuff. case "?": case "*": case "+": case "@": case "!": - this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c); + this.debug("%s %s %s %j <-- stateChar", pattern, i6, re3, c3); if (inClass) { this.debug(" in class"); - if (c === "!" && i === classStart + 1) c = "^"; - re += c; + if (c3 === "!" && i6 === classStart + 1) + c3 = "^"; + re3 += c3; continue; } self2.debug("call clearStateChar %j", stateChar); clearStateChar(); - stateChar = c; - if (options.noext) clearStateChar(); + stateChar = c3; + if (options.noext) + clearStateChar(); continue; case "(": if (inClass) { - re += "("; + re3 += "("; continue; } if (!stateChar) { - re += "\\("; + re3 += "\\("; continue; } patternListStack.push({ type: stateChar, - start: i - 1, - reStart: re.length, + start: i6 - 1, + reStart: re3.length, open: plTypes[stateChar].open, close: plTypes[stateChar].close }); - re += stateChar === "!" ? "(?:(?!(?:" : "(?:"; - this.debug("plType %j %j", stateChar, re); + re3 += stateChar === "!" ? "(?:(?!(?:" : "(?:"; + this.debug("plType %j %j", stateChar, re3); stateChar = false; continue; case ")": if (inClass || !patternListStack.length) { - re += "\\)"; + re3 += "\\)"; continue; } clearStateChar(); hasMagic = true; var pl = patternListStack.pop(); - re += pl.close; + re3 += pl.close; if (pl.type === "!") { negativeLists.push(pl); } - pl.reEnd = re.length; + pl.reEnd = re3.length; continue; case "|": if (inClass || !patternListStack.length || escaping) { - re += "\\|"; + re3 += "\\|"; escaping = false; continue; } clearStateChar(); - re += "|"; + re3 += "|"; continue; - // these are mostly the same in regexp and glob case "[": clearStateChar(); if (inClass) { - re += "\\" + c; + re3 += "\\" + c3; continue; } inClass = true; - classStart = i; - reClassStart = re.length; - re += c; + classStart = i6; + reClassStart = re3.length; + re3 += c3; continue; case "]": - if (i === classStart + 1 || !inClass) { - re += "\\" + c; + if (i6 === classStart + 1 || !inClass) { + re3 += "\\" + c3; escaping = false; continue; } if (inClass) { - var cs = pattern.substring(classStart + 1, i); + var cs = pattern.substring(classStart + 1, i6); try { RegExp("[" + cs + "]"); - } catch (er) { + } catch (er2) { var sp = this.parse(cs, SUBPARSE); - re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]"; + re3 = re3.substr(0, reClassStart) + "\\[" + sp[0] + "\\]"; hasMagic = hasMagic || sp[1]; inClass = false; continue; @@ -12637,59 +20906,59 @@ var require_lockfile = __commonJS({ } hasMagic = true; inClass = false; - re += c; + re3 += c3; continue; default: clearStateChar(); if (escaping) { escaping = false; - } else if (reSpecials[c] && !(c === "^" && inClass)) { - re += "\\"; + } else if (reSpecials[c3] && !(c3 === "^" && inClass)) { + re3 += "\\"; } - re += c; + re3 += c3; } } if (inClass) { cs = pattern.substr(classStart + 1); sp = this.parse(cs, SUBPARSE); - re = re.substr(0, reClassStart) + "\\[" + sp[0]; + re3 = re3.substr(0, reClassStart) + "\\[" + sp[0]; hasMagic = hasMagic || sp[1]; } for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { - var tail = re.slice(pl.reStart + pl.open.length); - this.debug("setting tail", re, pl); - tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) { - if (!$2) { - $2 = "\\"; + var tail = re3.slice(pl.reStart + pl.open.length); + this.debug("setting tail", re3, pl); + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_4, $1, $22) { + if (!$22) { + $22 = "\\"; } - return $1 + $1 + $2 + "|"; + return $1 + $1 + $22 + "|"; }); - this.debug("tail=%j\n %s", tail, tail, pl, re); - var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type; + this.debug("tail=%j\n %s", tail, tail, pl, re3); + var t3 = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type; hasMagic = true; - re = re.slice(0, pl.reStart) + t + "\\(" + tail; + re3 = re3.slice(0, pl.reStart) + t3 + "\\(" + tail; } clearStateChar(); if (escaping) { - re += "\\\\"; + re3 += "\\\\"; } var addPatternStart = false; - switch (re.charAt(0)) { + switch (re3.charAt(0)) { case ".": case "[": case "(": addPatternStart = true; } - for (var n = negativeLists.length - 1; n > -1; n--) { - var nl = negativeLists[n]; - var nlBefore = re.slice(0, nl.reStart); - var nlFirst = re.slice(nl.reStart, nl.reEnd - 8); - var nlLast = re.slice(nl.reEnd - 8, nl.reEnd); - var nlAfter = re.slice(nl.reEnd); + for (var n3 = negativeLists.length - 1; n3 > -1; n3--) { + var nl = negativeLists[n3]; + var nlBefore = re3.slice(0, nl.reStart); + var nlFirst = re3.slice(nl.reStart, nl.reEnd - 8); + var nlLast = re3.slice(nl.reEnd - 8, nl.reEnd); + var nlAfter = re3.slice(nl.reEnd); nlLast += nlAfter; var openParensBefore = nlBefore.split("(").length - 1; var cleanAfter = nlAfter; - for (i = 0; i < openParensBefore; i++) { + for (i6 = 0; i6 < openParensBefore; i6++) { cleanAfter = cleanAfter.replace(/\)[+*?]?/, ""); } nlAfter = cleanAfter; @@ -12698,28 +20967,28 @@ var require_lockfile = __commonJS({ dollar = "$"; } var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast; - re = newRe; + re3 = newRe; } - if (re !== "" && hasMagic) { - re = "(?=.)" + re; + if (re3 !== "" && hasMagic) { + re3 = "(?=.)" + re3; } if (addPatternStart) { - re = patternStart + re; + re3 = patternStart + re3; } if (isSub === SUBPARSE) { - return [re, hasMagic]; + return [re3, hasMagic]; } if (!hasMagic) { return globUnescape(pattern); } var flags = options.nocase ? "i" : ""; try { - var regExp = new RegExp("^" + re + "$", flags); - } catch (er) { + var regExp = new RegExp("^" + re3 + "$", flags); + } catch (er2) { return new RegExp("$."); } regExp._glob = pattern; - regExp._src = re; + regExp._src = re3; return regExp; } minimatch.makeRe = function(pattern, options) { @@ -12727,7 +20996,8 @@ var require_lockfile = __commonJS({ }; Minimatch.prototype.makeRe = makeRe; function makeRe() { - if (this.regexp || this.regexp === false) return this.regexp; + if (this.regexp || this.regexp === false) + return this.regexp; var set = this.set; if (!set.length) { this.regexp = false; @@ -12736,15 +21006,16 @@ var require_lockfile = __commonJS({ var options = this.options; var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot; var flags = options.nocase ? "i" : ""; - var re = set.map(function(pattern) { - return pattern.map(function(p) { - return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src; + var re3 = set.map(function(pattern) { + return pattern.map(function(p5) { + return p5 === GLOBSTAR ? twoStar : typeof p5 === "string" ? regExpEscape(p5) : p5._src; }).join("\\/"); }).join("|"); - re = "^(?:" + re + ")$"; - if (this.negate) re = "^(?!" + re + ").*$"; + re3 = "^(?:" + re3 + ")$"; + if (this.negate) + re3 = "^(?!" + re3 + ").*$"; try { - this.regexp = new RegExp(re, flags); + this.regexp = new RegExp(re3, flags); } catch (ex) { this.regexp = false; } @@ -12753,8 +21024,8 @@ var require_lockfile = __commonJS({ minimatch.match = function(list, pattern, options) { options = options || {}; var mm = new Minimatch(pattern, options); - list = list.filter(function(f) { - return mm.match(f); + list = list.filter(function(f6) { + return mm.match(f6); }); if (mm.options.nonull && !list.length) { list.push(pattern); @@ -12762,38 +21033,44 @@ var require_lockfile = __commonJS({ return list; }; Minimatch.prototype.match = match; - function match(f, partial) { - this.debug("match", f, this.pattern); - if (this.comment) return false; - if (this.empty) return f === ""; - if (f === "/" && partial) return true; + function match(f6, partial) { + this.debug("match", f6, this.pattern); + if (this.comment) + return false; + if (this.empty) + return f6 === ""; + if (f6 === "/" && partial) + return true; var options = this.options; if (path.sep !== "/") { - f = f.split(path.sep).join("/"); + f6 = f6.split(path.sep).join("/"); } - f = f.split(slashSplit); - this.debug(this.pattern, "split", f); + f6 = f6.split(slashSplit); + this.debug(this.pattern, "split", f6); var set = this.set; this.debug(this.pattern, "set", set); var filename; - var i; - for (i = f.length - 1; i >= 0; i--) { - filename = f[i]; - if (filename) break; - } - for (i = 0; i < set.length; i++) { - var pattern = set[i]; - var file = f; + var i6; + for (i6 = f6.length - 1; i6 >= 0; i6--) { + filename = f6[i6]; + if (filename) + break; + } + for (i6 = 0; i6 < set.length; i6++) { + var pattern = set[i6]; + var file = f6; if (options.matchBase && pattern.length === 1) { file = [filename]; } var hit = this.matchOne(file, pattern, partial); if (hit) { - if (options.flipNegate) return true; + if (options.flipNegate) + return true; return !this.negate; } } - if (options.flipNegate) return false; + if (options.flipNegate) + return false; return this.negate; } Minimatch.prototype.matchOne = function(file, pattern, partial) { @@ -12805,55 +21082,59 @@ var require_lockfile = __commonJS({ this.debug("matchOne", file.length, pattern.length); for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) { this.debug("matchOne loop"); - var p = pattern[pi]; - var f = file[fi]; - this.debug(pattern, p, f); - if (p === false) return false; - if (p === GLOBSTAR) { - this.debug("GLOBSTAR", [pattern, p, f]); - var fr = fi; + var p5 = pattern[pi]; + var f6 = file[fi]; + this.debug(pattern, p5, f6); + if (p5 === false) + return false; + if (p5 === GLOBSTAR) { + this.debug("GLOBSTAR", [pattern, p5, f6]); + var fr2 = fi; var pr = pi + 1; if (pr === pl) { this.debug("** at the end"); for (; fi < fl; fi++) { - if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false; + if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") + return false; } return true; } - while (fr < fl) { - var swallowee = file[fr]; - this.debug("\nglobstar while", file, fr, pattern, pr, swallowee); - if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { - this.debug("globstar found match!", fr, fl, swallowee); + while (fr2 < fl) { + var swallowee = file[fr2]; + this.debug("\nglobstar while", file, fr2, pattern, pr, swallowee); + if (this.matchOne(file.slice(fr2), pattern.slice(pr), partial)) { + this.debug("globstar found match!", fr2, fl, swallowee); return true; } else { if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") { - this.debug("dot detected!", file, fr, pattern, pr); + this.debug("dot detected!", file, fr2, pattern, pr); break; } this.debug("globstar swallow a segment, and continue"); - fr++; + fr2++; } } if (partial) { - this.debug("\n>>> no match, partial?", file, fr, pattern, pr); - if (fr === fl) return true; + this.debug("\n>>> no match, partial?", file, fr2, pattern, pr); + if (fr2 === fl) + return true; } return false; } var hit; - if (typeof p === "string") { + if (typeof p5 === "string") { if (options.nocase) { - hit = f.toLowerCase() === p.toLowerCase(); + hit = f6.toLowerCase() === p5.toLowerCase(); } else { - hit = f === p; + hit = f6 === p5; } - this.debug("string match", p, f, hit); + this.debug("string match", p5, f6, hit); } else { - hit = f.match(p); - this.debug("pattern match", p, f, hit); + hit = f6.match(p5); + this.debug("pattern match", p5, f6, hit); } - if (!hit) return false; + if (!hit) + return false; } if (fi === fl && pi === pl) { return true; @@ -12865,19 +21146,19 @@ var require_lockfile = __commonJS({ } throw new Error("wtf?"); }; - function globUnescape(s) { - return s.replace(/\\(.)/g, "$1"); + function globUnescape(s5) { + return s5.replace(/\\(.)/g, "$1"); } - function regExpEscape(s) { - return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); + function regExpEscape(s5) { + return s5.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); } }, /* 61 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var wrappy = __webpack_require__(123); - module2.exports = wrappy(once); - module2.exports.strict = wrappy(onceStrict); + module3.exports = wrappy(once); + module3.exports.strict = wrappy(onceStrict); once.proto = once(function() { Object.defineProperty(Function.prototype, "once", { value: function() { @@ -12892,120 +21173,124 @@ var require_lockfile = __commonJS({ configurable: true }); }); - function once(fn) { - var f = function() { - if (f.called) return f.value; - f.called = true; - return f.value = fn.apply(this, arguments); + function once(fn2) { + var f6 = function() { + if (f6.called) + return f6.value; + f6.called = true; + return f6.value = fn2.apply(this, arguments); }; - f.called = false; - return f; - } - function onceStrict(fn) { - var f = function() { - if (f.called) - throw new Error(f.onceError); - f.called = true; - return f.value = fn.apply(this, arguments); + f6.called = false; + return f6; + } + function onceStrict(fn2) { + var f6 = function() { + if (f6.called) + throw new Error(f6.onceError); + f6.called = true; + return f6.value = fn2.apply(this, arguments); }; - var name = fn.name || "Function wrapped with `once`"; - f.onceError = name + " shouldn't be called more than once"; - f.called = false; - return f; + var name = fn2.name || "Function wrapped with `once`"; + f6.onceError = name + " shouldn't be called more than once"; + f6.called = false; + return f6; } }, , /* 63 */ /***/ - function(module2, exports2) { - module2.exports = __require("buffer"); + function(module3, exports2) { + module3.exports = __require("buffer"); }, , , , /* 67 */ /***/ - function(module2, exports2) { - module2.exports = function(it) { - if (it == void 0) throw TypeError("Can't call method on " + it); - return it; + function(module3, exports2) { + module3.exports = function(it2) { + if (it2 == void 0) + throw TypeError("Can't call method on " + it2); + return it2; }; }, /* 68 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var isObject = __webpack_require__(34); var document2 = __webpack_require__(11).document; var is = isObject(document2) && isObject(document2.createElement); - module2.exports = function(it) { - return is ? document2.createElement(it) : {}; + module3.exports = function(it2) { + return is ? document2.createElement(it2) : {}; }; }, /* 69 */ /***/ - function(module2, exports2) { - module2.exports = true; + function(module3, exports2) { + module3.exports = true; }, /* 70 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; var aFunction = __webpack_require__(46); - function PromiseCapability(C) { + function PromiseCapability(C4) { var resolve, reject; - this.promise = new C(function($$resolve, $$reject) { - if (resolve !== void 0 || reject !== void 0) throw TypeError("Bad Promise constructor"); + this.promise = new C4(function($$resolve, $$reject) { + if (resolve !== void 0 || reject !== void 0) + throw TypeError("Bad Promise constructor"); resolve = $$resolve; reject = $$reject; }); this.resolve = aFunction(resolve); this.reject = aFunction(reject); } - module2.exports.f = function(C) { - return new PromiseCapability(C); + module3.exports.f = function(C4) { + return new PromiseCapability(C4); }; }, /* 71 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var def = __webpack_require__(50).f; var has = __webpack_require__(49); var TAG = __webpack_require__(13)("toStringTag"); - module2.exports = function(it, tag, stat) { - if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); + module3.exports = function(it2, tag, stat) { + if (it2 && !has(it2 = stat ? it2 : it2.prototype, TAG)) + def(it2, TAG, { configurable: true, value: tag }); }; }, /* 72 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var shared = __webpack_require__(107)("keys"); var uid = __webpack_require__(111); - module2.exports = function(key) { + module3.exports = function(key) { return shared[key] || (shared[key] = uid(key)); }; }, /* 73 */ /***/ - function(module2, exports2) { + function(module3, exports2) { var ceil = Math.ceil; var floor = Math.floor; - module2.exports = function(it) { - return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); + module3.exports = function(it2) { + return isNaN(it2 = +it2) ? 0 : (it2 > 0 ? floor : ceil)(it2); }; }, /* 74 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var IObject = __webpack_require__(131); var defined = __webpack_require__(67); - module2.exports = function(it) { - return IObject(defined(it)); + module3.exports = function(it2) { + return IObject(defined(it2)); }; }, /* 75 */ /***/ - function(module2, exports2, __webpack_require__) { - module2.exports = glob; + function(module3, exports2, __webpack_require__) { + module3.exports = glob2; var fs = __webpack_require__(3); var rp = __webpack_require__(114); var minimatch = __webpack_require__(60); @@ -13026,9 +21311,11 @@ var require_lockfile = __commonJS({ var childrenIgnored = common.childrenIgnored; var isIgnored = common.isIgnored; var once = __webpack_require__(61); - function glob(pattern, options, cb) { - if (typeof options === "function") cb = options, options = {}; - if (!options) options = {}; + function glob2(pattern, options, cb) { + if (typeof options === "function") + cb = options, options = {}; + if (!options) + options = {}; if (options.sync) { if (cb) throw new TypeError("callback provided to sync glob"); @@ -13036,36 +21323,36 @@ var require_lockfile = __commonJS({ } return new Glob(pattern, options, cb); } - glob.sync = globSync; - var GlobSync = glob.GlobSync = globSync.GlobSync; - glob.glob = glob; + glob2.sync = globSync; + var GlobSync = glob2.GlobSync = globSync.GlobSync; + glob2.glob = glob2; function extend(origin, add) { if (add === null || typeof add !== "object") { return origin; } var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; + var i6 = keys.length; + while (i6--) { + origin[keys[i6]] = add[keys[i6]]; } return origin; } - glob.hasMagic = function(pattern, options_) { + glob2.hasMagic = function(pattern, options_) { var options = extend({}, options_); options.noprocess = true; - var g = new Glob(pattern, options); - var set = g.minimatch.set; + var g2 = new Glob(pattern, options); + var set = g2.minimatch.set; if (!pattern) return false; if (set.length > 1) return true; - for (var j = 0; j < set[0].length; j++) { - if (typeof set[0][j] !== "string") + for (var j2 = 0; j2 < set[0].length; j2++) { + if (typeof set[0][j2] !== "string") return true; } return false; }; - glob.Glob = Glob; + glob2.Glob = Glob; inherits(Glob, EE); function Glob(pattern, options, cb) { if (typeof options === "function") { @@ -13081,8 +21368,8 @@ var require_lockfile = __commonJS({ return new Glob(pattern, options, cb); setopts(this, pattern, options); this._didRealPath = false; - var n = this.minimatch.set.length; - this.matches = new Array(n); + var n3 = this.minimatch.set.length; + this.matches = new Array(n3); if (typeof cb === "function") { cb = once(cb); this.on("error", cb); @@ -13097,11 +21384,11 @@ var require_lockfile = __commonJS({ this.paused = false; if (this.noprocess) return this; - if (n === 0) + if (n3 === 0) return done(); var sync = true; - for (var i = 0; i < n; i++) { - this._process(this.minimatch.set[i], i, false, done); + for (var i6 = 0; i6 < n3; i6++) { + this._process(this.minimatch.set[i6], i6, false, done); } sync = false; function done() { @@ -13130,14 +21417,14 @@ var require_lockfile = __commonJS({ if (this._didRealpath) return; this._didRealpath = true; - var n = this.matches.length; - if (n === 0) + var n3 = this.matches.length; + if (n3 === 0) return this._finish(); var self2 = this; - for (var i = 0; i < this.matches.length; i++) - this._realpathSet(i, next); + for (var i6 = 0; i6 < this.matches.length; i6++) + this._realpathSet(i6, next); function next() { - if (--n === 0) + if (--n3 === 0) self2._finish(); } }; @@ -13147,31 +21434,31 @@ var require_lockfile = __commonJS({ return cb(); var found = Object.keys(matchset); var self2 = this; - var n = found.length; - if (n === 0) + var n3 = found.length; + if (n3 === 0) return cb(); var set = this.matches[index] = /* @__PURE__ */ Object.create(null); - found.forEach(function(p, i) { - p = self2._makeAbs(p); - rp.realpath(p, self2.realpathCache, function(er, real) { - if (!er) + found.forEach(function(p5, i6) { + p5 = self2._makeAbs(p5); + rp.realpath(p5, self2.realpathCache, function(er2, real) { + if (!er2) set[real] = true; - else if (er.syscall === "stat") - set[p] = true; + else if (er2.syscall === "stat") + set[p5] = true; else - self2.emit("error", er); - if (--n === 0) { + self2.emit("error", er2); + if (--n3 === 0) { self2.matches[index] = set; cb(); } }); }); }; - Glob.prototype._mark = function(p) { - return common.mark(this, p); + Glob.prototype._mark = function(p5) { + return common.mark(this, p5); }; - Glob.prototype._makeAbs = function(f) { - return common.makeAbs(this, f); + Glob.prototype._makeAbs = function(f6) { + return common.makeAbs(this, f6); }; Glob.prototype.abort = function() { this.aborted = true; @@ -13190,18 +21477,18 @@ var require_lockfile = __commonJS({ if (this._emitQueue.length) { var eq = this._emitQueue.slice(0); this._emitQueue.length = 0; - for (var i = 0; i < eq.length; i++) { - var e = eq[i]; - this._emitMatch(e[0], e[1]); + for (var i6 = 0; i6 < eq.length; i6++) { + var e5 = eq[i6]; + this._emitMatch(e5[0], e5[1]); } } if (this._processQueue.length) { var pq = this._processQueue.slice(0); this._processQueue.length = 0; - for (var i = 0; i < pq.length; i++) { - var p = pq[i]; + for (var i6 = 0; i6 < pq.length; i6++) { + var p5 = pq[i6]; this._processing--; - this._process(p[0], p[1], p[2], p[3]); + this._process(p5[0], p5[1], p5[2], p5[3]); } } } @@ -13216,13 +21503,12 @@ var require_lockfile = __commonJS({ this._processQueue.push([pattern, index, inGlobStar, cb]); return; } - var n = 0; - while (typeof pattern[n] === "string") { - n++; + var n3 = 0; + while (typeof pattern[n3] === "string") { + n3++; } var prefix; - switch (n) { - // if not, then this is rather simple + switch (n3) { case pattern.length: this._processSimple(pattern.join("/"), index, cb); return; @@ -13230,10 +21516,10 @@ var require_lockfile = __commonJS({ prefix = null; break; default: - prefix = pattern.slice(0, n).join("/"); + prefix = pattern.slice(0, n3).join("/"); break; } - var remain = pattern.slice(n); + var remain = pattern.slice(n3); var read; if (prefix === null) read = "."; @@ -13254,29 +21540,29 @@ var require_lockfile = __commonJS({ }; Glob.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar, cb) { var self2 = this; - this._readdir(abs, inGlobStar, function(er, entries) { + this._readdir(abs, inGlobStar, function(er2, entries) { return self2._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb); }); }; Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) { if (!entries) return cb(); - var pn = remain[0]; + var pn2 = remain[0]; var negate = !!this.minimatch.negate; - var rawGlob = pn._glob; + var rawGlob = pn2._glob; var dotOk = this.dot || rawGlob.charAt(0) === "."; var matchedEntries = []; - for (var i = 0; i < entries.length; i++) { - var e = entries[i]; - if (e.charAt(0) !== "." || dotOk) { - var m; + for (var i6 = 0; i6 < entries.length; i6++) { + var e5 = entries[i6]; + if (e5.charAt(0) !== "." || dotOk) { + var m8; if (negate && !prefix) { - m = !e.match(pn); + m8 = !e5.match(pn2); } else { - m = e.match(pn); + m8 = e5.match(pn2); } - if (m) - matchedEntries.push(e); + if (m8) + matchedEntries.push(e5); } } var len = matchedEntries.length; @@ -13285,61 +21571,61 @@ var require_lockfile = __commonJS({ if (remain.length === 1 && !this.mark && !this.stat) { if (!this.matches[index]) this.matches[index] = /* @__PURE__ */ Object.create(null); - for (var i = 0; i < len; i++) { - var e = matchedEntries[i]; + for (var i6 = 0; i6 < len; i6++) { + var e5 = matchedEntries[i6]; if (prefix) { if (prefix !== "/") - e = prefix + "/" + e; + e5 = prefix + "/" + e5; else - e = prefix + e; + e5 = prefix + e5; } - if (e.charAt(0) === "/" && !this.nomount) { - e = path.join(this.root, e); + if (e5.charAt(0) === "/" && !this.nomount) { + e5 = path.join(this.root, e5); } - this._emitMatch(index, e); + this._emitMatch(index, e5); } return cb(); } remain.shift(); - for (var i = 0; i < len; i++) { - var e = matchedEntries[i]; + for (var i6 = 0; i6 < len; i6++) { + var e5 = matchedEntries[i6]; var newPattern; if (prefix) { if (prefix !== "/") - e = prefix + "/" + e; + e5 = prefix + "/" + e5; else - e = prefix + e; + e5 = prefix + e5; } - this._process([e].concat(remain), index, inGlobStar, cb); + this._process([e5].concat(remain), index, inGlobStar, cb); } cb(); }; - Glob.prototype._emitMatch = function(index, e) { + Glob.prototype._emitMatch = function(index, e5) { if (this.aborted) return; - if (isIgnored(this, e)) + if (isIgnored(this, e5)) return; if (this.paused) { - this._emitQueue.push([index, e]); + this._emitQueue.push([index, e5]); return; } - var abs = isAbsolute(e) ? e : this._makeAbs(e); + var abs = isAbsolute(e5) ? e5 : this._makeAbs(e5); if (this.mark) - e = this._mark(e); + e5 = this._mark(e5); if (this.absolute) - e = abs; - if (this.matches[index][e]) + e5 = abs; + if (this.matches[index][e5]) return; if (this.nodir) { - var c = this.cache[abs]; - if (c === "DIR" || Array.isArray(c)) + var c3 = this.cache[abs]; + if (c3 === "DIR" || Array.isArray(c3)) return; } - this.matches[index][e] = true; - var st = this.statCache[abs]; - if (st) - this.emit("stat", e, st); - this.emit("match", e); + this.matches[index][e5] = true; + var st2 = this.statCache[abs]; + if (st2) + this.emit("stat", e5, st2); + this.emit("match", e5); }; Glob.prototype._readdirInGlobStar = function(abs, cb) { if (this.aborted) @@ -13351,8 +21637,8 @@ var require_lockfile = __commonJS({ var lstatcb = inflight(lstatkey, lstatcb_); if (lstatcb) fs.lstat(abs, lstatcb); - function lstatcb_(er, lstat) { - if (er && er.code === "ENOENT") + function lstatcb_(er2, lstat) { + if (er2 && er2.code === "ENOENT") return cb(); var isSym = lstat && lstat.isSymbolicLink(); self2.symlinks[abs] = isSym; @@ -13372,19 +21658,19 @@ var require_lockfile = __commonJS({ if (inGlobStar && !ownProp(this.symlinks, abs)) return this._readdirInGlobStar(abs, cb); if (ownProp(this.cache, abs)) { - var c = this.cache[abs]; - if (!c || c === "FILE") + var c3 = this.cache[abs]; + if (!c3 || c3 === "FILE") return cb(); - if (Array.isArray(c)) - return cb(null, c); + if (Array.isArray(c3)) + return cb(null, c3); } var self2 = this; fs.readdir(abs, readdirCb(this, abs, cb)); }; function readdirCb(self2, abs, cb) { - return function(er, entries) { - if (er) - self2._readdirError(abs, er, cb); + return function(er2, entries) { + if (er2) + self2._readdirError(abs, er2, cb); else self2._readdirEntries(abs, entries, cb); }; @@ -13393,57 +21679,55 @@ var require_lockfile = __commonJS({ if (this.aborted) return; if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i++) { - var e = entries[i]; + for (var i6 = 0; i6 < entries.length; i6++) { + var e5 = entries[i6]; if (abs === "/") - e = abs + e; + e5 = abs + e5; else - e = abs + "/" + e; - this.cache[e] = true; + e5 = abs + "/" + e5; + this.cache[e5] = true; } } this.cache[abs] = entries; return cb(null, entries); }; - Glob.prototype._readdirError = function(f, er, cb) { + Glob.prototype._readdirError = function(f6, er2, cb) { if (this.aborted) return; - switch (er.code) { + switch (er2.code) { case "ENOTSUP": - // https://github.com/isaacs/node-glob/issues/205 case "ENOTDIR": - var abs = this._makeAbs(f); + var abs = this._makeAbs(f6); this.cache[abs] = "FILE"; if (abs === this.cwdAbs) { - var error = new Error(er.code + " invalid cwd " + this.cwd); + var error = new Error(er2.code + " invalid cwd " + this.cwd); error.path = this.cwd; - error.code = er.code; + error.code = er2.code; this.emit("error", error); this.abort(); } break; case "ENOENT": - // not terribly unusual case "ELOOP": case "ENAMETOOLONG": case "UNKNOWN": - this.cache[this._makeAbs(f)] = false; + this.cache[this._makeAbs(f6)] = false; break; default: - this.cache[this._makeAbs(f)] = false; + this.cache[this._makeAbs(f6)] = false; if (this.strict) { - this.emit("error", er); + this.emit("error", er2); this.abort(); } if (!this.silent) - console.error("glob error", er); + console.error("glob error", er2); break; } return cb(); }; Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar, cb) { var self2 = this; - this._readdir(abs, inGlobStar, function(er, entries) { + this._readdir(abs, inGlobStar, function(er2, entries) { self2._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb); }); }; @@ -13458,24 +21742,24 @@ var require_lockfile = __commonJS({ var len = entries.length; if (isSym && inGlobStar) return cb(); - for (var i = 0; i < len; i++) { - var e = entries[i]; - if (e.charAt(0) === "." && !this.dot) + for (var i6 = 0; i6 < len; i6++) { + var e5 = entries[i6]; + if (e5.charAt(0) === "." && !this.dot) continue; - var instead = gspref.concat(entries[i], remainWithoutGlobStar); + var instead = gspref.concat(entries[i6], remainWithoutGlobStar); this._process(instead, index, true, cb); - var below = gspref.concat(entries[i], remain); + var below = gspref.concat(entries[i6], remain); this._process(below, index, true, cb); } cb(); }; Glob.prototype._processSimple = function(prefix, index, cb) { var self2 = this; - this._stat(prefix, function(er, exists) { - self2._processSimple2(prefix, index, er, exists, cb); + this._stat(prefix, function(er2, exists) { + self2._processSimple2(prefix, index, er2, exists, cb); }); }; - Glob.prototype._processSimple2 = function(prefix, index, er, exists, cb) { + Glob.prototype._processSimple2 = function(prefix, index, er2, exists, cb) { if (!this.matches[index]) this.matches[index] = /* @__PURE__ */ Object.create(null); if (!exists) @@ -13495,18 +21779,18 @@ var require_lockfile = __commonJS({ this._emitMatch(index, prefix); cb(); }; - Glob.prototype._stat = function(f, cb) { - var abs = this._makeAbs(f); - var needDir = f.slice(-1) === "/"; - if (f.length > this.maxLength) + Glob.prototype._stat = function(f6, cb) { + var abs = this._makeAbs(f6); + var needDir = f6.slice(-1) === "/"; + if (f6.length > this.maxLength) return cb(); if (!this.stat && ownProp(this.cache, abs)) { - var c = this.cache[abs]; - if (Array.isArray(c)) - c = "DIR"; - if (!needDir || c === "DIR") - return cb(null, c); - if (needDir && c === "FILE") + var c3 = this.cache[abs]; + if (Array.isArray(c3)) + c3 = "DIR"; + if (!needDir || c3 === "DIR") + return cb(null, c3); + if (needDir && c3 === "FILE") return cb(); } var exists; @@ -13526,40 +21810,40 @@ var require_lockfile = __commonJS({ var statcb = inflight("stat\0" + abs, lstatcb_); if (statcb) fs.lstat(abs, statcb); - function lstatcb_(er, lstat) { + function lstatcb_(er2, lstat) { if (lstat && lstat.isSymbolicLink()) { - return fs.stat(abs, function(er2, stat2) { - if (er2) - self2._stat2(f, abs, null, lstat, cb); + return fs.stat(abs, function(er3, stat2) { + if (er3) + self2._stat2(f6, abs, null, lstat, cb); else - self2._stat2(f, abs, er2, stat2, cb); + self2._stat2(f6, abs, er3, stat2, cb); }); } else { - self2._stat2(f, abs, er, lstat, cb); + self2._stat2(f6, abs, er2, lstat, cb); } } }; - Glob.prototype._stat2 = function(f, abs, er, stat, cb) { - if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) { + Glob.prototype._stat2 = function(f6, abs, er2, stat, cb) { + if (er2 && (er2.code === "ENOENT" || er2.code === "ENOTDIR")) { this.statCache[abs] = false; return cb(); } - var needDir = f.slice(-1) === "/"; + var needDir = f6.slice(-1) === "/"; this.statCache[abs] = stat; if (abs.slice(-1) === "/" && stat && !stat.isDirectory()) return cb(null, false, stat); - var c = true; + var c3 = true; if (stat) - c = stat.isDirectory() ? "DIR" : "FILE"; - this.cache[abs] = this.cache[abs] || c; - if (needDir && c === "FILE") + c3 = stat.isDirectory() ? "DIR" : "FILE"; + this.cache[abs] = this.cache[abs] || c3; + if (needDir && c3 === "FILE") return cb(); - return cb(null, c, stat); + return cb(null, c3, stat); }; }, /* 76 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; function posix(path) { return path.charAt(0) === "/"; @@ -13571,21 +21855,21 @@ var require_lockfile = __commonJS({ var isUnc = Boolean(device && device.charAt(1) !== ":"); return Boolean(result[2] || isUnc); } - module2.exports = process.platform === "win32" ? win32 : posix; - module2.exports.posix = posix; - module2.exports.win32 = win32; + module3.exports = process.platform === "win32" ? win32 : posix; + module3.exports.posix = posix; + module3.exports.win32 = win32; }, , , /* 79 */ /***/ - function(module2, exports2) { - module2.exports = __require("tty"); + function(module3, exports2) { + module3.exports = __require("tty"); }, , /* 81 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true @@ -13667,8 +21951,8 @@ var require_lockfile = __commonJS({ } else if (input[0] === " ") { if (lastNewline) { let indent = ""; - for (let i = 0; input[i] === " "; i++) { - indent += input[i]; + for (let i6 = 0; input[i6] === " "; i6++) { + indent += input[i6]; } if (indent.length % 2) { throw new TypeError("Invalid number of spaces"); @@ -13681,11 +21965,11 @@ var require_lockfile = __commonJS({ } } else if (input[0] === '"') { let val = ""; - for (let i = 0; ; i++) { - const currentChar = input[i]; + for (let i6 = 0; ; i6++) { + const currentChar = input[i6]; val += currentChar; - if (i > 0 && currentChar === '"') { - const isEscaped = input[i - 1] === "\\" && input[i - 2] !== "\\"; + if (i6 > 0 && currentChar === '"') { + const isEscaped = input[i6 - 1] === "\\" && input[i6 - 2] !== "\\"; if (!isEscaped) { break; } @@ -13703,8 +21987,8 @@ var require_lockfile = __commonJS({ } } else if (/^[0-9]/.test(input)) { let val = ""; - for (let i = 0; /^[0-9]$/.test(input[i]); i++) { - val += input[i]; + for (let i6 = 0; /^[0-9]$/.test(input[i6]); i6++) { + val += input[i6]; } chop = val.length; yield buildToken(TOKEN_TYPES.number, +val); @@ -13722,8 +22006,8 @@ var require_lockfile = __commonJS({ chop++; } else if (/^[a-zA-Z\/-]/g.test(input)) { let name = ""; - for (let i = 0; i < input.length; i++) { - const char = input[i]; + for (let i6 = 0; i6 < input.length; i6++) { + const char = input[i6]; if (char === ":" || char === " " || char === "\n" || char === "\r" || char === ",") { break; } else { @@ -13842,11 +22126,13 @@ var require_lockfile = __commonJS({ for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); ; ) { var _ref; if (_isArray) { - if (_i >= _iterator.length) break; + if (_i >= _iterator.length) + break; _ref = _iterator[_i++]; } else { _i = _iterator.next(); - if (_i.done) break; + if (_i.done) + break; _ref = _i.value; } const key2 = _ref; @@ -13859,11 +22145,13 @@ var require_lockfile = __commonJS({ for (var _iterator2 = keys, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator](); ; ) { var _ref2; if (_isArray2) { - if (_i2 >= _iterator2.length) break; + if (_i2 >= _iterator2.length) + break; _ref2 = _iterator2[_i2++]; } else { _i2 = _iterator2.next(); - if (_i2.done) break; + if (_i2.done) + break; _ref2 = _i2.value; } const key2 = _ref2; @@ -13943,7 +22231,7 @@ var require_lockfile = __commonJS({ , /* 84 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true @@ -14044,9 +22332,9 @@ var require_lockfile = __commonJS({ } shiftConcurrencyQueue() { if (this.runningCount < this.maxConcurrency) { - const fn = this.concurrencyQueue.shift(); - if (fn) { - fn(); + const fn2 = this.concurrencyQueue.shift(); + if (fn2) { + fn2(); } } } @@ -14055,11 +22343,11 @@ var require_lockfile = __commonJS({ }, /* 85 */ /***/ - function(module2, exports2) { - module2.exports = function(exec) { + function(module3, exports2) { + module3.exports = function(exec) { try { return !!exec(); - } catch (e) { + } catch (e5) { return true; } }; @@ -14080,37 +22368,37 @@ var require_lockfile = __commonJS({ , /* 100 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var cof = __webpack_require__(47); var TAG = __webpack_require__(13)("toStringTag"); var ARG = cof(/* @__PURE__ */ function() { return arguments; }()) == "Arguments"; - var tryGet = function(it, key) { + var tryGet = function(it2, key) { try { - return it[key]; - } catch (e) { + return it2[key]; + } catch (e5) { } }; - module2.exports = function(it) { - var O, T, B; - return it === void 0 ? "Undefined" : it === null ? "Null" : typeof (T = tryGet(O = Object(it), TAG)) == "string" ? T : ARG ? cof(O) : (B = cof(O)) == "Object" && typeof O.callee == "function" ? "Arguments" : B; + module3.exports = function(it2) { + var O4, T3, B3; + return it2 === void 0 ? "Undefined" : it2 === null ? "Null" : typeof (T3 = tryGet(O4 = Object(it2), TAG)) == "string" ? T3 : ARG ? cof(O4) : (B3 = cof(O4)) == "Object" && typeof O4.callee == "function" ? "Arguments" : B3; }; }, /* 101 */ /***/ - function(module2, exports2) { - module2.exports = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","); + function(module3, exports2) { + module3.exports = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","); }, /* 102 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var document2 = __webpack_require__(11).document; - module2.exports = document2 && document2.documentElement; + module3.exports = document2 && document2.documentElement; }, /* 103 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; var LIBRARY = __webpack_require__(69); var $export = __webpack_require__(41); @@ -14128,10 +22416,11 @@ var require_lockfile = __commonJS({ var returnThis = function() { return this; }; - module2.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { + module3.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { $iterCreate(Constructor, NAME, next); var getMethod = function(kind) { - if (!BUGGY && kind in proto2) return proto2[kind]; + if (!BUGGY && kind in proto2) + return proto2[kind]; switch (kind) { case KEYS: return function keys() { @@ -14159,7 +22448,8 @@ var require_lockfile = __commonJS({ IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { setToStringTag(IteratorPrototype, TAG, true); - if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != "function") hide(IteratorPrototype, ITERATOR, returnThis); + if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != "function") + hide(IteratorPrototype, ITERATOR, returnThis); } } if (DEF_VALUES && $native && $native.name !== VALUES) { @@ -14179,44 +22469,48 @@ var require_lockfile = __commonJS({ keys: IS_SET ? $default : getMethod(KEYS), entries: $entries }; - if (FORCED) for (key in methods) { - if (!(key in proto2)) redefine(proto2, key, methods[key]); - } - else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); + if (FORCED) + for (key in methods) { + if (!(key in proto2)) + redefine(proto2, key, methods[key]); + } + else + $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); } return methods; }; }, /* 104 */ /***/ - function(module2, exports2) { - module2.exports = function(exec) { + function(module3, exports2) { + module3.exports = function(exec) { try { return { e: false, v: exec() }; - } catch (e) { - return { e: true, v: e }; + } catch (e5) { + return { e: true, v: e5 }; } }; }, /* 105 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var anObject = __webpack_require__(27); var isObject = __webpack_require__(34); var newPromiseCapability = __webpack_require__(70); - module2.exports = function(C, x) { - anObject(C); - if (isObject(x) && x.constructor === C) return x; - var promiseCapability = newPromiseCapability.f(C); + module3.exports = function(C4, x2) { + anObject(C4); + if (isObject(x2) && x2.constructor === C4) + return x2; + var promiseCapability = newPromiseCapability.f(C4); var resolve = promiseCapability.resolve; - resolve(x); + resolve(x2); return promiseCapability.promise; }; }, /* 106 */ /***/ - function(module2, exports2) { - module2.exports = function(bitmap, value) { + function(module3, exports2) { + module3.exports = function(bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), @@ -14227,12 +22521,12 @@ var require_lockfile = __commonJS({ }, /* 107 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var core = __webpack_require__(23); - var global = __webpack_require__(11); + var global2 = __webpack_require__(11); var SHARED = "__core-js_shared__"; - var store = global[SHARED] || (global[SHARED] = {}); - (module2.exports = function(key, value) { + var store = global2[SHARED] || (global2[SHARED] = {}); + (module3.exports = function(key, value) { return store[key] || (store[key] = value !== void 0 ? value : {}); })("versions", []).push({ version: core.version, @@ -14242,29 +22536,29 @@ var require_lockfile = __commonJS({ }, /* 108 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var anObject = __webpack_require__(27); var aFunction = __webpack_require__(46); var SPECIES = __webpack_require__(13)("species"); - module2.exports = function(O, D) { - var C = anObject(O).constructor; - var S; - return C === void 0 || (S = anObject(C)[SPECIES]) == void 0 ? D : aFunction(S); + module3.exports = function(O4, D3) { + var C4 = anObject(O4).constructor; + var S2; + return C4 === void 0 || (S2 = anObject(C4)[SPECIES]) == void 0 ? D3 : aFunction(S2); }; }, /* 109 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var ctx = __webpack_require__(48); var invoke = __webpack_require__(185); var html = __webpack_require__(102); var cel = __webpack_require__(68); - var global = __webpack_require__(11); - var process4 = global.process; - var setTask = global.setImmediate; - var clearTask = global.clearImmediate; - var MessageChannel = global.MessageChannel; - var Dispatch = global.Dispatch; + var global2 = __webpack_require__(11); + var process4 = global2.process; + var setTask = global2.setImmediate; + var clearTask = global2.clearImmediate; + var MessageChannel = global2.MessageChannel; + var Dispatch = global2.Dispatch; var counter = 0; var queue = {}; var ONREADYSTATECHANGE = "onreadystatechange"; @@ -14272,21 +22566,22 @@ var require_lockfile = __commonJS({ var run = function() { var id = +this; if (queue.hasOwnProperty(id)) { - var fn = queue[id]; + var fn2 = queue[id]; delete queue[id]; - fn(); + fn2(); } }; var listener = function(event) { run.call(event.data); }; if (!setTask || !clearTask) { - setTask = function setImmediate(fn) { + setTask = function setImmediate2(fn2) { var args = []; - var i = 1; - while (arguments.length > i) args.push(arguments[i++]); + var i6 = 1; + while (arguments.length > i6) + args.push(arguments[i6++]); queue[++counter] = function() { - invoke(typeof fn == "function" ? fn : Function(fn), args); + invoke(typeof fn2 == "function" ? fn2 : Function(fn2), args); }; defer(counter); return counter; @@ -14307,11 +22602,11 @@ var require_lockfile = __commonJS({ port = channel.port2; channel.port1.onmessage = listener; defer = ctx(port.postMessage, port, 1); - } else if (global.addEventListener && typeof postMessage == "function" && !global.importScripts) { + } else if (global2.addEventListener && typeof postMessage == "function" && !global2.importScripts) { defer = function(id) { - global.postMessage(id + "", "*"); + global2.postMessage(id + "", "*"); }; - global.addEventListener("message", listener, false); + global2.addEventListener("message", listener, false); } else if (ONREADYSTATECHANGE in cel("script")) { defer = function(id) { html.appendChild(cel("script"))[ONREADYSTATECHANGE] = function() { @@ -14325,33 +22620,33 @@ var require_lockfile = __commonJS({ }; } } - module2.exports = { + module3.exports = { set: setTask, clear: clearTask }; }, /* 110 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var toInteger = __webpack_require__(73); var min = Math.min; - module2.exports = function(it) { - return it > 0 ? min(toInteger(it), 9007199254740991) : 0; + module3.exports = function(it2) { + return it2 > 0 ? min(toInteger(it2), 9007199254740991) : 0; }; }, /* 111 */ /***/ - function(module2, exports2) { + function(module3, exports2) { var id = 0; var px = Math.random(); - module2.exports = function(key) { + module3.exports = function(key) { return "Symbol(".concat(key === void 0 ? "" : key, ")_", (++id + px).toString(36)); }; }, /* 112 */ /***/ - function(module2, exports2, __webpack_require__) { - exports2 = module2.exports = createDebug.debug = createDebug["default"] = createDebug; + function(module3, exports2, __webpack_require__) { + exports2 = module3.exports = createDebug.debug = createDebug["default"] = createDebug; exports2.coerce = coerce; exports2.disable = disable; exports2.enable = enable; @@ -14362,9 +22657,9 @@ var require_lockfile = __commonJS({ exports2.skips = []; exports2.formatters = {}; function selectColor(namespace) { - var hash = 0, i; - for (i in namespace) { - hash = (hash << 5) - hash + namespace.charCodeAt(i); + var hash = 0, i6; + for (i6 in namespace) { + hash = (hash << 5) - hash + namespace.charCodeAt(i6); hash |= 0; } return exports2.colors[Math.abs(hash) % exports2.colors.length]; @@ -14372,7 +22667,8 @@ var require_lockfile = __commonJS({ function createDebug(namespace) { var prevTime; function debug() { - if (!debug.enabled) return; + if (!debug.enabled) + return; var self2 = debug; var curr = +/* @__PURE__ */ new Date(); var ms = curr - (prevTime || curr); @@ -14381,8 +22677,8 @@ var require_lockfile = __commonJS({ self2.curr = curr; prevTime = curr; var args = new Array(arguments.length); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; + for (var i6 = 0; i6 < args.length; i6++) { + args[i6] = arguments[i6]; } args[0] = exports2.coerce(args[0]); if ("string" !== typeof args[0]) { @@ -14390,7 +22686,8 @@ var require_lockfile = __commonJS({ } var index = 0; args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { - if (match === "%%") return match; + if (match === "%%") + return match; index++; var formatter = exports2.formatters[format]; if ("function" === typeof formatter) { @@ -14429,20 +22726,21 @@ var require_lockfile = __commonJS({ exports2.save(namespaces); exports2.names = []; exports2.skips = []; - var i; + var i6; var split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/); var len = split.length; - for (i = 0; i < len; i++) { - if (!split[i]) continue; - namespaces = split[i].replace(/\*/g, ".*?"); + for (i6 = 0; i6 < len; i6++) { + if (!split[i6]) + continue; + namespaces = split[i6].replace(/\*/g, ".*?"); if (namespaces[0] === "-") { exports2.skips.push(new RegExp("^" + namespaces.substr(1) + "$")); } else { exports2.names.push(new RegExp("^" + namespaces + "$")); } } - for (i = 0; i < exports2.instances.length; i++) { - var instance = exports2.instances[i]; + for (i6 = 0; i6 < exports2.instances.length; i6++) { + var instance = exports2.instances[i6]; instance.enabled = exports2.enabled(instance.namespace); } } @@ -14453,29 +22751,30 @@ var require_lockfile = __commonJS({ if (name[name.length - 1] === "*") { return true; } - var i, len; - for (i = 0, len = exports2.skips.length; i < len; i++) { - if (exports2.skips[i].test(name)) { + var i6, len; + for (i6 = 0, len = exports2.skips.length; i6 < len; i6++) { + if (exports2.skips[i6].test(name)) { return false; } } - for (i = 0, len = exports2.names.length; i < len; i++) { - if (exports2.names[i].test(name)) { + for (i6 = 0, len = exports2.names.length; i6 < len; i6++) { + if (exports2.names[i6].test(name)) { return true; } } return false; } function coerce(val) { - if (val instanceof Error) return val.stack || val.message; + if (val instanceof Error) + return val.stack || val.message; return val; } }, , /* 114 */ /***/ - function(module2, exports2, __webpack_require__) { - module2.exports = realpath; + function(module3, exports2, __webpack_require__) { + module3.exports = realpath; realpath.realpath = realpath; realpath.sync = realpathSync; realpath.realpathSync = realpathSync; @@ -14487,36 +22786,36 @@ var require_lockfile = __commonJS({ var version = process.version; var ok = /^v[0-5]\./.test(version); var old = __webpack_require__(217); - function newError(er) { - return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG"); + function newError(er2) { + return er2 && er2.syscall === "realpath" && (er2.code === "ELOOP" || er2.code === "ENOMEM" || er2.code === "ENAMETOOLONG"); } - function realpath(p, cache, cb) { + function realpath(p5, cache, cb) { if (ok) { - return origRealpath(p, cache, cb); + return origRealpath(p5, cache, cb); } if (typeof cache === "function") { cb = cache; cache = null; } - origRealpath(p, cache, function(er, result) { - if (newError(er)) { - old.realpath(p, cache, cb); + origRealpath(p5, cache, function(er2, result) { + if (newError(er2)) { + old.realpath(p5, cache, cb); } else { - cb(er, result); + cb(er2, result); } }); } - function realpathSync(p, cache) { + function realpathSync(p5, cache) { if (ok) { - return origRealpathSync(p, cache); + return origRealpathSync(p5, cache); } try { - return origRealpathSync(p, cache); - } catch (er) { - if (newError(er)) { - return old.realpathSync(p, cache); + return origRealpathSync(p5, cache); + } catch (er2) { + if (newError(er2)) { + return old.realpathSync(p5, cache); } else { - throw er; + throw er2; } } } @@ -14531,7 +22830,7 @@ var require_lockfile = __commonJS({ }, /* 115 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { exports2.alphasort = alphasort; exports2.alphasorti = alphasorti; exports2.setopts = setopts; @@ -14548,11 +22847,11 @@ var require_lockfile = __commonJS({ var minimatch = __webpack_require__(60); var isAbsolute = __webpack_require__(76); var Minimatch = minimatch.Minimatch; - function alphasorti(a, b) { - return a.toLowerCase().localeCompare(b.toLowerCase()); + function alphasorti(a7, b3) { + return a7.toLowerCase().localeCompare(b3.toLowerCase()); } - function alphasort(a, b) { - return a.localeCompare(b); + function alphasort(a7, b3) { + return a7.localeCompare(b3); } function setupIgnores(self2, options) { self2.ignore = options.ignore || []; @@ -14630,23 +22929,23 @@ var require_lockfile = __commonJS({ function finish(self2) { var nou = self2.nounique; var all = nou ? [] : /* @__PURE__ */ Object.create(null); - for (var i = 0, l = self2.matches.length; i < l; i++) { - var matches = self2.matches[i]; + for (var i6 = 0, l3 = self2.matches.length; i6 < l3; i6++) { + var matches = self2.matches[i6]; if (!matches || Object.keys(matches).length === 0) { if (self2.nonull) { - var literal = self2.minimatch.globSet[i]; + var literal = self2.minimatch.globSet[i6]; if (nou) all.push(literal); else all[literal] = true; } } else { - var m = Object.keys(matches); + var m8 = Object.keys(matches); if (nou) - all.push.apply(all, m); + all.push.apply(all, m8); else - m.forEach(function(m2) { - all[m2] = true; + m8.forEach(function(m9) { + all[m9] = true; }); } } @@ -14655,54 +22954,54 @@ var require_lockfile = __commonJS({ if (!self2.nosort) all = all.sort(self2.nocase ? alphasorti : alphasort); if (self2.mark) { - for (var i = 0; i < all.length; i++) { - all[i] = self2._mark(all[i]); + for (var i6 = 0; i6 < all.length; i6++) { + all[i6] = self2._mark(all[i6]); } if (self2.nodir) { - all = all.filter(function(e) { - var notDir = !/\/$/.test(e); - var c = self2.cache[e] || self2.cache[makeAbs(self2, e)]; - if (notDir && c) - notDir = c !== "DIR" && !Array.isArray(c); + all = all.filter(function(e5) { + var notDir = !/\/$/.test(e5); + var c3 = self2.cache[e5] || self2.cache[makeAbs(self2, e5)]; + if (notDir && c3) + notDir = c3 !== "DIR" && !Array.isArray(c3); return notDir; }); } } if (self2.ignore.length) - all = all.filter(function(m2) { - return !isIgnored(self2, m2); + all = all.filter(function(m9) { + return !isIgnored(self2, m9); }); self2.found = all; } - function mark(self2, p) { - var abs = makeAbs(self2, p); - var c = self2.cache[abs]; - var m = p; - if (c) { - var isDir = c === "DIR" || Array.isArray(c); - var slash = p.slice(-1) === "/"; + function mark(self2, p5) { + var abs = makeAbs(self2, p5); + var c3 = self2.cache[abs]; + var m8 = p5; + if (c3) { + var isDir = c3 === "DIR" || Array.isArray(c3); + var slash = p5.slice(-1) === "/"; if (isDir && !slash) - m += "/"; + m8 += "/"; else if (!isDir && slash) - m = m.slice(0, -1); - if (m !== p) { - var mabs = makeAbs(self2, m); + m8 = m8.slice(0, -1); + if (m8 !== p5) { + var mabs = makeAbs(self2, m8); self2.statCache[mabs] = self2.statCache[abs]; self2.cache[mabs] = self2.cache[abs]; } } - return m; + return m8; } - function makeAbs(self2, f) { - var abs = f; - if (f.charAt(0) === "/") { - abs = path.join(self2.root, f); - } else if (isAbsolute(f) || f === "") { - abs = f; + function makeAbs(self2, f6) { + var abs = f6; + if (f6.charAt(0) === "/") { + abs = path.join(self2.root, f6); + } else if (isAbsolute(f6) || f6 === "") { + abs = f6; } else if (self2.changedCwd) { - abs = path.resolve(self2.cwd, f); + abs = path.resolve(self2.cwd, f6); } else { - abs = path.resolve(f); + abs = path.resolve(f6); } if (process.platform === "win32") abs = abs.replace(/\\/g, "/"); @@ -14725,14 +23024,14 @@ var require_lockfile = __commonJS({ }, /* 116 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var path = __webpack_require__(0); var fs = __webpack_require__(3); var _0777 = parseInt("0777", 8); - module2.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; - function mkdirP(p, opts, f, made) { + module3.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; + function mkdirP(p5, opts, f6, made) { if (typeof opts === "function") { - f = opts; + f6 = opts; opts = {}; } else if (!opts || typeof opts !== "object") { opts = { mode: opts }; @@ -14742,35 +23041,37 @@ var require_lockfile = __commonJS({ if (mode === void 0) { mode = _0777 & ~process.umask(); } - if (!made) made = null; - var cb = f || function() { + if (!made) + made = null; + var cb = f6 || function() { }; - p = path.resolve(p); - xfs.mkdir(p, mode, function(er) { - if (!er) { - made = made || p; + p5 = path.resolve(p5); + xfs.mkdir(p5, mode, function(er2) { + if (!er2) { + made = made || p5; return cb(null, made); } - switch (er.code) { + switch (er2.code) { case "ENOENT": - mkdirP(path.dirname(p), opts, function(er2, made2) { - if (er2) cb(er2, made2); - else mkdirP(p, opts, cb, made2); + mkdirP(path.dirname(p5), opts, function(er3, made2) { + if (er3) + cb(er3, made2); + else + mkdirP(p5, opts, cb, made2); }); break; - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. default: - xfs.stat(p, function(er2, stat) { - if (er2 || !stat.isDirectory()) cb(er, made); - else cb(null, made); + xfs.stat(p5, function(er22, stat) { + if (er22 || !stat.isDirectory()) + cb(er2, made); + else + cb(null, made); }); break; } }); } - mkdirP.sync = function sync(p, opts, made) { + mkdirP.sync = function sync(p5, opts, made) { if (!opts || typeof opts !== "object") { opts = { mode: opts }; } @@ -14779,28 +23080,27 @@ var require_lockfile = __commonJS({ if (mode === void 0) { mode = _0777 & ~process.umask(); } - if (!made) made = null; - p = path.resolve(p); + if (!made) + made = null; + p5 = path.resolve(p5); try { - xfs.mkdirSync(p, mode); - made = made || p; + xfs.mkdirSync(p5, mode); + made = made || p5; } catch (err0) { switch (err0.code) { case "ENOENT": - made = sync(path.dirname(p), opts, made); - sync(p, opts, made); + made = sync(path.dirname(p5), opts, made); + sync(p5, opts, made); break; - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. default: var stat; try { - stat = xfs.statSync(p); + stat = xfs.statSync(p5); } catch (err1) { throw err0; } - if (!stat.isDirectory()) throw err0; + if (!stat.isDirectory()) + throw err0; break; } } @@ -14814,40 +23114,41 @@ var require_lockfile = __commonJS({ , /* 122 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; - module2.exports = (x) => { - if (typeof x !== "string") { - throw new TypeError("Expected a string, got " + typeof x); + module3.exports = (x2) => { + if (typeof x2 !== "string") { + throw new TypeError("Expected a string, got " + typeof x2); } - if (x.charCodeAt(0) === 65279) { - return x.slice(1); + if (x2.charCodeAt(0) === 65279) { + return x2.slice(1); } - return x; + return x2; }; }, /* 123 */ /***/ - function(module2, exports2) { - module2.exports = wrappy; - function wrappy(fn, cb) { - if (fn && cb) return wrappy(fn)(cb); - if (typeof fn !== "function") + function(module3, exports2) { + module3.exports = wrappy; + function wrappy(fn2, cb) { + if (fn2 && cb) + return wrappy(fn2)(cb); + if (typeof fn2 !== "function") throw new TypeError("need wrapper function"); - Object.keys(fn).forEach(function(k) { - wrapper[k] = fn[k]; + Object.keys(fn2).forEach(function(k3) { + wrapper[k3] = fn2[k3]; }); return wrapper; function wrapper() { var args = new Array(arguments.length); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; + for (var i6 = 0; i6 < args.length; i6++) { + args[i6] = arguments[i6]; } - var ret = fn.apply(this, args); + var ret = fn2.apply(this, args); var cb2 = args[args.length - 1]; if (typeof ret === "function" && ret !== cb2) { - Object.keys(cb2).forEach(function(k) { - ret[k] = cb2[k]; + Object.keys(cb2).forEach(function(k3) { + ret[k3] = cb2[k3]; }); } return ret; @@ -14863,27 +23164,27 @@ var require_lockfile = __commonJS({ , /* 131 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var cof = __webpack_require__(47); - module2.exports = Object("z").propertyIsEnumerable(0) ? Object : function(it) { - return cof(it) == "String" ? it.split("") : Object(it); + module3.exports = Object("z").propertyIsEnumerable(0) ? Object : function(it2) { + return cof(it2) == "String" ? it2.split("") : Object(it2); }; }, /* 132 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var $keys = __webpack_require__(195); var enumBugKeys = __webpack_require__(101); - module2.exports = Object.keys || function keys(O) { - return $keys(O, enumBugKeys); + module3.exports = Object.keys || function keys(O4) { + return $keys(O4, enumBugKeys); }; }, /* 133 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var defined = __webpack_require__(67); - module2.exports = function(it) { - return Object(defined(it)); + module3.exports = function(it2) { + return Object(defined(it2)); }; }, , @@ -14899,8 +23200,8 @@ var require_lockfile = __commonJS({ , /* 145 */ /***/ - function(module2, exports2) { - module2.exports = { "name": "yarn", "installationMethod": "unknown", "version": "1.10.0-0", "license": "BSD-2-Clause", "preferGlobal": true, "description": "\u{1F4E6}\u{1F408} Fast, reliable, and secure dependency management.", "dependencies": { "@zkochan/cmd-shim": "^2.2.4", "babel-runtime": "^6.26.0", "bytes": "^3.0.0", "camelcase": "^4.0.0", "chalk": "^2.1.0", "commander": "^2.9.0", "death": "^1.0.0", "debug": "^3.0.0", "deep-equal": "^1.0.1", "detect-indent": "^5.0.0", "dnscache": "^1.0.1", "glob": "^7.1.1", "gunzip-maybe": "^1.4.0", "hash-for-dep": "^1.2.3", "imports-loader": "^0.8.0", "ini": "^1.3.4", "inquirer": "^3.0.1", "invariant": "^2.2.0", "is-builtin-module": "^2.0.0", "is-ci": "^1.0.10", "is-webpack-bundle": "^1.0.0", "leven": "^2.0.0", "loud-rejection": "^1.2.0", "micromatch": "^2.3.11", "mkdirp": "^0.5.1", "node-emoji": "^1.6.1", "normalize-url": "^2.0.0", "npm-logical-tree": "^1.2.1", "object-path": "^0.11.2", "proper-lockfile": "^2.0.0", "puka": "^1.0.0", "read": "^1.0.7", "request": "^2.87.0", "request-capture-har": "^1.2.2", "rimraf": "^2.5.0", "semver": "^5.1.0", "ssri": "^5.3.0", "strip-ansi": "^4.0.0", "strip-bom": "^3.0.0", "tar-fs": "^1.16.0", "tar-stream": "^1.6.1", "uuid": "^3.0.1", "v8-compile-cache": "^2.0.0", "validate-npm-package-license": "^3.0.3", "yn": "^2.0.0" }, "devDependencies": { "babel-core": "^6.26.0", "babel-eslint": "^7.2.3", "babel-loader": "^6.2.5", "babel-plugin-array-includes": "^2.0.3", "babel-plugin-transform-builtin-extend": "^1.1.2", "babel-plugin-transform-inline-imports-commonjs": "^1.0.0", "babel-plugin-transform-runtime": "^6.4.3", "babel-preset-env": "^1.6.0", "babel-preset-flow": "^6.23.0", "babel-preset-stage-0": "^6.0.0", "babylon": "^6.5.0", "commitizen": "^2.9.6", "cz-conventional-changelog": "^2.0.0", "eslint": "^4.3.0", "eslint-config-fb-strict": "^22.0.0", "eslint-plugin-babel": "^5.0.0", "eslint-plugin-flowtype": "^2.35.0", "eslint-plugin-jasmine": "^2.6.2", "eslint-plugin-jest": "^21.0.0", "eslint-plugin-jsx-a11y": "^6.0.2", "eslint-plugin-prefer-object-spread": "^1.2.1", "eslint-plugin-prettier": "^2.1.2", "eslint-plugin-react": "^7.1.0", "eslint-plugin-relay": "^0.0.24", "eslint-plugin-yarn-internal": "file:scripts/eslint-rules", "execa": "^0.10.0", "flow-bin": "^0.66.0", "git-release-notes": "^3.0.0", "gulp": "^3.9.0", "gulp-babel": "^7.0.0", "gulp-if": "^2.0.1", "gulp-newer": "^1.0.0", "gulp-plumber": "^1.0.1", "gulp-sourcemaps": "^2.2.0", "gulp-util": "^3.0.7", "gulp-watch": "^5.0.0", "jest": "^22.4.4", "jsinspect": "^0.12.6", "minimatch": "^3.0.4", "mock-stdin": "^0.3.0", "prettier": "^1.5.2", "temp": "^0.8.3", "webpack": "^2.1.0-beta.25", "yargs": "^6.3.0" }, "resolutions": { "sshpk": "^1.14.2" }, "engines": { "node": ">=4.0.0" }, "repository": "yarnpkg/yarn", "bin": { "yarn": "./bin/yarn.js", "yarnpkg": "./bin/yarn.js" }, "scripts": { "build": "gulp build", "build-bundle": "node ./scripts/build-webpack.js", "build-chocolatey": "powershell ./scripts/build-chocolatey.ps1", "build-deb": "./scripts/build-deb.sh", "build-dist": "bash ./scripts/build-dist.sh", "build-win-installer": "scripts\\build-windows-installer.bat", "changelog": "git-release-notes $(git describe --tags --abbrev=0 $(git describe --tags --abbrev=0)^)..$(git describe --tags --abbrev=0) scripts/changelog.md", "dupe-check": "yarn jsinspect ./src", "lint": "eslint . && flow check", "pkg-tests": "yarn --cwd packages/pkg-tests jest yarn.test.js", "prettier": "eslint src __tests__ --fix", "release-branch": "./scripts/release-branch.sh", "test": "yarn lint && yarn test-only", "test-only": "node --max_old_space_size=4096 ", "test-only-debug": "node --inspect-brk --max_old_space_size=4096 ", "test-coverage": "node --max_old_space_size=4096 ", "watch": "gulp watch", "commit": "git-cz" }, "jest": { "collectCoverageFrom": ["src/**/*.js"], "testEnvironment": "node", "modulePathIgnorePatterns": ["__tests__/fixtures/", "packages/pkg-tests/pkg-tests-fixtures", "dist/"], "testPathIgnorePatterns": ["__tests__/(fixtures|__mocks__)/", "updates/", "_(temp|mock|install|init|helpers).js$", "packages/pkg-tests"] }, "config": { "commitizen": { "path": "./" } } }; + function(module3, exports2) { + module3.exports = { "name": "yarn", "installationMethod": "unknown", "version": "1.10.0-0", "license": "BSD-2-Clause", "preferGlobal": true, "description": "\u{1F4E6}\u{1F408} Fast, reliable, and secure dependency management.", "dependencies": { "@zkochan/cmd-shim": "^2.2.4", "babel-runtime": "^6.26.0", "bytes": "^3.0.0", "camelcase": "^4.0.0", "chalk": "^2.1.0", "commander": "^2.9.0", "death": "^1.0.0", "debug": "^3.0.0", "deep-equal": "^1.0.1", "detect-indent": "^5.0.0", "dnscache": "^1.0.1", "glob": "^7.1.1", "gunzip-maybe": "^1.4.0", "hash-for-dep": "^1.2.3", "imports-loader": "^0.8.0", "ini": "^1.3.4", "inquirer": "^3.0.1", "invariant": "^2.2.0", "is-builtin-module": "^2.0.0", "is-ci": "^1.0.10", "is-webpack-bundle": "^1.0.0", "leven": "^2.0.0", "loud-rejection": "^1.2.0", "micromatch": "^2.3.11", "mkdirp": "^0.5.1", "node-emoji": "^1.6.1", "normalize-url": "^2.0.0", "npm-logical-tree": "^1.2.1", "object-path": "^0.11.2", "proper-lockfile": "^2.0.0", "puka": "^1.0.0", "read": "^1.0.7", "request": "^2.87.0", "request-capture-har": "^1.2.2", "rimraf": "^2.5.0", "semver": "^5.1.0", "ssri": "^5.3.0", "strip-ansi": "^4.0.0", "strip-bom": "^3.0.0", "tar-fs": "^1.16.0", "tar-stream": "^1.6.1", "uuid": "^3.0.1", "v8-compile-cache": "^2.0.0", "validate-npm-package-license": "^3.0.3", "yn": "^2.0.0" }, "devDependencies": { "babel-core": "^6.26.0", "babel-eslint": "^7.2.3", "babel-loader": "^6.2.5", "babel-plugin-array-includes": "^2.0.3", "babel-plugin-transform-builtin-extend": "^1.1.2", "babel-plugin-transform-inline-imports-commonjs": "^1.0.0", "babel-plugin-transform-runtime": "^6.4.3", "babel-preset-env": "^1.6.0", "babel-preset-flow": "^6.23.0", "babel-preset-stage-0": "^6.0.0", "babylon": "^6.5.0", "commitizen": "^2.9.6", "cz-conventional-changelog": "^2.0.0", "eslint": "^4.3.0", "eslint-config-fb-strict": "^22.0.0", "eslint-plugin-babel": "^5.0.0", "eslint-plugin-flowtype": "^2.35.0", "eslint-plugin-jasmine": "^2.6.2", "eslint-plugin-jest": "^21.0.0", "eslint-plugin-jsx-a11y": "^6.0.2", "eslint-plugin-prefer-object-spread": "^1.2.1", "eslint-plugin-prettier": "^2.1.2", "eslint-plugin-react": "^7.1.0", "eslint-plugin-relay": "^0.0.24", "eslint-plugin-yarn-internal": "file:scripts/eslint-rules", "execa": "^0.10.0", "flow-bin": "^0.66.0", "git-release-notes": "^3.0.0", "gulp": "^3.9.0", "gulp-babel": "^7.0.0", "gulp-if": "^2.0.1", "gulp-newer": "^1.0.0", "gulp-plumber": "^1.0.1", "gulp-sourcemaps": "^2.2.0", "gulp-util": "^3.0.7", "gulp-watch": "^5.0.0", "jest": "^22.4.4", "jsinspect": "^0.12.6", "minimatch": "^3.0.4", "mock-stdin": "^0.3.0", "prettier": "^1.5.2", "temp": "^0.8.3", "webpack": "^2.1.0-beta.25", "yargs": "^6.3.0" }, "resolutions": { "sshpk": "^1.14.2" }, "engines": { "node": ">=4.0.0" }, "repository": "yarnpkg/yarn", "bin": { "yarn": "./bin/yarn.js", "yarnpkg": "./bin/yarn.js" }, "scripts": { "build": "gulp build", "build-bundle": "node ./scripts/build-webpack.js", "build-chocolatey": "powershell ./scripts/build-chocolatey.ps1", "build-deb": "./scripts/build-deb.sh", "build-dist": "bash ./scripts/build-dist.sh", "build-win-installer": "scripts\\build-windows-installer.bat", "changelog": "git-release-notes $(git describe --tags --abbrev=0 $(git describe --tags --abbrev=0)^)..$(git describe --tags --abbrev=0) scripts/changelog.md", "dupe-check": "yarn jsinspect ./src", "lint": "eslint . && flow check", "pkg-tests": "yarn --cwd packages/pkg-tests jest yarn.test.js", "prettier": "eslint src __tests__ --fix", "release-branch": "./scripts/release-branch.sh", "test": "yarn lint && yarn test-only", "test-only": "node --max_old_space_size=4096 ", "test-only-debug": "node --inspect-brk --max_old_space_size=4096 ", "test-coverage": "node --max_old_space_size=4096 ", "watch": "gulp watch", "commit": "git-cz" }, "jest": { "collectCoverageFrom": ["src/**/*.js"], "testEnvironment": "node", "modulePathIgnorePatterns": ["__tests__/fixtures/", "packages/pkg-tests/pkg-tests-fixtures", "dist/"], "testPathIgnorePatterns": ["__tests__/(fixtures|__mocks__)/", "updates/", "_(temp|mock|install|init|helpers).js$", "packages/pkg-tests"] }, "config": { "commitizen": { "path": "./" } } }; }, , , @@ -14908,7 +23209,7 @@ var require_lockfile = __commonJS({ , /* 150 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true @@ -14946,11 +23247,11 @@ var require_lockfile = __commonJS({ registry: 6, dependencies: 7 }; - function priorityThenAlphaSort(a, b) { - if (priorities[a] || priorities[b]) { - return (priorities[a] || 100) > (priorities[b] || 100) ? 1 : -1; + function priorityThenAlphaSort(a7, b3) { + if (priorities[a7] || priorities[b3]) { + return (priorities[a7] || 100) > (priorities[b3] || 100) ? 1 : -1; } else { - return (0, (_misc || _load_misc()).sortAlpha)(a, b); + return (0, (_misc || _load_misc()).sortAlpha)(a7, b3); } } function _stringify(obj, options) { @@ -14961,16 +23262,16 @@ var require_lockfile = __commonJS({ const lines = []; const keys = Object.keys(obj).sort(priorityThenAlphaSort); let addedKeys = []; - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; + for (let i6 = 0; i6 < keys.length; i6++) { + const key = keys[i6]; const val = obj[key]; if (val == null || addedKeys.indexOf(key) >= 0) { continue; } const valKeys = [key]; if (typeof val === "object") { - for (let j = i + 1; j < keys.length; j++) { - const key2 = keys[j]; + for (let j2 = i6 + 1; j2 < keys.length; j2++) { + const key2 = keys[j2]; if (val === obj[key2]) { valKeys.push(key2); } @@ -15025,7 +23326,7 @@ ${indent}`); , /* 164 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true @@ -15049,7 +23350,7 @@ ${indent}`); if (doOpen) { try { openfd = yield open(dest, "a", data.mode); - } catch (er) { + } catch (er2) { try { openfd = yield open(dest, "r", data.mode); } catch (err) { @@ -15061,7 +23362,7 @@ ${indent}`); if (openfd) { yield futimes(openfd, data.atime, data.mtime); } - } catch (er) { + } catch (er2) { } finally { if (doOpen && openfd) { yield close(openfd); @@ -15134,9 +23435,9 @@ ${indent}`); return _ref2.apply(this, arguments); }; })(); - const fileDatesEqual = exports2.fileDatesEqual = (a, b) => { - const aTime = a.getTime(); - const bTime = b.getTime(); + const fileDatesEqual = exports2.fileDatesEqual = (a7, b3) => { + const aTime = a7.getTime(); + const bTime = b3.getTime(); if (process.platform !== "win32") { return aTime === bTime; } @@ -15157,7 +23458,7 @@ ${indent}`); , /* 169 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true @@ -15181,7 +23482,7 @@ ${indent}`); , /* 171 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true @@ -15231,43 +23532,45 @@ ${indent}`); , /* 173 */ /***/ - function(module2, exports2, __webpack_require__) { - module2.exports = { "default": __webpack_require__(179), __esModule: true }; + function(module3, exports2, __webpack_require__) { + module3.exports = { "default": __webpack_require__(179), __esModule: true }; }, /* 174 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; - module2.exports = balanced; - function balanced(a, b, str) { - if (a instanceof RegExp) a = maybeMatch(a, str); - if (b instanceof RegExp) b = maybeMatch(b, str); - var r = range(a, b, str); - return r && { - start: r[0], - end: r[1], - pre: str.slice(0, r[0]), - body: str.slice(r[0] + a.length, r[1]), - post: str.slice(r[1] + b.length) + module3.exports = balanced; + function balanced(a7, b3, str) { + if (a7 instanceof RegExp) + a7 = maybeMatch(a7, str); + if (b3 instanceof RegExp) + b3 = maybeMatch(b3, str); + var r3 = range(a7, b3, str); + return r3 && { + start: r3[0], + end: r3[1], + pre: str.slice(0, r3[0]), + body: str.slice(r3[0] + a7.length, r3[1]), + post: str.slice(r3[1] + b3.length) }; } function maybeMatch(reg, str) { - var m = str.match(reg); - return m ? m[0] : null; + var m8 = str.match(reg); + return m8 ? m8[0] : null; } balanced.range = range; - function range(a, b, str) { + function range(a7, b3, str) { var begs, beg, left, right, result; - var ai = str.indexOf(a); - var bi = str.indexOf(b, ai + 1); - var i = ai; + var ai = str.indexOf(a7); + var bi = str.indexOf(b3, ai + 1); + var i6 = ai; if (ai >= 0 && bi > 0) { begs = []; left = str.length; - while (i >= 0 && !result) { - if (i == ai) { - begs.push(i); - ai = str.indexOf(a, i + 1); + while (i6 >= 0 && !result) { + if (i6 == ai) { + begs.push(i6); + ai = str.indexOf(a7, i6 + 1); } else if (begs.length == 1) { result = [begs.pop(), bi]; } else { @@ -15276,9 +23579,9 @@ ${indent}`); left = beg; right = bi; } - bi = str.indexOf(b, i + 1); + bi = str.indexOf(b3, i6 + 1); } - i = ai < bi && ai >= 0 ? ai : bi; + i6 = ai < bi && ai >= 0 ? ai : bi; } if (begs.length) { result = [left, right]; @@ -15289,10 +23592,10 @@ ${indent}`); }, /* 175 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var concatMap = __webpack_require__(178); var balanced = __webpack_require__(174); - module2.exports = expandTop; + module3.exports = expandTop; var escSlash = "\0SLASH" + Math.random() + "\0"; var escOpen = "\0OPEN" + Math.random() + "\0"; var escClose = "\0CLOSE" + Math.random() + "\0"; @@ -15311,20 +23614,20 @@ ${indent}`); if (!str) return [""]; var parts = []; - var m = balanced("{", "}", str); - if (!m) + var m8 = balanced("{", "}", str); + if (!m8) return str.split(","); - var pre = m.pre; - var body = m.body; - var post = m.post; - var p = pre.split(","); - p[p.length - 1] += "{" + body + "}"; + var pre = m8.pre; + var body = m8.body; + var post = m8.post; + var p5 = pre.split(","); + p5[p5.length - 1] += "{" + body + "}"; var postParts = parseCommaParts(post); if (post.length) { - p[p.length - 1] += postParts.shift(); - p.push.apply(p, postParts); + p5[p5.length - 1] += postParts.shift(); + p5.push.apply(p5, postParts); } - parts.push.apply(parts, p); + parts.push.apply(parts, p5); return parts; } function expandTop(str) { @@ -15335,8 +23638,8 @@ ${indent}`); } return expand2(escapeBraces(str), true).map(unescapeBraces); } - function identity(e) { - return e; + function identity(e5) { + return e5; } function embrace(str) { return "{" + str + "}"; @@ -15344,87 +23647,88 @@ ${indent}`); function isPadded(el) { return /^-?0\d/.test(el); } - function lte(i, y) { - return i <= y; + function lte(i6, y3) { + return i6 <= y3; } - function gte(i, y) { - return i >= y; + function gte(i6, y3) { + return i6 >= y3; } function expand2(str, isTop) { var expansions = []; - var m = balanced("{", "}", str); - if (!m || /\$$/.test(m.pre)) return [str]; - var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); - var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var m8 = balanced("{", "}", str); + if (!m8 || /\$$/.test(m8.pre)) + return [str]; + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m8.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m8.body); var isSequence = isNumericSequence || isAlphaSequence; - var isOptions = m.body.indexOf(",") >= 0; + var isOptions = m8.body.indexOf(",") >= 0; if (!isSequence && !isOptions) { - if (m.post.match(/,.*\}/)) { - str = m.pre + "{" + m.body + escClose + m.post; + if (m8.post.match(/,.*\}/)) { + str = m8.pre + "{" + m8.body + escClose + m8.post; return expand2(str); } return [str]; } - var n; + var n3; if (isSequence) { - n = m.body.split(/\.\./); + n3 = m8.body.split(/\.\./); } else { - n = parseCommaParts(m.body); - if (n.length === 1) { - n = expand2(n[0], false).map(embrace); - if (n.length === 1) { - var post = m.post.length ? expand2(m.post, false) : [""]; - return post.map(function(p) { - return m.pre + n[0] + p; + n3 = parseCommaParts(m8.body); + if (n3.length === 1) { + n3 = expand2(n3[0], false).map(embrace); + if (n3.length === 1) { + var post = m8.post.length ? expand2(m8.post, false) : [""]; + return post.map(function(p5) { + return m8.pre + n3[0] + p5; }); } } } - var pre = m.pre; - var post = m.post.length ? expand2(m.post, false) : [""]; - var N; + var pre = m8.pre; + var post = m8.post.length ? expand2(m8.post, false) : [""]; + var N2; if (isSequence) { - var x = numeric(n[0]); - var y = numeric(n[1]); - var width = Math.max(n[0].length, n[1].length); - var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1; + var x2 = numeric(n3[0]); + var y3 = numeric(n3[1]); + var width = Math.max(n3[0].length, n3[1].length); + var incr = n3.length == 3 ? Math.abs(numeric(n3[2])) : 1; var test = lte; - var reverse = y < x; + var reverse = y3 < x2; if (reverse) { incr *= -1; test = gte; } - var pad = n.some(isPadded); - N = []; - for (var i = x; test(i, y); i += incr) { - var c; + var pad = n3.some(isPadded); + N2 = []; + for (var i6 = x2; test(i6, y3); i6 += incr) { + var c3; if (isAlphaSequence) { - c = String.fromCharCode(i); - if (c === "\\") - c = ""; + c3 = String.fromCharCode(i6); + if (c3 === "\\") + c3 = ""; } else { - c = String(i); + c3 = String(i6); if (pad) { - var need = width - c.length; + var need = width - c3.length; if (need > 0) { - var z = new Array(need + 1).join("0"); - if (i < 0) - c = "-" + z + c.slice(1); + var z3 = new Array(need + 1).join("0"); + if (i6 < 0) + c3 = "-" + z3 + c3.slice(1); else - c = z + c; + c3 = z3 + c3; } } } - N.push(c); + N2.push(c3); } } else { - N = concatMap(n, function(el) { + N2 = concatMap(n3, function(el) { return expand2(el, false); }); } - for (var j = 0; j < N.length; j++) { - for (var k = 0; k < post.length; k++) { - var expansion = pre + N[j] + post[k]; + for (var j2 = 0; j2 < N2.length; j2++) { + for (var k3 = 0; k3 < post.length; k3++) { + var expansion = pre + N2[j2] + post[k3]; if (!isTop || isSequence || expansion) expansions.push(expansion); } @@ -15434,36 +23738,36 @@ ${indent}`); }, /* 176 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; function preserveCamelCase(str) { let isLastCharLower = false; let isLastCharUpper = false; let isLastLastCharUpper = false; - for (let i = 0; i < str.length; i++) { - const c = str[i]; - if (isLastCharLower && /[a-zA-Z]/.test(c) && c.toUpperCase() === c) { - str = str.substr(0, i) + "-" + str.substr(i); + for (let i6 = 0; i6 < str.length; i6++) { + const c3 = str[i6]; + if (isLastCharLower && /[a-zA-Z]/.test(c3) && c3.toUpperCase() === c3) { + str = str.substr(0, i6) + "-" + str.substr(i6); isLastCharLower = false; isLastLastCharUpper = isLastCharUpper; isLastCharUpper = true; - i++; - } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(c) && c.toLowerCase() === c) { - str = str.substr(0, i - 1) + "-" + str.substr(i - 1); + i6++; + } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(c3) && c3.toLowerCase() === c3) { + str = str.substr(0, i6 - 1) + "-" + str.substr(i6 - 1); isLastLastCharUpper = isLastCharUpper; isLastCharUpper = false; isLastCharLower = true; } else { - isLastCharLower = c.toLowerCase() === c; + isLastCharLower = c3.toLowerCase() === c3; isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = c.toUpperCase() === c; + isLastCharUpper = c3.toUpperCase() === c3; } } return str; } - module2.exports = function(str) { + module3.exports = function(str) { if (arguments.length > 1) { - str = Array.from(arguments).map((x) => x.trim()).filter((x) => x.length).join("-"); + str = Array.from(arguments).map((x2) => x2.trim()).filter((x2) => x2.length).join("-"); } else { str = str.trim(); } @@ -15480,19 +23784,21 @@ ${indent}`); if (hasUpperCase) { str = preserveCamelCase(str); } - return str.replace(/^[_.\- ]+/, "").toLowerCase().replace(/[_.\- ]+(\w|$)/g, (m, p1) => p1.toUpperCase()); + return str.replace(/^[_.\- ]+/, "").toLowerCase().replace(/[_.\- ]+(\w|$)/g, (m8, p1) => p1.toUpperCase()); }; }, , /* 178 */ /***/ - function(module2, exports2) { - module2.exports = function(xs, fn) { + function(module3, exports2) { + module3.exports = function(xs, fn2) { var res = []; - for (var i = 0; i < xs.length; i++) { - var x = fn(xs[i], i); - if (isArray(x)) res.push.apply(res, x); - else res.push(x); + for (var i6 = 0; i6 < xs.length; i6++) { + var x2 = fn2(xs[i6], i6); + if (isArray(x2)) + res.push.apply(res, x2); + else + res.push(x2); } return res; }; @@ -15502,57 +23808,62 @@ ${indent}`); }, /* 179 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { __webpack_require__(205); __webpack_require__(207); __webpack_require__(210); __webpack_require__(206); __webpack_require__(208); __webpack_require__(209); - module2.exports = __webpack_require__(23).Promise; + module3.exports = __webpack_require__(23).Promise; }, /* 180 */ /***/ - function(module2, exports2) { - module2.exports = function() { + function(module3, exports2) { + module3.exports = function() { }; }, /* 181 */ /***/ - function(module2, exports2) { - module2.exports = function(it, Constructor, name, forbiddenField) { - if (!(it instanceof Constructor) || forbiddenField !== void 0 && forbiddenField in it) { + function(module3, exports2) { + module3.exports = function(it2, Constructor, name, forbiddenField) { + if (!(it2 instanceof Constructor) || forbiddenField !== void 0 && forbiddenField in it2) { throw TypeError(name + ": incorrect invocation!"); } - return it; + return it2; }; }, /* 182 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var toIObject = __webpack_require__(74); var toLength = __webpack_require__(110); var toAbsoluteIndex = __webpack_require__(200); - module2.exports = function(IS_INCLUDES) { + module3.exports = function(IS_INCLUDES) { return function($this, el, fromIndex) { - var O = toIObject($this); - var length = toLength(O.length); + var O4 = toIObject($this); + var length = toLength(O4.length); var index = toAbsoluteIndex(fromIndex, length); var value; - if (IS_INCLUDES && el != el) while (length > index) { - value = O[index++]; - if (value != value) return true; - } - else for (; length > index; index++) if (IS_INCLUDES || index in O) { - if (O[index] === el) return IS_INCLUDES || index || 0; - } + if (IS_INCLUDES && el != el) + while (length > index) { + value = O4[index++]; + if (value != value) + return true; + } + else + for (; length > index; index++) + if (IS_INCLUDES || index in O4) { + if (O4[index] === el) + return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; }; }; }, /* 183 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var ctx = __webpack_require__(48); var call = __webpack_require__(187); var isArrayIter = __webpack_require__(186); @@ -15561,30 +23872,35 @@ ${indent}`); var getIterFn = __webpack_require__(203); var BREAK = {}; var RETURN = {}; - var exports2 = module2.exports = function(iterable, entries, fn, that, ITERATOR) { + var exports2 = module3.exports = function(iterable, entries, fn2, that, ITERATOR) { var iterFn = ITERATOR ? function() { return iterable; } : getIterFn(iterable); - var f = ctx(fn, that, entries ? 2 : 1); + var f6 = ctx(fn2, that, entries ? 2 : 1); var index = 0; var length, step, iterator2, result; - if (typeof iterFn != "function") throw TypeError(iterable + " is not iterable!"); - if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) { - result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); - if (result === BREAK || result === RETURN) return result; - } - else for (iterator2 = iterFn.call(iterable); !(step = iterator2.next()).done; ) { - result = call(iterator2, f, step.value, entries); - if (result === BREAK || result === RETURN) return result; - } + if (typeof iterFn != "function") + throw TypeError(iterable + " is not iterable!"); + if (isArrayIter(iterFn)) + for (length = toLength(iterable.length); length > index; index++) { + result = entries ? f6(anObject(step = iterable[index])[0], step[1]) : f6(iterable[index]); + if (result === BREAK || result === RETURN) + return result; + } + else + for (iterator2 = iterFn.call(iterable); !(step = iterator2.next()).done; ) { + result = call(iterator2, f6, step.value, entries); + if (result === BREAK || result === RETURN) + return result; + } }; exports2.BREAK = BREAK; exports2.RETURN = RETURN; }, /* 184 */ /***/ - function(module2, exports2, __webpack_require__) { - module2.exports = !__webpack_require__(33) && !__webpack_require__(85)(function() { + function(module3, exports2, __webpack_require__) { + module3.exports = !__webpack_require__(33) && !__webpack_require__(85)(function() { return Object.defineProperty(__webpack_require__(68)("div"), "a", { get: function() { return 7; } }).a != 7; @@ -15592,51 +23908,52 @@ ${indent}`); }, /* 185 */ /***/ - function(module2, exports2) { - module2.exports = function(fn, args, that) { - var un = that === void 0; + function(module3, exports2) { + module3.exports = function(fn2, args, that) { + var un2 = that === void 0; switch (args.length) { case 0: - return un ? fn() : fn.call(that); + return un2 ? fn2() : fn2.call(that); case 1: - return un ? fn(args[0]) : fn.call(that, args[0]); + return un2 ? fn2(args[0]) : fn2.call(that, args[0]); case 2: - return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]); + return un2 ? fn2(args[0], args[1]) : fn2.call(that, args[0], args[1]); case 3: - return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]); + return un2 ? fn2(args[0], args[1], args[2]) : fn2.call(that, args[0], args[1], args[2]); case 4: - return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]); + return un2 ? fn2(args[0], args[1], args[2], args[3]) : fn2.call(that, args[0], args[1], args[2], args[3]); } - return fn.apply(that, args); + return fn2.apply(that, args); }; }, /* 186 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var Iterators = __webpack_require__(35); var ITERATOR = __webpack_require__(13)("iterator"); var ArrayProto = Array.prototype; - module2.exports = function(it) { - return it !== void 0 && (Iterators.Array === it || ArrayProto[ITERATOR] === it); + module3.exports = function(it2) { + return it2 !== void 0 && (Iterators.Array === it2 || ArrayProto[ITERATOR] === it2); }; }, /* 187 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var anObject = __webpack_require__(27); - module2.exports = function(iterator2, fn, value, entries) { + module3.exports = function(iterator2, fn2, value, entries) { try { - return entries ? fn(anObject(value)[0], value[1]) : fn(value); - } catch (e) { + return entries ? fn2(anObject(value)[0], value[1]) : fn2(value); + } catch (e5) { var ret = iterator2["return"]; - if (ret !== void 0) anObject(ret.call(iterator2)); - throw e; + if (ret !== void 0) + anObject(ret.call(iterator2)); + throw e5; } }; }, /* 188 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; var create = __webpack_require__(192); var descriptor = __webpack_require__(106); @@ -15645,14 +23962,14 @@ ${indent}`); __webpack_require__(31)(IteratorPrototype, __webpack_require__(13)("iterator"), function() { return this; }); - module2.exports = function(Constructor, NAME, next) { + module3.exports = function(Constructor, NAME, next) { Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); setToStringTag(Constructor, NAME + " Iterator"); }; }, /* 189 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var ITERATOR = __webpack_require__(13)("iterator"); var SAFE_CLOSING = false; try { @@ -15663,10 +23980,11 @@ ${indent}`); Array.from(riter, function() { throw 2; }); - } catch (e) { + } catch (e5) { } - module2.exports = function(exec, skipClosing) { - if (!skipClosing && !SAFE_CLOSING) return false; + module3.exports = function(exec, skipClosing) { + if (!skipClosing && !SAFE_CLOSING) + return false; var safe = false; try { var arr = [7]; @@ -15678,51 +23996,55 @@ ${indent}`); return iter; }; exec(arr); - } catch (e) { + } catch (e5) { } return safe; }; }, /* 190 */ /***/ - function(module2, exports2) { - module2.exports = function(done, value) { + function(module3, exports2) { + module3.exports = function(done, value) { return { value, done: !!done }; }; }, /* 191 */ /***/ - function(module2, exports2, __webpack_require__) { - var global = __webpack_require__(11); + function(module3, exports2, __webpack_require__) { + var global2 = __webpack_require__(11); var macrotask = __webpack_require__(109).set; - var Observer = global.MutationObserver || global.WebKitMutationObserver; - var process4 = global.process; - var Promise2 = global.Promise; + var Observer = global2.MutationObserver || global2.WebKitMutationObserver; + var process4 = global2.process; + var Promise2 = global2.Promise; var isNode = __webpack_require__(47)(process4) == "process"; - module2.exports = function() { + module3.exports = function() { var head, last, notify; var flush = function() { - var parent, fn; - if (isNode && (parent = process4.domain)) parent.exit(); + var parent, fn2; + if (isNode && (parent = process4.domain)) + parent.exit(); while (head) { - fn = head.fn; + fn2 = head.fn; head = head.next; try { - fn(); - } catch (e) { - if (head) notify(); - else last = void 0; - throw e; + fn2(); + } catch (e5) { + if (head) + notify(); + else + last = void 0; + throw e5; } } last = void 0; - if (parent) parent.enter(); + if (parent) + parent.enter(); }; if (isNode) { notify = function() { process4.nextTick(flush); }; - } else if (Observer && !(global.navigator && global.navigator.standalone)) { + } else if (Observer && !(global2.navigator && global2.navigator.standalone)) { var toggle = true; var node = document.createTextNode(""); new Observer(flush).observe(node, { characterData: true }); @@ -15736,12 +24058,13 @@ ${indent}`); }; } else { notify = function() { - macrotask.call(global, flush); + macrotask.call(global2, flush); }; } - return function(fn) { - var task = { fn, next: void 0 }; - if (last) last.next = task; + return function(fn2) { + var task = { fn: fn2, next: void 0 }; + if (last) + last.next = task; if (!head) { head = task; notify(); @@ -15752,7 +24075,7 @@ ${indent}`); }, /* 192 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var anObject = __webpack_require__(27); var dPs = __webpack_require__(193); var enumBugKeys = __webpack_require__(101); @@ -15762,200 +24085,218 @@ ${indent}`); var PROTOTYPE = "prototype"; var createDict = function() { var iframe = __webpack_require__(68)("iframe"); - var i = enumBugKeys.length; - var lt = "<"; - var gt = ">"; + var i6 = enumBugKeys.length; + var lt2 = "<"; + var gt2 = ">"; var iframeDocument; iframe.style.display = "none"; __webpack_require__(102).appendChild(iframe); iframe.src = "javascript:"; iframeDocument = iframe.contentWindow.document; iframeDocument.open(); - iframeDocument.write(lt + "script" + gt + "document.F=Object" + lt + "/script" + gt); + iframeDocument.write(lt2 + "script" + gt2 + "document.F=Object" + lt2 + "/script" + gt2); iframeDocument.close(); createDict = iframeDocument.F; - while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; + while (i6--) + delete createDict[PROTOTYPE][enumBugKeys[i6]]; return createDict(); }; - module2.exports = Object.create || function create(O, Properties) { + module3.exports = Object.create || function create(O4, Properties) { var result; - if (O !== null) { - Empty[PROTOTYPE] = anObject(O); + if (O4 !== null) { + Empty[PROTOTYPE] = anObject(O4); result = new Empty(); Empty[PROTOTYPE] = null; - result[IE_PROTO] = O; - } else result = createDict(); + result[IE_PROTO] = O4; + } else + result = createDict(); return Properties === void 0 ? result : dPs(result, Properties); }; }, /* 193 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var dP = __webpack_require__(50); var anObject = __webpack_require__(27); var getKeys = __webpack_require__(132); - module2.exports = __webpack_require__(33) ? Object.defineProperties : function defineProperties(O, Properties) { - anObject(O); + module3.exports = __webpack_require__(33) ? Object.defineProperties : function defineProperties(O4, Properties) { + anObject(O4); var keys = getKeys(Properties); var length = keys.length; - var i = 0; - var P; - while (length > i) dP.f(O, P = keys[i++], Properties[P]); - return O; + var i6 = 0; + var P3; + while (length > i6) + dP.f(O4, P3 = keys[i6++], Properties[P3]); + return O4; }; }, /* 194 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var has = __webpack_require__(49); var toObject = __webpack_require__(133); var IE_PROTO = __webpack_require__(72)("IE_PROTO"); var ObjectProto = Object.prototype; - module2.exports = Object.getPrototypeOf || function(O) { - O = toObject(O); - if (has(O, IE_PROTO)) return O[IE_PROTO]; - if (typeof O.constructor == "function" && O instanceof O.constructor) { - return O.constructor.prototype; - } - return O instanceof Object ? ObjectProto : null; + module3.exports = Object.getPrototypeOf || function(O4) { + O4 = toObject(O4); + if (has(O4, IE_PROTO)) + return O4[IE_PROTO]; + if (typeof O4.constructor == "function" && O4 instanceof O4.constructor) { + return O4.constructor.prototype; + } + return O4 instanceof Object ? ObjectProto : null; }; }, /* 195 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var has = __webpack_require__(49); var toIObject = __webpack_require__(74); var arrayIndexOf = __webpack_require__(182)(false); var IE_PROTO = __webpack_require__(72)("IE_PROTO"); - module2.exports = function(object, names) { - var O = toIObject(object); - var i = 0; + module3.exports = function(object, names) { + var O4 = toIObject(object); + var i6 = 0; var result = []; var key; - for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); - while (names.length > i) if (has(O, key = names[i++])) { - ~arrayIndexOf(result, key) || result.push(key); - } + for (key in O4) + if (key != IE_PROTO) + has(O4, key) && result.push(key); + while (names.length > i6) + if (has(O4, key = names[i6++])) { + ~arrayIndexOf(result, key) || result.push(key); + } return result; }; }, /* 196 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var hide = __webpack_require__(31); - module2.exports = function(target, src, safe) { + module3.exports = function(target, src, safe) { for (var key in src) { - if (safe && target[key]) target[key] = src[key]; - else hide(target, key, src[key]); + if (safe && target[key]) + target[key] = src[key]; + else + hide(target, key, src[key]); } return target; }; }, /* 197 */ /***/ - function(module2, exports2, __webpack_require__) { - module2.exports = __webpack_require__(31); + function(module3, exports2, __webpack_require__) { + module3.exports = __webpack_require__(31); }, /* 198 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; - var global = __webpack_require__(11); + var global2 = __webpack_require__(11); var core = __webpack_require__(23); var dP = __webpack_require__(50); var DESCRIPTORS = __webpack_require__(33); var SPECIES = __webpack_require__(13)("species"); - module2.exports = function(KEY) { - var C = typeof core[KEY] == "function" ? core[KEY] : global[KEY]; - if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { - configurable: true, - get: function() { - return this; - } - }); + module3.exports = function(KEY) { + var C4 = typeof core[KEY] == "function" ? core[KEY] : global2[KEY]; + if (DESCRIPTORS && C4 && !C4[SPECIES]) + dP.f(C4, SPECIES, { + configurable: true, + get: function() { + return this; + } + }); }; }, /* 199 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var toInteger = __webpack_require__(73); var defined = __webpack_require__(67); - module2.exports = function(TO_STRING) { + module3.exports = function(TO_STRING) { return function(that, pos) { - var s = String(defined(that)); - var i = toInteger(pos); - var l = s.length; - var a, b; - if (i < 0 || i >= l) return TO_STRING ? "" : void 0; - a = s.charCodeAt(i); - return a < 55296 || a > 56319 || i + 1 === l || (b = s.charCodeAt(i + 1)) < 56320 || b > 57343 ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 55296 << 10) + (b - 56320) + 65536; + var s5 = String(defined(that)); + var i6 = toInteger(pos); + var l3 = s5.length; + var a7, b3; + if (i6 < 0 || i6 >= l3) + return TO_STRING ? "" : void 0; + a7 = s5.charCodeAt(i6); + return a7 < 55296 || a7 > 56319 || i6 + 1 === l3 || (b3 = s5.charCodeAt(i6 + 1)) < 56320 || b3 > 57343 ? TO_STRING ? s5.charAt(i6) : a7 : TO_STRING ? s5.slice(i6, i6 + 2) : (a7 - 55296 << 10) + (b3 - 56320) + 65536; }; }; }, /* 200 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var toInteger = __webpack_require__(73); var max = Math.max; var min = Math.min; - module2.exports = function(index, length) { + module3.exports = function(index, length) { index = toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); }; }, /* 201 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var isObject = __webpack_require__(34); - module2.exports = function(it, S) { - if (!isObject(it)) return it; - var fn, val; - if (S && typeof (fn = it.toString) == "function" && !isObject(val = fn.call(it))) return val; - if (typeof (fn = it.valueOf) == "function" && !isObject(val = fn.call(it))) return val; - if (!S && typeof (fn = it.toString) == "function" && !isObject(val = fn.call(it))) return val; + module3.exports = function(it2, S2) { + if (!isObject(it2)) + return it2; + var fn2, val; + if (S2 && typeof (fn2 = it2.toString) == "function" && !isObject(val = fn2.call(it2))) + return val; + if (typeof (fn2 = it2.valueOf) == "function" && !isObject(val = fn2.call(it2))) + return val; + if (!S2 && typeof (fn2 = it2.toString) == "function" && !isObject(val = fn2.call(it2))) + return val; throw TypeError("Can't convert object to primitive value"); }; }, /* 202 */ /***/ - function(module2, exports2, __webpack_require__) { - var global = __webpack_require__(11); - var navigator2 = global.navigator; - module2.exports = navigator2 && navigator2.userAgent || ""; + function(module3, exports2, __webpack_require__) { + var global2 = __webpack_require__(11); + var navigator2 = global2.navigator; + module3.exports = navigator2 && navigator2.userAgent || ""; }, /* 203 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var classof = __webpack_require__(100); var ITERATOR = __webpack_require__(13)("iterator"); var Iterators = __webpack_require__(35); - module2.exports = __webpack_require__(23).getIteratorMethod = function(it) { - if (it != void 0) return it[ITERATOR] || it["@@iterator"] || Iterators[classof(it)]; + module3.exports = __webpack_require__(23).getIteratorMethod = function(it2) { + if (it2 != void 0) + return it2[ITERATOR] || it2["@@iterator"] || Iterators[classof(it2)]; }; }, /* 204 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; var addToUnscopables = __webpack_require__(180); var step = __webpack_require__(190); var Iterators = __webpack_require__(35); var toIObject = __webpack_require__(74); - module2.exports = __webpack_require__(103)(Array, "Array", function(iterated, kind) { + module3.exports = __webpack_require__(103)(Array, "Array", function(iterated, kind) { this._t = toIObject(iterated); this._i = 0; this._k = kind; }, function() { - var O = this._t; + var O4 = this._t; var kind = this._k; var index = this._i++; - if (!O || index >= O.length) { + if (!O4 || index >= O4.length) { this._t = void 0; return step(1); } - if (kind == "keys") return step(0, index); - if (kind == "values") return step(0, O[index]); - return step(0, [index, O[index]]); + if (kind == "keys") + return step(0, index); + if (kind == "values") + return step(0, O4[index]); + return step(0, [index, O4[index]]); }, "values"); Iterators.Arguments = Iterators.Array; addToUnscopables("keys"); @@ -15964,14 +24305,14 @@ ${indent}`); }, /* 205 */ /***/ - function(module2, exports2) { + function(module3, exports2) { }, /* 206 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; var LIBRARY = __webpack_require__(69); - var global = __webpack_require__(11); + var global2 = __webpack_require__(11); var ctx = __webpack_require__(48); var classof = __webpack_require__(100); var $export = __webpack_require__(41); @@ -15987,11 +24328,11 @@ ${indent}`); var userAgent2 = __webpack_require__(202); var promiseResolve = __webpack_require__(105); var PROMISE = "Promise"; - var TypeError2 = global.TypeError; - var process4 = global.process; + var TypeError2 = global2.TypeError; + var process4 = global2.process; var versions = process4 && process4.versions; var v8 = versions && versions.v8 || ""; - var $Promise = global[PROMISE]; + var $Promise = global2[PROMISE]; var isNode = classof(process4) == "process"; var empty = function() { }; @@ -16004,21 +24345,22 @@ ${indent}`); exec(empty, empty); }; return (isNode || typeof PromiseRejectionEvent == "function") && promise.then(empty) instanceof FakePromise && v8.indexOf("6.6") !== 0 && userAgent2.indexOf("Chrome/66") === -1; - } catch (e) { + } catch (e5) { } }(); - var isThenable = function(it) { + var isThenable = function(it2) { var then; - return isObject(it) && typeof (then = it.then) == "function" ? then : false; + return isObject(it2) && typeof (then = it2.then) == "function" ? then : false; }; var notify = function(promise, isReject) { - if (promise._n) return; + if (promise._n) + return; promise._n = true; var chain = promise._c; microtask(function() { var value = promise._v; var ok = promise._s == 1; - var i = 0; + var i6 = 0; var run = function(reaction) { var handler2 = ok ? reaction.ok : reaction.fail; var resolve = reaction.resolve; @@ -16028,12 +24370,15 @@ ${indent}`); try { if (handler2) { if (!ok) { - if (promise._h == 2) onHandleUnhandled(promise); + if (promise._h == 2) + onHandleUnhandled(promise); promise._h = 1; } - if (handler2 === true) result = value; + if (handler2 === true) + result = value; else { - if (domain) domain.enter(); + if (domain) + domain.enter(); result = handler2(value); if (domain) { domain.exit(); @@ -16044,21 +24389,26 @@ ${indent}`); reject(TypeError2("Promise-chain cycle")); } else if (then = isThenable(result)) { then.call(result, resolve, reject); - } else resolve(result); - } else reject(value); - } catch (e) { - if (domain && !exited) domain.exit(); - reject(e); + } else + resolve(result); + } else + reject(value); + } catch (e5) { + if (domain && !exited) + domain.exit(); + reject(e5); } }; - while (chain.length > i) run(chain[i++]); + while (chain.length > i6) + run(chain[i6++]); promise._c = []; promise._n = false; - if (isReject && !promise._h) onUnhandled(promise); + if (isReject && !promise._h) + onUnhandled(promise); }); }; var onUnhandled = function(promise) { - task.call(global, function() { + task.call(global2, function() { var value = promise._v; var unhandled = isUnhandled(promise); var result, handler2, console2; @@ -16066,56 +24416,61 @@ ${indent}`); result = perform(function() { if (isNode) { process4.emit("unhandledRejection", value, promise); - } else if (handler2 = global.onunhandledrejection) { + } else if (handler2 = global2.onunhandledrejection) { handler2({ promise, reason: value }); - } else if ((console2 = global.console) && console2.error) { + } else if ((console2 = global2.console) && console2.error) { console2.error("Unhandled promise rejection", value); } }); promise._h = isNode || isUnhandled(promise) ? 2 : 1; } promise._a = void 0; - if (unhandled && result.e) throw result.v; + if (unhandled && result.e) + throw result.v; }); }; var isUnhandled = function(promise) { return promise._h !== 1 && (promise._a || promise._c).length === 0; }; var onHandleUnhandled = function(promise) { - task.call(global, function() { + task.call(global2, function() { var handler2; if (isNode) { process4.emit("rejectionHandled", promise); - } else if (handler2 = global.onrejectionhandled) { + } else if (handler2 = global2.onrejectionhandled) { handler2({ promise, reason: promise._v }); } }); }; var $reject = function(value) { var promise = this; - if (promise._d) return; + if (promise._d) + return; promise._d = true; promise = promise._w || promise; promise._v = value; promise._s = 2; - if (!promise._a) promise._a = promise._c.slice(); + if (!promise._a) + promise._a = promise._c.slice(); notify(promise, true); }; var $resolve = function(value) { var promise = this; var then; - if (promise._d) return; + if (promise._d) + return; promise._d = true; promise = promise._w || promise; try { - if (promise === value) throw TypeError2("Promise can't be resolved itself"); + if (promise === value) + throw TypeError2("Promise can't be resolved itself"); if (then = isThenable(value)) { microtask(function() { var wrapper = { _w: promise, _d: false }; try { then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); - } catch (e) { - $reject.call(wrapper, e); + } catch (e5) { + $reject.call(wrapper, e5); } }); } else { @@ -16123,8 +24478,8 @@ ${indent}`); promise._s = 1; notify(promise, false); } - } catch (e) { - $reject.call({ _w: promise, _d: false }, e); + } catch (e5) { + $reject.call({ _w: promise, _d: false }, e5); } }; if (!USE_NATIVE) { @@ -16155,8 +24510,10 @@ ${indent}`); reaction.fail = typeof onRejected == "function" && onRejected; reaction.domain = isNode ? process4.domain : void 0; this._c.push(reaction); - if (this._a) this._a.push(reaction); - if (this._s) notify(this, false); + if (this._a) + this._a.push(reaction); + if (this._s) + notify(this, false); return reaction.promise; }, // 25.4.5.1 Promise.prototype.catch(onRejected) @@ -16170,8 +24527,8 @@ ${indent}`); this.resolve = ctx($resolve, promise, 1); this.reject = ctx($reject, promise, 1); }; - newPromiseCapabilityModule.f = newPromiseCapability = function(C) { - return C === $Promise || C === Wrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C); + newPromiseCapabilityModule.f = newPromiseCapability = function(C4) { + return C4 === $Promise || C4 === Wrapper ? new OwnPromiseCapability(C4) : newGenericPromiseCapability(C4); }; } $export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise }); @@ -16180,17 +24537,17 @@ ${indent}`); Wrapper = __webpack_require__(23)[PROMISE]; $export($export.S + $export.F * !USE_NATIVE, PROMISE, { // 25.4.4.5 Promise.reject(r) - reject: function reject(r) { + reject: function reject(r3) { var capability = newPromiseCapability(this); var $$reject = capability.reject; - $$reject(r); + $$reject(r3); return capability.promise; } }); $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { // 25.4.4.6 Promise.resolve(x) - resolve: function resolve(x) { - return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x); + resolve: function resolve(x2) { + return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x2); } }); $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(189)(function(iter) { @@ -16198,8 +24555,8 @@ ${indent}`); })), PROMISE, { // 25.4.4.1 Promise.all(iterable) all: function all(iterable) { - var C = this; - var capability = newPromiseCapability(C); + var C4 = this; + var capability = newPromiseCapability(C4); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function() { @@ -16211,8 +24568,9 @@ ${indent}`); var alreadyCalled = false; values.push(void 0); remaining++; - C.resolve(promise).then(function(value) { - if (alreadyCalled) return; + C4.resolve(promise).then(function(value) { + if (alreadyCalled) + return; alreadyCalled = true; values[$index] = value; --remaining || resolve(values); @@ -16220,63 +24578,66 @@ ${indent}`); }); --remaining || resolve(values); }); - if (result.e) reject(result.v); + if (result.e) + reject(result.v); return capability.promise; }, // 25.4.4.4 Promise.race(iterable) race: function race(iterable) { - var C = this; - var capability = newPromiseCapability(C); + var C4 = this; + var capability = newPromiseCapability(C4); var reject = capability.reject; var result = perform(function() { forOf(iterable, false, function(promise) { - C.resolve(promise).then(capability.resolve, reject); + C4.resolve(promise).then(capability.resolve, reject); }); }); - if (result.e) reject(result.v); + if (result.e) + reject(result.v); return capability.promise; } }); }, /* 207 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; var $at = __webpack_require__(199)(true); __webpack_require__(103)(String, "String", function(iterated) { this._t = String(iterated); this._i = 0; }, function() { - var O = this._t; + var O4 = this._t; var index = this._i; var point; - if (index >= O.length) return { value: void 0, done: true }; - point = $at(O, index); + if (index >= O4.length) + return { value: void 0, done: true }; + point = $at(O4, index); this._i += point.length; return { value: point, done: false }; }); }, /* 208 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; var $export = __webpack_require__(41); var core = __webpack_require__(23); - var global = __webpack_require__(11); + var global2 = __webpack_require__(11); var speciesConstructor = __webpack_require__(108); var promiseResolve = __webpack_require__(105); $export($export.P + $export.R, "Promise", { "finally": function(onFinally) { - var C = speciesConstructor(this, core.Promise || global.Promise); + var C4 = speciesConstructor(this, core.Promise || global2.Promise); var isFunction = typeof onFinally == "function"; return this.then( - isFunction ? function(x) { - return promiseResolve(C, onFinally()).then(function() { - return x; + isFunction ? function(x2) { + return promiseResolve(C4, onFinally()).then(function() { + return x2; }); } : onFinally, - isFunction ? function(e) { - return promiseResolve(C, onFinally()).then(function() { - throw e; + isFunction ? function(e5) { + return promiseResolve(C4, onFinally()).then(function() { + throw e5; }); } : onFinally ); @@ -16284,7 +24645,7 @@ ${indent}`); }, /* 209 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; var $export = __webpack_require__(41); var newPromiseCapability = __webpack_require__(70); @@ -16298,25 +24659,26 @@ ${indent}`); }, /* 210 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { __webpack_require__(204); - var global = __webpack_require__(11); + var global2 = __webpack_require__(11); var hide = __webpack_require__(31); var Iterators = __webpack_require__(35); var TO_STRING_TAG = __webpack_require__(13)("toStringTag"); var DOMIterables = "CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","); - for (var i = 0; i < DOMIterables.length; i++) { - var NAME = DOMIterables[i]; - var Collection2 = global[NAME]; + for (var i6 = 0; i6 < DOMIterables.length; i6++) { + var NAME = DOMIterables[i6]; + var Collection2 = global2[NAME]; var proto2 = Collection2 && Collection2.prototype; - if (proto2 && !proto2[TO_STRING_TAG]) hide(proto2, TO_STRING_TAG, NAME); + if (proto2 && !proto2[TO_STRING_TAG]) + hide(proto2, TO_STRING_TAG, NAME); Iterators[NAME] = Iterators.Array; } }, /* 211 */ /***/ - function(module2, exports2, __webpack_require__) { - exports2 = module2.exports = __webpack_require__(112); + function(module3, exports2, __webpack_require__) { + exports2 = module3.exports = __webpack_require__(112); exports2.log = log; exports2.formatArgs = formatArgs; exports2.save = save; @@ -16414,9 +24776,9 @@ ${indent}`); typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // double check webkit in userAgent just in case we are in a worker typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); } - exports2.formatters.j = function(v) { + exports2.formatters.j = function(v4) { try { - return JSON.stringify(v); + return JSON.stringify(v4); } catch (err) { return "[UnexpectedJSONParseError]: " + err.message; } @@ -16424,19 +24786,21 @@ ${indent}`); function formatArgs(args) { var useColors2 = this.useColors; args[0] = (useColors2 ? "%c" : "") + this.namespace + (useColors2 ? " %c" : " ") + args[0] + (useColors2 ? "%c " : " ") + "+" + exports2.humanize(this.diff); - if (!useColors2) return; - var c = "color: " + this.color; - args.splice(1, 0, c, "color: inherit"); + if (!useColors2) + return; + var c3 = "color: " + this.color; + args.splice(1, 0, c3, "color: inherit"); var index = 0; var lastC = 0; args[0].replace(/%[a-zA-Z%]/g, function(match) { - if ("%%" === match) return; + if ("%%" === match) + return; index++; if ("%c" === match) { lastC = index; } }); - args.splice(lastC, 0, c); + args.splice(lastC, 0, c3); } function log() { return "object" === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments); @@ -16448,43 +24812,43 @@ ${indent}`); } else { exports2.storage.debug = namespaces; } - } catch (e) { + } catch (e5) { } } function load() { - var r; + var r3; try { - r = exports2.storage.debug; - } catch (e) { + r3 = exports2.storage.debug; + } catch (e5) { } - if (!r && typeof process !== "undefined" && "env" in process) { - r = process.env.DEBUG; + if (!r3 && typeof process !== "undefined" && "env" in process) { + r3 = process.env.DEBUG; } - return r; + return r3; } exports2.enable(load()); function localstorage() { try { return window.localStorage; - } catch (e) { + } catch (e5) { } } }, /* 212 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { if (typeof process === "undefined" || process.type === "renderer") { - module2.exports = __webpack_require__(211); + module3.exports = __webpack_require__(211); } else { - module2.exports = __webpack_require__(213); + module3.exports = __webpack_require__(213); } }, /* 213 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var tty3 = __webpack_require__(79); var util = __webpack_require__(2); - exports2 = module2.exports = __webpack_require__(112); + exports2 = module3.exports = __webpack_require__(112); exports2.init = init; exports2.log = log; exports2.formatArgs = formatArgs; @@ -16579,36 +24943,40 @@ ${indent}`); exports2.inspectOpts = Object.keys(process.env).filter(function(key) { return /^debug_/i.test(key); }).reduce(function(obj, key) { - var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function(_, k) { - return k.toUpperCase(); + var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function(_4, k3) { + return k3.toUpperCase(); }); var val = process.env[key]; - if (/^(yes|on|true|enabled)$/i.test(val)) val = true; - else if (/^(no|off|false|disabled)$/i.test(val)) val = false; - else if (val === "null") val = null; - else val = Number(val); + if (/^(yes|on|true|enabled)$/i.test(val)) + val = true; + else if (/^(no|off|false|disabled)$/i.test(val)) + val = false; + else if (val === "null") + val = null; + else + val = Number(val); obj[prop] = val; return obj; }, {}); function useColors() { return "colors" in exports2.inspectOpts ? Boolean(exports2.inspectOpts.colors) : tty3.isatty(process.stderr.fd); } - exports2.formatters.o = function(v) { + exports2.formatters.o = function(v4) { this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts).split("\n").map(function(str) { + return util.inspect(v4, this.inspectOpts).split("\n").map(function(str) { return str.trim(); }).join(" "); }; - exports2.formatters.O = function(v) { + exports2.formatters.O = function(v4) { this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts); + return util.inspect(v4, this.inspectOpts); }; function formatArgs(args) { var name = this.namespace; var useColors2 = this.useColors; if (useColors2) { - var c = this.color; - var colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c); + var c3 = this.color; + var colorCode = "\x1B[3" + (c3 < 8 ? c3 : "8;5;" + c3); var prefix = " " + colorCode + ";1m" + name + " \x1B[0m"; args[0] = prefix + args[0].split("\n").join("\n" + prefix); args.push(colorCode + "m+" + exports2.humanize(this.diff) + "\x1B[0m"); @@ -16639,8 +25007,8 @@ ${indent}`); function init(debug) { debug.inspectOpts = {}; var keys = Object.keys(exports2.inspectOpts); - for (var i = 0; i < keys.length; i++) { - debug.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]]; + for (var i6 = 0; i6 < keys.length; i6++) { + debug.inspectOpts[keys[i6]] = exports2.inspectOpts[keys[i6]]; } } exports2.enable(load()); @@ -16650,7 +25018,7 @@ ${indent}`); , /* 217 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var pathModule = __webpack_require__(0); var isWindows = process.platform === "win32"; var fs = __webpack_require__(3); @@ -16698,31 +25066,31 @@ ${indent}`); } else { var splitRootRe = /^[\/]*/; } - exports2.realpathSync = function realpathSync(p, cache) { - p = pathModule.resolve(p); - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return cache[p]; + exports2.realpathSync = function realpathSync(p5, cache) { + p5 = pathModule.resolve(p5); + if (cache && Object.prototype.hasOwnProperty.call(cache, p5)) { + return cache[p5]; } - var original = p, seenLinks = {}, knownHard = {}; + var original = p5, seenLinks = {}, knownHard = {}; var pos; var current; var base; var previous; start(); function start() { - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; + var m8 = splitRootRe.exec(p5); + pos = m8[0].length; + current = m8[0]; + base = m8[0]; previous = ""; if (isWindows && !knownHard[base]) { fs.lstatSync(base); knownHard[base] = true; } } - while (pos < p.length) { + while (pos < p5.length) { nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); + var result = nextPartRe.exec(p5); previous = current; current += result[0]; base = previous + result[1]; @@ -16737,7 +25105,8 @@ ${indent}`); var stat = fs.lstatSync(base); if (!stat.isSymbolicLink()) { knownHard[base] = true; - if (cache) cache[base] = base; + if (cache) + cache[base] = base; continue; } var linkTarget = null; @@ -16752,39 +25121,43 @@ ${indent}`); linkTarget = fs.readlinkSync(base); } resolvedLink = pathModule.resolve(previous, linkTarget); - if (cache) cache[base] = resolvedLink; - if (!isWindows) seenLinks[id] = linkTarget; + if (cache) + cache[base] = resolvedLink; + if (!isWindows) + seenLinks[id] = linkTarget; } - p = pathModule.resolve(resolvedLink, p.slice(pos)); + p5 = pathModule.resolve(resolvedLink, p5.slice(pos)); start(); } - if (cache) cache[original] = p; - return p; + if (cache) + cache[original] = p5; + return p5; }; - exports2.realpath = function realpath(p, cache, cb) { + exports2.realpath = function realpath(p5, cache, cb) { if (typeof cb !== "function") { cb = maybeCallback(cache); cache = null; } - p = pathModule.resolve(p); - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return process.nextTick(cb.bind(null, null, cache[p])); + p5 = pathModule.resolve(p5); + if (cache && Object.prototype.hasOwnProperty.call(cache, p5)) { + return process.nextTick(cb.bind(null, null, cache[p5])); } - var original = p, seenLinks = {}, knownHard = {}; + var original = p5, seenLinks = {}, knownHard = {}; var pos; var current; var base; var previous; start(); function start() { - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; + var m8 = splitRootRe.exec(p5); + pos = m8[0].length; + current = m8[0]; + base = m8[0]; previous = ""; if (isWindows && !knownHard[base]) { fs.lstat(base, function(err) { - if (err) return cb(err); + if (err) + return cb(err); knownHard[base] = true; LOOP(); }); @@ -16793,12 +25166,13 @@ ${indent}`); } } function LOOP() { - if (pos >= p.length) { - if (cache) cache[original] = p; - return cb(null, p); + if (pos >= p5.length) { + if (cache) + cache[original] = p5; + return cb(null, p5); } nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); + var result = nextPartRe.exec(p5); previous = current; current += result[0]; base = previous + result[1]; @@ -16812,10 +25186,12 @@ ${indent}`); return fs.lstat(base, gotStat); } function gotStat(err, stat) { - if (err) return cb(err); + if (err) + return cb(err); if (!stat.isSymbolicLink()) { knownHard[base] = true; - if (cache) cache[base] = base; + if (cache) + cache[base] = base; return process.nextTick(LOOP); } if (!isWindows) { @@ -16825,29 +25201,33 @@ ${indent}`); } } fs.stat(base, function(err2) { - if (err2) return cb(err2); + if (err2) + return cb(err2); fs.readlink(base, function(err3, target) { - if (!isWindows) seenLinks[id] = target; + if (!isWindows) + seenLinks[id] = target; gotTarget(err3, target); }); }); } function gotTarget(err, target, base2) { - if (err) return cb(err); + if (err) + return cb(err); var resolvedLink = pathModule.resolve(previous, target); - if (cache) cache[base2] = resolvedLink; + if (cache) + cache[base2] = resolvedLink; gotResolvedLink(resolvedLink); } function gotResolvedLink(resolvedLink) { - p = pathModule.resolve(resolvedLink, p.slice(pos)); + p5 = pathModule.resolve(resolvedLink, p5.slice(pos)); start(); } }; }, /* 218 */ /***/ - function(module2, exports2, __webpack_require__) { - module2.exports = globSync; + function(module3, exports2, __webpack_require__) { + module3.exports = globSync; globSync.GlobSync = GlobSync; var fs = __webpack_require__(3); var rp = __webpack_require__(114); @@ -16880,10 +25260,10 @@ ${indent}`); setopts(this, pattern, options); if (this.noprocess) return this; - var n = this.minimatch.set.length; - this.matches = new Array(n); - for (var i = 0; i < n; i++) { - this._process(this.minimatch.set[i], i, false); + var n3 = this.minimatch.set.length; + this.matches = new Array(n3); + for (var i6 = 0; i6 < n3; i6++) { + this._process(this.minimatch.set[i6], i6, false); } this._finish(); } @@ -16893,16 +25273,16 @@ ${indent}`); var self2 = this; this.matches.forEach(function(matchset, index) { var set = self2.matches[index] = /* @__PURE__ */ Object.create(null); - for (var p in matchset) { + for (var p5 in matchset) { try { - p = self2._makeAbs(p); - var real = rp.realpathSync(p, self2.realpathCache); + p5 = self2._makeAbs(p5); + var real = rp.realpathSync(p5, self2.realpathCache); set[real] = true; - } catch (er) { - if (er.syscall === "stat") - set[self2._makeAbs(p)] = true; + } catch (er2) { + if (er2.syscall === "stat") + set[self2._makeAbs(p5)] = true; else - throw er; + throw er2; } } }); @@ -16911,13 +25291,12 @@ ${indent}`); }; GlobSync.prototype._process = function(pattern, index, inGlobStar) { assert2(this instanceof GlobSync); - var n = 0; - while (typeof pattern[n] === "string") { - n++; + var n3 = 0; + while (typeof pattern[n3] === "string") { + n3++; } var prefix; - switch (n) { - // if not, then this is rather simple + switch (n3) { case pattern.length: this._processSimple(pattern.join("/"), index); return; @@ -16925,10 +25304,10 @@ ${indent}`); prefix = null; break; default: - prefix = pattern.slice(0, n).join("/"); + prefix = pattern.slice(0, n3).join("/"); break; } - var remain = pattern.slice(n); + var remain = pattern.slice(n3); var read; if (prefix === null) read = "."; @@ -16951,22 +25330,22 @@ ${indent}`); var entries = this._readdir(abs, inGlobStar); if (!entries) return; - var pn = remain[0]; + var pn2 = remain[0]; var negate = !!this.minimatch.negate; - var rawGlob = pn._glob; + var rawGlob = pn2._glob; var dotOk = this.dot || rawGlob.charAt(0) === "."; var matchedEntries = []; - for (var i = 0; i < entries.length; i++) { - var e = entries[i]; - if (e.charAt(0) !== "." || dotOk) { - var m; + for (var i6 = 0; i6 < entries.length; i6++) { + var e5 = entries[i6]; + if (e5.charAt(0) !== "." || dotOk) { + var m8; if (negate && !prefix) { - m = !e.match(pn); + m8 = !e5.match(pn2); } else { - m = e.match(pn); + m8 = e5.match(pn2); } - if (m) - matchedEntries.push(e); + if (m8) + matchedEntries.push(e5); } } var len = matchedEntries.length; @@ -16975,51 +25354,51 @@ ${indent}`); if (remain.length === 1 && !this.mark && !this.stat) { if (!this.matches[index]) this.matches[index] = /* @__PURE__ */ Object.create(null); - for (var i = 0; i < len; i++) { - var e = matchedEntries[i]; + for (var i6 = 0; i6 < len; i6++) { + var e5 = matchedEntries[i6]; if (prefix) { if (prefix.slice(-1) !== "/") - e = prefix + "/" + e; + e5 = prefix + "/" + e5; else - e = prefix + e; + e5 = prefix + e5; } - if (e.charAt(0) === "/" && !this.nomount) { - e = path.join(this.root, e); + if (e5.charAt(0) === "/" && !this.nomount) { + e5 = path.join(this.root, e5); } - this._emitMatch(index, e); + this._emitMatch(index, e5); } return; } remain.shift(); - for (var i = 0; i < len; i++) { - var e = matchedEntries[i]; + for (var i6 = 0; i6 < len; i6++) { + var e5 = matchedEntries[i6]; var newPattern; if (prefix) - newPattern = [prefix, e]; + newPattern = [prefix, e5]; else - newPattern = [e]; + newPattern = [e5]; this._process(newPattern.concat(remain), index, inGlobStar); } }; - GlobSync.prototype._emitMatch = function(index, e) { - if (isIgnored(this, e)) + GlobSync.prototype._emitMatch = function(index, e5) { + if (isIgnored(this, e5)) return; - var abs = this._makeAbs(e); + var abs = this._makeAbs(e5); if (this.mark) - e = this._mark(e); + e5 = this._mark(e5); if (this.absolute) { - e = abs; + e5 = abs; } - if (this.matches[index][e]) + if (this.matches[index][e5]) return; if (this.nodir) { - var c = this.cache[abs]; - if (c === "DIR" || Array.isArray(c)) + var c3 = this.cache[abs]; + if (c3 === "DIR" || Array.isArray(c3)) return; } - this.matches[index][e] = true; + this.matches[index][e5] = true; if (this.stat) - this._stat(e); + this._stat(e5); }; GlobSync.prototype._readdirInGlobStar = function(abs) { if (this.follow) @@ -17029,8 +25408,8 @@ ${indent}`); var stat; try { lstat = fs.lstatSync(abs); - } catch (er) { - if (er.code === "ENOENT") { + } catch (er2) { + if (er2.code === "ENOENT") { return null; } } @@ -17047,60 +25426,58 @@ ${indent}`); if (inGlobStar && !ownProp(this.symlinks, abs)) return this._readdirInGlobStar(abs); if (ownProp(this.cache, abs)) { - var c = this.cache[abs]; - if (!c || c === "FILE") + var c3 = this.cache[abs]; + if (!c3 || c3 === "FILE") return null; - if (Array.isArray(c)) - return c; + if (Array.isArray(c3)) + return c3; } try { return this._readdirEntries(abs, fs.readdirSync(abs)); - } catch (er) { - this._readdirError(abs, er); + } catch (er2) { + this._readdirError(abs, er2); return null; } }; GlobSync.prototype._readdirEntries = function(abs, entries) { if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i++) { - var e = entries[i]; + for (var i6 = 0; i6 < entries.length; i6++) { + var e5 = entries[i6]; if (abs === "/") - e = abs + e; + e5 = abs + e5; else - e = abs + "/" + e; - this.cache[e] = true; + e5 = abs + "/" + e5; + this.cache[e5] = true; } } this.cache[abs] = entries; return entries; }; - GlobSync.prototype._readdirError = function(f, er) { - switch (er.code) { + GlobSync.prototype._readdirError = function(f6, er2) { + switch (er2.code) { case "ENOTSUP": - // https://github.com/isaacs/node-glob/issues/205 case "ENOTDIR": - var abs = this._makeAbs(f); + var abs = this._makeAbs(f6); this.cache[abs] = "FILE"; if (abs === this.cwdAbs) { - var error = new Error(er.code + " invalid cwd " + this.cwd); + var error = new Error(er2.code + " invalid cwd " + this.cwd); error.path = this.cwd; - error.code = er.code; + error.code = er2.code; throw error; } break; case "ENOENT": - // not terribly unusual case "ELOOP": case "ENAMETOOLONG": case "UNKNOWN": - this.cache[this._makeAbs(f)] = false; + this.cache[this._makeAbs(f6)] = false; break; default: - this.cache[this._makeAbs(f)] = false; + this.cache[this._makeAbs(f6)] = false; if (this.strict) - throw er; + throw er2; if (!this.silent) - console.error("glob error", er); + console.error("glob error", er2); break; } }; @@ -17116,13 +25493,13 @@ ${indent}`); var isSym = this.symlinks[abs]; if (isSym && inGlobStar) return; - for (var i = 0; i < len; i++) { - var e = entries[i]; - if (e.charAt(0) === "." && !this.dot) + for (var i6 = 0; i6 < len; i6++) { + var e5 = entries[i6]; + if (e5.charAt(0) === "." && !this.dot) continue; - var instead = gspref.concat(entries[i], remainWithoutGlobStar); + var instead = gspref.concat(entries[i6], remainWithoutGlobStar); this._process(instead, index, true); - var below = gspref.concat(entries[i], remain); + var below = gspref.concat(entries[i6], remain); this._process(below, index, true); } }; @@ -17146,18 +25523,18 @@ ${indent}`); prefix = prefix.replace(/\\/g, "/"); this._emitMatch(index, prefix); }; - GlobSync.prototype._stat = function(f) { - var abs = this._makeAbs(f); - var needDir = f.slice(-1) === "/"; - if (f.length > this.maxLength) + GlobSync.prototype._stat = function(f6) { + var abs = this._makeAbs(f6); + var needDir = f6.slice(-1) === "/"; + if (f6.length > this.maxLength) return false; if (!this.stat && ownProp(this.cache, abs)) { - var c = this.cache[abs]; - if (Array.isArray(c)) - c = "DIR"; - if (!needDir || c === "DIR") - return c; - if (needDir && c === "FILE") + var c3 = this.cache[abs]; + if (Array.isArray(c3)) + c3 = "DIR"; + if (!needDir || c3 === "DIR") + return c3; + if (needDir && c3 === "FILE") return false; } var exists; @@ -17166,8 +25543,8 @@ ${indent}`); var lstat; try { lstat = fs.lstatSync(abs); - } catch (er) { - if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) { + } catch (er2) { + if (er2 && (er2.code === "ENOENT" || er2.code === "ENOTDIR")) { this.statCache[abs] = false; return false; } @@ -17175,7 +25552,7 @@ ${indent}`); if (lstat && lstat.isSymbolicLink()) { try { stat = fs.statSync(abs); - } catch (er) { + } catch (er2) { stat = lstat; } } else { @@ -17183,28 +25560,28 @@ ${indent}`); } } this.statCache[abs] = stat; - var c = true; + var c3 = true; if (stat) - c = stat.isDirectory() ? "DIR" : "FILE"; - this.cache[abs] = this.cache[abs] || c; - if (needDir && c === "FILE") + c3 = stat.isDirectory() ? "DIR" : "FILE"; + this.cache[abs] = this.cache[abs] || c3; + if (needDir && c3 === "FILE") return false; - return c; + return c3; }; - GlobSync.prototype._mark = function(p) { - return common.mark(this, p); + GlobSync.prototype._mark = function(p5) { + return common.mark(this, p5); }; - GlobSync.prototype._makeAbs = function(f) { - return common.makeAbs(this, f); + GlobSync.prototype._makeAbs = function(f6) { + return common.makeAbs(this, f6); }; }, , , /* 221 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; - module2.exports = function(flag, argv) { + module3.exports = function(flag, argv) { argv = argv || process.argv; var terminatorPos = argv.indexOf("--"); var prefix = /^--/.test(flag) ? "" : "--"; @@ -17215,11 +25592,11 @@ ${indent}`); , /* 223 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { var wrappy = __webpack_require__(123); var reqs = /* @__PURE__ */ Object.create(null); var once = __webpack_require__(61); - module2.exports = wrappy(inflight); + module3.exports = wrappy(inflight); function inflight(key, cb) { if (reqs[key]) { reqs[key].push(cb); @@ -17235,8 +25612,8 @@ ${indent}`); var len = cbs.length; var args = slice(arguments); try { - for (var i = 0; i < len; i++) { - cbs[i].apply(null, args); + for (var i6 = 0; i6 < len; i6++) { + cbs[i6].apply(null, args); } } finally { if (cbs.length > len) { @@ -17253,15 +25630,16 @@ ${indent}`); function slice(args) { var length = args.length; var array = []; - for (var i = 0; i < length; i++) array[i] = args[i]; + for (var i6 = 0; i6 < length; i6++) + array[i6] = args[i6]; return array; } }, /* 224 */ /***/ - function(module2, exports2) { + function(module3, exports2) { if (typeof Object.create === "function") { - module2.exports = function inherits(ctor, superCtor) { + module3.exports = function inherits(ctor, superCtor) { ctor.super_ = superCtor; ctor.prototype = Object.create(superCtor.prototype, { constructor: { @@ -17273,7 +25651,7 @@ ${indent}`); }); }; } else { - module2.exports = function inherits(ctor, superCtor) { + module3.exports = function inherits(ctor, superCtor) { ctor.super_ = superCtor; var TempCtor = function() { }; @@ -17287,19 +25665,19 @@ ${indent}`); , /* 227 */ /***/ - function(module2, exports2, __webpack_require__) { - module2.exports = typeof __webpack_require__ !== "undefined"; + function(module3, exports2, __webpack_require__) { + module3.exports = typeof __webpack_require__ !== "undefined"; }, , /* 229 */ /***/ - function(module2, exports2) { - var s = 1e3; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var y = d * 365.25; - module2.exports = function(val, options) { + function(module3, exports2) { + var s5 = 1e3; + var m8 = s5 * 60; + var h3 = m8 * 60; + var d5 = h3 * 24; + var y3 = d5 * 365.25; + module3.exports = function(val, options) { options = options || {}; var type = typeof val; if (type === "string" && val.length > 0) { @@ -17322,7 +25700,7 @@ ${indent}`); if (!match) { return; } - var n = parseFloat(match[1]); + var n3 = parseFloat(match[1]); var type = (match[2] || "ms").toLowerCase(); switch (type) { case "years": @@ -17330,65 +25708,65 @@ ${indent}`); case "yrs": case "yr": case "y": - return n * y; + return n3 * y3; case "days": case "day": case "d": - return n * d; + return n3 * d5; case "hours": case "hour": case "hrs": case "hr": case "h": - return n * h; + return n3 * h3; case "minutes": case "minute": case "mins": case "min": case "m": - return n * m; + return n3 * m8; case "seconds": case "second": case "secs": case "sec": case "s": - return n * s; + return n3 * s5; case "milliseconds": case "millisecond": case "msecs": case "msec": case "ms": - return n; + return n3; default: return void 0; } } function fmtShort(ms) { - if (ms >= d) { - return Math.round(ms / d) + "d"; + if (ms >= d5) { + return Math.round(ms / d5) + "d"; } - if (ms >= h) { - return Math.round(ms / h) + "h"; + if (ms >= h3) { + return Math.round(ms / h3) + "h"; } - if (ms >= m) { - return Math.round(ms / m) + "m"; + if (ms >= m8) { + return Math.round(ms / m8) + "m"; } - if (ms >= s) { - return Math.round(ms / s) + "s"; + if (ms >= s5) { + return Math.round(ms / s5) + "s"; } return ms + "ms"; } function fmtLong(ms) { - return plural(ms, d, "day") || plural(ms, h, "hour") || plural(ms, m, "minute") || plural(ms, s, "second") || ms + " ms"; + return plural(ms, d5, "day") || plural(ms, h3, "hour") || plural(ms, m8, "minute") || plural(ms, s5, "second") || ms + " ms"; } - function plural(ms, n, name) { - if (ms < n) { + function plural(ms, n3, name) { + if (ms < n3) { return; } - if (ms < n * 1.5) { - return Math.floor(ms / n) + " " + name; + if (ms < n3 * 1.5) { + return Math.floor(ms / n3) + " " + name; } - return Math.ceil(ms / n) + " " + name + "s"; + return Math.ceil(ms / n3) + " " + name + "s"; } }, , @@ -17396,13 +25774,13 @@ ${indent}`); , /* 233 */ /***/ - function(module2, exports2, __webpack_require__) { - module2.exports = rimraf; + function(module3, exports2, __webpack_require__) { + module3.exports = rimraf; rimraf.sync = rimrafSync; var assert2 = __webpack_require__(22); var path = __webpack_require__(0); var fs = __webpack_require__(3); - var glob = __webpack_require__(75); + var glob2 = __webpack_require__(75); var _0666 = parseInt("666", 8); var defaultGlobOpts = { nosort: true, @@ -17419,10 +25797,10 @@ ${indent}`); "rmdir", "readdir" ]; - methods.forEach(function(m) { - options[m] = options[m] || fs[m]; - m = m + "Sync"; - options[m] = options[m] || fs[m]; + methods.forEach(function(m8) { + options[m8] = options[m8] || fs[m8]; + m8 = m8 + "Sync"; + options[m8] = options[m8] || fs[m8]; }); options.maxBusyTries = options.maxBusyTries || 3; options.emfileWait = options.emfileWait || 1e3; @@ -17432,247 +25810,248 @@ ${indent}`); options.disableGlob = options.disableGlob || false; options.glob = options.glob || defaultGlobOpts; } - function rimraf(p, options, cb) { + function rimraf(p5, options, cb) { if (typeof options === "function") { cb = options; options = {}; } - assert2(p, "rimraf: missing path"); - assert2.equal(typeof p, "string", "rimraf: path should be a string"); + assert2(p5, "rimraf: missing path"); + assert2.equal(typeof p5, "string", "rimraf: path should be a string"); assert2.equal(typeof cb, "function", "rimraf: callback function required"); assert2(options, "rimraf: invalid options argument provided"); assert2.equal(typeof options, "object", "rimraf: options should be object"); defaults(options); var busyTries = 0; var errState = null; - var n = 0; - if (options.disableGlob || !glob.hasMagic(p)) - return afterGlob(null, [p]); - options.lstat(p, function(er, stat) { - if (!er) - return afterGlob(null, [p]); - glob(p, options.glob, afterGlob); + var n3 = 0; + if (options.disableGlob || !glob2.hasMagic(p5)) + return afterGlob(null, [p5]); + options.lstat(p5, function(er2, stat) { + if (!er2) + return afterGlob(null, [p5]); + glob2(p5, options.glob, afterGlob); }); - function next(er) { - errState = errState || er; - if (--n === 0) + function next(er2) { + errState = errState || er2; + if (--n3 === 0) cb(errState); } - function afterGlob(er, results) { - if (er) - return cb(er); - n = results.length; - if (n === 0) + function afterGlob(er2, results) { + if (er2) + return cb(er2); + n3 = results.length; + if (n3 === 0) return cb(); - results.forEach(function(p2) { - rimraf_(p2, options, function CB(er2) { - if (er2) { - if ((er2.code === "EBUSY" || er2.code === "ENOTEMPTY" || er2.code === "EPERM") && busyTries < options.maxBusyTries) { + results.forEach(function(p6) { + rimraf_(p6, options, function CB(er3) { + if (er3) { + if ((er3.code === "EBUSY" || er3.code === "ENOTEMPTY" || er3.code === "EPERM") && busyTries < options.maxBusyTries) { busyTries++; var time = busyTries * 100; return setTimeout(function() { - rimraf_(p2, options, CB); + rimraf_(p6, options, CB); }, time); } - if (er2.code === "EMFILE" && timeout < options.emfileWait) { + if (er3.code === "EMFILE" && timeout < options.emfileWait) { return setTimeout(function() { - rimraf_(p2, options, CB); + rimraf_(p6, options, CB); }, timeout++); } - if (er2.code === "ENOENT") er2 = null; + if (er3.code === "ENOENT") + er3 = null; } timeout = 0; - next(er2); + next(er3); }); }); } } - function rimraf_(p, options, cb) { - assert2(p); + function rimraf_(p5, options, cb) { + assert2(p5); assert2(options); assert2(typeof cb === "function"); - options.lstat(p, function(er, st) { - if (er && er.code === "ENOENT") + options.lstat(p5, function(er2, st2) { + if (er2 && er2.code === "ENOENT") return cb(null); - if (er && er.code === "EPERM" && isWindows) - fixWinEPERM(p, options, er, cb); - if (st && st.isDirectory()) - return rmdir(p, options, er, cb); - options.unlink(p, function(er2) { - if (er2) { - if (er2.code === "ENOENT") + if (er2 && er2.code === "EPERM" && isWindows) + fixWinEPERM(p5, options, er2, cb); + if (st2 && st2.isDirectory()) + return rmdir(p5, options, er2, cb); + options.unlink(p5, function(er3) { + if (er3) { + if (er3.code === "ENOENT") return cb(null); - if (er2.code === "EPERM") - return isWindows ? fixWinEPERM(p, options, er2, cb) : rmdir(p, options, er2, cb); - if (er2.code === "EISDIR") - return rmdir(p, options, er2, cb); + if (er3.code === "EPERM") + return isWindows ? fixWinEPERM(p5, options, er3, cb) : rmdir(p5, options, er3, cb); + if (er3.code === "EISDIR") + return rmdir(p5, options, er3, cb); } - return cb(er2); + return cb(er3); }); }); } - function fixWinEPERM(p, options, er, cb) { - assert2(p); + function fixWinEPERM(p5, options, er2, cb) { + assert2(p5); assert2(options); assert2(typeof cb === "function"); - if (er) - assert2(er instanceof Error); - options.chmod(p, _0666, function(er2) { - if (er2) - cb(er2.code === "ENOENT" ? null : er); + if (er2) + assert2(er2 instanceof Error); + options.chmod(p5, _0666, function(er22) { + if (er22) + cb(er22.code === "ENOENT" ? null : er2); else - options.stat(p, function(er3, stats) { + options.stat(p5, function(er3, stats) { if (er3) - cb(er3.code === "ENOENT" ? null : er); + cb(er3.code === "ENOENT" ? null : er2); else if (stats.isDirectory()) - rmdir(p, options, er, cb); + rmdir(p5, options, er2, cb); else - options.unlink(p, cb); + options.unlink(p5, cb); }); }); } - function fixWinEPERMSync(p, options, er) { - assert2(p); + function fixWinEPERMSync(p5, options, er2) { + assert2(p5); assert2(options); - if (er) - assert2(er instanceof Error); + if (er2) + assert2(er2 instanceof Error); try { - options.chmodSync(p, _0666); - } catch (er2) { - if (er2.code === "ENOENT") + options.chmodSync(p5, _0666); + } catch (er22) { + if (er22.code === "ENOENT") return; else - throw er; + throw er2; } try { - var stats = options.statSync(p); + var stats = options.statSync(p5); } catch (er3) { if (er3.code === "ENOENT") return; else - throw er; + throw er2; } if (stats.isDirectory()) - rmdirSync(p, options, er); + rmdirSync(p5, options, er2); else - options.unlinkSync(p); + options.unlinkSync(p5); } - function rmdir(p, options, originalEr, cb) { - assert2(p); + function rmdir(p5, options, originalEr, cb) { + assert2(p5); assert2(options); if (originalEr) assert2(originalEr instanceof Error); assert2(typeof cb === "function"); - options.rmdir(p, function(er) { - if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) - rmkids(p, options, cb); - else if (er && er.code === "ENOTDIR") + options.rmdir(p5, function(er2) { + if (er2 && (er2.code === "ENOTEMPTY" || er2.code === "EEXIST" || er2.code === "EPERM")) + rmkids(p5, options, cb); + else if (er2 && er2.code === "ENOTDIR") cb(originalEr); else - cb(er); + cb(er2); }); } - function rmkids(p, options, cb) { - assert2(p); + function rmkids(p5, options, cb) { + assert2(p5); assert2(options); assert2(typeof cb === "function"); - options.readdir(p, function(er, files) { - if (er) - return cb(er); - var n = files.length; - if (n === 0) - return options.rmdir(p, cb); + options.readdir(p5, function(er2, files) { + if (er2) + return cb(er2); + var n3 = files.length; + if (n3 === 0) + return options.rmdir(p5, cb); var errState; - files.forEach(function(f) { - rimraf(path.join(p, f), options, function(er2) { + files.forEach(function(f6) { + rimraf(path.join(p5, f6), options, function(er3) { if (errState) return; - if (er2) - return cb(errState = er2); - if (--n === 0) - options.rmdir(p, cb); + if (er3) + return cb(errState = er3); + if (--n3 === 0) + options.rmdir(p5, cb); }); }); }); } - function rimrafSync(p, options) { + function rimrafSync(p5, options) { options = options || {}; defaults(options); - assert2(p, "rimraf: missing path"); - assert2.equal(typeof p, "string", "rimraf: path should be a string"); + assert2(p5, "rimraf: missing path"); + assert2.equal(typeof p5, "string", "rimraf: path should be a string"); assert2(options, "rimraf: missing options"); assert2.equal(typeof options, "object", "rimraf: options should be object"); var results; - if (options.disableGlob || !glob.hasMagic(p)) { - results = [p]; + if (options.disableGlob || !glob2.hasMagic(p5)) { + results = [p5]; } else { try { - options.lstatSync(p); - results = [p]; - } catch (er) { - results = glob.sync(p, options.glob); + options.lstatSync(p5); + results = [p5]; + } catch (er2) { + results = glob2.sync(p5, options.glob); } } if (!results.length) return; - for (var i = 0; i < results.length; i++) { - var p = results[i]; + for (var i6 = 0; i6 < results.length; i6++) { + var p5 = results[i6]; try { - var st = options.lstatSync(p); - } catch (er) { - if (er.code === "ENOENT") + var st2 = options.lstatSync(p5); + } catch (er2) { + if (er2.code === "ENOENT") return; - if (er.code === "EPERM" && isWindows) - fixWinEPERMSync(p, options, er); + if (er2.code === "EPERM" && isWindows) + fixWinEPERMSync(p5, options, er2); } try { - if (st && st.isDirectory()) - rmdirSync(p, options, null); + if (st2 && st2.isDirectory()) + rmdirSync(p5, options, null); else - options.unlinkSync(p); - } catch (er) { - if (er.code === "ENOENT") + options.unlinkSync(p5); + } catch (er2) { + if (er2.code === "ENOENT") return; - if (er.code === "EPERM") - return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er); - if (er.code !== "EISDIR") - throw er; - rmdirSync(p, options, er); + if (er2.code === "EPERM") + return isWindows ? fixWinEPERMSync(p5, options, er2) : rmdirSync(p5, options, er2); + if (er2.code !== "EISDIR") + throw er2; + rmdirSync(p5, options, er2); } } } - function rmdirSync(p, options, originalEr) { - assert2(p); + function rmdirSync(p5, options, originalEr) { + assert2(p5); assert2(options); if (originalEr) assert2(originalEr instanceof Error); try { - options.rmdirSync(p); - } catch (er) { - if (er.code === "ENOENT") + options.rmdirSync(p5); + } catch (er2) { + if (er2.code === "ENOENT") return; - if (er.code === "ENOTDIR") + if (er2.code === "ENOTDIR") throw originalEr; - if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") - rmkidsSync(p, options); + if (er2.code === "ENOTEMPTY" || er2.code === "EEXIST" || er2.code === "EPERM") + rmkidsSync(p5, options); } } - function rmkidsSync(p, options) { - assert2(p); + function rmkidsSync(p5, options) { + assert2(p5); assert2(options); - options.readdirSync(p).forEach(function(f) { - rimrafSync(path.join(p, f), options); + options.readdirSync(p5).forEach(function(f6) { + rimrafSync(path.join(p5, f6), options); }); var retries = isWindows ? 100 : 1; - var i = 0; + var i6 = 0; do { var threw = true; try { - var ret = options.rmdirSync(p, options); + var ret = options.rmdirSync(p5, options); threw = false; return ret; } finally { - if (++i < retries && threw) + if (++i6 < retries && threw) continue; } } while (true); @@ -17685,7 +26064,7 @@ ${indent}`); , /* 239 */ /***/ - function(module2, exports2, __webpack_require__) { + function(module3, exports2, __webpack_require__) { "use strict"; var hasFlag3 = __webpack_require__(221); var support = function(level) { @@ -17744,7 +26123,7 @@ ${indent}`); if (supportLevel === 0 && "FORCE_COLOR" in process.env) { supportLevel = 1; } - module2.exports = process && support(supportLevel); + module3.exports = process && support(supportLevel); } /******/ ]); @@ -17837,15 +26216,15 @@ var require_visit = __commonJS({ if (typeof ctrl !== "symbol") { if (identity.isCollection(node)) { path = Object.freeze(path.concat(node)); - for (let i = 0; i < node.items.length; ++i) { - const ci = visit_(i, node.items[i], visitor, path); + for (let i6 = 0; i6 < node.items.length; ++i6) { + const ci = visit_(i6, node.items[i6], visitor, path); if (typeof ci === "number") - i = ci - 1; + i6 = ci - 1; else if (ci === BREAK) return BREAK; else if (ci === REMOVE) { - node.items.splice(i, 1); - i -= 1; + node.items.splice(i6, 1); + i6 -= 1; } } } else if (identity.isPair(node)) { @@ -17885,15 +26264,15 @@ var require_visit = __commonJS({ if (typeof ctrl !== "symbol") { if (identity.isCollection(node)) { path = Object.freeze(path.concat(node)); - for (let i = 0; i < node.items.length; ++i) { - const ci = await visitAsync_(i, node.items[i], visitor, path); + for (let i6 = 0; i6 < node.items.length; ++i6) { + const ci = await visitAsync_(i6, node.items[i6], visitor, path); if (typeof ci === "number") - i = ci - 1; + i6 = ci - 1; else if (ci === BREAK) return BREAK; else if (ci === REMOVE) { - node.items.splice(i, 1); - i -= 1; + node.items.splice(i6, 1); + i6 -= 1; } } } else if (identity.isPair(node)) { @@ -17980,7 +26359,7 @@ var require_directives = __commonJS({ "{": "%7B", "}": "%7D" }; - var escapeTagName = (tn) => tn.replace(/[!,[\]{}]/g, (ch) => escapeChars[ch]); + var escapeTagName = (tn2) => tn2.replace(/[!,[\]{}]/g, (ch) => escapeChars[ch]); var Directives = class _Directives { constructor(yaml, tags) { this.docStart = null; @@ -18125,7 +26504,7 @@ var require_directives = __commonJS({ for (const [handle, prefix] of tagEntries) { if (handle === "!!" && prefix === "tag:yaml.org,2002:") continue; - if (!doc || tagNames.some((tn) => tn.startsWith(prefix))) + if (!doc || tagNames.some((tn2) => tn2.startsWith(prefix))) lines.push(`%TAG ${handle} ${prefix}`); } return lines.join("\n"); @@ -18162,8 +26541,8 @@ var require_anchors = __commonJS({ return anchors; } function findNewAnchor(prefix, exclude) { - for (let i = 1; true; ++i) { - const name = `${prefix}${i}`; + for (let i6 = 1; true; ++i6) { + const name = `${prefix}${i6}`; if (!exclude.has(name)) return name; } @@ -18214,22 +26593,22 @@ var require_applyReviver = __commonJS({ function applyReviver(reviver, obj, key, val) { if (val && typeof val === "object") { if (Array.isArray(val)) { - for (let i = 0, len = val.length; i < len; ++i) { - const v0 = val[i]; - const v1 = applyReviver(reviver, val, String(i), v0); + for (let i6 = 0, len = val.length; i6 < len; ++i6) { + const v0 = val[i6]; + const v1 = applyReviver(reviver, val, String(i6), v0); if (v1 === void 0) - delete val[i]; + delete val[i6]; else if (v1 !== v0) - val[i] = v1; + val[i6] = v1; } } else if (val instanceof Map) { - for (const k of Array.from(val.keys())) { - const v0 = val.get(k); - const v1 = applyReviver(reviver, val, k, v0); + for (const k3 of Array.from(val.keys())) { + const v0 = val.get(k3); + const v1 = applyReviver(reviver, val, k3, v0); if (v1 === void 0) - val.delete(k); + val.delete(k3); else if (v1 !== v0) - val.set(k, v1); + val.set(k3, v1); } } else if (val instanceof Set) { for (const v0 of Array.from(val)) { @@ -18242,12 +26621,12 @@ var require_applyReviver = __commonJS({ } } } else { - for (const [k, v0] of Object.entries(val)) { - const v1 = applyReviver(reviver, val, k, v0); + for (const [k3, v0] of Object.entries(val)) { + const v1 = applyReviver(reviver, val, k3, v0); if (v1 === void 0) - delete val[k]; + delete val[k3]; else if (v1 !== v0) - val[k] = v1; + val[k3] = v1; } } } @@ -18264,7 +26643,7 @@ var require_toJS = __commonJS({ var identity = require_identity(); function toJS(value, arg, ctx) { if (Array.isArray(value)) - return value.map((v, i) => toJS(v, String(i), ctx)); + return value.map((v4, i6) => toJS(v4, String(i6), ctx)); if (value && typeof value.toJSON === "function") { if (!ctx || !identity.hasAnchor(value)) return value.toJSON(arg, ctx); @@ -18426,9 +26805,9 @@ var require_Alias = __commonJS({ } else if (identity.isCollection(node)) { let count = 0; for (const item of node.items) { - const c = getAliasCount(doc, item, anchors2); - if (c > count) - count = c; + const c3 = getAliasCount(doc, item, anchors2); + if (c3 > count) + count = c3; } return count; } else if (identity.isPair(node)) { @@ -18482,13 +26861,13 @@ var require_createNode = __commonJS({ var defaultTagPrefix = "tag:yaml.org,2002:"; function findTagObject(value, tagName, tags) { if (tagName) { - const match = tags.filter((t) => t.tag === tagName); - const tagObj = match.find((t) => !t.format) ?? match[0]; + const match = tags.filter((t3) => t3.tag === tagName); + const tagObj = match.find((t3) => !t3.format) ?? match[0]; if (!tagObj) throw new Error(`Tag ${tagName} not found`); return tagObj; } - return tags.find((t) => t.identify?.(value) && !t.format); + return tags.find((t3) => t3.identify?.(value) && !t3.format); } function createNode(value, tagName, ctx) { if (identity.isDocument(value)) @@ -18555,18 +26934,18 @@ var require_Collection = __commonJS({ var identity = require_identity(); var Node = require_Node(); function collectionFromPath(schema, path, value) { - let v = value; - for (let i = path.length - 1; i >= 0; --i) { - const k = path[i]; - if (typeof k === "number" && Number.isInteger(k) && k >= 0) { - const a = []; - a[k] = v; - v = a; + let v4 = value; + for (let i6 = path.length - 1; i6 >= 0; --i6) { + const k3 = path[i6]; + if (typeof k3 === "number" && Number.isInteger(k3) && k3 >= 0) { + const a7 = []; + a7[k3] = v4; + v4 = a7; } else { - v = /* @__PURE__ */ new Map([[k, v]]); + v4 = /* @__PURE__ */ new Map([[k3, v4]]); } } - return createNode.createNode(v, void 0, { + return createNode.createNode(v4, void 0, { aliasDuplicateObjects: false, keepUndefined: false, onAnchor: () => { @@ -18596,7 +26975,7 @@ var require_Collection = __commonJS({ const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this)); if (schema) copy.schema = schema; - copy.items = copy.items.map((it) => identity.isNode(it) || identity.isPair(it) ? it.clone(schema) : it); + copy.items = copy.items.map((it2) => identity.isNode(it2) || identity.isPair(it2) ? it2.clone(schema) : it2); if (this.range) copy.range = this.range.slice(); return copy; @@ -18651,8 +27030,8 @@ var require_Collection = __commonJS({ return this.items.every((node) => { if (!identity.isPair(node)) return false; - const n = node.value; - return n == null || allowScalar && identity.isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag; + const n3 = node.value; + return n3 == null || allowScalar && identity.isScalar(n3) && n3.value == null && !n3.commentBefore && !n3.comment && !n3.tag; }); } /** @@ -18734,44 +27113,44 @@ var require_foldFlowLines = __commonJS({ let split = void 0; let prev = void 0; let overflow = false; - let i = -1; + let i6 = -1; let escStart = -1; let escEnd = -1; if (mode === FOLD_BLOCK) { - i = consumeMoreIndentedLines(text, i, indent.length); - if (i !== -1) - end = i + endStep; + i6 = consumeMoreIndentedLines(text, i6, indent.length); + if (i6 !== -1) + end = i6 + endStep; } - for (let ch; ch = text[i += 1]; ) { + for (let ch; ch = text[i6 += 1]; ) { if (mode === FOLD_QUOTED && ch === "\\") { - escStart = i; - switch (text[i + 1]) { + escStart = i6; + switch (text[i6 + 1]) { case "x": - i += 3; + i6 += 3; break; case "u": - i += 5; + i6 += 5; break; case "U": - i += 9; + i6 += 9; break; default: - i += 1; + i6 += 1; } - escEnd = i; + escEnd = i6; } if (ch === "\n") { if (mode === FOLD_BLOCK) - i = consumeMoreIndentedLines(text, i, indent.length); - end = i + indent.length + endStep; + i6 = consumeMoreIndentedLines(text, i6, indent.length); + end = i6 + indent.length + endStep; split = void 0; } else { if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") { - const next = text[i + 1]; + const next = text[i6 + 1]; if (next && next !== " " && next !== "\n" && next !== " ") - split = i; + split = i6; } - if (i >= end) { + if (i6 >= end) { if (split) { folds.push(split); end = split + endStep; @@ -18779,15 +27158,15 @@ var require_foldFlowLines = __commonJS({ } else if (mode === FOLD_QUOTED) { while (prev === " " || prev === " ") { prev = ch; - ch = text[i += 1]; + ch = text[i6 += 1]; overflow = true; } - const j = i > escEnd + 1 ? i - 2 : escStart - 1; - if (escapedFolds[j]) + const j2 = i6 > escEnd + 1 ? i6 - 2 : escStart - 1; + if (escapedFolds[j2]) return text; - folds.push(j); - escapedFolds[j] = true; - end = j + endStep; + folds.push(j2); + escapedFolds[j2] = true; + end = j2 + endStep; split = void 0; } else { overflow = true; @@ -18803,9 +27182,9 @@ var require_foldFlowLines = __commonJS({ if (onFold) onFold(); let res = text.slice(0, folds[0]); - for (let i2 = 0; i2 < folds.length; ++i2) { - const fold = folds[i2]; - const end2 = folds[i2 + 1] || text.length; + for (let i7 = 0; i7 < folds.length; ++i7) { + const fold = folds[i7]; + const end2 = folds[i7 + 1] || text.length; if (fold === 0) res = ` ${indent}${text.slice(0, end2)}`; @@ -18818,19 +27197,19 @@ ${indent}${text.slice(fold + 1, end2)}`; } return res; } - function consumeMoreIndentedLines(text, i, indent) { - let end = i; - let start = i + 1; + function consumeMoreIndentedLines(text, i6, indent) { + let end = i6; + let start = i6 + 1; let ch = text[start]; while (ch === " " || ch === " ") { - if (i < start + indent) { - ch = text[++i]; + if (i6 < start + indent) { + ch = text[++i6]; } else { do { - ch = text[++i]; + ch = text[++i6]; } while (ch && ch !== "\n"); - end = i; - start = i + 1; + end = i6; + start = i6 + 1; ch = text[start]; } } @@ -18862,11 +27241,11 @@ var require_stringifyString = __commonJS({ const strLen = str.length; if (strLen <= limit) return false; - for (let i = 0, start = 0; i < strLen; ++i) { - if (str[i] === "\n") { - if (i - start > limit) + for (let i6 = 0, start = 0; i6 < strLen; ++i6) { + if (str[i6] === "\n") { + if (i6 - start > limit) return true; - start = i + 1; + start = i6 + 1; if (strLen - start <= limit) return false; } @@ -18882,19 +27261,19 @@ var require_stringifyString = __commonJS({ const indent = ctx.indent || (containsDocumentMarker(value) ? " " : ""); let str = ""; let start = 0; - for (let i = 0, ch = json[i]; ch; ch = json[++i]) { - if (ch === " " && json[i + 1] === "\\" && json[i + 2] === "n") { - str += json.slice(start, i) + "\\ "; - i += 1; - start = i; + for (let i6 = 0, ch = json[i6]; ch; ch = json[++i6]) { + if (ch === " " && json[i6 + 1] === "\\" && json[i6 + 2] === "n") { + str += json.slice(start, i6) + "\\ "; + i6 += 1; + start = i6; ch = "\\"; } if (ch === "\\") - switch (json[i + 1]) { + switch (json[i6 + 1]) { case "u": { - str += json.slice(start, i); - const code = json.substr(i + 2, 4); + str += json.slice(start, i6); + const code = json.substr(i6 + 2, 4); switch (code) { case "0000": str += "\\0"; @@ -18924,30 +27303,30 @@ var require_stringifyString = __commonJS({ if (code.substr(0, 2) === "00") str += "\\x" + code.substr(2); else - str += json.substr(i, 6); + str += json.substr(i6, 6); } - i += 5; - start = i + 1; + i6 += 5; + start = i6 + 1; } break; case "n": - if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) { - i += 1; + if (implicitKey || json[i6 + 2] === '"' || json.length < minMultiLineLength) { + i6 += 1; } else { - str += json.slice(start, i) + "\n\n"; - while (json[i + 2] === "\\" && json[i + 3] === "n" && json[i + 4] !== '"') { + str += json.slice(start, i6) + "\n\n"; + while (json[i6 + 2] === "\\" && json[i6 + 3] === "n" && json[i6 + 4] !== '"') { str += "\n"; - i += 2; + i6 += 2; } str += indent; - if (json[i + 2] === " ") + if (json[i6 + 2] === " ") str += "\\"; - i += 1; - start = i + 1; + i6 += 1; + start = i6 + 1; } break; default: - i += 1; + i6 += 1; } } str = start ? str + json.slice(start) : json; @@ -18986,7 +27365,7 @@ ${indent}`) + "'"; } function blockString({ comment, type, value }, ctx, onComment, onChompKeep) { const { blockQuote, commentString, lineWidth } = ctx.options; - if (!blockQuote || /\n[\t ]+$/.test(value) || /^\s*$/.test(value)) { + if (!blockQuote || /\n[\t ]+$/.test(value)) { return quotedString(value, ctx); } const indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? " " : ""); @@ -19115,10 +27494,10 @@ ${indent}`); let res = _stringify(type); if (res === null) { const { defaultKeyType, defaultStringType } = ctx.options; - const t = implicitKey && defaultKeyType || defaultStringType; - res = _stringify(t); + const t3 = implicitKey && defaultKeyType || defaultStringType; + res = _stringify(t3); if (res === null) - throw new Error(`Unsupported default string type ${t}`); + throw new Error(`Unsupported default string type ${t3}`); } return res; } @@ -19127,7 +27506,7 @@ ${indent}`); }); // -var require_stringify = __commonJS({ +var require_stringify2 = __commonJS({ ""(exports) { "use strict"; var anchors = require_anchors(); @@ -19177,24 +27556,24 @@ var require_stringify = __commonJS({ } function getTagObject(tags, item) { if (item.tag) { - const match = tags.filter((t) => t.tag === item.tag); + const match = tags.filter((t3) => t3.tag === item.tag); if (match.length > 0) - return match.find((t) => t.format === item.format) ?? match[0]; + return match.find((t3) => t3.format === item.format) ?? match[0]; } let tagObj = void 0; let obj; if (identity.isScalar(item)) { obj = item.value; - let match = tags.filter((t) => t.identify?.(obj)); + let match = tags.filter((t3) => t3.identify?.(obj)); if (match.length > 1) { - const testMatch = match.filter((t) => t.test); + const testMatch = match.filter((t3) => t3.test); if (testMatch.length > 0) match = testMatch; } - tagObj = match.find((t) => t.format === item.format) ?? match.find((t) => !t.format); + tagObj = match.find((t3) => t3.format === item.format) ?? match.find((t3) => !t3.format); } else { obj = item; - tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass); + tagObj = tags.find((t3) => t3.nodeClass && obj instanceof t3.nodeClass); } if (!tagObj) { const name = obj?.constructor?.name ?? (obj === null ? "null" : typeof obj); @@ -19233,7 +27612,7 @@ var require_stringify = __commonJS({ } } let tagObj = void 0; - const node = identity.isNode(item) ? item : ctx.doc.createNode(item, { onTagObj: (o) => tagObj = o }); + const node = identity.isNode(item) ? item : ctx.doc.createNode(item, { onTagObj: (o8) => tagObj = o8 }); tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node)); const props = stringifyProps(node, tagObj, ctx); if (props.length > 0) @@ -19255,7 +27634,7 @@ var require_stringifyPair = __commonJS({ "use strict"; var identity = require_identity(); var Scalar = require_Scalar(); - var stringify = require_stringify(); + var stringify = require_stringify2(); var stringifyComment = require_stringifyComment(); function stringifyPair({ key, value }, ctx, onComment, onChompKeep) { const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx; @@ -19425,11 +27804,11 @@ var require_merge = __commonJS({ function addMergeToJSMap(ctx, map, value) { value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value; if (identity.isSeq(value)) - for (const it of value.items) - mergeValue(ctx, map, it); + for (const it2 of value.items) + mergeValue(ctx, map, it2); else if (Array.isArray(value)) - for (const it of value) - mergeValue(ctx, map, it); + for (const it2 of value) + mergeValue(ctx, map, it2); else mergeValue(ctx, map, value); } @@ -19467,7 +27846,7 @@ var require_addPairToJSMap = __commonJS({ "use strict"; var log = require_log(); var merge2 = require_merge(); - var stringify = require_stringify(); + var stringify = require_stringify2(); var identity = require_identity(); var toJS = require_toJS(); function addPairToJSMap(ctx, map, { key, value }) { @@ -19534,9 +27913,9 @@ var require_Pair = __commonJS({ var addPairToJSMap = require_addPairToJSMap(); var identity = require_identity(); function createPair(key, value, ctx) { - const k = createNode.createNode(key, void 0, ctx); - const v = createNode.createNode(value, void 0, ctx); - return new Pair(k, v); + const k3 = createNode.createNode(key, void 0, ctx); + const v4 = createNode.createNode(value, void 0, ctx); + return new Pair(k3, v4); } var Pair = class _Pair { constructor(key, value = null) { @@ -19552,7 +27931,7 @@ var require_Pair = __commonJS({ value = value.clone(schema); return new _Pair(key, value); } - toJSON(_, ctx) { + toJSON(_4, ctx) { const pair = ctx?.mapAsMap ? /* @__PURE__ */ new Map() : {}; return addPairToJSMap.addPairToJSMap(ctx, pair, this); } @@ -19570,7 +27949,7 @@ var require_stringifyCollection = __commonJS({ ""(exports) { "use strict"; var identity = require_identity(); - var stringify = require_stringify(); + var stringify = require_stringify2(); var stringifyComment = require_stringifyComment(); function stringifyCollection(collection, ctx, options) { const flow = ctx.inFlow ?? collection.flow; @@ -19582,8 +27961,8 @@ var require_stringifyCollection = __commonJS({ const itemCtx = Object.assign({}, ctx, { indent: itemIndent, type: null }); let chompKeep = false; const lines = []; - for (let i = 0; i < items.length; ++i) { - const item = items[i]; + for (let i6 = 0; i6 < items.length; ++i6) { + const item = items[i6]; let comment2 = null; if (identity.isNode(item)) { if (!chompKeep && item.spaceBefore) @@ -19612,8 +27991,8 @@ var require_stringifyCollection = __commonJS({ str = flowChars.start + flowChars.end; } else { str = lines[0]; - for (let i = 1; i < lines.length; ++i) { - const line = lines[i]; + for (let i6 = 1; i6 < lines.length; ++i6) { + const line = lines[i6]; str += line ? ` ${indent}${line}` : "\n"; } @@ -19637,8 +28016,8 @@ ${indent}${line}` : "\n"; let reqNewline = false; let linesAtValue = 0; const lines = []; - for (let i = 0; i < items.length; ++i) { - const item = items[i]; + for (let i6 = 0; i6 < items.length; ++i6) { + const item = items[i6]; let comment = null; if (identity.isNode(item)) { if (item.spaceBefore) @@ -19668,7 +28047,7 @@ ${indent}${line}` : "\n"; if (comment) reqNewline = true; let str = stringify.stringify(item, itemCtx, () => comment = null); - if (i < items.length - 1) + if (i6 < items.length - 1) str += ","; if (comment) str += stringifyComment.lineComment(str, itemIndent, commentString(comment)); @@ -19720,13 +28099,13 @@ var require_YAMLMap = __commonJS({ var Pair = require_Pair(); var Scalar = require_Scalar(); function findPair(items, key) { - const k = identity.isScalar(key) ? key.value : key; - for (const it of items) { - if (identity.isPair(it)) { - if (it.key === key || it.key === k) - return it; - if (identity.isScalar(it.key) && it.key.value === k) - return it; + const k3 = identity.isScalar(key) ? key.value : key; + for (const it2 of items) { + if (identity.isPair(it2)) { + if (it2.key === key || it2.key === k3) + return it2; + if (identity.isScalar(it2.key) && it2.key.value === k3) + return it2; } } return void 0; @@ -19790,25 +28169,25 @@ var require_YAMLMap = __commonJS({ else prev.value = _pair.value; } else if (sortEntries) { - const i = this.items.findIndex((item) => sortEntries(_pair, item) < 0); - if (i === -1) + const i6 = this.items.findIndex((item) => sortEntries(_pair, item) < 0); + if (i6 === -1) this.items.push(_pair); else - this.items.splice(i, 0, _pair); + this.items.splice(i6, 0, _pair); } else { this.items.push(_pair); } } delete(key) { - const it = findPair(this.items, key); - if (!it) + const it2 = findPair(this.items, key); + if (!it2) return false; - const del = this.items.splice(this.items.indexOf(it), 1); + const del = this.items.splice(this.items.indexOf(it2), 1); return del.length > 0; } get(key, keepScalar) { - const it = findPair(this.items, key); - const node = it?.value; + const it2 = findPair(this.items, key); + const node = it2?.value; return (!keepScalar && identity.isScalar(node) ? node.value : node) ?? void 0; } has(key) { @@ -19822,7 +28201,7 @@ var require_YAMLMap = __commonJS({ * @param {Class} Type - If set, forces the returned collection type * @returns Instance of Type, Map, or Object */ - toJSON(_, ctx, Type) { + toJSON(_4, ctx, Type) { const map = Type ? new Type() : ctx?.mapAsMap ? /* @__PURE__ */ new Map() : {}; if (ctx?.onCreate) ctx.onCreate(map); @@ -19915,8 +28294,8 @@ var require_YAMLSeq = __commonJS({ const idx = asItemIndex(key); if (typeof idx !== "number") return void 0; - const it = this.items[idx]; - return !keepScalar && identity.isScalar(it) ? it.value : it; + const it2 = this.items[idx]; + return !keepScalar && identity.isScalar(it2) ? it2.value : it2; } /** * Checks if the collection includes a value with the key `key`. @@ -19945,13 +28324,13 @@ var require_YAMLSeq = __commonJS({ else this.items[idx] = value; } - toJSON(_, ctx) { + toJSON(_4, ctx) { const seq = []; if (ctx?.onCreate) ctx.onCreate(seq); - let i = 0; + let i6 = 0; for (const item of this.items) - seq.push(toJS.toJS(item, String(i++), ctx)); + seq.push(toJS.toJS(item, String(i6++), ctx)); return seq; } toString(ctx, onComment, onChompKeep) { @@ -19969,13 +28348,13 @@ var require_YAMLSeq = __commonJS({ const { replacer } = ctx; const seq = new this(schema); if (obj && Symbol.iterator in Object(obj)) { - let i = 0; - for (let it of obj) { + let i6 = 0; + for (let it2 of obj) { if (typeof replacer === "function") { - const key = obj instanceof Set ? it : String(i++); - it = replacer.call(obj, key, it); + const key = obj instanceof Set ? it2 : String(i6++); + it2 = replacer.call(obj, key, it2); } - seq.items.push(createNode.createNode(it, void 0, ctx)); + seq.items.push(createNode.createNode(it2, void 0, ctx)); } } return seq; @@ -20014,7 +28393,7 @@ var require_seq = __commonJS({ }); // -var require_string = __commonJS({ +var require_string2 = __commonJS({ ""(exports) { "use strict"; var stringifyString = require_stringifyString(); @@ -20084,18 +28463,18 @@ var require_stringifyNumber = __commonJS({ const num = typeof value === "number" ? value : Number(value); if (!isFinite(num)) return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf"; - let n = JSON.stringify(value); - if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) { - let i = n.indexOf("."); - if (i < 0) { - i = n.length; - n += "."; + let n3 = JSON.stringify(value); + if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n3)) { + let i6 = n3.indexOf("."); + if (i6 < 0) { + i6 = n3.length; + n3 += "."; } - let d = minFractionDigits - (n.length - i - 1); - while (d-- > 0) - n += "0"; + let d5 = minFractionDigits - (n3.length - i6 - 1); + while (d5-- > 0) + n3 += "0"; } - return n; + return n3; } exports.stringifyNumber = stringifyNumber; } @@ -20199,7 +28578,7 @@ var require_schema = __commonJS({ var map = require_map(); var _null = require_null(); var seq = require_seq(); - var string = require_string(); + var string = require_string2(); var bool = require_bool(); var float = require_float(); var int = require_int(); @@ -20313,8 +28692,8 @@ var require_binary = __commonJS({ } else if (typeof atob === "function") { const str = atob(src.replace(/[\n\r]/g, "")); const buffer = new Uint8Array(str.length); - for (let i = 0; i < str.length; ++i) - buffer[i] = str.charCodeAt(i); + for (let i6 = 0; i6 < str.length; ++i6) + buffer[i6] = str.charCodeAt(i6); return buffer; } else { onError("This environment does not support reading binary tags; either Buffer or atob is required"); @@ -20329,20 +28708,20 @@ var require_binary = __commonJS({ if (typeof node_buffer.Buffer === "function") { str = buf instanceof node_buffer.Buffer ? buf.toString("base64") : node_buffer.Buffer.from(buf.buffer).toString("base64"); } else if (typeof btoa === "function") { - let s = ""; - for (let i = 0; i < buf.length; ++i) - s += String.fromCharCode(buf[i]); - str = btoa(s); + let s5 = ""; + for (let i6 = 0; i6 < buf.length; ++i6) + s5 += String.fromCharCode(buf[i6]); + str = btoa(s5); } else { throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required"); } type ?? (type = Scalar.Scalar.BLOCK_LITERAL); if (type !== Scalar.Scalar.QUOTE_DOUBLE) { const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth); - const n = Math.ceil(str.length / lineWidth); - const lines = new Array(n); - for (let i = 0, o = 0; i < n; ++i, o += lineWidth) { - lines[i] = str.substr(o, lineWidth); + const n3 = Math.ceil(str.length / lineWidth); + const lines = new Array(n3); + for (let i6 = 0, o8 = 0; i6 < n3; ++i6, o8 += lineWidth) { + lines[i6] = str.substr(o8, lineWidth); } str = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? "\n" : " "); } @@ -20363,8 +28742,8 @@ var require_pairs = __commonJS({ var YAMLSeq = require_YAMLSeq(); function resolvePairs(seq, onError) { if (identity.isSeq(seq)) { - for (let i = 0; i < seq.items.length; ++i) { - let item = seq.items[i]; + for (let i6 = 0; i6 < seq.items.length; ++i6) { + let item = seq.items[i6]; if (identity.isPair(item)) continue; else if (identity.isMap(item)) { @@ -20375,13 +28754,13 @@ var require_pairs = __commonJS({ pair.key.commentBefore = pair.key.commentBefore ? `${item.commentBefore} ${pair.key.commentBefore}` : item.commentBefore; if (item.comment) { - const cn = pair.value ?? pair.key; - cn.comment = cn.comment ? `${item.comment} -${cn.comment}` : item.comment; + const cn2 = pair.value ?? pair.key; + cn2.comment = cn2.comment ? `${item.comment} +${cn2.comment}` : item.comment; } item = pair; } - seq.items[i] = identity.isPair(item) ? item : new Pair.Pair(item); + seq.items[i6] = identity.isPair(item) ? item : new Pair.Pair(item); } } else onError("Expected a sequence for this tag"); @@ -20391,28 +28770,28 @@ ${cn.comment}` : item.comment; const { replacer } = ctx; const pairs2 = new YAMLSeq.YAMLSeq(schema); pairs2.tag = "tag:yaml.org,2002:pairs"; - let i = 0; + let i6 = 0; if (iterable && Symbol.iterator in Object(iterable)) - for (let it of iterable) { + for (let it2 of iterable) { if (typeof replacer === "function") - it = replacer.call(iterable, String(i++), it); + it2 = replacer.call(iterable, String(i6++), it2); let key, value; - if (Array.isArray(it)) { - if (it.length === 2) { - key = it[0]; - value = it[1]; + if (Array.isArray(it2)) { + if (it2.length === 2) { + key = it2[0]; + value = it2[1]; } else - throw new TypeError(`Expected [key, value] tuple: ${it}`); - } else if (it && it instanceof Object) { - const keys = Object.keys(it); + throw new TypeError(`Expected [key, value] tuple: ${it2}`); + } else if (it2 && it2 instanceof Object) { + const keys = Object.keys(it2); if (keys.length === 1) { key = keys[0]; - value = it[key]; + value = it2[key]; } else { throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`); } } else { - key = it; + key = it2; } pairs2.items.push(Pair.createPair(key, value, ctx)); } @@ -20454,9 +28833,9 @@ var require_omap = __commonJS({ * If `ctx` is given, the return type is actually `Map`, * but TypeScript won't allow widening the signature of a child method. */ - toJSON(_, ctx) { + toJSON(_4, ctx) { if (!ctx) - return super.toJSON(_); + return super.toJSON(_4); const map = /* @__PURE__ */ new Map(); if (ctx?.onCreate) ctx.onCreate(map); @@ -20576,9 +28955,9 @@ var require_float2 = __commonJS({ const node = new Scalar.Scalar(parseFloat(str.replace(/_/g, ""))); const dot = str.indexOf("."); if (dot !== -1) { - const f = str.substring(dot + 1).replace(/_/g, ""); - if (f[f.length - 1] === "0") - node.minFractionDigits = f.length; + const f6 = str.substring(dot + 1).replace(/_/g, ""); + if (f6[f6.length - 1] === "0") + node.minFractionDigits = f6.length; } return node; }, @@ -20613,11 +28992,11 @@ var require_int2 = __commonJS({ str = `0x${str}`; break; } - const n2 = BigInt(str); - return sign === "-" ? BigInt(-1) * n2 : n2; + const n4 = BigInt(str); + return sign === "-" ? BigInt(-1) * n4 : n4; } - const n = parseInt(str, radix); - return sign === "-" ? -1 * n : n; + const n3 = parseInt(str, radix); + return sign === "-" ? -1 * n3 : n3; } function intStringify(node, radix, prefix) { const { value } = node; @@ -20711,8 +29090,8 @@ var require_set = __commonJS({ this.items.push(new Pair.Pair(key)); } } - toJSON(_, ctx) { - return super.toJSON(_, ctx, Set); + toJSON(_4, ctx) { + return super.toJSON(_4, ctx, Set); } toString(ctx, onComment, onChompKeep) { if (!ctx) @@ -20766,15 +29145,15 @@ var require_timestamp = __commonJS({ function parseSexagesimal(str, asBigInt) { const sign = str[0]; const parts = sign === "-" || sign === "+" ? str.substring(1) : str; - const num = (n) => asBigInt ? BigInt(n) : Number(n); - const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 * num(60) + num(p), num(0)); + const num = (n3) => asBigInt ? BigInt(n3) : Number(n3); + const res = parts.replace(/_/g, "").split(":").reduce((res2, p5) => res2 * num(60) + num(p5), num(0)); return sign === "-" ? num(-1) * res : res; } function stringifySexagesimal(node) { let { value } = node; - let num = (n) => n; + let num = (n3) => n3; if (typeof value === "bigint") - num = (n) => BigInt(n); + num = (n3) => BigInt(n3); else if (isNaN(value) || !isFinite(value)) return stringifyNumber.stringifyNumber(node); let sign = ""; @@ -20794,7 +29173,7 @@ var require_timestamp = __commonJS({ parts.unshift(value); } } - return sign + parts.map((n) => String(n).padStart(2, "0")).join(":").replace(/000000\d*$/, ""); + return sign + parts.map((n3) => String(n3).padStart(2, "0")).join(":").replace(/000000\d*$/, ""); } var intTime = { identify: (value) => typeof value === "bigint" || Number.isInteger(value), @@ -20831,10 +29210,10 @@ var require_timestamp = __commonJS({ let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec); const tz = match[8]; if (tz && tz !== "Z") { - let d = parseSexagesimal(tz, false); - if (Math.abs(d) < 30) - d *= 60; - date -= 6e4 * d; + let d5 = parseSexagesimal(tz, false); + if (Math.abs(d5) < 30) + d5 *= 60; + date -= 6e4 * d5; } return new Date(date); }, @@ -20853,7 +29232,7 @@ var require_schema3 = __commonJS({ var map = require_map(); var _null = require_null(); var seq = require_seq(); - var string = require_string(); + var string = require_string2(); var binary = require_binary(); var bool = require_bool2(); var float = require_float2(); @@ -20897,7 +29276,7 @@ var require_tags = __commonJS({ var map = require_map(); var _null = require_null(); var seq = require_seq(); - var string = require_string(); + var string = require_string2(); var bool = require_bool(); var float = require_float(); var int = require_int(); @@ -20991,9 +29370,9 @@ var require_Schema = __commonJS({ var identity = require_identity(); var map = require_map(); var seq = require_seq(); - var string = require_string(); + var string = require_string2(); var tags = require_tags(); - var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0; + var sortMapEntriesByKey = (a7, b3) => a7.key < b3.key ? -1 : a7.key > b3.key ? 1 : 0; var Schema = class _Schema { constructor({ compat, customTags, merge: merge2, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) { this.compat = Array.isArray(compat) ? tags.getTags(compat, "compat") : compat ? tags.getTags(null, compat) : null; @@ -21021,7 +29400,7 @@ var require_stringifyDocument = __commonJS({ ""(exports) { "use strict"; var identity = require_identity(); - var stringify = require_stringify(); + var stringify = require_stringify2(); var stringifyComment = require_stringifyComment(); function stringifyDocument(doc, options) { const lines = []; @@ -21201,7 +29580,7 @@ var require_Document = __commonJS({ value = replacer.call({ "": value }, "", value); _replacer = replacer; } else if (Array.isArray(replacer)) { - const keyToStr = (v) => typeof v === "number" || v instanceof String || v instanceof Number; + const keyToStr = (v4) => typeof v4 === "number" || v4 instanceof String || v4 instanceof Number; const asStr = replacer.filter(keyToStr).map(String); if (asStr.length > 0) replacer = replacer.concat(asStr); @@ -21236,9 +29615,9 @@ var require_Document = __commonJS({ * recursively wrapping all values as `Scalar` or `Collection` nodes. */ createPair(key, value, options = {}) { - const k = this.createNode(key, null, options); - const v = this.createNode(value, null, options); - return new Pair.Pair(k, v); + const k3 = this.createNode(key, null, options); + const v4 = this.createNode(value, null, options); + return new Pair.Pair(k3, v4); } /** * Removes a value from the document. @@ -21390,8 +29769,8 @@ var require_Document = __commonJS({ if (this.errors.length > 0) throw new Error("Document with errors cannot be stringified"); if ("indent" in options && (!Number.isInteger(options.indent) || Number(options.indent) <= 0)) { - const s = JSON.stringify(options.indent); - throw new Error(`"indent" option must be a positive integer, not ${s}`); + const s5 = JSON.stringify(options.indent); + throw new Error(`"indent" option must be a positive integer, not ${s5}`); } return stringifyDocument.stringifyDocument(this, options); } @@ -21573,7 +29952,6 @@ var require_resolve_props = __commonJS({ hasSpace = false; break; } - // else fallthrough default: onError(token, "UNEXPECTED_TOKEN", `Unexpected ${token.type} token`); atNewline = false; @@ -21619,22 +29997,22 @@ var require_util_contains_newline = __commonJS({ if (key.source.includes("\n")) return true; if (key.end) { - for (const st of key.end) - if (st.type === "newline") + for (const st2 of key.end) + if (st2.type === "newline") return true; } return false; case "flow-collection": - for (const it of key.items) { - for (const st of it.start) - if (st.type === "newline") + for (const it2 of key.items) { + for (const st2 of it2.start) + if (st2.type === "newline") return true; - if (it.sep) { - for (const st of it.sep) - if (st.type === "newline") + if (it2.sep) { + for (const st2 of it2.sep) + if (st2.type === "newline") return true; } - if (containsNewline(it.key) || containsNewline(it.value)) + if (containsNewline(it2.key) || containsNewline(it2.value)) return true; } return false; @@ -21673,7 +30051,7 @@ var require_util_map_includes = __commonJS({ const { uniqueKeys } = ctx.options; if (uniqueKeys === false) return false; - const isEqual = typeof uniqueKeys === "function" ? uniqueKeys : (a, b) => a === b || identity.isScalar(a) && identity.isScalar(b) && a.value === b.value; + const isEqual = typeof uniqueKeys === "function" ? uniqueKeys : (a7, b3) => a7 === b3 || identity.isScalar(a7) && identity.isScalar(b3) && a7.value === b3.value; return items.some((pair) => isEqual(pair.key, search)); } exports.mapIncludes = mapIncludes; @@ -21760,3378 +30138,7458 @@ var require_resolve_block_map = __commonJS({ if (ctx.schema.compat) utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError); offset = valueNode.range[2]; - const pair = new Pair.Pair(keyNode, valueNode); - if (ctx.options.keepSourceTokens) - pair.srcToken = collItem; - map.items.push(pair); + const pair = new Pair.Pair(keyNode, valueNode); + if (ctx.options.keepSourceTokens) + pair.srcToken = collItem; + map.items.push(pair); + } else { + if (implicitKey) + onError(keyNode.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"); + if (valueProps.comment) { + if (keyNode.comment) + keyNode.comment += "\n" + valueProps.comment; + else + keyNode.comment = valueProps.comment; + } + const pair = new Pair.Pair(keyNode); + if (ctx.options.keepSourceTokens) + pair.srcToken = collItem; + map.items.push(pair); + } + } + if (commentEnd && commentEnd < offset) + onError(commentEnd, "IMPOSSIBLE", "Map comment with trailing content"); + map.range = [bm.offset, offset, commentEnd ?? offset]; + return map; + } + exports.resolveBlockMap = resolveBlockMap; + } +}); + +// +var require_resolve_block_seq = __commonJS({ + ""(exports) { + "use strict"; + var YAMLSeq = require_YAMLSeq(); + var resolveProps = require_resolve_props(); + var utilFlowIndentCheck = require_util_flow_indent_check(); + function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, tag) { + const NodeClass = tag?.nodeClass ?? YAMLSeq.YAMLSeq; + const seq = new NodeClass(ctx.schema); + if (ctx.atRoot) + ctx.atRoot = false; + if (ctx.atKey) + ctx.atKey = false; + let offset = bs.offset; + let commentEnd = null; + for (const { start, value } of bs.items) { + const props = resolveProps.resolveProps(start, { + indicator: "seq-item-ind", + next: value, + offset, + onError, + parentIndent: bs.indent, + startOnNewline: true + }); + if (!props.found) { + if (props.anchor || props.tag || value) { + if (value && value.type === "block-seq") + onError(props.end, "BAD_INDENT", "All sequence items must start at the same column"); + else + onError(offset, "MISSING_CHAR", "Sequence item without - indicator"); + } else { + commentEnd = props.end; + if (props.comment) + seq.comment = props.comment; + continue; + } + } + const node = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, start, null, props, onError); + if (ctx.schema.compat) + utilFlowIndentCheck.flowIndentCheck(bs.indent, value, onError); + offset = node.range[2]; + seq.items.push(node); + } + seq.range = [bs.offset, offset, commentEnd ?? offset]; + return seq; + } + exports.resolveBlockSeq = resolveBlockSeq; + } +}); + +// +var require_resolve_end = __commonJS({ + ""(exports) { + "use strict"; + function resolveEnd(end, offset, reqSpace, onError) { + let comment = ""; + if (end) { + let hasSpace = false; + let sep2 = ""; + for (const token of end) { + const { source, type } = token; + switch (type) { + case "space": + hasSpace = true; + break; + case "comment": { + if (reqSpace && !hasSpace) + onError(token, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters"); + const cb = source.substring(1) || " "; + if (!comment) + comment = cb; + else + comment += sep2 + cb; + sep2 = ""; + break; + } + case "newline": + if (comment) + sep2 += source; + hasSpace = true; + break; + default: + onError(token, "UNEXPECTED_TOKEN", `Unexpected ${type} at node end`); + } + offset += source.length; + } + } + return { comment, offset }; + } + exports.resolveEnd = resolveEnd; + } +}); + +// +var require_resolve_flow_collection = __commonJS({ + ""(exports) { + "use strict"; + var identity = require_identity(); + var Pair = require_Pair(); + var YAMLMap = require_YAMLMap(); + var YAMLSeq = require_YAMLSeq(); + var resolveEnd = require_resolve_end(); + var resolveProps = require_resolve_props(); + var utilContainsNewline = require_util_contains_newline(); + var utilMapIncludes = require_util_map_includes(); + var blockMsg = "Block collections are not allowed within flow collections"; + var isBlock = (token) => token && (token.type === "block-map" || token.type === "block-seq"); + function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) { + const isMap = fc.start.source === "{"; + const fcName = isMap ? "flow map" : "flow sequence"; + const NodeClass = tag?.nodeClass ?? (isMap ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq); + const coll = new NodeClass(ctx.schema); + coll.flow = true; + const atRoot = ctx.atRoot; + if (atRoot) + ctx.atRoot = false; + if (ctx.atKey) + ctx.atKey = false; + let offset = fc.offset + fc.start.source.length; + for (let i6 = 0; i6 < fc.items.length; ++i6) { + const collItem = fc.items[i6]; + const { start, key, sep: sep2, value } = collItem; + const props = resolveProps.resolveProps(start, { + flow: fcName, + indicator: "explicit-key-ind", + next: key ?? sep2?.[0], + offset, + onError, + parentIndent: fc.indent, + startOnNewline: false + }); + if (!props.found) { + if (!props.anchor && !props.tag && !sep2 && !value) { + if (i6 === 0 && props.comma) + onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`); + else if (i6 < fc.items.length - 1) + onError(props.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${fcName}`); + if (props.comment) { + if (coll.comment) + coll.comment += "\n" + props.comment; + else + coll.comment = props.comment; + } + offset = props.end; + continue; + } + if (!isMap && ctx.options.strict && utilContainsNewline.containsNewline(key)) + onError( + key, + // checked by containsNewline() + "MULTILINE_IMPLICIT_KEY", + "Implicit keys of flow sequence pairs need to be on a single line" + ); + } + if (i6 === 0) { + if (props.comma) + onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`); + } else { + if (!props.comma) + onError(props.start, "MISSING_CHAR", `Missing , between ${fcName} items`); + if (props.comment) { + let prevItemComment = ""; + loop: + for (const st2 of start) { + switch (st2.type) { + case "comma": + case "space": + break; + case "comment": + prevItemComment = st2.source.substring(1); + break loop; + default: + break loop; + } + } + if (prevItemComment) { + let prev = coll.items[coll.items.length - 1]; + if (identity.isPair(prev)) + prev = prev.value ?? prev.key; + if (prev.comment) + prev.comment += "\n" + prevItemComment; + else + prev.comment = prevItemComment; + props.comment = props.comment.substring(prevItemComment.length + 1); + } + } + } + if (!isMap && !sep2 && !props.found) { + const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep2, null, props, onError); + coll.items.push(valueNode); + offset = valueNode.range[2]; + if (isBlock(value)) + onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg); } else { - if (implicitKey) - onError(keyNode.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"); - if (valueProps.comment) { + ctx.atKey = true; + const keyStart = props.end; + const keyNode = key ? composeNode(ctx, key, props, onError) : composeEmptyNode(ctx, keyStart, start, null, props, onError); + if (isBlock(key)) + onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg); + ctx.atKey = false; + const valueProps = resolveProps.resolveProps(sep2 ?? [], { + flow: fcName, + indicator: "map-value-ind", + next: value, + offset: keyNode.range[2], + onError, + parentIndent: fc.indent, + startOnNewline: false + }); + if (valueProps.found) { + if (!isMap && !props.found && ctx.options.strict) { + if (sep2) + for (const st2 of sep2) { + if (st2 === valueProps.found) + break; + if (st2.type === "newline") { + onError(st2, "MULTILINE_IMPLICIT_KEY", "Implicit keys of flow sequence pairs need to be on a single line"); + break; + } + } + if (props.start < valueProps.found.offset - 1024) + onError(valueProps.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key"); + } + } else if (value) { + if ("source" in value && value.source && value.source[0] === ":") + onError(value, "MISSING_CHAR", `Missing space after : in ${fcName}`); + else + onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`); + } + const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep2, null, valueProps, onError) : null; + if (valueNode) { + if (isBlock(value)) + onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg); + } else if (valueProps.comment) { if (keyNode.comment) keyNode.comment += "\n" + valueProps.comment; else keyNode.comment = valueProps.comment; } - const pair = new Pair.Pair(keyNode); + const pair = new Pair.Pair(keyNode, valueNode); if (ctx.options.keepSourceTokens) pair.srcToken = collItem; - map.items.push(pair); + if (isMap) { + const map = coll; + if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode)) + onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique"); + map.items.push(pair); + } else { + const map = new YAMLMap.YAMLMap(ctx.schema); + map.flow = true; + map.items.push(pair); + const endRange = (valueNode ?? keyNode).range; + map.range = [keyNode.range[0], endRange[1], endRange[2]]; + coll.items.push(map); + } + offset = valueNode ? valueNode.range[2] : valueProps.end; } } - if (commentEnd && commentEnd < offset) - onError(commentEnd, "IMPOSSIBLE", "Map comment with trailing content"); - map.range = [bm.offset, offset, commentEnd ?? offset]; - return map; + const expectedEnd = isMap ? "}" : "]"; + const [ce2, ...ee3] = fc.end; + let cePos = offset; + if (ce2 && ce2.source === expectedEnd) + cePos = ce2.offset + ce2.source.length; + else { + const name = fcName[0].toUpperCase() + fcName.substring(1); + const msg = atRoot ? `${name} must end with a ${expectedEnd}` : `${name} in block collection must be sufficiently indented and end with a ${expectedEnd}`; + onError(offset, atRoot ? "MISSING_CHAR" : "BAD_INDENT", msg); + if (ce2 && ce2.source.length !== 1) + ee3.unshift(ce2); + } + if (ee3.length > 0) { + const end = resolveEnd.resolveEnd(ee3, cePos, ctx.options.strict, onError); + if (end.comment) { + if (coll.comment) + coll.comment += "\n" + end.comment; + else + coll.comment = end.comment; + } + coll.range = [fc.offset, cePos, end.offset]; + } else { + coll.range = [fc.offset, cePos, cePos]; + } + return coll; } - exports.resolveBlockMap = resolveBlockMap; + exports.resolveFlowCollection = resolveFlowCollection; } }); // -var require_resolve_block_seq = __commonJS({ +var require_compose_collection = __commonJS({ ""(exports) { "use strict"; + var identity = require_identity(); + var Scalar = require_Scalar(); + var YAMLMap = require_YAMLMap(); var YAMLSeq = require_YAMLSeq(); - var resolveProps = require_resolve_props(); - var utilFlowIndentCheck = require_util_flow_indent_check(); - function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, tag) { - const NodeClass = tag?.nodeClass ?? YAMLSeq.YAMLSeq; - const seq = new NodeClass(ctx.schema); - if (ctx.atRoot) - ctx.atRoot = false; - if (ctx.atKey) - ctx.atKey = false; - let offset = bs.offset; - let commentEnd = null; - for (const { start, value } of bs.items) { - const props = resolveProps.resolveProps(start, { - indicator: "seq-item-ind", - next: value, - offset, - onError, - parentIndent: bs.indent, - startOnNewline: true - }); - if (!props.found) { - if (props.anchor || props.tag || value) { - if (value && value.type === "block-seq") - onError(props.end, "BAD_INDENT", "All sequence items must start at the same column"); - else - onError(offset, "MISSING_CHAR", "Sequence item without - indicator"); + var resolveBlockMap = require_resolve_block_map(); + var resolveBlockSeq = require_resolve_block_seq(); + var resolveFlowCollection = require_resolve_flow_collection(); + function resolveCollection(CN, ctx, token, onError, tagName, tag) { + const coll = token.type === "block-map" ? resolveBlockMap.resolveBlockMap(CN, ctx, token, onError, tag) : token.type === "block-seq" ? resolveBlockSeq.resolveBlockSeq(CN, ctx, token, onError, tag) : resolveFlowCollection.resolveFlowCollection(CN, ctx, token, onError, tag); + const Coll = coll.constructor; + if (tagName === "!" || tagName === Coll.tagName) { + coll.tag = Coll.tagName; + return coll; + } + if (tagName) + coll.tag = tagName; + return coll; + } + function composeCollection(CN, ctx, token, props, onError) { + const tagToken = props.tag; + const tagName = !tagToken ? null : ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)); + if (token.type === "block-seq") { + const { anchor, newlineAfterProp: nl } = props; + const lastProp = anchor && tagToken ? anchor.offset > tagToken.offset ? anchor : tagToken : anchor ?? tagToken; + if (lastProp && (!nl || nl.offset < lastProp.offset)) { + const message = "Missing newline after block sequence props"; + onError(lastProp, "MISSING_CHAR", message); + } + } + const expType = token.type === "block-map" ? "map" : token.type === "block-seq" ? "seq" : token.start.source === "{" ? "map" : "seq"; + if (!tagToken || !tagName || tagName === "!" || tagName === YAMLMap.YAMLMap.tagName && expType === "map" || tagName === YAMLSeq.YAMLSeq.tagName && expType === "seq") { + return resolveCollection(CN, ctx, token, onError, tagName); + } + let tag = ctx.schema.tags.find((t3) => t3.tag === tagName && t3.collection === expType); + if (!tag) { + const kt = ctx.schema.knownTags[tagName]; + if (kt && kt.collection === expType) { + ctx.schema.tags.push(Object.assign({}, kt, { default: false })); + tag = kt; + } else { + if (kt) { + onError(tagToken, "BAD_COLLECTION_TYPE", `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? "scalar"}`, true); } else { - commentEnd = props.end; - if (props.comment) - seq.comment = props.comment; - continue; + onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, true); + } + return resolveCollection(CN, ctx, token, onError, tagName); + } + } + const coll = resolveCollection(CN, ctx, token, onError, tagName, tag); + const res = tag.resolve?.(coll, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg), ctx.options) ?? coll; + const node = identity.isNode(res) ? res : new Scalar.Scalar(res); + node.range = coll.range; + node.tag = tagName; + if (tag?.format) + node.format = tag.format; + return node; + } + exports.composeCollection = composeCollection; + } +}); + +// +var require_resolve_block_scalar = __commonJS({ + ""(exports) { + "use strict"; + var Scalar = require_Scalar(); + function resolveBlockScalar(ctx, scalar, onError) { + const start = scalar.offset; + const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError); + if (!header) + return { value: "", type: null, comment: "", range: [start, start, start] }; + const type = header.mode === ">" ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL; + const lines = scalar.source ? splitLines(scalar.source) : []; + let chompStart = lines.length; + for (let i6 = lines.length - 1; i6 >= 0; --i6) { + const content = lines[i6][1]; + if (content === "" || content === "\r") + chompStart = i6; + else + break; + } + if (chompStart === 0) { + const value2 = header.chomp === "+" && lines.length > 0 ? "\n".repeat(Math.max(1, lines.length - 1)) : ""; + let end2 = start + header.length; + if (scalar.source) + end2 += scalar.source.length; + return { value: value2, type, comment: header.comment, range: [start, end2, end2] }; + } + let trimIndent = scalar.indent + header.indent; + let offset = scalar.offset + header.length; + let contentStart = 0; + for (let i6 = 0; i6 < chompStart; ++i6) { + const [indent, content] = lines[i6]; + if (content === "" || content === "\r") { + if (header.indent === 0 && indent.length > trimIndent) + trimIndent = indent.length; + } else { + if (indent.length < trimIndent) { + const message = "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"; + onError(offset + indent.length, "MISSING_CHAR", message); + } + if (header.indent === 0) + trimIndent = indent.length; + contentStart = i6; + if (trimIndent === 0 && !ctx.atRoot) { + const message = "Block scalar values in collections must be indented"; + onError(offset, "BAD_INDENT", message); } + break; + } + offset += indent.length + content.length + 1; + } + for (let i6 = lines.length - 1; i6 >= chompStart; --i6) { + if (lines[i6][0].length > trimIndent) + chompStart = i6 + 1; + } + let value = ""; + let sep2 = ""; + let prevMoreIndented = false; + for (let i6 = 0; i6 < contentStart; ++i6) + value += lines[i6][0].slice(trimIndent) + "\n"; + for (let i6 = contentStart; i6 < chompStart; ++i6) { + let [indent, content] = lines[i6]; + offset += indent.length + content.length + 1; + const crlf = content[content.length - 1] === "\r"; + if (crlf) + content = content.slice(0, -1); + if (content && indent.length < trimIndent) { + const src = header.indent ? "explicit indentation indicator" : "first line"; + const message = `Block scalar lines must not be less indented than their ${src}`; + onError(offset - content.length - (crlf ? 2 : 1), "BAD_INDENT", message); + indent = ""; + } + if (type === Scalar.Scalar.BLOCK_LITERAL) { + value += sep2 + indent.slice(trimIndent) + content; + sep2 = "\n"; + } else if (indent.length > trimIndent || content[0] === " ") { + if (sep2 === " ") + sep2 = "\n"; + else if (!prevMoreIndented && sep2 === "\n") + sep2 = "\n\n"; + value += sep2 + indent.slice(trimIndent) + content; + sep2 = "\n"; + prevMoreIndented = true; + } else if (content === "") { + if (sep2 === "\n") + value += "\n"; + else + sep2 = "\n"; + } else { + value += sep2 + content; + sep2 = " "; + prevMoreIndented = false; } - const node = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, start, null, props, onError); - if (ctx.schema.compat) - utilFlowIndentCheck.flowIndentCheck(bs.indent, value, onError); - offset = node.range[2]; - seq.items.push(node); } - seq.range = [bs.offset, offset, commentEnd ?? offset]; - return seq; + switch (header.chomp) { + case "-": + break; + case "+": + for (let i6 = chompStart; i6 < lines.length; ++i6) + value += "\n" + lines[i6][0].slice(trimIndent); + if (value[value.length - 1] !== "\n") + value += "\n"; + break; + default: + value += "\n"; + } + const end = start + header.length + scalar.source.length; + return { value, type, comment: header.comment, range: [start, end, end] }; } - exports.resolveBlockSeq = resolveBlockSeq; - } -}); - -// -var require_resolve_end = __commonJS({ - ""(exports) { - "use strict"; - function resolveEnd(end, offset, reqSpace, onError) { + function parseBlockScalarHeader({ offset, props }, strict, onError) { + if (props[0].type !== "block-scalar-header") { + onError(props[0], "IMPOSSIBLE", "Block scalar header not found"); + return null; + } + const { source } = props[0]; + const mode = source[0]; + let indent = 0; + let chomp = ""; + let error = -1; + for (let i6 = 1; i6 < source.length; ++i6) { + const ch = source[i6]; + if (!chomp && (ch === "-" || ch === "+")) + chomp = ch; + else { + const n3 = Number(ch); + if (!indent && n3) + indent = n3; + else if (error === -1) + error = offset + i6; + } + } + if (error !== -1) + onError(error, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${source}`); + let hasSpace = false; let comment = ""; - if (end) { - let hasSpace = false; - let sep2 = ""; - for (const token of end) { - const { source, type } = token; - switch (type) { - case "space": - hasSpace = true; - break; - case "comment": { - if (reqSpace && !hasSpace) - onError(token, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters"); - const cb = source.substring(1) || " "; - if (!comment) - comment = cb; - else - comment += sep2 + cb; - sep2 = ""; - break; + let length = source.length; + for (let i6 = 1; i6 < props.length; ++i6) { + const token = props[i6]; + switch (token.type) { + case "space": + hasSpace = true; + case "newline": + length += token.source.length; + break; + case "comment": + if (strict && !hasSpace) { + const message = "Comments must be separated from other tokens by white space characters"; + onError(token, "MISSING_CHAR", message); } - case "newline": - if (comment) - sep2 += source; - hasSpace = true; - break; - default: - onError(token, "UNEXPECTED_TOKEN", `Unexpected ${type} at node end`); + length += token.source.length; + comment = token.source.substring(1); + break; + case "error": + onError(token, "UNEXPECTED_TOKEN", token.message); + length += token.source.length; + break; + default: { + const message = `Unexpected token in block scalar header: ${token.type}`; + onError(token, "UNEXPECTED_TOKEN", message); + const ts = token.source; + if (ts && typeof ts === "string") + length += ts.length; } - offset += source.length; } } - return { comment, offset }; + return { mode, indent, chomp, comment, length }; } - exports.resolveEnd = resolveEnd; + function splitLines(source) { + const split = source.split(/\n( *)/); + const first = split[0]; + const m8 = first.match(/^( *)/); + const line0 = m8?.[1] ? [m8[1], first.slice(m8[1].length)] : ["", first]; + const lines = [line0]; + for (let i6 = 1; i6 < split.length; i6 += 2) + lines.push([split[i6], split[i6 + 1]]); + return lines; + } + exports.resolveBlockScalar = resolveBlockScalar; } }); // -var require_resolve_flow_collection = __commonJS({ +var require_resolve_flow_scalar = __commonJS({ ""(exports) { "use strict"; - var identity = require_identity(); - var Pair = require_Pair(); - var YAMLMap = require_YAMLMap(); - var YAMLSeq = require_YAMLSeq(); + var Scalar = require_Scalar(); var resolveEnd = require_resolve_end(); - var resolveProps = require_resolve_props(); - var utilContainsNewline = require_util_contains_newline(); - var utilMapIncludes = require_util_map_includes(); - var blockMsg = "Block collections are not allowed within flow collections"; - var isBlock = (token) => token && (token.type === "block-map" || token.type === "block-seq"); - function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) { - const isMap = fc.start.source === "{"; - const fcName = isMap ? "flow map" : "flow sequence"; - const NodeClass = tag?.nodeClass ?? (isMap ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq); - const coll = new NodeClass(ctx.schema); - coll.flow = true; - const atRoot = ctx.atRoot; - if (atRoot) - ctx.atRoot = false; - if (ctx.atKey) - ctx.atKey = false; - let offset = fc.offset + fc.start.source.length; - for (let i = 0; i < fc.items.length; ++i) { - const collItem = fc.items[i]; - const { start, key, sep: sep2, value } = collItem; - const props = resolveProps.resolveProps(start, { - flow: fcName, - indicator: "explicit-key-ind", - next: key ?? sep2?.[0], - offset, - onError, - parentIndent: fc.indent, - startOnNewline: false - }); - if (!props.found) { - if (!props.anchor && !props.tag && !sep2 && !value) { - if (i === 0 && props.comma) - onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`); - else if (i < fc.items.length - 1) - onError(props.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${fcName}`); - if (props.comment) { - if (coll.comment) - coll.comment += "\n" + props.comment; - else - coll.comment = props.comment; - } - offset = props.end; - continue; - } - if (!isMap && ctx.options.strict && utilContainsNewline.containsNewline(key)) - onError( - key, - // checked by containsNewline() - "MULTILINE_IMPLICIT_KEY", - "Implicit keys of flow sequence pairs need to be on a single line" - ); + function resolveFlowScalar(scalar, strict, onError) { + const { offset, type, source, end } = scalar; + let _type; + let value; + const _onError = (rel, code, msg) => onError(offset + rel, code, msg); + switch (type) { + case "scalar": + _type = Scalar.Scalar.PLAIN; + value = plainValue(source, _onError); + break; + case "single-quoted-scalar": + _type = Scalar.Scalar.QUOTE_SINGLE; + value = singleQuotedValue(source, _onError); + break; + case "double-quoted-scalar": + _type = Scalar.Scalar.QUOTE_DOUBLE; + value = doubleQuotedValue(source, _onError); + break; + default: + onError(scalar, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${type}`); + return { + value: "", + type: null, + comment: "", + range: [offset, offset + source.length, offset + source.length] + }; + } + const valueEnd = offset + source.length; + const re3 = resolveEnd.resolveEnd(end, valueEnd, strict, onError); + return { + value, + type: _type, + comment: re3.comment, + range: [offset, valueEnd, re3.offset] + }; + } + function plainValue(source, onError) { + let badChar = ""; + switch (source[0]) { + case " ": + badChar = "a tab character"; + break; + case ",": + badChar = "flow indicator character ,"; + break; + case "%": + badChar = "directive indicator character %"; + break; + case "|": + case ">": { + badChar = `block scalar indicator ${source[0]}`; + break; } - if (i === 0) { - if (props.comma) - onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`); - } else { - if (!props.comma) - onError(props.start, "MISSING_CHAR", `Missing , between ${fcName} items`); - if (props.comment) { - let prevItemComment = ""; - loop: for (const st of start) { - switch (st.type) { - case "comma": - case "space": - break; - case "comment": - prevItemComment = st.source.substring(1); - break loop; - default: - break loop; - } - } - if (prevItemComment) { - let prev = coll.items[coll.items.length - 1]; - if (identity.isPair(prev)) - prev = prev.value ?? prev.key; - if (prev.comment) - prev.comment += "\n" + prevItemComment; - else - prev.comment = prevItemComment; - props.comment = props.comment.substring(prevItemComment.length + 1); - } - } + case "@": + case "`": { + badChar = `reserved character ${source[0]}`; + break; } - if (!isMap && !sep2 && !props.found) { - const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep2, null, props, onError); - coll.items.push(valueNode); - offset = valueNode.range[2]; - if (isBlock(value)) - onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg); + } + if (badChar) + onError(0, "BAD_SCALAR_START", `Plain value cannot start with ${badChar}`); + return foldLines(source); + } + function singleQuotedValue(source, onError) { + if (source[source.length - 1] !== "'" || source.length === 1) + onError(source.length, "MISSING_CHAR", "Missing closing 'quote"); + return foldLines(source.slice(1, -1)).replace(/''/g, "'"); + } + function foldLines(source) { + let first, line; + try { + first = new RegExp("(.*?)(? wsStart ? source.slice(wsStart, i6 + 1) : ch; + } else { + res += ch; } } - const expectedEnd = isMap ? "}" : "]"; - const [ce, ...ee] = fc.end; - let cePos = offset; - if (ce && ce.source === expectedEnd) - cePos = ce.offset + ce.source.length; - else { - const name = fcName[0].toUpperCase() + fcName.substring(1); - const msg = atRoot ? `${name} must end with a ${expectedEnd}` : `${name} in block collection must be sufficiently indented and end with a ${expectedEnd}`; - onError(offset, atRoot ? "MISSING_CHAR" : "BAD_INDENT", msg); - if (ce && ce.source.length !== 1) - ee.unshift(ce); + if (source[source.length - 1] !== '"' || source.length === 1) + onError(source.length, "MISSING_CHAR", 'Missing closing "quote'); + return res; + } + function foldNewline(source, offset) { + let fold = ""; + let ch = source[offset + 1]; + while (ch === " " || ch === " " || ch === "\n" || ch === "\r") { + if (ch === "\r" && source[offset + 2] !== "\n") + break; + if (ch === "\n") + fold += "\n"; + offset += 1; + ch = source[offset + 1]; } - if (ee.length > 0) { - const end = resolveEnd.resolveEnd(ee, cePos, ctx.options.strict, onError); - if (end.comment) { - if (coll.comment) - coll.comment += "\n" + end.comment; - else - coll.comment = end.comment; - } - coll.range = [fc.offset, cePos, end.offset]; - } else { - coll.range = [fc.offset, cePos, cePos]; + if (!fold) + fold = " "; + return { fold, offset }; + } + var escapeCodes = { + "0": "\0", + // null character + a: "\x07", + // bell character + b: "\b", + // backspace + e: "\x1B", + // escape character + f: "\f", + // form feed + n: "\n", + // line feed + r: "\r", + // carriage return + t: " ", + // horizontal tab + v: "\v", + // vertical tab + N: "\x85", + // Unicode next line + _: "\xA0", + // Unicode non-breaking space + L: "\u2028", + // Unicode line separator + P: "\u2029", + // Unicode paragraph separator + " ": " ", + '"': '"', + "/": "/", + "\\": "\\", + " ": " " + }; + function parseCharCode(source, offset, length, onError) { + const cc = source.substr(offset, length); + const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc); + const code = ok ? parseInt(cc, 16) : NaN; + if (isNaN(code)) { + const raw = source.substr(offset - 2, length + 2); + onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`); + return raw; } - return coll; + return String.fromCodePoint(code); } - exports.resolveFlowCollection = resolveFlowCollection; + exports.resolveFlowScalar = resolveFlowScalar; } }); // -var require_compose_collection = __commonJS({ +var require_compose_scalar = __commonJS({ ""(exports) { "use strict"; var identity = require_identity(); var Scalar = require_Scalar(); - var YAMLMap = require_YAMLMap(); - var YAMLSeq = require_YAMLSeq(); - var resolveBlockMap = require_resolve_block_map(); - var resolveBlockSeq = require_resolve_block_seq(); - var resolveFlowCollection = require_resolve_flow_collection(); - function resolveCollection(CN, ctx, token, onError, tagName, tag) { - const coll = token.type === "block-map" ? resolveBlockMap.resolveBlockMap(CN, ctx, token, onError, tag) : token.type === "block-seq" ? resolveBlockSeq.resolveBlockSeq(CN, ctx, token, onError, tag) : resolveFlowCollection.resolveFlowCollection(CN, ctx, token, onError, tag); - const Coll = coll.constructor; - if (tagName === "!" || tagName === Coll.tagName) { - coll.tag = Coll.tagName; - return coll; + var resolveBlockScalar = require_resolve_block_scalar(); + var resolveFlowScalar = require_resolve_flow_scalar(); + function composeScalar(ctx, token, tagToken, onError) { + const { value, type, comment, range } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError); + const tagName = tagToken ? ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)) : null; + let tag; + if (ctx.options.stringKeys && ctx.atKey) { + tag = ctx.schema[identity.SCALAR]; + } else if (tagName) + tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError); + else if (token.type === "scalar") + tag = findScalarTagByTest(ctx, value, token, onError); + else + tag = ctx.schema[identity.SCALAR]; + let scalar; + try { + const res = tag.resolve(value, (msg) => onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg), ctx.options); + scalar = identity.isScalar(res) ? res : new Scalar.Scalar(res); + } catch (error) { + const msg = error instanceof Error ? error.message : String(error); + onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg); + scalar = new Scalar.Scalar(value); } + scalar.range = range; + scalar.source = value; + if (type) + scalar.type = type; if (tagName) - coll.tag = tagName; - return coll; + scalar.tag = tagName; + if (tag.format) + scalar.format = tag.format; + if (comment) + scalar.comment = comment; + return scalar; } - function composeCollection(CN, ctx, token, props, onError) { - const tagToken = props.tag; - const tagName = !tagToken ? null : ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)); - if (token.type === "block-seq") { - const { anchor, newlineAfterProp: nl } = props; - const lastProp = anchor && tagToken ? anchor.offset > tagToken.offset ? anchor : tagToken : anchor ?? tagToken; - if (lastProp && (!nl || nl.offset < lastProp.offset)) { - const message = "Missing newline after block sequence props"; - onError(lastProp, "MISSING_CHAR", message); + function findScalarTagByName(schema, value, tagName, tagToken, onError) { + if (tagName === "!") + return schema[identity.SCALAR]; + const matchWithTest = []; + for (const tag of schema.tags) { + if (!tag.collection && tag.tag === tagName) { + if (tag.default && tag.test) + matchWithTest.push(tag); + else + return tag; } } - const expType = token.type === "block-map" ? "map" : token.type === "block-seq" ? "seq" : token.start.source === "{" ? "map" : "seq"; - if (!tagToken || !tagName || tagName === "!" || tagName === YAMLMap.YAMLMap.tagName && expType === "map" || tagName === YAMLSeq.YAMLSeq.tagName && expType === "seq") { - return resolveCollection(CN, ctx, token, onError, tagName); + for (const tag of matchWithTest) + if (tag.test?.test(value)) + return tag; + const kt = schema.knownTags[tagName]; + if (kt && !kt.collection) { + schema.tags.push(Object.assign({}, kt, { default: false, test: void 0 })); + return kt; } - let tag = ctx.schema.tags.find((t) => t.tag === tagName && t.collection === expType); - if (!tag) { - const kt = ctx.schema.knownTags[tagName]; - if (kt && kt.collection === expType) { - ctx.schema.tags.push(Object.assign({}, kt, { default: false })); - tag = kt; - } else { - if (kt) { - onError(tagToken, "BAD_COLLECTION_TYPE", `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? "scalar"}`, true); - } else { - onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, true); - } - return resolveCollection(CN, ctx, token, onError, tagName); + onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str"); + return schema[identity.SCALAR]; + } + function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) { + const tag = schema.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema[identity.SCALAR]; + if (schema.compat) { + const compat = schema.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema[identity.SCALAR]; + if (tag.tag !== compat.tag) { + const ts = directives.tagString(tag.tag); + const cs = directives.tagString(compat.tag); + const msg = `Value may be parsed as either ${ts} or ${cs}`; + onError(token, "TAG_RESOLVE_FAILED", msg, true); } } - const coll = resolveCollection(CN, ctx, token, onError, tagName, tag); - const res = tag.resolve?.(coll, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg), ctx.options) ?? coll; - const node = identity.isNode(res) ? res : new Scalar.Scalar(res); - node.range = coll.range; - node.tag = tagName; - if (tag?.format) - node.format = tag.format; - return node; + return tag; } - exports.composeCollection = composeCollection; + exports.composeScalar = composeScalar; } }); // -var require_resolve_block_scalar = __commonJS({ +var require_util_empty_scalar_position = __commonJS({ ""(exports) { "use strict"; - var Scalar = require_Scalar(); - function resolveBlockScalar(ctx, scalar, onError) { - const start = scalar.offset; - const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError); - if (!header) - return { value: "", type: null, comment: "", range: [start, start, start] }; - const type = header.mode === ">" ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL; - const lines = scalar.source ? splitLines(scalar.source) : []; - let chompStart = lines.length; - for (let i = lines.length - 1; i >= 0; --i) { - const content = lines[i][1]; - if (content === "" || content === "\r") - chompStart = i; - else - break; - } - if (chompStart === 0) { - const value2 = header.chomp === "+" && lines.length > 0 ? "\n".repeat(Math.max(1, lines.length - 1)) : ""; - let end2 = start + header.length; - if (scalar.source) - end2 += scalar.source.length; - return { value: value2, type, comment: header.comment, range: [start, end2, end2] }; - } - let trimIndent = scalar.indent + header.indent; - let offset = scalar.offset + header.length; - let contentStart = 0; - for (let i = 0; i < chompStart; ++i) { - const [indent, content] = lines[i]; - if (content === "" || content === "\r") { - if (header.indent === 0 && indent.length > trimIndent) - trimIndent = indent.length; - } else { - if (indent.length < trimIndent) { - const message = "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"; - onError(offset + indent.length, "MISSING_CHAR", message); + function emptyScalarPosition(offset, before, pos) { + if (before) { + pos ?? (pos = before.length); + for (let i6 = pos - 1; i6 >= 0; --i6) { + let st2 = before[i6]; + switch (st2.type) { + case "space": + case "comment": + case "newline": + offset -= st2.source.length; + continue; } - if (header.indent === 0) - trimIndent = indent.length; - contentStart = i; - if (trimIndent === 0 && !ctx.atRoot) { - const message = "Block scalar values in collections must be indented"; - onError(offset, "BAD_INDENT", message); + st2 = before[++i6]; + while (st2?.type === "space") { + offset += st2.source.length; + st2 = before[++i6]; } break; } - offset += indent.length + content.length + 1; - } - for (let i = lines.length - 1; i >= chompStart; --i) { - if (lines[i][0].length > trimIndent) - chompStart = i + 1; - } - let value = ""; - let sep2 = ""; - let prevMoreIndented = false; - for (let i = 0; i < contentStart; ++i) - value += lines[i][0].slice(trimIndent) + "\n"; - for (let i = contentStart; i < chompStart; ++i) { - let [indent, content] = lines[i]; - offset += indent.length + content.length + 1; - const crlf = content[content.length - 1] === "\r"; - if (crlf) - content = content.slice(0, -1); - if (content && indent.length < trimIndent) { - const src = header.indent ? "explicit indentation indicator" : "first line"; - const message = `Block scalar lines must not be less indented than their ${src}`; - onError(offset - content.length - (crlf ? 2 : 1), "BAD_INDENT", message); - indent = ""; - } - if (type === Scalar.Scalar.BLOCK_LITERAL) { - value += sep2 + indent.slice(trimIndent) + content; - sep2 = "\n"; - } else if (indent.length > trimIndent || content[0] === " ") { - if (sep2 === " ") - sep2 = "\n"; - else if (!prevMoreIndented && sep2 === "\n") - sep2 = "\n\n"; - value += sep2 + indent.slice(trimIndent) + content; - sep2 = "\n"; - prevMoreIndented = true; - } else if (content === "") { - if (sep2 === "\n") - value += "\n"; - else - sep2 = "\n"; - } else { - value += sep2 + content; - sep2 = " "; - prevMoreIndented = false; - } } - switch (header.chomp) { - case "-": + return offset; + } + exports.emptyScalarPosition = emptyScalarPosition; + } +}); + +// +var require_compose_node = __commonJS({ + ""(exports) { + "use strict"; + var Alias = require_Alias(); + var identity = require_identity(); + var composeCollection = require_compose_collection(); + var composeScalar = require_compose_scalar(); + var resolveEnd = require_resolve_end(); + var utilEmptyScalarPosition = require_util_empty_scalar_position(); + var CN = { composeNode, composeEmptyNode }; + function composeNode(ctx, token, props, onError) { + const atKey = ctx.atKey; + const { spaceBefore, comment, anchor, tag } = props; + let node; + let isSrcToken = true; + switch (token.type) { + case "alias": + node = composeAlias(ctx, token, onError); + if (anchor || tag) + onError(token, "ALIAS_PROPS", "An alias node must not specify any properties"); break; - case "+": - for (let i = chompStart; i < lines.length; ++i) - value += "\n" + lines[i][0].slice(trimIndent); - if (value[value.length - 1] !== "\n") - value += "\n"; + case "scalar": + case "single-quoted-scalar": + case "double-quoted-scalar": + case "block-scalar": + node = composeScalar.composeScalar(ctx, token, tag, onError); + if (anchor) + node.anchor = anchor.source.substring(1); break; - default: - value += "\n"; + case "block-map": + case "block-seq": + case "flow-collection": + node = composeCollection.composeCollection(CN, ctx, token, props, onError); + if (anchor) + node.anchor = anchor.source.substring(1); + break; + default: { + const message = token.type === "error" ? token.message : `Unsupported token (type: ${token.type})`; + onError(token, "UNEXPECTED_TOKEN", message); + node = composeEmptyNode(ctx, token.offset, void 0, null, props, onError); + isSrcToken = false; + } } - const end = start + header.length + scalar.source.length; - return { value, type, comment: header.comment, range: [start, end, end] }; - } - function parseBlockScalarHeader({ offset, props }, strict, onError) { - if (props[0].type !== "block-scalar-header") { - onError(props[0], "IMPOSSIBLE", "Block scalar header not found"); - return null; + if (anchor && node.anchor === "") + onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string"); + if (atKey && ctx.options.stringKeys && (!identity.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) { + const msg = "With stringKeys, all keys must be strings"; + onError(tag ?? token, "NON_STRING_KEY", msg); } - const { source } = props[0]; - const mode = source[0]; - let indent = 0; - let chomp = ""; - let error = -1; - for (let i = 1; i < source.length; ++i) { - const ch = source[i]; - if (!chomp && (ch === "-" || ch === "+")) - chomp = ch; - else { - const n = Number(ch); - if (!indent && n) - indent = n; - else if (error === -1) - error = offset + i; - } + if (spaceBefore) + node.spaceBefore = true; + if (comment) { + if (token.type === "scalar" && token.source === "") + node.comment = comment; + else + node.commentBefore = comment; } - if (error !== -1) - onError(error, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${source}`); - let hasSpace = false; - let comment = ""; - let length = source.length; - for (let i = 1; i < props.length; ++i) { - const token = props[i]; - switch (token.type) { - case "space": - hasSpace = true; - // fallthrough - case "newline": - length += token.source.length; - break; - case "comment": - if (strict && !hasSpace) { - const message = "Comments must be separated from other tokens by white space characters"; - onError(token, "MISSING_CHAR", message); - } - length += token.source.length; - comment = token.source.substring(1); - break; - case "error": - onError(token, "UNEXPECTED_TOKEN", token.message); - length += token.source.length; - break; - /* istanbul ignore next should not happen */ - default: { - const message = `Unexpected token in block scalar header: ${token.type}`; - onError(token, "UNEXPECTED_TOKEN", message); - const ts = token.source; - if (ts && typeof ts === "string") - length += ts.length; - } - } + if (ctx.options.keepSourceTokens && isSrcToken) + node.srcToken = token; + return node; + } + function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag, end }, onError) { + const token = { + type: "scalar", + offset: utilEmptyScalarPosition.emptyScalarPosition(offset, before, pos), + indent: -1, + source: "" + }; + const node = composeScalar.composeScalar(ctx, token, tag, onError); + if (anchor) { + node.anchor = anchor.source.substring(1); + if (node.anchor === "") + onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string"); + } + if (spaceBefore) + node.spaceBefore = true; + if (comment) { + node.comment = comment; + node.range[2] = end; } - return { mode, indent, chomp, comment, length }; + return node; } - function splitLines(source) { - const split = source.split(/\n( *)/); - const first = split[0]; - const m = first.match(/^( *)/); - const line0 = m?.[1] ? [m[1], first.slice(m[1].length)] : ["", first]; - const lines = [line0]; - for (let i = 1; i < split.length; i += 2) - lines.push([split[i], split[i + 1]]); - return lines; + function composeAlias({ options }, { offset, source, end }, onError) { + const alias = new Alias.Alias(source.substring(1)); + if (alias.source === "") + onError(offset, "BAD_ALIAS", "Alias cannot be an empty string"); + if (alias.source.endsWith(":")) + onError(offset + source.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", true); + const valueEnd = offset + source.length; + const re3 = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError); + alias.range = [offset, valueEnd, re3.offset]; + if (re3.comment) + alias.comment = re3.comment; + return alias; } - exports.resolveBlockScalar = resolveBlockScalar; + exports.composeEmptyNode = composeEmptyNode; + exports.composeNode = composeNode; } }); // -var require_resolve_flow_scalar = __commonJS({ +var require_compose_doc = __commonJS({ ""(exports) { "use strict"; - var Scalar = require_Scalar(); + var Document = require_Document(); + var composeNode = require_compose_node(); var resolveEnd = require_resolve_end(); - function resolveFlowScalar(scalar, strict, onError) { - const { offset, type, source, end } = scalar; - let _type; - let value; - const _onError = (rel, code, msg) => onError(offset + rel, code, msg); - switch (type) { - case "scalar": - _type = Scalar.Scalar.PLAIN; - value = plainValue(source, _onError); - break; - case "single-quoted-scalar": - _type = Scalar.Scalar.QUOTE_SINGLE; - value = singleQuotedValue(source, _onError); - break; - case "double-quoted-scalar": - _type = Scalar.Scalar.QUOTE_DOUBLE; - value = doubleQuotedValue(source, _onError); - break; - /* istanbul ignore next should not happen */ - default: - onError(scalar, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${type}`); - return { - value: "", - type: null, - comment: "", - range: [offset, offset + source.length, offset + source.length] - }; - } - const valueEnd = offset + source.length; - const re = resolveEnd.resolveEnd(end, valueEnd, strict, onError); - return { - value, - type: _type, - comment: re.comment, - range: [offset, valueEnd, re.offset] + var resolveProps = require_resolve_props(); + function composeDoc(options, directives, { offset, start, value, end }, onError) { + const opts = Object.assign({ _directives: directives }, options); + const doc = new Document.Document(void 0, opts); + const ctx = { + atKey: false, + atRoot: true, + directives: doc.directives, + options: doc.options, + schema: doc.schema }; - } - function plainValue(source, onError) { - let badChar = ""; - switch (source[0]) { - /* istanbul ignore next should not happen */ - case " ": - badChar = "a tab character"; - break; - case ",": - badChar = "flow indicator character ,"; - break; - case "%": - badChar = "directive indicator character %"; - break; - case "|": - case ">": { - badChar = `block scalar indicator ${source[0]}`; - break; - } - case "@": - case "`": { - badChar = `reserved character ${source[0]}`; - break; - } + const props = resolveProps.resolveProps(start, { + indicator: "doc-start", + next: value ?? end?.[0], + offset, + onError, + parentIndent: 0, + startOnNewline: true + }); + if (props.found) { + doc.directives.docStart = true; + if (value && (value.type === "block-map" || value.type === "block-seq") && !props.hasNewline) + onError(props.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker"); } - if (badChar) - onError(0, "BAD_SCALAR_START", `Plain value cannot start with ${badChar}`); - return foldLines(source); + doc.contents = value ? composeNode.composeNode(ctx, value, props, onError) : composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError); + const contentEnd = doc.contents.range[2]; + const re3 = resolveEnd.resolveEnd(end, contentEnd, false, onError); + if (re3.comment) + doc.comment = re3.comment; + doc.range = [offset, contentEnd, re3.offset]; + return doc; } - function singleQuotedValue(source, onError) { - if (source[source.length - 1] !== "'" || source.length === 1) - onError(source.length, "MISSING_CHAR", "Missing closing 'quote"); - return foldLines(source.slice(1, -1)).replace(/''/g, "'"); + exports.composeDoc = composeDoc; + } +}); + +// +var require_composer = __commonJS({ + ""(exports) { + "use strict"; + var node_process = __require("process"); + var directives = require_directives(); + var Document = require_Document(); + var errors = require_errors(); + var identity = require_identity(); + var composeDoc = require_compose_doc(); + var resolveEnd = require_resolve_end(); + function getErrorPos(src) { + if (typeof src === "number") + return [src, src + 1]; + if (Array.isArray(src)) + return src.length === 2 ? src : [src[0], src[1]]; + const { offset, source } = src; + return [offset, offset + (typeof source === "string" ? source.length : 1)]; } - function foldLines(source) { - let first, line; - try { - first = new RegExp("(.*?)(? { + const pos = getErrorPos(source); + if (warning) + this.warnings.push(new errors.YAMLWarning(pos, code, message)); else - sep2 = "\n"; + this.errors.push(new errors.YAMLParseError(pos, code, message)); + }; + this.directives = new directives.Directives({ version: options.version || "1.2" }); + this.options = options; + } + decorate(doc, afterDoc) { + const { comment, afterEmptyLine } = parsePrelude(this.prelude); + if (comment) { + const dc = doc.contents; + if (afterDoc) { + doc.comment = doc.comment ? `${doc.comment} +${comment}` : comment; + } else if (afterEmptyLine || doc.directives.docStart || !dc) { + doc.commentBefore = comment; + } else if (identity.isCollection(dc) && !dc.flow && dc.items.length > 0) { + let it2 = dc.items[0]; + if (identity.isPair(it2)) + it2 = it2.key; + const cb = it2.commentBefore; + it2.commentBefore = cb ? `${comment} +${cb}` : comment; + } else { + const cb = dc.commentBefore; + dc.commentBefore = cb ? `${comment} +${cb}` : comment; + } + } + if (afterDoc) { + Array.prototype.push.apply(doc.errors, this.errors); + Array.prototype.push.apply(doc.warnings, this.warnings); } else { - res += sep2 + match[1]; - sep2 = " "; + doc.errors = this.errors; + doc.warnings = this.warnings; } - pos = line.lastIndex; + this.prelude = []; + this.errors = []; + this.warnings = []; } - const last = /[ \t]*(.*)/sy; - last.lastIndex = pos; - match = last.exec(source); - return res + sep2 + (match?.[1] ?? ""); - } - function doubleQuotedValue(source, onError) { - let res = ""; - for (let i = 1; i < source.length - 1; ++i) { - const ch = source[i]; - if (ch === "\r" && source[i + 1] === "\n") - continue; - if (ch === "\n") { - const { fold, offset } = foldNewline(source, i); - res += fold; - i = offset; - } else if (ch === "\\") { - let next = source[++i]; - const cc = escapeCodes[next]; - if (cc) - res += cc; - else if (next === "\n") { - next = source[i + 1]; - while (next === " " || next === " ") - next = source[++i + 1]; - } else if (next === "\r" && source[i + 1] === "\n") { - next = source[++i + 1]; - while (next === " " || next === " ") - next = source[++i + 1]; - } else if (next === "x" || next === "u" || next === "U") { - const length = { x: 2, u: 4, U: 8 }[next]; - res += parseCharCode(source, i + 1, length, onError); - i += length; - } else { - const raw = source.substr(i - 1, 2); - onError(i - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`); - res += raw; + /** + * Current stream status information. + * + * Mostly useful at the end of input for an empty stream. + */ + streamInfo() { + return { + comment: parsePrelude(this.prelude).comment, + directives: this.directives, + errors: this.errors, + warnings: this.warnings + }; + } + /** + * Compose tokens into documents. + * + * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document. + * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly. + */ + *compose(tokens, forceDoc = false, endOffset = -1) { + for (const token of tokens) + yield* this.next(token); + yield* this.end(forceDoc, endOffset); + } + /** Advance the composer by one CST token. */ + *next(token) { + if (node_process.env.LOG_STREAM) + console.dir(token, { depth: null }); + switch (token.type) { + case "directive": + this.directives.add(token.source, (offset, message, warning) => { + const pos = getErrorPos(token); + pos[0] += offset; + this.onError(pos, "BAD_DIRECTIVE", message, warning); + }); + this.prelude.push(token.source); + this.atDirectives = true; + break; + case "document": { + const doc = composeDoc.composeDoc(this.options, this.directives, token, this.onError); + if (this.atDirectives && !doc.directives.docStart) + this.onError(token, "MISSING_CHAR", "Missing directives-end/doc-start indicator line"); + this.decorate(doc, false); + if (this.doc) + yield this.doc; + this.doc = doc; + this.atDirectives = false; + break; } - } else if (ch === " " || ch === " ") { - const wsStart = i; - let next = source[i + 1]; - while (next === " " || next === " ") - next = source[++i + 1]; - if (next !== "\n" && !(next === "\r" && source[i + 2] === "\n")) - res += i > wsStart ? source.slice(wsStart, i + 1) : ch; - } else { - res += ch; + case "byte-order-mark": + case "space": + break; + case "comment": + case "newline": + this.prelude.push(token.source); + break; + case "error": { + const msg = token.source ? `${token.message}: ${JSON.stringify(token.source)}` : token.message; + const error = new errors.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg); + if (this.atDirectives || !this.doc) + this.errors.push(error); + else + this.doc.errors.push(error); + break; + } + case "doc-end": { + if (!this.doc) { + const msg = "Unexpected doc-end without preceding document"; + this.errors.push(new errors.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg)); + break; + } + this.doc.directives.docEnd = true; + const end = resolveEnd.resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError); + this.decorate(this.doc, true); + if (end.comment) { + const dc = this.doc.comment; + this.doc.comment = dc ? `${dc} +${end.comment}` : end.comment; + } + this.doc.range[2] = end.offset; + break; + } + default: + this.errors.push(new errors.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", `Unsupported token ${token.type}`)); } } - if (source[source.length - 1] !== '"' || source.length === 1) - onError(source.length, "MISSING_CHAR", 'Missing closing "quote'); - return res; - } - function foldNewline(source, offset) { - let fold = ""; - let ch = source[offset + 1]; - while (ch === " " || ch === " " || ch === "\n" || ch === "\r") { - if (ch === "\r" && source[offset + 2] !== "\n") - break; - if (ch === "\n") - fold += "\n"; - offset += 1; - ch = source[offset + 1]; + /** + * Call at end of input to yield any remaining document. + * + * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document. + * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly. + */ + *end(forceDoc = false, endOffset = -1) { + if (this.doc) { + this.decorate(this.doc, true); + yield this.doc; + this.doc = null; + } else if (forceDoc) { + const opts = Object.assign({ _directives: this.directives }, this.options); + const doc = new Document.Document(void 0, opts); + if (this.atDirectives) + this.onError(endOffset, "MISSING_CHAR", "Missing directives-end indicator line"); + doc.range = [0, endOffset, endOffset]; + this.decorate(doc, false); + yield doc; + } } - if (!fold) - fold = " "; - return { fold, offset }; - } - var escapeCodes = { - "0": "\0", - // null character - a: "\x07", - // bell character - b: "\b", - // backspace - e: "\x1B", - // escape character - f: "\f", - // form feed - n: "\n", - // line feed - r: "\r", - // carriage return - t: " ", - // horizontal tab - v: "\v", - // vertical tab - N: "\x85", - // Unicode next line - _: "\xA0", - // Unicode non-breaking space - L: "\u2028", - // Unicode line separator - P: "\u2029", - // Unicode paragraph separator - " ": " ", - '"': '"', - "/": "/", - "\\": "\\", - " ": " " }; - function parseCharCode(source, offset, length, onError) { - const cc = source.substr(offset, length); - const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc); - const code = ok ? parseInt(cc, 16) : NaN; - if (isNaN(code)) { - const raw = source.substr(offset - 2, length + 2); - onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`); - return raw; - } - return String.fromCodePoint(code); - } - exports.resolveFlowScalar = resolveFlowScalar; + exports.Composer = Composer; } }); // -var require_compose_scalar = __commonJS({ +var require_cst_scalar = __commonJS({ ""(exports) { "use strict"; - var identity = require_identity(); - var Scalar = require_Scalar(); var resolveBlockScalar = require_resolve_block_scalar(); var resolveFlowScalar = require_resolve_flow_scalar(); - function composeScalar(ctx, token, tagToken, onError) { - const { value, type, comment, range } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError); - const tagName = tagToken ? ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)) : null; - let tag; - if (ctx.options.stringKeys && ctx.atKey) { - tag = ctx.schema[identity.SCALAR]; - } else if (tagName) - tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError); - else if (token.type === "scalar") - tag = findScalarTagByTest(ctx, value, token, onError); - else - tag = ctx.schema[identity.SCALAR]; - let scalar; - try { - const res = tag.resolve(value, (msg) => onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg), ctx.options); - scalar = identity.isScalar(res) ? res : new Scalar.Scalar(res); - } catch (error) { - const msg = error instanceof Error ? error.message : String(error); - onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg); - scalar = new Scalar.Scalar(value); + var errors = require_errors(); + var stringifyString = require_stringifyString(); + function resolveAsScalar(token, strict = true, onError) { + if (token) { + const _onError = (pos, code, message) => { + const offset = typeof pos === "number" ? pos : Array.isArray(pos) ? pos[0] : pos.offset; + if (onError) + onError(offset, code, message); + else + throw new errors.YAMLParseError([offset, offset + 1], code, message); + }; + switch (token.type) { + case "scalar": + case "single-quoted-scalar": + case "double-quoted-scalar": + return resolveFlowScalar.resolveFlowScalar(token, strict, _onError); + case "block-scalar": + return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError); + } } - scalar.range = range; - scalar.source = value; - if (type) - scalar.type = type; - if (tagName) - scalar.tag = tagName; - if (tag.format) - scalar.format = tag.format; - if (comment) - scalar.comment = comment; - return scalar; + return null; } - function findScalarTagByName(schema, value, tagName, tagToken, onError) { - if (tagName === "!") - return schema[identity.SCALAR]; - const matchWithTest = []; - for (const tag of schema.tags) { - if (!tag.collection && tag.tag === tagName) { - if (tag.default && tag.test) - matchWithTest.push(tag); - else - return tag; + function createScalarToken(value, context2) { + const { implicitKey = false, indent, inFlow = false, offset = -1, type = "PLAIN" } = context2; + const source = stringifyString.stringifyString({ type, value }, { + implicitKey, + indent: indent > 0 ? " ".repeat(indent) : "", + inFlow, + options: { blockQuote: true, lineWidth: -1 } + }); + const end = context2.end ?? [ + { type: "newline", offset: -1, indent, source: "\n" } + ]; + switch (source[0]) { + case "|": + case ">": { + const he2 = source.indexOf("\n"); + const head = source.substring(0, he2); + const body = source.substring(he2 + 1) + "\n"; + const props = [ + { type: "block-scalar-header", offset, indent, source: head } + ]; + if (!addEndtoBlockProps(props, end)) + props.push({ type: "newline", offset: -1, indent, source: "\n" }); + return { type: "block-scalar", offset, indent, props, source: body }; + } + case '"': + return { type: "double-quoted-scalar", offset, indent, source, end }; + case "'": + return { type: "single-quoted-scalar", offset, indent, source, end }; + default: + return { type: "scalar", offset, indent, source, end }; + } + } + function setScalarValue(token, value, context2 = {}) { + let { afterKey = false, implicitKey = false, inFlow = false, type } = context2; + let indent = "indent" in token ? token.indent : null; + if (afterKey && typeof indent === "number") + indent += 2; + if (!type) + switch (token.type) { + case "single-quoted-scalar": + type = "QUOTE_SINGLE"; + break; + case "double-quoted-scalar": + type = "QUOTE_DOUBLE"; + break; + case "block-scalar": { + const header = token.props[0]; + if (header.type !== "block-scalar-header") + throw new Error("Invalid block scalar header"); + type = header.source[0] === ">" ? "BLOCK_FOLDED" : "BLOCK_LITERAL"; + break; + } + default: + type = "PLAIN"; } + const source = stringifyString.stringifyString({ type, value }, { + implicitKey: implicitKey || indent === null, + indent: indent !== null && indent > 0 ? " ".repeat(indent) : "", + inFlow, + options: { blockQuote: true, lineWidth: -1 } + }); + switch (source[0]) { + case "|": + case ">": + setBlockScalarValue(token, source); + break; + case '"': + setFlowScalarValue(token, source, "double-quoted-scalar"); + break; + case "'": + setFlowScalarValue(token, source, "single-quoted-scalar"); + break; + default: + setFlowScalarValue(token, source, "scalar"); } - for (const tag of matchWithTest) - if (tag.test?.test(value)) - return tag; - const kt = schema.knownTags[tagName]; - if (kt && !kt.collection) { - schema.tags.push(Object.assign({}, kt, { default: false, test: void 0 })); - return kt; - } - onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str"); - return schema[identity.SCALAR]; } - function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) { - const tag = schema.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema[identity.SCALAR]; - if (schema.compat) { - const compat = schema.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema[identity.SCALAR]; - if (tag.tag !== compat.tag) { - const ts = directives.tagString(tag.tag); - const cs = directives.tagString(compat.tag); - const msg = `Value may be parsed as either ${ts} or ${cs}`; - onError(token, "TAG_RESOLVE_FAILED", msg, true); - } + function setBlockScalarValue(token, source) { + const he2 = source.indexOf("\n"); + const head = source.substring(0, he2); + const body = source.substring(he2 + 1) + "\n"; + if (token.type === "block-scalar") { + const header = token.props[0]; + if (header.type !== "block-scalar-header") + throw new Error("Invalid block scalar header"); + header.source = head; + token.source = body; + } else { + const { offset } = token; + const indent = "indent" in token ? token.indent : -1; + const props = [ + { type: "block-scalar-header", offset, indent, source: head } + ]; + if (!addEndtoBlockProps(props, "end" in token ? token.end : void 0)) + props.push({ type: "newline", offset: -1, indent, source: "\n" }); + for (const key of Object.keys(token)) + if (key !== "type" && key !== "offset") + delete token[key]; + Object.assign(token, { type: "block-scalar", indent, props, source: body }); } - return tag; } - exports.composeScalar = composeScalar; - } -}); - -// -var require_util_empty_scalar_position = __commonJS({ - ""(exports) { - "use strict"; - function emptyScalarPosition(offset, before, pos) { - if (before) { - pos ?? (pos = before.length); - for (let i = pos - 1; i >= 0; --i) { - let st = before[i]; - switch (st.type) { + function addEndtoBlockProps(props, end) { + if (end) + for (const st2 of end) + switch (st2.type) { case "space": case "comment": + props.push(st2); + break; case "newline": - offset -= st.source.length; - continue; - } - st = before[++i]; - while (st?.type === "space") { - offset += st.source.length; - st = before[++i]; + props.push(st2); + return true; } + return false; + } + function setFlowScalarValue(token, source, type) { + switch (token.type) { + case "scalar": + case "double-quoted-scalar": + case "single-quoted-scalar": + token.type = type; + token.source = source; + break; + case "block-scalar": { + const end = token.props.slice(1); + let oa = source.length; + if (token.props[0].type === "block-scalar-header") + oa -= token.props[0].source.length; + for (const tok of end) + tok.offset += oa; + delete token.props; + Object.assign(token, { type, source, end }); + break; + } + case "block-map": + case "block-seq": { + const offset = token.offset + source.length; + const nl = { type: "newline", offset, indent: token.indent, source: "\n" }; + delete token.items; + Object.assign(token, { type, source, end: [nl] }); break; } + default: { + const indent = "indent" in token ? token.indent : -1; + const end = "end" in token && Array.isArray(token.end) ? token.end.filter((st2) => st2.type === "space" || st2.type === "comment" || st2.type === "newline") : []; + for (const key of Object.keys(token)) + if (key !== "type" && key !== "offset") + delete token[key]; + Object.assign(token, { type, indent, source, end }); + } } - return offset; } - exports.emptyScalarPosition = emptyScalarPosition; + exports.createScalarToken = createScalarToken; + exports.resolveAsScalar = resolveAsScalar; + exports.setScalarValue = setScalarValue; } }); // -var require_compose_node = __commonJS({ +var require_cst_stringify = __commonJS({ ""(exports) { "use strict"; - var Alias = require_Alias(); - var identity = require_identity(); - var composeCollection = require_compose_collection(); - var composeScalar = require_compose_scalar(); - var resolveEnd = require_resolve_end(); - var utilEmptyScalarPosition = require_util_empty_scalar_position(); - var CN = { composeNode, composeEmptyNode }; - function composeNode(ctx, token, props, onError) { - const atKey = ctx.atKey; - const { spaceBefore, comment, anchor, tag } = props; - let node; - let isSrcToken = true; + var stringify = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst); + function stringifyToken(token) { switch (token.type) { - case "alias": - node = composeAlias(ctx, token, onError); - if (anchor || tag) - onError(token, "ALIAS_PROPS", "An alias node must not specify any properties"); - break; - case "scalar": - case "single-quoted-scalar": - case "double-quoted-scalar": - case "block-scalar": - node = composeScalar.composeScalar(ctx, token, tag, onError); - if (anchor) - node.anchor = anchor.source.substring(1); - break; + case "block-scalar": { + let res = ""; + for (const tok of token.props) + res += stringifyToken(tok); + return res + token.source; + } case "block-map": - case "block-seq": - case "flow-collection": - node = composeCollection.composeCollection(CN, ctx, token, props, onError); - if (anchor) - node.anchor = anchor.source.substring(1); - break; + case "block-seq": { + let res = ""; + for (const item of token.items) + res += stringifyItem(item); + return res; + } + case "flow-collection": { + let res = token.start.source; + for (const item of token.items) + res += stringifyItem(item); + for (const st2 of token.end) + res += st2.source; + return res; + } + case "document": { + let res = stringifyItem(token); + if (token.end) + for (const st2 of token.end) + res += st2.source; + return res; + } default: { - const message = token.type === "error" ? token.message : `Unsupported token (type: ${token.type})`; - onError(token, "UNEXPECTED_TOKEN", message); - node = composeEmptyNode(ctx, token.offset, void 0, null, props, onError); - isSrcToken = false; + let res = token.source; + if ("end" in token && token.end) + for (const st2 of token.end) + res += st2.source; + return res; } } - if (anchor && node.anchor === "") - onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string"); - if (atKey && ctx.options.stringKeys && (!identity.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) { - const msg = "With stringKeys, all keys must be strings"; - onError(tag ?? token, "NON_STRING_KEY", msg); - } - if (spaceBefore) - node.spaceBefore = true; - if (comment) { - if (token.type === "scalar" && token.source === "") - node.comment = comment; - else - node.commentBefore = comment; - } - if (ctx.options.keepSourceTokens && isSrcToken) - node.srcToken = token; - return node; } - function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag, end }, onError) { - const token = { - type: "scalar", - offset: utilEmptyScalarPosition.emptyScalarPosition(offset, before, pos), - indent: -1, - source: "" - }; - const node = composeScalar.composeScalar(ctx, token, tag, onError); - if (anchor) { - node.anchor = anchor.source.substring(1); - if (node.anchor === "") - onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string"); + function stringifyItem({ start, key, sep: sep2, value }) { + let res = ""; + for (const st2 of start) + res += st2.source; + if (key) + res += stringifyToken(key); + if (sep2) + for (const st2 of sep2) + res += st2.source; + if (value) + res += stringifyToken(value); + return res; + } + exports.stringify = stringify; + } +}); + +// +var require_cst_visit = __commonJS({ + ""(exports) { + "use strict"; + var BREAK = Symbol("break visit"); + var SKIP = Symbol("skip children"); + var REMOVE = Symbol("remove item"); + function visit(cst, visitor) { + if ("type" in cst && cst.type === "document") + cst = { start: cst.start, value: cst.value }; + _visit(Object.freeze([]), cst, visitor); + } + visit.BREAK = BREAK; + visit.SKIP = SKIP; + visit.REMOVE = REMOVE; + visit.itemAtPath = (cst, path) => { + let item = cst; + for (const [field, index] of path) { + const tok = item?.[field]; + if (tok && "items" in tok) { + item = tok.items[index]; + } else + return void 0; } - if (spaceBefore) - node.spaceBefore = true; - if (comment) { - node.comment = comment; - node.range[2] = end; + return item; + }; + visit.parentCollection = (cst, path) => { + const parent = visit.itemAtPath(cst, path.slice(0, -1)); + const field = path[path.length - 1][0]; + const coll = parent?.[field]; + if (coll && "items" in coll) + return coll; + throw new Error("Parent collection not found"); + }; + function _visit(path, item, visitor) { + let ctrl = visitor(item, path); + if (typeof ctrl === "symbol") + return ctrl; + for (const field of ["key", "value"]) { + const token = item[field]; + if (token && "items" in token) { + for (let i6 = 0; i6 < token.items.length; ++i6) { + const ci = _visit(Object.freeze(path.concat([[field, i6]])), token.items[i6], visitor); + if (typeof ci === "number") + i6 = ci - 1; + else if (ci === BREAK) + return BREAK; + else if (ci === REMOVE) { + token.items.splice(i6, 1); + i6 -= 1; + } + } + if (typeof ctrl === "function" && field === "key") + ctrl = ctrl(item, path); + } } - return node; - } - function composeAlias({ options }, { offset, source, end }, onError) { - const alias = new Alias.Alias(source.substring(1)); - if (alias.source === "") - onError(offset, "BAD_ALIAS", "Alias cannot be an empty string"); - if (alias.source.endsWith(":")) - onError(offset + source.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", true); - const valueEnd = offset + source.length; - const re = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError); - alias.range = [offset, valueEnd, re.offset]; - if (re.comment) - alias.comment = re.comment; - return alias; + return typeof ctrl === "function" ? ctrl(item, path) : ctrl; } - exports.composeEmptyNode = composeEmptyNode; - exports.composeNode = composeNode; + exports.visit = visit; } }); // -var require_compose_doc = __commonJS({ +var require_cst = __commonJS({ ""(exports) { "use strict"; - var Document = require_Document(); - var composeNode = require_compose_node(); - var resolveEnd = require_resolve_end(); - var resolveProps = require_resolve_props(); - function composeDoc(options, directives, { offset, start, value, end }, onError) { - const opts = Object.assign({ _directives: directives }, options); - const doc = new Document.Document(void 0, opts); - const ctx = { - atKey: false, - atRoot: true, - directives: doc.directives, - options: doc.options, - schema: doc.schema - }; - const props = resolveProps.resolveProps(start, { - indicator: "doc-start", - next: value ?? end?.[0], - offset, - onError, - parentIndent: 0, - startOnNewline: true - }); - if (props.found) { - doc.directives.docStart = true; - if (value && (value.type === "block-map" || value.type === "block-seq") && !props.hasNewline) - onError(props.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker"); + var cstScalar = require_cst_scalar(); + var cstStringify = require_cst_stringify(); + var cstVisit = require_cst_visit(); + var BOM = "\uFEFF"; + var DOCUMENT = ""; + var FLOW_END = ""; + var SCALAR = ""; + var isCollection = (token) => !!token && "items" in token; + var isScalar = (token) => !!token && (token.type === "scalar" || token.type === "single-quoted-scalar" || token.type === "double-quoted-scalar" || token.type === "block-scalar"); + function prettyToken(token) { + switch (token) { + case BOM: + return ""; + case DOCUMENT: + return ""; + case FLOW_END: + return ""; + case SCALAR: + return ""; + default: + return JSON.stringify(token); } - doc.contents = value ? composeNode.composeNode(ctx, value, props, onError) : composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError); - const contentEnd = doc.contents.range[2]; - const re = resolveEnd.resolveEnd(end, contentEnd, false, onError); - if (re.comment) - doc.comment = re.comment; - doc.range = [offset, contentEnd, re.offset]; - return doc; } - exports.composeDoc = composeDoc; + function tokenType(source) { + switch (source) { + case BOM: + return "byte-order-mark"; + case DOCUMENT: + return "doc-mode"; + case FLOW_END: + return "flow-error-end"; + case SCALAR: + return "scalar"; + case "---": + return "doc-start"; + case "...": + return "doc-end"; + case "": + case "\n": + case "\r\n": + return "newline"; + case "-": + return "seq-item-ind"; + case "?": + return "explicit-key-ind"; + case ":": + return "map-value-ind"; + case "{": + return "flow-map-start"; + case "}": + return "flow-map-end"; + case "[": + return "flow-seq-start"; + case "]": + return "flow-seq-end"; + case ",": + return "comma"; + } + switch (source[0]) { + case " ": + case " ": + return "space"; + case "#": + return "comment"; + case "%": + return "directive-line"; + case "*": + return "alias"; + case "&": + return "anchor"; + case "!": + return "tag"; + case "'": + return "single-quoted-scalar"; + case '"': + return "double-quoted-scalar"; + case "|": + case ">": + return "block-scalar-header"; + } + return null; + } + exports.createScalarToken = cstScalar.createScalarToken; + exports.resolveAsScalar = cstScalar.resolveAsScalar; + exports.setScalarValue = cstScalar.setScalarValue; + exports.stringify = cstStringify.stringify; + exports.visit = cstVisit.visit; + exports.BOM = BOM; + exports.DOCUMENT = DOCUMENT; + exports.FLOW_END = FLOW_END; + exports.SCALAR = SCALAR; + exports.isCollection = isCollection; + exports.isScalar = isScalar; + exports.prettyToken = prettyToken; + exports.tokenType = tokenType; } }); // -var require_composer = __commonJS({ +var require_lexer = __commonJS({ ""(exports) { "use strict"; - var node_process = __require("process"); - var directives = require_directives(); - var Document = require_Document(); - var errors = require_errors(); - var identity = require_identity(); - var composeDoc = require_compose_doc(); - var resolveEnd = require_resolve_end(); - function getErrorPos(src) { - if (typeof src === "number") - return [src, src + 1]; - if (Array.isArray(src)) - return src.length === 2 ? src : [src[0], src[1]]; - const { offset, source } = src; - return [offset, offset + (typeof source === "string" ? source.length : 1)]; - } - function parsePrelude(prelude) { - let comment = ""; - let atComment = false; - let afterEmptyLine = false; - for (let i = 0; i < prelude.length; ++i) { - const source = prelude[i]; - switch (source[0]) { - case "#": - comment += (comment === "" ? "" : afterEmptyLine ? "\n\n" : "\n") + (source.substring(1) || " "); - atComment = true; - afterEmptyLine = false; - break; - case "%": - if (prelude[i + 1]?.[0] !== "#") - i += 1; - atComment = false; - break; - default: - if (!atComment) - afterEmptyLine = true; - atComment = false; - } - } - return { comment, afterEmptyLine }; - } - var Composer = class { - constructor(options = {}) { - this.doc = null; - this.atDirectives = false; - this.prelude = []; - this.errors = []; - this.warnings = []; - this.onError = (source, code, message, warning) => { - const pos = getErrorPos(source); - if (warning) - this.warnings.push(new errors.YAMLWarning(pos, code, message)); - else - this.errors.push(new errors.YAMLParseError(pos, code, message)); - }; - this.directives = new directives.Directives({ version: options.version || "1.2" }); - this.options = options; - } - decorate(doc, afterDoc) { - const { comment, afterEmptyLine } = parsePrelude(this.prelude); - if (comment) { - const dc = doc.contents; - if (afterDoc) { - doc.comment = doc.comment ? `${doc.comment} -${comment}` : comment; - } else if (afterEmptyLine || doc.directives.docStart || !dc) { - doc.commentBefore = comment; - } else if (identity.isCollection(dc) && !dc.flow && dc.items.length > 0) { - let it = dc.items[0]; - if (identity.isPair(it)) - it = it.key; - const cb = it.commentBefore; - it.commentBefore = cb ? `${comment} -${cb}` : comment; - } else { - const cb = dc.commentBefore; - dc.commentBefore = cb ? `${comment} -${cb}` : comment; - } - } - if (afterDoc) { - Array.prototype.push.apply(doc.errors, this.errors); - Array.prototype.push.apply(doc.warnings, this.warnings); - } else { - doc.errors = this.errors; - doc.warnings = this.warnings; - } - this.prelude = []; - this.errors = []; - this.warnings = []; + var cst = require_cst(); + function isEmpty(ch) { + switch (ch) { + case void 0: + case " ": + case "\n": + case "\r": + case " ": + return true; + default: + return false; } - /** - * Current stream status information. - * - * Mostly useful at the end of input for an empty stream. - */ - streamInfo() { - return { - comment: parsePrelude(this.prelude).comment, - directives: this.directives, - errors: this.errors, - warnings: this.warnings - }; + } + var hexDigits = new Set("0123456789ABCDEFabcdef"); + var tagChars = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"); + var flowIndicatorChars = new Set(",[]{}"); + var invalidAnchorChars = new Set(" ,[]{}\n\r "); + var isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch); + var Lexer = class { + constructor() { + this.atEnd = false; + this.blockScalarIndent = -1; + this.blockScalarKeep = false; + this.buffer = ""; + this.flowKey = false; + this.flowLevel = 0; + this.indentNext = 0; + this.indentValue = 0; + this.lineEndPos = null; + this.next = null; + this.pos = 0; } /** - * Compose tokens into documents. + * Generate YAML tokens from the `source` string. If `incomplete`, + * a part of the last line may be left as a buffer for the next call. * - * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document. - * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly. + * @returns A generator of lexical tokens */ - *compose(tokens, forceDoc = false, endOffset = -1) { - for (const token of tokens) - yield* this.next(token); - yield* this.end(forceDoc, endOffset); + *lex(source, incomplete = false) { + if (source) { + if (typeof source !== "string") + throw TypeError("source is not a string"); + this.buffer = this.buffer ? this.buffer + source : source; + this.lineEndPos = null; + } + this.atEnd = !incomplete; + let next = this.next ?? "stream"; + while (next && (incomplete || this.hasChars(1))) + next = yield* this.parseNext(next); } - /** Advance the composer by one CST token. */ - *next(token) { - if (node_process.env.LOG_STREAM) - console.dir(token, { depth: null }); - switch (token.type) { - case "directive": - this.directives.add(token.source, (offset, message, warning) => { - const pos = getErrorPos(token); - pos[0] += offset; - this.onError(pos, "BAD_DIRECTIVE", message, warning); - }); - this.prelude.push(token.source); - this.atDirectives = true; - break; - case "document": { - const doc = composeDoc.composeDoc(this.options, this.directives, token, this.onError); - if (this.atDirectives && !doc.directives.docStart) - this.onError(token, "MISSING_CHAR", "Missing directives-end/doc-start indicator line"); - this.decorate(doc, false); - if (this.doc) - yield this.doc; - this.doc = doc; - this.atDirectives = false; - break; - } - case "byte-order-mark": - case "space": - break; - case "comment": - case "newline": - this.prelude.push(token.source); - break; - case "error": { - const msg = token.source ? `${token.message}: ${JSON.stringify(token.source)}` : token.message; - const error = new errors.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg); - if (this.atDirectives || !this.doc) - this.errors.push(error); - else - this.doc.errors.push(error); - break; - } - case "doc-end": { - if (!this.doc) { - const msg = "Unexpected doc-end without preceding document"; - this.errors.push(new errors.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg)); - break; - } - this.doc.directives.docEnd = true; - const end = resolveEnd.resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError); - this.decorate(this.doc, true); - if (end.comment) { - const dc = this.doc.comment; - this.doc.comment = dc ? `${dc} -${end.comment}` : end.comment; - } - this.doc.range[2] = end.offset; - break; + atLineEnd() { + let i6 = this.pos; + let ch = this.buffer[i6]; + while (ch === " " || ch === " ") + ch = this.buffer[++i6]; + if (!ch || ch === "#" || ch === "\n") + return true; + if (ch === "\r") + return this.buffer[i6 + 1] === "\n"; + return false; + } + charAt(n3) { + return this.buffer[this.pos + n3]; + } + continueScalar(offset) { + let ch = this.buffer[offset]; + if (this.indentNext > 0) { + let indent = 0; + while (ch === " ") + ch = this.buffer[++indent + offset]; + if (ch === "\r") { + const next = this.buffer[indent + offset + 1]; + if (next === "\n" || !next && !this.atEnd) + return offset + indent + 1; } - default: - this.errors.push(new errors.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", `Unsupported token ${token.type}`)); + return ch === "\n" || indent >= this.indentNext || !ch && !this.atEnd ? offset + indent : -1; + } + if (ch === "-" || ch === ".") { + const dt2 = this.buffer.substr(offset, 3); + if ((dt2 === "---" || dt2 === "...") && isEmpty(this.buffer[offset + 3])) + return -1; } + return offset; } - /** - * Call at end of input to yield any remaining document. - * - * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document. - * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly. - */ - *end(forceDoc = false, endOffset = -1) { - if (this.doc) { - this.decorate(this.doc, true); - yield this.doc; - this.doc = null; - } else if (forceDoc) { - const opts = Object.assign({ _directives: this.directives }, this.options); - const doc = new Document.Document(void 0, opts); - if (this.atDirectives) - this.onError(endOffset, "MISSING_CHAR", "Missing directives-end indicator line"); - doc.range = [0, endOffset, endOffset]; - this.decorate(doc, false); - yield doc; + getLine() { + let end = this.lineEndPos; + if (typeof end !== "number" || end !== -1 && end < this.pos) { + end = this.buffer.indexOf("\n", this.pos); + this.lineEndPos = end; } + if (end === -1) + return this.atEnd ? this.buffer.substring(this.pos) : null; + if (this.buffer[end - 1] === "\r") + end -= 1; + return this.buffer.substring(this.pos, end); } - }; - exports.Composer = Composer; - } -}); - -// -var require_cst_scalar = __commonJS({ - ""(exports) { - "use strict"; - var resolveBlockScalar = require_resolve_block_scalar(); - var resolveFlowScalar = require_resolve_flow_scalar(); - var errors = require_errors(); - var stringifyString = require_stringifyString(); - function resolveAsScalar(token, strict = true, onError) { - if (token) { - const _onError = (pos, code, message) => { - const offset = typeof pos === "number" ? pos : Array.isArray(pos) ? pos[0] : pos.offset; - if (onError) - onError(offset, code, message); - else - throw new errors.YAMLParseError([offset, offset + 1], code, message); - }; - switch (token.type) { - case "scalar": - case "single-quoted-scalar": - case "double-quoted-scalar": - return resolveFlowScalar.resolveFlowScalar(token, strict, _onError); + hasChars(n3) { + return this.pos + n3 <= this.buffer.length; + } + setNext(state) { + this.buffer = this.buffer.substring(this.pos); + this.pos = 0; + this.lineEndPos = null; + this.next = state; + return null; + } + peek(n3) { + return this.buffer.substr(this.pos, n3); + } + *parseNext(next) { + switch (next) { + case "stream": + return yield* this.parseStream(); + case "line-start": + return yield* this.parseLineStart(); + case "block-start": + return yield* this.parseBlockStart(); + case "doc": + return yield* this.parseDocument(); + case "flow": + return yield* this.parseFlowCollection(); + case "quoted-scalar": + return yield* this.parseQuotedScalar(); case "block-scalar": - return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError); + return yield* this.parseBlockScalar(); + case "plain-scalar": + return yield* this.parsePlainScalar(); + } + } + *parseStream() { + let line = this.getLine(); + if (line === null) + return this.setNext("stream"); + if (line[0] === cst.BOM) { + yield* this.pushCount(1); + line = line.substring(1); + } + if (line[0] === "%") { + let dirEnd = line.length; + let cs = line.indexOf("#"); + while (cs !== -1) { + const ch = line[cs - 1]; + if (ch === " " || ch === " ") { + dirEnd = cs - 1; + break; + } else { + cs = line.indexOf("#", cs + 1); + } + } + while (true) { + const ch = line[dirEnd - 1]; + if (ch === " " || ch === " ") + dirEnd -= 1; + else + break; + } + const n3 = (yield* this.pushCount(dirEnd)) + (yield* this.pushSpaces(true)); + yield* this.pushCount(line.length - n3); + this.pushNewline(); + return "stream"; } - } - return null; - } - function createScalarToken(value, context2) { - const { implicitKey = false, indent, inFlow = false, offset = -1, type = "PLAIN" } = context2; - const source = stringifyString.stringifyString({ type, value }, { - implicitKey, - indent: indent > 0 ? " ".repeat(indent) : "", - inFlow, - options: { blockQuote: true, lineWidth: -1 } - }); - const end = context2.end ?? [ - { type: "newline", offset: -1, indent, source: "\n" } - ]; - switch (source[0]) { - case "|": - case ">": { - const he = source.indexOf("\n"); - const head = source.substring(0, he); - const body = source.substring(he + 1) + "\n"; - const props = [ - { type: "block-scalar-header", offset, indent, source: head } - ]; - if (!addEndtoBlockProps(props, end)) - props.push({ type: "newline", offset: -1, indent, source: "\n" }); - return { type: "block-scalar", offset, indent, props, source: body }; + if (this.atLineEnd()) { + const sp = yield* this.pushSpaces(true); + yield* this.pushCount(line.length - sp); + yield* this.pushNewline(); + return "stream"; } - case '"': - return { type: "double-quoted-scalar", offset, indent, source, end }; - case "'": - return { type: "single-quoted-scalar", offset, indent, source, end }; - default: - return { type: "scalar", offset, indent, source, end }; + yield cst.DOCUMENT; + return yield* this.parseLineStart(); } - } - function setScalarValue(token, value, context2 = {}) { - let { afterKey = false, implicitKey = false, inFlow = false, type } = context2; - let indent = "indent" in token ? token.indent : null; - if (afterKey && typeof indent === "number") - indent += 2; - if (!type) - switch (token.type) { - case "single-quoted-scalar": - type = "QUOTE_SINGLE"; - break; - case "double-quoted-scalar": - type = "QUOTE_DOUBLE"; - break; - case "block-scalar": { - const header = token.props[0]; - if (header.type !== "block-scalar-header") - throw new Error("Invalid block scalar header"); - type = header.source[0] === ">" ? "BLOCK_FOLDED" : "BLOCK_LITERAL"; - break; + *parseLineStart() { + const ch = this.charAt(0); + if (!ch && !this.atEnd) + return this.setNext("line-start"); + if (ch === "-" || ch === ".") { + if (!this.atEnd && !this.hasChars(4)) + return this.setNext("line-start"); + const s5 = this.peek(3); + if ((s5 === "---" || s5 === "...") && isEmpty(this.charAt(3))) { + yield* this.pushCount(3); + this.indentValue = 0; + this.indentNext = 0; + return s5 === "---" ? "doc" : "stream"; } - default: - type = "PLAIN"; } - const source = stringifyString.stringifyString({ type, value }, { - implicitKey: implicitKey || indent === null, - indent: indent !== null && indent > 0 ? " ".repeat(indent) : "", - inFlow, - options: { blockQuote: true, lineWidth: -1 } - }); - switch (source[0]) { - case "|": - case ">": - setBlockScalarValue(token, source); - break; - case '"': - setFlowScalarValue(token, source, "double-quoted-scalar"); - break; - case "'": - setFlowScalarValue(token, source, "single-quoted-scalar"); - break; - default: - setFlowScalarValue(token, source, "scalar"); + this.indentValue = yield* this.pushSpaces(false); + if (this.indentNext > this.indentValue && !isEmpty(this.charAt(1))) + this.indentNext = this.indentValue; + return yield* this.parseBlockStart(); } - } - function setBlockScalarValue(token, source) { - const he = source.indexOf("\n"); - const head = source.substring(0, he); - const body = source.substring(he + 1) + "\n"; - if (token.type === "block-scalar") { - const header = token.props[0]; - if (header.type !== "block-scalar-header") - throw new Error("Invalid block scalar header"); - header.source = head; - token.source = body; - } else { - const { offset } = token; - const indent = "indent" in token ? token.indent : -1; - const props = [ - { type: "block-scalar-header", offset, indent, source: head } - ]; - if (!addEndtoBlockProps(props, "end" in token ? token.end : void 0)) - props.push({ type: "newline", offset: -1, indent, source: "\n" }); - for (const key of Object.keys(token)) - if (key !== "type" && key !== "offset") - delete token[key]; - Object.assign(token, { type: "block-scalar", indent, props, source: body }); + *parseBlockStart() { + const [ch0, ch1] = this.peek(2); + if (!ch1 && !this.atEnd) + return this.setNext("block-start"); + if ((ch0 === "-" || ch0 === "?" || ch0 === ":") && isEmpty(ch1)) { + const n3 = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true)); + this.indentNext = this.indentValue + 1; + this.indentValue += n3; + return yield* this.parseBlockStart(); + } + return "doc"; } - } - function addEndtoBlockProps(props, end) { - if (end) - for (const st of end) - switch (st.type) { - case "space": - case "comment": - props.push(st); - break; - case "newline": - props.push(st); - return true; + *parseDocument() { + yield* this.pushSpaces(true); + const line = this.getLine(); + if (line === null) + return this.setNext("doc"); + let n3 = yield* this.pushIndicators(); + switch (line[n3]) { + case "#": + yield* this.pushCount(line.length - n3); + case void 0: + yield* this.pushNewline(); + return yield* this.parseLineStart(); + case "{": + case "[": + yield* this.pushCount(1); + this.flowKey = false; + this.flowLevel = 1; + return "flow"; + case "}": + case "]": + yield* this.pushCount(1); + return "doc"; + case "*": + yield* this.pushUntil(isNotAnchorChar); + return "doc"; + case '"': + case "'": + return yield* this.parseQuotedScalar(); + case "|": + case ">": + n3 += yield* this.parseBlockScalarHeader(); + n3 += yield* this.pushSpaces(true); + yield* this.pushCount(line.length - n3); + yield* this.pushNewline(); + return yield* this.parseBlockScalar(); + default: + return yield* this.parsePlainScalar(); + } + } + *parseFlowCollection() { + let nl, sp; + let indent = -1; + do { + nl = yield* this.pushNewline(); + if (nl > 0) { + sp = yield* this.pushSpaces(false); + this.indentValue = indent = sp; + } else { + sp = 0; + } + sp += yield* this.pushSpaces(true); + } while (nl + sp > 0); + const line = this.getLine(); + if (line === null) + return this.setNext("flow"); + if (indent !== -1 && indent < this.indentNext && line[0] !== "#" || indent === 0 && (line.startsWith("---") || line.startsWith("...")) && isEmpty(line[3])) { + const atFlowEndMarker = indent === this.indentNext - 1 && this.flowLevel === 1 && (line[0] === "]" || line[0] === "}"); + if (!atFlowEndMarker) { + this.flowLevel = 0; + yield cst.FLOW_END; + return yield* this.parseLineStart(); } - return false; - } - function setFlowScalarValue(token, source, type) { - switch (token.type) { - case "scalar": - case "double-quoted-scalar": - case "single-quoted-scalar": - token.type = type; - token.source = source; - break; - case "block-scalar": { - const end = token.props.slice(1); - let oa = source.length; - if (token.props[0].type === "block-scalar-header") - oa -= token.props[0].source.length; - for (const tok of end) - tok.offset += oa; - delete token.props; - Object.assign(token, { type, source, end }); - break; } - case "block-map": - case "block-seq": { - const offset = token.offset + source.length; - const nl = { type: "newline", offset, indent: token.indent, source: "\n" }; - delete token.items; - Object.assign(token, { type, source, end: [nl] }); - break; + let n3 = 0; + while (line[n3] === ",") { + n3 += yield* this.pushCount(1); + n3 += yield* this.pushSpaces(true); + this.flowKey = false; + } + n3 += yield* this.pushIndicators(); + switch (line[n3]) { + case void 0: + return "flow"; + case "#": + yield* this.pushCount(line.length - n3); + return "flow"; + case "{": + case "[": + yield* this.pushCount(1); + this.flowKey = false; + this.flowLevel += 1; + return "flow"; + case "}": + case "]": + yield* this.pushCount(1); + this.flowKey = true; + this.flowLevel -= 1; + return this.flowLevel ? "flow" : "doc"; + case "*": + yield* this.pushUntil(isNotAnchorChar); + return "flow"; + case '"': + case "'": + this.flowKey = true; + return yield* this.parseQuotedScalar(); + case ":": { + const next = this.charAt(1); + if (this.flowKey || isEmpty(next) || next === ",") { + this.flowKey = false; + yield* this.pushCount(1); + yield* this.pushSpaces(true); + return "flow"; + } + } + default: + this.flowKey = false; + return yield* this.parsePlainScalar(); + } + } + *parseQuotedScalar() { + const quote = this.charAt(0); + let end = this.buffer.indexOf(quote, this.pos + 1); + if (quote === "'") { + while (end !== -1 && this.buffer[end + 1] === "'") + end = this.buffer.indexOf("'", end + 2); + } else { + while (end !== -1) { + let n3 = 0; + while (this.buffer[end - 1 - n3] === "\\") + n3 += 1; + if (n3 % 2 === 0) + break; + end = this.buffer.indexOf('"', end + 1); + } } - default: { - const indent = "indent" in token ? token.indent : -1; - const end = "end" in token && Array.isArray(token.end) ? token.end.filter((st) => st.type === "space" || st.type === "comment" || st.type === "newline") : []; - for (const key of Object.keys(token)) - if (key !== "type" && key !== "offset") - delete token[key]; - Object.assign(token, { type, indent, source, end }); + const qb = this.buffer.substring(0, end); + let nl = qb.indexOf("\n", this.pos); + if (nl !== -1) { + while (nl !== -1) { + const cs = this.continueScalar(nl + 1); + if (cs === -1) + break; + nl = qb.indexOf("\n", cs); + } + if (nl !== -1) { + end = nl - (qb[nl - 1] === "\r" ? 2 : 1); + } + } + if (end === -1) { + if (!this.atEnd) + return this.setNext("quoted-scalar"); + end = this.buffer.length; } + yield* this.pushToIndex(end + 1, false); + return this.flowLevel ? "flow" : "doc"; } - } - exports.createScalarToken = createScalarToken; - exports.resolveAsScalar = resolveAsScalar; - exports.setScalarValue = setScalarValue; - } -}); - -// -var require_cst_stringify = __commonJS({ - ""(exports) { - "use strict"; - var stringify = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst); - function stringifyToken(token) { - switch (token.type) { - case "block-scalar": { - let res = ""; - for (const tok of token.props) - res += stringifyToken(tok); - return res + token.source; + *parseBlockScalarHeader() { + this.blockScalarIndent = -1; + this.blockScalarKeep = false; + let i6 = this.pos; + while (true) { + const ch = this.buffer[++i6]; + if (ch === "+") + this.blockScalarKeep = true; + else if (ch > "0" && ch <= "9") + this.blockScalarIndent = Number(ch) - 1; + else if (ch !== "-") + break; } - case "block-map": - case "block-seq": { - let res = ""; - for (const item of token.items) - res += stringifyItem(item); - return res; + return yield* this.pushUntil((ch) => isEmpty(ch) || ch === "#"); + } + *parseBlockScalar() { + let nl = this.pos - 1; + let indent = 0; + let ch; + loop: + for (let i7 = this.pos; ch = this.buffer[i7]; ++i7) { + switch (ch) { + case " ": + indent += 1; + break; + case "\n": + nl = i7; + indent = 0; + break; + case "\r": { + const next = this.buffer[i7 + 1]; + if (!next && !this.atEnd) + return this.setNext("block-scalar"); + if (next === "\n") + break; + } + default: + break loop; + } + } + if (!ch && !this.atEnd) + return this.setNext("block-scalar"); + if (indent >= this.indentNext) { + if (this.blockScalarIndent === -1) + this.indentNext = indent; + else { + this.indentNext = this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext); + } + do { + const cs = this.continueScalar(nl + 1); + if (cs === -1) + break; + nl = this.buffer.indexOf("\n", cs); + } while (nl !== -1); + if (nl === -1) { + if (!this.atEnd) + return this.setNext("block-scalar"); + nl = this.buffer.length; + } } - case "flow-collection": { - let res = token.start.source; - for (const item of token.items) - res += stringifyItem(item); - for (const st of token.end) - res += st.source; - return res; + let i6 = nl + 1; + ch = this.buffer[i6]; + while (ch === " ") + ch = this.buffer[++i6]; + if (ch === " ") { + while (ch === " " || ch === " " || ch === "\r" || ch === "\n") + ch = this.buffer[++i6]; + nl = i6 - 1; + } else if (!this.blockScalarKeep) { + do { + let i7 = nl - 1; + let ch2 = this.buffer[i7]; + if (ch2 === "\r") + ch2 = this.buffer[--i7]; + const lastChar = i7; + while (ch2 === " ") + ch2 = this.buffer[--i7]; + if (ch2 === "\n" && i7 >= this.pos && i7 + 1 + indent > lastChar) + nl = i7; + else + break; + } while (true); } - case "document": { - let res = stringifyItem(token); - if (token.end) - for (const st of token.end) - res += st.source; - return res; + yield cst.SCALAR; + yield* this.pushToIndex(nl + 1, true); + return yield* this.parseLineStart(); + } + *parsePlainScalar() { + const inFlow = this.flowLevel > 0; + let end = this.pos - 1; + let i6 = this.pos - 1; + let ch; + while (ch = this.buffer[++i6]) { + if (ch === ":") { + const next = this.buffer[i6 + 1]; + if (isEmpty(next) || inFlow && flowIndicatorChars.has(next)) + break; + end = i6; + } else if (isEmpty(ch)) { + let next = this.buffer[i6 + 1]; + if (ch === "\r") { + if (next === "\n") { + i6 += 1; + ch = "\n"; + next = this.buffer[i6 + 1]; + } else + end = i6; + } + if (next === "#" || inFlow && flowIndicatorChars.has(next)) + break; + if (ch === "\n") { + const cs = this.continueScalar(i6 + 1); + if (cs === -1) + break; + i6 = Math.max(i6, cs - 2); + } + } else { + if (inFlow && flowIndicatorChars.has(ch)) + break; + end = i6; + } } - default: { - let res = token.source; - if ("end" in token && token.end) - for (const st of token.end) - res += st.source; - return res; + if (!ch && !this.atEnd) + return this.setNext("plain-scalar"); + yield cst.SCALAR; + yield* this.pushToIndex(end + 1, true); + return inFlow ? "flow" : "doc"; + } + *pushCount(n3) { + if (n3 > 0) { + yield this.buffer.substr(this.pos, n3); + this.pos += n3; + return n3; } + return 0; } - } - function stringifyItem({ start, key, sep: sep2, value }) { - let res = ""; - for (const st of start) - res += st.source; - if (key) - res += stringifyToken(key); - if (sep2) - for (const st of sep2) - res += st.source; - if (value) - res += stringifyToken(value); - return res; - } - exports.stringify = stringify; - } -}); - -// -var require_cst_visit = __commonJS({ - ""(exports) { - "use strict"; - var BREAK = Symbol("break visit"); - var SKIP = Symbol("skip children"); - var REMOVE = Symbol("remove item"); - function visit(cst, visitor) { - if ("type" in cst && cst.type === "document") - cst = { start: cst.start, value: cst.value }; - _visit(Object.freeze([]), cst, visitor); - } - visit.BREAK = BREAK; - visit.SKIP = SKIP; - visit.REMOVE = REMOVE; - visit.itemAtPath = (cst, path) => { - let item = cst; - for (const [field, index] of path) { - const tok = item?.[field]; - if (tok && "items" in tok) { - item = tok.items[index]; - } else - return void 0; + *pushToIndex(i6, allowEmpty) { + const s5 = this.buffer.slice(this.pos, i6); + if (s5) { + yield s5; + this.pos += s5.length; + return s5.length; + } else if (allowEmpty) + yield ""; + return 0; } - return item; - }; - visit.parentCollection = (cst, path) => { - const parent = visit.itemAtPath(cst, path.slice(0, -1)); - const field = path[path.length - 1][0]; - const coll = parent?.[field]; - if (coll && "items" in coll) - return coll; - throw new Error("Parent collection not found"); - }; - function _visit(path, item, visitor) { - let ctrl = visitor(item, path); - if (typeof ctrl === "symbol") - return ctrl; - for (const field of ["key", "value"]) { - const token = item[field]; - if (token && "items" in token) { - for (let i = 0; i < token.items.length; ++i) { - const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor); - if (typeof ci === "number") - i = ci - 1; - else if (ci === BREAK) - return BREAK; - else if (ci === REMOVE) { - token.items.splice(i, 1); - i -= 1; + *pushIndicators() { + switch (this.charAt(0)) { + case "!": + return (yield* this.pushTag()) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators()); + case "&": + return (yield* this.pushUntil(isNotAnchorChar)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators()); + case "-": + case "?": + case ":": { + const inFlow = this.flowLevel > 0; + const ch1 = this.charAt(1); + if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) { + if (!inFlow) + this.indentNext = this.indentValue + 1; + else if (this.flowKey) + this.flowKey = false; + return (yield* this.pushCount(1)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators()); } } - if (typeof ctrl === "function" && field === "key") - ctrl = ctrl(item, path); } + return 0; + } + *pushTag() { + if (this.charAt(1) === "<") { + let i6 = this.pos + 2; + let ch = this.buffer[i6]; + while (!isEmpty(ch) && ch !== ">") + ch = this.buffer[++i6]; + return yield* this.pushToIndex(ch === ">" ? i6 + 1 : i6, false); + } else { + let i6 = this.pos + 1; + let ch = this.buffer[i6]; + while (ch) { + if (tagChars.has(ch)) + ch = this.buffer[++i6]; + else if (ch === "%" && hexDigits.has(this.buffer[i6 + 1]) && hexDigits.has(this.buffer[i6 + 2])) { + ch = this.buffer[i6 += 3]; + } else + break; + } + return yield* this.pushToIndex(i6, false); + } + } + *pushNewline() { + const ch = this.buffer[this.pos]; + if (ch === "\n") + return yield* this.pushCount(1); + else if (ch === "\r" && this.charAt(1) === "\n") + return yield* this.pushCount(2); + else + return 0; + } + *pushSpaces(allowTabs) { + let i6 = this.pos - 1; + let ch; + do { + ch = this.buffer[++i6]; + } while (ch === " " || allowTabs && ch === " "); + const n3 = i6 - this.pos; + if (n3 > 0) { + yield this.buffer.substr(this.pos, n3); + this.pos = i6; + } + return n3; } - return typeof ctrl === "function" ? ctrl(item, path) : ctrl; - } - exports.visit = visit; + *pushUntil(test) { + let i6 = this.pos; + let ch = this.buffer[i6]; + while (!test(ch)) + ch = this.buffer[++i6]; + return yield* this.pushToIndex(i6, false); + } + }; + exports.Lexer = Lexer; } }); // -var require_cst = __commonJS({ +var require_line_counter = __commonJS({ ""(exports) { "use strict"; - var cstScalar = require_cst_scalar(); - var cstStringify = require_cst_stringify(); - var cstVisit = require_cst_visit(); - var BOM = "\uFEFF"; - var DOCUMENT = ""; - var FLOW_END = ""; - var SCALAR = ""; - var isCollection = (token) => !!token && "items" in token; - var isScalar = (token) => !!token && (token.type === "scalar" || token.type === "single-quoted-scalar" || token.type === "double-quoted-scalar" || token.type === "block-scalar"); - function prettyToken(token) { - switch (token) { - case BOM: - return ""; - case DOCUMENT: - return ""; - case FLOW_END: - return ""; - case SCALAR: - return ""; - default: - return JSON.stringify(token); - } - } - function tokenType(source) { - switch (source) { - case BOM: - return "byte-order-mark"; - case DOCUMENT: - return "doc-mode"; - case FLOW_END: - return "flow-error-end"; - case SCALAR: - return "scalar"; - case "---": - return "doc-start"; - case "...": - return "doc-end"; - case "": - case "\n": - case "\r\n": - return "newline"; - case "-": - return "seq-item-ind"; - case "?": - return "explicit-key-ind"; - case ":": - return "map-value-ind"; - case "{": - return "flow-map-start"; - case "}": - return "flow-map-end"; - case "[": - return "flow-seq-start"; - case "]": - return "flow-seq-end"; - case ",": - return "comma"; - } - switch (source[0]) { - case " ": - case " ": - return "space"; - case "#": - return "comment"; - case "%": - return "directive-line"; - case "*": - return "alias"; - case "&": - return "anchor"; - case "!": - return "tag"; - case "'": - return "single-quoted-scalar"; - case '"': - return "double-quoted-scalar"; - case "|": - case ">": - return "block-scalar-header"; + var LineCounter = class { + constructor() { + this.lineStarts = []; + this.addNewLine = (offset) => this.lineStarts.push(offset); + this.linePos = (offset) => { + let low = 0; + let high = this.lineStarts.length; + while (low < high) { + const mid = low + high >> 1; + if (this.lineStarts[mid] < offset) + low = mid + 1; + else + high = mid; + } + if (this.lineStarts[low] === offset) + return { line: low + 1, col: 1 }; + if (low === 0) + return { line: 0, col: offset }; + const start = this.lineStarts[low - 1]; + return { line: low, col: offset - start + 1 }; + }; } - return null; - } - exports.createScalarToken = cstScalar.createScalarToken; - exports.resolveAsScalar = cstScalar.resolveAsScalar; - exports.setScalarValue = cstScalar.setScalarValue; - exports.stringify = cstStringify.stringify; - exports.visit = cstVisit.visit; - exports.BOM = BOM; - exports.DOCUMENT = DOCUMENT; - exports.FLOW_END = FLOW_END; - exports.SCALAR = SCALAR; - exports.isCollection = isCollection; - exports.isScalar = isScalar; - exports.prettyToken = prettyToken; - exports.tokenType = tokenType; + }; + exports.LineCounter = LineCounter; } }); // -var require_lexer = __commonJS({ +var require_parser = __commonJS({ ""(exports) { "use strict"; + var node_process = __require("process"); var cst = require_cst(); - function isEmpty(ch) { - switch (ch) { - case void 0: - case " ": - case "\n": - case "\r": - case " ": + var lexer = require_lexer(); + function includesToken(list, type) { + for (let i6 = 0; i6 < list.length; ++i6) + if (list[i6].type === type) return true; - default: - return false; - } + return false; } - var hexDigits = new Set("0123456789ABCDEFabcdef"); - var tagChars = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"); - var flowIndicatorChars = new Set(",[]{}"); - var invalidAnchorChars = new Set(" ,[]{}\n\r "); - var isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch); - var Lexer = class { - constructor() { - this.atEnd = false; - this.blockScalarIndent = -1; - this.blockScalarKeep = false; - this.buffer = ""; - this.flowKey = false; - this.flowLevel = 0; - this.indentNext = 0; - this.indentValue = 0; - this.lineEndPos = null; - this.next = null; - this.pos = 0; - } - /** - * Generate YAML tokens from the `source` string. If `incomplete`, - * a part of the last line may be left as a buffer for the next call. - * - * @returns A generator of lexical tokens - */ - *lex(source, incomplete = false) { - if (source) { - if (typeof source !== "string") - throw TypeError("source is not a string"); - this.buffer = this.buffer ? this.buffer + source : source; - this.lineEndPos = null; - } - this.atEnd = !incomplete; - let next = this.next ?? "stream"; - while (next && (incomplete || this.hasChars(1))) - next = yield* this.parseNext(next); - } - atLineEnd() { - let i = this.pos; - let ch = this.buffer[i]; - while (ch === " " || ch === " ") - ch = this.buffer[++i]; - if (!ch || ch === "#" || ch === "\n") - return true; - if (ch === "\r") - return this.buffer[i + 1] === "\n"; - return false; - } - charAt(n) { - return this.buffer[this.pos + n]; - } - continueScalar(offset) { - let ch = this.buffer[offset]; - if (this.indentNext > 0) { - let indent = 0; - while (ch === " ") - ch = this.buffer[++indent + offset]; - if (ch === "\r") { - const next = this.buffer[indent + offset + 1]; - if (next === "\n" || !next && !this.atEnd) - return offset + indent + 1; - } - return ch === "\n" || indent >= this.indentNext || !ch && !this.atEnd ? offset + indent : -1; - } - if (ch === "-" || ch === ".") { - const dt = this.buffer.substr(offset, 3); - if ((dt === "---" || dt === "...") && isEmpty(this.buffer[offset + 3])) - return -1; - } - return offset; - } - getLine() { - let end = this.lineEndPos; - if (typeof end !== "number" || end !== -1 && end < this.pos) { - end = this.buffer.indexOf("\n", this.pos); - this.lineEndPos = end; - } - if (end === -1) - return this.atEnd ? this.buffer.substring(this.pos) : null; - if (this.buffer[end - 1] === "\r") - end -= 1; - return this.buffer.substring(this.pos, end); - } - hasChars(n) { - return this.pos + n <= this.buffer.length; - } - setNext(state) { - this.buffer = this.buffer.substring(this.pos); - this.pos = 0; - this.lineEndPos = null; - this.next = state; - return null; - } - peek(n) { - return this.buffer.substr(this.pos, n); - } - *parseNext(next) { - switch (next) { - case "stream": - return yield* this.parseStream(); - case "line-start": - return yield* this.parseLineStart(); - case "block-start": - return yield* this.parseBlockStart(); - case "doc": - return yield* this.parseDocument(); - case "flow": - return yield* this.parseFlowCollection(); - case "quoted-scalar": - return yield* this.parseQuotedScalar(); - case "block-scalar": - return yield* this.parseBlockScalar(); - case "plain-scalar": - return yield* this.parsePlainScalar(); + function findNonEmptyIndex(list) { + for (let i6 = 0; i6 < list.length; ++i6) { + switch (list[i6].type) { + case "space": + case "comment": + case "newline": + break; + default: + return i6; } } - *parseStream() { - let line = this.getLine(); - if (line === null) - return this.setNext("stream"); - if (line[0] === cst.BOM) { - yield* this.pushCount(1); - line = line.substring(1); + return -1; + } + function isFlowToken(token) { + switch (token?.type) { + case "alias": + case "scalar": + case "single-quoted-scalar": + case "double-quoted-scalar": + case "flow-collection": + return true; + default: + return false; + } + } + function getPrevProps(parent) { + switch (parent.type) { + case "document": + return parent.start; + case "block-map": { + const it2 = parent.items[parent.items.length - 1]; + return it2.sep ?? it2.start; } - if (line[0] === "%") { - let dirEnd = line.length; - let cs = line.indexOf("#"); - while (cs !== -1) { - const ch = line[cs - 1]; - if (ch === " " || ch === " ") { - dirEnd = cs - 1; - break; - } else { - cs = line.indexOf("#", cs + 1); - } - } - while (true) { - const ch = line[dirEnd - 1]; - if (ch === " " || ch === " ") - dirEnd -= 1; - else - break; + case "block-seq": + return parent.items[parent.items.length - 1].start; + default: + return []; + } + } + function getFirstKeyStartProps(prev) { + if (prev.length === 0) + return []; + let i6 = prev.length; + loop: + while (--i6 >= 0) { + switch (prev[i6].type) { + case "doc-start": + case "explicit-key-ind": + case "map-value-ind": + case "seq-item-ind": + case "newline": + break loop; } - const n = (yield* this.pushCount(dirEnd)) + (yield* this.pushSpaces(true)); - yield* this.pushCount(line.length - n); - this.pushNewline(); - return "stream"; - } - if (this.atLineEnd()) { - const sp = yield* this.pushSpaces(true); - yield* this.pushCount(line.length - sp); - yield* this.pushNewline(); - return "stream"; } - yield cst.DOCUMENT; - return yield* this.parseLineStart(); + while (prev[++i6]?.type === "space") { } - *parseLineStart() { - const ch = this.charAt(0); - if (!ch && !this.atEnd) - return this.setNext("line-start"); - if (ch === "-" || ch === ".") { - if (!this.atEnd && !this.hasChars(4)) - return this.setNext("line-start"); - const s = this.peek(3); - if ((s === "---" || s === "...") && isEmpty(this.charAt(3))) { - yield* this.pushCount(3); - this.indentValue = 0; - this.indentNext = 0; - return s === "---" ? "doc" : "stream"; + return prev.splice(i6, prev.length); + } + function fixFlowSeqItems(fc) { + if (fc.start.type === "flow-seq-start") { + for (const it2 of fc.items) { + if (it2.sep && !it2.value && !includesToken(it2.start, "explicit-key-ind") && !includesToken(it2.sep, "map-value-ind")) { + if (it2.key) + it2.value = it2.key; + delete it2.key; + if (isFlowToken(it2.value)) { + if (it2.value.end) + Array.prototype.push.apply(it2.value.end, it2.sep); + else + it2.value.end = it2.sep; + } else + Array.prototype.push.apply(it2.start, it2.sep); + delete it2.sep; } } - this.indentValue = yield* this.pushSpaces(false); - if (this.indentNext > this.indentValue && !isEmpty(this.charAt(1))) - this.indentNext = this.indentValue; - return yield* this.parseBlockStart(); } - *parseBlockStart() { - const [ch0, ch1] = this.peek(2); - if (!ch1 && !this.atEnd) - return this.setNext("block-start"); - if ((ch0 === "-" || ch0 === "?" || ch0 === ":") && isEmpty(ch1)) { - const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true)); - this.indentNext = this.indentValue + 1; - this.indentValue += n; - return yield* this.parseBlockStart(); - } - return "doc"; + } + var Parser = class { + /** + * @param onNewLine - If defined, called separately with the start position of + * each new line (in `parse()`, including the start of input). + */ + constructor(onNewLine) { + this.atNewLine = true; + this.atScalar = false; + this.indent = 0; + this.offset = 0; + this.onKeyLine = false; + this.stack = []; + this.source = ""; + this.type = ""; + this.lexer = new lexer.Lexer(); + this.onNewLine = onNewLine; } - *parseDocument() { - yield* this.pushSpaces(true); - const line = this.getLine(); - if (line === null) - return this.setNext("doc"); - let n = yield* this.pushIndicators(); - switch (line[n]) { - case "#": - yield* this.pushCount(line.length - n); - // fallthrough - case void 0: - yield* this.pushNewline(); - return yield* this.parseLineStart(); - case "{": - case "[": - yield* this.pushCount(1); - this.flowKey = false; - this.flowLevel = 1; - return "flow"; - case "}": - case "]": - yield* this.pushCount(1); - return "doc"; - case "*": - yield* this.pushUntil(isNotAnchorChar); - return "doc"; - case '"': - case "'": - return yield* this.parseQuotedScalar(); - case "|": - case ">": - n += yield* this.parseBlockScalarHeader(); - n += yield* this.pushSpaces(true); - yield* this.pushCount(line.length - n); - yield* this.pushNewline(); - return yield* this.parseBlockScalar(); - default: - return yield* this.parsePlainScalar(); - } + /** + * Parse `source` as a YAML stream. + * If `incomplete`, a part of the last line may be left as a buffer for the next call. + * + * Errors are not thrown, but yielded as `{ type: 'error', message }` tokens. + * + * @returns A generator of tokens representing each directive, document, and other structure. + */ + *parse(source, incomplete = false) { + if (this.onNewLine && this.offset === 0) + this.onNewLine(0); + for (const lexeme of this.lexer.lex(source, incomplete)) + yield* this.next(lexeme); + if (!incomplete) + yield* this.end(); } - *parseFlowCollection() { - let nl, sp; - let indent = -1; - do { - nl = yield* this.pushNewline(); - if (nl > 0) { - sp = yield* this.pushSpaces(false); - this.indentValue = indent = sp; - } else { - sp = 0; - } - sp += yield* this.pushSpaces(true); - } while (nl + sp > 0); - const line = this.getLine(); - if (line === null) - return this.setNext("flow"); - if (indent !== -1 && indent < this.indentNext && line[0] !== "#" || indent === 0 && (line.startsWith("---") || line.startsWith("...")) && isEmpty(line[3])) { - const atFlowEndMarker = indent === this.indentNext - 1 && this.flowLevel === 1 && (line[0] === "]" || line[0] === "}"); - if (!atFlowEndMarker) { - this.flowLevel = 0; - yield cst.FLOW_END; - return yield* this.parseLineStart(); - } - } - let n = 0; - while (line[n] === ",") { - n += yield* this.pushCount(1); - n += yield* this.pushSpaces(true); - this.flowKey = false; - } - n += yield* this.pushIndicators(); - switch (line[n]) { - case void 0: - return "flow"; - case "#": - yield* this.pushCount(line.length - n); - return "flow"; - case "{": - case "[": - yield* this.pushCount(1); - this.flowKey = false; - this.flowLevel += 1; - return "flow"; - case "}": - case "]": - yield* this.pushCount(1); - this.flowKey = true; - this.flowLevel -= 1; - return this.flowLevel ? "flow" : "doc"; - case "*": - yield* this.pushUntil(isNotAnchorChar); - return "flow"; - case '"': - case "'": - this.flowKey = true; - return yield* this.parseQuotedScalar(); - case ":": { - const next = this.charAt(1); - if (this.flowKey || isEmpty(next) || next === ",") { - this.flowKey = false; - yield* this.pushCount(1); - yield* this.pushSpaces(true); - return "flow"; - } - } - // fallthrough - default: - this.flowKey = false; - return yield* this.parsePlainScalar(); + /** + * Advance the parser by the `source` of one lexical token. + */ + *next(source) { + this.source = source; + if (node_process.env.LOG_TOKENS) + console.log("|", cst.prettyToken(source)); + if (this.atScalar) { + this.atScalar = false; + yield* this.step(); + this.offset += source.length; + return; } - } - *parseQuotedScalar() { - const quote = this.charAt(0); - let end = this.buffer.indexOf(quote, this.pos + 1); - if (quote === "'") { - while (end !== -1 && this.buffer[end + 1] === "'") - end = this.buffer.indexOf("'", end + 2); + const type = cst.tokenType(source); + if (!type) { + const message = `Not a YAML token: ${source}`; + yield* this.pop({ type: "error", offset: this.offset, message, source }); + this.offset += source.length; + } else if (type === "scalar") { + this.atNewLine = false; + this.atScalar = true; + this.type = "scalar"; } else { - while (end !== -1) { - let n = 0; - while (this.buffer[end - 1 - n] === "\\") - n += 1; - if (n % 2 === 0) + this.type = type; + yield* this.step(); + switch (type) { + case "newline": + this.atNewLine = true; + this.indent = 0; + if (this.onNewLine) + this.onNewLine(this.offset + source.length); break; - end = this.buffer.indexOf('"', end + 1); - } - } - const qb = this.buffer.substring(0, end); - let nl = qb.indexOf("\n", this.pos); - if (nl !== -1) { - while (nl !== -1) { - const cs = this.continueScalar(nl + 1); - if (cs === -1) + case "space": + if (this.atNewLine && source[0] === " ") + this.indent += source.length; break; - nl = qb.indexOf("\n", cs); - } - if (nl !== -1) { - end = nl - (qb[nl - 1] === "\r" ? 2 : 1); + case "explicit-key-ind": + case "map-value-ind": + case "seq-item-ind": + if (this.atNewLine) + this.indent += source.length; + break; + case "doc-mode": + case "flow-error-end": + return; + default: + this.atNewLine = false; } + this.offset += source.length; } - if (end === -1) { - if (!this.atEnd) - return this.setNext("quoted-scalar"); - end = this.buffer.length; - } - yield* this.pushToIndex(end + 1, false); - return this.flowLevel ? "flow" : "doc"; } - *parseBlockScalarHeader() { - this.blockScalarIndent = -1; - this.blockScalarKeep = false; - let i = this.pos; - while (true) { - const ch = this.buffer[++i]; - if (ch === "+") - this.blockScalarKeep = true; - else if (ch > "0" && ch <= "9") - this.blockScalarIndent = Number(ch) - 1; - else if (ch !== "-") - break; - } - return yield* this.pushUntil((ch) => isEmpty(ch) || ch === "#"); + /** Call at end of input to push out any remaining constructions */ + *end() { + while (this.stack.length > 0) + yield* this.pop(); } - *parseBlockScalar() { - let nl = this.pos - 1; - let indent = 0; - let ch; - loop: for (let i2 = this.pos; ch = this.buffer[i2]; ++i2) { - switch (ch) { - case " ": - indent += 1; - break; - case "\n": - nl = i2; - indent = 0; - break; - case "\r": { - const next = this.buffer[i2 + 1]; - if (!next && !this.atEnd) - return this.setNext("block-scalar"); - if (next === "\n") - break; - } - // fallthrough - default: - break loop; - } + get sourceToken() { + const st2 = { + type: this.type, + offset: this.offset, + indent: this.indent, + source: this.source + }; + return st2; + } + *step() { + const top = this.peek(1); + if (this.type === "doc-end" && (!top || top.type !== "doc-end")) { + while (this.stack.length > 0) + yield* this.pop(); + this.stack.push({ + type: "doc-end", + offset: this.offset, + source: this.source + }); + return; } - if (!ch && !this.atEnd) - return this.setNext("block-scalar"); - if (indent >= this.indentNext) { - if (this.blockScalarIndent === -1) - this.indentNext = indent; - else { - this.indentNext = this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext); + if (!top) + return yield* this.stream(); + switch (top.type) { + case "document": + return yield* this.document(top); + case "alias": + case "scalar": + case "single-quoted-scalar": + case "double-quoted-scalar": + return yield* this.scalar(top); + case "block-scalar": + return yield* this.blockScalar(top); + case "block-map": + return yield* this.blockMap(top); + case "block-seq": + return yield* this.blockSequence(top); + case "flow-collection": + return yield* this.flowCollection(top); + case "doc-end": + return yield* this.documentEnd(top); + } + yield* this.pop(); + } + peek(n3) { + return this.stack[this.stack.length - n3]; + } + *pop(error) { + const token = error ?? this.stack.pop(); + if (!token) { + const message = "Tried to pop an empty stack"; + yield { type: "error", offset: this.offset, source: "", message }; + } else if (this.stack.length === 0) { + yield token; + } else { + const top = this.peek(1); + if (token.type === "block-scalar") { + token.indent = "indent" in top ? top.indent : 0; + } else if (token.type === "flow-collection" && top.type === "document") { + token.indent = 0; } - do { - const cs = this.continueScalar(nl + 1); - if (cs === -1) + if (token.type === "flow-collection") + fixFlowSeqItems(token); + switch (top.type) { + case "document": + top.value = token; break; - nl = this.buffer.indexOf("\n", cs); - } while (nl !== -1); - if (nl === -1) { - if (!this.atEnd) - return this.setNext("block-scalar"); - nl = this.buffer.length; - } - } - let i = nl + 1; - ch = this.buffer[i]; - while (ch === " ") - ch = this.buffer[++i]; - if (ch === " ") { - while (ch === " " || ch === " " || ch === "\r" || ch === "\n") - ch = this.buffer[++i]; - nl = i - 1; - } else if (!this.blockScalarKeep) { - do { - let i2 = nl - 1; - let ch2 = this.buffer[i2]; - if (ch2 === "\r") - ch2 = this.buffer[--i2]; - const lastChar = i2; - while (ch2 === " ") - ch2 = this.buffer[--i2]; - if (ch2 === "\n" && i2 >= this.pos && i2 + 1 + indent > lastChar) - nl = i2; - else + case "block-scalar": + top.props.push(token); break; - } while (true); - } - yield cst.SCALAR; - yield* this.pushToIndex(nl + 1, true); - return yield* this.parseLineStart(); - } - *parsePlainScalar() { - const inFlow = this.flowLevel > 0; - let end = this.pos - 1; - let i = this.pos - 1; - let ch; - while (ch = this.buffer[++i]) { - if (ch === ":") { - const next = this.buffer[i + 1]; - if (isEmpty(next) || inFlow && flowIndicatorChars.has(next)) + case "block-map": { + const it2 = top.items[top.items.length - 1]; + if (it2.value) { + top.items.push({ start: [], key: token, sep: [] }); + this.onKeyLine = true; + return; + } else if (it2.sep) { + it2.value = token; + } else { + Object.assign(it2, { key: token, sep: [] }); + this.onKeyLine = !it2.explicitKey; + return; + } break; - end = i; - } else if (isEmpty(ch)) { - let next = this.buffer[i + 1]; - if (ch === "\r") { - if (next === "\n") { - i += 1; - ch = "\n"; - next = this.buffer[i + 1]; - } else - end = i; } - if (next === "#" || inFlow && flowIndicatorChars.has(next)) + case "block-seq": { + const it2 = top.items[top.items.length - 1]; + if (it2.value) + top.items.push({ start: [], value: token }); + else + it2.value = token; break; - if (ch === "\n") { - const cs = this.continueScalar(i + 1); - if (cs === -1) - break; - i = Math.max(i, cs - 2); } - } else { - if (inFlow && flowIndicatorChars.has(ch)) - break; - end = i; + case "flow-collection": { + const it2 = top.items[top.items.length - 1]; + if (!it2 || it2.value) + top.items.push({ start: [], key: token, sep: [] }); + else if (it2.sep) + it2.value = token; + else + Object.assign(it2, { key: token, sep: [] }); + return; + } + default: + yield* this.pop(); + yield* this.pop(token); + } + if ((top.type === "document" || top.type === "block-map" || top.type === "block-seq") && (token.type === "block-map" || token.type === "block-seq")) { + const last = token.items[token.items.length - 1]; + if (last && !last.sep && !last.value && last.start.length > 0 && findNonEmptyIndex(last.start) === -1 && (token.indent === 0 || last.start.every((st2) => st2.type !== "comment" || st2.indent < token.indent))) { + if (top.type === "document") + top.end = last.start; + else + top.items.push({ start: last.start }); + token.items.splice(-1, 1); + } } } - if (!ch && !this.atEnd) - return this.setNext("plain-scalar"); - yield cst.SCALAR; - yield* this.pushToIndex(end + 1, true); - return inFlow ? "flow" : "doc"; - } - *pushCount(n) { - if (n > 0) { - yield this.buffer.substr(this.pos, n); - this.pos += n; - return n; - } - return 0; - } - *pushToIndex(i, allowEmpty) { - const s = this.buffer.slice(this.pos, i); - if (s) { - yield s; - this.pos += s.length; - return s.length; - } else if (allowEmpty) - yield ""; - return 0; } - *pushIndicators() { - switch (this.charAt(0)) { - case "!": - return (yield* this.pushTag()) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators()); - case "&": - return (yield* this.pushUntil(isNotAnchorChar)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators()); - case "-": - // this is an error - case "?": - // this is an error outside flow collections - case ":": { - const inFlow = this.flowLevel > 0; - const ch1 = this.charAt(1); - if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) { - if (!inFlow) - this.indentNext = this.indentValue + 1; - else if (this.flowKey) - this.flowKey = false; - return (yield* this.pushCount(1)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators()); - } + *stream() { + switch (this.type) { + case "directive-line": + yield { type: "directive", offset: this.offset, source: this.source }; + return; + case "byte-order-mark": + case "space": + case "comment": + case "newline": + yield this.sourceToken; + return; + case "doc-mode": + case "doc-start": { + const doc = { + type: "document", + offset: this.offset, + start: [] + }; + if (this.type === "doc-start") + doc.start.push(this.sourceToken); + this.stack.push(doc); + return; } } - return 0; + yield { + type: "error", + offset: this.offset, + message: `Unexpected ${this.type} token in YAML stream`, + source: this.source + }; } - *pushTag() { - if (this.charAt(1) === "<") { - let i = this.pos + 2; - let ch = this.buffer[i]; - while (!isEmpty(ch) && ch !== ">") - ch = this.buffer[++i]; - return yield* this.pushToIndex(ch === ">" ? i + 1 : i, false); - } else { - let i = this.pos + 1; - let ch = this.buffer[i]; - while (ch) { - if (tagChars.has(ch)) - ch = this.buffer[++i]; - else if (ch === "%" && hexDigits.has(this.buffer[i + 1]) && hexDigits.has(this.buffer[i + 2])) { - ch = this.buffer[i += 3]; + *document(doc) { + if (doc.value) + return yield* this.lineEnd(doc); + switch (this.type) { + case "doc-start": { + if (findNonEmptyIndex(doc.start) !== -1) { + yield* this.pop(); + yield* this.step(); } else - break; + doc.start.push(this.sourceToken); + return; } - return yield* this.pushToIndex(i, false); + case "anchor": + case "tag": + case "space": + case "comment": + case "newline": + doc.start.push(this.sourceToken); + return; } - } - *pushNewline() { - const ch = this.buffer[this.pos]; - if (ch === "\n") - return yield* this.pushCount(1); - else if (ch === "\r" && this.charAt(1) === "\n") - return yield* this.pushCount(2); - else - return 0; - } - *pushSpaces(allowTabs) { - let i = this.pos - 1; - let ch; - do { - ch = this.buffer[++i]; - } while (ch === " " || allowTabs && ch === " "); - const n = i - this.pos; - if (n > 0) { - yield this.buffer.substr(this.pos, n); - this.pos = i; + const bv = this.startBlockValue(doc); + if (bv) + this.stack.push(bv); + else { + yield { + type: "error", + offset: this.offset, + message: `Unexpected ${this.type} token in YAML document`, + source: this.source + }; } - return n; - } - *pushUntil(test) { - let i = this.pos; - let ch = this.buffer[i]; - while (!test(ch)) - ch = this.buffer[++i]; - return yield* this.pushToIndex(i, false); } - }; - exports.Lexer = Lexer; - } -}); - -// -var require_line_counter = __commonJS({ - ""(exports) { - "use strict"; - var LineCounter = class { - constructor() { - this.lineStarts = []; - this.addNewLine = (offset) => this.lineStarts.push(offset); - this.linePos = (offset) => { - let low = 0; - let high = this.lineStarts.length; - while (low < high) { - const mid = low + high >> 1; - if (this.lineStarts[mid] < offset) - low = mid + 1; - else - high = mid; - } - if (this.lineStarts[low] === offset) - return { line: low + 1, col: 1 }; - if (low === 0) - return { line: 0, col: offset }; - const start = this.lineStarts[low - 1]; - return { line: low, col: offset - start + 1 }; - }; + *scalar(scalar) { + if (this.type === "map-value-ind") { + const prev = getPrevProps(this.peek(2)); + const start = getFirstKeyStartProps(prev); + let sep2; + if (scalar.end) { + sep2 = scalar.end; + sep2.push(this.sourceToken); + delete scalar.end; + } else + sep2 = [this.sourceToken]; + const map = { + type: "block-map", + offset: scalar.offset, + indent: scalar.indent, + items: [{ start, key: scalar, sep: sep2 }] + }; + this.onKeyLine = true; + this.stack[this.stack.length - 1] = map; + } else + yield* this.lineEnd(scalar); } - }; - exports.LineCounter = LineCounter; - } -}); - -// -var require_parser = __commonJS({ - ""(exports) { - "use strict"; - var node_process = __require("process"); - var cst = require_cst(); - var lexer = require_lexer(); - function includesToken(list, type) { - for (let i = 0; i < list.length; ++i) - if (list[i].type === type) - return true; - return false; - } - function findNonEmptyIndex(list) { - for (let i = 0; i < list.length; ++i) { - switch (list[i].type) { + *blockScalar(scalar) { + switch (this.type) { case "space": case "comment": case "newline": + scalar.props.push(this.sourceToken); + return; + case "scalar": + scalar.source = this.source; + this.atNewLine = true; + this.indent = 0; + if (this.onNewLine) { + let nl = this.source.indexOf("\n") + 1; + while (nl !== 0) { + this.onNewLine(this.offset + nl); + nl = this.source.indexOf("\n", nl) + 1; + } + } + yield* this.pop(); break; default: - return i; + yield* this.pop(); + yield* this.step(); } } - return -1; - } - function isFlowToken(token) { - switch (token?.type) { - case "alias": - case "scalar": - case "single-quoted-scalar": - case "double-quoted-scalar": - case "flow-collection": - return true; - default: - return false; - } - } - function getPrevProps(parent) { - switch (parent.type) { - case "document": - return parent.start; - case "block-map": { - const it = parent.items[parent.items.length - 1]; - return it.sep ?? it.start; + *blockMap(map) { + const it2 = map.items[map.items.length - 1]; + switch (this.type) { + case "newline": + this.onKeyLine = false; + if (it2.value) { + const end = "end" in it2.value ? it2.value.end : void 0; + const last = Array.isArray(end) ? end[end.length - 1] : void 0; + if (last?.type === "comment") + end?.push(this.sourceToken); + else + map.items.push({ start: [this.sourceToken] }); + } else if (it2.sep) { + it2.sep.push(this.sourceToken); + } else { + it2.start.push(this.sourceToken); + } + return; + case "space": + case "comment": + if (it2.value) { + map.items.push({ start: [this.sourceToken] }); + } else if (it2.sep) { + it2.sep.push(this.sourceToken); + } else { + if (this.atIndentedComment(it2.start, map.indent)) { + const prev = map.items[map.items.length - 2]; + const end = prev?.value?.end; + if (Array.isArray(end)) { + Array.prototype.push.apply(end, it2.start); + end.push(this.sourceToken); + map.items.pop(); + return; + } + } + it2.start.push(this.sourceToken); + } + return; + } + if (this.indent >= map.indent) { + const atMapIndent = !this.onKeyLine && this.indent === map.indent; + const atNextItem = atMapIndent && (it2.sep || it2.explicitKey) && this.type !== "seq-item-ind"; + let start = []; + if (atNextItem && it2.sep && !it2.value) { + const nl = []; + for (let i6 = 0; i6 < it2.sep.length; ++i6) { + const st2 = it2.sep[i6]; + switch (st2.type) { + case "newline": + nl.push(i6); + break; + case "space": + break; + case "comment": + if (st2.indent > map.indent) + nl.length = 0; + break; + default: + nl.length = 0; + } + } + if (nl.length >= 2) + start = it2.sep.splice(nl[1]); + } + switch (this.type) { + case "anchor": + case "tag": + if (atNextItem || it2.value) { + start.push(this.sourceToken); + map.items.push({ start }); + this.onKeyLine = true; + } else if (it2.sep) { + it2.sep.push(this.sourceToken); + } else { + it2.start.push(this.sourceToken); + } + return; + case "explicit-key-ind": + if (!it2.sep && !it2.explicitKey) { + it2.start.push(this.sourceToken); + it2.explicitKey = true; + } else if (atNextItem || it2.value) { + start.push(this.sourceToken); + map.items.push({ start, explicitKey: true }); + } else { + this.stack.push({ + type: "block-map", + offset: this.offset, + indent: this.indent, + items: [{ start: [this.sourceToken], explicitKey: true }] + }); + } + this.onKeyLine = true; + return; + case "map-value-ind": + if (it2.explicitKey) { + if (!it2.sep) { + if (includesToken(it2.start, "newline")) { + Object.assign(it2, { key: null, sep: [this.sourceToken] }); + } else { + const start2 = getFirstKeyStartProps(it2.start); + this.stack.push({ + type: "block-map", + offset: this.offset, + indent: this.indent, + items: [{ start: start2, key: null, sep: [this.sourceToken] }] + }); + } + } else if (it2.value) { + map.items.push({ start: [], key: null, sep: [this.sourceToken] }); + } else if (includesToken(it2.sep, "map-value-ind")) { + this.stack.push({ + type: "block-map", + offset: this.offset, + indent: this.indent, + items: [{ start, key: null, sep: [this.sourceToken] }] + }); + } else if (isFlowToken(it2.key) && !includesToken(it2.sep, "newline")) { + const start2 = getFirstKeyStartProps(it2.start); + const key = it2.key; + const sep2 = it2.sep; + sep2.push(this.sourceToken); + delete it2.key; + delete it2.sep; + this.stack.push({ + type: "block-map", + offset: this.offset, + indent: this.indent, + items: [{ start: start2, key, sep: sep2 }] + }); + } else if (start.length > 0) { + it2.sep = it2.sep.concat(start, this.sourceToken); + } else { + it2.sep.push(this.sourceToken); + } + } else { + if (!it2.sep) { + Object.assign(it2, { key: null, sep: [this.sourceToken] }); + } else if (it2.value || atNextItem) { + map.items.push({ start, key: null, sep: [this.sourceToken] }); + } else if (includesToken(it2.sep, "map-value-ind")) { + this.stack.push({ + type: "block-map", + offset: this.offset, + indent: this.indent, + items: [{ start: [], key: null, sep: [this.sourceToken] }] + }); + } else { + it2.sep.push(this.sourceToken); + } + } + this.onKeyLine = true; + return; + case "alias": + case "scalar": + case "single-quoted-scalar": + case "double-quoted-scalar": { + const fs = this.flowScalar(this.type); + if (atNextItem || it2.value) { + map.items.push({ start, key: fs, sep: [] }); + this.onKeyLine = true; + } else if (it2.sep) { + this.stack.push(fs); + } else { + Object.assign(it2, { key: fs, sep: [] }); + this.onKeyLine = true; + } + return; + } + default: { + const bv = this.startBlockValue(map); + if (bv) { + if (bv.type === "block-seq") { + if (!it2.explicitKey && it2.sep && !includesToken(it2.sep, "newline")) { + yield* this.pop({ + type: "error", + offset: this.offset, + message: "Unexpected block-seq-ind on same line with key", + source: this.source + }); + return; + } + } else if (atMapIndent) { + map.items.push({ start }); + } + this.stack.push(bv); + return; + } + } + } } - case "block-seq": - return parent.items[parent.items.length - 1].start; - /* istanbul ignore next should not happen */ - default: - return []; + yield* this.pop(); + yield* this.step(); } - } - function getFirstKeyStartProps(prev) { - if (prev.length === 0) - return []; - let i = prev.length; - loop: while (--i >= 0) { - switch (prev[i].type) { - case "doc-start": - case "explicit-key-ind": - case "map-value-ind": - case "seq-item-ind": + *blockSequence(seq) { + const it2 = seq.items[seq.items.length - 1]; + switch (this.type) { case "newline": - break loop; - } - } - while (prev[++i]?.type === "space") { - } - return prev.splice(i, prev.length); - } - function fixFlowSeqItems(fc) { - if (fc.start.type === "flow-seq-start") { - for (const it of fc.items) { - if (it.sep && !it.value && !includesToken(it.start, "explicit-key-ind") && !includesToken(it.sep, "map-value-ind")) { - if (it.key) - it.value = it.key; - delete it.key; - if (isFlowToken(it.value)) { - if (it.value.end) - Array.prototype.push.apply(it.value.end, it.sep); + if (it2.value) { + const end = "end" in it2.value ? it2.value.end : void 0; + const last = Array.isArray(end) ? end[end.length - 1] : void 0; + if (last?.type === "comment") + end?.push(this.sourceToken); else - it.value.end = it.sep; + seq.items.push({ start: [this.sourceToken] }); } else - Array.prototype.push.apply(it.start, it.sep); - delete it.sep; + it2.start.push(this.sourceToken); + return; + case "space": + case "comment": + if (it2.value) + seq.items.push({ start: [this.sourceToken] }); + else { + if (this.atIndentedComment(it2.start, seq.indent)) { + const prev = seq.items[seq.items.length - 2]; + const end = prev?.value?.end; + if (Array.isArray(end)) { + Array.prototype.push.apply(end, it2.start); + end.push(this.sourceToken); + seq.items.pop(); + return; + } + } + it2.start.push(this.sourceToken); + } + return; + case "anchor": + case "tag": + if (it2.value || this.indent <= seq.indent) + break; + it2.start.push(this.sourceToken); + return; + case "seq-item-ind": + if (this.indent !== seq.indent) + break; + if (it2.value || includesToken(it2.start, "seq-item-ind")) + seq.items.push({ start: [this.sourceToken] }); + else + it2.start.push(this.sourceToken); + return; + } + if (this.indent > seq.indent) { + const bv = this.startBlockValue(seq); + if (bv) { + this.stack.push(bv); + return; } } + yield* this.pop(); + yield* this.step(); } - } - var Parser = class { - /** - * @param onNewLine - If defined, called separately with the start position of - * each new line (in `parse()`, including the start of input). - */ - constructor(onNewLine) { - this.atNewLine = true; - this.atScalar = false; - this.indent = 0; - this.offset = 0; - this.onKeyLine = false; - this.stack = []; - this.source = ""; - this.type = ""; - this.lexer = new lexer.Lexer(); - this.onNewLine = onNewLine; - } - /** - * Parse `source` as a YAML stream. - * If `incomplete`, a part of the last line may be left as a buffer for the next call. - * - * Errors are not thrown, but yielded as `{ type: 'error', message }` tokens. - * - * @returns A generator of tokens representing each directive, document, and other structure. - */ - *parse(source, incomplete = false) { - if (this.onNewLine && this.offset === 0) - this.onNewLine(0); - for (const lexeme of this.lexer.lex(source, incomplete)) - yield* this.next(lexeme); - if (!incomplete) - yield* this.end(); - } - /** - * Advance the parser by the `source` of one lexical token. - */ - *next(source) { - this.source = source; - if (node_process.env.LOG_TOKENS) - console.log("|", cst.prettyToken(source)); - if (this.atScalar) { - this.atScalar = false; - yield* this.step(); - this.offset += source.length; - return; - } - const type = cst.tokenType(source); - if (!type) { - const message = `Not a YAML token: ${source}`; - yield* this.pop({ type: "error", offset: this.offset, message, source }); - this.offset += source.length; - } else if (type === "scalar") { - this.atNewLine = false; - this.atScalar = true; - this.type = "scalar"; - } else { - this.type = type; - yield* this.step(); - switch (type) { - case "newline": - this.atNewLine = true; - this.indent = 0; - if (this.onNewLine) - this.onNewLine(this.offset + source.length); - break; - case "space": - if (this.atNewLine && source[0] === " ") - this.indent += source.length; - break; + *flowCollection(fc) { + const it2 = fc.items[fc.items.length - 1]; + if (this.type === "flow-error-end") { + let top; + do { + yield* this.pop(); + top = this.peek(1); + } while (top && top.type === "flow-collection"); + } else if (fc.end.length === 0) { + switch (this.type) { + case "comma": case "explicit-key-ind": + if (!it2 || it2.sep) + fc.items.push({ start: [this.sourceToken] }); + else + it2.start.push(this.sourceToken); + return; case "map-value-ind": - case "seq-item-ind": - if (this.atNewLine) - this.indent += source.length; - break; - case "doc-mode": - case "flow-error-end": + if (!it2 || it2.value) + fc.items.push({ start: [], key: null, sep: [this.sourceToken] }); + else if (it2.sep) + it2.sep.push(this.sourceToken); + else + Object.assign(it2, { key: null, sep: [this.sourceToken] }); + return; + case "space": + case "comment": + case "newline": + case "anchor": + case "tag": + if (!it2 || it2.value) + fc.items.push({ start: [this.sourceToken] }); + else if (it2.sep) + it2.sep.push(this.sourceToken); + else + it2.start.push(this.sourceToken); + return; + case "alias": + case "scalar": + case "single-quoted-scalar": + case "double-quoted-scalar": { + const fs = this.flowScalar(this.type); + if (!it2 || it2.value) + fc.items.push({ start: [], key: fs, sep: [] }); + else if (it2.sep) + this.stack.push(fs); + else + Object.assign(it2, { key: fs, sep: [] }); + return; + } + case "flow-map-end": + case "flow-seq-end": + fc.end.push(this.sourceToken); return; - default: - this.atNewLine = false; } - this.offset += source.length; + const bv = this.startBlockValue(fc); + if (bv) + this.stack.push(bv); + else { + yield* this.pop(); + yield* this.step(); + } + } else { + const parent = this.peek(2); + if (parent.type === "block-map" && (this.type === "map-value-ind" && parent.indent === fc.indent || this.type === "newline" && !parent.items[parent.items.length - 1].sep)) { + yield* this.pop(); + yield* this.step(); + } else if (this.type === "map-value-ind" && parent.type !== "flow-collection") { + const prev = getPrevProps(parent); + const start = getFirstKeyStartProps(prev); + fixFlowSeqItems(fc); + const sep2 = fc.end.splice(1, fc.end.length); + sep2.push(this.sourceToken); + const map = { + type: "block-map", + offset: fc.offset, + indent: fc.indent, + items: [{ start, key: fc, sep: sep2 }] + }; + this.onKeyLine = true; + this.stack[this.stack.length - 1] = map; + } else { + yield* this.lineEnd(fc); + } } } - /** Call at end of input to push out any remaining constructions */ - *end() { - while (this.stack.length > 0) - yield* this.pop(); - } - get sourceToken() { - const st = { - type: this.type, + flowScalar(type) { + if (this.onNewLine) { + let nl = this.source.indexOf("\n") + 1; + while (nl !== 0) { + this.onNewLine(this.offset + nl); + nl = this.source.indexOf("\n", nl) + 1; + } + } + return { + type, offset: this.offset, indent: this.indent, source: this.source }; - return st; } - *step() { - const top = this.peek(1); - if (this.type === "doc-end" && (!top || top.type !== "doc-end")) { - while (this.stack.length > 0) - yield* this.pop(); - this.stack.push({ - type: "doc-end", - offset: this.offset, - source: this.source - }); - return; - } - if (!top) - return yield* this.stream(); - switch (top.type) { - case "document": - return yield* this.document(top); + startBlockValue(parent) { + switch (this.type) { case "alias": case "scalar": case "single-quoted-scalar": case "double-quoted-scalar": - return yield* this.scalar(top); - case "block-scalar": - return yield* this.blockScalar(top); - case "block-map": - return yield* this.blockMap(top); - case "block-seq": - return yield* this.blockSequence(top); - case "flow-collection": - return yield* this.flowCollection(top); - case "doc-end": - return yield* this.documentEnd(top); + return this.flowScalar(this.type); + case "block-scalar-header": + return { + type: "block-scalar", + offset: this.offset, + indent: this.indent, + props: [this.sourceToken], + source: "" + }; + case "flow-map-start": + case "flow-seq-start": + return { + type: "flow-collection", + offset: this.offset, + indent: this.indent, + start: this.sourceToken, + items: [], + end: [] + }; + case "seq-item-ind": + return { + type: "block-seq", + offset: this.offset, + indent: this.indent, + items: [{ start: [this.sourceToken] }] + }; + case "explicit-key-ind": { + this.onKeyLine = true; + const prev = getPrevProps(parent); + const start = getFirstKeyStartProps(prev); + start.push(this.sourceToken); + return { + type: "block-map", + offset: this.offset, + indent: this.indent, + items: [{ start, explicitKey: true }] + }; + } + case "map-value-ind": { + this.onKeyLine = true; + const prev = getPrevProps(parent); + const start = getFirstKeyStartProps(prev); + return { + type: "block-map", + offset: this.offset, + indent: this.indent, + items: [{ start, key: null, sep: [this.sourceToken] }] + }; + } } - yield* this.pop(); + return null; } - peek(n) { - return this.stack[this.stack.length - n]; + atIndentedComment(start, indent) { + if (this.type !== "comment") + return false; + if (this.indent <= indent) + return false; + return start.every((st2) => st2.type === "newline" || st2.type === "space"); } - *pop(error) { - const token = error ?? this.stack.pop(); - if (!token) { - const message = "Tried to pop an empty stack"; - yield { type: "error", offset: this.offset, source: "", message }; - } else if (this.stack.length === 0) { - yield token; - } else { - const top = this.peek(1); - if (token.type === "block-scalar") { - token.indent = "indent" in top ? top.indent : 0; - } else if (token.type === "flow-collection" && top.type === "document") { - token.indent = 0; - } - if (token.type === "flow-collection") - fixFlowSeqItems(token); - switch (top.type) { - case "document": - top.value = token; - break; - case "block-scalar": - top.props.push(token); - break; - case "block-map": { - const it = top.items[top.items.length - 1]; - if (it.value) { - top.items.push({ start: [], key: token, sep: [] }); - this.onKeyLine = true; - return; - } else if (it.sep) { - it.value = token; - } else { - Object.assign(it, { key: token, sep: [] }); - this.onKeyLine = !it.explicitKey; - return; - } - break; - } - case "block-seq": { - const it = top.items[top.items.length - 1]; - if (it.value) - top.items.push({ start: [], value: token }); - else - it.value = token; - break; - } - case "flow-collection": { - const it = top.items[top.items.length - 1]; - if (!it || it.value) - top.items.push({ start: [], key: token, sep: [] }); - else if (it.sep) - it.value = token; - else - Object.assign(it, { key: token, sep: [] }); - return; - } - /* istanbul ignore next should not happen */ - default: + *documentEnd(docEnd) { + if (this.type !== "doc-mode") { + if (docEnd.end) + docEnd.end.push(this.sourceToken); + else + docEnd.end = [this.sourceToken]; + if (this.type === "newline") + yield* this.pop(); + } + } + *lineEnd(token) { + switch (this.type) { + case "comma": + case "doc-start": + case "doc-end": + case "flow-seq-end": + case "flow-map-end": + case "map-value-ind": + yield* this.pop(); + yield* this.step(); + break; + case "newline": + this.onKeyLine = false; + case "space": + case "comment": + default: + if (token.end) + token.end.push(this.sourceToken); + else + token.end = [this.sourceToken]; + if (this.type === "newline") yield* this.pop(); - yield* this.pop(token); - } - if ((top.type === "document" || top.type === "block-map" || top.type === "block-seq") && (token.type === "block-map" || token.type === "block-seq")) { - const last = token.items[token.items.length - 1]; - if (last && !last.sep && !last.value && last.start.length > 0 && findNonEmptyIndex(last.start) === -1 && (token.indent === 0 || last.start.every((st) => st.type !== "comment" || st.indent < token.indent))) { - if (top.type === "document") - top.end = last.start; - else - top.items.push({ start: last.start }); - token.items.splice(-1, 1); - } - } } } - *stream() { - switch (this.type) { - case "directive-line": - yield { type: "directive", offset: this.offset, source: this.source }; - return; - case "byte-order-mark": - case "space": - case "comment": - case "newline": - yield this.sourceToken; - return; - case "doc-mode": - case "doc-start": { - const doc = { - type: "document", - offset: this.offset, - start: [] - }; - if (this.type === "doc-start") - doc.start.push(this.sourceToken); - this.stack.push(doc); - return; - } - } - yield { - type: "error", - offset: this.offset, - message: `Unexpected ${this.type} token in YAML stream`, - source: this.source - }; + }; + exports.Parser = Parser; + } +}); + +// +var require_public_api = __commonJS({ + ""(exports) { + "use strict"; + var composer = require_composer(); + var Document = require_Document(); + var errors = require_errors(); + var log = require_log(); + var identity = require_identity(); + var lineCounter = require_line_counter(); + var parser = require_parser(); + function parseOptions(options) { + const prettyErrors = options.prettyErrors !== false; + const lineCounter$1 = options.lineCounter || prettyErrors && new lineCounter.LineCounter() || null; + return { lineCounter: lineCounter$1, prettyErrors }; + } + function parseAllDocuments(source, options = {}) { + const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options); + const parser$1 = new parser.Parser(lineCounter2?.addNewLine); + const composer$1 = new composer.Composer(options); + const docs = Array.from(composer$1.compose(parser$1.parse(source))); + if (prettyErrors && lineCounter2) + for (const doc of docs) { + doc.errors.forEach(errors.prettifyError(source, lineCounter2)); + doc.warnings.forEach(errors.prettifyError(source, lineCounter2)); + } + if (docs.length > 0) + return docs; + return Object.assign([], { empty: true }, composer$1.streamInfo()); + } + function parseDocument(source, options = {}) { + const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options); + const parser$1 = new parser.Parser(lineCounter2?.addNewLine); + const composer$1 = new composer.Composer(options); + let doc = null; + for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) { + if (!doc) + doc = _doc; + else if (doc.options.logLevel !== "silent") { + doc.errors.push(new errors.YAMLParseError(_doc.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()")); + break; + } + } + if (prettyErrors && lineCounter2) { + doc.errors.forEach(errors.prettifyError(source, lineCounter2)); + doc.warnings.forEach(errors.prettifyError(source, lineCounter2)); + } + return doc; + } + function parse2(src, reviver, options) { + let _reviver = void 0; + if (typeof reviver === "function") { + _reviver = reviver; + } else if (options === void 0 && reviver && typeof reviver === "object") { + options = reviver; + } + const doc = parseDocument(src, options); + if (!doc) + return null; + doc.warnings.forEach((warning) => log.warn(doc.options.logLevel, warning)); + if (doc.errors.length > 0) { + if (doc.options.logLevel !== "silent") + throw doc.errors[0]; + else + doc.errors = []; + } + return doc.toJS(Object.assign({ reviver: _reviver }, options)); + } + function stringify(value, replacer, options) { + let _replacer = null; + if (typeof replacer === "function" || Array.isArray(replacer)) { + _replacer = replacer; + } else if (options === void 0 && replacer) { + options = replacer; + } + if (typeof options === "string") + options = options.length; + if (typeof options === "number") { + const indent = Math.round(options); + options = indent < 1 ? void 0 : indent > 8 ? { indent: 8 } : { indent }; } - *document(doc) { - if (doc.value) - return yield* this.lineEnd(doc); - switch (this.type) { - case "doc-start": { - if (findNonEmptyIndex(doc.start) !== -1) { - yield* this.pop(); - yield* this.step(); - } else - doc.start.push(this.sourceToken); - return; - } - case "anchor": - case "tag": - case "space": - case "comment": - case "newline": - doc.start.push(this.sourceToken); - return; + if (value === void 0) { + const { keepUndefined } = options ?? replacer ?? {}; + if (!keepUndefined) + return void 0; + } + if (identity.isDocument(value) && !_replacer) + return value.toString(options); + return new Document.Document(value, _replacer, options).toString(options); + } + exports.parse = parse2; + exports.parseAllDocuments = parseAllDocuments; + exports.parseDocument = parseDocument; + exports.stringify = stringify; + } +}); + +// +var require_dist2 = __commonJS({ + ""(exports) { + "use strict"; + var composer = require_composer(); + var Document = require_Document(); + var Schema = require_Schema(); + var errors = require_errors(); + var Alias = require_Alias(); + var identity = require_identity(); + var Pair = require_Pair(); + var Scalar = require_Scalar(); + var YAMLMap = require_YAMLMap(); + var YAMLSeq = require_YAMLSeq(); + var cst = require_cst(); + var lexer = require_lexer(); + var lineCounter = require_line_counter(); + var parser = require_parser(); + var publicApi = require_public_api(); + var visit = require_visit(); + exports.Composer = composer.Composer; + exports.Document = Document.Document; + exports.Schema = Schema.Schema; + exports.YAMLError = errors.YAMLError; + exports.YAMLParseError = errors.YAMLParseError; + exports.YAMLWarning = errors.YAMLWarning; + exports.Alias = Alias.Alias; + exports.isAlias = identity.isAlias; + exports.isCollection = identity.isCollection; + exports.isDocument = identity.isDocument; + exports.isMap = identity.isMap; + exports.isNode = identity.isNode; + exports.isPair = identity.isPair; + exports.isScalar = identity.isScalar; + exports.isSeq = identity.isSeq; + exports.Pair = Pair.Pair; + exports.Scalar = Scalar.Scalar; + exports.YAMLMap = YAMLMap.YAMLMap; + exports.YAMLSeq = YAMLSeq.YAMLSeq; + exports.CST = cst; + exports.Lexer = lexer.Lexer; + exports.LineCounter = lineCounter.LineCounter; + exports.Parser = parser.Parser; + exports.parse = publicApi.parse; + exports.parseAllDocuments = publicApi.parseAllDocuments; + exports.parseDocument = publicApi.parseDocument; + exports.stringify = publicApi.stringify; + exports.visit = visit.visit; + exports.visitAsync = visit.visitAsync; + } +}); + +// .github/actions/deploy-docs-site/lib/main.mts +var import_core3 = __toESM(require_core(), 1); +var import_github3 = __toESM(require_github(), 1); + +// .github/actions/deploy-docs-site/lib/deploy.mjs +import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises"; +import { join } from "node:path"; +import { tmpdir } from "node:os"; +import { spawnSync } from "node:child_process"; + +// .github/actions/deploy-docs-site/lib/credential.mjs +var import_tmp = __toESM(require_tmp(), 1); +var import_core = __toESM(require_core(), 1); +import { writeSync } from "node:fs"; +var credentialFilePath; +function getCredentialFilePath() { + if (credentialFilePath === void 0) { + const tmpFile = (0, import_tmp.fileSync)({ postfix: ".json" }); + writeSync(tmpFile.fd, (0, import_core.getInput)("serviceKey", { required: true })); + (0, import_core.setSecret)(tmpFile.name); + credentialFilePath = tmpFile.name; + } + return credentialFilePath; +} +var githubReleaseTrainReadToken = (0, import_core.getInput)("githubReleaseTrainReadToken", { + required: true +}); + +// .github/actions/deploy-docs-site/lib/deploy.mjs +async function deployToFirebase(deployment, configPath, stagingDir) { + if (deployment.destination == void 0) { + console.log(`No deployment necessary for docs created from: ${deployment.branch}`); + return; + } + console.log("Preparing for deployment to firebase..."); + const deployConfigPath = join(stagingDir, "firebase.json"); + const config = JSON.parse(await readFile(configPath, { encoding: "utf-8" })); + config["hosting"]["public"] = "./browser"; + await writeFile(deployConfigPath, JSON.stringify(config, null, 2)); + firebase(`target:clear --config ${deployConfigPath} --project angular-dev-site hosting angular-docs`, stagingDir); + firebase(`target:apply --config ${deployConfigPath} --project angular-dev-site hosting angular-docs ${deployment.destination}`, stagingDir); + firebase(`deploy --config ${deployConfigPath} --project angular-dev-site --only hosting --non-interactive`, stagingDir); + firebase(`target:clear --config ${deployConfigPath} --project angular-dev-site hosting angular-docs`, stagingDir); + await rm(stagingDir, { recursive: true }); +} +async function setupRedirect(deployment) { + if (deployment.redirect === void 0) { + console.log(`No redirect necessary for docs created from: ${deployment.branch}`); + return; + } + console.log("Preparing to set up redirect on firebase..."); + const redirectConfig = JSON.stringify({ + hosting: { + target: "angular-docs", + redirects: [ + { + type: 302, + regex: "^(.*)$", + destination: `${deployment.redirect.to}:1` } - const bv = this.startBlockValue(doc); - if (bv) - this.stack.push(bv); - else { - yield { - type: "error", - offset: this.offset, - message: `Unexpected ${this.type} token in YAML document`, - source: this.source - }; + ] + } + }, null, 2); + const tmpRedirectDir = await mkdtemp(join(tmpdir(), "redirect-directory")); + const redirectConfigPath = join(tmpRedirectDir, "firebase.json"); + await writeFile(redirectConfigPath, redirectConfig); + spawnSync(`chmod 777 -R ${tmpRedirectDir}`, { encoding: "utf-8", shell: true }); + firebase(`target:clear --config ${redirectConfigPath} --project angular-dev-site hosting angular-docs`, tmpRedirectDir); + firebase(`target:apply --config ${redirectConfigPath} --project angular-dev-site hosting angular-docs ${deployment.redirect.from}`, tmpRedirectDir); + firebase(`deploy --config ${redirectConfigPath} --project angular-dev-site --only hosting --non-interactive`, tmpRedirectDir); + firebase(`target:clear --config ${redirectConfigPath} --project angular-dev-site hosting angular-docs`, tmpRedirectDir); + await rm(tmpRedirectDir, { recursive: true }); +} +function firebase(cmd, cwd) { + const { status } = spawnSync("npx", `-y firebase-tools@13.15.1 ${cmd}`.split(" "), { + cwd, + encoding: "utf-8", + shell: true, + stdio: "inherit", + env: { + ...process.env, + GOOGLE_APPLICATION_CREDENTIALS: getCredentialFilePath() + } + }); + if (status !== 0) { + console.error("Firebase command failed, see log above for details."); + process.exit(status ?? void 0); + } +} + +// +var import_fast_glob = __toESM(require_out4()); +import { join as join2 } from "path"; + +// +import m5 from "node:module"; +import { MessageChannel as u3 } from "node:worker_threads"; + +// +import { createRequire as o2 } from "module"; +import a from "node:path"; + +// +import r from "node:path"; +import o from "node:os"; +var { geteuid: t } = process; +var s = t ? t() : o.userInfo().username; +var e = r.join(o.tmpdir(), `tsx-${s}`); + +// +var p = Object.defineProperty; +var e2 = (t3, r3) => p(t3, "name", { value: r3, configurable: true }); +var m = o2(import.meta.url); +var i = process.platform === "win32"; +var n = e2((t3) => { + const r3 = a.join(e, `${t3}.pipe`); + return i ? `\\\\?\\pipe\\${r3}` : r3; +}, "getPipePath"); + +// +import d3 from "node:module"; +import p4 from "node:path"; +import { fileURLToPath as O3 } from "node:url"; + +// +import m3 from "node:path"; +import le from "node:fs"; +import Fe from "node:module"; + +// +var A = (r3) => r3 !== null && typeof r3 == "object"; +var a2 = (r3, t3) => Object.assign(new Error(`[${r3}]: ${t3}`), { code: r3 }); +var _ = "ERR_INVALID_PACKAGE_CONFIG"; +var E = "ERR_INVALID_PACKAGE_TARGET"; +var I = "ERR_PACKAGE_PATH_NOT_EXPORTED"; +var R = /^\d+$/; +var O = /^(\.{1,2}|node_modules)$/i; +var w = /\/|\\/; +var h = ((r3) => (r3.Export = "exports", r3.Import = "imports", r3))(h || {}); +var f = (r3, t3, e5, o8, c3) => { + if (t3 == null) + return []; + if (typeof t3 == "string") { + const [n3, ...i6] = t3.split(w); + if (n3 === ".." || i6.some((l3) => O.test(l3))) + throw a2(E, `Invalid "${r3}" target "${t3}" defined in the package config`); + return [c3 ? t3.replace(/\*/g, c3) : t3]; + } + if (Array.isArray(t3)) + return t3.flatMap((n3) => f(r3, n3, e5, o8, c3)); + if (A(t3)) { + for (const n3 of Object.keys(t3)) { + if (R.test(n3)) + throw a2(_, "Cannot contain numeric property keys"); + if (n3 === "default" || o8.includes(n3)) + return f(r3, t3[n3], e5, o8, c3); + } + return []; + } + throw a2(E, `Invalid "${r3}" target "${t3}"`); +}; +var s2 = "*"; +var m2 = (r3, t3) => { + const e5 = r3.indexOf(s2), o8 = t3.indexOf(s2); + return e5 === o8 ? t3.length > r3.length : o8 > e5; +}; +function d(r3, t3) { + if (!t3.includes(s2) && r3.hasOwnProperty(t3)) + return [t3]; + let e5, o8; + for (const c3 of Object.keys(r3)) + if (c3.includes(s2)) { + const [n3, i6, l3] = c3.split(s2); + if (l3 === void 0 && t3.startsWith(n3) && t3.endsWith(i6)) { + const g2 = t3.slice(n3.length, -i6.length || void 0); + g2 && (!e5 || m2(e5, c3)) && (e5 = c3, o8 = g2); + } + } + return [e5, o8]; +} +var p2 = (r3) => Object.keys(r3).reduce((t3, e5) => { + const o8 = e5 === "" || e5[0] !== "."; + if (t3 === void 0 || t3 === o8) + return o8; + throw a2(_, '"exports" cannot contain some keys starting with "." and some not'); +}, void 0); +var u = /^\w+:/; +var v = (r3, t3, e5) => { + if (!r3) + throw new Error('"exports" is required'); + t3 = t3 === "" ? "." : `./${t3}`, (typeof r3 == "string" || Array.isArray(r3) || A(r3) && p2(r3)) && (r3 = { ".": r3 }); + const [o8, c3] = d(r3, t3), n3 = f(h.Export, r3[o8], t3, e5, c3); + if (n3.length === 0) + throw a2(I, t3 === "." ? 'No "exports" main defined' : `Package subpath '${t3}' is not defined by "exports"`); + for (const i6 of n3) + if (!i6.startsWith("./") && !u.test(i6)) + throw a2(E, `Invalid "exports" target "${i6}" defined in the package config`); + return n3; +}; + +// +import he from "fs"; +import Ee from "os"; +import Be from "path"; +var je = Object.defineProperty; +var o3 = (e5, t3) => je(e5, "name", { value: t3, configurable: true }); +function E2(e5) { + return e5.startsWith("\\\\?\\") ? e5 : e5.replace(/\\/g, "/"); +} +o3(E2, "slash"); +var z = o3((e5) => { + const t3 = le[e5]; + return (s5, ...n3) => { + const l3 = `${e5}:${n3.join(":")}`; + let i6 = s5 == null ? void 0 : s5.get(l3); + return i6 === void 0 && (i6 = Reflect.apply(t3, le, n3), s5 == null || s5.set(l3, i6)), i6; + }; +}, "cacheFs"); +var B = z("existsSync"); +var Le = z("readFileSync"); +var P = z("statSync"); +var ie = o3((e5, t3, s5) => { + for (; ; ) { + const n3 = m3.posix.join(e5, t3); + if (B(s5, n3)) + return n3; + const l3 = m3.dirname(e5); + if (l3 === e5) + return; + e5 = l3; + } +}, "findUp"); +var G = /^\.{1,2}(\/.*)?$/; +var Q = o3((e5) => { + const t3 = E2(e5); + return G.test(t3) ? t3 : `./${t3}`; +}, "normalizeRelativePath"); +function $e(e5, t3 = false) { + const s5 = e5.length; + let n3 = 0, l3 = "", i6 = 0, r3 = 16, f6 = 0, u5 = 0, g2 = 0, w4 = 0, b3 = 0; + function _4(c3, y3) { + let D3 = 0, T3 = 0; + for (; D3 < c3; ) { + let p5 = e5.charCodeAt(n3); + if (p5 >= 48 && p5 <= 57) + T3 = T3 * 16 + p5 - 48; + else if (p5 >= 65 && p5 <= 70) + T3 = T3 * 16 + p5 - 65 + 10; + else if (p5 >= 97 && p5 <= 102) + T3 = T3 * 16 + p5 - 97 + 10; + else + break; + n3++, D3++; + } + return D3 < c3 && (T3 = -1), T3; + } + o3(_4, "scanHexDigits"); + function d5(c3) { + n3 = c3, l3 = "", i6 = 0, r3 = 16, b3 = 0; + } + o3(d5, "setPosition"); + function j2() { + let c3 = n3; + if (e5.charCodeAt(n3) === 48) + n3++; + else + for (n3++; n3 < e5.length && I2(e5.charCodeAt(n3)); ) + n3++; + if (n3 < e5.length && e5.charCodeAt(n3) === 46) + if (n3++, n3 < e5.length && I2(e5.charCodeAt(n3))) + for (n3++; n3 < e5.length && I2(e5.charCodeAt(n3)); ) + n3++; + else + return b3 = 3, e5.substring(c3, n3); + let y3 = n3; + if (n3 < e5.length && (e5.charCodeAt(n3) === 69 || e5.charCodeAt(n3) === 101)) + if (n3++, (n3 < e5.length && e5.charCodeAt(n3) === 43 || e5.charCodeAt(n3) === 45) && n3++, n3 < e5.length && I2(e5.charCodeAt(n3))) { + for (n3++; n3 < e5.length && I2(e5.charCodeAt(n3)); ) + n3++; + y3 = n3; + } else + b3 = 3; + return e5.substring(c3, y3); + } + o3(j2, "scanNumber"); + function v4() { + let c3 = "", y3 = n3; + for (; ; ) { + if (n3 >= s5) { + c3 += e5.substring(y3, n3), b3 = 2; + break; + } + const D3 = e5.charCodeAt(n3); + if (D3 === 34) { + c3 += e5.substring(y3, n3), n3++; + break; + } + if (D3 === 92) { + if (c3 += e5.substring(y3, n3), n3++, n3 >= s5) { + b3 = 2; + break; + } + switch (e5.charCodeAt(n3++)) { + case 34: + c3 += '"'; + break; + case 92: + c3 += "\\"; + break; + case 47: + c3 += "/"; + break; + case 98: + c3 += "\b"; + break; + case 102: + c3 += "\f"; + break; + case 110: + c3 += ` +`; + break; + case 114: + c3 += "\r"; + break; + case 116: + c3 += " "; + break; + case 117: + const p5 = _4(4); + p5 >= 0 ? c3 += String.fromCharCode(p5) : b3 = 4; + break; + default: + b3 = 5; } + y3 = n3; + continue; } - *scalar(scalar) { - if (this.type === "map-value-ind") { - const prev = getPrevProps(this.peek(2)); - const start = getFirstKeyStartProps(prev); - let sep2; - if (scalar.end) { - sep2 = scalar.end; - sep2.push(this.sourceToken); - delete scalar.end; - } else - sep2 = [this.sourceToken]; - const map = { - type: "block-map", - offset: scalar.offset, - indent: scalar.indent, - items: [{ start, key: scalar, sep: sep2 }] - }; - this.onKeyLine = true; - this.stack[this.stack.length - 1] = map; + if (D3 >= 0 && D3 <= 31) + if (x(D3)) { + c3 += e5.substring(y3, n3), b3 = 2; + break; } else - yield* this.lineEnd(scalar); - } - *blockScalar(scalar) { - switch (this.type) { - case "space": - case "comment": - case "newline": - scalar.props.push(this.sourceToken); - return; - case "scalar": - scalar.source = this.source; - this.atNewLine = true; - this.indent = 0; - if (this.onNewLine) { - let nl = this.source.indexOf("\n") + 1; - while (nl !== 0) { - this.onNewLine(this.offset + nl); - nl = this.source.indexOf("\n", nl) + 1; - } + b3 = 6; + n3++; + } + return c3; + } + o3(v4, "scanString"); + function A3() { + if (l3 = "", b3 = 0, i6 = n3, u5 = f6, w4 = g2, n3 >= s5) + return i6 = s5, r3 = 17; + let c3 = e5.charCodeAt(n3); + if (H(c3)) { + do + n3++, l3 += String.fromCharCode(c3), c3 = e5.charCodeAt(n3); + while (H(c3)); + return r3 = 15; + } + if (x(c3)) + return n3++, l3 += String.fromCharCode(c3), c3 === 13 && e5.charCodeAt(n3) === 10 && (n3++, l3 += ` +`), f6++, g2 = n3, r3 = 14; + switch (c3) { + case 123: + return n3++, r3 = 1; + case 125: + return n3++, r3 = 2; + case 91: + return n3++, r3 = 3; + case 93: + return n3++, r3 = 4; + case 58: + return n3++, r3 = 6; + case 44: + return n3++, r3 = 5; + case 34: + return n3++, l3 = v4(), r3 = 10; + case 47: + const y3 = n3 - 1; + if (e5.charCodeAt(n3 + 1) === 47) { + for (n3 += 2; n3 < s5 && !x(e5.charCodeAt(n3)); ) + n3++; + return l3 = e5.substring(y3, n3), r3 = 12; + } + if (e5.charCodeAt(n3 + 1) === 42) { + n3 += 2; + const D3 = s5 - 1; + let T3 = false; + for (; n3 < D3; ) { + const p5 = e5.charCodeAt(n3); + if (p5 === 42 && e5.charCodeAt(n3 + 1) === 47) { + n3 += 2, T3 = true; + break; } - yield* this.pop(); - break; - /* istanbul ignore next should not happen */ - default: - yield* this.pop(); - yield* this.step(); + n3++, x(p5) && (p5 === 13 && e5.charCodeAt(n3) === 10 && n3++, f6++, g2 = n3); + } + return T3 || (n3++, b3 = 1), l3 = e5.substring(y3, n3), r3 = 13; + } + return l3 += String.fromCharCode(c3), n3++, r3 = 16; + case 45: + if (l3 += String.fromCharCode(c3), n3++, n3 === s5 || !I2(e5.charCodeAt(n3))) + return r3 = 16; + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + return l3 += j2(), r3 = 11; + default: + for (; n3 < s5 && h3(c3); ) + n3++, c3 = e5.charCodeAt(n3); + if (i6 !== n3) { + switch (l3 = e5.substring(i6, n3), l3) { + case "true": + return r3 = 8; + case "false": + return r3 = 9; + case "null": + return r3 = 7; + } + return r3 = 16; + } + return l3 += String.fromCharCode(c3), n3++, r3 = 16; + } + } + o3(A3, "scanNext"); + function h3(c3) { + if (H(c3) || x(c3)) + return false; + switch (c3) { + case 125: + case 93: + case 123: + case 91: + case 34: + case 58: + case 44: + case 47: + return false; + } + return true; + } + o3(h3, "isUnknownContentCharacter"); + function L3() { + let c3; + do + c3 = A3(); + while (c3 >= 12 && c3 <= 15); + return c3; + } + return o3(L3, "scanNextNonTrivia"), { setPosition: d5, getPosition: o3(() => n3, "getPosition"), scan: t3 ? L3 : A3, getToken: o3(() => r3, "getToken"), getTokenValue: o3(() => l3, "getTokenValue"), getTokenOffset: o3(() => i6, "getTokenOffset"), getTokenLength: o3(() => n3 - i6, "getTokenLength"), getTokenStartLine: o3(() => u5, "getTokenStartLine"), getTokenStartCharacter: o3(() => i6 - w4, "getTokenStartCharacter"), getTokenError: o3(() => b3, "getTokenError") }; +} +o3($e, "createScanner"); +function H(e5) { + return e5 === 32 || e5 === 9; +} +o3(H, "isWhiteSpace"); +function x(e5) { + return e5 === 10 || e5 === 13; +} +o3(x, "isLineBreak"); +function I2(e5) { + return e5 >= 48 && e5 <= 57; +} +o3(I2, "isDigit"); +var oe; +(function(e5) { + e5[e5.lineFeed = 10] = "lineFeed", e5[e5.carriageReturn = 13] = "carriageReturn", e5[e5.space = 32] = "space", e5[e5._0 = 48] = "_0", e5[e5._1 = 49] = "_1", e5[e5._2 = 50] = "_2", e5[e5._3 = 51] = "_3", e5[e5._4 = 52] = "_4", e5[e5._5 = 53] = "_5", e5[e5._6 = 54] = "_6", e5[e5._7 = 55] = "_7", e5[e5._8 = 56] = "_8", e5[e5._9 = 57] = "_9", e5[e5.a = 97] = "a", e5[e5.b = 98] = "b", e5[e5.c = 99] = "c", e5[e5.d = 100] = "d", e5[e5.e = 101] = "e", e5[e5.f = 102] = "f", e5[e5.g = 103] = "g", e5[e5.h = 104] = "h", e5[e5.i = 105] = "i", e5[e5.j = 106] = "j", e5[e5.k = 107] = "k", e5[e5.l = 108] = "l", e5[e5.m = 109] = "m", e5[e5.n = 110] = "n", e5[e5.o = 111] = "o", e5[e5.p = 112] = "p", e5[e5.q = 113] = "q", e5[e5.r = 114] = "r", e5[e5.s = 115] = "s", e5[e5.t = 116] = "t", e5[e5.u = 117] = "u", e5[e5.v = 118] = "v", e5[e5.w = 119] = "w", e5[e5.x = 120] = "x", e5[e5.y = 121] = "y", e5[e5.z = 122] = "z", e5[e5.A = 65] = "A", e5[e5.B = 66] = "B", e5[e5.C = 67] = "C", e5[e5.D = 68] = "D", e5[e5.E = 69] = "E", e5[e5.F = 70] = "F", e5[e5.G = 71] = "G", e5[e5.H = 72] = "H", e5[e5.I = 73] = "I", e5[e5.J = 74] = "J", e5[e5.K = 75] = "K", e5[e5.L = 76] = "L", e5[e5.M = 77] = "M", e5[e5.N = 78] = "N", e5[e5.O = 79] = "O", e5[e5.P = 80] = "P", e5[e5.Q = 81] = "Q", e5[e5.R = 82] = "R", e5[e5.S = 83] = "S", e5[e5.T = 84] = "T", e5[e5.U = 85] = "U", e5[e5.V = 86] = "V", e5[e5.W = 87] = "W", e5[e5.X = 88] = "X", e5[e5.Y = 89] = "Y", e5[e5.Z = 90] = "Z", e5[e5.asterisk = 42] = "asterisk", e5[e5.backslash = 92] = "backslash", e5[e5.closeBrace = 125] = "closeBrace", e5[e5.closeBracket = 93] = "closeBracket", e5[e5.colon = 58] = "colon", e5[e5.comma = 44] = "comma", e5[e5.dot = 46] = "dot", e5[e5.doubleQuote = 34] = "doubleQuote", e5[e5.minus = 45] = "minus", e5[e5.openBrace = 123] = "openBrace", e5[e5.openBracket = 91] = "openBracket", e5[e5.plus = 43] = "plus", e5[e5.slash = 47] = "slash", e5[e5.formFeed = 12] = "formFeed", e5[e5.tab = 9] = "tab"; +})(oe || (oe = {})), new Array(20).fill(0).map((e5, t3) => " ".repeat(t3)); +var U = 200; +new Array(U).fill(0).map((e5, t3) => ` +` + " ".repeat(t3)), new Array(U).fill(0).map((e5, t3) => "\r" + " ".repeat(t3)), new Array(U).fill(0).map((e5, t3) => `\r +` + " ".repeat(t3)), new Array(U).fill(0).map((e5, t3) => ` +` + " ".repeat(t3)), new Array(U).fill(0).map((e5, t3) => "\r" + " ".repeat(t3)), new Array(U).fill(0).map((e5, t3) => `\r +` + " ".repeat(t3)); +var R2; +(function(e5) { + e5.DEFAULT = { allowTrailingComma: false }; +})(R2 || (R2 = {})); +function Ie(e5, t3 = [], s5 = R2.DEFAULT) { + let n3 = null, l3 = []; + const i6 = []; + function r3(u5) { + Array.isArray(l3) ? l3.push(u5) : n3 !== null && (l3[n3] = u5); + } + return o3(r3, "onValue"), Ue(e5, { onObjectBegin: o3(() => { + const u5 = {}; + r3(u5), i6.push(l3), l3 = u5, n3 = null; + }, "onObjectBegin"), onObjectProperty: o3((u5) => { + n3 = u5; + }, "onObjectProperty"), onObjectEnd: o3(() => { + l3 = i6.pop(); + }, "onObjectEnd"), onArrayBegin: o3(() => { + const u5 = []; + r3(u5), i6.push(l3), l3 = u5, n3 = null; + }, "onArrayBegin"), onArrayEnd: o3(() => { + l3 = i6.pop(); + }, "onArrayEnd"), onLiteralValue: r3, onError: o3((u5, g2, w4) => { + t3.push({ error: u5, offset: g2, length: w4 }); + }, "onError") }, s5), l3[0]; +} +o3(Ie, "parse$1"); +function Ue(e5, t3, s5 = R2.DEFAULT) { + const n3 = $e(e5, false), l3 = []; + let i6 = 0; + function r3(k3) { + return k3 ? () => i6 === 0 && k3(n3.getTokenOffset(), n3.getTokenLength(), n3.getTokenStartLine(), n3.getTokenStartCharacter()) : () => true; + } + o3(r3, "toNoArgVisit"); + function f6(k3) { + return k3 ? (F4) => i6 === 0 && k3(F4, n3.getTokenOffset(), n3.getTokenLength(), n3.getTokenStartLine(), n3.getTokenStartCharacter()) : () => true; + } + o3(f6, "toOneArgVisit"); + function u5(k3) { + return k3 ? (F4) => i6 === 0 && k3(F4, n3.getTokenOffset(), n3.getTokenLength(), n3.getTokenStartLine(), n3.getTokenStartCharacter(), () => l3.slice()) : () => true; + } + o3(u5, "toOneArgVisitWithPath"); + function g2(k3) { + return k3 ? () => { + i6 > 0 ? i6++ : k3(n3.getTokenOffset(), n3.getTokenLength(), n3.getTokenStartLine(), n3.getTokenStartCharacter(), () => l3.slice()) === false && (i6 = 1); + } : () => true; + } + o3(g2, "toBeginVisit"); + function w4(k3) { + return k3 ? () => { + i6 > 0 && i6--, i6 === 0 && k3(n3.getTokenOffset(), n3.getTokenLength(), n3.getTokenStartLine(), n3.getTokenStartCharacter()); + } : () => true; + } + o3(w4, "toEndVisit"); + const b3 = g2(t3.onObjectBegin), _4 = u5(t3.onObjectProperty), d5 = w4(t3.onObjectEnd), j2 = g2(t3.onArrayBegin), v4 = w4(t3.onArrayEnd), A3 = u5(t3.onLiteralValue), h3 = f6(t3.onSeparator), L3 = r3(t3.onComment), c3 = f6(t3.onError), y3 = s5 && s5.disallowComments, D3 = s5 && s5.allowTrailingComma; + function T3() { + for (; ; ) { + const k3 = n3.scan(); + switch (n3.getTokenError()) { + case 4: + p5(14); + break; + case 5: + p5(15); + break; + case 3: + p5(13); + break; + case 1: + y3 || p5(11); + break; + case 2: + p5(12); + break; + case 6: + p5(16); + break; + } + switch (k3) { + case 12: + case 13: + y3 ? p5(10) : L3(); + break; + case 16: + p5(1); + break; + case 15: + case 14: + break; + default: + return k3; + } + } + } + o3(T3, "scanNext"); + function p5(k3, F4 = [], se3 = []) { + if (c3(k3), F4.length + se3.length > 0) { + let N2 = n3.getToken(); + for (; N2 !== 17; ) { + if (F4.indexOf(N2) !== -1) { + T3(); + break; + } else if (se3.indexOf(N2) !== -1) + break; + N2 = T3(); + } + } + } + o3(p5, "handleError"); + function a7(k3) { + const F4 = n3.getTokenValue(); + return k3 ? A3(F4) : (_4(F4), l3.push(F4)), T3(), true; + } + o3(a7, "parseString"); + function S2() { + switch (n3.getToken()) { + case 11: + const k3 = n3.getTokenValue(); + let F4 = Number(k3); + isNaN(F4) && (p5(2), F4 = 0), A3(F4); + break; + case 7: + A3(null); + break; + case 8: + A3(true); + break; + case 9: + A3(false); + break; + default: + return false; + } + return T3(), true; + } + o3(S2, "parseLiteral"); + function Ae2() { + return n3.getToken() !== 10 ? (p5(3, [], [2, 5]), false) : (a7(false), n3.getToken() === 6 ? (h3(":"), T3(), O4() || p5(4, [], [2, 5])) : p5(5, [], [2, 5]), l3.pop(), true); + } + o3(Ae2, "parseProperty"); + function ye3() { + b3(), T3(); + let k3 = false; + for (; n3.getToken() !== 2 && n3.getToken() !== 17; ) { + if (n3.getToken() === 5) { + if (k3 || p5(4, [], []), h3(","), T3(), n3.getToken() === 2 && D3) + break; + } else + k3 && p5(6, [], []); + Ae2() || p5(4, [], [2, 5]), k3 = true; + } + return d5(), n3.getToken() !== 2 ? p5(7, [2], []) : T3(), true; + } + o3(ye3, "parseObject"); + function _e3() { + j2(), T3(); + let k3 = true, F4 = false; + for (; n3.getToken() !== 4 && n3.getToken() !== 17; ) { + if (n3.getToken() === 5) { + if (F4 || p5(4, [], []), h3(","), T3(), n3.getToken() === 4 && D3) + break; + } else + F4 && p5(6, [], []); + k3 ? (l3.push(0), k3 = false) : l3[l3.length - 1]++, O4() || p5(4, [], [4, 5]), F4 = true; + } + return v4(), k3 || l3.pop(), n3.getToken() !== 4 ? p5(8, [4], []) : T3(), true; + } + o3(_e3, "parseArray"); + function O4() { + switch (n3.getToken()) { + case 3: + return _e3(); + case 1: + return ye3(); + case 10: + return a7(true); + default: + return S2(); + } + } + return o3(O4, "parseValue"), T3(), n3.getToken() === 17 ? s5.allowEmptyContent ? true : (p5(4, [], []), false) : O4() ? (n3.getToken() !== 17 && p5(9, [], []), true) : (p5(4, [], []), false); +} +o3(Ue, "visit"); +var re; +(function(e5) { + e5[e5.None = 0] = "None", e5[e5.UnexpectedEndOfComment = 1] = "UnexpectedEndOfComment", e5[e5.UnexpectedEndOfString = 2] = "UnexpectedEndOfString", e5[e5.UnexpectedEndOfNumber = 3] = "UnexpectedEndOfNumber", e5[e5.InvalidUnicode = 4] = "InvalidUnicode", e5[e5.InvalidEscapeCharacter = 5] = "InvalidEscapeCharacter", e5[e5.InvalidCharacter = 6] = "InvalidCharacter"; +})(re || (re = {})); +var ue; +(function(e5) { + e5[e5.OpenBraceToken = 1] = "OpenBraceToken", e5[e5.CloseBraceToken = 2] = "CloseBraceToken", e5[e5.OpenBracketToken = 3] = "OpenBracketToken", e5[e5.CloseBracketToken = 4] = "CloseBracketToken", e5[e5.CommaToken = 5] = "CommaToken", e5[e5.ColonToken = 6] = "ColonToken", e5[e5.NullKeyword = 7] = "NullKeyword", e5[e5.TrueKeyword = 8] = "TrueKeyword", e5[e5.FalseKeyword = 9] = "FalseKeyword", e5[e5.StringLiteral = 10] = "StringLiteral", e5[e5.NumericLiteral = 11] = "NumericLiteral", e5[e5.LineCommentTrivia = 12] = "LineCommentTrivia", e5[e5.BlockCommentTrivia = 13] = "BlockCommentTrivia", e5[e5.LineBreakTrivia = 14] = "LineBreakTrivia", e5[e5.Trivia = 15] = "Trivia", e5[e5.Unknown = 16] = "Unknown", e5[e5.EOF = 17] = "EOF"; +})(ue || (ue = {})); +var xe = Ie; +var fe; +(function(e5) { + e5[e5.InvalidSymbol = 1] = "InvalidSymbol", e5[e5.InvalidNumberFormat = 2] = "InvalidNumberFormat", e5[e5.PropertyNameExpected = 3] = "PropertyNameExpected", e5[e5.ValueExpected = 4] = "ValueExpected", e5[e5.ColonExpected = 5] = "ColonExpected", e5[e5.CommaExpected = 6] = "CommaExpected", e5[e5.CloseBraceExpected = 7] = "CloseBraceExpected", e5[e5.CloseBracketExpected = 8] = "CloseBracketExpected", e5[e5.EndOfFileExpected = 9] = "EndOfFileExpected", e5[e5.InvalidCommentToken = 10] = "InvalidCommentToken", e5[e5.UnexpectedEndOfComment = 11] = "UnexpectedEndOfComment", e5[e5.UnexpectedEndOfString = 12] = "UnexpectedEndOfString", e5[e5.UnexpectedEndOfNumber = 13] = "UnexpectedEndOfNumber", e5[e5.InvalidUnicode = 14] = "InvalidUnicode", e5[e5.InvalidEscapeCharacter = 15] = "InvalidEscapeCharacter", e5[e5.InvalidCharacter = 16] = "InvalidCharacter"; +})(fe || (fe = {})); +var ce = o3((e5, t3) => xe(Le(t3, e5, "utf8")), "readJsonc"); +var X = Symbol("implicitBaseUrl"); +var $ = "${configDir}"; +var Se = o3(() => { + const { findPnpApi: e5 } = Fe; + return e5 && e5(process.cwd()); +}, "getPnpApi"); +var Y = o3((e5, t3, s5, n3) => { + const l3 = `resolveFromPackageJsonPath:${e5}:${t3}:${s5}`; + if (n3 != null && n3.has(l3)) + return n3.get(l3); + const i6 = ce(e5, n3); + if (!i6) + return; + let r3 = t3 || "tsconfig.json"; + if (!s5 && i6.exports) + try { + const [f6] = v(i6.exports, t3, ["require", "types"]); + r3 = f6; + } catch { + return false; + } + else + !t3 && i6.tsconfig && (r3 = i6.tsconfig); + return r3 = m3.join(e5, "..", r3), n3 == null || n3.set(l3, r3), r3; +}, "resolveFromPackageJsonPath"); +var Z = "package.json"; +var q = "tsconfig.json"; +var Ne = o3((e5, t3, s5) => { + let n3 = e5; + if (e5 === ".." && (n3 = m3.join(n3, q)), e5[0] === "." && (n3 = m3.resolve(t3, n3)), m3.isAbsolute(n3)) { + if (B(s5, n3)) { + if (P(s5, n3).isFile()) + return n3; + } else if (!n3.endsWith(".json")) { + const d5 = `${n3}.json`; + if (B(s5, d5)) + return d5; + } + return; + } + const [l3, ...i6] = e5.split("/"), r3 = l3[0] === "@" ? `${l3}/${i6.shift()}` : l3, f6 = i6.join("/"), u5 = Se(); + if (u5) { + const { resolveRequest: d5 } = u5; + try { + if (r3 === e5) { + const j2 = d5(m3.join(r3, Z), t3); + if (j2) { + const v4 = Y(j2, f6, false, s5); + if (v4 && B(s5, v4)) + return v4; + } + } else { + let j2; + try { + j2 = d5(e5, t3, { extensions: [".json"] }); + } catch { + j2 = d5(m3.join(e5, q), t3); } + if (j2) + return j2; } - *blockMap(map) { - const it = map.items[map.items.length - 1]; - switch (this.type) { - case "newline": - this.onKeyLine = false; - if (it.value) { - const end = "end" in it.value ? it.value.end : void 0; - const last = Array.isArray(end) ? end[end.length - 1] : void 0; - if (last?.type === "comment") - end?.push(this.sourceToken); - else - map.items.push({ start: [this.sourceToken] }); - } else if (it.sep) { - it.sep.push(this.sourceToken); - } else { - it.start.push(this.sourceToken); - } - return; - case "space": - case "comment": - if (it.value) { - map.items.push({ start: [this.sourceToken] }); - } else if (it.sep) { - it.sep.push(this.sourceToken); - } else { - if (this.atIndentedComment(it.start, map.indent)) { - const prev = map.items[map.items.length - 2]; - const end = prev?.value?.end; - if (Array.isArray(end)) { - Array.prototype.push.apply(end, it.start); - end.push(this.sourceToken); - map.items.pop(); - return; - } - } - it.start.push(this.sourceToken); - } - return; + } catch { + } + } + const g2 = ie(m3.resolve(t3), m3.join("node_modules", r3), s5); + if (!g2 || !P(s5, g2).isDirectory()) + return; + const w4 = m3.join(g2, Z); + if (B(s5, w4)) { + const d5 = Y(w4, f6, false, s5); + if (d5 === false) + return; + if (d5 && B(s5, d5) && P(s5, d5).isFile()) + return d5; + } + const b3 = m3.join(g2, f6), _4 = b3.endsWith(".json"); + if (!_4) { + const d5 = `${b3}.json`; + if (B(s5, d5)) + return d5; + } + if (B(s5, b3)) { + if (P(s5, b3).isDirectory()) { + const d5 = m3.join(b3, Z); + if (B(s5, d5)) { + const v4 = Y(d5, "", true, s5); + if (v4 && B(s5, v4)) + return v4; + } + const j2 = m3.join(b3, q); + if (B(s5, j2)) + return j2; + } else if (_4) + return b3; + } +}, "resolveExtendsPath"); +var K = o3((e5, t3) => Q(m3.relative(e5, t3)), "pathRelative"); +var ae = ["files", "include", "exclude"]; +var ge = o3((e5, t3, s5) => { + const n3 = m3.join(t3, s5), l3 = m3.relative(e5, n3); + return E2(l3) || "./"; +}, "resolveAndRelativize"); +var Pe = o3((e5, t3, s5) => { + const n3 = m3.relative(e5, t3); + if (!n3) + return s5; + const l3 = s5.startsWith("./") ? s5.slice(2) : s5; + return E2(`${n3}/${l3}`); +}, "prefixPattern"); +var Re = o3((e5, t3, s5, n3) => { + const l3 = Ne(e5, t3, n3); + if (!l3) + throw new Error(`File '${e5}' not found.`); + if (s5.has(l3)) + throw new Error(`Circularity detected while resolving configuration: ${l3}`); + s5.add(l3); + const i6 = m3.dirname(l3), r3 = pe(l3, n3, s5); + delete r3.references; + const { compilerOptions: f6 } = r3; + if (f6) { + const { baseUrl: u5 } = f6; + u5 && !u5.startsWith($) && (f6.baseUrl = ge(t3, i6, u5)); + const { outDir: g2 } = f6; + g2 && !g2.startsWith($) && (f6.outDir = ge(t3, i6, g2)); + } + for (const u5 of ae) { + const g2 = r3[u5]; + g2 && (r3[u5] = g2.map((w4) => w4.startsWith($) ? w4 : Pe(t3, i6, w4))); + } + return r3; +}, "resolveExtends"); +var We = ["outDir", "declarationDir"]; +var pe = o3((e5, t3, s5 = /* @__PURE__ */ new Set()) => { + let n3; + try { + n3 = ce(e5, t3) || {}; + } catch { + throw new Error(`Cannot resolve tsconfig at path: ${e5}`); + } + if (typeof n3 != "object") + throw new SyntaxError(`Failed to parse tsconfig at: ${e5}`); + const l3 = m3.dirname(e5); + if (n3.compilerOptions) { + const { compilerOptions: i6 } = n3; + i6.paths && !i6.baseUrl && (i6[X] = l3); + } + if (n3.extends) { + const i6 = Array.isArray(n3.extends) ? n3.extends : [n3.extends]; + delete n3.extends; + for (const r3 of i6.reverse()) { + const f6 = Re(r3, l3, new Set(s5), t3), u5 = { ...f6, ...n3, compilerOptions: { ...f6.compilerOptions, ...n3.compilerOptions } }; + f6.watchOptions && (u5.watchOptions = { ...f6.watchOptions, ...n3.watchOptions }), n3 = u5; + } + } + if (n3.compilerOptions) { + const { compilerOptions: i6 } = n3, r3 = ["baseUrl", "rootDir"]; + for (const f6 of r3) { + const u5 = i6[f6]; + if (u5 && !u5.startsWith($)) { + const g2 = m3.resolve(l3, u5), w4 = K(l3, g2); + i6[f6] = w4; + } + } + for (const f6 of We) { + let u5 = i6[f6]; + u5 && (Array.isArray(n3.exclude) || (n3.exclude = []), n3.exclude.includes(u5) || n3.exclude.push(u5), u5.startsWith($) || (u5 = Q(u5)), i6[f6] = u5); + } + } else + n3.compilerOptions = {}; + if (n3.include ? (n3.include = n3.include.map(E2), n3.files && delete n3.files) : n3.files && (n3.files = n3.files.map((i6) => i6.startsWith($) ? i6 : Q(i6))), n3.watchOptions) { + const { watchOptions: i6 } = n3; + i6.excludeDirectories && (i6.excludeDirectories = i6.excludeDirectories.map((r3) => E2(m3.resolve(l3, r3)))); + } + return n3; +}, "_parseTsconfig"); +var W = o3((e5, t3) => { + if (e5.startsWith($)) + return E2(m3.join(t3, e5.slice($.length))); +}, "interpolateConfigDir"); +var Ve = ["outDir", "declarationDir", "outFile", "rootDir", "baseUrl", "tsBuildInfoFile"]; +var Me = o3((e5) => { + var t3, s5, n3, l3, i6, r3, f6, u5, g2, w4, b3, _4, d5, j2, v4, A3, h3, L3, c3, y3, D3, T3, p5; + if (e5.strict) { + const a7 = ["noImplicitAny", "noImplicitThis", "strictNullChecks", "strictFunctionTypes", "strictBindCallApply", "strictPropertyInitialization", "strictBuiltinIteratorReturn", "alwaysStrict", "useUnknownInCatchVariables"]; + for (const S2 of a7) + e5[S2] === void 0 && (e5[S2] = true); + } + if (e5.target) { + let a7 = e5.target.toLowerCase(); + a7 === "es2015" && (a7 = "es6"), e5.target = a7, a7 === "esnext" && ((t3 = e5.module) != null || (e5.module = "es6"), (s5 = e5.useDefineForClassFields) != null || (e5.useDefineForClassFields = true)), (a7 === "es6" || a7 === "es2016" || a7 === "es2017" || a7 === "es2018" || a7 === "es2019" || a7 === "es2020" || a7 === "es2021" || a7 === "es2022" || a7 === "es2023" || a7 === "es2024") && ((n3 = e5.module) != null || (e5.module = "es6")), (a7 === "es2022" || a7 === "es2023" || a7 === "es2024") && ((l3 = e5.useDefineForClassFields) != null || (e5.useDefineForClassFields = true)); + } + if (e5.module) { + let a7 = e5.module.toLowerCase(); + a7 === "es2015" && (a7 = "es6"), e5.module = a7, (a7 === "es6" || a7 === "es2020" || a7 === "es2022" || a7 === "esnext" || a7 === "none" || a7 === "system" || a7 === "umd" || a7 === "amd") && ((i6 = e5.moduleResolution) != null || (e5.moduleResolution = "classic")), a7 === "system" && ((r3 = e5.allowSyntheticDefaultImports) != null || (e5.allowSyntheticDefaultImports = true)), (a7 === "node16" || a7 === "nodenext" || a7 === "preserve") && ((f6 = e5.esModuleInterop) != null || (e5.esModuleInterop = true), (u5 = e5.allowSyntheticDefaultImports) != null || (e5.allowSyntheticDefaultImports = true)), (a7 === "node16" || a7 === "nodenext") && ((g2 = e5.moduleDetection) != null || (e5.moduleDetection = "force"), (w4 = e5.useDefineForClassFields) != null || (e5.useDefineForClassFields = true)), a7 === "node16" && ((b3 = e5.target) != null || (e5.target = "es2022"), (_4 = e5.moduleResolution) != null || (e5.moduleResolution = "node16")), a7 === "nodenext" && ((d5 = e5.target) != null || (e5.target = "esnext"), (j2 = e5.moduleResolution) != null || (e5.moduleResolution = "nodenext")), a7 === "preserve" && ((v4 = e5.moduleResolution) != null || (e5.moduleResolution = "bundler")); + } + if (e5.moduleResolution) { + let a7 = e5.moduleResolution.toLowerCase(); + a7 === "node" && (a7 = "node10"), e5.moduleResolution = a7, (a7 === "node16" || a7 === "nodenext" || a7 === "bundler") && ((A3 = e5.resolvePackageJsonExports) != null || (e5.resolvePackageJsonExports = true), (h3 = e5.resolvePackageJsonImports) != null || (e5.resolvePackageJsonImports = true)), a7 === "bundler" && ((L3 = e5.allowSyntheticDefaultImports) != null || (e5.allowSyntheticDefaultImports = true), (c3 = e5.resolveJsonModule) != null || (e5.resolveJsonModule = true)); + } + e5.esModuleInterop && ((y3 = e5.allowSyntheticDefaultImports) != null || (e5.allowSyntheticDefaultImports = true)), e5.verbatimModuleSyntax && ((D3 = e5.isolatedModules) != null || (e5.isolatedModules = true), (T3 = e5.preserveConstEnums) != null || (e5.preserveConstEnums = true)), e5.isolatedModules && ((p5 = e5.preserveConstEnums) != null || (e5.preserveConstEnums = true)); +}, "normalizeCompilerOptions"); +var me = o3((e5, t3 = /* @__PURE__ */ new Map()) => { + const s5 = m3.resolve(e5), n3 = pe(s5, t3), l3 = m3.dirname(s5), { compilerOptions: i6 } = n3; + if (i6) { + for (const f6 of Ve) { + const u5 = i6[f6]; + if (u5) { + const g2 = W(u5, l3); + i6[f6] = g2 ? K(l3, g2) : u5; + } + } + for (const f6 of ["rootDirs", "typeRoots"]) { + const u5 = i6[f6]; + u5 && (i6[f6] = u5.map((g2) => { + const w4 = W(g2, l3); + return w4 ? K(l3, w4) : g2; + })); + } + const { paths: r3 } = i6; + if (r3) + for (const f6 of Object.keys(r3)) + r3[f6] = r3[f6].map((u5) => { + var g2; + return (g2 = W(u5, l3)) != null ? g2 : u5; + }); + Me(i6); + } + for (const r3 of ae) { + const f6 = n3[r3]; + f6 && (n3[r3] = f6.map((u5) => { + var g2; + return (g2 = W(u5, l3)) != null ? g2 : u5; + })); + } + return n3; +}, "parseTsconfig"); +var Je = o3((e5 = process.cwd(), t3 = "tsconfig.json", s5 = /* @__PURE__ */ new Map()) => { + const n3 = ie(E2(e5), t3, s5); + if (!n3) + return null; + const l3 = me(n3, s5); + return { path: n3, config: l3 }; +}, "getTsconfig"); +var Oe = /\*/g; +var ke = o3((e5, t3) => { + const s5 = e5.match(Oe); + if (s5 && s5.length > 1) + throw new Error(t3); +}, "assertStarCount"); +var ze = o3((e5) => { + if (e5.includes("*")) { + const [t3, s5] = e5.split("*"); + return { prefix: t3, suffix: s5 }; + } + return e5; +}, "parsePattern"); +var Ge = o3(({ prefix: e5, suffix: t3 }, s5) => s5.startsWith(e5) && s5.endsWith(t3), "isPatternMatch"); +var Qe = o3((e5, t3, s5) => Object.entries(e5).map(([n3, l3]) => (ke(n3, `Pattern '${n3}' can have at most one '*' character.`), { pattern: ze(n3), substitutions: l3.map((i6) => { + if (ke(i6, `Substitution '${i6}' in pattern '${n3}' can have at most one '*' character.`), !t3 && !G.test(i6)) + throw new Error("Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?"); + return m3.resolve(s5, i6); +}) })), "parsePaths"); +var He = o3((e5) => { + const { compilerOptions: t3 } = e5.config; + if (!t3) + return null; + const { baseUrl: s5, paths: n3 } = t3; + if (!s5 && !n3) + return null; + const l3 = X in t3 && t3[X], i6 = m3.resolve(m3.dirname(e5.path), s5 || l3 || "."), r3 = n3 ? Qe(n3, s5, i6) : []; + return (f6) => { + if (G.test(f6)) + return []; + const u5 = []; + for (const _4 of r3) { + if (_4.pattern === f6) + return _4.substitutions.map(E2); + typeof _4.pattern != "string" && u5.push(_4); + } + let g2, w4 = -1; + for (const _4 of u5) + Ge(_4.pattern, f6) && _4.pattern.prefix.length > w4 && (w4 = _4.pattern.prefix.length, g2 = _4); + if (!g2) + return s5 ? [E2(m3.join(i6, f6))] : []; + const b3 = f6.slice(g2.pattern.prefix.length, f6.length - g2.pattern.suffix.length); + return g2.substitutions.map((_4) => E2(_4.replace("*", b3))); + }; +}, "createPathsMatcher"); +var Xe = Object.defineProperty; +var V = o3((e5, t3) => Xe(e5, "name", { value: t3, configurable: true }), "s"); +var we = V((e5) => { + let t3 = ""; + for (let s5 = 0; s5 < e5.length; s5 += 1) { + const n3 = e5[s5], l3 = n3.toUpperCase(); + t3 += n3 === l3 ? n3.toLowerCase() : l3; + } + return t3; +}, "invertCase"); +var C = /* @__PURE__ */ new Map(); +var be = V((e5, t3) => { + const s5 = Be.join(e5, `.is-fs-case-sensitive-test-${process.pid}`); + try { + return t3.writeFileSync(s5, ""), !t3.existsSync(we(s5)); + } finally { + try { + t3.unlinkSync(s5); + } catch { + } + } +}, "checkDirectoryCaseWithWrite"); +var Ye = V((e5, t3, s5) => { + try { + return be(e5, s5); + } catch (n3) { + if (t3 === void 0) + return be(Ee.tmpdir(), s5); + throw n3; + } +}, "checkDirectoryCaseWithFallback"); +var Ze = V((e5, t3 = he, s5 = true) => { + const n3 = e5 != null ? e5 : process.cwd(); + if (s5 && C.has(n3)) + return C.get(n3); + let l3; + const i6 = we(n3); + return i6 !== n3 && t3.existsSync(n3) ? l3 = !t3.existsSync(i6) : l3 = Ye(n3, e5, t3), s5 && C.set(n3, l3), l3; +}, "isFsCaseSensitive"); +var { join: M } = m3.posix; +var ee = { ts: [".ts", ".tsx", ".d.ts"], cts: [".cts", ".d.cts"], mts: [".mts", ".d.mts"] }; +var qe = o3((e5) => { + const t3 = [...ee.ts], s5 = [...ee.cts], n3 = [...ee.mts]; + return e5 != null && e5.allowJs && (t3.push(".js", ".jsx"), s5.push(".cjs"), n3.push(".mjs")), [...t3, ...s5, ...n3]; +}, "getSupportedExtensions"); +var Ke = o3((e5) => { + const t3 = []; + if (!e5) + return t3; + const { outDir: s5, declarationDir: n3 } = e5; + return s5 && t3.push(s5), n3 && t3.push(n3), t3; +}, "getDefaultExcludeSpec"); +var de = o3((e5) => e5.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`), "escapeForRegexp"); +var Ce = ["node_modules", "bower_components", "jspm_packages"]; +var ne = `(?!(${Ce.join("|")})(/|$))`; +var en = /(?:^|\/)[^.*?]+$/; +var ve = "**/*"; +var J = "[^/]"; +var te = "[^./]"; +var Te = process.platform === "win32"; +var nn = o3(({ config: e5, path: t3 }, s5 = Ze()) => { + if ("extends" in e5) + throw new Error("tsconfig#extends must be resolved. Use getTsconfig or parseTsconfig to resolve it."); + if (!m3.isAbsolute(t3)) + throw new Error("The tsconfig path must be absolute"); + Te && (t3 = E2(t3)); + const n3 = m3.dirname(t3), { files: l3, include: i6, exclude: r3, compilerOptions: f6 } = e5, u5 = l3 == null ? void 0 : l3.map((v4) => M(n3, v4)), g2 = qe(f6), w4 = s5 ? "" : "i", _4 = (r3 || Ke(f6)).map((v4) => { + const A3 = M(n3, v4), h3 = de(A3).replaceAll(String.raw`\*\*/`, "(.+/)?").replaceAll(String.raw`\*`, `${J}*`).replaceAll(String.raw`\?`, J); + return new RegExp(`^${h3}($|/)`, w4); + }), d5 = l3 || i6 ? i6 : [ve], j2 = d5 ? d5.map((v4) => { + let A3 = M(n3, v4); + en.test(A3) && (A3 = M(A3, ve)); + const h3 = de(A3).replaceAll(String.raw`/\*\*`, `(/${ne}${te}${J}*)*?`).replaceAll(/(\/)?\\\*/g, (L3, c3) => { + const y3 = `(${te}|(\\.(?!min\\.js$))?)*`; + return c3 ? `/${ne}${te}${y3}` : y3; + }).replaceAll(/(\/)?\\\?/g, (L3, c3) => { + const y3 = J; + return c3 ? `/${ne}${y3}` : y3; + }); + return new RegExp(`^${h3}$`, w4); + }) : void 0; + return (v4) => { + if (!m3.isAbsolute(v4)) + throw new Error("filePath must be absolute"); + if (Te && (v4 = E2(v4)), u5 != null && u5.includes(v4)) + return e5; + if (!(!g2.some((A3) => v4.endsWith(A3)) || _4.some((A3) => A3.test(v4))) && j2 && j2.some((A3) => A3.test(v4))) + return e5; + }; +}, "createFilesMatcher"); + +// +import se2, { writeSync as te2 } from "node:fs"; + +// +var import_esbuild = __toESM(require_main(), 1); +import { fileURLToPath as Jt, pathToFileURL as Gt } from "node:url"; +import Ht from "node:crypto"; +import U2 from "node:fs"; +import X2 from "node:path"; +import Xt from "node:os"; +var Pt = Object.defineProperty; +var f2 = (s5, e5) => Pt(s5, "name", { value: e5, configurable: true }); +var Ne2 = f2((s5) => Ht.createHash("sha1").update(s5).digest("hex"), "sha1"); +var Ie2 = 44; +var Yt = 59; +var Me2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +var $e2 = new Uint8Array(64); +var Ue2 = new Uint8Array(128); +for (let s5 = 0; s5 < Me2.length; s5++) { + const e5 = Me2.charCodeAt(s5); + $e2[s5] = e5, Ue2[e5] = s5; +} +var me2 = typeof TextDecoder < "u" ? new TextDecoder() : typeof Buffer < "u" ? { decode(s5) { + return Buffer.from(s5.buffer, s5.byteOffset, s5.byteLength).toString(); +} } : { decode(s5) { + let e5 = ""; + for (let n3 = 0; n3 < s5.length; n3++) + e5 += String.fromCharCode(s5[n3]); + return e5; +} }; +function Qt(s5) { + const e5 = new Int32Array(5), n3 = []; + let i6 = 0; + do { + const o8 = Zt(s5, i6), c3 = []; + let u5 = true, p5 = 0; + e5[0] = 0; + for (let g2 = i6; g2 < o8; g2++) { + let b3; + g2 = K2(s5, g2, e5, 0); + const d5 = e5[0]; + d5 < p5 && (u5 = false), p5 = d5, je2(s5, g2, o8) ? (g2 = K2(s5, g2, e5, 1), g2 = K2(s5, g2, e5, 2), g2 = K2(s5, g2, e5, 3), je2(s5, g2, o8) ? (g2 = K2(s5, g2, e5, 4), b3 = [d5, e5[1], e5[2], e5[3], e5[4]]) : b3 = [d5, e5[1], e5[2], e5[3]]) : b3 = [d5], c3.push(b3); + } + u5 || Vt(c3), n3.push(c3), i6 = o8 + 1; + } while (i6 <= s5.length); + return n3; +} +f2(Qt, "decode"); +function Zt(s5, e5) { + const n3 = s5.indexOf(";", e5); + return n3 === -1 ? s5.length : n3; +} +f2(Zt, "indexOf"); +function K2(s5, e5, n3, i6) { + let o8 = 0, c3 = 0, u5 = 0; + do { + const g2 = s5.charCodeAt(e5++); + u5 = Ue2[g2], o8 |= (u5 & 31) << c3, c3 += 5; + } while (u5 & 32); + const p5 = o8 & 1; + return o8 >>>= 1, p5 && (o8 = -2147483648 | -o8), n3[i6] += o8, e5; +} +f2(K2, "decodeInteger"); +function je2(s5, e5, n3) { + return e5 >= n3 ? false : s5.charCodeAt(e5) !== Ie2; +} +f2(je2, "hasMoreVlq"); +function Vt(s5) { + s5.sort(en2); +} +f2(Vt, "sort"); +function en2(s5, e5) { + return s5[0] - e5[0]; +} +f2(en2, "sortComparator$1"); +function De(s5) { + const e5 = new Int32Array(5), n3 = 1024 * 16, i6 = n3 - 36, o8 = new Uint8Array(n3), c3 = o8.subarray(0, i6); + let u5 = 0, p5 = ""; + for (let g2 = 0; g2 < s5.length; g2++) { + const b3 = s5[g2]; + if (g2 > 0 && (u5 === n3 && (p5 += me2.decode(o8), u5 = 0), o8[u5++] = Yt), b3.length !== 0) { + e5[0] = 0; + for (let d5 = 0; d5 < b3.length; d5++) { + const r3 = b3[d5]; + u5 > i6 && (p5 += me2.decode(c3), o8.copyWithin(0, i6, u5), u5 -= i6), d5 > 0 && (o8[u5++] = Ie2), u5 = Y3(o8, u5, e5, r3, 0), r3.length !== 1 && (u5 = Y3(o8, u5, e5, r3, 1), u5 = Y3(o8, u5, e5, r3, 2), u5 = Y3(o8, u5, e5, r3, 3), r3.length !== 4 && (u5 = Y3(o8, u5, e5, r3, 4))); + } + } + } + return p5 + me2.decode(o8.subarray(0, u5)); +} +f2(De, "encode"); +function Y3(s5, e5, n3, i6, o8) { + const c3 = i6[o8]; + let u5 = c3 - n3[o8]; + n3[o8] = c3, u5 = u5 < 0 ? -u5 << 1 | 1 : u5 << 1; + do { + let p5 = u5 & 31; + u5 >>>= 5, u5 > 0 && (p5 |= 32), s5[e5++] = $e2[p5]; + } while (u5 > 0); + return e5; +} +f2(Y3, "encodeInteger"); +var ae2 = class _ae { + static { + f2(this, "BitSet"); + } + constructor(e5) { + this.bits = e5 instanceof _ae ? e5.bits.slice() : []; + } + add(e5) { + this.bits[e5 >> 5] |= 1 << (e5 & 31); + } + has(e5) { + return !!(this.bits[e5 >> 5] & 1 << (e5 & 31)); + } +}; +var ee2 = class _ee { + static { + f2(this, "Chunk"); + } + constructor(e5, n3, i6) { + this.start = e5, this.end = n3, this.original = i6, this.intro = "", this.outro = "", this.content = i6, this.storeName = false, this.edited = false, this.previous = null, this.next = null; + } + appendLeft(e5) { + this.outro += e5; + } + appendRight(e5) { + this.intro = this.intro + e5; + } + clone() { + const e5 = new _ee(this.start, this.end, this.original); + return e5.intro = this.intro, e5.outro = this.outro, e5.content = this.content, e5.storeName = this.storeName, e5.edited = this.edited, e5; + } + contains(e5) { + return this.start < e5 && e5 < this.end; + } + eachNext(e5) { + let n3 = this; + for (; n3; ) + e5(n3), n3 = n3.next; + } + eachPrevious(e5) { + let n3 = this; + for (; n3; ) + e5(n3), n3 = n3.previous; + } + edit(e5, n3, i6) { + return this.content = e5, i6 || (this.intro = "", this.outro = ""), this.storeName = n3, this.edited = true, this; + } + prependLeft(e5) { + this.outro = e5 + this.outro; + } + prependRight(e5) { + this.intro = e5 + this.intro; + } + reset() { + this.intro = "", this.outro = "", this.edited && (this.content = this.original, this.storeName = false, this.edited = false); + } + split(e5) { + const n3 = e5 - this.start, i6 = this.original.slice(0, n3), o8 = this.original.slice(n3); + this.original = i6; + const c3 = new _ee(e5, this.end, o8); + return c3.outro = this.outro, this.outro = "", this.end = e5, this.edited ? (c3.edit("", false), this.content = "") : this.content = i6, c3.next = this.next, c3.next && (c3.next.previous = c3), c3.previous = this, this.next = c3, c3; + } + toString() { + return this.intro + this.content + this.outro; + } + trimEnd(e5) { + if (this.outro = this.outro.replace(e5, ""), this.outro.length) + return true; + const n3 = this.content.replace(e5, ""); + if (n3.length) + return n3 !== this.content && (this.split(this.start + n3.length).edit("", void 0, true), this.edited && this.edit(n3, this.storeName, true)), true; + if (this.edit("", void 0, true), this.intro = this.intro.replace(e5, ""), this.intro.length) + return true; + } + trimStart(e5) { + if (this.intro = this.intro.replace(e5, ""), this.intro.length) + return true; + const n3 = this.content.replace(e5, ""); + if (n3.length) { + if (n3 !== this.content) { + const i6 = this.split(this.end - n3.length); + this.edited && i6.edit(n3, this.storeName, true), this.edit("", void 0, true); + } + return true; + } else if (this.edit("", void 0, true), this.outro = this.outro.replace(e5, ""), this.outro.length) + return true; + } +}; +function tn() { + return typeof globalThis < "u" && typeof globalThis.btoa == "function" ? (s5) => globalThis.btoa(unescape(encodeURIComponent(s5))) : typeof Buffer == "function" ? (s5) => Buffer.from(s5, "utf-8").toString("base64") : () => { + throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported."); + }; +} +f2(tn, "getBtoa"); +var nn2 = tn(); +var rn = class { + static { + f2(this, "SourceMap"); + } + constructor(e5) { + this.version = 3, this.file = e5.file, this.sources = e5.sources, this.sourcesContent = e5.sourcesContent, this.names = e5.names, this.mappings = De(e5.mappings), typeof e5.x_google_ignoreList < "u" && (this.x_google_ignoreList = e5.x_google_ignoreList); + } + toString() { + return JSON.stringify(this); + } + toUrl() { + return "data:application/json;charset=utf-8;base64," + nn2(this.toString()); + } +}; +function sn(s5) { + const e5 = s5.split(` +`), n3 = e5.filter((c3) => /^\t+/.test(c3)), i6 = e5.filter((c3) => /^ {2,}/.test(c3)); + if (n3.length === 0 && i6.length === 0) + return null; + if (n3.length >= i6.length) + return " "; + const o8 = i6.reduce((c3, u5) => { + const p5 = /^ +/.exec(u5)[0].length; + return Math.min(p5, c3); + }, 1 / 0); + return new Array(o8 + 1).join(" "); +} +f2(sn, "guessIndent"); +function on(s5, e5) { + const n3 = s5.split(/[/\\]/), i6 = e5.split(/[/\\]/); + for (n3.pop(); n3[0] === i6[0]; ) + n3.shift(), i6.shift(); + if (n3.length) { + let o8 = n3.length; + for (; o8--; ) + n3[o8] = ".."; + } + return n3.concat(i6).join("/"); +} +f2(on, "getRelativePath"); +var an = Object.prototype.toString; +function cn(s5) { + return an.call(s5) === "[object Object]"; +} +f2(cn, "isObject"); +function Te2(s5) { + const e5 = s5.split(` +`), n3 = []; + for (let i6 = 0, o8 = 0; i6 < e5.length; i6++) + n3.push(o8), o8 += e5[i6].length + 1; + return f2(function(o8) { + let c3 = 0, u5 = n3.length; + for (; c3 < u5; ) { + const b3 = c3 + u5 >> 1; + o8 < n3[b3] ? u5 = b3 : c3 = b3 + 1; + } + const p5 = c3 - 1, g2 = o8 - n3[p5]; + return { line: p5, column: g2 }; + }, "locate"); +} +f2(Te2, "getLocator"); +var un = /\w/; +var ln = class { + static { + f2(this, "Mappings"); + } + constructor(e5) { + this.hires = e5, this.generatedCodeLine = 0, this.generatedCodeColumn = 0, this.raw = [], this.rawSegments = this.raw[this.generatedCodeLine] = [], this.pending = null; + } + addEdit(e5, n3, i6, o8) { + if (n3.length) { + const c3 = n3.length - 1; + let u5 = n3.indexOf(` +`, 0), p5 = -1; + for (; u5 >= 0 && c3 > u5; ) { + const b3 = [this.generatedCodeColumn, e5, i6.line, i6.column]; + o8 >= 0 && b3.push(o8), this.rawSegments.push(b3), this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = [], this.generatedCodeColumn = 0, p5 = u5, u5 = n3.indexOf(` +`, u5 + 1); + } + const g2 = [this.generatedCodeColumn, e5, i6.line, i6.column]; + o8 >= 0 && g2.push(o8), this.rawSegments.push(g2), this.advance(n3.slice(p5 + 1)); + } else + this.pending && (this.rawSegments.push(this.pending), this.advance(n3)); + this.pending = null; + } + addUneditedChunk(e5, n3, i6, o8, c3) { + let u5 = n3.start, p5 = true, g2 = false; + for (; u5 < n3.end; ) { + if (this.hires || p5 || c3.has(u5)) { + const b3 = [this.generatedCodeColumn, e5, o8.line, o8.column]; + this.hires === "boundary" ? un.test(i6[u5]) ? g2 || (this.rawSegments.push(b3), g2 = true) : (this.rawSegments.push(b3), g2 = false) : this.rawSegments.push(b3); + } + i6[u5] === ` +` ? (o8.line += 1, o8.column = 0, this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = [], this.generatedCodeColumn = 0, p5 = true) : (o8.column += 1, this.generatedCodeColumn += 1, p5 = false), u5 += 1; + } + this.pending = null; + } + advance(e5) { + if (!e5) + return; + const n3 = e5.split(` +`); + if (n3.length > 1) { + for (let i6 = 0; i6 < n3.length - 1; i6++) + this.generatedCodeLine++, this.raw[this.generatedCodeLine] = this.rawSegments = []; + this.generatedCodeColumn = 0; + } + this.generatedCodeColumn += n3[n3.length - 1].length; + } +}; +var Q3 = ` +`; +var J2 = { insertLeft: false, insertRight: false, storeName: false }; +var _e = class __e2 { + static { + f2(this, "MagicString"); + } + constructor(e5, n3 = {}) { + const i6 = new ee2(0, e5.length, e5); + Object.defineProperties(this, { original: { writable: true, value: e5 }, outro: { writable: true, value: "" }, intro: { writable: true, value: "" }, firstChunk: { writable: true, value: i6 }, lastChunk: { writable: true, value: i6 }, lastSearchedChunk: { writable: true, value: i6 }, byStart: { writable: true, value: {} }, byEnd: { writable: true, value: {} }, filename: { writable: true, value: n3.filename }, indentExclusionRanges: { writable: true, value: n3.indentExclusionRanges }, sourcemapLocations: { writable: true, value: new ae2() }, storedNames: { writable: true, value: {} }, indentStr: { writable: true, value: void 0 }, ignoreList: { writable: true, value: n3.ignoreList } }), this.byStart[0] = i6, this.byEnd[e5.length] = i6; + } + addSourcemapLocation(e5) { + this.sourcemapLocations.add(e5); + } + append(e5) { + if (typeof e5 != "string") + throw new TypeError("outro content must be a string"); + return this.outro += e5, this; + } + appendLeft(e5, n3) { + if (typeof n3 != "string") + throw new TypeError("inserted content must be a string"); + this._split(e5); + const i6 = this.byEnd[e5]; + return i6 ? i6.appendLeft(n3) : this.intro += n3, this; + } + appendRight(e5, n3) { + if (typeof n3 != "string") + throw new TypeError("inserted content must be a string"); + this._split(e5); + const i6 = this.byStart[e5]; + return i6 ? i6.appendRight(n3) : this.outro += n3, this; + } + clone() { + const e5 = new __e2(this.original, { filename: this.filename }); + let n3 = this.firstChunk, i6 = e5.firstChunk = e5.lastSearchedChunk = n3.clone(); + for (; n3; ) { + e5.byStart[i6.start] = i6, e5.byEnd[i6.end] = i6; + const o8 = n3.next, c3 = o8 && o8.clone(); + c3 && (i6.next = c3, c3.previous = i6, i6 = c3), n3 = o8; + } + return e5.lastChunk = i6, this.indentExclusionRanges && (e5.indentExclusionRanges = this.indentExclusionRanges.slice()), e5.sourcemapLocations = new ae2(this.sourcemapLocations), e5.intro = this.intro, e5.outro = this.outro, e5; + } + generateDecodedMap(e5) { + e5 = e5 || {}; + const n3 = 0, i6 = Object.keys(this.storedNames), o8 = new ln(e5.hires), c3 = Te2(this.original); + return this.intro && o8.advance(this.intro), this.firstChunk.eachNext((u5) => { + const p5 = c3(u5.start); + u5.intro.length && o8.advance(u5.intro), u5.edited ? o8.addEdit(n3, u5.content, p5, u5.storeName ? i6.indexOf(u5.original) : -1) : o8.addUneditedChunk(n3, u5, this.original, p5, this.sourcemapLocations), u5.outro.length && o8.advance(u5.outro); + }), { file: e5.file ? e5.file.split(/[/\\]/).pop() : void 0, sources: [e5.source ? on(e5.file || "", e5.source) : e5.file || ""], sourcesContent: e5.includeContent ? [this.original] : void 0, names: i6, mappings: o8.raw, x_google_ignoreList: this.ignoreList ? [n3] : void 0 }; + } + generateMap(e5) { + return new rn(this.generateDecodedMap(e5)); + } + _ensureindentStr() { + this.indentStr === void 0 && (this.indentStr = sn(this.original)); + } + _getRawIndentString() { + return this._ensureindentStr(), this.indentStr; + } + getIndentString() { + return this._ensureindentStr(), this.indentStr === null ? " " : this.indentStr; + } + indent(e5, n3) { + const i6 = /^[^\r\n]/gm; + if (cn(e5) && (n3 = e5, e5 = void 0), e5 === void 0 && (this._ensureindentStr(), e5 = this.indentStr || " "), e5 === "") + return this; + n3 = n3 || {}; + const o8 = {}; + n3.exclude && (typeof n3.exclude[0] == "number" ? [n3.exclude] : n3.exclude).forEach((d5) => { + for (let r3 = d5[0]; r3 < d5[1]; r3 += 1) + o8[r3] = true; + }); + let c3 = n3.indentStart !== false; + const u5 = f2((b3) => c3 ? `${e5}${b3}` : (c3 = true, b3), "replacer"); + this.intro = this.intro.replace(i6, u5); + let p5 = 0, g2 = this.firstChunk; + for (; g2; ) { + const b3 = g2.end; + if (g2.edited) + o8[p5] || (g2.content = g2.content.replace(i6, u5), g2.content.length && (c3 = g2.content[g2.content.length - 1] === ` +`)); + else + for (p5 = g2.start; p5 < b3; ) { + if (!o8[p5]) { + const d5 = this.original[p5]; + d5 === ` +` ? c3 = true : d5 !== "\r" && c3 && (c3 = false, p5 === g2.start || (this._splitChunk(g2, p5), g2 = g2.next), g2.prependRight(e5)); + } + p5 += 1; + } + p5 = g2.end, g2 = g2.next; + } + return this.outro = this.outro.replace(i6, u5), this; + } + insert() { + throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)"); + } + insertLeft(e5, n3) { + return J2.insertLeft || (console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"), J2.insertLeft = true), this.appendLeft(e5, n3); + } + insertRight(e5, n3) { + return J2.insertRight || (console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"), J2.insertRight = true), this.prependRight(e5, n3); + } + move(e5, n3, i6) { + if (i6 >= e5 && i6 <= n3) + throw new Error("Cannot move a selection inside itself"); + this._split(e5), this._split(n3), this._split(i6); + const o8 = this.byStart[e5], c3 = this.byEnd[n3], u5 = o8.previous, p5 = c3.next, g2 = this.byStart[i6]; + if (!g2 && c3 === this.lastChunk) + return this; + const b3 = g2 ? g2.previous : this.lastChunk; + return u5 && (u5.next = p5), p5 && (p5.previous = u5), b3 && (b3.next = o8), g2 && (g2.previous = c3), o8.previous || (this.firstChunk = c3.next), c3.next || (this.lastChunk = o8.previous, this.lastChunk.next = null), o8.previous = b3, c3.next = g2 || null, b3 || (this.firstChunk = o8), g2 || (this.lastChunk = c3), this; + } + overwrite(e5, n3, i6, o8) { + return o8 = o8 || {}, this.update(e5, n3, i6, { ...o8, overwrite: !o8.contentOnly }); + } + update(e5, n3, i6, o8) { + if (typeof i6 != "string") + throw new TypeError("replacement content must be a string"); + for (; e5 < 0; ) + e5 += this.original.length; + for (; n3 < 0; ) + n3 += this.original.length; + if (n3 > this.original.length) + throw new Error("end is out of bounds"); + if (e5 === n3) + throw new Error("Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead"); + this._split(e5), this._split(n3), o8 === true && (J2.storeName || (console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"), J2.storeName = true), o8 = { storeName: true }); + const c3 = o8 !== void 0 ? o8.storeName : false, u5 = o8 !== void 0 ? o8.overwrite : false; + if (c3) { + const b3 = this.original.slice(e5, n3); + Object.defineProperty(this.storedNames, b3, { writable: true, value: true, enumerable: true }); + } + const p5 = this.byStart[e5], g2 = this.byEnd[n3]; + if (p5) { + let b3 = p5; + for (; b3 !== g2; ) { + if (b3.next !== this.byStart[b3.end]) + throw new Error("Cannot overwrite across a split point"); + b3 = b3.next, b3.edit("", false); + } + p5.edit(i6, c3, !u5); + } else { + const b3 = new ee2(e5, n3, "").edit(i6, c3); + g2.next = b3, b3.previous = g2; + } + return this; + } + prepend(e5) { + if (typeof e5 != "string") + throw new TypeError("outro content must be a string"); + return this.intro = e5 + this.intro, this; + } + prependLeft(e5, n3) { + if (typeof n3 != "string") + throw new TypeError("inserted content must be a string"); + this._split(e5); + const i6 = this.byEnd[e5]; + return i6 ? i6.prependLeft(n3) : this.intro = n3 + this.intro, this; + } + prependRight(e5, n3) { + if (typeof n3 != "string") + throw new TypeError("inserted content must be a string"); + this._split(e5); + const i6 = this.byStart[e5]; + return i6 ? i6.prependRight(n3) : this.outro = n3 + this.outro, this; + } + remove(e5, n3) { + for (; e5 < 0; ) + e5 += this.original.length; + for (; n3 < 0; ) + n3 += this.original.length; + if (e5 === n3) + return this; + if (e5 < 0 || n3 > this.original.length) + throw new Error("Character is out of bounds"); + if (e5 > n3) + throw new Error("end must be greater than start"); + this._split(e5), this._split(n3); + let i6 = this.byStart[e5]; + for (; i6; ) + i6.intro = "", i6.outro = "", i6.edit(""), i6 = n3 > i6.end ? this.byStart[i6.end] : null; + return this; + } + reset(e5, n3) { + for (; e5 < 0; ) + e5 += this.original.length; + for (; n3 < 0; ) + n3 += this.original.length; + if (e5 === n3) + return this; + if (e5 < 0 || n3 > this.original.length) + throw new Error("Character is out of bounds"); + if (e5 > n3) + throw new Error("end must be greater than start"); + this._split(e5), this._split(n3); + let i6 = this.byStart[e5]; + for (; i6; ) + i6.reset(), i6 = n3 > i6.end ? this.byStart[i6.end] : null; + return this; + } + lastChar() { + if (this.outro.length) + return this.outro[this.outro.length - 1]; + let e5 = this.lastChunk; + do { + if (e5.outro.length) + return e5.outro[e5.outro.length - 1]; + if (e5.content.length) + return e5.content[e5.content.length - 1]; + if (e5.intro.length) + return e5.intro[e5.intro.length - 1]; + } while (e5 = e5.previous); + return this.intro.length ? this.intro[this.intro.length - 1] : ""; + } + lastLine() { + let e5 = this.outro.lastIndexOf(Q3); + if (e5 !== -1) + return this.outro.substr(e5 + 1); + let n3 = this.outro, i6 = this.lastChunk; + do { + if (i6.outro.length > 0) { + if (e5 = i6.outro.lastIndexOf(Q3), e5 !== -1) + return i6.outro.substr(e5 + 1) + n3; + n3 = i6.outro + n3; + } + if (i6.content.length > 0) { + if (e5 = i6.content.lastIndexOf(Q3), e5 !== -1) + return i6.content.substr(e5 + 1) + n3; + n3 = i6.content + n3; + } + if (i6.intro.length > 0) { + if (e5 = i6.intro.lastIndexOf(Q3), e5 !== -1) + return i6.intro.substr(e5 + 1) + n3; + n3 = i6.intro + n3; + } + } while (i6 = i6.previous); + return e5 = this.intro.lastIndexOf(Q3), e5 !== -1 ? this.intro.substr(e5 + 1) + n3 : this.intro + n3; + } + slice(e5 = 0, n3 = this.original.length) { + for (; e5 < 0; ) + e5 += this.original.length; + for (; n3 < 0; ) + n3 += this.original.length; + let i6 = "", o8 = this.firstChunk; + for (; o8 && (o8.start > e5 || o8.end <= e5); ) { + if (o8.start < n3 && o8.end >= n3) + return i6; + o8 = o8.next; + } + if (o8 && o8.edited && o8.start !== e5) + throw new Error(`Cannot use replaced character ${e5} as slice start anchor.`); + const c3 = o8; + for (; o8; ) { + o8.intro && (c3 !== o8 || o8.start === e5) && (i6 += o8.intro); + const u5 = o8.start < n3 && o8.end >= n3; + if (u5 && o8.edited && o8.end !== n3) + throw new Error(`Cannot use replaced character ${n3} as slice end anchor.`); + const p5 = c3 === o8 ? e5 - o8.start : 0, g2 = u5 ? o8.content.length + n3 - o8.end : o8.content.length; + if (i6 += o8.content.slice(p5, g2), o8.outro && (!u5 || o8.end === n3) && (i6 += o8.outro), u5) + break; + o8 = o8.next; + } + return i6; + } + snip(e5, n3) { + const i6 = this.clone(); + return i6.remove(0, e5), i6.remove(n3, i6.original.length), i6; + } + _split(e5) { + if (this.byStart[e5] || this.byEnd[e5]) + return; + let n3 = this.lastSearchedChunk; + const i6 = e5 > n3.end; + for (; n3; ) { + if (n3.contains(e5)) + return this._splitChunk(n3, e5); + n3 = i6 ? this.byStart[n3.end] : this.byEnd[n3.start]; + } + } + _splitChunk(e5, n3) { + if (e5.edited && e5.content.length) { + const o8 = Te2(this.original)(n3); + throw new Error(`Cannot split a chunk that has already been edited (${o8.line}:${o8.column} \u2013 "${e5.original}")`); + } + const i6 = e5.split(n3); + return this.byEnd[n3] = e5, this.byStart[n3] = i6, this.byEnd[i6.end] = i6, e5 === this.lastChunk && (this.lastChunk = i6), this.lastSearchedChunk = e5, true; + } + toString() { + let e5 = this.intro, n3 = this.firstChunk; + for (; n3; ) + e5 += n3.toString(), n3 = n3.next; + return e5 + this.outro; + } + isEmpty() { + let e5 = this.firstChunk; + do + if (e5.intro.length && e5.intro.trim() || e5.content.length && e5.content.trim() || e5.outro.length && e5.outro.trim()) + return false; + while (e5 = e5.next); + return true; + } + length() { + let e5 = this.firstChunk, n3 = 0; + do + n3 += e5.intro.length + e5.content.length + e5.outro.length; + while (e5 = e5.next); + return n3; + } + trimLines() { + return this.trim("[\\r\\n]"); + } + trim(e5) { + return this.trimStart(e5).trimEnd(e5); + } + trimEndAborted(e5) { + const n3 = new RegExp((e5 || "\\s") + "+$"); + if (this.outro = this.outro.replace(n3, ""), this.outro.length) + return true; + let i6 = this.lastChunk; + do { + const o8 = i6.end, c3 = i6.trimEnd(n3); + if (i6.end !== o8 && (this.lastChunk === i6 && (this.lastChunk = i6.next), this.byEnd[i6.end] = i6, this.byStart[i6.next.start] = i6.next, this.byEnd[i6.next.end] = i6.next), c3) + return true; + i6 = i6.previous; + } while (i6); + return false; + } + trimEnd(e5) { + return this.trimEndAborted(e5), this; + } + trimStartAborted(e5) { + const n3 = new RegExp("^" + (e5 || "\\s") + "+"); + if (this.intro = this.intro.replace(n3, ""), this.intro.length) + return true; + let i6 = this.firstChunk; + do { + const o8 = i6.end, c3 = i6.trimStart(n3); + if (i6.end !== o8 && (i6 === this.lastChunk && (this.lastChunk = i6.next), this.byEnd[i6.end] = i6, this.byStart[i6.next.start] = i6.next, this.byEnd[i6.next.end] = i6.next), c3) + return true; + i6 = i6.next; + } while (i6); + return false; + } + trimStart(e5) { + return this.trimStartAborted(e5), this; + } + hasChanged() { + return this.original !== this.toString(); + } + _replaceRegexp(e5, n3) { + function i6(c3, u5) { + return typeof n3 == "string" ? n3.replace(/\$(\$|&|\d+)/g, (p5, g2) => g2 === "$" ? "$" : g2 === "&" ? c3[0] : +g2 < c3.length ? c3[+g2] : `$${g2}`) : n3(...c3, c3.index, u5, c3.groups); + } + f2(i6, "getReplacement"); + function o8(c3, u5) { + let p5; + const g2 = []; + for (; p5 = c3.exec(u5); ) + g2.push(p5); + return g2; + } + if (f2(o8, "matchAll"), e5.global) + o8(e5, this.original).forEach((u5) => { + if (u5.index != null) { + const p5 = i6(u5, this.original); + p5 !== u5[0] && this.overwrite(u5.index, u5.index + u5[0].length, p5); } - if (this.indent >= map.indent) { - const atMapIndent = !this.onKeyLine && this.indent === map.indent; - const atNextItem = atMapIndent && (it.sep || it.explicitKey) && this.type !== "seq-item-ind"; - let start = []; - if (atNextItem && it.sep && !it.value) { - const nl = []; - for (let i = 0; i < it.sep.length; ++i) { - const st = it.sep[i]; - switch (st.type) { - case "newline": - nl.push(i); - break; - case "space": - break; - case "comment": - if (st.indent > map.indent) - nl.length = 0; + }); + else { + const c3 = this.original.match(e5); + if (c3 && c3.index != null) { + const u5 = i6(c3, this.original); + u5 !== c3[0] && this.overwrite(c3.index, c3.index + c3[0].length, u5); + } + } + return this; + } + _replaceString(e5, n3) { + const { original: i6 } = this, o8 = i6.indexOf(e5); + return o8 !== -1 && this.overwrite(o8, o8 + e5.length, n3), this; + } + replace(e5, n3) { + return typeof e5 == "string" ? this._replaceString(e5, n3) : this._replaceRegexp(e5, n3); + } + _replaceAllString(e5, n3) { + const { original: i6 } = this, o8 = e5.length; + for (let c3 = i6.indexOf(e5); c3 !== -1; c3 = i6.indexOf(e5, c3 + o8)) + i6.slice(c3, c3 + o8) !== n3 && this.overwrite(c3, c3 + o8, n3); + return this; + } + replaceAll(e5, n3) { + if (typeof e5 == "string") + return this._replaceAllString(e5, n3); + if (!e5.global) + throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument"); + return this._replaceRegexp(e5, n3); + } +}; +var v2; +var re2; +var ke2; +var Z2 = 2 << 19; +var Fe2 = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1 ? function(s5, e5) { + const n3 = s5.length; + let i6 = 0; + for (; i6 < n3; ) + e5[i6] = s5.charCodeAt(i6++); +} : function(s5, e5) { + const n3 = s5.length; + let i6 = 0; + for (; i6 < n3; ) { + const o8 = s5.charCodeAt(i6); + e5[i6++] = (255 & o8) << 8 | o8 >>> 8; + } +}; +var hn = "xportmportlassforetaourceromsyncunctionssertvoyiedelecontininstantybreareturdebuggeawaithrwhileifcatcfinallels"; +var _2; +var We2; +var y; +function fn(s5, e5 = "@") { + _2 = s5, We2 = e5; + const n3 = 2 * _2.length + (2 << 18); + if (n3 > Z2 || !v2) { + for (; n3 > Z2; ) + Z2 *= 2; + re2 = new ArrayBuffer(Z2), Fe2(hn, new Uint16Array(re2, 16, 110)), v2 = function(u5, p5, g2) { + var b3 = new u5.Int8Array(g2), d5 = new u5.Int16Array(g2), r3 = new u5.Int32Array(g2), R6 = new u5.Uint8Array(g2), L3 = new u5.Uint16Array(g2), E6 = 1040; + function N2() { + var t3 = 0, a7 = 0, h3 = 0, l3 = 0, w4 = 0, m8 = 0, C4 = 0; + C4 = E6, E6 = E6 + 10240 | 0, b3[804] = 1, b3[803] = 0, d5[399] = 0, d5[400] = 0, r3[69] = r3[2], b3[805] = 0, r3[68] = 0, b3[802] = 0, r3[70] = C4 + 2048, r3[71] = C4, b3[806] = 0, t3 = (r3[3] | 0) + -2 | 0, r3[72] = t3, a7 = t3 + (r3[66] << 1) | 0, r3[73] = a7; + e: + for (; ; ) { + if (h3 = t3 + 2 | 0, r3[72] = h3, t3 >>> 0 >= a7 >>> 0) { + l3 = 18; + break; + } + t: + do + switch (d5[h3 >> 1] | 0) { + case 9: + case 10: + case 11: + case 12: + case 13: + case 32: + break; + case 101: { + if (!(d5[400] | 0) && z3(h3) | 0 && !(A3(t3 + 4 | 0, 16, 10) | 0) && ($3(), (b3[804] | 0) == 0)) { + l3 = 9; + break e; + } else + l3 = 17; + break; + } + case 105: { + z3(h3) | 0 && !(A3(t3 + 4 | 0, 26, 10) | 0) && W2(), l3 = 17; + break; + } + case 59: { + l3 = 17; + break; + } + case 47: + switch (d5[t3 + 4 >> 1] | 0) { + case 47: { + fe2(); + break t; + } + case 42: { + le2(1); + break t; + } + default: { + l3 = 16; + break e; + } + } + default: { + l3 = 16; + break e; + } + } + while (false); + (l3 | 0) == 17 && (l3 = 0, r3[69] = r3[72]), t3 = r3[72] | 0, a7 = r3[73] | 0; + } + (l3 | 0) == 9 ? (t3 = r3[72] | 0, r3[69] = t3, l3 = 19) : (l3 | 0) == 16 ? (b3[804] = 0, r3[72] = t3, l3 = 19) : (l3 | 0) == 18 && (b3[802] | 0 ? t3 = 0 : (t3 = h3, l3 = 19)); + do + if ((l3 | 0) == 19) { + e: + for (; ; ) { + if (a7 = t3 + 2 | 0, r3[72] = a7, t3 >>> 0 >= (r3[73] | 0) >>> 0) { + l3 = 92; break; - default: - nl.length = 0; + } + t: + do + switch (d5[a7 >> 1] | 0) { + case 9: + case 10: + case 11: + case 12: + case 13: + case 32: + break; + case 101: { + !(d5[400] | 0) && z3(a7) | 0 && !(A3(t3 + 4 | 0, 16, 10) | 0) && $3(), l3 = 91; + break; + } + case 105: { + z3(a7) | 0 && !(A3(t3 + 4 | 0, 26, 10) | 0) && W2(), l3 = 91; + break; + } + case 99: { + z3(a7) | 0 && !(A3(t3 + 4 | 0, 36, 8) | 0) && P3(d5[t3 + 12 >> 1] | 0) | 0 && (b3[806] = 1), l3 = 91; + break; + } + case 40: { + h3 = r3[70] | 0, t3 = d5[400] | 0, l3 = t3 & 65535, r3[h3 + (l3 << 3) >> 2] = 1, a7 = r3[69] | 0, d5[400] = t3 + 1 << 16 >> 16, r3[h3 + (l3 << 3) + 4 >> 2] = a7, l3 = 91; + break; + } + case 41: { + if (a7 = d5[400] | 0, !(a7 << 16 >> 16)) { + l3 = 36; + break e; + } + h3 = a7 + -1 << 16 >> 16, d5[400] = h3, l3 = d5[399] | 0, a7 = l3 & 65535, l3 << 16 >> 16 && (r3[(r3[70] | 0) + ((h3 & 65535) << 3) >> 2] | 0) == 5 && (a7 = r3[(r3[71] | 0) + (a7 + -1 << 2) >> 2] | 0, h3 = a7 + 4 | 0, r3[h3 >> 2] | 0 || (r3[h3 >> 2] = (r3[69] | 0) + 2), r3[a7 + 12 >> 2] = t3 + 4, d5[399] = l3 + -1 << 16 >> 16), l3 = 91; + break; + } + case 123: { + l3 = r3[69] | 0, h3 = r3[63] | 0, t3 = l3; + do + if ((d5[l3 >> 1] | 0) == 41 & (h3 | 0) != 0 && (r3[h3 + 4 >> 2] | 0) == (l3 | 0)) + if (a7 = r3[64] | 0, r3[63] = a7, a7) { + r3[a7 + 32 >> 2] = 0; + break; + } else { + r3[59] = 0; + break; + } + while (false); + h3 = r3[70] | 0, a7 = d5[400] | 0, l3 = a7 & 65535, r3[h3 + (l3 << 3) >> 2] = b3[806] | 0 ? 6 : 2, d5[400] = a7 + 1 << 16 >> 16, r3[h3 + (l3 << 3) + 4 >> 2] = t3, b3[806] = 0, l3 = 91; + break; + } + case 125: { + if (t3 = d5[400] | 0, !(t3 << 16 >> 16)) { + l3 = 49; + break e; + } + h3 = r3[70] | 0, l3 = t3 + -1 << 16 >> 16, d5[400] = l3, (r3[h3 + ((l3 & 65535) << 3) >> 2] | 0) == 4 && Ee3(), l3 = 91; + break; + } + case 39: { + I5(39), l3 = 91; + break; + } + case 34: { + I5(34), l3 = 91; + break; + } + case 47: + switch (d5[t3 + 4 >> 1] | 0) { + case 47: { + fe2(); + break t; + } + case 42: { + le2(1); + break t; + } + default: { + t3 = r3[69] | 0, a7 = d5[t3 >> 1] | 0; + n: + do + if (!(kt(a7) | 0)) + a7 << 16 >> 16 == 41 ? (h3 = d5[400] | 0, xt(r3[(r3[70] | 0) + ((h3 & 65535) << 3) + 4 >> 2] | 0) | 0 || (l3 = 65)) : l3 = 64; + else + switch (a7 << 16 >> 16) { + case 46: + if (((d5[t3 + -2 >> 1] | 0) + -48 & 65535) < 10) { + l3 = 64; + break n; + } else + break n; + case 43: + if ((d5[t3 + -2 >> 1] | 0) == 43) { + l3 = 64; + break n; + } else + break n; + case 45: + if ((d5[t3 + -2 >> 1] | 0) == 45) { + l3 = 64; + break n; + } else + break n; + default: + break n; + } + while (false); + (l3 | 0) == 64 && (h3 = d5[400] | 0, l3 = 65); + n: + do + if ((l3 | 0) == 65) { + if (l3 = 0, h3 << 16 >> 16 && (w4 = r3[70] | 0, m8 = (h3 & 65535) + -1 | 0, a7 << 16 >> 16 == 102 ? (r3[w4 + (m8 << 3) >> 2] | 0) == 1 : 0)) { + if ((d5[t3 + -2 >> 1] | 0) == 111 && O4(r3[w4 + (m8 << 3) + 4 >> 2] | 0, 44, 3) | 0) + break; + } else + l3 = 69; + if ((l3 | 0) == 69 && a7 << 16 >> 16 == 125 && (l3 = r3[70] | 0, h3 = h3 & 65535, mt(r3[l3 + (h3 << 3) + 4 >> 2] | 0) | 0 || (r3[l3 + (h3 << 3) >> 2] | 0) == 6)) + break; + if (!(pt(t3) | 0)) { + switch (a7 << 16 >> 16) { + case 0: + break n; + case 47: { + if (b3[805] | 0) + break n; + break; + } + default: + } + if (l3 = r3[65] | 0, l3 | 0 && t3 >>> 0 >= (r3[l3 >> 2] | 0) >>> 0 && t3 >>> 0 <= (r3[l3 + 4 >> 2] | 0) >>> 0) { + ue2(), b3[805] = 0, l3 = 91; + break t; + } + h3 = r3[3] | 0; + do { + if (t3 >>> 0 <= h3 >>> 0) + break; + t3 = t3 + -2 | 0, r3[69] = t3, a7 = d5[t3 >> 1] | 0; + } while (!(he2(a7) | 0)); + if (ne2(a7) | 0) { + do { + if (t3 >>> 0 <= h3 >>> 0) + break; + t3 = t3 + -2 | 0, r3[69] = t3; + } while (ne2(d5[t3 >> 1] | 0) | 0); + if (Ct(t3) | 0) { + ue2(), b3[805] = 0, l3 = 91; + break t; + } + } + b3[805] = 1, l3 = 91; + break t; + } + } + while (false); + ue2(), b3[805] = 0, l3 = 91; + break t; + } + } + case 96: { + h3 = r3[70] | 0, a7 = d5[400] | 0, l3 = a7 & 65535, r3[h3 + (l3 << 3) + 4 >> 2] = r3[69], d5[400] = a7 + 1 << 16 >> 16, r3[h3 + (l3 << 3) >> 2] = 3, Ee3(), l3 = 91; + break; + } + default: + l3 = 91; + } + while (false); + (l3 | 0) == 91 && (l3 = 0, r3[69] = r3[72]), t3 = r3[72] | 0; } + if ((l3 | 0) == 36) { + M3(), t3 = 0; + break; + } else if ((l3 | 0) == 49) { + M3(), t3 = 0; + break; + } else if ((l3 | 0) == 92) { + t3 = b3[802] | 0 ? 0 : (d5[399] | d5[400]) << 16 >> 16 == 0; + break; } - if (nl.length >= 2) - start = it.sep.splice(nl[1]); } - switch (this.type) { - case "anchor": - case "tag": - if (atNextItem || it.value) { - start.push(this.sourceToken); - map.items.push({ start }); - this.onKeyLine = true; - } else if (it.sep) { - it.sep.push(this.sourceToken); - } else { - it.start.push(this.sourceToken); - } - return; - case "explicit-key-ind": - if (!it.sep && !it.explicitKey) { - it.start.push(this.sourceToken); - it.explicitKey = true; - } else if (atNextItem || it.value) { - start.push(this.sourceToken); - map.items.push({ start, explicitKey: true }); - } else { - this.stack.push({ - type: "block-map", - offset: this.offset, - indent: this.indent, - items: [{ start: [this.sourceToken], explicitKey: true }] - }); + while (false); + return E6 = C4, t3 | 0; + } + f2(N2, "b"); + function $3() { + var t3 = 0, a7 = 0, h3 = 0, l3 = 0, w4 = 0, m8 = 0, C4 = 0, T3 = 0, ge3 = 0, be3 = 0, pe3 = 0, we3 = 0, S2 = 0, x2 = 0; + T3 = r3[72] | 0, ge3 = r3[65] | 0, x2 = T3 + 12 | 0, r3[72] = x2, h3 = k3(1) | 0, t3 = r3[72] | 0, (t3 | 0) == (x2 | 0) && !(te3(h3) | 0) || (S2 = 3); + e: + do + if ((S2 | 0) == 3) { + t: + do + switch (h3 << 16 >> 16) { + case 123: { + for (r3[72] = t3 + 2, t3 = k3(1) | 0, a7 = r3[72] | 0; ; ) { + if (H3(t3) | 0 ? (I5(t3), t3 = (r3[72] | 0) + 2 | 0, r3[72] = t3) : (j2(t3) | 0, t3 = r3[72] | 0), k3(1) | 0, t3 = Le2(a7, t3) | 0, t3 << 16 >> 16 == 44 && (r3[72] = (r3[72] | 0) + 2, t3 = k3(1) | 0), t3 << 16 >> 16 == 125) { + S2 = 15; + break; + } + if (x2 = a7, a7 = r3[72] | 0, (a7 | 0) == (x2 | 0)) { + S2 = 12; + break; + } + if (a7 >>> 0 > (r3[73] | 0) >>> 0) { + S2 = 14; + break; + } + } + if ((S2 | 0) == 12) { + M3(); + break e; + } else if ((S2 | 0) == 14) { + M3(); + break e; + } else if ((S2 | 0) == 15) { + b3[803] = 1, r3[72] = (r3[72] | 0) + 2; + break t; + } + break; + } + case 42: { + r3[72] = t3 + 2, k3(1) | 0, x2 = r3[72] | 0, Le2(x2, x2) | 0; + break; + } + default: { + switch (b3[804] = 0, h3 << 16 >> 16) { + case 100: { + switch (T3 = t3 + 14 | 0, r3[72] = T3, (k3(1) | 0) << 16 >> 16) { + case 97: { + a7 = r3[72] | 0, !(A3(a7 + 2 | 0, 72, 8) | 0) && (w4 = a7 + 10 | 0, ne2(d5[w4 >> 1] | 0) | 0) && (r3[72] = w4, k3(0) | 0, S2 = 22); + break; + } + case 102: { + S2 = 22; + break; + } + case 99: { + a7 = r3[72] | 0, !(A3(a7 + 2 | 0, 36, 8) | 0) && (l3 = a7 + 10 | 0, x2 = d5[l3 >> 1] | 0, P3(x2) | 0 | x2 << 16 >> 16 == 123) && (r3[72] = l3, m8 = k3(1) | 0, m8 << 16 >> 16 != 123) && (we3 = m8, S2 = 31); + break; + } + default: + } + n: + do + if ((S2 | 0) == 22 && (C4 = r3[72] | 0, (A3(C4 + 2 | 0, 80, 14) | 0) == 0)) { + if (h3 = C4 + 16 | 0, a7 = d5[h3 >> 1] | 0, !(P3(a7) | 0)) + switch (a7 << 16 >> 16) { + case 40: + case 42: + break; + default: + break n; + } + r3[72] = h3, a7 = k3(1) | 0, a7 << 16 >> 16 == 42 && (r3[72] = (r3[72] | 0) + 2, a7 = k3(1) | 0), a7 << 16 >> 16 != 40 && (we3 = a7, S2 = 31); + } + while (false); + if ((S2 | 0) == 31 && (be3 = r3[72] | 0, j2(we3) | 0, pe3 = r3[72] | 0, pe3 >>> 0 > be3 >>> 0)) { + B3(t3, T3, be3, pe3), r3[72] = (r3[72] | 0) + -2; + break e; + } + B3(t3, T3, 0, 0), r3[72] = t3 + 12; + break e; + } + case 97: { + r3[72] = t3 + 10, k3(0) | 0, t3 = r3[72] | 0, S2 = 35; + break; + } + case 102: { + S2 = 35; + break; + } + case 99: { + if (!(A3(t3 + 2 | 0, 36, 8) | 0) && (a7 = t3 + 10 | 0, he2(d5[a7 >> 1] | 0) | 0)) { + r3[72] = a7, x2 = k3(1) | 0, S2 = r3[72] | 0, j2(x2) | 0, x2 = r3[72] | 0, B3(S2, x2, S2, x2), r3[72] = (r3[72] | 0) + -2; + break e; + } + t3 = t3 + 4 | 0, r3[72] = t3; + break; + } + case 108: + case 118: + break; + default: + break e; + } + if ((S2 | 0) == 35) { + r3[72] = t3 + 16, t3 = k3(1) | 0, t3 << 16 >> 16 == 42 && (r3[72] = (r3[72] | 0) + 2, t3 = k3(1) | 0), S2 = r3[72] | 0, j2(t3) | 0, x2 = r3[72] | 0, B3(S2, x2, S2, x2), r3[72] = (r3[72] | 0) + -2; + break e; + } + r3[72] = t3 + 6, b3[804] = 0, h3 = k3(1) | 0, t3 = r3[72] | 0, h3 = (j2(h3) | 0 | 32) << 16 >> 16 == 123, l3 = r3[72] | 0, h3 && (r3[72] = l3 + 2, x2 = k3(1) | 0, t3 = r3[72] | 0, j2(x2) | 0); + n: + for (; a7 = r3[72] | 0, (a7 | 0) != (t3 | 0); ) { + if (B3(t3, a7, t3, a7), a7 = k3(1) | 0, h3) + switch (a7 << 16 >> 16) { + case 93: + case 125: + break e; + default: + } + if (t3 = r3[72] | 0, a7 << 16 >> 16 != 44) { + S2 = 51; + break; + } + switch (r3[72] = t3 + 2, a7 = k3(1) | 0, t3 = r3[72] | 0, a7 << 16 >> 16) { + case 91: + case 123: { + S2 = 51; + break n; + } + default: + } + j2(a7) | 0; + } + if ((S2 | 0) == 51 && (r3[72] = t3 + -2), !h3) + break e; + r3[72] = l3 + -2; + break e; + } + } + while (false); + if (x2 = (k3(1) | 0) << 16 >> 16 == 102, t3 = r3[72] | 0, x2 && !(A3(t3 + 2 | 0, 66, 6) | 0)) + for (r3[72] = t3 + 8, G4(T3, k3(1) | 0, 0), t3 = ge3 | 0 ? ge3 + 16 | 0 : 240; ; ) { + if (t3 = r3[t3 >> 2] | 0, !t3) + break e; + r3[t3 + 12 >> 2] = 0, r3[t3 + 8 >> 2] = 0, t3 = t3 + 16 | 0; + } + r3[72] = t3 + -2; + } + while (false); + } + f2($3, "k"); + function W2() { + var t3 = 0, a7 = 0, h3 = 0, l3 = 0, w4 = 0, m8 = 0, C4 = 0; + w4 = r3[72] | 0, h3 = w4 + 12 | 0, r3[72] = h3, l3 = k3(1) | 0, a7 = r3[72] | 0; + e: + do + if (l3 << 16 >> 16 != 46) + l3 << 16 >> 16 == 115 & a7 >>> 0 > h3 >>> 0 ? !(A3(a7 + 2 | 0, 56, 10) | 0) && (t3 = a7 + 12 | 0, P3(d5[t3 >> 1] | 0) | 0) ? m8 = 14 : (a7 = 6, h3 = 0, m8 = 46) : (t3 = l3, h3 = 0, m8 = 15); + else + switch (r3[72] = a7 + 2, (k3(1) | 0) << 16 >> 16) { + case 109: { + if (t3 = r3[72] | 0, A3(t3 + 2 | 0, 50, 6) | 0 || (a7 = r3[69] | 0, !(de3(a7) | 0) && (d5[a7 >> 1] | 0) == 46)) + break e; + ce2(w4, w4, t3 + 8 | 0, 2); + break e; + } + case 115: { + if (t3 = r3[72] | 0, A3(t3 + 2 | 0, 56, 10) | 0 || (a7 = r3[69] | 0, !(de3(a7) | 0) && (d5[a7 >> 1] | 0) == 46)) + break e; + t3 = t3 + 12 | 0, m8 = 14; + break e; + } + default: + break e; } - this.onKeyLine = true; - return; - case "map-value-ind": - if (it.explicitKey) { - if (!it.sep) { - if (includesToken(it.start, "newline")) { - Object.assign(it, { key: null, sep: [this.sourceToken] }); + while (false); + (m8 | 0) == 14 && (r3[72] = t3, t3 = k3(1) | 0, h3 = 1, m8 = 15); + e: + do + if ((m8 | 0) == 15) + switch (t3 << 16 >> 16) { + case 40: { + if (a7 = r3[70] | 0, C4 = d5[400] | 0, l3 = C4 & 65535, r3[a7 + (l3 << 3) >> 2] = 5, t3 = r3[72] | 0, d5[400] = C4 + 1 << 16 >> 16, r3[a7 + (l3 << 3) + 4 >> 2] = t3, (d5[r3[69] >> 1] | 0) == 46) + break e; + switch (r3[72] = t3 + 2, a7 = k3(1) | 0, ce2(w4, r3[72] | 0, 0, t3), h3 ? (t3 = r3[63] | 0, r3[t3 + 28 >> 2] = 5) : t3 = r3[63] | 0, w4 = r3[71] | 0, C4 = d5[399] | 0, d5[399] = C4 + 1 << 16 >> 16, r3[w4 + ((C4 & 65535) << 2) >> 2] = t3, a7 << 16 >> 16) { + case 39: { + I5(39); + break; + } + case 34: { + I5(34); + break; + } + default: { + r3[72] = (r3[72] | 0) + -2; + break e; + } + } + switch (t3 = (r3[72] | 0) + 2 | 0, r3[72] = t3, (k3(1) | 0) << 16 >> 16) { + case 44: { + r3[72] = (r3[72] | 0) + 2, k3(1) | 0, w4 = r3[63] | 0, r3[w4 + 4 >> 2] = t3, C4 = r3[72] | 0, r3[w4 + 16 >> 2] = C4, b3[w4 + 24 >> 0] = 1, r3[72] = C4 + -2; + break e; + } + case 41: { + d5[400] = (d5[400] | 0) + -1 << 16 >> 16, C4 = r3[63] | 0, r3[C4 + 4 >> 2] = t3, r3[C4 + 12 >> 2] = (r3[72] | 0) + 2, b3[C4 + 24 >> 0] = 1, d5[399] = (d5[399] | 0) + -1 << 16 >> 16; + break e; + } + default: { + r3[72] = (r3[72] | 0) + -2; + break e; + } + } + } + case 123: { + if (h3) { + a7 = 12, h3 = 1, m8 = 46; + break e; + } + if (t3 = r3[72] | 0, d5[400] | 0) { + r3[72] = t3 + -2; + break e; + } + for (; !(t3 >>> 0 >= (r3[73] | 0) >>> 0); ) { + if (t3 = k3(1) | 0, H3(t3) | 0) + I5(t3); + else if (t3 << 16 >> 16 == 125) { + m8 = 36; + break; + } + t3 = (r3[72] | 0) + 2 | 0, r3[72] = t3; + } + if ((m8 | 0) == 36 && (r3[72] = (r3[72] | 0) + 2), C4 = (k3(1) | 0) << 16 >> 16 == 102, t3 = r3[72] | 0, C4 && A3(t3 + 2 | 0, 66, 6) | 0) { + M3(); + break e; + } + if (r3[72] = t3 + 8, t3 = k3(1) | 0, H3(t3) | 0) { + G4(w4, t3, 0); + break e; } else { - const start2 = getFirstKeyStartProps(it.start); - this.stack.push({ - type: "block-map", - offset: this.offset, - indent: this.indent, - items: [{ start: start2, key: null, sep: [this.sourceToken] }] - }); + M3(); + break e; } - } else if (it.value) { - map.items.push({ start: [], key: null, sep: [this.sourceToken] }); - } else if (includesToken(it.sep, "map-value-ind")) { - this.stack.push({ - type: "block-map", - offset: this.offset, - indent: this.indent, - items: [{ start, key: null, sep: [this.sourceToken] }] - }); - } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) { - const start2 = getFirstKeyStartProps(it.start); - const key = it.key; - const sep2 = it.sep; - sep2.push(this.sourceToken); - delete it.key; - delete it.sep; - this.stack.push({ - type: "block-map", - offset: this.offset, - indent: this.indent, - items: [{ start: start2, key, sep: sep2 }] - }); - } else if (start.length > 0) { - it.sep = it.sep.concat(start, this.sourceToken); - } else { - it.sep.push(this.sourceToken); } - } else { - if (!it.sep) { - Object.assign(it, { key: null, sep: [this.sourceToken] }); - } else if (it.value || atNextItem) { - map.items.push({ start, key: null, sep: [this.sourceToken] }); - } else if (includesToken(it.sep, "map-value-ind")) { - this.stack.push({ - type: "block-map", - offset: this.offset, - indent: this.indent, - items: [{ start: [], key: null, sep: [this.sourceToken] }] - }); - } else { - it.sep.push(this.sourceToken); + default: { + if (h3) { + a7 = 12, h3 = 1, m8 = 46; + break e; + } + switch (t3 << 16 >> 16) { + case 42: + case 39: + case 34: { + h3 = 0, m8 = 48; + break e; + } + default: { + a7 = 6, h3 = 0, m8 = 46; + break e; + } + } } } - this.onKeyLine = true; - return; - case "alias": - case "scalar": - case "single-quoted-scalar": - case "double-quoted-scalar": { - const fs = this.flowScalar(this.type); - if (atNextItem || it.value) { - map.items.push({ start, key: fs, sep: [] }); - this.onKeyLine = true; - } else if (it.sep) { - this.stack.push(fs); - } else { - Object.assign(it, { key: fs, sep: [] }); - this.onKeyLine = true; + while (false); + (m8 | 0) == 46 && (t3 = r3[72] | 0, (t3 | 0) == (w4 + (a7 << 1) | 0) ? r3[72] = t3 + -2 : m8 = 48); + do + if ((m8 | 0) == 48) { + if (d5[400] | 0) { + r3[72] = (r3[72] | 0) + -2; + break; + } + for (t3 = r3[73] | 0, a7 = r3[72] | 0; ; ) { + if (a7 >>> 0 >= t3 >>> 0) { + m8 = 55; + break; } - return; + if (l3 = d5[a7 >> 1] | 0, H3(l3) | 0) { + m8 = 53; + break; + } + C4 = a7 + 2 | 0, r3[72] = C4, a7 = C4; } - default: { - const bv = this.startBlockValue(map); - if (bv) { - if (bv.type === "block-seq") { - if (!it.explicitKey && it.sep && !includesToken(it.sep, "newline")) { - yield* this.pop({ - type: "error", - offset: this.offset, - message: "Unexpected block-seq-ind on same line with key", - source: this.source - }); - return; + if ((m8 | 0) == 53) { + G4(w4, l3, h3); + break; + } else if ((m8 | 0) == 55) { + M3(); + break; + } + } + while (false); + } + f2(W2, "l"); + function G4(t3, a7, h3) { + t3 = t3 | 0, a7 = a7 | 0, h3 = h3 | 0; + var l3 = 0, w4 = 0; + switch (l3 = (r3[72] | 0) + 2 | 0, a7 << 16 >> 16) { + case 39: { + I5(39), w4 = 5; + break; + } + case 34: { + I5(34), w4 = 5; + break; + } + default: + M3(); + } + do + if ((w4 | 0) == 5) { + if (ce2(t3, l3, r3[72] | 0, 1), h3 && (r3[(r3[63] | 0) + 28 >> 2] = 4), r3[72] = (r3[72] | 0) + 2, a7 = k3(0) | 0, h3 = a7 << 16 >> 16 == 97, h3 ? (l3 = r3[72] | 0, A3(l3 + 2 | 0, 94, 10) | 0 && (w4 = 13)) : (l3 = r3[72] | 0, a7 << 16 >> 16 == 119 && (d5[l3 + 2 >> 1] | 0) == 105 && (d5[l3 + 4 >> 1] | 0) == 116 && (d5[l3 + 6 >> 1] | 0) == 104 || (w4 = 13)), (w4 | 0) == 13) { + r3[72] = l3 + -2; + break; + } + if (r3[72] = l3 + ((h3 ? 6 : 4) << 1), (k3(1) | 0) << 16 >> 16 != 123) { + r3[72] = l3; + break; + } + h3 = r3[72] | 0, a7 = h3; + e: + for (; ; ) { + switch (r3[72] = a7 + 2, a7 = k3(1) | 0, a7 << 16 >> 16) { + case 39: { + I5(39), r3[72] = (r3[72] | 0) + 2, a7 = k3(1) | 0; + break; } - } else if (atMapIndent) { - map.items.push({ start }); + case 34: { + I5(34), r3[72] = (r3[72] | 0) + 2, a7 = k3(1) | 0; + break; + } + default: + a7 = j2(a7) | 0; } - this.stack.push(bv); - return; + if (a7 << 16 >> 16 != 58) { + w4 = 22; + break; + } + switch (r3[72] = (r3[72] | 0) + 2, (k3(1) | 0) << 16 >> 16) { + case 39: { + I5(39); + break; + } + case 34: { + I5(34); + break; + } + default: { + w4 = 26; + break e; + } + } + switch (r3[72] = (r3[72] | 0) + 2, (k3(1) | 0) << 16 >> 16) { + case 125: { + w4 = 31; + break e; + } + case 44: + break; + default: { + w4 = 30; + break e; + } + } + if (r3[72] = (r3[72] | 0) + 2, (k3(1) | 0) << 16 >> 16 == 125) { + w4 = 31; + break; + } + a7 = r3[72] | 0; } + if ((w4 | 0) == 22) { + r3[72] = l3; + break; + } else if ((w4 | 0) == 26) { + r3[72] = l3; + break; + } else if ((w4 | 0) == 30) { + r3[72] = l3; + break; + } else if ((w4 | 0) == 31) { + w4 = r3[63] | 0, r3[w4 + 16 >> 2] = h3, r3[w4 + 12 >> 2] = (r3[72] | 0) + 2; + break; } } - } - yield* this.pop(); - yield* this.step(); + while (false); } - *blockSequence(seq) { - const it = seq.items[seq.items.length - 1]; - switch (this.type) { - case "newline": - if (it.value) { - const end = "end" in it.value ? it.value.end : void 0; - const last = Array.isArray(end) ? end[end.length - 1] : void 0; - if (last?.type === "comment") - end?.push(this.sourceToken); - else - seq.items.push({ start: [this.sourceToken] }); - } else - it.start.push(this.sourceToken); - return; - case "space": - case "comment": - if (it.value) - seq.items.push({ start: [this.sourceToken] }); - else { - if (this.atIndentedComment(it.start, seq.indent)) { - const prev = seq.items[seq.items.length - 2]; - const end = prev?.value?.end; - if (Array.isArray(end)) { - Array.prototype.push.apply(end, it.start); - end.push(this.sourceToken); - seq.items.pop(); - return; + f2(G4, "u"); + function pt(t3) { + t3 = t3 | 0; + e: + do + switch (d5[t3 >> 1] | 0) { + case 100: + switch (d5[t3 + -2 >> 1] | 0) { + case 105: { + t3 = O4(t3 + -4 | 0, 104, 2) | 0; + break e; + } + case 108: { + t3 = O4(t3 + -4 | 0, 108, 3) | 0; + break e; + } + default: { + t3 = 0; + break e; + } + } + case 101: + switch (d5[t3 + -2 >> 1] | 0) { + case 115: + switch (d5[t3 + -4 >> 1] | 0) { + case 108: { + t3 = q2(t3 + -6 | 0, 101) | 0; + break e; + } + case 97: { + t3 = q2(t3 + -6 | 0, 99) | 0; + break e; + } + default: { + t3 = 0; + break e; + } + } + case 116: { + t3 = O4(t3 + -4 | 0, 114, 4) | 0; + break e; + } + case 117: { + t3 = O4(t3 + -4 | 0, 122, 6) | 0; + break e; + } + default: { + t3 = 0; + break e; + } + } + case 102: { + if ((d5[t3 + -2 >> 1] | 0) == 111 && (d5[t3 + -4 >> 1] | 0) == 101) + switch (d5[t3 + -6 >> 1] | 0) { + case 99: { + t3 = O4(t3 + -8 | 0, 134, 6) | 0; + break e; + } + case 112: { + t3 = O4(t3 + -8 | 0, 146, 2) | 0; + break e; + } + default: { + t3 = 0; + break e; + } + } + else + t3 = 0; + break; + } + case 107: { + t3 = O4(t3 + -2 | 0, 150, 4) | 0; + break; + } + case 110: { + t3 = t3 + -2 | 0, q2(t3, 105) | 0 ? t3 = 1 : t3 = O4(t3, 158, 5) | 0; + break; + } + case 111: { + t3 = q2(t3 + -2 | 0, 100) | 0; + break; + } + case 114: { + t3 = O4(t3 + -2 | 0, 168, 7) | 0; + break; + } + case 116: { + t3 = O4(t3 + -2 | 0, 182, 4) | 0; + break; + } + case 119: + switch (d5[t3 + -2 >> 1] | 0) { + case 101: { + t3 = q2(t3 + -4 | 0, 110) | 0; + break e; + } + case 111: { + t3 = O4(t3 + -4 | 0, 190, 3) | 0; + break e; + } + default: { + t3 = 0; + break e; + } + } + default: + t3 = 0; + } + while (false); + return t3 | 0; + } + f2(pt, "o"); + function Ee3() { + var t3 = 0, a7 = 0, h3 = 0, l3 = 0; + a7 = r3[73] | 0, h3 = r3[72] | 0; + e: + for (; ; ) { + if (t3 = h3 + 2 | 0, h3 >>> 0 >= a7 >>> 0) { + a7 = 10; + break; + } + switch (d5[t3 >> 1] | 0) { + case 96: { + a7 = 7; + break e; + } + case 36: { + if ((d5[h3 + 4 >> 1] | 0) == 123) { + a7 = 6; + break e; } + break; + } + case 92: { + t3 = h3 + 4 | 0; + break; } - it.start.push(this.sourceToken); + default: } - return; - case "anchor": - case "tag": - if (it.value || this.indent <= seq.indent) - break; - it.start.push(this.sourceToken); - return; - case "seq-item-ind": - if (this.indent !== seq.indent) - break; - if (it.value || includesToken(it.start, "seq-item-ind")) - seq.items.push({ start: [this.sourceToken] }); - else - it.start.push(this.sourceToken); - return; - } - if (this.indent > seq.indent) { - const bv = this.startBlockValue(seq); - if (bv) { - this.stack.push(bv); - return; + h3 = t3; } - } - yield* this.pop(); - yield* this.step(); + (a7 | 0) == 6 ? (t3 = h3 + 4 | 0, r3[72] = t3, a7 = r3[70] | 0, l3 = d5[400] | 0, h3 = l3 & 65535, r3[a7 + (h3 << 3) >> 2] = 4, d5[400] = l3 + 1 << 16 >> 16, r3[a7 + (h3 << 3) + 4 >> 2] = t3) : (a7 | 0) == 7 ? (r3[72] = t3, h3 = r3[70] | 0, l3 = (d5[400] | 0) + -1 << 16 >> 16, d5[400] = l3, (r3[h3 + ((l3 & 65535) << 3) >> 2] | 0) != 3 && M3()) : (a7 | 0) == 10 && (r3[72] = t3, M3()); } - *flowCollection(fc) { - const it = fc.items[fc.items.length - 1]; - if (this.type === "flow-error-end") { - let top; + f2(Ee3, "h"); + function k3(t3) { + t3 = t3 | 0; + var a7 = 0, h3 = 0, l3 = 0; + h3 = r3[72] | 0; + e: do { - yield* this.pop(); - top = this.peek(1); - } while (top && top.type === "flow-collection"); - } else if (fc.end.length === 0) { - switch (this.type) { - case "comma": - case "explicit-key-ind": - if (!it || it.sep) - fc.items.push({ start: [this.sourceToken] }); - else - it.start.push(this.sourceToken); - return; - case "map-value-ind": - if (!it || it.value) - fc.items.push({ start: [], key: null, sep: [this.sourceToken] }); - else if (it.sep) - it.sep.push(this.sourceToken); - else - Object.assign(it, { key: null, sep: [this.sourceToken] }); - return; - case "space": - case "comment": - case "newline": - case "anchor": - case "tag": - if (!it || it.value) - fc.items.push({ start: [this.sourceToken] }); - else if (it.sep) - it.sep.push(this.sourceToken); - else - it.start.push(this.sourceToken); - return; - case "alias": - case "scalar": - case "single-quoted-scalar": - case "double-quoted-scalar": { - const fs = this.flowScalar(this.type); - if (!it || it.value) - fc.items.push({ start: [], key: fs, sep: [] }); - else if (it.sep) - this.stack.push(fs); - else - Object.assign(it, { key: fs, sep: [] }); - return; - } - case "flow-map-end": - case "flow-seq-end": - fc.end.push(this.sourceToken); - return; + a7 = d5[h3 >> 1] | 0; + t: + do + if (a7 << 16 >> 16 != 47) + if (t3) { + if (P3(a7) | 0) + break; + break e; + } else { + if (ne2(a7) | 0) + break; + break e; + } + else + switch (d5[h3 + 2 >> 1] | 0) { + case 47: { + fe2(); + break t; + } + case 42: { + le2(t3); + break t; + } + default: { + a7 = 47; + break e; + } + } + while (false); + l3 = r3[72] | 0, h3 = l3 + 2 | 0, r3[72] = h3; + } while (l3 >>> 0 < (r3[73] | 0) >>> 0); + return a7 | 0; + } + f2(k3, "w"); + function ce2(t3, a7, h3, l3) { + t3 = t3 | 0, a7 = a7 | 0, h3 = h3 | 0, l3 = l3 | 0; + var w4 = 0, m8 = 0; + m8 = r3[67] | 0, r3[67] = m8 + 36, w4 = r3[63] | 0, r3[(w4 | 0 ? w4 + 32 | 0 : 236) >> 2] = m8, r3[64] = w4, r3[63] = m8, r3[m8 + 8 >> 2] = t3, (l3 | 0) == 2 ? (t3 = 3, w4 = h3) : (w4 = (l3 | 0) == 1, t3 = w4 ? 1 : 2, w4 = w4 ? h3 + 2 | 0 : 0), r3[m8 + 12 >> 2] = w4, r3[m8 + 28 >> 2] = t3, r3[m8 >> 2] = a7, r3[m8 + 4 >> 2] = h3, r3[m8 + 16 >> 2] = 0, r3[m8 + 20 >> 2] = l3, a7 = (l3 | 0) == 1, b3[m8 + 24 >> 0] = a7 & 1, r3[m8 + 32 >> 2] = 0, a7 | (l3 | 0) == 2 && (b3[803] = 1); + } + f2(ce2, "d"); + function I5(t3) { + t3 = t3 | 0; + var a7 = 0, h3 = 0, l3 = 0, w4 = 0; + for (w4 = r3[73] | 0, a7 = r3[72] | 0; ; ) { + if (l3 = a7 + 2 | 0, a7 >>> 0 >= w4 >>> 0) { + a7 = 9; + break; } - const bv = this.startBlockValue(fc); - if (bv) - this.stack.push(bv); - else { - yield* this.pop(); - yield* this.step(); + if (h3 = d5[l3 >> 1] | 0, h3 << 16 >> 16 == t3 << 16 >> 16) { + a7 = 10; + break; } - } else { - const parent = this.peek(2); - if (parent.type === "block-map" && (this.type === "map-value-ind" && parent.indent === fc.indent || this.type === "newline" && !parent.items[parent.items.length - 1].sep)) { - yield* this.pop(); - yield* this.step(); - } else if (this.type === "map-value-ind" && parent.type !== "flow-collection") { - const prev = getPrevProps(parent); - const start = getFirstKeyStartProps(prev); - fixFlowSeqItems(fc); - const sep2 = fc.end.splice(1, fc.end.length); - sep2.push(this.sourceToken); - const map = { - type: "block-map", - offset: fc.offset, - indent: fc.indent, - items: [{ start, key: fc, sep: sep2 }] - }; - this.onKeyLine = true; - this.stack[this.stack.length - 1] = map; - } else { - yield* this.lineEnd(fc); + if (h3 << 16 >> 16 == 92) + h3 = a7 + 4 | 0, (d5[h3 >> 1] | 0) == 13 ? (a7 = a7 + 6 | 0, a7 = (d5[a7 >> 1] | 0) == 10 ? a7 : h3) : a7 = h3; + else if (Re2(h3) | 0) { + a7 = 9; + break; + } else + a7 = l3; + } + (a7 | 0) == 9 ? (r3[72] = l3, M3()) : (a7 | 0) == 10 && (r3[72] = l3); + } + f2(I5, "v"); + function Le2(t3, a7) { + t3 = t3 | 0, a7 = a7 | 0; + var h3 = 0, l3 = 0, w4 = 0, m8 = 0; + return h3 = r3[72] | 0, l3 = d5[h3 >> 1] | 0, m8 = (t3 | 0) == (a7 | 0), w4 = m8 ? 0 : t3, m8 = m8 ? 0 : a7, l3 << 16 >> 16 == 97 && (r3[72] = h3 + 4, h3 = k3(1) | 0, t3 = r3[72] | 0, H3(h3) | 0 ? (I5(h3), a7 = (r3[72] | 0) + 2 | 0, r3[72] = a7) : (j2(h3) | 0, a7 = r3[72] | 0), l3 = k3(1) | 0, h3 = r3[72] | 0), (h3 | 0) != (t3 | 0) && B3(t3, a7, w4, m8), l3 | 0; + } + f2(Le2, "A"); + function wt() { + var t3 = 0, a7 = 0, h3 = 0; + h3 = r3[73] | 0, a7 = r3[72] | 0; + e: + for (; ; ) { + if (t3 = a7 + 2 | 0, a7 >>> 0 >= h3 >>> 0) { + a7 = 6; + break; + } + switch (d5[t3 >> 1] | 0) { + case 13: + case 10: { + a7 = 6; + break e; + } + case 93: { + a7 = 7; + break e; + } + case 92: { + t3 = a7 + 4 | 0; + break; + } + default: + } + a7 = t3; } - } + return (a7 | 0) == 6 ? (r3[72] = t3, M3(), t3 = 0) : (a7 | 0) == 7 && (r3[72] = t3, t3 = 93), t3 | 0; } - flowScalar(type) { - if (this.onNewLine) { - let nl = this.source.indexOf("\n") + 1; - while (nl !== 0) { - this.onNewLine(this.offset + nl); - nl = this.source.indexOf("\n", nl) + 1; + f2(wt, "C"); + function ue2() { + var t3 = 0, a7 = 0, h3 = 0; + e: + for (; ; ) { + if (t3 = r3[72] | 0, a7 = t3 + 2 | 0, r3[72] = a7, t3 >>> 0 >= (r3[73] | 0) >>> 0) { + h3 = 7; + break; + } + switch (d5[a7 >> 1] | 0) { + case 13: + case 10: { + h3 = 7; + break e; + } + case 47: + break e; + case 91: { + wt() | 0; + break; + } + case 92: { + r3[72] = t3 + 4; + break; + } + default: + } } - } - return { - type, - offset: this.offset, - indent: this.indent, - source: this.source - }; + (h3 | 0) == 7 && M3(); } - startBlockValue(parent) { - switch (this.type) { - case "alias": - case "scalar": - case "single-quoted-scalar": - case "double-quoted-scalar": - return this.flowScalar(this.type); - case "block-scalar-header": - return { - type: "block-scalar", - offset: this.offset, - indent: this.indent, - props: [this.sourceToken], - source: "" - }; - case "flow-map-start": - case "flow-seq-start": - return { - type: "flow-collection", - offset: this.offset, - indent: this.indent, - start: this.sourceToken, - items: [], - end: [] - }; - case "seq-item-ind": - return { - type: "block-seq", - offset: this.offset, - indent: this.indent, - items: [{ start: [this.sourceToken] }] - }; - case "explicit-key-ind": { - this.onKeyLine = true; - const prev = getPrevProps(parent); - const start = getFirstKeyStartProps(prev); - start.push(this.sourceToken); - return { - type: "block-map", - offset: this.offset, - indent: this.indent, - items: [{ start, explicitKey: true }] - }; + f2(ue2, "g"); + function mt(t3) { + switch (t3 = t3 | 0, d5[t3 >> 1] | 0) { + case 62: { + t3 = (d5[t3 + -2 >> 1] | 0) == 61; + break; } - case "map-value-ind": { - this.onKeyLine = true; - const prev = getPrevProps(parent); - const start = getFirstKeyStartProps(prev); - return { - type: "block-map", - offset: this.offset, - indent: this.indent, - items: [{ start, key: null, sep: [this.sourceToken] }] - }; + case 41: + case 59: { + t3 = 1; + break; + } + case 104: { + t3 = O4(t3 + -2 | 0, 210, 4) | 0; + break; + } + case 121: { + t3 = O4(t3 + -2 | 0, 218, 6) | 0; + break; + } + case 101: { + t3 = O4(t3 + -2 | 0, 230, 3) | 0; + break; } + default: + t3 = 0; } - return null; - } - atIndentedComment(start, indent) { - if (this.type !== "comment") - return false; - if (this.indent <= indent) - return false; - return start.every((st) => st.type === "newline" || st.type === "space"); + return t3 | 0; } - *documentEnd(docEnd) { - if (this.type !== "doc-mode") { - if (docEnd.end) - docEnd.end.push(this.sourceToken); - else - docEnd.end = [this.sourceToken]; - if (this.type === "newline") - yield* this.pop(); + f2(mt, "p"); + function le2(t3) { + t3 = t3 | 0; + var a7 = 0, h3 = 0, l3 = 0, w4 = 0, m8 = 0; + for (w4 = (r3[72] | 0) + 2 | 0, r3[72] = w4, h3 = r3[73] | 0; a7 = w4 + 2 | 0, !(w4 >>> 0 >= h3 >>> 0 || (l3 = d5[a7 >> 1] | 0, !t3 && Re2(l3) | 0)); ) { + if (l3 << 16 >> 16 == 42 && (d5[w4 + 4 >> 1] | 0) == 47) { + m8 = 8; + break; + } + w4 = a7; } + (m8 | 0) == 8 && (r3[72] = a7, a7 = w4 + 4 | 0), r3[72] = a7; } - *lineEnd(token) { - switch (this.type) { - case "comma": - case "doc-start": - case "doc-end": - case "flow-seq-end": - case "flow-map-end": - case "map-value-ind": - yield* this.pop(); - yield* this.step(); + f2(le2, "y"); + function A3(t3, a7, h3) { + t3 = t3 | 0, a7 = a7 | 0, h3 = h3 | 0; + var l3 = 0, w4 = 0; + e: + do + if (!h3) + t3 = 0; + else { + for (; l3 = b3[t3 >> 0] | 0, w4 = b3[a7 >> 0] | 0, l3 << 24 >> 24 == w4 << 24 >> 24; ) + if (h3 = h3 + -1 | 0, h3) + t3 = t3 + 1 | 0, a7 = a7 + 1 | 0; + else { + t3 = 0; + break e; + } + t3 = (l3 & 255) - (w4 & 255) | 0; + } + while (false); + return t3 | 0; + } + f2(A3, "m"); + function te3(t3) { + t3 = t3 | 0; + e: + do + switch (t3 << 16 >> 16) { + case 38: + case 37: + case 33: { + t3 = 1; + break; + } + default: + if ((t3 & -8) << 16 >> 16 == 40 | (t3 + -58 & 65535) < 6) + t3 = 1; + else { + switch (t3 << 16 >> 16) { + case 91: + case 93: + case 94: { + t3 = 1; + break e; + } + default: + } + t3 = (t3 + -123 & 65535) < 4; + } + } + while (false); + return t3 | 0; + } + f2(te3, "I"); + function kt(t3) { + t3 = t3 | 0; + e: + do + switch (t3 << 16 >> 16) { + case 38: + case 37: + case 33: + break; + default: + if (!((t3 + -58 & 65535) < 6 | (t3 + -40 & 65535) < 7 & t3 << 16 >> 16 != 41)) { + switch (t3 << 16 >> 16) { + case 91: + case 94: + break e; + default: + } + return t3 << 16 >> 16 != 125 & (t3 + -123 & 65535) < 4 | 0; + } + } + while (false); + return 1; + } + f2(kt, "U"); + function Oe2(t3) { + t3 = t3 | 0; + var a7 = 0; + a7 = d5[t3 >> 1] | 0; + e: + do + if ((a7 + -9 & 65535) >= 5) { + switch (a7 << 16 >> 16) { + case 160: + case 32: { + a7 = 1; + break e; + } + default: + } + if (te3(a7) | 0) + return a7 << 16 >> 16 != 46 | (de3(t3) | 0) | 0; + a7 = 0; + } else + a7 = 1; + while (false); + return a7 | 0; + } + f2(Oe2, "x"); + function yt(t3) { + t3 = t3 | 0; + var a7 = 0, h3 = 0, l3 = 0, w4 = 0; + return h3 = E6, E6 = E6 + 16 | 0, l3 = h3, r3[l3 >> 2] = 0, r3[66] = t3, a7 = r3[3] | 0, w4 = a7 + (t3 << 1) | 0, t3 = w4 + 2 | 0, d5[w4 >> 1] = 0, r3[l3 >> 2] = t3, r3[67] = t3, r3[59] = 0, r3[63] = 0, r3[61] = 0, r3[60] = 0, r3[65] = 0, r3[62] = 0, E6 = h3, a7 | 0; + } + f2(yt, "S"); + function B3(t3, a7, h3, l3) { + t3 = t3 | 0, a7 = a7 | 0, h3 = h3 | 0, l3 = l3 | 0; + var w4 = 0, m8 = 0; + w4 = r3[67] | 0, r3[67] = w4 + 20, m8 = r3[65] | 0, r3[(m8 | 0 ? m8 + 16 | 0 : 240) >> 2] = w4, r3[65] = w4, r3[w4 >> 2] = t3, r3[w4 + 4 >> 2] = a7, r3[w4 + 8 >> 2] = h3, r3[w4 + 12 >> 2] = l3, r3[w4 + 16 >> 2] = 0, b3[803] = 1; + } + f2(B3, "O"); + function O4(t3, a7, h3) { + t3 = t3 | 0, a7 = a7 | 0, h3 = h3 | 0; + var l3 = 0, w4 = 0; + return l3 = t3 + (0 - h3 << 1) | 0, w4 = l3 + 2 | 0, t3 = r3[3] | 0, w4 >>> 0 >= t3 >>> 0 && !(A3(w4, a7, h3 << 1) | 0) ? (w4 | 0) == (t3 | 0) ? t3 = 1 : t3 = Oe2(l3) | 0 : t3 = 0, t3 | 0; + } + f2(O4, "$"); + function Ct(t3) { + switch (t3 = t3 | 0, d5[t3 >> 1] | 0) { + case 107: { + t3 = O4(t3 + -2 | 0, 150, 4) | 0; + break; + } + case 101: { + (d5[t3 + -2 >> 1] | 0) == 117 ? t3 = O4(t3 + -4 | 0, 122, 6) | 0 : t3 = 0; + break; + } + default: + t3 = 0; + } + return t3 | 0; + } + f2(Ct, "j"); + function q2(t3, a7) { + t3 = t3 | 0, a7 = a7 | 0; + var h3 = 0; + return h3 = r3[3] | 0, h3 >>> 0 <= t3 >>> 0 && (d5[t3 >> 1] | 0) == a7 << 16 >> 16 ? (h3 | 0) == (t3 | 0) ? h3 = 1 : h3 = he2(d5[t3 + -2 >> 1] | 0) | 0 : h3 = 0, h3 | 0; + } + f2(q2, "B"); + function he2(t3) { + t3 = t3 | 0; + e: + do + if ((t3 + -9 & 65535) < 5) + t3 = 1; + else { + switch (t3 << 16 >> 16) { + case 32: + case 160: { + t3 = 1; + break e; + } + default: + } + t3 = t3 << 16 >> 16 != 46 & (te3(t3) | 0); + } + while (false); + return t3 | 0; + } + f2(he2, "E"); + function fe2() { + var t3 = 0, a7 = 0, h3 = 0; + t3 = r3[73] | 0, h3 = r3[72] | 0; + e: + for (; a7 = h3 + 2 | 0, !(h3 >>> 0 >= t3 >>> 0); ) + switch (d5[a7 >> 1] | 0) { + case 13: + case 10: + break e; + default: + h3 = a7; + } + r3[72] = a7; + } + f2(fe2, "P"); + function j2(t3) { + for (t3 = t3 | 0; !(P3(t3) | 0 || te3(t3) | 0); ) + if (t3 = (r3[72] | 0) + 2 | 0, r3[72] = t3, t3 = d5[t3 >> 1] | 0, !(t3 << 16 >> 16)) { + t3 = 0; break; - case "newline": - this.onKeyLine = false; - // fallthrough - case "space": - case "comment": + } + return t3 | 0; + } + f2(j2, "q"); + function St() { + var t3 = 0; + switch (t3 = r3[(r3[61] | 0) + 20 >> 2] | 0, t3 | 0) { + case 1: { + t3 = -1; + break; + } + case 2: { + t3 = -2; + break; + } default: - if (token.end) - token.end.push(this.sourceToken); - else - token.end = [this.sourceToken]; - if (this.type === "newline") - yield* this.pop(); - } + t3 = t3 - (r3[3] | 0) >> 1; + } + return t3 | 0; + } + f2(St, "z"); + function xt(t3) { + return t3 = t3 | 0, !(O4(t3, 196, 5) | 0) && !(O4(t3, 44, 3) | 0) ? t3 = O4(t3, 206, 2) | 0 : t3 = 1, t3 | 0; + } + f2(xt, "D"); + function ne2(t3) { + switch (t3 = t3 | 0, t3 << 16 >> 16) { + case 160: + case 32: + case 12: + case 11: + case 9: { + t3 = 1; + break; + } + default: + t3 = 0; + } + return t3 | 0; + } + f2(ne2, "F"); + function de3(t3) { + return t3 = t3 | 0, (d5[t3 >> 1] | 0) == 46 && (d5[t3 + -2 >> 1] | 0) == 46 ? t3 = (d5[t3 + -4 >> 1] | 0) == 46 : t3 = 0, t3 | 0; + } + f2(de3, "G"); + function z3(t3) { + return t3 = t3 | 0, (r3[3] | 0) == (t3 | 0) ? t3 = 1 : t3 = Oe2(t3 + -2 | 0) | 0, t3 | 0; + } + f2(z3, "H"); + function vt() { + var t3 = 0; + return t3 = r3[(r3[62] | 0) + 12 >> 2] | 0, t3 ? t3 = t3 - (r3[3] | 0) >> 1 : t3 = -1, t3 | 0; + } + f2(vt, "J"); + function _t() { + var t3 = 0; + return t3 = r3[(r3[61] | 0) + 12 >> 2] | 0, t3 ? t3 = t3 - (r3[3] | 0) >> 1 : t3 = -1, t3 | 0; + } + f2(_t, "K"); + function Et() { + var t3 = 0; + return t3 = r3[(r3[62] | 0) + 8 >> 2] | 0, t3 ? t3 = t3 - (r3[3] | 0) >> 1 : t3 = -1, t3 | 0; + } + f2(Et, "L"); + function Lt() { + var t3 = 0; + return t3 = r3[(r3[61] | 0) + 16 >> 2] | 0, t3 ? t3 = t3 - (r3[3] | 0) >> 1 : t3 = -1, t3 | 0; + } + f2(Lt, "M"); + function Ot() { + var t3 = 0; + return t3 = r3[(r3[61] | 0) + 4 >> 2] | 0, t3 ? t3 = t3 - (r3[3] | 0) >> 1 : t3 = -1, t3 | 0; + } + f2(Ot, "N"); + function Rt() { + var t3 = 0; + return t3 = r3[61] | 0, t3 = r3[(t3 | 0 ? t3 + 32 | 0 : 236) >> 2] | 0, r3[61] = t3, (t3 | 0) != 0 | 0; + } + f2(Rt, "Q"); + function At() { + var t3 = 0; + return t3 = r3[62] | 0, t3 = r3[(t3 | 0 ? t3 + 16 | 0 : 240) >> 2] | 0, r3[62] = t3, (t3 | 0) != 0 | 0; + } + f2(At, "R"); + function M3() { + b3[802] = 1, r3[68] = (r3[72] | 0) - (r3[3] | 0) >> 1, r3[72] = (r3[73] | 0) + 2; + } + f2(M3, "T"); + function P3(t3) { + return t3 = t3 | 0, (t3 | 128) << 16 >> 16 == 160 | (t3 + -9 & 65535) < 5 | 0; + } + f2(P3, "V"); + function H3(t3) { + return t3 = t3 | 0, t3 << 16 >> 16 == 39 | t3 << 16 >> 16 == 34 | 0; + } + f2(H3, "W"); + function Nt() { + return (r3[(r3[61] | 0) + 8 >> 2] | 0) - (r3[3] | 0) >> 1 | 0; + } + f2(Nt, "X"); + function It() { + return (r3[(r3[62] | 0) + 4 >> 2] | 0) - (r3[3] | 0) >> 1 | 0; + } + f2(It, "Y"); + function Re2(t3) { + return t3 = t3 | 0, t3 << 16 >> 16 == 13 | t3 << 16 >> 16 == 10 | 0; + } + f2(Re2, "Z"); + function Mt() { + return (r3[r3[61] >> 2] | 0) - (r3[3] | 0) >> 1 | 0; + } + f2(Mt, "_"); + function $t() { + return (r3[r3[62] >> 2] | 0) - (r3[3] | 0) >> 1 | 0; + } + f2($t, "ee"); + function Ut() { + return R6[(r3[61] | 0) + 24 >> 0] | 0 | 0; + } + f2(Ut, "ae"); + function jt(t3) { + t3 = t3 | 0, r3[3] = t3; + } + f2(jt, "re"); + function Dt() { + return r3[(r3[61] | 0) + 28 >> 2] | 0; + } + f2(Dt, "ie"); + function Tt() { + return (b3[803] | 0) != 0 | 0; + } + f2(Tt, "se"); + function Ft() { + return (b3[804] | 0) != 0 | 0; + } + f2(Ft, "fe"); + function Wt() { + return r3[68] | 0; + } + f2(Wt, "te"); + function Bt(t3) { + return t3 = t3 | 0, E6 = t3 + 992 + 15 & -16, 992; + } + return f2(Bt, "ce"), { su: Bt, ai: Lt, e: Wt, ee: It, ele: vt, els: Et, es: $t, f: Ft, id: St, ie: Ot, ip: Ut, is: Mt, it: Dt, ms: Tt, p: N2, re: At, ri: Rt, sa: yt, se: _t, ses: jt, ss: Nt }; + }(typeof self < "u" ? self : global, {}, re2), ke2 = v2.su(Z2 - (2 << 17)); + } + const i6 = _2.length + 1; + v2.ses(ke2), v2.sa(i6 - 1), Fe2(_2, new Uint16Array(re2, ke2, i6)), v2.p() || (y = v2.e(), D()); + const o8 = [], c3 = []; + for (; v2.ri(); ) { + const u5 = v2.is(), p5 = v2.ie(), g2 = v2.ai(), b3 = v2.id(), d5 = v2.ss(), r3 = v2.se(), R6 = v2.it(); + let L3; + v2.ip() && (L3 = ye(b3 === -1 ? u5 : u5 + 1, _2.charCodeAt(b3 === -1 ? u5 - 1 : u5))), o8.push({ t: R6, n: L3, s: u5, e: p5, ss: d5, se: r3, d: b3, a: g2 }); + } + for (; v2.re(); ) { + const u5 = v2.es(), p5 = v2.ee(), g2 = v2.els(), b3 = v2.ele(), d5 = _2.charCodeAt(u5), r3 = g2 >= 0 ? _2.charCodeAt(g2) : -1; + c3.push({ s: u5, e: p5, ls: g2, le: b3, n: d5 === 34 || d5 === 39 ? ye(u5 + 1, d5) : _2.slice(u5, p5), ln: g2 < 0 ? void 0 : r3 === 34 || r3 === 39 ? ye(g2 + 1, r3) : _2.slice(g2, b3) }); + } + return [o8, c3, !!v2.f(), !!v2.ms()]; +} +f2(fn, "parse"); +function ye(s5, e5) { + y = s5; + let n3 = "", i6 = y; + for (; ; ) { + y >= _2.length && D(); + const o8 = _2.charCodeAt(y); + if (o8 === e5) + break; + o8 === 92 ? (n3 += _2.slice(i6, y), n3 += dn(), i6 = y) : (o8 === 8232 || o8 === 8233 || Be2(o8) && D(), ++y); + } + return n3 += _2.slice(i6, y++), n3; +} +f2(ye, "b"); +function dn() { + let s5 = _2.charCodeAt(++y); + switch (++y, s5) { + case 110: + return ` +`; + case 114: + return "\r"; + case 120: + return String.fromCharCode(Ce2(2)); + case 117: + return function() { + const e5 = _2.charCodeAt(y); + let n3; + return e5 === 123 ? (++y, n3 = Ce2(_2.indexOf("}", y) - y), ++y, n3 > 1114111 && D()) : n3 = Ce2(4), n3 <= 65535 ? String.fromCharCode(n3) : (n3 -= 65536, String.fromCharCode(55296 + (n3 >> 10), 56320 + (1023 & n3))); + }(); + case 116: + return " "; + case 98: + return "\b"; + case 118: + return "\v"; + case 102: + return "\f"; + case 13: + _2.charCodeAt(y) === 10 && ++y; + case 10: + return ""; + case 56: + case 57: + D(); + default: + if (s5 >= 48 && s5 <= 55) { + let e5 = _2.substr(y - 1, 3).match(/^[0-7]+/)[0], n3 = parseInt(e5, 8); + return n3 > 255 && (e5 = e5.slice(0, -1), n3 = parseInt(e5, 8)), y += e5.length - 1, s5 = _2.charCodeAt(y), e5 === "0" && s5 !== 56 && s5 !== 57 || D(), String.fromCharCode(n3); + } + return Be2(s5) ? "" : String.fromCharCode(s5); + } +} +f2(dn, "k"); +function Ce2(s5) { + const e5 = y; + let n3 = 0, i6 = 0; + for (let o8 = 0; o8 < s5; ++o8, ++y) { + let c3, u5 = _2.charCodeAt(y); + if (u5 !== 95) { + if (u5 >= 97) + c3 = u5 - 97 + 10; + else if (u5 >= 65) + c3 = u5 - 65 + 10; + else { + if (!(u5 >= 48 && u5 <= 57)) + break; + c3 = u5 - 48; } - }; - exports.Parser = Parser; + if (c3 >= 16) + break; + i6 = u5, n3 = 16 * n3 + c3; + } else + i6 !== 95 && o8 !== 0 || D(), i6 = u5; } -}); - -// -var require_public_api = __commonJS({ - ""(exports) { - "use strict"; - var composer = require_composer(); - var Document = require_Document(); - var errors = require_errors(); - var log = require_log(); - var identity = require_identity(); - var lineCounter = require_line_counter(); - var parser = require_parser(); - function parseOptions(options) { - const prettyErrors = options.prettyErrors !== false; - const lineCounter$1 = options.lineCounter || prettyErrors && new lineCounter.LineCounter() || null; - return { lineCounter: lineCounter$1, prettyErrors }; + return i6 !== 95 && y - e5 === s5 || D(), n3; +} +f2(Ce2, "l"); +function Be2(s5) { + return s5 === 13 || s5 === 10; +} +f2(Be2, "u"); +function D() { + throw Object.assign(Error(`Parse error ${We2}:${_2.slice(0, y).split(` +`).length}:${y - _2.lastIndexOf(` +`, y - 1)}`), { idx: y }); +} +f2(D, "o"); +var Se2; +typeof WebAssembly < "u" && (async () => { + const { parse: s5, init: e5 } = await Promise.resolve().then(() => (init_lexer_DQCqS3nf(), lexer_DQCqS3nf_exports)); + await e5, Se2 = s5; +})(); +var Pe2 = f2((s5, e5) => Se2 ? Se2(s5, e5) : fn(s5, e5), "parseEsm"); +var gn = f2((s5) => { + if (!s5.includes("import") && !s5.includes("export")) + return false; + try { + return Pe2(s5)[3]; + } catch { + return true; + } +}, "isESM"); +var Je2 = "2"; +var bn = ((s5) => { + const e5 = "default"; + return s5[e5] && typeof s5[e5] == "object" && "__esModule" in s5[e5] ? s5[e5] : s5; +}).toString(); +var pn = `.then(${bn})`; +var xe2 = f2((s5, e5, n3) => { + if (n3) { + if (!e5.includes("import(")) + return; + } else if (!e5.includes("import")) + return; + const o8 = Pe2(e5, s5)[0].filter((g2) => g2.d > -1); + if (o8.length === 0) + return; + const c3 = new _e(e5); + for (const g2 of o8) + c3.appendRight(g2.se, pn); + const u5 = c3.toString(), p5 = c3.generateMap({ source: s5, includeContent: false, hires: "boundary" }); + return { code: u5, map: p5 }; +}, "transformDynamicImport"); +var Ge2 = f2((s5) => { + try { + const e5 = U2.readFileSync(s5, "utf8"); + return JSON.parse(e5); + } catch { + } +}, "readJsonFile"); +var qe2 = f2(() => { +}, "noop"); +var ze2 = f2(() => Math.floor(Date.now() / 1e8), "getTime"); +var wn = class extends Map { + static { + f2(this, "FileCache"); + } + cacheDirectory = e; + oldCacheDirectory = X2.join(Xt.tmpdir(), "tsx"); + cacheFiles; + constructor() { + super(), U2.mkdirSync(this.cacheDirectory, { recursive: true }), this.cacheFiles = U2.readdirSync(this.cacheDirectory).map((e5) => { + const [n3, i6] = e5.split("-"); + return { time: Number(n3), key: i6, fileName: e5 }; + }), setImmediate(() => { + this.expireDiskCache(), this.removeOldCacheDirectory(); + }); + } + get(e5) { + const n3 = super.get(e5); + if (n3) + return n3; + const i6 = this.cacheFiles.find((u5) => u5.key === e5); + if (!i6) + return; + const o8 = X2.join(this.cacheDirectory, i6.fileName), c3 = Ge2(o8); + if (!c3) { + U2.promises.unlink(o8).then(() => { + const u5 = this.cacheFiles.indexOf(i6); + this.cacheFiles.splice(u5, 1); + }, () => { + }); + return; } - function parseAllDocuments(source, options = {}) { - const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options); - const parser$1 = new parser.Parser(lineCounter2?.addNewLine); - const composer$1 = new composer.Composer(options); - const docs = Array.from(composer$1.compose(parser$1.parse(source))); - if (prettyErrors && lineCounter2) - for (const doc of docs) { - doc.errors.forEach(errors.prettifyError(source, lineCounter2)); - doc.warnings.forEach(errors.prettifyError(source, lineCounter2)); - } - if (docs.length > 0) - return docs; - return Object.assign([], { empty: true }, composer$1.streamInfo()); + return super.set(e5, c3), c3; + } + set(e5, n3) { + if (super.set(e5, n3), n3) { + const i6 = ze2(); + U2.promises.writeFile(X2.join(this.cacheDirectory, `${i6}-${e5}`), JSON.stringify(n3)).catch(qe2); } - function parseDocument(source, options = {}) { - const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options); - const parser$1 = new parser.Parser(lineCounter2?.addNewLine); - const composer$1 = new composer.Composer(options); - let doc = null; - for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) { - if (!doc) - doc = _doc; - else if (doc.options.logLevel !== "silent") { - doc.errors.push(new errors.YAMLParseError(_doc.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()")); - break; - } - } - if (prettyErrors && lineCounter2) { - doc.errors.forEach(errors.prettifyError(source, lineCounter2)); - doc.warnings.forEach(errors.prettifyError(source, lineCounter2)); - } - return doc; + return this; + } + expireDiskCache() { + const e5 = ze2(); + for (const n3 of this.cacheFiles) + e5 - n3.time > 7 && U2.promises.unlink(X2.join(this.cacheDirectory, n3.fileName)).catch(qe2); + } + async removeOldCacheDirectory() { + try { + await U2.promises.access(this.oldCacheDirectory).then(() => true) && ("rm" in U2.promises ? await U2.promises.rm(this.oldCacheDirectory, { recursive: true, force: true }) : await U2.promises.rmdir(this.oldCacheDirectory, { recursive: true })); + } catch { } - function parse2(src, reviver, options) { - let _reviver = void 0; - if (typeof reviver === "function") { - _reviver = reviver; - } else if (options === void 0 && reviver && typeof reviver === "object") { - options = reviver; - } - const doc = parseDocument(src, options); - if (!doc) - return null; - doc.warnings.forEach((warning) => log.warn(doc.options.logLevel, warning)); - if (doc.errors.length > 0) { - if (doc.options.logLevel !== "silent") - throw doc.errors[0]; - else - doc.errors = []; - } - return doc.toJS(Object.assign({ reviver: _reviver }, options)); + } +}; +var ie2 = process.env.TSX_DISABLE_CACHE ? /* @__PURE__ */ new Map() : new wn(); +var mn = /^[\w+.-]+:\/\//; +var kn = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/; +var yn = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i; +function Cn(s5) { + return mn.test(s5); +} +f2(Cn, "isAbsoluteUrl"); +function Sn(s5) { + return s5.startsWith("//"); +} +f2(Sn, "isSchemeRelativeUrl"); +function He2(s5) { + return s5.startsWith("/"); +} +f2(He2, "isAbsolutePath"); +function xn(s5) { + return s5.startsWith("file:"); +} +f2(xn, "isFileUrl"); +function Xe2(s5) { + return /^[.?#]/.test(s5); +} +f2(Xe2, "isRelative"); +function se(s5) { + const e5 = kn.exec(s5); + return Ke2(e5[1], e5[2] || "", e5[3], e5[4] || "", e5[5] || "/", e5[6] || "", e5[7] || ""); +} +f2(se, "parseAbsoluteUrl"); +function vn(s5) { + const e5 = yn.exec(s5), n3 = e5[2]; + return Ke2("file:", "", e5[1] || "", "", He2(n3) ? n3 : "/" + n3, e5[3] || "", e5[4] || ""); +} +f2(vn, "parseFileUrl"); +function Ke2(s5, e5, n3, i6, o8, c3, u5) { + return { scheme: s5, user: e5, host: n3, port: i6, path: o8, query: c3, hash: u5, type: 7 }; +} +f2(Ke2, "makeUrl"); +function Ye2(s5) { + if (Sn(s5)) { + const n3 = se("http:" + s5); + return n3.scheme = "", n3.type = 6, n3; + } + if (He2(s5)) { + const n3 = se("http://foo.com" + s5); + return n3.scheme = "", n3.host = "", n3.type = 5, n3; + } + if (xn(s5)) + return vn(s5); + if (Cn(s5)) + return se(s5); + const e5 = se("http://foo.com/" + s5); + return e5.scheme = "", e5.host = "", e5.type = s5 ? s5.startsWith("?") ? 3 : s5.startsWith("#") ? 2 : 4 : 1, e5; +} +f2(Ye2, "parseUrl"); +function _n(s5) { + if (s5.endsWith("/..")) + return s5; + const e5 = s5.lastIndexOf("/"); + return s5.slice(0, e5 + 1); +} +f2(_n, "stripPathFilename"); +function En(s5, e5) { + Qe2(e5, e5.type), s5.path === "/" ? s5.path = e5.path : s5.path = _n(e5.path) + s5.path; +} +f2(En, "mergePaths"); +function Qe2(s5, e5) { + const n3 = e5 <= 4, i6 = s5.path.split("/"); + let o8 = 1, c3 = 0, u5 = false; + for (let g2 = 1; g2 < i6.length; g2++) { + const b3 = i6[g2]; + if (!b3) { + u5 = true; + continue; } - function stringify(value, replacer, options) { - let _replacer = null; - if (typeof replacer === "function" || Array.isArray(replacer)) { - _replacer = replacer; - } else if (options === void 0 && replacer) { - options = replacer; - } - if (typeof options === "string") - options = options.length; - if (typeof options === "number") { - const indent = Math.round(options); - options = indent < 1 ? void 0 : indent > 8 ? { indent: 8 } : { indent }; + if (u5 = false, b3 !== ".") { + if (b3 === "..") { + c3 ? (u5 = true, c3--, o8--) : n3 && (i6[o8++] = b3); + continue; } - if (value === void 0) { - const { keepUndefined } = options ?? replacer ?? {}; - if (!keepUndefined) - return void 0; + i6[o8++] = b3, c3++; + } + } + let p5 = ""; + for (let g2 = 1; g2 < o8; g2++) + p5 += "/" + i6[g2]; + (!p5 || u5 && !p5.endsWith("/..")) && (p5 += "/"), s5.path = p5; +} +f2(Qe2, "normalizePath"); +function Ln(s5, e5) { + if (!s5 && !e5) + return ""; + const n3 = Ye2(s5); + let i6 = n3.type; + if (e5 && i6 !== 7) { + const c3 = Ye2(e5), u5 = c3.type; + switch (i6) { + case 1: + n3.hash = c3.hash; + case 2: + n3.query = c3.query; + case 3: + case 4: + En(n3, c3); + case 5: + n3.user = c3.user, n3.host = c3.host, n3.port = c3.port; + case 6: + n3.scheme = c3.scheme; + } + u5 > i6 && (i6 = u5); + } + Qe2(n3, i6); + const o8 = n3.query + n3.hash; + switch (i6) { + case 2: + case 3: + return o8; + case 4: { + const c3 = n3.path.slice(1); + return c3 ? Xe2(e5 || s5) && !Xe2(c3) ? "./" + c3 + o8 : c3 + o8 : o8 || "."; + } + case 5: + return n3.path + o8; + default: + return n3.scheme + "//" + n3.user + n3.host + n3.port + n3.path + o8; + } +} +f2(Ln, "resolve$1"); +function Ze2(s5, e5) { + return e5 && !e5.endsWith("/") && (e5 += "/"), Ln(s5, e5); +} +f2(Ze2, "resolve"); +function On(s5) { + if (!s5) + return ""; + const e5 = s5.lastIndexOf("/"); + return s5.slice(0, e5 + 1); +} +f2(On, "stripFilename"); +var F2 = 0; +function Rn(s5, e5) { + const n3 = Ve2(s5, 0); + if (n3 === s5.length) + return s5; + e5 || (s5 = s5.slice()); + for (let i6 = n3; i6 < s5.length; i6 = Ve2(s5, i6 + 1)) + s5[i6] = Nn(s5[i6], e5); + return s5; +} +f2(Rn, "maybeSort"); +function Ve2(s5, e5) { + for (let n3 = e5; n3 < s5.length; n3++) + if (!An(s5[n3])) + return n3; + return s5.length; +} +f2(Ve2, "nextUnsortedSegmentLine"); +function An(s5) { + for (let e5 = 1; e5 < s5.length; e5++) + if (s5[e5][F2] < s5[e5 - 1][F2]) + return false; + return true; +} +f2(An, "isSorted"); +function Nn(s5, e5) { + return e5 || (s5 = s5.slice()), s5.sort(In); +} +f2(Nn, "sortSegments"); +function In(s5, e5) { + return s5[F2] - e5[F2]; +} +f2(In, "sortComparator"); +var oe2 = false; +function Mn(s5, e5, n3, i6) { + for (; n3 <= i6; ) { + const o8 = n3 + (i6 - n3 >> 1), c3 = s5[o8][F2] - e5; + if (c3 === 0) + return oe2 = true, o8; + c3 < 0 ? n3 = o8 + 1 : i6 = o8 - 1; + } + return oe2 = false, n3 - 1; +} +f2(Mn, "binarySearch"); +function $n(s5, e5, n3) { + for (let i6 = n3 - 1; i6 >= 0 && s5[i6][F2] === e5; n3 = i6--) + ; + return n3; +} +f2($n, "lowerBound"); +function Un() { + return { lastKey: -1, lastNeedle: -1, lastIndex: -1 }; +} +f2(Un, "memoizedState"); +function jn(s5, e5, n3, i6) { + const { lastKey: o8, lastNeedle: c3, lastIndex: u5 } = n3; + let p5 = 0, g2 = s5.length - 1; + if (i6 === o8) { + if (e5 === c3) + return oe2 = u5 !== -1 && s5[u5][F2] === e5, u5; + e5 >= c3 ? p5 = u5 === -1 ? 0 : u5 : g2 = u5; + } + return n3.lastKey = i6, n3.lastNeedle = e5, n3.lastIndex = Mn(s5, e5, p5, g2); +} +f2(jn, "memoizedBinarySearch"); +var et = class { + static { + f2(this, "TraceMap"); + } + constructor(e5, n3) { + const i6 = typeof e5 == "string"; + if (!i6 && e5._decodedMemo) + return e5; + const o8 = i6 ? JSON.parse(e5) : e5, { version: c3, file: u5, names: p5, sourceRoot: g2, sources: b3, sourcesContent: d5 } = o8; + this.version = c3, this.file = u5, this.names = p5 || [], this.sourceRoot = g2, this.sources = b3, this.sourcesContent = d5, this.ignoreList = o8.ignoreList || o8.x_google_ignoreList || void 0; + const r3 = Ze2(g2 || "", On(n3)); + this.resolvedSources = b3.map((L3) => Ze2(L3 || "", r3)); + const { mappings: R6 } = o8; + typeof R6 == "string" ? (this._encoded = R6, this._decoded = void 0) : (this._encoded = void 0, this._decoded = Rn(R6, i6)), this._decodedMemo = Un(), this._bySources = void 0, this._bySourceMemos = void 0; + } +}; +function vr(s5) { + return s5; +} +f2(vr, "cast$2"); +function tt(s5) { + var e5; + return (e5 = s5)._decoded || (e5._decoded = Qt(s5._encoded)); +} +f2(tt, "decodedMappings"); +function Dn(s5, e5, n3) { + const i6 = tt(s5); + if (e5 >= i6.length) + return null; + const o8 = i6[e5], c3 = Tn(o8, s5._decodedMemo, e5, n3); + return c3 === -1 ? null : o8[c3]; +} +f2(Dn, "traceSegment"); +function Tn(s5, e5, n3, i6, o8) { + let c3 = jn(s5, i6, e5, n3); + return oe2 && (c3 = $n(s5, i6, c3)), c3 === -1 || c3 === s5.length ? -1 : c3; +} +f2(Tn, "traceSegmentInternal"); +var ve2 = class { + static { + f2(this, "SetArray"); + } + constructor() { + this._indexes = { __proto__: null }, this.array = []; + } +}; +function _r(s5) { + return s5; +} +f2(_r, "cast$1"); +function nt(s5, e5) { + return s5._indexes[e5]; +} +f2(nt, "get"); +function V2(s5, e5) { + const n3 = nt(s5, e5); + if (n3 !== void 0) + return n3; + const { array: i6, _indexes: o8 } = s5, c3 = i6.push(e5); + return o8[e5] = c3 - 1; +} +f2(V2, "put"); +function Fn(s5, e5) { + const n3 = nt(s5, e5); + if (n3 === void 0) + return; + const { array: i6, _indexes: o8 } = s5; + for (let c3 = n3 + 1; c3 < i6.length; c3++) { + const u5 = i6[c3]; + i6[c3 - 1] = u5, o8[u5]--; + } + o8[e5] = void 0, i6.pop(); +} +f2(Fn, "remove"); +var Wn = 0; +var Bn = 1; +var Pn = 2; +var Jn = 3; +var Gn = 4; +var rt = -1; +var qn = class { + static { + f2(this, "GenMapping"); + } + constructor({ file: e5, sourceRoot: n3 } = {}) { + this._names = new ve2(), this._sources = new ve2(), this._sourcesContent = [], this._mappings = [], this.file = e5, this.sourceRoot = n3, this._ignoreList = new ve2(); + } +}; +function Er(s5) { + return s5; +} +f2(Er, "cast"); +var zn = f2((s5, e5, n3, i6, o8, c3, u5, p5) => Yn(true, s5, e5, n3, i6, o8, c3, u5), "maybeAddSegment"); +function Hn(s5, e5, n3) { + const { _sources: i6, _sourcesContent: o8 } = s5, c3 = V2(i6, e5); + o8[c3] = n3; +} +f2(Hn, "setSourceContent"); +function Xn(s5, e5, n3 = true) { + const { _sources: i6, _sourcesContent: o8, _ignoreList: c3 } = s5, u5 = V2(i6, e5); + u5 === o8.length && (o8[u5] = null), n3 ? V2(c3, u5) : Fn(c3, u5); +} +f2(Xn, "setIgnore"); +function it(s5) { + const { _mappings: e5, _sources: n3, _sourcesContent: i6, _names: o8, _ignoreList: c3 } = s5; + return Vn(e5), { version: 3, file: s5.file || void 0, names: o8.array, sourceRoot: s5.sourceRoot || void 0, sources: n3.array, sourcesContent: i6, mappings: e5, ignoreList: c3.array }; +} +f2(it, "toDecodedMap"); +function Kn(s5) { + const e5 = it(s5); + return Object.assign(Object.assign({}, e5), { mappings: De(e5.mappings) }); +} +f2(Kn, "toEncodedMap"); +function Yn(s5, e5, n3, i6, o8, c3, u5, p5, g2) { + const { _mappings: b3, _sources: d5, _sourcesContent: r3, _names: R6 } = e5, L3 = Qn(b3, n3), E6 = Zn(L3, i6); + if (!o8) + return er(L3, E6) ? void 0 : st(L3, E6, [i6]); + const N2 = V2(d5, o8), $3 = p5 ? V2(R6, p5) : rt; + if (N2 === r3.length && (r3[N2] = null), !tr(L3, E6, N2, c3, u5, $3)) + return st(L3, E6, p5 ? [i6, N2, c3, u5, $3] : [i6, N2, c3, u5]); +} +f2(Yn, "addSegmentInternal"); +function Qn(s5, e5) { + for (let n3 = s5.length; n3 <= e5; n3++) + s5[n3] = []; + return s5[e5]; +} +f2(Qn, "getLine"); +function Zn(s5, e5) { + let n3 = s5.length; + for (let i6 = n3 - 1; i6 >= 0; n3 = i6--) { + const o8 = s5[i6]; + if (e5 >= o8[Wn]) + break; + } + return n3; +} +f2(Zn, "getColumnIndex"); +function st(s5, e5, n3) { + for (let i6 = s5.length; i6 > e5; i6--) + s5[i6] = s5[i6 - 1]; + s5[e5] = n3; +} +f2(st, "insert"); +function Vn(s5) { + const { length: e5 } = s5; + let n3 = e5; + for (let i6 = n3 - 1; i6 >= 0 && !(s5[i6].length > 0); n3 = i6, i6--) + ; + n3 < e5 && (s5.length = n3); +} +f2(Vn, "removeEmptyFinalLines"); +function er(s5, e5) { + return e5 === 0 ? true : s5[e5 - 1].length === 1; +} +f2(er, "skipSourceless"); +function tr(s5, e5, n3, i6, o8, c3) { + if (e5 === 0) + return false; + const u5 = s5[e5 - 1]; + return u5.length === 1 ? false : n3 === u5[Bn] && i6 === u5[Pn] && o8 === u5[Jn] && c3 === (u5.length === 5 ? u5[Gn] : rt); +} +f2(tr, "skipSource"); +var ot = at("", -1, -1, "", null, false); +var nr = []; +function at(s5, e5, n3, i6, o8, c3) { + return { source: s5, line: e5, column: n3, name: i6, content: o8, ignore: c3 }; +} +f2(at, "SegmentObject"); +function ct(s5, e5, n3, i6, o8) { + return { map: s5, sources: e5, source: n3, content: i6, ignore: o8 }; +} +f2(ct, "Source"); +function ut(s5, e5) { + return ct(s5, e5, "", null, false); +} +f2(ut, "MapSource"); +function rr(s5, e5, n3) { + return ct(null, nr, s5, e5, n3); +} +f2(rr, "OriginalSource"); +function ir(s5) { + const e5 = new qn({ file: s5.map.file }), { sources: n3, map: i6 } = s5, o8 = i6.names, c3 = tt(i6); + for (let u5 = 0; u5 < c3.length; u5++) { + const p5 = c3[u5]; + for (let g2 = 0; g2 < p5.length; g2++) { + const b3 = p5[g2], d5 = b3[0]; + let r3 = ot; + if (b3.length !== 1) { + const G4 = n3[b3[1]]; + if (r3 = lt(G4, b3[2], b3[3], b3.length === 5 ? o8[b3[4]] : ""), r3 == null) + continue; } - if (identity.isDocument(value) && !_replacer) - return value.toString(options); - return new Document.Document(value, _replacer, options).toString(options); + const { column: R6, line: L3, name: E6, content: N2, source: $3, ignore: W2 } = r3; + zn(e5, u5, d5, $3, L3, R6, E6), $3 && N2 != null && Hn(e5, $3, N2), W2 && Xn(e5, $3, true); } - exports.parse = parse2; - exports.parseAllDocuments = parseAllDocuments; - exports.parseDocument = parseDocument; - exports.stringify = stringify; } -}); - -// -var require_dist2 = __commonJS({ - ""(exports) { - "use strict"; - var composer = require_composer(); - var Document = require_Document(); - var Schema = require_Schema(); - var errors = require_errors(); - var Alias = require_Alias(); - var identity = require_identity(); - var Pair = require_Pair(); - var Scalar = require_Scalar(); - var YAMLMap = require_YAMLMap(); - var YAMLSeq = require_YAMLSeq(); - var cst = require_cst(); - var lexer = require_lexer(); - var lineCounter = require_line_counter(); - var parser = require_parser(); - var publicApi = require_public_api(); - var visit = require_visit(); - exports.Composer = composer.Composer; - exports.Document = Document.Document; - exports.Schema = Schema.Schema; - exports.YAMLError = errors.YAMLError; - exports.YAMLParseError = errors.YAMLParseError; - exports.YAMLWarning = errors.YAMLWarning; - exports.Alias = Alias.Alias; - exports.isAlias = identity.isAlias; - exports.isCollection = identity.isCollection; - exports.isDocument = identity.isDocument; - exports.isMap = identity.isMap; - exports.isNode = identity.isNode; - exports.isPair = identity.isPair; - exports.isScalar = identity.isScalar; - exports.isSeq = identity.isSeq; - exports.Pair = Pair.Pair; - exports.Scalar = Scalar.Scalar; - exports.YAMLMap = YAMLMap.YAMLMap; - exports.YAMLSeq = YAMLSeq.YAMLSeq; - exports.CST = cst; - exports.Lexer = lexer.Lexer; - exports.LineCounter = lineCounter.LineCounter; - exports.Parser = parser.Parser; - exports.parse = publicApi.parse; - exports.parseAllDocuments = publicApi.parseAllDocuments; - exports.parseDocument = publicApi.parseDocument; - exports.stringify = publicApi.stringify; - exports.visit = visit.visit; - exports.visitAsync = visit.visitAsync; + return e5; +} +f2(ir, "traceMappings"); +function lt(s5, e5, n3, i6) { + if (!s5.map) + return at(s5.source, e5, n3, i6, s5.content, s5.ignore); + const o8 = Dn(s5.map, e5, n3); + return o8 == null ? null : o8.length === 1 ? ot : lt(s5.sources[o8[1]], o8[2], o8[3], o8.length === 5 ? s5.map.names[o8[4]] : i6); +} +f2(lt, "originalPositionFor"); +function sr(s5) { + return Array.isArray(s5) ? s5 : [s5]; +} +f2(sr, "asArray"); +function or(s5, e5) { + const n3 = sr(s5).map((c3) => new et(c3, "")), i6 = n3.pop(); + for (let c3 = 0; c3 < n3.length; c3++) + if (n3[c3].sources.length > 1) + throw new Error(`Transformation map ${c3} must have exactly one source file. +Did you specify these with the most recent transformation maps first?`); + let o8 = ht(i6, e5, "", 0); + for (let c3 = n3.length - 1; c3 >= 0; c3--) + o8 = ut(n3[c3], [o8]); + return o8; +} +f2(or, "buildSourceMapTree"); +function ht(s5, e5, n3, i6) { + const { resolvedSources: o8, sourcesContent: c3, ignoreList: u5 } = s5, p5 = i6 + 1, g2 = o8.map((b3, d5) => { + const r3 = { importer: n3, depth: p5, source: b3 || "", content: void 0, ignore: void 0 }, R6 = e5(r3.source, r3), { source: L3, content: E6, ignore: N2 } = r3; + if (R6) + return ht(new et(R6, L3), e5, L3, p5); + const $3 = E6 !== void 0 ? E6 : c3 ? c3[d5] : null, W2 = N2 !== void 0 ? N2 : u5 ? u5.includes(d5) : false; + return rr(L3, $3, W2); + }); + return ut(s5, g2); +} +f2(ht, "build"); +var ar = class { + static { + f2(this, "SourceMap"); } -}); + constructor(e5, n3) { + const i6 = n3.decodedMappings ? it(e5) : Kn(e5); + this.version = i6.version, this.file = i6.file, this.mappings = i6.mappings, this.names = i6.names, this.ignoreList = i6.ignoreList, this.sourceRoot = i6.sourceRoot, this.sources = i6.sources, n3.excludeContent || (this.sourcesContent = i6.sourcesContent); + } + toString() { + return JSON.stringify(this); + } +}; +function ft(s5, e5, n3) { + const i6 = { excludeContent: !!n3, decodedMappings: false }, o8 = or(s5, e5); + return new ar(ir(o8), i6); +} +f2(ft, "remapping"); +var cr = f2((s5, e5, n3) => { + const i6 = [], o8 = { code: e5 }; + for (const c3 of n3) { + const u5 = c3(s5, o8.code); + u5 && (Object.assign(o8, u5), i6.unshift(u5.map)); + } + return { ...o8, map: ft(i6, () => null) }; +}, "applyTransformersSync"); +var ur = f2(async (s5, e5, n3) => { + const i6 = [], o8 = { code: e5 }; + for (const c3 of n3) { + const u5 = await c3(s5, o8.code); + u5 && (Object.assign(o8, u5), i6.unshift(u5.map)); + } + return { ...o8, map: ft(i6, () => null) }; +}, "applyTransformers"); +var lr = Object.freeze({ target: `node${process.versions.node}`, loader: "default" }); +var hr = /^--inspect(?:-brk|-port|-publish-uid|-wait)?(?:=|$)/; +var fr = process.execArgv.some((s5) => hr.test(s5)); +var dt = { ...lr, sourcemap: true, sourcesContent: !!process.env.NODE_V8_COVERAGE || fr, minifyWhitespace: true, keepNames: true }; +var gt = f2((s5) => { + const e5 = s5.sourcefile; + if (e5) { + const n3 = X2.extname(e5.split("?")[0]); + n3 ? n3 === ".cts" || n3 === ".mts" ? s5.sourcefile = `${e5.slice(0, -3)}ts` : n3 === ".mjs" && (s5.sourcefile = `${e5.slice(0, -3)}js`) : s5.sourcefile += ".js"; + } + return (n3) => (n3.map && (s5.sourcefile !== e5 && (n3.map = n3.map.replace(JSON.stringify(s5.sourcefile), JSON.stringify(e5))), n3.map = JSON.parse(n3.map)), n3); +}, "patchOptions"); +var bt = f2((s5) => { + throw s5.name = "TransformError", delete s5.errors, delete s5.warnings, s5; +}, "formatEsbuildError"); +var dr = f2((s5, e5, n3) => { + const i6 = {}; + let o8, c3, u5; + if (e5.startsWith("file://")) { + o8 = e5; + const d5 = new URL(e5); + c3 = Jt(d5); + } else + [c3, u5] = e5.split("?"), o8 = Gt(c3) + (u5 ? `?${u5}` : ""); + c3.endsWith(".cjs") || c3.endsWith(".cts") || (i6["import.meta.url"] = JSON.stringify(o8)); + const p5 = { ...dt, format: "cjs", sourcefile: c3, define: i6, banner: `__filename=${JSON.stringify(c3)};(()=>{`, footer: "})()", platform: "node", ...n3 }, g2 = Ne2([s5, JSON.stringify(p5), import_esbuild.version, Je2].join("-")); + let b3 = ie2.get(g2); + return b3 || (b3 = cr(e5, s5, [(d5, r3) => { + const R6 = gt(p5); + let L3; + try { + L3 = (0, import_esbuild.transformSync)(r3, p5); + } catch (E6) { + throw bt(E6); + } + return R6(L3); + }, (d5, r3) => xe2(d5, r3, true)]), ie2.set(g2, b3)), b3; +}, "transformSync"); +var gr = f2(async (s5, e5, n3) => { + const i6 = { ...dt, format: "esm", sourcefile: e5, ...n3 }, o8 = Ne2([s5, JSON.stringify(i6), import_esbuild.version, Je2].join("-")); + let c3 = ie2.get(o8); + return c3 || (c3 = await ur(e5, s5, [async (u5, p5) => { + const g2 = gt(i6); + let b3; + try { + b3 = await (0, import_esbuild.transform)(p5, i6); + } catch (d5) { + throw bt(d5); + } + return g2(b3); + }, (u5, p5) => xe2(u5, p5, true)]), ie2.set(o8, c3)), c3; +}, "transform"); -// .github/actions/deploy-docs-site/lib/main.mts -var import_core3 = __toESM(require_core(), 1); -var import_github3 = __toESM(require_github(), 1); +// +import p3 from "node:net"; +var a4 = Object.defineProperty; +var o4 = (e5, n3) => a4(e5, "name", { value: n3, configurable: true }); +var m4 = o4(() => new Promise((e5) => { + const n3 = n(process.ppid), t3 = p3.createConnection(n3, () => { + e5(o4((i6) => { + const r3 = Buffer.from(JSON.stringify(i6)), s5 = Buffer.alloc(4); + s5.writeInt32BE(r3.length, 0), t3.write(Buffer.concat([s5, r3])); + }, "sendToParent")); + }); + t3.on("error", () => { + e5(); + }), t3.unref(); +}), "connectToServer"); +var c2 = { send: void 0 }; +var f3 = m4(); +f3.then((e5) => { + c2.send = e5; +}, () => { +}); -// .github/actions/deploy-docs-site/lib/deploy.mjs -import { cp, mkdtemp, readFile, rm, writeFile } from "node:fs/promises"; -import { join } from "node:path"; -import { tmpdir } from "node:os"; -import { spawnSync } from "node:child_process"; +// +import { inspect as oe3 } from "node:util"; -// .github/actions/deploy-docs-site/lib/credential.mjs -var import_tmp = __toESM(require_tmp(), 1); -var import_core = __toESM(require_core(), 1); -import { writeSync } from "node:fs"; -var credentialFilePath; -function getCredentialFilePath() { - if (credentialFilePath === void 0) { - const tmpFile = (0, import_tmp.fileSync)({ postfix: ".json" }); - writeSync(tmpFile.fd, (0, import_core.getInput)("serviceKey", { required: true })); - (0, import_core.setSecret)(tmpFile.name); - credentialFilePath = tmpFile.name; - } - return credentialFilePath; +// +var u2 = Object.defineProperty; +var g = (s5, n3) => u2(s5, "name", { value: n3, configurable: true }); +var t2 = true; +var l = typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {}; +var i2 = 0; +if (l.process && l.process.env && l.process.stdout) { + const { FORCE_COLOR: s5, NODE_DISABLE_COLORS: n3, NO_COLOR: r3, TERM: o8, COLORTERM: c3 } = l.process.env; + n3 || r3 || s5 === "0" ? t2 = false : s5 === "1" || s5 === "2" || s5 === "3" ? t2 = true : o8 === "dumb" ? t2 = false : "CI" in l.process.env && ["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE"].some((a7) => a7 in l.process.env) ? t2 = true : t2 = process.stdout.isTTY, t2 && (process.platform === "win32" || c3 && (c3 === "truecolor" || c3 === "24bit") ? i2 = 3 : o8 && (o8.endsWith("-256color") || o8.endsWith("256")) ? i2 = 2 : i2 = 1); } -var githubReleaseTrainReadToken = (0, import_core.getInput)("githubReleaseTrainReadToken", { - required: true -}); +var f4 = { enabled: t2, supportLevel: i2 }; +function e3(s5, n3, r3 = 1) { + const o8 = `\x1B[${s5}m`, c3 = `\x1B[${n3}m`, a7 = new RegExp(`\\x1b\\[${n3}m`, "g"); + return (p5) => f4.enabled && f4.supportLevel >= r3 ? o8 + ("" + p5).replace(a7, o8) + c3 : "" + p5; +} +g(e3, "kolorist"); +var b = e3(30, 39); +var d2 = e3(33, 39); +var O2 = e3(90, 39); +var C2 = e3(92, 39); +var R4 = e3(95, 39); +var I3 = e3(96, 39); +var L2 = e3(44, 49); +var E3 = e3(100, 49); +var T = e3(103, 49); -// .github/actions/deploy-docs-site/lib/deploy.mjs -async function deployToFirebase(deployment, configPath, distDirPath) { - if (deployment.destination == void 0) { - console.log(`No deployment necessary for docs created from: ${deployment.branch}`); +// +var K3 = Object.defineProperty; +var o5 = (s5, e5) => K3(s5, "name", { value: e5, configurable: true }); +var R5 = o5((s5) => { + if (!s5.startsWith("data:text/javascript,")) return; - } - console.log("Preparing for deployment to firebase..."); - const tmpDeployDir = await mkdtemp(join(tmpdir(), "deploy-directory")); - const deployConfigPath = join(tmpDeployDir, "firebase.json"); - const config = JSON.parse(await readFile(configPath, { encoding: "utf-8" })); - config["hosting"]["public"] = "./dist"; - await writeFile(deployConfigPath, JSON.stringify(config, null, 2)); - await cp(distDirPath, join(tmpDeployDir, "dist"), { recursive: true }); - spawnSync(`chmod 777 -R ${tmpDeployDir}`, { encoding: "utf-8", shell: true }); - firebase(`target:clear --config ${deployConfigPath} --project angular-dev-site hosting angular-docs`, tmpDeployDir); - firebase(`target:apply --config ${deployConfigPath} --project angular-dev-site hosting angular-docs ${deployment.destination}`, tmpDeployDir); - firebase(`deploy --config ${deployConfigPath} --project angular-dev-site --only hosting --non-interactive`, tmpDeployDir); - firebase(`target:clear --config ${deployConfigPath} --project angular-dev-site hosting angular-docs`, tmpDeployDir); - await rm(tmpDeployDir, { recursive: true }); -} -async function setupRedirect(deployment) { - if (deployment.redirect === void 0) { - console.log(`No redirect necessary for docs created from: ${deployment.branch}`); + const e5 = s5.indexOf("?"); + if (e5 === -1) return; - } - console.log("Preparing to set up redirect on firebase..."); - const redirectConfig = JSON.stringify({ - hosting: { - target: "angular-docs", - redirects: [ - { - type: 302, - regex: "^(.*)$", - destination: `${deployment.redirect.to}:1` - } - ] + const n3 = new URLSearchParams(s5.slice(e5 + 1)).get("filePath"); + if (n3) + return n3; +}, "getOriginalFilePath"); +var D2 = o5((s5) => { + const e5 = R5(s5); + return e5 && (d3._cache[e5] = d3._cache[s5], delete d3._cache[s5], s5 = e5), s5; +}, "interopCjsExports"); +var me3 = o5((s5) => { + const e5 = s5.indexOf(":"); + if (e5 !== -1) + return s5.slice(0, e5); +}, "getScheme"); +var N = o5((s5) => s5[0] === "." && (s5[1] === "/" || s5[1] === "." || s5[2] === "/"), "isRelativePath"); +var j = o5((s5) => N(s5) || p4.isAbsolute(s5), "isFilePath"); +var pe2 = o5((s5) => { + if (j(s5)) + return true; + const e5 = me3(s5); + return e5 && e5 !== "node"; +}, "requestAcceptsQuery"); +var y2 = "file://"; +var C3 = /\.([cm]?ts|[tj]sx)($|\?)/; +var de2 = /[/\\].+\.(?:cts|cjs)(?:$|\?)/; +var E4 = /\/(?:$|\?)/; +var ge2 = /^(?:@[^/]+\/)?[^/\\]+$/; +var Q4 = `${p4.sep}node_modules${p4.sep}`; +var M2; +var _3; +var S = false; +var A2 = o5((s5) => { + let e5 = null; + if (s5) { + const a7 = p4.resolve(s5); + e5 = { path: a7, config: me(a7) }; + } else { + try { + e5 = Je(); + } catch { } - }, null, 2); - const tmpRedirectDir = await mkdtemp(join(tmpdir(), "redirect-directory")); - const redirectConfigPath = join(tmpRedirectDir, "firebase.json"); - await writeFile(redirectConfigPath, redirectConfig); - spawnSync(`chmod 777 -R ${tmpRedirectDir}`, { encoding: "utf-8", shell: true }); - firebase(`target:clear --config ${redirectConfigPath} --project angular-dev-site hosting angular-docs`, tmpRedirectDir); - firebase(`target:apply --config ${redirectConfigPath} --project angular-dev-site hosting angular-docs ${deployment.redirect.from}`, tmpRedirectDir); - firebase(`deploy --config ${redirectConfigPath} --project angular-dev-site --only hosting --non-interactive`, tmpRedirectDir); - firebase(`target:clear --config ${redirectConfigPath} --project angular-dev-site hosting angular-docs`, tmpRedirectDir); - await rm(tmpRedirectDir, { recursive: true }); -} -function firebase(cmd, cwd) { - spawnSync("npx", `-y firebase-tools@13.15.1 ${cmd}`.split(" "), { - cwd, - encoding: "utf-8", - shell: true, - stdio: "inherit", - env: { - ...process.env, - GOOGLE_APPLICATION_CREDENTIALS: getCredentialFilePath() + if (!e5) + return; + } + M2 = nn(e5), _3 = He(e5), S = e5?.config.compilerOptions?.allowJs ?? false; +}, "loadTsconfig"); +var T2 = o5((s5) => Array.from(s5).length > 0 ? `?${s5.toString()}` : "", "urlSearchParamsStringify"); +var Pe3 = ` +//# sourceMappingURL=data:application/json;base64,`; +var I4 = o5(() => process.sourceMapsEnabled ?? true, "shouldApplySourceMap"); +var F3 = o5(({ code: s5, map: e5 }) => s5 + Pe3 + Buffer.from(JSON.stringify(e5), "utf8").toString("base64"), "inlineSourceMap"); +var v3 = Number(process.env.TSX_DEBUG); +v3 && (f4.enabled = true, f4.supportLevel = 3); +var J3 = o5((s5) => (e5, ...a7) => { + if (!v3 || e5 > v3) + return; + const n3 = `${E3(` tsx P${process.pid} `)} ${s5}`, t3 = a7.map((r3) => typeof r3 == "string" ? r3 : oe3(r3, { colors: true })).join(" "); + te2(1, `${n3} ${t3} +`); +}, "createLog"); +var P2 = J3(T(b(" CJS "))); +var je3 = J3(L2(" ESM ")); +var be2 = [".cts", ".mts", ".ts", ".tsx", ".jsx"]; +var xe3 = [".js", ".cjs", ".mjs"]; +var k2 = [".ts", ".tsx", ".jsx"]; +var $2 = o5((s5, e5, a7, n3) => { + const t3 = Object.getOwnPropertyDescriptor(s5, e5); + t3?.set ? s5[e5] = a7 : (!t3 || t3.configurable) && Object.defineProperty(s5, e5, { value: a7, enumerable: t3?.enumerable || n3?.enumerable, writable: n3?.writable ?? (t3 ? t3.writable : true), configurable: n3?.configurable ?? (t3 ? t3.configurable : true) }); +}, "safeSet"); +var ye2 = o5((s5, e5, a7) => { + const n3 = e5[".js"], t3 = o5((r3, c3) => { + if (s5.enabled === false) + return n3(r3, c3); + const [i6, f6] = c3.split("?"); + if ((new URLSearchParams(f6).get("namespace") ?? void 0) !== a7) + return n3(r3, c3); + P2(2, "load", { filePath: c3 }), r3.id.startsWith("data:text/javascript,") && (r3.path = p4.dirname(i6)), c2?.send && c2.send({ type: "dependency", path: i6 }); + const u5 = be2.some((m8) => i6.endsWith(m8)), g2 = xe3.some((m8) => i6.endsWith(m8)); + if (!u5 && !g2) + return n3(r3, i6); + let h3 = se2.readFileSync(i6, "utf8"); + if (i6.endsWith(".cjs")) { + const m8 = xe2(c3, h3); + m8 && (h3 = I4() ? F3(m8) : m8.code); + } else if (u5 || gn(h3)) { + const m8 = dr(h3, c3, { tsconfigRaw: M2?.(i6) }); + h3 = I4() ? F3(m8) : m8.code; + } + P2(1, "loaded", { filePath: i6 }), r3._compile(h3, i6); + }, "transformer"); + $2(e5, ".js", t3); + for (const r3 of k2) + $2(e5, r3, t3, { enumerable: !a7, writable: true, configurable: true }); + return $2(e5, ".mjs", t3, { writable: true, configurable: true }), () => { + e5[".js"] === t3 && (e5[".js"] = n3); + for (const r3 of [...k2, ".mjs"]) + e5[r3] === t3 && delete e5[r3]; + }; +}, "createExtensions"); +var Ee2 = o5((s5) => (e5) => { + if ((e5 === "." || e5 === ".." || e5.endsWith("/..")) && (e5 += "/"), E4.test(e5)) { + let a7 = p4.join(e5, "index.js"); + e5.startsWith("./") && (a7 = `./${a7}`); + try { + return s5(a7); + } catch { } + } + try { + return s5(e5); + } catch (a7) { + const n3 = a7; + if (n3.code === "MODULE_NOT_FOUND") + try { + return s5(`${e5}${p4.sep}index.js`); + } catch { + } + throw n3; + } +}, "createImplicitResolver"); +var B2 = [".js", ".json"]; +var G3 = [".ts", ".tsx", ".jsx"]; +var _e2 = [...G3, ...B2]; +var Se3 = [...B2, ...G3]; +var b2 = /* @__PURE__ */ Object.create(null); +b2[".js"] = [".ts", ".tsx", ".js", ".jsx"], b2[".jsx"] = [".tsx", ".ts", ".jsx", ".js"], b2[".cjs"] = [".cts"], b2[".mjs"] = [".mts"]; +var X3 = o5((s5) => { + const e5 = s5.split("?"), a7 = e5[1] ? `?${e5[1]}` : "", [n3] = e5, t3 = p4.extname(n3), r3 = [], c3 = b2[t3]; + if (c3) { + const f6 = n3.slice(0, -t3.length); + r3.push(...c3.map((l3) => f6 + l3 + a7)); + } + const i6 = !(s5.startsWith(y2) || j(n3)) || n3.includes(Q4) || n3.includes("/node_modules/") ? Se3 : _e2; + return r3.push(...i6.map((f6) => n3 + f6 + a7)), r3; +}, "mapTsExtensions"); +var w2 = o5((s5, e5, a7) => { + if (P2(3, "resolveTsFilename", { request: e5, isDirectory: E4.test(e5), isTsParent: a7, allowJs: S }), E4.test(e5) || !a7 && !S) + return; + const n3 = X3(e5); + if (n3) + for (const t3 of n3) + try { + return s5(t3); + } catch (r3) { + const { code: c3 } = r3; + if (c3 !== "MODULE_NOT_FOUND" && c3 !== "ERR_PACKAGE_PATH_NOT_EXPORTED") + throw r3; + } +}, "resolveTsFilename"); +var ve3 = o5((s5, e5) => (a7) => { + if (P2(3, "resolveTsFilename", { request: a7, isTsParent: e5, isFilePath: j(a7) }), j(a7)) { + const n3 = w2(s5, a7, e5); + if (n3) + return n3; + } + try { + return s5(a7); + } catch (n3) { + const t3 = n3; + if (t3.code === "MODULE_NOT_FOUND") { + if (t3.path) { + const c3 = t3.message.match(/^Cannot find module '([^']+)'$/); + if (c3) { + const f6 = c3[1], l3 = w2(s5, f6, e5); + if (l3) + return l3; + } + const i6 = t3.message.match(/^Cannot find module '([^']+)'. Please verify that the package.json has a valid "main" entry$/); + if (i6) { + const f6 = i6[1], l3 = w2(s5, f6, e5); + if (l3) + return l3; + } + } + const r3 = w2(s5, a7, e5); + if (r3) + return r3; + } + throw t3; + } +}, "createTsExtensionResolver"); +var z2 = "at cjsPreparseModuleExports (node:internal"; +var we2 = o5((s5) => { + const e5 = s5.stack.split(` +`).slice(1); + return e5[1].includes(z2) || e5[2].includes(z2); +}, "isFromCjsLexer"); +var Me3 = o5((s5, e5) => { + const a7 = s5.split("?"), n3 = new URLSearchParams(a7[1]); + if (e5?.filename) { + const t3 = R5(e5.filename); + let r3; + if (t3) { + const f6 = t3.split("?"), l3 = f6[0]; + r3 = f6[1], e5.filename = l3, e5.path = p4.dirname(l3), e5.paths = d3._nodeModulePaths(e5.path), d3._cache[l3] = e5; + } + r3 || (r3 = e5.filename.split("?")[1]); + const i6 = new URLSearchParams(r3).get("namespace"); + i6 && n3.append("namespace", i6); + } + return [a7[0], n3, (t3, r3) => (p4.isAbsolute(t3) && !t3.endsWith(".json") && !t3.endsWith(".node") && !(r3 === 0 && we2(new Error())) && (t3 += T2(n3)), t3)]; +}, "preserveQuery"); +var Te3 = o5((s5, e5, a7) => { + if (s5.startsWith(y2) && (s5 = O3(s5)), _3 && !j(s5) && !e5?.filename?.includes(Q4)) { + const n3 = _3(s5); + for (const t3 of n3) + try { + return a7(t3); + } catch { + } + } + return a7(s5); +}, "resolveTsPaths"); +var Fe3 = o5((s5, e5, a7) => (n3, t3, ...r3) => { + if (s5.enabled === false) + return e5(n3, t3, ...r3); + n3 = D2(n3); + const [c3, i6, f6] = Me3(n3, t3); + if ((i6.get("namespace") ?? void 0) !== a7) + return e5(n3, t3, ...r3); + P2(2, "resolve", { request: n3, parent: t3?.filename ?? t3, restOfArgs: r3 }); + let l3 = o5((g2) => e5(g2, t3, ...r3), "nextResolveSimple"); + l3 = ve3(l3, !!(a7 || t3?.filename && C3.test(t3.filename))), l3 = Ee2(l3); + const u5 = f6(Te3(c3, t3, l3), r3.length); + return P2(1, "resolved", { request: n3, parent: t3?.filename ?? t3, resolved: u5 }), u5; +}, "createResolveFilename"); +var H2 = o5((s5, e5) => { + if (!e5) + throw new Error("The current file path (__filename or import.meta.url) must be provided in the second argument of tsx.require()"); + return s5.startsWith(".") ? ((typeof e5 == "string" && e5.startsWith(y2) || e5 instanceof URL) && (e5 = O3(e5)), p4.resolve(p4.dirname(e5), s5)) : s5; +}, "resolveContext"); +var $e3 = o5((s5) => { + const { sourceMapsEnabled: e5 } = process, a7 = { enabled: true }; + A2(process.env.TSX_TSCONFIG_PATH), process.setSourceMapsEnabled(true); + const n3 = d3._resolveFilename, t3 = Fe3(a7, n3, s5?.namespace); + d3._resolveFilename = t3; + const r3 = ye2(a7, d3._extensions, s5?.namespace), c3 = o5(() => { + e5 === false && process.setSourceMapsEnabled(false), a7.enabled = false, d3._resolveFilename === t3 && (d3._resolveFilename = n3), r3(); + }, "unregister"); + if (s5?.namespace) { + const i6 = o5((l3, u5) => { + const g2 = H2(l3, u5), [h3, m8] = g2.split("?"), x2 = new URLSearchParams(m8); + return s5.namespace && !h3.startsWith("node:") && x2.set("namespace", s5.namespace), m(h3 + T2(x2)); + }, "scopedRequire"); + c3.require = i6; + const f6 = o5((l3, u5, g2) => { + const h3 = H2(l3, u5), [m8, x2] = h3.split("?"), L3 = new URLSearchParams(x2); + return s5.namespace && !m8.startsWith("node:") && L3.set("namespace", s5.namespace), t3(m8 + T2(L3), module, false, g2); + }, "scopedResolve"); + c3.resolve = f6, c3.unregister = c3; + } + return c3; +}, "register"); + +// +import { pathToFileURL as h2 } from "node:url"; +var d4 = Object.defineProperty; +var o6 = (r3, s5) => d4(r3, "name", { value: s5, configurable: true }); +var w3 = o6((r3) => (s5, e5) => { + if (!e5) + throw new Error("The current file path (import.meta.url) must be provided in the second argument of tsImport()"); + const a7 = e5.startsWith(y2) ? e5 : h2(e5).toString(); + return import(`tsx://${JSON.stringify({ specifier: s5, parentURL: a7, namespace: r3 })}`); +}, "createScopedImport"); +var l2 = false; +var E5 = o6((r3) => { + if (!m5.register) + throw new Error(`This version of Node.js (${process.version}) does not support module.register(). Please upgrade to Node v18.19 or v20.6 and above.`); + if (!l2) { + const { _resolveFilename: t3 } = m5; + m5._resolveFilename = (p5, ...c3) => t3(D2(p5), ...c3), l2 = true; + } + const { sourceMapsEnabled: s5 } = process; + process.setSourceMapsEnabled(true); + const { port1: e5, port2: a7 } = new u3(); + m5.register(`./esm/index.mjs?${Date.now()}`, { parentURL: import.meta.url, data: { port: a7, namespace: r3?.namespace, tsconfig: r3?.tsconfig }, transferList: [a7] }); + const f6 = r3?.onImport, n3 = f6 && ((t3) => { + t3.type === "load" && f6(t3.url); }); -} + n3 && (e5.on("message", n3), e5.unref()); + const i6 = o6(() => (s5 === false && process.setSourceMapsEnabled(false), n3 && e5.off("message", n3), e5.postMessage("deactivate"), new Promise((t3) => { + const p5 = o6((c3) => { + c3.type === "deactivated" && (t3(), e5.off("message", p5)); + }, "onDeactivated"); + e5.on("message", p5); + })), "unregister"); + return r3?.namespace && (i6.import = w3(r3.namespace), i6.unregister = i6), i6; +}, "register"); // -import { pathToFileURL } from "url"; -import { join as join2 } from "path"; +var m6 = Object.defineProperty; +var a5 = (r3, t3) => m6(r3, "name", { value: t3, configurable: true }); +var e4; +var s3 = a5((r3, t3) => (e4 || (e4 = $e3({ namespace: Date.now().toString() })), e4.require(r3, t3)), "tsxRequire"); +var i3 = a5((r3, t3, c3) => (e4 || (e4 = $e3({ namespace: Date.now().toString() })), e4.resolve(r3, t3, c3)), "resolve"); +i3.paths = m.resolve.paths, s3.resolve = i3, s3.main = m.main, s3.extensions = m.extensions, s3.cache = m.cache; + +// +var i4 = Object.defineProperty; +var o7 = (e5, t3) => i4(e5, "name", { value: t3, configurable: true }); +var n2 = o7((e5, t3) => { + const r3 = e5[0] - t3[0]; + if (r3 === 0) { + const s5 = e5[1] - t3[1]; + return s5 === 0 ? e5[2] >= t3[2] : s5 > 0; + } + return r3 > 0; +}, "isVersionGreaterOrEqual"); +var a6 = process.versions.node.split(".").map(Number); +var u4 = o7((e5, t3 = a6) => { + for (let r3 = 0; r3 < e5.length; r3 += 1) { + const s5 = e5[r3]; + if (r3 === e5.length - 1 || t3[0] === s5[0]) + return n2(t3, s5); + } + return false; +}, "isFeatureSupported"); +var m7 = [[20, 11, 0], [21, 3, 0]]; + +// +var import_esbuild2 = __toESM(require_main(), 1); +var s4 = Object.defineProperty; +var i5 = (r3, t3) => s4(r3, "name", { value: t3, configurable: true }); +var f5 = i5((r3, t3) => { + if (!t3 || typeof t3 == "object" && !t3.parentURL) + throw new Error("The current file path (import.meta.url) must be provided in the second argument of tsImport()"); + const e5 = typeof t3 == "string", o8 = e5 ? t3 : t3.parentURL, m8 = Date.now().toString(), a7 = $e3({ namespace: m8 }); + return !u4(m7) && !ge2.test(r3) && de2.test(r3) ? Promise.resolve(a7.require(r3, o8)) : E5({ namespace: m8, ...e5 ? {} : t3 }).import(r3, o8); +}, "tsImport"); // var ANSI_BACKGROUND_OFFSET = 10; @@ -25410,6 +37868,12 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) { if (env.TERM === "xterm-kitty") { return 3; } + if (env.TERM === "xterm-ghostty") { + return 3; + } + if (env.TERM === "wezterm") { + return 3; + } if ("TERM_PROGRAM" in env) { const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10); switch (env.TERM_PROGRAM) { @@ -25721,6 +38185,12 @@ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) { if (env2.TERM === "xterm-kitty") { return 3; } + if (env2.TERM === "xterm-ghostty") { + return 3; + } + if (env2.TERM === "wezterm") { + return 3; + } if ("TERM_PROGRAM" in env2) { const version = Number.parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10); switch (env2.TERM_PROGRAM) { @@ -25760,12 +38230,6 @@ var supports_color_default2 = supportsColor2; import { spawn as _spawn, spawnSync as _spawnSync, exec as _exec } from "child_process"; import assert from "assert"; var ChildProcess = class { - /** - * Spawns a given command with the specified arguments inside an interactive shell. All process - * stdin, stdout and stderr output is printed to the current console. - * - * @returns a Promise resolving on success, and rejecting on command failure with the status code. - */ static spawnInteractive(command, args, options = {}) { return new Promise((resolve, reject) => { const commandText = `${command} ${args.join(" ")}`; @@ -25774,11 +38238,6 @@ var ChildProcess = class { childProcess.on("close", (status) => status === 0 ? resolve() : reject(status)); }); } - /** - * Spawns a given command with the specified arguments inside a shell synchronously. - * - * @returns The command's stdout and stderr. - */ static spawnSync(command, args, options = {}) { const commandText = `${command} ${args.join(" ")}`; const env3 = getEnvironmentForNonInteractiveCommand(options.env); @@ -25790,27 +38249,11 @@ var ChildProcess = class { } throw new Error(stderr); } - /** - * Spawns a given command with the specified arguments inside a shell. All process stdout - * output is captured and returned as resolution on completion. Depending on the chosen - * output mode, stdout/stderr output is also printed to the console, or only on error. - * - * @returns a Promise resolving with captured stdout and stderr on success. The promise - * rejects on command failure. - */ static spawn(command, args, options = {}) { const commandText = `${command} ${args.join(" ")}`; const env3 = getEnvironmentForNonInteractiveCommand(options.env); return processAsyncCmd(commandText, options, _spawn(command, args, { ...options, env: env3, shell: true, stdio: "pipe" })); } - /** - * Execs a given command with the specified arguments inside a shell. All process stdout - * output is captured and returned as resolution on completion. Depending on the chosen - * output mode, stdout/stderr output is also printed to the console, or only on error. - * - * @returns a Promise resolving with captured stdout and stderr on success. The promise - * rejects on command failure. - */ static exec(command, options = {}) { const env3 = getEnvironmentForNonInteractiveCommand(options.env); return processAsyncCmd(command, options, _exec(command, { ...options, env: env3 })); @@ -25905,11 +38348,7 @@ Log.log = buildLogLevelFunction(() => console.log, LogLevel.LOG, null); Log.warn = buildLogLevelFunction(() => console.warn, LogLevel.WARN, source_default.yellow); function buildLogLevelFunction(loadCommand, level, defaultColor) { const loggingFunction = (...values) => { - runConsoleCommand( - loadCommand, - level, - ...values.map((v) => typeof v === "string" && defaultColor ? defaultColor(v) : v) - ); + runConsoleCommand(loadCommand, level, ...values.map((v4) => typeof v4 === "string" && defaultColor ? defaultColor(v4) : v4)); }; loggingFunction.group = (label, collapsed = false) => { const command = collapsed ? console.groupCollapsed : console.group; @@ -25944,12 +38383,8 @@ function appendToLogFile(logLevel, ...text) { return; } const logLevelText = `${LogLevel[logLevel]}:`.padEnd(LOG_LEVEL_COLUMNS); - appendFile( - logFilePath, - // Strip ANSI escape codes from log outputs. - stripVTControlCharacters(text.join(" ").split("\n").map((l) => `${logLevelText} ${l} -`).join("")) - ); + appendFile(logFilePath, stripVTControlCharacters(text.join(" ").split("\n").map((l3) => `${logLevelText} ${l3} +`).join(""))); } // @@ -25962,7 +38397,8 @@ function getCachedConfig() { } // -var CONFIG_FILE_PATH = ".ng-dev/config.mjs"; +import { pathToFileURL } from "url"; +var CONFIG_FILE_PATH_MATCHER = ".ng-dev/config.{mjs,mts}"; var setConfig = setCachedConfig; async function getConfig(baseDirOrAssertions) { let cachedConfig2 = getCachedConfig(); @@ -25973,7 +38409,8 @@ async function getConfig(baseDirOrAssertions) { } else { baseDir = determineRepoBaseDirFromCwd(); } - const configPath = join2(baseDir, CONFIG_FILE_PATH); + const [matchedFile] = await (0, import_fast_glob.default)(CONFIG_FILE_PATH_MATCHER, { cwd: baseDir }); + const configPath = join2(baseDir, matchedFile); cachedConfig2 = await readConfigFile(configPath); setCachedConfig(cachedConfig2); } @@ -26007,17 +38444,20 @@ function assertValidGithubConfig(config) { } } async function readConfigFile(configPath, returnEmptyObjectOnError = false) { + const unregister = E5({ tsconfig: false }); try { return await import(pathToFileURL(configPath).toString()); - } catch (e) { + } catch (e5) { if (returnEmptyObjectOnError) { Log.debug(`Could not read configuration file at ${configPath}, returning empty object instead.`); - Log.debug(e); + Log.debug(e5); return {}; } Log.error(`Could not read configuration file at ${configPath}.`); - Log.error(e); + Log.error(e5); process.exit(1); + } finally { + unregister(); } } @@ -26132,68 +38572,67 @@ var managedLabels = createTypedObject(ManagedLabel)({ DETECTED_BREAKING_CHANGE: { description: "PR contains a commit with a breaking change", name: "detected: breaking change", - commitCheck: (c) => c.breakingChanges.length !== 0 + commitCheck: (c3) => c3.breakingChanges.length !== 0 }, DETECTED_DEPRECATION: { description: "PR contains a commit with a deprecation", name: "detected: deprecation", - commitCheck: (c) => c.deprecations.length !== 0 + commitCheck: (c3) => c3.deprecations.length !== 0 }, DETECTED_FEATURE: { description: "PR contains a feature commit", name: "detected: feature", - commitCheck: (c) => c.type === "feat" + commitCheck: (c3) => c3.type === "feat" }, DETECTED_DOCS_CHANGE: { description: "Related to the documentation", name: "area: docs", - commitCheck: (c) => c.type === "docs" + commitCheck: (c3) => c3.type === "docs" }, DETECTED_INFRA_CHANGE: { description: "Related the build and CI infrastructure of the project", name: "area: build & ci", - commitCheck: (c) => c.type === "build" || c.type === "ci" + commitCheck: (c3) => c3.type === "build" || c3.type === "ci" }, DETECTED_PERF_CHANGE: { description: "Issues related to performance", name: "area: performance", - commitCheck: (c) => c.type === "perf" + commitCheck: (c3) => c3.type === "perf" }, - // angular/angular specific labels. DETECTED_HTTP_CHANGE: { description: "Issues related to HTTP and HTTP Client", name: "area: common/http", - commitCheck: (c) => c.scope === "common/http" || c.scope === "http", + commitCheck: (c3) => c3.scope === "common/http" || c3.scope === "http", repositories: [ManagedRepositories.ANGULAR] }, DETECTED_COMPILER_CHANGE: { description: "Issues related to `ngc`, Angular's template compiler", name: "area: compiler", - commitCheck: (c) => c.scope === "compiler" || c.scope === "compiler-cli", + commitCheck: (c3) => c3.scope === "compiler" || c3.scope === "compiler-cli", repositories: [ManagedRepositories.ANGULAR] }, DETECTED_PLATFORM_BROWSER_CHANGE: { description: "Issues related to the framework runtime", name: "area: core", - commitCheck: (c) => c.scope === "platform-browser" || c.scope === "core" || c.scope === "platform-browser-dynamic", + commitCheck: (c3) => c3.scope === "platform-browser" || c3.scope === "core" || c3.scope === "platform-browser-dynamic", repositories: [ManagedRepositories.ANGULAR] }, DETECTED_PLATFORM_SERVER_CHANGE: { description: "Issues related to server-side rendering", name: "area: server", - commitCheck: (c) => c.scope === "platform-server", + commitCheck: (c3) => c3.scope === "platform-server", repositories: [ManagedRepositories.ANGULAR] }, DETECTED_ZONES_CHANGE: { description: "Issues related to zone.js", name: "area: zones", - commitCheck: (c) => c.scope === "zone.js", + commitCheck: (c3) => c3.scope === "zone.js", repositories: [ManagedRepositories.ANGULAR] }, DETECTED_LOCALIZE_CHANGE: { description: "Issues related to localization and internationalization", name: "area: i18n", - commitCheck: (c) => c.scope === "localize", + commitCheck: (c3) => c3.scope === "localize", repositories: [ManagedRepositories.ANGULAR] } }); @@ -26255,6 +38694,10 @@ var TargetLabel = class extends Label { } }; var targetLabels = createTypedObject(TargetLabel)({ + TARGET_AUTOMATION: { + description: "This PR is targeted to only merge into the branch defined in Github [bot use only]", + name: "target: automation" + }, TARGET_FEATURE: { description: "This PR is targeted for a feature branch (outside of main and semver branches)", name: "target: feature" @@ -26410,7 +38853,7 @@ async function getBranchesForMajorVersions(repo, majorVersions) { branches.push({ name, parsed }); } } - return branches.sort((a, b) => import_semver.default.rcompare(a.parsed, b.parsed)); + return branches.sort((a7, b3) => import_semver.default.rcompare(a7.parsed, b3.parsed)); } function convertVersionBranchToSemVer(branchName) { return import_semver.default.parse(branchName.replace(versionBranchNameRegex, "$1.$2.0")); @@ -26425,11 +38868,9 @@ var ActiveReleaseTrains = class { this.latest = this.trains.latest; this.exceptionalMinor = this.trains.exceptionalMinor; } - /** Whether the active release trains indicate the repository is in a feature freeze state. */ isFeatureFreeze() { return this.releaseCandidate !== null && this.releaseCandidate.version.prerelease[0] === "next"; } - /** Fetches the active release trains for the configured project. */ static async fetch(repo) { return fetchActiveReleaseTrains(repo); } @@ -26446,23 +38887,23 @@ async function fetchActiveReleaseTrains(repo) { }; if (nextVersion.minor === 0) { majorVersionsToFetch.push(nextVersion.major - 1, nextVersion.major - 2); - checks.isValidReleaseCandidateVersion = (v) => v.major === nextVersion.major - 1; + checks.isValidReleaseCandidateVersion = (v4) => v4.major === nextVersion.major - 1; checks.canHaveExceptionalMinor = (rc) => rc === null || rc.isMajor; - checks.isValidExceptionalMinorVersion = (v, rc) => v.major === (rc === null ? nextVersion.major : rc.version.major) - 1; + checks.isValidExceptionalMinorVersion = (v4, rc) => v4.major === (rc === null ? nextVersion.major : rc.version.major) - 1; } else if (nextVersion.minor === 1) { majorVersionsToFetch.push(nextVersion.major, nextVersion.major - 1); - checks.isValidReleaseCandidateVersion = (v) => v.major === nextVersion.major; + checks.isValidReleaseCandidateVersion = (v4) => v4.major === nextVersion.major; checks.canHaveExceptionalMinor = (rc) => rc !== null && rc.isMajor; - checks.isValidExceptionalMinorVersion = (v, rc) => v.major === rc.version.major - 1; + checks.isValidExceptionalMinorVersion = (v4, rc) => v4.major === rc.version.major - 1; } else { majorVersionsToFetch.push(nextVersion.major); - checks.isValidReleaseCandidateVersion = (v) => v.major === nextVersion.major; + checks.isValidReleaseCandidateVersion = (v4) => v4.major === nextVersion.major; checks.canHaveExceptionalMinor = () => false; } const branches = await getBranchesForMajorVersions(repo, majorVersionsToFetch); const { latest, releaseCandidate, exceptionalMinor } = await findActiveReleaseTrainsFromVersionBranches(repo, next, branches, checks); if (latest === null) { - throw Error(`Unable to determine the latest release-train. The following branches have been considered: [${branches.map((b) => b.name).join(", ")}]`); + throw Error(`Unable to determine the latest release-train. The following branches have been considered: [${branches.map((b3) => b3.name).join(", ")}]`); } return new ActiveReleaseTrains({ releaseCandidate, next, latest, exceptionalMinor }); } @@ -26523,7 +38964,7 @@ async function fetchProjectNpmPackageInfo(config) { } async function fetchPackageInfoFromNpmRegistry(pkgName) { if (_npmPackageInfoCache[pkgName] === void 0) { - _npmPackageInfoCache[pkgName] = fetch(`https://registry.npmjs.org/${pkgName}`).then((r) => r.json()); + _npmPackageInfoCache[pkgName] = fetch(`https://registry.npmjs.org/${pkgName}`).then((r3) => r3.json()); } return await _npmPackageInfoCache[pkgName]; } @@ -26551,8 +38992,8 @@ async function fetchLongTermSupportBranchesFromNpm(config) { } } } - active.sort((a, b) => import_semver3.default.rcompare(a.version, b.version)); - inactive.sort((a, b) => import_semver3.default.rcompare(a.version, b.version)); + active.sort((a7, b3) => import_semver3.default.rcompare(a7.version, b3.version)); + inactive.sort((a7, b3) => import_semver3.default.rcompare(a7.version, b3.version)); return { active, inactive }; } function isLtsDistTag(tagName) { @@ -26736,10 +39177,13 @@ function lowercaseKeys(object) { }, {}); } function isPlainObject(value) { - if (typeof value !== "object" || value === null) return false; - if (Object.prototype.toString.call(value) !== "[object Object]") return false; + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; const proto2 = Object.getPrototypeOf(value); - if (proto2 === null) return true; + if (proto2 === null) + return true; const Ctor = Object.prototype.hasOwnProperty.call(proto2, "constructor") && proto2.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } @@ -26747,8 +39191,10 @@ function mergeDeep(defaults, options) { const result = Object.assign({}, defaults); Object.keys(options).forEach((key) => { if (isPlainObject(options[key])) { - if (!(key in defaults)) Object.assign(result, { [key]: options[key] }); - else result[key] = mergeDeep(defaults[key], options[key]); + if (!(key in defaults)) + Object.assign(result, { [key]: options[key] }); + else + result[key] = mergeDeep(defaults[key], options[key]); } else { Object.assign(result, { [key]: options[key] }); } @@ -26806,7 +39252,7 @@ function extractUrlVariableNames(url) { if (!matches) { return []; } - return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []); + return matches.map(removeNonChars).reduce((a7, b3) => a7.concat(b3), []); } function omit(object, keysToOmit) { const result = { __proto__: null }; @@ -26826,8 +39272,8 @@ function encodeReserved(str) { }).join(""); } function encodeUnreserved(str) { - return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { - return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + return encodeURIComponent(str).replace(/[!'()*]/g, function(c3) { + return "%" + c3.charCodeAt(0).toString(16).toUpperCase(); }); } function encodeValue(operator, value, key) { @@ -26864,9 +39310,9 @@ function getValues(context2, operator, key, modifier) { ); }); } else { - Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { - result.push(encodeValue(operator, value[k], k)); + Object.keys(value).forEach(function(k3) { + if (isDefined(value[k3])) { + result.push(encodeValue(operator, value[k3], k3)); } }); } @@ -26877,10 +39323,10 @@ function getValues(context2, operator, key, modifier) { tmp.push(encodeValue(operator, value2)); }); } else { - Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { - tmp.push(encodeUnreserved(k)); - tmp.push(encodeValue(operator, value[k].toString())); + Object.keys(value).forEach(function(k3) { + if (isDefined(value[k3])) { + tmp.push(encodeUnreserved(k3)); + tmp.push(encodeValue(operator, value[k3].toString())); } }); } @@ -26913,7 +39359,7 @@ function expand(template, context2) { var operators = ["+", "#", ".", "/", ";", "?", "&"]; template = template.replace( /\{([^\{\}]+)\}|([^\{\}]+)/g, - function(_, expression, literal) { + function(_4, expression, literal) { if (expression) { let operator = ""; const values = []; @@ -27068,17 +39514,20 @@ var RequestError = class extends Error { }; // -var VERSION2 = "10.0.3"; +var VERSION2 = "10.0.5"; var defaults_default = { headers: { "user-agent": `octokit-request.js/${VERSION2} ${getUserAgent()}` } }; function isPlainObject2(value) { - if (typeof value !== "object" || value === null) return false; - if (Object.prototype.toString.call(value) !== "[object Object]") return false; + if (typeof value !== "object" || value === null) + return false; + if (Object.prototype.toString.call(value) !== "[object Object]") + return false; const proto2 = Object.getPrototypeOf(value); - if (proto2 === null) return true; + if (proto2 === null) + return true; const Ctor = Object.prototype.hasOwnProperty.call(proto2, "constructor") && proto2.constructor; return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value); } @@ -27212,7 +39661,7 @@ function toErrorMessage(data) { } if ("message" in data) { const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : ""; - return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`; + return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v4) => JSON.stringify(v4)).join(", ")}${suffix}` : `${data.message}${suffix}`; } return `Unknown error: ${JSON.stringify(data)}`; } @@ -27245,7 +39694,7 @@ var request = withDefaults2(endpoint, defaults_default); var VERSION3 = "0.0.0-development"; function _buildMessageForResponseErrors(data) { return `Request failed due to following response errors: -` + data.errors.map((e) => ` - ${e.message}`).join("\n"); +` + data.errors.map((e5) => ` - ${e5.message}`).join("\n"); } var GraphqlResponseError = class extends Error { constructor(request2, headers, response) { @@ -27283,7 +39732,8 @@ function graphql(request2, query2, options) { ); } for (const key in options) { - if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) continue; + if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) + continue; return Promise.reject( new Error( `[@octokit/graphql] "${key}" cannot be used as variable name` @@ -27394,7 +39844,7 @@ var createTokenAuth = function createTokenAuth2(token) { }; // -var VERSION4 = "7.0.3"; +var VERSION4 = "7.0.5"; // var noop = () => { @@ -27517,8 +39967,8 @@ var Octokit = class { this.auth = auth2; } const classConstructor = this.constructor; - for (let i = 0; i < classConstructor.plugins.length; ++i) { - Object.assign(this, classConstructor.plugins[i](this, options)); + for (let i6 = 0; i6 < classConstructor.plugins.length; ++i6) { + Object.assign(this, classConstructor.plugins[i6](this, options)); } } // assigned during constructor @@ -27567,7 +40017,8 @@ function normalizePaginatedListResponse(response) { }; } const responseNeedsNormalization = ("total_count" in response.data || "total_commits" in response.data) && !("url" in response.data); - if (!responseNeedsNormalization) return response; + if (!responseNeedsNormalization) + return response; const incompleteResults = response.data.incomplete_results; const repositorySelection = response.data.repository_selection; const totalCount = response.data.total_count; @@ -27598,7 +40049,8 @@ function iterator(octokit, route, parameters) { return { [Symbol.asyncIterator]: () => ({ async next() { - if (!url) return { done: true }; + if (!url) + return { done: true }; try { const response = await requestMethod({ method, url, headers }); const normalizedResponse = normalizePaginatedListResponse(response); @@ -27617,7 +40069,8 @@ function iterator(octokit, route, parameters) { } return { value: normalizedResponse }; } catch (error) { - if (error.status !== 409) throw error; + if (error.status !== 409) + throw error; url = ""; return { value: { @@ -27674,7 +40127,7 @@ function paginateRest(octokit) { paginateRest.VERSION = VERSION6; // -var VERSION7 = "16.0.0"; +var VERSION7 = "16.1.1"; // var Endpoints = { @@ -28486,11 +40939,20 @@ var Endpoints = { removeSelectedRepoFromOrgSecret: [ "DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}" ], + repositoryAccessForOrg: [ + "GET /organizations/{org}/dependabot/repository-access" + ], + setRepositoryAccessDefaultLevel: [ + "PUT /organizations/{org}/dependabot/repository-access/default-level" + ], setSelectedReposForOrgSecret: [ "PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories" ], updateAlert: [ "PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number}" + ], + updateRepositoryAccessForOrg: [ + "PATCH /organizations/{org}/dependabot/repository-access" ] }, dependencyGraph: { @@ -28596,6 +41058,9 @@ var Endpoints = { addAssignees: [ "POST /repos/{owner}/{repo}/issues/{issue_number}/assignees" ], + addBlockedByDependency: [ + "POST /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by" + ], addLabels: ["POST /repos/{owner}/{repo}/issues/{issue_number}/labels"], addSubIssue: [ "POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues" @@ -28622,10 +41087,17 @@ var Endpoints = { getEvent: ["GET /repos/{owner}/{repo}/issues/events/{event_id}"], getLabel: ["GET /repos/{owner}/{repo}/labels/{name}"], getMilestone: ["GET /repos/{owner}/{repo}/milestones/{milestone_number}"], + getParent: ["GET /repos/{owner}/{repo}/issues/{issue_number}/parent"], list: ["GET /issues"], listAssignees: ["GET /repos/{owner}/{repo}/assignees"], listComments: ["GET /repos/{owner}/{repo}/issues/{issue_number}/comments"], listCommentsForRepo: ["GET /repos/{owner}/{repo}/issues/comments"], + listDependenciesBlockedBy: [ + "GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by" + ], + listDependenciesBlocking: [ + "GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocking" + ], listEvents: ["GET /repos/{owner}/{repo}/issues/{issue_number}/events"], listEventsForRepo: ["GET /repos/{owner}/{repo}/issues/events"], listEventsForTimeline: [ @@ -28652,6 +41124,9 @@ var Endpoints = { removeAssignees: [ "DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees" ], + removeDependencyBlockedBy: [ + "DELETE /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by/{issue_id}" + ], removeLabel: [ "DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}" ], @@ -28754,6 +41229,9 @@ var Endpoints = { convertMemberToOutsideCollaborator: [ "PUT /orgs/{org}/outside_collaborators/{username}" ], + createArtifactStorageRecord: [ + "POST /orgs/{org}/artifacts/metadata/storage-record" + ], createInvitation: ["POST /orgs/{org}/invitations"], createIssueType: ["POST /orgs/{org}/issue-types"], createOrUpdateCustomProperties: ["PATCH /orgs/{org}/properties/schema"], @@ -28765,15 +41243,15 @@ var Endpoints = { ], createWebhook: ["POST /orgs/{org}/hooks"], delete: ["DELETE /orgs/{org}"], + deleteAttestationsBulk: ["POST /orgs/{org}/attestations/delete-request"], + deleteAttestationsById: [ + "DELETE /orgs/{org}/attestations/{attestation_id}" + ], + deleteAttestationsBySubjectDigest: [ + "DELETE /orgs/{org}/attestations/digest/{subject_digest}" + ], deleteIssueType: ["DELETE /orgs/{org}/issue-types/{issue_type_id}"], deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"], - enableOrDisableSecurityProductOnAllOrgRepos: [ - "POST /orgs/{org}/{security_product}/{enablement}", - {}, - { - deprecated: "octokit.rest.orgs.enableOrDisableSecurityProductOnAllOrgRepos() is deprecated, see https://docs.github.com/rest/orgs/orgs#enable-or-disable-a-security-feature-for-an-organization" - } - ], get: ["GET /orgs/{org}"], getAllCustomProperties: ["GET /orgs/{org}/properties/schema"], getCustomProperty: [ @@ -28793,7 +41271,13 @@ var Endpoints = { ], list: ["GET /organizations"], listAppInstallations: ["GET /orgs/{org}/installations"], + listArtifactStorageRecords: [ + "GET /orgs/{org}/artifacts/{subject_digest}/metadata/storage-records" + ], listAttestations: ["GET /orgs/{org}/attestations/{subject_digest}"], + listAttestationsBulk: [ + "POST /orgs/{org}/attestations/bulk-list{?per_page,before,after}" + ], listBlockedUsers: ["GET /orgs/{org}/blocks"], listCustomPropertiesValuesForRepos: ["GET /orgs/{org}/properties/values"], listFailedInvitations: ["GET /orgs/{org}/failed_invitations"], @@ -28988,6 +41472,44 @@ var Endpoints = { "PATCH /orgs/{org}/private-registries/{secret_name}" ] }, + projects: { + addItemForOrg: ["POST /orgs/{org}/projectsV2/{project_number}/items"], + addItemForUser: ["POST /users/{user_id}/projectsV2/{project_number}/items"], + deleteItemForOrg: [ + "DELETE /orgs/{org}/projectsV2/{project_number}/items/{item_id}" + ], + deleteItemForUser: [ + "DELETE /users/{user_id}/projectsV2/{project_number}/items/{item_id}" + ], + getFieldForOrg: [ + "GET /orgs/{org}/projectsV2/{project_number}/fields/{field_id}" + ], + getFieldForUser: [ + "GET /users/{user_id}/projectsV2/{project_number}/fields/{field_id}" + ], + getForOrg: ["GET /orgs/{org}/projectsV2/{project_number}"], + getForUser: ["GET /users/{user_id}/projectsV2/{project_number}"], + getOrgItem: ["GET /orgs/{org}/projectsV2/{project_number}/items/{item_id}"], + getUserItem: [ + "GET /users/{user_id}/projectsV2/{project_number}/items/{item_id}" + ], + listFieldsForOrg: ["GET /orgs/{org}/projectsV2/{project_number}/fields"], + listFieldsForUser: [ + "GET /users/{user_id}/projectsV2/{project_number}/fields" + ], + listForOrg: ["GET /orgs/{org}/projectsV2"], + listForUser: ["GET /users/{username}/projectsV2"], + listItemsForOrg: ["GET /orgs/{org}/projectsV2/{project_number}/items"], + listItemsForUser: [ + "GET /users/{user_id}/projectsV2/{project_number}/items" + ], + updateItemForOrg: [ + "PATCH /orgs/{org}/projectsV2/{project_number}/items/{item_id}" + ], + updateItemForUser: [ + "PATCH /users/{user_id}/projectsV2/{project_number}/items/{item_id}" + ] + }, pulls: { checkIfMerged: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/merge"], create: ["POST /repos/{owner}/{repo}/pulls"], @@ -29566,8 +42088,14 @@ var Endpoints = { listLocationsForAlert: [ "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations" ], + listOrgPatternConfigs: [ + "GET /orgs/{org}/secret-scanning/pattern-configurations" + ], updateAlert: [ "PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}" + ], + updateOrgPatternConfigs: [ + "PATCH /orgs/{org}/secret-scanning/pattern-configurations" ] }, securityAdvisories: { @@ -29677,6 +42205,15 @@ var Endpoints = { ], createPublicSshKeyForAuthenticatedUser: ["POST /user/keys"], createSshSigningKeyForAuthenticatedUser: ["POST /user/ssh_signing_keys"], + deleteAttestationsBulk: [ + "POST /users/{username}/attestations/delete-request" + ], + deleteAttestationsById: [ + "DELETE /users/{username}/attestations/{attestation_id}" + ], + deleteAttestationsBySubjectDigest: [ + "DELETE /users/{username}/attestations/digest/{subject_digest}" + ], deleteEmailForAuthenticated: [ "DELETE /user/emails", {}, @@ -29721,6 +42258,9 @@ var Endpoints = { ], list: ["GET /users"], listAttestations: ["GET /users/{username}/attestations/{subject_digest}"], + listAttestationsBulk: [ + "POST /users/{username}/attestations/bulk-list{?per_page,before,after}" + ], listBlockedByAuthenticated: [ "GET /user/blocks", {}, @@ -29958,7 +42498,6 @@ var AuthenticatedGithubClient = class extends GithubClient { headers: { authorization: `token ${this._token}` } }); } - /** Perform a query using Github's Graphql API. */ async graphql(queryObject, params2 = {}) { return await this._graphql((0, import_typed_graphqlify2.query)(queryObject).toString(), params2); } @@ -29987,8 +42526,6 @@ function getRepositoryGitUrl(config, githubToken) { // var GitCommandError = class extends Error { - // Note: Do not expose the unsanitized arguments as a public property. NodeJS - // could print the properties of an error instance and leak e.g. a token. constructor(client, unsanitizedArgs) { super(`Command failed: git ${client.sanitizeConsoleOutput(unsanitizedArgs.join(" "))}`); } @@ -30003,7 +42540,6 @@ var GitClient = class _GitClient { this.remoteParams = { owner: config.github.owner, repo: config.github.name }; this.mainBranchName = config.github.mainBranchName; } - /** Executes the given git command. Throws if the command fails. */ run(args, options) { const result = this.runGraceful(args, options); if (result.status !== 0) { @@ -30011,11 +42547,6 @@ var GitClient = class _GitClient { } return result; } - /** - * Spawns a given Git command process. Does not throw if the command fails. Additionally, - * if there is any stderr output, the output will be printed. This makes it easier to - * info failed commands. - */ runGraceful(args, options = {}) { const gitCommand = args[0]; if (isDryRun() && gitCommand === "push") { @@ -30028,8 +42559,6 @@ var GitClient = class _GitClient { cwd: this.baseDir, stdio: "pipe", ...options, - // Encoding is always `utf8` and not overridable. This ensures that this method - // always returns `string` as output instead of buffers. encoding: "utf8" }); Log.debug(`Status: ${result.status}, Error: ${!!result.error}, Signal: ${result.signal}`); @@ -30044,19 +42573,15 @@ var GitClient = class _GitClient { } return result; } - /** Git URL that resolves to the configured repository. */ getRepoGitUrl() { return getRepositoryGitUrl(this.remoteConfig); } - /** Whether the given branch contains the specified SHA. */ hasCommit(branchName, sha) { return this.run(["branch", branchName, "--contains", sha]).stdout !== ""; } - /** Whether the local repository is configured as shallow. */ isShallowRepo() { return this.run(["rev-parse", "--is-shallow-repository"]).stdout.trim() === "true"; } - /** Gets the currently checked out branch or revision. */ getCurrentBranchOrRevision() { const branchName = this.run(["rev-parse", "--abbrev-ref", "HEAD"]).stdout.trim(); if (branchName === "HEAD") { @@ -30064,16 +42589,10 @@ var GitClient = class _GitClient { } return branchName; } - /** Gets whether the current Git repository has uncommitted changes. */ hasUncommittedChanges() { this.runGraceful(["update-index", "-q", "--refresh"]); return this.runGraceful(["diff-index", "--quiet", "HEAD"]).status !== 0; } - /** - * Checks out a requested branch or revision, optionally cleaning the state of the repository - * before attempting the checking. Returns a boolean indicating whether the branch or revision - * was cleanly checked out. - */ checkout(branchOrRevision, cleanState) { if (cleanState) { this.runGraceful(["am", "--abort"], { stdio: "ignore" }); @@ -30083,32 +42602,21 @@ var GitClient = class _GitClient { } return this.runGraceful(["checkout", branchOrRevision], { stdio: "ignore" }).status === 0; } - /** Retrieve a list of all files in the repository changed since the provided shaOrRef. */ allChangesFilesSince(shaOrRef = "HEAD") { return Array.from(/* @__PURE__ */ new Set([ ...gitOutputAsArray(this.runGraceful(["diff", "--name-only", "--diff-filter=d", shaOrRef])), ...gitOutputAsArray(this.runGraceful(["ls-files", "--others", "--exclude-standard"])) ])); } - /** Retrieve a list of all files currently staged in the repostitory. */ allStagedFiles() { return gitOutputAsArray(this.runGraceful(["diff", "--name-only", "--diff-filter=ACM", "--staged"])); } - /** Retrieve a list of all files tracked in the repository. */ allFiles() { return gitOutputAsArray(this.runGraceful(["ls-files"])); } - /** - * Sanitizes the given console message. This method can be overridden by - * derived classes. e.g. to sanitize access tokens from Git commands. - */ sanitizeConsoleOutput(value) { return value; } - /** - * Static method to get the singleton instance of the `GitClient`, - * creating it, if not created yet. - */ static async get() { if (_GitClient._unauthenticatedInstance === null) { _GitClient._unauthenticatedInstance = (async () => { @@ -30120,7 +42628,7 @@ var GitClient = class _GitClient { }; GitClient._unauthenticatedInstance = null; function gitOutputAsArray(gitCommandResult) { - return gitCommandResult.stdout.split("\n").map((x) => x.trim()).filter((x) => !!x); + return gitCommandResult.stdout.split("\n").map((x2) => x2.trim()).filter((x2) => !!x2); } // @@ -30134,18 +42642,12 @@ var AuthenticatedGitClient = class _AuthenticatedGitClient extends GitClient { this._cachedForkRepositories = null; this.github = new AuthenticatedGithubClient(this.githubToken); } - /** Sanitizes a given message by omitting the provided Github token if present. */ sanitizeConsoleOutput(value) { return value.replace(this._githubTokenRegex, ""); } - /** Git URL that resolves to the configured repository. */ getRepoGitUrl() { return getRepositoryGitUrl(this.remoteConfig, this.githubToken); } - /** - * Assert the GitClient instance is using a token with permissions for the all of the - * provided OAuth scopes. - */ async hasOauthScopes(testFn) { if (this.userType === "bot") { return true; @@ -30165,7 +42667,6 @@ Alternatively, a new token can be created at: ${GITHUB_TOKEN_GENERATE_URL} `; return { error }; } - /** Gets an owned fork for the configured project of the authenticated user. */ async getForkOfAuthenticatedUser() { const forks = await this.getAllForksOfAuthenticatedUser(); if (forks.length === 0) { @@ -30173,12 +42674,6 @@ Alternatively, a new token can be created at: ${GITHUB_TOKEN_GENERATE_URL} } return forks[0]; } - /** - * Finds all forks owned by the currently authenticated user in the Git client, - * - * The determined fork repositories are cached as we assume that the authenticated - * user will not change during execution, or that no new forks are created. - */ async getAllForksOfAuthenticatedUser() { if (this._cachedForkRepositories !== null) { return this._cachedForkRepositories; @@ -30190,7 +42685,6 @@ Alternatively, a new token can be created at: ${GITHUB_TOKEN_GENERATE_URL} name: node.name })); } - /** Fetch the OAuth scopes for the loaded Github token. */ _fetchAuthScopesForToken() { if (this._cachedOauthScopes !== null) { return this._cachedOauthScopes; @@ -30203,10 +42697,6 @@ Alternatively, a new token can be created at: ${GITHUB_TOKEN_GENERATE_URL} return scopes.split(",").map((scope) => scope.trim()).filter((scope) => scope !== ""); }); } - /** - * Static method to get the singleton instance of the `AuthenticatedGitClient`, - * creating it if it has not yet been created. - */ static async get() { if (_AuthenticatedGitClient._token === null) { throw new Error("No instance of `AuthenticatedGitClient` has been configured."); @@ -30218,7 +42708,6 @@ Alternatively, a new token can be created at: ${GITHUB_TOKEN_GENERATE_URL} } return _AuthenticatedGitClient._authenticatedInstance; } - /** Configures an authenticated git client. */ static configure(token, userType = "user") { if (_AuthenticatedGitClient._token) { throw Error("Unable to configure `AuthenticatedGitClient` as it has been configured already."); @@ -30251,7 +42740,8 @@ async function getDeployments() { [...ltsBranches.active, ...ltsBranches.inactive].forEach((branch) => { docSites.set(branch.name, { branch: branch.name, - destination: `v${branch.version.major}-angular-dev` + destination: `v${branch.version.major}-angular-dev`, + servingUrl: `https://v${branch.version.major}.angular.dev/` }); }); docSites.set(releaseTrains.latest.branchName, { @@ -30260,11 +42750,13 @@ async function getDeployments() { from: `v${releaseTrains.latest.version.major}-angular-dev`, to: "https://angular.dev" }, + servingUrl: "https://angular.dev/", destination: "angular-dev-site" }); if (releaseTrains.releaseCandidate) { docSites.set(releaseTrains.next.branchName, { - branch: releaseTrains.next.branchName + branch: releaseTrains.next.branchName, + servingUrl: "https://next.angular.dev/" }); docSites.set(releaseTrains.releaseCandidate.branchName, { branch: releaseTrains.releaseCandidate.branchName, @@ -30272,18 +42764,49 @@ async function getDeployments() { redirect: { from: `v${releaseTrains.releaseCandidate.version.major}-angular-dev`, to: "https://next.angular.dev" - } + }, + servingUrl: "https://next.angular.dev/" }); } else { docSites.set(releaseTrains.next.branchName, { branch: releaseTrains.next.branchName, - destination: "next-angular-dev" + destination: "next-angular-dev", + servingUrl: "https://next.angular.dev/" }); } return docSites; } +// .github/actions/deploy-docs-site/lib/sitemap.mjs +import { join as join3 } from "path"; +import { readFileSync, writeFileSync } from "fs"; +async function generateSitemap(deployment, distDir) { + const servingUrlWithoutEndingSlash = deployment.servingUrl.endsWith("/") ? deployment.servingUrl.slice(0, -1) : deployment.servingUrl; + const lastModifiedTimestamp = (/* @__PURE__ */ new Date()).toISOString(); + const routes = JSON.parse(readFileSync(join3(distDir, "prerendered-routes.json"), "utf-8")); + const sitemap = ` + + ${Object.keys(routes.routes).map((route) => { + const routeWithoutLeadingSlash = route.startsWith("/") ? route.slice(1) : route; + return ` + + ${servingUrlWithoutEndingSlash}/${routeWithoutLeadingSlash} + ${lastModifiedTimestamp} + daily + 1.0 + + `; + }).join("")} + `; + writeFileSync(join3(distDir, "browser", "sitemap.xml"), sitemap, "utf-8"); + console.log(`Generated sitemap with ${Object.keys(routes.routes).length} entries.`); +} + // .github/actions/deploy-docs-site/lib/main.mts +import { spawnSync as spawnSync3 } from "child_process"; +import { cp, mkdtemp as mkdtemp2 } from "fs/promises"; +import { tmpdir as tmpdir2 } from "os"; +import { join as join4 } from "path"; var refMatcher = /refs\/heads\/(.*)/; async function deployDocs() { setConfig({ @@ -30303,7 +42826,9 @@ async function deployDocs() { } const currentBranch = matchedRef[1]; const configPath = (0, import_core3.getInput)("configPath"); - const distDir = (0, import_core3.getInput)("distDir"); + const stagingDir = await mkdtemp2(join4(tmpdir2(), "deploy-directory")); + await cp((0, import_core3.getInput)("distDir"), stagingDir, { recursive: true }); + spawnSync3(`chmod 777 -R ${stagingDir}`, { encoding: "utf-8", shell: true }); const deployment = (await getDeployments()).get(currentBranch); if (deployment === void 0) { console.log(`Current branch (${currentBranch}) does not deploy a documentation site.`); @@ -30329,13 +42854,14 @@ async function deployDocs() { console.log(` From: ${deployment.redirect.from}`); console.log(` To: ${deployment.redirect.to}`); } - await deployToFirebase(deployment, configPath, distDir); + await generateSitemap(deployment, stagingDir); + await deployToFirebase(deployment, configPath, stagingDir); await setupRedirect(deployment); } if (import_github3.context.repo.owner === "angular") { - deployDocs().catch((e) => { - (0, import_core3.setFailed)(e.message); - console.error(e); + deployDocs().catch((e5) => { + (0, import_core3.setFailed)(e5.message); + console.error(e5); }); } else { console.warn( @@ -30353,228 +42879,49 @@ tmp/lib/tmp.js: * MIT Licensed *) -@angular/ng-dev/utils/child-process.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/utils/repo-directory.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/utils/logging.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/utils/config-cache.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/utils/config.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/commit-message/config.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/format/config.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/pr/config/index.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/release/config/index.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/release/versioning/release-trains.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/release/versioning/version-branches.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/release/versioning/active-release-trains.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/release/versioning/npm-registry.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/release/versioning/long-term-support.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/release/versioning/index.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/release/precheck/index.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/utils/git/graphql-queries.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/utils/dry-run.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) - -@angular/ng-dev/utils/git/github.js: - (** - * @license - * Copyright Google LLC +is-extglob/index.js: + (*! + * is-extglob * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license + * Copyright (c) 2014-2016, Jon Schlinkert. + * Licensed under the MIT License. *) -@angular/ng-dev/utils/git/github-urls.js: - (** - * @license - * Copyright Google LLC +is-glob/index.js: + (*! + * is-glob * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. *) -@angular/ng-dev/utils/git/git-client.js: - (** - * @license - * Copyright Google LLC +is-number/index.js: + (*! + * is-number * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license + * Copyright (c) 2014-present, Jon Schlinkert. + * Released under the MIT License. *) -@angular/ng-dev/utils/git/authenticated-git-client.js: - (** - * @license - * Copyright Google LLC +to-regex-range/index.js: + (*! + * to-regex-range * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license + * Copyright (c) 2015-present, Jon Schlinkert. + * Released under the MIT License. *) -@angular/ng-dev/utils/nodejs-errors.js: - (** - * @license - * Copyright Google LLC +fill-range/index.js: + (*! + * fill-range * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license + * Copyright (c) 2014-present, Jon Schlinkert. + * Licensed under the MIT License. *) -@angular/ng-dev/utils/resolve-yarn-bin.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) +queue-microtask/index.js: + (*! queue-microtask. MIT License. Feross Aboukhadijeh *) -@angular/ng-dev/index.js: - (** - * @license - * Copyright Google LLC - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - *) +run-parallel/index.js: + (*! run-parallel. MIT License. Feross Aboukhadijeh *) */ diff --git a/.github/actions/deploy-docs-site/tsconfig.json b/.github/actions/deploy-docs-site/tsconfig.json index 839b2e57c4f0..ddabad392d77 100644 --- a/.github/actions/deploy-docs-site/tsconfig.json +++ b/.github/actions/deploy-docs-site/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "module": "NodeNext", "target": "ES2021", + "types": ["node"], "lib": ["es2021"], "experimentalDecorators": true, "strict": true, @@ -11,6 +12,5 @@ "noImplicitReturns": true, "declaration": true, "sourceMap": true - } } \ No newline at end of file diff --git a/.github/actions/saucelabs-legacy/action.yml b/.github/actions/saucelabs-legacy/action.yml index 267ef4ed3f8e..5dcd170b6ae1 100644 --- a/.github/actions/saucelabs-legacy/action.yml +++ b/.github/actions/saucelabs-legacy/action.yml @@ -5,9 +5,9 @@ runs: using: 'composite' steps: - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Saucelabs Variables - uses: angular/dev-infra/github-actions/saucelabs@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/saucelabs@4425eed914bab0e311066d4b930c35576b7d200e - name: Starting Saucelabs tunnel service shell: bash run: ./tools/saucelabs/sauce-service.sh run & diff --git a/.github/workflows/adev-preview-build.yml b/.github/workflows/adev-preview-build.yml index cd28e5d409a8..069c458e57a0 100644 --- a/.github/workflows/adev-preview-build.yml +++ b/.github/workflows/adev-preview-build.yml @@ -15,22 +15,22 @@ permissions: read-all jobs: adev-build: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-8core if: | (github.event.action == 'labeled' && github.event.label.name == 'adev: preview') || (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'adev: preview')) steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e - name: Install node modules run: pnpm install --frozen-lockfile - - name: Build adev to ensure it continues to work - run: pnpm bazel build //adev:build --full_build_adev --config=release - - uses: angular/dev-infra/github-actions/previews/pack-and-upload-artifact@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + - name: Build adev + run: pnpm bazel build //adev:build.production + - uses: angular/dev-infra/github-actions/previews/pack-and-upload-artifact@4425eed914bab0e311066d4b930c35576b7d200e with: workflow-artifact-name: 'adev-preview' pull-number: '${{github.event.pull_request.number}}' diff --git a/.github/workflows/adev-preview-deploy.yml b/.github/workflows/adev-preview-deploy.yml index 125f7fef5d79..778c987d1d2e 100644 --- a/.github/workflows/adev-preview-deploy.yml +++ b/.github/workflows/adev-preview-deploy.yml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 with: token: '${{secrets.GITHUB_TOKEN}}' @@ -40,7 +40,7 @@ jobs: npx -y firebase-tools@latest target:clear --config adev/firebase.json --project ${{env.PREVIEW_PROJECT}} hosting angular-docs npx -y firebase-tools@latest target:apply --config adev/firebase.json --project ${{env.PREVIEW_PROJECT}} hosting angular-docs ${{env.PREVIEW_SITE}} - - uses: angular/dev-infra/github-actions/previews/upload-artifacts-to-firebase@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + - uses: angular/dev-infra/github-actions/previews/upload-artifacts-to-firebase@4425eed914bab0e311066d4b930c35576b7d200e with: github-token: '${{secrets.GITHUB_TOKEN}}' workflow-artifact-name: 'adev-preview' diff --git a/.github/workflows/assistant-to-the-branch-manager.yml b/.github/workflows/assistant-to-the-branch-manager.yml index 2270f4c825c9..07118beb0160 100644 --- a/.github/workflows/assistant-to-the-branch-manager.yml +++ b/.github/workflows/assistant-to-the-branch-manager.yml @@ -13,9 +13,9 @@ jobs: assistant_to_the_branch_manager: runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - - uses: angular/dev-infra/github-actions/branch-manager@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + - uses: angular/dev-infra/github-actions/branch-manager@4425eed914bab0e311066d4b930c35576b7d200e with: angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }} diff --git a/.github/workflows/benchmark-compare.yml b/.github/workflows/benchmark-compare.yml index eb45c5a433eb..219f1ae237e8 100644 --- a/.github/workflows/benchmark-compare.yml +++ b/.github/workflows/benchmark-compare.yml @@ -28,7 +28,7 @@ jobs: - uses: alessbell/pull-request-comment-branch@aad01d65d6982b8eacabed5e9a684cd8ceb98da6 # v1.1 id: comment-branch - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: # Specify repository as the PR branch might be from a fork. repository: ${{steps.comment-branch.outputs.head_owner}}/${{steps.comment-branch.outputs.head_repo}} @@ -38,7 +38,7 @@ jobs: - run: pnpm install --frozen-lockfile - - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + - uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e with: bazelrc: ./.bazelrc.user diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4840291c510..b90803bfb124 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,9 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 - with: - cache-node-modules: true + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Install node modules run: pnpm install --frozen-lockfile - name: Check code lint @@ -41,13 +39,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e with: - cache-node-modules: true + disable-package-manager-cache: true - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e with: google_credential: ${{ secrets.RBE_TRUSTED_BUILDS_USER }} - name: Install node modules @@ -63,18 +61,17 @@ jobs: start: pnpm bazel run //devtools/src:devserver wait-on: 'http://localhost:4200' wait-on-timeout: 300 + install: false test: - runs-on: ubuntu-latest-4core + runs-on: ubuntu-latest steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 - with: - cache-node-modules: true + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel Remote Caching - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e with: google_credential: ${{ secrets.RBE_TRUSTED_BUILDS_USER }} - name: Install node modules @@ -83,16 +80,14 @@ jobs: run: pnpm test:ci integration-tests: - runs-on: ubuntu-latest-4core + runs-on: ubuntu-latest steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 - with: - cache-node-modules: true + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel Remote Caching - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e with: google_credential: ${{ secrets.RBE_TRUSTED_BUILDS_USER }} - name: Install node modules @@ -102,14 +97,14 @@ jobs: adev: runs-on: - labels: ubuntu-latest-4core + labels: ubuntu-latest steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e with: google_credential: ${{ secrets.RBE_TRUSTED_BUILDS_USER }} - name: Install node modules @@ -117,20 +112,18 @@ jobs: - name: Run tests run: pnpm bazel test //adev/... - name: Build adev in fast mode to ensure it continues to work - run: pnpm bazel build //adev:build --config=release + run: pnpm bazel build //adev:build publish-snapshots: runs-on: labels: ubuntu-latest steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 - with: - cache-node-modules: true + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e - name: Install node modules run: pnpm install --frozen-lockfile - run: echo "https://${{secrets.SNAPSHOT_BUILDS_GITHUB_TOKEN}}:@github.com" > ${HOME}/.git_credentials @@ -139,20 +132,14 @@ jobs: zone-js: runs-on: - labels: ubuntu-latest-4core + labels: ubuntu-latest steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 - with: - cache-node-modules: true - node-module-directories: | - ./node_modules - ./packages/zone.js/node_modules - ./packages/zone.js/test/typings/node_modules + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e with: google_credential: ${{ secrets.RBE_TRUSTED_BUILDS_USER }} - name: Install node modules @@ -186,14 +173,12 @@ jobs: - run: pnpm -C packages/zone.js/test/typings test # saucelabs: - # runs-on: ubuntu-latest-4core + # runs-on: ubuntu-latest # env: # SAUCE_TUNNEL_IDENTIFIER: angular-framework-${{ github.run_number }} # steps: # - name: Initialize environment # uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@b5a3609f89c06eb4037dce22a93641213a5d1508 - # with: - # cache-node-modules: true # - name: Install node modules # run: pnpm install --frozen-lockfile # - uses: ./.github/actions/saucelabs-legacy @@ -201,22 +186,22 @@ jobs: adev-deploy: needs: [adev] if: needs.adev.result == 'success' - runs-on: ubuntu-latest + runs-on: ubuntu-latest-8core steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e - name: Install node modules run: pnpm install --frozen-lockfile - - name: Build adev to ensure it continues to work - run: pnpm bazel build //adev:build --full_build_adev --config=release + - name: Build adev + run: pnpm bazel build //adev:build.production --config=release - name: Deploy to firebase uses: ./.github/actions/deploy-docs-site with: serviceKey: ${{ secrets.ANGULAR_DEV_SITE_DEPLOY }} githubReleaseTrainReadToken: ${{ secrets.DOCS_DEPLOY_GITHUB_RELEASE_TRAIN_TOKEN }} configPath: 'adev/firebase.json' - distDir: 'dist/bin/adev/dist/browser' + distDir: 'dist/bin/adev/dist' diff --git a/.github/workflows/dev-infra.yml b/.github/workflows/dev-infra.yml index 4a613a0d801b..a0e91fad87aa 100644 --- a/.github/workflows/dev-infra.yml +++ b/.github/workflows/dev-infra.yml @@ -12,14 +12,14 @@ jobs: labels: runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: angular/dev-infra/github-actions/pull-request-labeling@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: angular/dev-infra/github-actions/pull-request-labeling@4425eed914bab0e311066d4b930c35576b7d200e with: angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }} post_approval_changes: runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: angular/dev-infra/github-actions/post-approval-changes@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: angular/dev-infra/github-actions/post-approval-changes@4425eed914bab0e311066d4b930c35576b7d200e with: angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }} diff --git a/.github/workflows/google-internal-tests.yml b/.github/workflows/google-internal-tests.yml index e6093c170e16..461a67efac91 100644 --- a/.github/workflows/google-internal-tests.yml +++ b/.github/workflows/google-internal-tests.yml @@ -13,8 +13,8 @@ jobs: statuses: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: angular/dev-infra/github-actions/google-internal-tests@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: angular/dev-infra/github-actions/google-internal-tests@4425eed914bab0e311066d4b930c35576b7d200e with: run-tests-guide-url: http://go/angular-g3sync-start github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml index 01e35fdf72cd..25ef18aba3a3 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/manual.yml @@ -8,22 +8,20 @@ jobs: # Bazel saucelabs job resides in `manual.yml` because it's currently unstable, but # kept as "runnable" for debugging/stabilization effort purposes. bazel-saucelabs: - runs-on: ubuntu-latest-4core + runs-on: ubuntu-latest env: JOBS: 2 steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 - with: - cache-node-modules: true + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Install node modules run: pnpm install --frozen-lockfile - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel Remote Caching - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Saucelabs Variables - uses: angular/dev-infra/github-actions/saucelabs@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/saucelabs@4425eed914bab0e311066d4b930c35576b7d200e - name: Set up Sauce Tunnel Daemon run: pnpm bazel run //tools/saucelabs-daemon/background-service -- $JOBS & env: diff --git a/.github/workflows/merge-ready-status.yml b/.github/workflows/merge-ready-status.yml index 404e3d48b0fd..73abf350a132 100644 --- a/.github/workflows/merge-ready-status.yml +++ b/.github/workflows/merge-ready-status.yml @@ -9,6 +9,6 @@ jobs: status: runs-on: ubuntu-latest steps: - - uses: angular/dev-infra/github-actions/unified-status-check@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + - uses: angular/dev-infra/github-actions/unified-status-check@4425eed914bab0e311066d4b930c35576b7d200e with: angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }} diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 775b0ba594cb..878ff5dc3aeb 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -21,7 +21,7 @@ jobs: workflows: ${{ steps.workflows.outputs.workflows }} steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Install node modules run: pnpm install --frozen-lockfile - id: workflows @@ -36,16 +36,16 @@ jobs: workflow: ${{ fromJSON(needs.list.outputs.workflows) }} steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Install node modules run: pnpm install --frozen-lockfile # We utilize the google-github-actions/auth action to allow us to get an active credential using workflow # identity federation. This allows us to request short lived credentials on demand, rather than storing # credentials in secrets long term. More information can be found at: # https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-google-cloud-platform - - uses: 'google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f' # v2 + - uses: 'google-github-actions/auth@c200f3691d83b41bf9bbd8638997a462592937ed' # v2 with: project_id: 'internal-200822' workload_identity_provider: 'projects/823469418460/locations/global/workloadIdentityPools/measurables-tracking/providers/angular' diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 55905d17763e..c62b93b36d79 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -19,9 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 - with: - cache-node-modules: true + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Install node modules run: pnpm install --frozen-lockfile - name: Check code lint @@ -39,7 +37,7 @@ jobs: - name: Check code format run: pnpm ng-dev format changed --check ${{ github.event.pull_request.base.sha }} - name: Check Package Licenses - uses: angular/dev-infra/github-actions/linting/licenses@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/linting/licenses@4425eed914bab0e311066d4b930c35576b7d200e with: allow-dependencies-licenses: 'pkg:npm/google-protobuf@' @@ -47,13 +45,18 @@ jobs: runs-on: ubuntu-latest steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e with: - cache-node-modules: true + disable-package-manager-cache: true - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e + - name: Cache downloaded Cypress binary + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: '~/.cache/Cypress' + key: cypress-cache-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} - name: Install node modules run: pnpm install --frozen-lockfile - name: Run unit tests @@ -67,18 +70,17 @@ jobs: start: pnpm bazel run //devtools/src:devserver wait-on: 'http://localhost:4200' wait-on-timeout: 300 + install: false test: - runs-on: ubuntu-latest-8core + runs-on: ubuntu-latest steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 - with: - cache-node-modules: true + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel Remote Caching - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e - name: Install node modules run: pnpm install --frozen-lockfile - name: Run CI tests for framework @@ -95,16 +97,14 @@ jobs: retention-days: 1 integration-tests: - runs-on: ubuntu-latest-4core + runs-on: ubuntu-latest steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 - with: - cache-node-modules: true + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel Remote Caching - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e - name: Install node modules run: pnpm install --frozen-lockfile - name: Run integration CI tests for framework @@ -112,37 +112,31 @@ jobs: adev: runs-on: - labels: ubuntu-latest-8core + labels: ubuntu-latest steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e - name: Install node modules run: pnpm install --frozen-lockfile - name: Run tests run: pnpm bazel test //adev/... - name: Build adev in fast mode to ensure it continues to work - run: pnpm bazel build //adev:build --config=release + run: pnpm bazel build //adev:build zone-js: runs-on: - labels: ubuntu-latest-4core + labels: ubuntu-latest steps: - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 - with: - cache-node-modules: true - node-module-directories: | - ./node_modules - ./packages/zone.js/node_modules - ./packages/zone.js/test/typings/node_modules + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/setup@4425eed914bab0e311066d4b930c35576b7d200e - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@4d2f875ec29ee71e0fe1a349a99c5ab2ccb71e30 + uses: angular/dev-infra/github-actions/bazel/configure-remote@4425eed914bab0e311066d4b930c35576b7d200e - name: Install node modules run: pnpm install --frozen-lockfile - run: | @@ -163,8 +157,6 @@ jobs: cp dist/bin/packages/zone.js/npm_package/bundles/zone-patch-electron.umd.js ./packages/zone.js/test/extra/ cp dist/bin/packages/zone.js/test/closure/zone.closure.js ./packages/zone.js/build/test/zone.closure.mjs - # Install - - run: pnpm -C packages/zone.js install --frozen-lockfile # Run zone.js tools tests - run: pnpm -C packages/zone.js promisefinallytest - run: pnpm -C packages/zone.js jest:test @@ -174,14 +166,12 @@ jobs: - run: pnpm -C packages/zone.js/test/typings test # saucelabs: - # runs-on: ubuntu-latest-4core + # runs-on: ubuntu-latest # env: # SAUCE_TUNNEL_IDENTIFIER: angular-framework-${{ github.run_number }} # steps: # - name: Initialize environment # uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@b5a3609f89c06eb4037dce22a93641213a5d1508 - # with: - # cache-node-modules: true # - name: Install node modules # run: pnpm install --frozen-lockfile # - uses: ./.github/actions/saucelabs-legacy diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 8a1cda9ec594..c70180ee9bd5 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -25,12 +25,12 @@ jobs: steps: - name: 'Checkout code' - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: 'Run analysis' - uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2 + uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3 with: results_file: results.sarif results_format: sarif @@ -47,6 +47,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: 'Upload to code-scanning' - uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5 + uses: github/codeql-action/upload-sarif@42213152a85ae7569bdb6bec7bcd74cd691bfe41 # v3.30.9 with: sarif_file: results.sarif diff --git a/.github/workflows/update-cdk-apis-and-cli-help.yml b/.github/workflows/update-cdk-apis-and-cli-help.yml index 48630ecea4fe..5fbe30f909e9 100644 --- a/.github/workflows/update-cdk-apis-and-cli-help.yml +++ b/.github/workflows/update-cdk-apis-and-cli-help.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout the repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: # Setting `persist-credentials: false` prevents the github-action account from being the # account that is attempted to be used for authentication, instead the remote is set to @@ -37,7 +37,7 @@ jobs: env: ANGULAR_CDK_BUILDS_READONLY_GITHUB_TOKEN: ${{ secrets.ANGULAR_CDK_BUILDS_READONLY_GITHUB_TOKEN }} - name: Create a PR CDK apis (if necessary) - uses: peter-evans/create-pull-request@v7.0.8 # v7.0.8 + uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 with: token: ${{ secrets.ANGULAR_ROBOT_ACCESS_TOKEN }} push-to-fork: 'angular-robot/angular' @@ -52,6 +52,7 @@ jobs: labels: | action: merge area: docs + target: automation commit-message: | docs: update Angular CDK apis @@ -66,7 +67,7 @@ jobs: env: ANGULAR_CLI_BUILDS_READONLY_GITHUB_TOKEN: ${{ secrets.ANGULAR_CLI_BUILDS_READONLY_GITHUB_TOKEN }} - name: Create a PR CLI help (if necessary) - uses: peter-evans/create-pull-request@v7.0.8 # v7.0.8 + uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 with: token: ${{ secrets.ANGULAR_ROBOT_ACCESS_TOKEN }} push-to-fork: 'angular-robot/angular' @@ -81,6 +82,7 @@ jobs: labels: | action: merge area: docs + target: automation commit-message: | docs: update Angular CLI help diff --git a/.ng-dev/format.mts b/.ng-dev/format.mts index 8b6e8b48ee1f..f46bb26e35ee 100644 --- a/.ng-dev/format.mts +++ b/.ng-dev/format.mts @@ -6,6 +6,7 @@ import {FormatConfig} from '@angular/ng-dev'; export const format: FormatConfig = { 'prettier': { 'matchers': [ + '**/*.md', '**/*.{yaml,yml}', '**/*.{js,ts,mjs,mts,cjs,cts,tsx}', 'devtools/**/*.{js,ts,mjs,mts,cjs,cts,html,scss}', @@ -15,7 +16,6 @@ export const format: FormatConfig = { // Both third_party and .yarn are directories containing copied code which should // not be modified. '!third_party/**', - '!.yarn/**', // Do not format the locale files which are checked-in for Google3, but generated using // the `generate-locales-tool` from `packages/common/locales`. '!packages/core/src/i18n/locale_en.ts', @@ -26,6 +26,9 @@ export const format: FormatConfig = { // Ignore generated javascript file(s) '!.github/actions/deploy-docs-site/main.js', + + // Ignore goldens MD files + '!/goldens/**/*.api.md', ], }, 'buildifier': true, diff --git a/.ng-dev/release.mts b/.ng-dev/release.mts index dff95e9e6f2a..e17dbd93e798 100644 --- a/.ng-dev/release.mts +++ b/.ng-dev/release.mts @@ -2,7 +2,6 @@ import {ReleaseConfig} from '@angular/ng-dev'; /** Configuration for the `ng-dev release` command. */ export const release: ReleaseConfig = { - rulesJsInteropMode: true, publishRegistry: 'https://wombat-dressing-room.appspot.com', representativeNpmPackage: '@angular/core', npmPackages: [ diff --git a/.nvmrc b/.nvmrc index 91d5f6ff8e3f..aa50a62f2194 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -22.18.0 +22.21.0 diff --git a/.pullapprove.yml b/.pullapprove.yml index ee2de32d1d6b..b3c539c1b4c6 100644 --- a/.pullapprove.yml +++ b/.pullapprove.yml @@ -15,9 +15,6 @@ # - We trust that people do the right thing and won't approve changes they don't feel confident reviewing # - We enforce that only approved PRs are merged ensuring that unreviewed code isn't accidentally merged # - We distribute approval rights as much as possible to help us scale better -# - Groups have one or two global approvers groups as fallbacks: -# - @angular/fw-global-approvers: for approving minor changes, large-scale refactorings, and emergency situations. -# - @angular/fw-global-approvers-for-docs-only-changes: for approving minor documentation-only changes that don't require engineering review # - A small number of file groups have very limited number of reviewers because incorrect changes to the files they guard would have serious consequences (e.g. security, public api) # # Configuration nuances: @@ -37,27 +34,10 @@ # See reviewer list under `required-minimum-review` group. Team member names and # usernames are managed there. -#################################################################################### -# Approval Groups -#################################################################################### -# ========================================================= -# @angular/framework-global-approvers -# ========================================================= -# Used for approving minor changes, large-scale refactorings, and in emergency situations. -# -# alxhub -# jelbourn -# josephperrott -# -# ========================================================= -# @angular/framework-global-approvers-for-docs-only-changes -# ========================================================= -# Used for approving minor documentation-only changes that don't require engineering review. - version: 3 -# availability: -# users_unavailable: ['atscott'] +#availability: +# users_unavailable: [] # Meta field that goes unused by PullApprove to allow for defining aliases to be # used throughout the config. @@ -97,14 +77,6 @@ overrides: - if: len(groups.active.exclude("required-minimum-review").exclude("global-*")) == 0 and len(groups.approved.include("global-*")) == 0 status: failure explanation: 'At least one group must match this PR. Please update an existing review group, or create a new group.' - # If any global dev-infra approval is given the status should be passing. - - if: len(groups.approved.include("global-dev-infra-approvers")) == 1 - status: success - explanation: 'Passing as globally approved by dev-infra' - # If any global docs approval is given the status should be passing. - - if: len(groups.approved.include("global-docs-approvers")) == 1 - status: success - explanation: 'Passing as globally approved by docs' # If any global approval is given the status should be passing. - if: len(groups.approved.include("global-approvers")) == 1 status: success @@ -135,6 +107,9 @@ groups: - kirjs - JoostK - mmalerba + - ~amishne + - ~leonsenft + - ~mattrbeck # ========================================================= # Framework: General (most code in our packages) @@ -177,6 +152,10 @@ groups: - thePunderWoman - ~pkozlowski-opensource - mmalerba + - JeanMeche + - ~amishne + - ~leonsenft + - ~mattrbeck # ========================================================= # Framework: Security-sensitive files which require extra review @@ -230,6 +209,9 @@ groups: - thePunderWoman - ~pkozlowski-opensource - mmalerba + - ~amishne + - ~leonsenft + - ~mattrbeck # ========================================================= # Tooling: Compiler API shared with Angular CLI @@ -273,7 +255,7 @@ groups: - bencodezen - crisbeto - kirjs - - ~JeanMeche + - JeanMeche - jelbourn - thePunderWoman - devversion @@ -283,6 +265,9 @@ groups: - MarkTechson - mmalerba - ~hawkgs + - ~amishne + - ~leonsenft + - ~mattrbeck # ========================================================= # Angular DevTools @@ -300,7 +285,7 @@ groups: - ~devversion - dgp1130 - hawkgs - - jkrems + - hybrist - ~josephperrott - JeanMeche - milomg @@ -320,7 +305,6 @@ groups: '.gemini/**/{*,.*}', '.ng-dev/**/{*,.*}', '.vscode/**/{*,.*}', - '.yarn/**/{*,.*}', 'contributing-docs/*.md', 'contributing-docs/images/**/{*,.*}', 'goldens/{*,.*}', @@ -393,13 +377,16 @@ groups: - crisbeto - devversion - JeanMeche - - ~jkrems + - ~hybrist - ~iteriani - ~tbondwilkinson - ~rahatarmanahmed + - ~amishne + - ~leonsenft + - ~mattrbeck reviews: - request: 3 # Request reviews from 3 people - required: 2 # Require that 2 people approve + request: 2 + required: 1 reviewed_for: required # ================================================ @@ -424,6 +411,9 @@ groups: - thePunderWoman - ~pkozlowski-opensource - mmalerba + - ~amishne + - ~leonsenft + - ~mattrbeck reviews: request: 2 # Request reviews from 2 people required: 1 # Require that 1 person approve @@ -517,44 +507,10 @@ groups: global-approvers: type: optional reviewers: - teams: - - framework-global-approvers - reviews: - request: 0 - required: 1 - reviewed_for: required - - # ========================================================= - # Global Approvers For Docs - # - # All reviews performed for global docs approvals require - # using the `Reviewed-for:` specifier to set the approval - # specificity as documented at: - # https://docs.pullapprove.com/reviewed-for/ - # ========================================================= - global-docs-approvers: - type: optional - reviewers: - teams: - - framework-global-approvers-for-docs-only-changes - reviews: - request: 0 - required: 1 - reviewed_for: required - - # ========================================================= - # Global Approvers For Dev-Infra changes - # - # All reviews performed for global dev-infra approvals - # require using the `Reviewed-for:` specifier to set the - # approval specificity as documented at: - # https://docs.pullapprove.com/reviewed-for/ - # ========================================================= - global-dev-infra-approvers: - type: optional - reviewers: - teams: - - dev-infra-framework + users: + - alxhub + - jelbourn + - josephperrott reviews: request: 0 required: 1 diff --git a/.yarn/README.md b/.yarn/README.md deleted file mode 100644 index de1653b9dea0..000000000000 --- a/.yarn/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Yarn Vendoring -We utilize Yarn's `yarn-path` configuration in a shared `.yarnrc` file to enforce -everyone using the same version of Yarn. Yarn checks the `.yarnrc` file to -determine if yarn should delegate the command to a vendored version at the -provided path. - -## How to update -To update to the latest version of Yarn as our vendored version: -- Run this command -```sh -yarn policies set-version latest -``` -- Remove the previous version diff --git a/.yarn/releases/yarn-1.22.22.cjs b/.yarn/releases/yarn-1.22.22.cjs deleted file mode 100755 index ad51d93a8c9c..000000000000 --- a/.yarn/releases/yarn-1.22.22.cjs +++ /dev/null @@ -1,148049 +0,0 @@ -#!/usr/bin/env node -module.exports = -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // identity function for calling harmony imports with the correct context -/******/ __webpack_require__.i = function(value) { return value; }; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 517); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { - -module.exports = require("path"); - -/***/ }), -/* 1 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = __extends; -/* unused harmony export __assign */ -/* unused harmony export __rest */ -/* unused harmony export __decorate */ -/* unused harmony export __param */ -/* unused harmony export __metadata */ -/* unused harmony export __awaiter */ -/* unused harmony export __generator */ -/* unused harmony export __exportStar */ -/* unused harmony export __values */ -/* unused harmony export __read */ -/* unused harmony export __spread */ -/* unused harmony export __await */ -/* unused harmony export __asyncGenerator */ -/* unused harmony export __asyncDelegator */ -/* unused harmony export __asyncValues */ -/* unused harmony export __makeTemplateObject */ -/* unused harmony export __importStar */ -/* unused harmony export __importDefault */ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ -/* global Reflect, Promise */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - } - return __assign.apply(this, arguments); -} - -function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) - t[p[i]] = s[p[i]]; - return t; -} - -function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -function __awaiter(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -function __exportStar(m, exports) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} - -function __values(o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; - if (m) return m.call(o); - return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; -} - -function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } -} - -function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result.default = mod; - return result; -} - -function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} - - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; - -var _promise = __webpack_require__(224); - -var _promise2 = _interopRequireDefault(_promise); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = function (fn) { - return function () { - var gen = fn.apply(this, arguments); - return new _promise2.default(function (resolve, reject) { - function step(key, arg) { - try { - var info = gen[key](arg); - var value = info.value; - } catch (error) { - reject(error); - return; - } - - if (info.done) { - resolve(value); - } else { - return _promise2.default.resolve(value).then(function (value) { - step("next", value); - }, function (err) { - step("throw", err); - }); - } - } - - return step("next"); - }); - }; -}; - -/***/ }), -/* 3 */ -/***/ (function(module, exports) { - -module.exports = require("util"); - -/***/ }), -/* 4 */ -/***/ (function(module, exports) { - -module.exports = require("fs"); - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getFirstSuitableFolder = exports.readFirstAvailableStream = exports.makeTempDir = exports.hardlinksWork = exports.writeFilePreservingEol = exports.getFileSizeOnDisk = exports.walk = exports.symlink = exports.find = exports.readJsonAndFile = exports.readJson = exports.readFileAny = exports.hardlinkBulk = exports.copyBulk = exports.unlink = exports.glob = exports.link = exports.chmod = exports.lstat = exports.exists = exports.mkdirp = exports.stat = exports.access = exports.rename = exports.readdir = exports.realpath = exports.readlink = exports.writeFile = exports.open = exports.readFileBuffer = exports.lockQueue = exports.constants = undefined; - -var _asyncToGenerator2; - -function _load_asyncToGenerator() { - return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); -} - -let buildActionsForCopy = (() => { - var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, events, possibleExtraneous, reporter) { - - // - let build = (() => { - var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) { - const src = data.src, - dest = data.dest, - type = data.type; - - const onFresh = data.onFresh || noop; - const onDone = data.onDone || noop; - - // TODO https://github.com/yarnpkg/yarn/issues/3751 - // related to bundled dependencies handling - if (files.has(dest.toLowerCase())) { - reporter.verbose(`The case-insensitive file ${dest} shouldn't be copied twice in one bulk copy`); - } else { - files.add(dest.toLowerCase()); - } - - if (type === 'symlink') { - yield mkdirp((_path || _load_path()).default.dirname(dest)); - onFresh(); - actions.symlink.push({ - dest, - linkname: src - }); - onDone(); - return; - } - - if (events.ignoreBasenames.indexOf((_path || _load_path()).default.basename(src)) >= 0) { - // ignored file - return; - } - - const srcStat = yield lstat(src); - let srcFiles; - - if (srcStat.isDirectory()) { - srcFiles = yield readdir(src); - } - - let destStat; - try { - // try accessing the destination - destStat = yield lstat(dest); - } catch (e) { - // proceed if destination doesn't exist, otherwise error - if (e.code !== 'ENOENT') { - throw e; - } - } - - // if destination exists - if (destStat) { - const bothSymlinks = srcStat.isSymbolicLink() && destStat.isSymbolicLink(); - const bothFolders = srcStat.isDirectory() && destStat.isDirectory(); - const bothFiles = srcStat.isFile() && destStat.isFile(); - - // EINVAL access errors sometimes happen which shouldn't because node shouldn't be giving - // us modes that aren't valid. investigate this, it's generally safe to proceed. - - /* if (srcStat.mode !== destStat.mode) { - try { - await access(dest, srcStat.mode); - } catch (err) {} - } */ - - if (bothFiles && artifactFiles.has(dest)) { - // this file gets changed during build, likely by a custom install script. Don't bother checking it. - onDone(); - reporter.verbose(reporter.lang('verboseFileSkipArtifact', src)); - return; - } - - if (bothFiles && srcStat.size === destStat.size && (0, (_fsNormalized || _load_fsNormalized()).fileDatesEqual)(srcStat.mtime, destStat.mtime)) { - // we can safely assume this is the same file - onDone(); - reporter.verbose(reporter.lang('verboseFileSkip', src, dest, srcStat.size, +srcStat.mtime)); - return; - } - - if (bothSymlinks) { - const srcReallink = yield readlink(src); - if (srcReallink === (yield readlink(dest))) { - // if both symlinks are the same then we can continue on - onDone(); - reporter.verbose(reporter.lang('verboseFileSkipSymlink', src, dest, srcReallink)); - return; - } - } - - if (bothFolders) { - // mark files that aren't in this folder as possibly extraneous - const destFiles = yield readdir(dest); - invariant(srcFiles, 'src files not initialised'); - - for (var _iterator4 = destFiles, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { - var _ref6; - - if (_isArray4) { - if (_i4 >= _iterator4.length) break; - _ref6 = _iterator4[_i4++]; - } else { - _i4 = _iterator4.next(); - if (_i4.done) break; - _ref6 = _i4.value; - } - - const file = _ref6; - - if (srcFiles.indexOf(file) < 0) { - const loc = (_path || _load_path()).default.join(dest, file); - possibleExtraneous.add(loc); - - if ((yield lstat(loc)).isDirectory()) { - for (var _iterator5 = yield readdir(loc), _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { - var _ref7; - - if (_isArray5) { - if (_i5 >= _iterator5.length) break; - _ref7 = _iterator5[_i5++]; - } else { - _i5 = _iterator5.next(); - if (_i5.done) break; - _ref7 = _i5.value; - } - - const file = _ref7; - - possibleExtraneous.add((_path || _load_path()).default.join(loc, file)); - } - } - } - } - } - } - - if (destStat && destStat.isSymbolicLink()) { - yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(dest); - destStat = null; - } - - if (srcStat.isSymbolicLink()) { - onFresh(); - const linkname = yield readlink(src); - actions.symlink.push({ - dest, - linkname - }); - onDone(); - } else if (srcStat.isDirectory()) { - if (!destStat) { - reporter.verbose(reporter.lang('verboseFileFolder', dest)); - yield mkdirp(dest); - } - - const destParts = dest.split((_path || _load_path()).default.sep); - while (destParts.length) { - files.add(destParts.join((_path || _load_path()).default.sep).toLowerCase()); - destParts.pop(); - } - - // push all files to queue - invariant(srcFiles, 'src files not initialised'); - let remaining = srcFiles.length; - if (!remaining) { - onDone(); - } - for (var _iterator6 = srcFiles, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) { - var _ref8; - - if (_isArray6) { - if (_i6 >= _iterator6.length) break; - _ref8 = _iterator6[_i6++]; - } else { - _i6 = _iterator6.next(); - if (_i6.done) break; - _ref8 = _i6.value; - } - - const file = _ref8; - - queue.push({ - dest: (_path || _load_path()).default.join(dest, file), - onFresh, - onDone: function (_onDone) { - function onDone() { - return _onDone.apply(this, arguments); - } - - onDone.toString = function () { - return _onDone.toString(); - }; - - return onDone; - }(function () { - if (--remaining === 0) { - onDone(); - } - }), - src: (_path || _load_path()).default.join(src, file) - }); - } - } else if (srcStat.isFile()) { - onFresh(); - actions.file.push({ - src, - dest, - atime: srcStat.atime, - mtime: srcStat.mtime, - mode: srcStat.mode - }); - onDone(); - } else { - throw new Error(`unsure how to copy this: ${src}`); - } - }); - - return function build(_x5) { - return _ref5.apply(this, arguments); - }; - })(); - - const artifactFiles = new Set(events.artifactFiles || []); - const files = new Set(); - - // initialise events - for (var _iterator = queue, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref2; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref2 = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref2 = _i.value; - } - - const item = _ref2; - - const onDone = item.onDone; - item.onDone = function () { - events.onProgress(item.dest); - if (onDone) { - onDone(); - } - }; - } - events.onStart(queue.length); - - // start building actions - const actions = { - file: [], - symlink: [], - link: [] - }; - - // custom concurrency logic as we're always executing stacks of CONCURRENT_QUEUE_ITEMS queue items - // at a time due to the requirement to push items onto the queue - while (queue.length) { - const items = queue.splice(0, CONCURRENT_QUEUE_ITEMS); - yield Promise.all(items.map(build)); - } - - // simulate the existence of some files to prevent considering them extraneous - for (var _iterator2 = artifactFiles, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { - var _ref3; - - if (_isArray2) { - if (_i2 >= _iterator2.length) break; - _ref3 = _iterator2[_i2++]; - } else { - _i2 = _iterator2.next(); - if (_i2.done) break; - _ref3 = _i2.value; - } - - const file = _ref3; - - if (possibleExtraneous.has(file)) { - reporter.verbose(reporter.lang('verboseFilePhantomExtraneous', file)); - possibleExtraneous.delete(file); - } - } - - for (var _iterator3 = possibleExtraneous, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { - var _ref4; - - if (_isArray3) { - if (_i3 >= _iterator3.length) break; - _ref4 = _iterator3[_i3++]; - } else { - _i3 = _iterator3.next(); - if (_i3.done) break; - _ref4 = _i3.value; - } - - const loc = _ref4; - - if (files.has(loc.toLowerCase())) { - possibleExtraneous.delete(loc); - } - } - - return actions; - }); - - return function buildActionsForCopy(_x, _x2, _x3, _x4) { - return _ref.apply(this, arguments); - }; -})(); - -let buildActionsForHardlink = (() => { - var _ref9 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, events, possibleExtraneous, reporter) { - - // - let build = (() => { - var _ref13 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) { - const src = data.src, - dest = data.dest; - - const onFresh = data.onFresh || noop; - const onDone = data.onDone || noop; - if (files.has(dest.toLowerCase())) { - // Fixes issue https://github.com/yarnpkg/yarn/issues/2734 - // When bulk hardlinking we have A -> B structure that we want to hardlink to A1 -> B1, - // package-linker passes that modules A1 and B1 need to be hardlinked, - // the recursive linking algorithm of A1 ends up scheduling files in B1 to be linked twice which will case - // an exception. - onDone(); - return; - } - files.add(dest.toLowerCase()); - - if (events.ignoreBasenames.indexOf((_path || _load_path()).default.basename(src)) >= 0) { - // ignored file - return; - } - - const srcStat = yield lstat(src); - let srcFiles; - - if (srcStat.isDirectory()) { - srcFiles = yield readdir(src); - } - - const destExists = yield exists(dest); - if (destExists) { - const destStat = yield lstat(dest); - - const bothSymlinks = srcStat.isSymbolicLink() && destStat.isSymbolicLink(); - const bothFolders = srcStat.isDirectory() && destStat.isDirectory(); - const bothFiles = srcStat.isFile() && destStat.isFile(); - - if (srcStat.mode !== destStat.mode) { - try { - yield access(dest, srcStat.mode); - } catch (err) { - // EINVAL access errors sometimes happen which shouldn't because node shouldn't be giving - // us modes that aren't valid. investigate this, it's generally safe to proceed. - reporter.verbose(err); - } - } - - if (bothFiles && artifactFiles.has(dest)) { - // this file gets changed during build, likely by a custom install script. Don't bother checking it. - onDone(); - reporter.verbose(reporter.lang('verboseFileSkipArtifact', src)); - return; - } - - // correct hardlink - if (bothFiles && srcStat.ino !== null && srcStat.ino === destStat.ino) { - onDone(); - reporter.verbose(reporter.lang('verboseFileSkip', src, dest, srcStat.ino)); - return; - } - - if (bothSymlinks) { - const srcReallink = yield readlink(src); - if (srcReallink === (yield readlink(dest))) { - // if both symlinks are the same then we can continue on - onDone(); - reporter.verbose(reporter.lang('verboseFileSkipSymlink', src, dest, srcReallink)); - return; - } - } - - if (bothFolders) { - // mark files that aren't in this folder as possibly extraneous - const destFiles = yield readdir(dest); - invariant(srcFiles, 'src files not initialised'); - - for (var _iterator10 = destFiles, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : _iterator10[Symbol.iterator]();;) { - var _ref14; - - if (_isArray10) { - if (_i10 >= _iterator10.length) break; - _ref14 = _iterator10[_i10++]; - } else { - _i10 = _iterator10.next(); - if (_i10.done) break; - _ref14 = _i10.value; - } - - const file = _ref14; - - if (srcFiles.indexOf(file) < 0) { - const loc = (_path || _load_path()).default.join(dest, file); - possibleExtraneous.add(loc); - - if ((yield lstat(loc)).isDirectory()) { - for (var _iterator11 = yield readdir(loc), _isArray11 = Array.isArray(_iterator11), _i11 = 0, _iterator11 = _isArray11 ? _iterator11 : _iterator11[Symbol.iterator]();;) { - var _ref15; - - if (_isArray11) { - if (_i11 >= _iterator11.length) break; - _ref15 = _iterator11[_i11++]; - } else { - _i11 = _iterator11.next(); - if (_i11.done) break; - _ref15 = _i11.value; - } - - const file = _ref15; - - possibleExtraneous.add((_path || _load_path()).default.join(loc, file)); - } - } - } - } - } - } - - if (srcStat.isSymbolicLink()) { - onFresh(); - const linkname = yield readlink(src); - actions.symlink.push({ - dest, - linkname - }); - onDone(); - } else if (srcStat.isDirectory()) { - reporter.verbose(reporter.lang('verboseFileFolder', dest)); - yield mkdirp(dest); - - const destParts = dest.split((_path || _load_path()).default.sep); - while (destParts.length) { - files.add(destParts.join((_path || _load_path()).default.sep).toLowerCase()); - destParts.pop(); - } - - // push all files to queue - invariant(srcFiles, 'src files not initialised'); - let remaining = srcFiles.length; - if (!remaining) { - onDone(); - } - for (var _iterator12 = srcFiles, _isArray12 = Array.isArray(_iterator12), _i12 = 0, _iterator12 = _isArray12 ? _iterator12 : _iterator12[Symbol.iterator]();;) { - var _ref16; - - if (_isArray12) { - if (_i12 >= _iterator12.length) break; - _ref16 = _iterator12[_i12++]; - } else { - _i12 = _iterator12.next(); - if (_i12.done) break; - _ref16 = _i12.value; - } - - const file = _ref16; - - queue.push({ - onFresh, - src: (_path || _load_path()).default.join(src, file), - dest: (_path || _load_path()).default.join(dest, file), - onDone: function (_onDone2) { - function onDone() { - return _onDone2.apply(this, arguments); - } - - onDone.toString = function () { - return _onDone2.toString(); - }; - - return onDone; - }(function () { - if (--remaining === 0) { - onDone(); - } - }) - }); - } - } else if (srcStat.isFile()) { - onFresh(); - actions.link.push({ - src, - dest, - removeDest: destExists - }); - onDone(); - } else { - throw new Error(`unsure how to copy this: ${src}`); - } - }); - - return function build(_x10) { - return _ref13.apply(this, arguments); - }; - })(); - - const artifactFiles = new Set(events.artifactFiles || []); - const files = new Set(); - - // initialise events - for (var _iterator7 = queue, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) { - var _ref10; - - if (_isArray7) { - if (_i7 >= _iterator7.length) break; - _ref10 = _iterator7[_i7++]; - } else { - _i7 = _iterator7.next(); - if (_i7.done) break; - _ref10 = _i7.value; - } - - const item = _ref10; - - const onDone = item.onDone || noop; - item.onDone = function () { - events.onProgress(item.dest); - onDone(); - }; - } - events.onStart(queue.length); - - // start building actions - const actions = { - file: [], - symlink: [], - link: [] - }; - - // custom concurrency logic as we're always executing stacks of CONCURRENT_QUEUE_ITEMS queue items - // at a time due to the requirement to push items onto the queue - while (queue.length) { - const items = queue.splice(0, CONCURRENT_QUEUE_ITEMS); - yield Promise.all(items.map(build)); - } - - // simulate the existence of some files to prevent considering them extraneous - for (var _iterator8 = artifactFiles, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator]();;) { - var _ref11; - - if (_isArray8) { - if (_i8 >= _iterator8.length) break; - _ref11 = _iterator8[_i8++]; - } else { - _i8 = _iterator8.next(); - if (_i8.done) break; - _ref11 = _i8.value; - } - - const file = _ref11; - - if (possibleExtraneous.has(file)) { - reporter.verbose(reporter.lang('verboseFilePhantomExtraneous', file)); - possibleExtraneous.delete(file); - } - } - - for (var _iterator9 = possibleExtraneous, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator]();;) { - var _ref12; - - if (_isArray9) { - if (_i9 >= _iterator9.length) break; - _ref12 = _iterator9[_i9++]; - } else { - _i9 = _iterator9.next(); - if (_i9.done) break; - _ref12 = _i9.value; - } - - const loc = _ref12; - - if (files.has(loc.toLowerCase())) { - possibleExtraneous.delete(loc); - } - } - - return actions; - }); - - return function buildActionsForHardlink(_x6, _x7, _x8, _x9) { - return _ref9.apply(this, arguments); - }; -})(); - -let copyBulk = exports.copyBulk = (() => { - var _ref17 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, reporter, _events) { - const events = { - onStart: _events && _events.onStart || noop, - onProgress: _events && _events.onProgress || noop, - possibleExtraneous: _events ? _events.possibleExtraneous : new Set(), - ignoreBasenames: _events && _events.ignoreBasenames || [], - artifactFiles: _events && _events.artifactFiles || [] - }; - - const actions = yield buildActionsForCopy(queue, events, events.possibleExtraneous, reporter); - events.onStart(actions.file.length + actions.symlink.length + actions.link.length); - - const fileActions = actions.file; - - const currentlyWriting = new Map(); - - yield (_promise || _load_promise()).queue(fileActions, (() => { - var _ref18 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) { - let writePromise; - while (writePromise = currentlyWriting.get(data.dest)) { - yield writePromise; - } - - reporter.verbose(reporter.lang('verboseFileCopy', data.src, data.dest)); - const copier = (0, (_fsNormalized || _load_fsNormalized()).copyFile)(data, function () { - return currentlyWriting.delete(data.dest); - }); - currentlyWriting.set(data.dest, copier); - events.onProgress(data.dest); - return copier; - }); - - return function (_x14) { - return _ref18.apply(this, arguments); - }; - })(), CONCURRENT_QUEUE_ITEMS); - - // we need to copy symlinks last as they could reference files we were copying - const symlinkActions = actions.symlink; - yield (_promise || _load_promise()).queue(symlinkActions, function (data) { - const linkname = (_path || _load_path()).default.resolve((_path || _load_path()).default.dirname(data.dest), data.linkname); - reporter.verbose(reporter.lang('verboseFileSymlink', data.dest, linkname)); - return symlink(linkname, data.dest); - }); - }); - - return function copyBulk(_x11, _x12, _x13) { - return _ref17.apply(this, arguments); - }; -})(); - -let hardlinkBulk = exports.hardlinkBulk = (() => { - var _ref19 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (queue, reporter, _events) { - const events = { - onStart: _events && _events.onStart || noop, - onProgress: _events && _events.onProgress || noop, - possibleExtraneous: _events ? _events.possibleExtraneous : new Set(), - artifactFiles: _events && _events.artifactFiles || [], - ignoreBasenames: [] - }; - - const actions = yield buildActionsForHardlink(queue, events, events.possibleExtraneous, reporter); - events.onStart(actions.file.length + actions.symlink.length + actions.link.length); - - const fileActions = actions.link; - - yield (_promise || _load_promise()).queue(fileActions, (() => { - var _ref20 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) { - reporter.verbose(reporter.lang('verboseFileLink', data.src, data.dest)); - if (data.removeDest) { - yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(data.dest); - } - yield link(data.src, data.dest); - }); - - return function (_x18) { - return _ref20.apply(this, arguments); - }; - })(), CONCURRENT_QUEUE_ITEMS); - - // we need to copy symlinks last as they could reference files we were copying - const symlinkActions = actions.symlink; - yield (_promise || _load_promise()).queue(symlinkActions, function (data) { - const linkname = (_path || _load_path()).default.resolve((_path || _load_path()).default.dirname(data.dest), data.linkname); - reporter.verbose(reporter.lang('verboseFileSymlink', data.dest, linkname)); - return symlink(linkname, data.dest); - }); - }); - - return function hardlinkBulk(_x15, _x16, _x17) { - return _ref19.apply(this, arguments); - }; -})(); - -let readFileAny = exports.readFileAny = (() => { - var _ref21 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (files) { - for (var _iterator13 = files, _isArray13 = Array.isArray(_iterator13), _i13 = 0, _iterator13 = _isArray13 ? _iterator13 : _iterator13[Symbol.iterator]();;) { - var _ref22; - - if (_isArray13) { - if (_i13 >= _iterator13.length) break; - _ref22 = _iterator13[_i13++]; - } else { - _i13 = _iterator13.next(); - if (_i13.done) break; - _ref22 = _i13.value; - } - - const file = _ref22; - - if (yield exists(file)) { - return readFile(file); - } - } - return null; - }); - - return function readFileAny(_x19) { - return _ref21.apply(this, arguments); - }; -})(); - -let readJson = exports.readJson = (() => { - var _ref23 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (loc) { - return (yield readJsonAndFile(loc)).object; - }); - - return function readJson(_x20) { - return _ref23.apply(this, arguments); - }; -})(); - -let readJsonAndFile = exports.readJsonAndFile = (() => { - var _ref24 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (loc) { - const file = yield readFile(loc); - try { - return { - object: (0, (_map || _load_map()).default)(JSON.parse(stripBOM(file))), - content: file - }; - } catch (err) { - err.message = `${loc}: ${err.message}`; - throw err; - } - }); - - return function readJsonAndFile(_x21) { - return _ref24.apply(this, arguments); - }; -})(); - -let find = exports.find = (() => { - var _ref25 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (filename, dir) { - const parts = dir.split((_path || _load_path()).default.sep); - - while (parts.length) { - const loc = parts.concat(filename).join((_path || _load_path()).default.sep); - - if (yield exists(loc)) { - return loc; - } else { - parts.pop(); - } - } - - return false; - }); - - return function find(_x22, _x23) { - return _ref25.apply(this, arguments); - }; -})(); - -let symlink = exports.symlink = (() => { - var _ref26 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (src, dest) { - if (process.platform !== 'win32') { - // use relative paths otherwise which will be retained if the directory is moved - src = (_path || _load_path()).default.relative((_path || _load_path()).default.dirname(dest), src); - // When path.relative returns an empty string for the current directory, we should instead use - // '.', which is a valid fs.symlink target. - src = src || '.'; - } - - try { - const stats = yield lstat(dest); - if (stats.isSymbolicLink()) { - const resolved = dest; - if (resolved === src) { - return; - } - } - } catch (err) { - if (err.code !== 'ENOENT') { - throw err; - } - } - - // We use rimraf for unlink which never throws an ENOENT on missing target - yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(dest); - - if (process.platform === 'win32') { - // use directory junctions if possible on win32, this requires absolute paths - yield fsSymlink(src, dest, 'junction'); - } else { - yield fsSymlink(src, dest); - } - }); - - return function symlink(_x24, _x25) { - return _ref26.apply(this, arguments); - }; -})(); - -let walk = exports.walk = (() => { - var _ref27 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (dir, relativeDir, ignoreBasenames = new Set()) { - let files = []; - - let filenames = yield readdir(dir); - if (ignoreBasenames.size) { - filenames = filenames.filter(function (name) { - return !ignoreBasenames.has(name); - }); - } - - for (var _iterator14 = filenames, _isArray14 = Array.isArray(_iterator14), _i14 = 0, _iterator14 = _isArray14 ? _iterator14 : _iterator14[Symbol.iterator]();;) { - var _ref28; - - if (_isArray14) { - if (_i14 >= _iterator14.length) break; - _ref28 = _iterator14[_i14++]; - } else { - _i14 = _iterator14.next(); - if (_i14.done) break; - _ref28 = _i14.value; - } - - const name = _ref28; - - const relative = relativeDir ? (_path || _load_path()).default.join(relativeDir, name) : name; - const loc = (_path || _load_path()).default.join(dir, name); - const stat = yield lstat(loc); - - files.push({ - relative, - basename: name, - absolute: loc, - mtime: +stat.mtime - }); - - if (stat.isDirectory()) { - files = files.concat((yield walk(loc, relative, ignoreBasenames))); - } - } - - return files; - }); - - return function walk(_x26, _x27) { - return _ref27.apply(this, arguments); - }; -})(); - -let getFileSizeOnDisk = exports.getFileSizeOnDisk = (() => { - var _ref29 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (loc) { - const stat = yield lstat(loc); - const size = stat.size, - blockSize = stat.blksize; - - - return Math.ceil(size / blockSize) * blockSize; - }); - - return function getFileSizeOnDisk(_x28) { - return _ref29.apply(this, arguments); - }; -})(); - -let getEolFromFile = (() => { - var _ref30 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (path) { - if (!(yield exists(path))) { - return undefined; - } - - const buffer = yield readFileBuffer(path); - - for (let i = 0; i < buffer.length; ++i) { - if (buffer[i] === cr) { - return '\r\n'; - } - if (buffer[i] === lf) { - return '\n'; - } - } - return undefined; - }); - - return function getEolFromFile(_x29) { - return _ref30.apply(this, arguments); - }; -})(); - -let writeFilePreservingEol = exports.writeFilePreservingEol = (() => { - var _ref31 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (path, data) { - const eol = (yield getEolFromFile(path)) || (_os || _load_os()).default.EOL; - if (eol !== '\n') { - data = data.replace(/\n/g, eol); - } - yield writeFile(path, data); - }); - - return function writeFilePreservingEol(_x30, _x31) { - return _ref31.apply(this, arguments); - }; -})(); - -let hardlinksWork = exports.hardlinksWork = (() => { - var _ref32 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (dir) { - const filename = 'test-file' + Math.random(); - const file = (_path || _load_path()).default.join(dir, filename); - const fileLink = (_path || _load_path()).default.join(dir, filename + '-link'); - try { - yield writeFile(file, 'test'); - yield link(file, fileLink); - } catch (err) { - return false; - } finally { - yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(file); - yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(fileLink); - } - return true; - }); - - return function hardlinksWork(_x32) { - return _ref32.apply(this, arguments); - }; -})(); - -// not a strict polyfill for Node's fs.mkdtemp - - -let makeTempDir = exports.makeTempDir = (() => { - var _ref33 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (prefix) { - const dir = (_path || _load_path()).default.join((_os || _load_os()).default.tmpdir(), `yarn-${prefix || ''}-${Date.now()}-${Math.random()}`); - yield (0, (_fsNormalized || _load_fsNormalized()).unlink)(dir); - yield mkdirp(dir); - return dir; - }); - - return function makeTempDir(_x33) { - return _ref33.apply(this, arguments); - }; -})(); - -let readFirstAvailableStream = exports.readFirstAvailableStream = (() => { - var _ref34 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (paths) { - for (var _iterator15 = paths, _isArray15 = Array.isArray(_iterator15), _i15 = 0, _iterator15 = _isArray15 ? _iterator15 : _iterator15[Symbol.iterator]();;) { - var _ref35; - - if (_isArray15) { - if (_i15 >= _iterator15.length) break; - _ref35 = _iterator15[_i15++]; - } else { - _i15 = _iterator15.next(); - if (_i15.done) break; - _ref35 = _i15.value; - } - - const path = _ref35; - - try { - const fd = yield open(path, 'r'); - return (_fs || _load_fs()).default.createReadStream(path, { fd }); - } catch (err) { - // Try the next one - } - } - return null; - }); - - return function readFirstAvailableStream(_x34) { - return _ref34.apply(this, arguments); - }; -})(); - -let getFirstSuitableFolder = exports.getFirstSuitableFolder = (() => { - var _ref36 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (paths, mode = constants.W_OK | constants.X_OK) { - const result = { - skipped: [], - folder: null - }; - - for (var _iterator16 = paths, _isArray16 = Array.isArray(_iterator16), _i16 = 0, _iterator16 = _isArray16 ? _iterator16 : _iterator16[Symbol.iterator]();;) { - var _ref37; - - if (_isArray16) { - if (_i16 >= _iterator16.length) break; - _ref37 = _iterator16[_i16++]; - } else { - _i16 = _iterator16.next(); - if (_i16.done) break; - _ref37 = _i16.value; - } - - const folder = _ref37; - - try { - yield mkdirp(folder); - yield access(folder, mode); - - result.folder = folder; - - return result; - } catch (error) { - result.skipped.push({ - error, - folder - }); - } - } - return result; - }); - - return function getFirstSuitableFolder(_x35) { - return _ref36.apply(this, arguments); - }; -})(); - -exports.copy = copy; -exports.readFile = readFile; -exports.readFileRaw = readFileRaw; -exports.normalizeOS = normalizeOS; - -var _fs; - -function _load_fs() { - return _fs = _interopRequireDefault(__webpack_require__(4)); -} - -var _glob; - -function _load_glob() { - return _glob = _interopRequireDefault(__webpack_require__(99)); -} - -var _os; - -function _load_os() { - return _os = _interopRequireDefault(__webpack_require__(42)); -} - -var _path; - -function _load_path() { - return _path = _interopRequireDefault(__webpack_require__(0)); -} - -var _blockingQueue; - -function _load_blockingQueue() { - return _blockingQueue = _interopRequireDefault(__webpack_require__(110)); -} - -var _promise; - -function _load_promise() { - return _promise = _interopRequireWildcard(__webpack_require__(51)); -} - -var _promise2; - -function _load_promise2() { - return _promise2 = __webpack_require__(51); -} - -var _map; - -function _load_map() { - return _map = _interopRequireDefault(__webpack_require__(30)); -} - -var _fsNormalized; - -function _load_fsNormalized() { - return _fsNormalized = __webpack_require__(216); -} - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const constants = exports.constants = typeof (_fs || _load_fs()).default.constants !== 'undefined' ? (_fs || _load_fs()).default.constants : { - R_OK: (_fs || _load_fs()).default.R_OK, - W_OK: (_fs || _load_fs()).default.W_OK, - X_OK: (_fs || _load_fs()).default.X_OK -}; - -const lockQueue = exports.lockQueue = new (_blockingQueue || _load_blockingQueue()).default('fs lock'); - -const readFileBuffer = exports.readFileBuffer = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.readFile); -const open = exports.open = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.open); -const writeFile = exports.writeFile = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.writeFile); -const readlink = exports.readlink = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.readlink); -const realpath = exports.realpath = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.realpath); -const readdir = exports.readdir = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.readdir); -const rename = exports.rename = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.rename); -const access = exports.access = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.access); -const stat = exports.stat = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.stat); -const mkdirp = exports.mkdirp = (0, (_promise2 || _load_promise2()).promisify)(__webpack_require__(146)); -const exists = exports.exists = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.exists, true); -const lstat = exports.lstat = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.lstat); -const chmod = exports.chmod = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.chmod); -const link = exports.link = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.link); -const glob = exports.glob = (0, (_promise2 || _load_promise2()).promisify)((_glob || _load_glob()).default); -exports.unlink = (_fsNormalized || _load_fsNormalized()).unlink; - -// fs.copyFile uses the native file copying instructions on the system, performing much better -// than any JS-based solution and consumes fewer resources. Repeated testing to fine tune the -// concurrency level revealed 128 as the sweet spot on a quad-core, 16 CPU Intel system with SSD. - -const CONCURRENT_QUEUE_ITEMS = (_fs || _load_fs()).default.copyFile ? 128 : 4; - -const fsSymlink = (0, (_promise2 || _load_promise2()).promisify)((_fs || _load_fs()).default.symlink); -const invariant = __webpack_require__(9); -const stripBOM = __webpack_require__(161); - -const noop = () => {}; - -function copy(src, dest, reporter) { - return copyBulk([{ src, dest }], reporter); -} - -function _readFile(loc, encoding) { - return new Promise((resolve, reject) => { - (_fs || _load_fs()).default.readFile(loc, encoding, function (err, content) { - if (err) { - reject(err); - } else { - resolve(content); - } - }); - }); -} - -function readFile(loc) { - return _readFile(loc, 'utf8').then(normalizeOS); -} - -function readFileRaw(loc) { - return _readFile(loc, 'binary'); -} - -function normalizeOS(body) { - return body.replace(/\r\n/g, '\n'); -} - -const cr = '\r'.charCodeAt(0); -const lf = '\n'.charCodeAt(0); - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -class MessageError extends Error { - constructor(msg, code) { - super(msg); - this.code = code; - } - -} - -exports.MessageError = MessageError; -class ProcessSpawnError extends MessageError { - constructor(msg, code, process) { - super(msg, code); - this.process = process; - } - -} - -exports.ProcessSpawnError = ProcessSpawnError; -class SecurityError extends MessageError {} - -exports.SecurityError = SecurityError; -class ProcessTermError extends MessageError {} - -exports.ProcessTermError = ProcessTermError; -class ResponseError extends Error { - constructor(msg, responseCode) { - super(msg); - this.responseCode = responseCode; - } - -} - -exports.ResponseError = ResponseError; -class OneTimePasswordError extends Error { - constructor(notice) { - super(); - this.notice = notice; - } - -} -exports.OneTimePasswordError = OneTimePasswordError; - -/***/ }), -/* 7 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subscriber; }); -/* unused harmony export SafeSubscriber */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isFunction__ = __webpack_require__(155); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Observer__ = __webpack_require__(420); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Subscription__ = __webpack_require__(25); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__internal_symbol_rxSubscriber__ = __webpack_require__(322); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__config__ = __webpack_require__(186); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__util_hostReportError__ = __webpack_require__(324); -/** PURE_IMPORTS_START tslib,_util_isFunction,_Observer,_Subscription,_internal_symbol_rxSubscriber,_config,_util_hostReportError PURE_IMPORTS_END */ - - - - - - - -var Subscriber = /*@__PURE__*/ (function (_super) { - __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](Subscriber, _super); - function Subscriber(destinationOrNext, error, complete) { - var _this = _super.call(this) || this; - _this.syncErrorValue = null; - _this.syncErrorThrown = false; - _this.syncErrorThrowable = false; - _this.isStopped = false; - _this._parentSubscription = null; - switch (arguments.length) { - case 0: - _this.destination = __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]; - break; - case 1: - if (!destinationOrNext) { - _this.destination = __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]; - break; - } - if (typeof destinationOrNext === 'object') { - if (destinationOrNext instanceof Subscriber) { - _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable; - _this.destination = destinationOrNext; - destinationOrNext.add(_this); - } - else { - _this.syncErrorThrowable = true; - _this.destination = new SafeSubscriber(_this, destinationOrNext); - } - break; - } - default: - _this.syncErrorThrowable = true; - _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete); - break; - } - return _this; - } - Subscriber.prototype[__WEBPACK_IMPORTED_MODULE_4__internal_symbol_rxSubscriber__["a" /* rxSubscriber */]] = function () { return this; }; - Subscriber.create = function (next, error, complete) { - var subscriber = new Subscriber(next, error, complete); - subscriber.syncErrorThrowable = false; - return subscriber; - }; - Subscriber.prototype.next = function (value) { - if (!this.isStopped) { - this._next(value); - } - }; - Subscriber.prototype.error = function (err) { - if (!this.isStopped) { - this.isStopped = true; - this._error(err); - } - }; - Subscriber.prototype.complete = function () { - if (!this.isStopped) { - this.isStopped = true; - this._complete(); - } - }; - Subscriber.prototype.unsubscribe = function () { - if (this.closed) { - return; - } - this.isStopped = true; - _super.prototype.unsubscribe.call(this); - }; - Subscriber.prototype._next = function (value) { - this.destination.next(value); - }; - Subscriber.prototype._error = function (err) { - this.destination.error(err); - this.unsubscribe(); - }; - Subscriber.prototype._complete = function () { - this.destination.complete(); - this.unsubscribe(); - }; - Subscriber.prototype._unsubscribeAndRecycle = function () { - var _a = this, _parent = _a._parent, _parents = _a._parents; - this._parent = null; - this._parents = null; - this.unsubscribe(); - this.closed = false; - this.isStopped = false; - this._parent = _parent; - this._parents = _parents; - this._parentSubscription = null; - return this; - }; - return Subscriber; -}(__WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */])); - -var SafeSubscriber = /*@__PURE__*/ (function (_super) { - __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](SafeSubscriber, _super); - function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) { - var _this = _super.call(this) || this; - _this._parentSubscriber = _parentSubscriber; - var next; - var context = _this; - if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__util_isFunction__["a" /* isFunction */])(observerOrNext)) { - next = observerOrNext; - } - else if (observerOrNext) { - next = observerOrNext.next; - error = observerOrNext.error; - complete = observerOrNext.complete; - if (observerOrNext !== __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]) { - context = Object.create(observerOrNext); - if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__util_isFunction__["a" /* isFunction */])(context.unsubscribe)) { - _this.add(context.unsubscribe.bind(context)); - } - context.unsubscribe = _this.unsubscribe.bind(_this); - } - } - _this._context = context; - _this._next = next; - _this._error = error; - _this._complete = complete; - return _this; - } - SafeSubscriber.prototype.next = function (value) { - if (!this.isStopped && this._next) { - var _parentSubscriber = this._parentSubscriber; - if (!__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { - this.__tryOrUnsub(this._next, value); - } - else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) { - this.unsubscribe(); - } - } - }; - SafeSubscriber.prototype.error = function (err) { - if (!this.isStopped) { - var _parentSubscriber = this._parentSubscriber; - var useDeprecatedSynchronousErrorHandling = __WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling; - if (this._error) { - if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { - this.__tryOrUnsub(this._error, err); - this.unsubscribe(); - } - else { - this.__tryOrSetError(_parentSubscriber, this._error, err); - this.unsubscribe(); - } - } - else if (!_parentSubscriber.syncErrorThrowable) { - this.unsubscribe(); - if (useDeprecatedSynchronousErrorHandling) { - throw err; - } - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__util_hostReportError__["a" /* hostReportError */])(err); - } - else { - if (useDeprecatedSynchronousErrorHandling) { - _parentSubscriber.syncErrorValue = err; - _parentSubscriber.syncErrorThrown = true; - } - else { - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__util_hostReportError__["a" /* hostReportError */])(err); - } - this.unsubscribe(); - } - } - }; - SafeSubscriber.prototype.complete = function () { - var _this = this; - if (!this.isStopped) { - var _parentSubscriber = this._parentSubscriber; - if (this._complete) { - var wrappedComplete = function () { return _this._complete.call(_this._context); }; - if (!__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { - this.__tryOrUnsub(wrappedComplete); - this.unsubscribe(); - } - else { - this.__tryOrSetError(_parentSubscriber, wrappedComplete); - this.unsubscribe(); - } - } - else { - this.unsubscribe(); - } - } - }; - SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) { - try { - fn.call(this._context, value); - } - catch (err) { - this.unsubscribe(); - if (__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) { - throw err; - } - else { - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__util_hostReportError__["a" /* hostReportError */])(err); - } - } - }; - SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) { - if (!__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) { - throw new Error('bad call'); - } - try { - fn.call(this._context, value); - } - catch (err) { - if (__WEBPACK_IMPORTED_MODULE_5__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) { - parent.syncErrorValue = err; - parent.syncErrorThrown = true; - return true; - } - else { - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__util_hostReportError__["a" /* hostReportError */])(err); - return true; - } - } - return false; - }; - SafeSubscriber.prototype._unsubscribe = function () { - var _parentSubscriber = this._parentSubscriber; - this._context = null; - this._parentSubscriber = null; - _parentSubscriber.unsubscribe(); - }; - return SafeSubscriber; -}(Subscriber)); - -//# sourceMappingURL=Subscriber.js.map - - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getPathKey = getPathKey; -const os = __webpack_require__(42); -const path = __webpack_require__(0); -const userHome = __webpack_require__(67).default; - -var _require = __webpack_require__(222); - -const getCacheDir = _require.getCacheDir, - getConfigDir = _require.getConfigDir, - getDataDir = _require.getDataDir; - -const isWebpackBundle = __webpack_require__(278); - -const DEPENDENCY_TYPES = exports.DEPENDENCY_TYPES = ['devDependencies', 'dependencies', 'optionalDependencies', 'peerDependencies']; -const OWNED_DEPENDENCY_TYPES = exports.OWNED_DEPENDENCY_TYPES = ['devDependencies', 'dependencies', 'optionalDependencies']; - -const RESOLUTIONS = exports.RESOLUTIONS = 'resolutions'; -const MANIFEST_FIELDS = exports.MANIFEST_FIELDS = [RESOLUTIONS, ...DEPENDENCY_TYPES]; - -const SUPPORTED_NODE_VERSIONS = exports.SUPPORTED_NODE_VERSIONS = '^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0'; - -const YARN_REGISTRY = exports.YARN_REGISTRY = 'https://registry.yarnpkg.com'; -const NPM_REGISTRY_RE = exports.NPM_REGISTRY_RE = /https?:\/\/registry\.npmjs\.org/g; - -const YARN_DOCS = exports.YARN_DOCS = 'https://yarnpkg.com/en/docs/cli/'; -const YARN_INSTALLER_SH = exports.YARN_INSTALLER_SH = 'https://yarnpkg.com/install.sh'; -const YARN_INSTALLER_MSI = exports.YARN_INSTALLER_MSI = 'https://yarnpkg.com/latest.msi'; - -const SELF_UPDATE_VERSION_URL = exports.SELF_UPDATE_VERSION_URL = 'https://yarnpkg.com/latest-version'; - -// cache version, bump whenever we make backwards incompatible changes -const CACHE_VERSION = exports.CACHE_VERSION = 6; - -// lockfile version, bump whenever we make backwards incompatible changes -const LOCKFILE_VERSION = exports.LOCKFILE_VERSION = 1; - -// max amount of network requests to perform concurrently -const NETWORK_CONCURRENCY = exports.NETWORK_CONCURRENCY = 8; - -// HTTP timeout used when downloading packages -const NETWORK_TIMEOUT = exports.NETWORK_TIMEOUT = 30 * 1000; // in milliseconds - -// max amount of child processes to execute concurrently -const CHILD_CONCURRENCY = exports.CHILD_CONCURRENCY = 5; - -const REQUIRED_PACKAGE_KEYS = exports.REQUIRED_PACKAGE_KEYS = ['name', 'version', '_uid']; - -function getPreferredCacheDirectories() { - const preferredCacheDirectories = [getCacheDir()]; - - if (process.getuid) { - // $FlowFixMe: process.getuid exists, dammit - preferredCacheDirectories.push(path.join(os.tmpdir(), `.yarn-cache-${process.getuid()}`)); - } - - preferredCacheDirectories.push(path.join(os.tmpdir(), `.yarn-cache`)); - - return preferredCacheDirectories; -} - -const PREFERRED_MODULE_CACHE_DIRECTORIES = exports.PREFERRED_MODULE_CACHE_DIRECTORIES = getPreferredCacheDirectories(); -const CONFIG_DIRECTORY = exports.CONFIG_DIRECTORY = getConfigDir(); -const DATA_DIRECTORY = exports.DATA_DIRECTORY = getDataDir(); -const LINK_REGISTRY_DIRECTORY = exports.LINK_REGISTRY_DIRECTORY = path.join(DATA_DIRECTORY, 'link'); -const GLOBAL_MODULE_DIRECTORY = exports.GLOBAL_MODULE_DIRECTORY = path.join(DATA_DIRECTORY, 'global'); - -const NODE_BIN_PATH = exports.NODE_BIN_PATH = process.execPath; -const YARN_BIN_PATH = exports.YARN_BIN_PATH = getYarnBinPath(); - -// Webpack needs to be configured with node.__dirname/__filename = false -function getYarnBinPath() { - if (isWebpackBundle) { - return __filename; - } else { - return path.join(__dirname, '..', 'bin', 'yarn.js'); - } -} - -const NODE_MODULES_FOLDER = exports.NODE_MODULES_FOLDER = 'node_modules'; -const NODE_PACKAGE_JSON = exports.NODE_PACKAGE_JSON = 'package.json'; - -const PNP_FILENAME = exports.PNP_FILENAME = '.pnp.js'; - -const POSIX_GLOBAL_PREFIX = exports.POSIX_GLOBAL_PREFIX = `${process.env.DESTDIR || ''}/usr/local`; -const FALLBACK_GLOBAL_PREFIX = exports.FALLBACK_GLOBAL_PREFIX = path.join(userHome, '.yarn'); - -const META_FOLDER = exports.META_FOLDER = '.yarn-meta'; -const INTEGRITY_FILENAME = exports.INTEGRITY_FILENAME = '.yarn-integrity'; -const LOCKFILE_FILENAME = exports.LOCKFILE_FILENAME = 'yarn.lock'; -const METADATA_FILENAME = exports.METADATA_FILENAME = '.yarn-metadata.json'; -const TARBALL_FILENAME = exports.TARBALL_FILENAME = '.yarn-tarball.tgz'; -const CLEAN_FILENAME = exports.CLEAN_FILENAME = '.yarnclean'; - -const NPM_LOCK_FILENAME = exports.NPM_LOCK_FILENAME = 'package-lock.json'; -const NPM_SHRINKWRAP_FILENAME = exports.NPM_SHRINKWRAP_FILENAME = 'npm-shrinkwrap.json'; - -const DEFAULT_INDENT = exports.DEFAULT_INDENT = ' '; -const SINGLE_INSTANCE_PORT = exports.SINGLE_INSTANCE_PORT = 31997; -const SINGLE_INSTANCE_FILENAME = exports.SINGLE_INSTANCE_FILENAME = '.yarn-single-instance'; - -const ENV_PATH_KEY = exports.ENV_PATH_KEY = getPathKey(process.platform, process.env); - -function getPathKey(platform, env) { - let pathKey = 'PATH'; - - // windows calls its path "Path" usually, but this is not guaranteed. - if (platform === 'win32') { - pathKey = 'Path'; - - for (const key in env) { - if (key.toLowerCase() === 'path') { - pathKey = key; - } - } - } - - return pathKey; -} - -const VERSION_COLOR_SCHEME = exports.VERSION_COLOR_SCHEME = { - major: 'red', - premajor: 'red', - minor: 'yellow', - preminor: 'yellow', - patch: 'green', - prepatch: 'green', - prerelease: 'red', - unchanged: 'white', - unknown: 'red' -}; - -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - - -/** - * Use invariant() to assert state which your program assumes to be true. - * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. - * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. - */ - -var NODE_ENV = process.env.NODE_ENV; - -var invariant = function(condition, format, a, b, c, d, e, f) { - if (NODE_ENV !== 'production') { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); - } - } - - if (!condition) { - var error; - if (format === undefined) { - error = new Error( - 'Minified exception occurred; use the non-minified dev environment ' + - 'for the full error message and additional helpful warnings.' - ); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error( - format.replace(/%s/g, function() { return args[argIndex++]; }) - ); - error.name = 'Invariant Violation'; - } - - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; - } -}; - -module.exports = invariant; - - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var YAMLException = __webpack_require__(55); - -var TYPE_CONSTRUCTOR_OPTIONS = [ - 'kind', - 'resolve', - 'construct', - 'instanceOf', - 'predicate', - 'represent', - 'defaultStyle', - 'styleAliases' -]; - -var YAML_NODE_KINDS = [ - 'scalar', - 'sequence', - 'mapping' -]; - -function compileStyleAliases(map) { - var result = {}; - - if (map !== null) { - Object.keys(map).forEach(function (style) { - map[style].forEach(function (alias) { - result[String(alias)] = style; - }); - }); - } - - return result; -} - -function Type(tag, options) { - options = options || {}; - - Object.keys(options).forEach(function (name) { - if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { - throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); - } - }); - - // TODO: Add tag format check. - this.tag = tag; - this.kind = options['kind'] || null; - this.resolve = options['resolve'] || function () { return true; }; - this.construct = options['construct'] || function (data) { return data; }; - this.instanceOf = options['instanceOf'] || null; - this.predicate = options['predicate'] || null; - this.represent = options['represent'] || null; - this.defaultStyle = options['defaultStyle'] || null; - this.styleAliases = compileStyleAliases(options['styleAliases'] || null); - - if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { - throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); - } -} - -module.exports = Type; - - -/***/ }), -/* 11 */ -/***/ (function(module, exports) { - -module.exports = require("crypto"); - -/***/ }), -/* 12 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Observable; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_canReportError__ = __webpack_require__(323); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_toSubscriber__ = __webpack_require__(932); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__internal_symbol_observable__ = __webpack_require__(118); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_pipe__ = __webpack_require__(325); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__config__ = __webpack_require__(186); -/** PURE_IMPORTS_START _util_canReportError,_util_toSubscriber,_internal_symbol_observable,_util_pipe,_config PURE_IMPORTS_END */ - - - - - -var Observable = /*@__PURE__*/ (function () { - function Observable(subscribe) { - this._isScalar = false; - if (subscribe) { - this._subscribe = subscribe; - } - } - Observable.prototype.lift = function (operator) { - var observable = new Observable(); - observable.source = this; - observable.operator = operator; - return observable; - }; - Observable.prototype.subscribe = function (observerOrNext, error, complete) { - var operator = this.operator; - var sink = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__util_toSubscriber__["a" /* toSubscriber */])(observerOrNext, error, complete); - if (operator) { - operator.call(sink, this.source); - } - else { - sink.add(this.source || (__WEBPACK_IMPORTED_MODULE_4__config__["a" /* config */].useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ? - this._subscribe(sink) : - this._trySubscribe(sink)); - } - if (__WEBPACK_IMPORTED_MODULE_4__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) { - if (sink.syncErrorThrowable) { - sink.syncErrorThrowable = false; - if (sink.syncErrorThrown) { - throw sink.syncErrorValue; - } - } - } - return sink; - }; - Observable.prototype._trySubscribe = function (sink) { - try { - return this._subscribe(sink); - } - catch (err) { - if (__WEBPACK_IMPORTED_MODULE_4__config__["a" /* config */].useDeprecatedSynchronousErrorHandling) { - sink.syncErrorThrown = true; - sink.syncErrorValue = err; - } - if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__util_canReportError__["a" /* canReportError */])(sink)) { - sink.error(err); - } - else { - console.warn(err); - } - } - }; - Observable.prototype.forEach = function (next, promiseCtor) { - var _this = this; - promiseCtor = getPromiseCtor(promiseCtor); - return new promiseCtor(function (resolve, reject) { - var subscription; - subscription = _this.subscribe(function (value) { - try { - next(value); - } - catch (err) { - reject(err); - if (subscription) { - subscription.unsubscribe(); - } - } - }, reject, resolve); - }); - }; - Observable.prototype._subscribe = function (subscriber) { - var source = this.source; - return source && source.subscribe(subscriber); - }; - Observable.prototype[__WEBPACK_IMPORTED_MODULE_2__internal_symbol_observable__["a" /* observable */]] = function () { - return this; - }; - Observable.prototype.pipe = function () { - var operations = []; - for (var _i = 0; _i < arguments.length; _i++) { - operations[_i] = arguments[_i]; - } - if (operations.length === 0) { - return this; - } - return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__util_pipe__["b" /* pipeFromArray */])(operations)(this); - }; - Observable.prototype.toPromise = function (promiseCtor) { - var _this = this; - promiseCtor = getPromiseCtor(promiseCtor); - return new promiseCtor(function (resolve, reject) { - var value; - _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); }); - }); - }; - Observable.create = function (subscribe) { - return new Observable(subscribe); - }; - return Observable; -}()); - -function getPromiseCtor(promiseCtor) { - if (!promiseCtor) { - promiseCtor = __WEBPACK_IMPORTED_MODULE_4__config__["a" /* config */].Promise || Promise; - } - if (!promiseCtor) { - throw new Error('no Promise impl found'); - } - return promiseCtor; -} -//# sourceMappingURL=Observable.js.map - - -/***/ }), -/* 13 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OuterSubscriber; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscriber__ = __webpack_require__(7); -/** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */ - - -var OuterSubscriber = /*@__PURE__*/ (function (_super) { - __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](OuterSubscriber, _super); - function OuterSubscriber() { - return _super !== null && _super.apply(this, arguments) || this; - } - OuterSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.destination.next(innerValue); - }; - OuterSubscriber.prototype.notifyError = function (error, innerSub) { - this.destination.error(error); - }; - OuterSubscriber.prototype.notifyComplete = function (innerSub) { - this.destination.complete(); - }; - return OuterSubscriber; -}(__WEBPACK_IMPORTED_MODULE_1__Subscriber__["a" /* Subscriber */])); - -//# sourceMappingURL=OuterSubscriber.js.map - - -/***/ }), -/* 14 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = subscribeToResult; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__InnerSubscriber__ = __webpack_require__(84); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__subscribeTo__ = __webpack_require__(446); -/** PURE_IMPORTS_START _InnerSubscriber,_subscribeTo PURE_IMPORTS_END */ - - -function subscribeToResult(outerSubscriber, result, outerValue, outerIndex, destination) { - if (destination === void 0) { - destination = new __WEBPACK_IMPORTED_MODULE_0__InnerSubscriber__["a" /* InnerSubscriber */](outerSubscriber, outerValue, outerIndex); - } - if (destination.closed) { - return; - } - return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__subscribeTo__["a" /* subscribeTo */])(result)(destination); -} -//# sourceMappingURL=subscribeToResult.js.map - - -/***/ }), -/* 15 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* eslint-disable node/no-deprecated-api */ - - - -var buffer = __webpack_require__(64) -var Buffer = buffer.Buffer - -var safer = {} - -var key - -for (key in buffer) { - if (!buffer.hasOwnProperty(key)) continue - if (key === 'SlowBuffer' || key === 'Buffer') continue - safer[key] = buffer[key] -} - -var Safer = safer.Buffer = {} -for (key in Buffer) { - if (!Buffer.hasOwnProperty(key)) continue - if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue - Safer[key] = Buffer[key] -} - -safer.Buffer.prototype = Buffer.prototype - -if (!Safer.from || Safer.from === Uint8Array.from) { - Safer.from = function (value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value) - } - if (value && typeof value.length === 'undefined') { - throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value) - } - return Buffer(value, encodingOrOffset, length) - } -} - -if (!Safer.alloc) { - Safer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) - } - if (size < 0 || size >= 2 * (1 << 30)) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } - var buf = Buffer(size) - if (!fill || fill.length === 0) { - buf.fill(0) - } else if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - return buf - } -} - -if (!safer.kStringMaxLength) { - try { - safer.kStringMaxLength = process.binding('buffer').kStringMaxLength - } catch (e) { - // we can't determine kStringMaxLength in environments where process.binding - // is unsupported, so let's not set it - } -} - -if (!safer.constants) { - safer.constants = { - MAX_LENGTH: safer.kMaxLength - } - if (safer.kStringMaxLength) { - safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength - } -} - -module.exports = safer - - -/***/ }), -/* 16 */ -/***/ (function(module, exports, __webpack_require__) { - -// Copyright (c) 2012, Mark Cavage. All rights reserved. -// Copyright 2015 Joyent, Inc. - -var assert = __webpack_require__(29); -var Stream = __webpack_require__(23).Stream; -var util = __webpack_require__(3); - - -///--- Globals - -/* JSSTYLED */ -var UUID_REGEXP = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/; - - -///--- Internal - -function _capitalize(str) { - return (str.charAt(0).toUpperCase() + str.slice(1)); -} - -function _toss(name, expected, oper, arg, actual) { - throw new assert.AssertionError({ - message: util.format('%s (%s) is required', name, expected), - actual: (actual === undefined) ? typeof (arg) : actual(arg), - expected: expected, - operator: oper || '===', - stackStartFunction: _toss.caller - }); -} - -function _getClass(arg) { - return (Object.prototype.toString.call(arg).slice(8, -1)); -} - -function noop() { - // Why even bother with asserts? -} - - -///--- Exports - -var types = { - bool: { - check: function (arg) { return typeof (arg) === 'boolean'; } - }, - func: { - check: function (arg) { return typeof (arg) === 'function'; } - }, - string: { - check: function (arg) { return typeof (arg) === 'string'; } - }, - object: { - check: function (arg) { - return typeof (arg) === 'object' && arg !== null; - } - }, - number: { - check: function (arg) { - return typeof (arg) === 'number' && !isNaN(arg); - } - }, - finite: { - check: function (arg) { - return typeof (arg) === 'number' && !isNaN(arg) && isFinite(arg); - } - }, - buffer: { - check: function (arg) { return Buffer.isBuffer(arg); }, - operator: 'Buffer.isBuffer' - }, - array: { - check: function (arg) { return Array.isArray(arg); }, - operator: 'Array.isArray' - }, - stream: { - check: function (arg) { return arg instanceof Stream; }, - operator: 'instanceof', - actual: _getClass - }, - date: { - check: function (arg) { return arg instanceof Date; }, - operator: 'instanceof', - actual: _getClass - }, - regexp: { - check: function (arg) { return arg instanceof RegExp; }, - operator: 'instanceof', - actual: _getClass - }, - uuid: { - check: function (arg) { - return typeof (arg) === 'string' && UUID_REGEXP.test(arg); - }, - operator: 'isUUID' - } -}; - -function _setExports(ndebug) { - var keys = Object.keys(types); - var out; - - /* re-export standard assert */ - if (process.env.NODE_NDEBUG) { - out = noop; - } else { - out = function (arg, msg) { - if (!arg) { - _toss(msg, 'true', arg); - } - }; - } - - /* standard checks */ - keys.forEach(function (k) { - if (ndebug) { - out[k] = noop; - return; - } - var type = types[k]; - out[k] = function (arg, msg) { - if (!type.check(arg)) { - _toss(msg, k, type.operator, arg, type.actual); - } - }; - }); - - /* optional checks */ - keys.forEach(function (k) { - var name = 'optional' + _capitalize(k); - if (ndebug) { - out[name] = noop; - return; - } - var type = types[k]; - out[name] = function (arg, msg) { - if (arg === undefined || arg === null) { - return; - } - if (!type.check(arg)) { - _toss(msg, k, type.operator, arg, type.actual); - } - }; - }); - - /* arrayOf checks */ - keys.forEach(function (k) { - var name = 'arrayOf' + _capitalize(k); - if (ndebug) { - out[name] = noop; - return; - } - var type = types[k]; - var expected = '[' + k + ']'; - out[name] = function (arg, msg) { - if (!Array.isArray(arg)) { - _toss(msg, expected, type.operator, arg, type.actual); - } - var i; - for (i = 0; i < arg.length; i++) { - if (!type.check(arg[i])) { - _toss(msg, expected, type.operator, arg, type.actual); - } - } - }; - }); - - /* optionalArrayOf checks */ - keys.forEach(function (k) { - var name = 'optionalArrayOf' + _capitalize(k); - if (ndebug) { - out[name] = noop; - return; - } - var type = types[k]; - var expected = '[' + k + ']'; - out[name] = function (arg, msg) { - if (arg === undefined || arg === null) { - return; - } - if (!Array.isArray(arg)) { - _toss(msg, expected, type.operator, arg, type.actual); - } - var i; - for (i = 0; i < arg.length; i++) { - if (!type.check(arg[i])) { - _toss(msg, expected, type.operator, arg, type.actual); - } - } - }; - }); - - /* re-export built-in assertions */ - Object.keys(assert).forEach(function (k) { - if (k === 'AssertionError') { - out[k] = assert[k]; - return; - } - if (ndebug) { - out[k] = noop; - return; - } - out[k] = assert[k]; - }); - - /* export ourselves (for unit tests _only_) */ - out._setExports = _setExports; - - return out; -} - -module.exports = _setExports(process.env.NODE_NDEBUG); - - -/***/ }), -/* 17 */ -/***/ (function(module, exports) { - -// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 -var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self - // eslint-disable-next-line no-new-func - : Function('return this')(); -if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef - - -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.sortAlpha = sortAlpha; -exports.sortOptionsByFlags = sortOptionsByFlags; -exports.entries = entries; -exports.removePrefix = removePrefix; -exports.removeSuffix = removeSuffix; -exports.addSuffix = addSuffix; -exports.hyphenate = hyphenate; -exports.camelCase = camelCase; -exports.compareSortedArrays = compareSortedArrays; -exports.sleep = sleep; -const _camelCase = __webpack_require__(227); - -function sortAlpha(a, b) { - // sort alphabetically in a deterministic way - const shortLen = Math.min(a.length, b.length); - for (let i = 0; i < shortLen; i++) { - const aChar = a.charCodeAt(i); - const bChar = b.charCodeAt(i); - if (aChar !== bChar) { - return aChar - bChar; - } - } - return a.length - b.length; -} - -function sortOptionsByFlags(a, b) { - const aOpt = a.flags.replace(/-/g, ''); - const bOpt = b.flags.replace(/-/g, ''); - return sortAlpha(aOpt, bOpt); -} - -function entries(obj) { - const entries = []; - if (obj) { - for (const key in obj) { - entries.push([key, obj[key]]); - } - } - return entries; -} - -function removePrefix(pattern, prefix) { - if (pattern.startsWith(prefix)) { - pattern = pattern.slice(prefix.length); - } - - return pattern; -} - -function removeSuffix(pattern, suffix) { - if (pattern.endsWith(suffix)) { - return pattern.slice(0, -suffix.length); - } - - return pattern; -} - -function addSuffix(pattern, suffix) { - if (!pattern.endsWith(suffix)) { - return pattern + suffix; - } - - return pattern; -} - -function hyphenate(str) { - return str.replace(/[A-Z]/g, match => { - return '-' + match.charAt(0).toLowerCase(); - }); -} - -function camelCase(str) { - if (/[A-Z]/.test(str)) { - return null; - } else { - return _camelCase(str); - } -} - -function compareSortedArrays(array1, array2) { - if (array1.length !== array2.length) { - return false; - } - for (let i = 0, len = array1.length; i < len; i++) { - if (array1[i] !== array2[i]) { - return false; - } - } - return true; -} - -function sleep(ms) { - return new Promise(resolve => { - setTimeout(resolve, ms); - }); -} - -/***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.stringify = exports.parse = undefined; - -var _asyncToGenerator2; - -function _load_asyncToGenerator() { - return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); -} - -var _parse; - -function _load_parse() { - return _parse = __webpack_require__(106); -} - -Object.defineProperty(exports, 'parse', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_parse || _load_parse()).default; - } -}); - -var _stringify; - -function _load_stringify() { - return _stringify = __webpack_require__(200); -} - -Object.defineProperty(exports, 'stringify', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_stringify || _load_stringify()).default; - } -}); -exports.implodeEntry = implodeEntry; -exports.explodeEntry = explodeEntry; - -var _misc; - -function _load_misc() { - return _misc = __webpack_require__(18); -} - -var _normalizePattern; - -function _load_normalizePattern() { - return _normalizePattern = __webpack_require__(37); -} - -var _parse2; - -function _load_parse2() { - return _parse2 = _interopRequireDefault(__webpack_require__(106)); -} - -var _constants; - -function _load_constants() { - return _constants = __webpack_require__(8); -} - -var _fs; - -function _load_fs() { - return _fs = _interopRequireWildcard(__webpack_require__(5)); -} - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const invariant = __webpack_require__(9); - -const path = __webpack_require__(0); -const ssri = __webpack_require__(65); - -function getName(pattern) { - return (0, (_normalizePattern || _load_normalizePattern()).normalizePattern)(pattern).name; -} - -function blankObjectUndefined(obj) { - return obj && Object.keys(obj).length ? obj : undefined; -} - -function keyForRemote(remote) { - return remote.resolved || (remote.reference && remote.hash ? `${remote.reference}#${remote.hash}` : null); -} - -function serializeIntegrity(integrity) { - // We need this because `Integrity.toString()` does not use sorting to ensure a stable string output - // See https://git.io/vx2Hy - return integrity.toString().split(' ').sort().join(' '); -} - -function implodeEntry(pattern, obj) { - const inferredName = getName(pattern); - const integrity = obj.integrity ? serializeIntegrity(obj.integrity) : ''; - const imploded = { - name: inferredName === obj.name ? undefined : obj.name, - version: obj.version, - uid: obj.uid === obj.version ? undefined : obj.uid, - resolved: obj.resolved, - registry: obj.registry === 'npm' ? undefined : obj.registry, - dependencies: blankObjectUndefined(obj.dependencies), - optionalDependencies: blankObjectUndefined(obj.optionalDependencies), - permissions: blankObjectUndefined(obj.permissions), - prebuiltVariants: blankObjectUndefined(obj.prebuiltVariants) - }; - if (integrity) { - imploded.integrity = integrity; - } - return imploded; -} - -function explodeEntry(pattern, obj) { - obj.optionalDependencies = obj.optionalDependencies || {}; - obj.dependencies = obj.dependencies || {}; - obj.uid = obj.uid || obj.version; - obj.permissions = obj.permissions || {}; - obj.registry = obj.registry || 'npm'; - obj.name = obj.name || getName(pattern); - const integrity = obj.integrity; - if (integrity && integrity.isIntegrity) { - obj.integrity = ssri.parse(integrity); - } - return obj; -} - -class Lockfile { - constructor({ cache, source, parseResultType } = {}) { - this.source = source || ''; - this.cache = cache; - this.parseResultType = parseResultType; - } - - // source string if the `cache` was parsed - - - // if true, we're parsing an old yarn file and need to update integrity fields - hasEntriesExistWithoutIntegrity() { - if (!this.cache) { - return false; - } - - for (const key in this.cache) { - // $FlowFixMe - `this.cache` is clearly defined at this point - if (!/^.*@(file:|http)/.test(key) && this.cache[key] && !this.cache[key].integrity) { - return true; - } - } - - return false; - } - - static fromDirectory(dir, reporter) { - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - // read the manifest in this directory - const lockfileLoc = path.join(dir, (_constants || _load_constants()).LOCKFILE_FILENAME); - - let lockfile; - let rawLockfile = ''; - let parseResult; - - if (yield (_fs || _load_fs()).exists(lockfileLoc)) { - rawLockfile = yield (_fs || _load_fs()).readFile(lockfileLoc); - parseResult = (0, (_parse2 || _load_parse2()).default)(rawLockfile, lockfileLoc); - - if (reporter) { - if (parseResult.type === 'merge') { - reporter.info(reporter.lang('lockfileMerged')); - } else if (parseResult.type === 'conflict') { - reporter.warn(reporter.lang('lockfileConflict')); - } - } - - lockfile = parseResult.object; - } else if (reporter) { - reporter.info(reporter.lang('noLockfileFound')); - } - - if (lockfile && lockfile.__metadata) { - const lockfilev2 = lockfile; - lockfile = {}; - } - - return new Lockfile({ cache: lockfile, source: rawLockfile, parseResultType: parseResult && parseResult.type }); - })(); - } - - getLocked(pattern) { - const cache = this.cache; - if (!cache) { - return undefined; - } - - const shrunk = pattern in cache && cache[pattern]; - - if (typeof shrunk === 'string') { - return this.getLocked(shrunk); - } else if (shrunk) { - explodeEntry(pattern, shrunk); - return shrunk; - } - - return undefined; - } - - removePattern(pattern) { - const cache = this.cache; - if (!cache) { - return; - } - delete cache[pattern]; - } - - getLockfile(patterns) { - const lockfile = {}; - const seen = new Map(); - - // order by name so that lockfile manifest is assigned to the first dependency with this manifest - // the others that have the same remoteKey will just refer to the first - // ordering allows for consistency in lockfile when it is serialized - const sortedPatternsKeys = Object.keys(patterns).sort((_misc || _load_misc()).sortAlpha); - - for (var _iterator = sortedPatternsKeys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - const pattern = _ref; - - const pkg = patterns[pattern]; - const remote = pkg._remote, - ref = pkg._reference; - - invariant(ref, 'Package is missing a reference'); - invariant(remote, 'Package is missing a remote'); - - const remoteKey = keyForRemote(remote); - const pkgName = getName(pattern); - - const seenKey = remoteKey ? `${remoteKey}#${pkgName}` : null; - const seenPattern = seenKey ? seen.get(seenKey) : null; - - if (seenPattern) { - // no point in duplicating it - lockfile[pattern] = seenPattern; - continue; - } - - const obj = implodeEntry(pattern, { - name: pkgName, - version: pkg.version, - uid: pkg._uid, - resolved: remote.resolved, - integrity: remote.integrity, - registry: remote.registry, - dependencies: pkg.dependencies, - peerDependencies: pkg.peerDependencies, - optionalDependencies: pkg.optionalDependencies, - permissions: ref.permissions, - prebuiltVariants: pkg.prebuiltVariants - }); - - lockfile[pattern] = obj; - - if (seenKey) { - seen.set(seenKey, obj); - } - } - - return lockfile; - } -} -exports.default = Lockfile; - -/***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; - -var _assign = __webpack_require__(559); - -var _assign2 = _interopRequireDefault(_assign); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = _assign2.default || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target; -}; - -/***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { - -var store = __webpack_require__(134)('wks'); -var uid = __webpack_require__(138); -var Symbol = __webpack_require__(17).Symbol; -var USE_SYMBOL = typeof Symbol == 'function'; - -var $exports = module.exports = function (name) { - return store[name] || (store[name] = - USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); -}; - -$exports.store = store; - - -/***/ }), -/* 22 */ -/***/ (function(module, exports) { - -exports = module.exports = SemVer; - -// The debug function is excluded entirely from the minified version. -/* nomin */ var debug; -/* nomin */ if (typeof process === 'object' && - /* nomin */ process.env && - /* nomin */ process.env.NODE_DEBUG && - /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG)) - /* nomin */ debug = function() { - /* nomin */ var args = Array.prototype.slice.call(arguments, 0); - /* nomin */ args.unshift('SEMVER'); - /* nomin */ console.log.apply(console, args); - /* nomin */ }; -/* nomin */ else - /* nomin */ debug = function() {}; - -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -exports.SEMVER_SPEC_VERSION = '2.0.0'; - -var MAX_LENGTH = 256; -var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; - -// Max safe segment length for coercion. -var MAX_SAFE_COMPONENT_LENGTH = 16; - -// The actual regexps go on exports.re -var re = exports.re = []; -var src = exports.src = []; -var R = 0; - -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -var NUMERICIDENTIFIER = R++; -src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'; -var NUMERICIDENTIFIERLOOSE = R++; -src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'; - - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -var NONNUMERICIDENTIFIER = R++; -src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; - - -// ## Main Version -// Three dot-separated numeric identifiers. - -var MAINVERSION = R++; -src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')'; - -var MAINVERSIONLOOSE = R++; -src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')'; - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -var PRERELEASEIDENTIFIER = R++; -src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + - '|' + src[NONNUMERICIDENTIFIER] + ')'; - -var PRERELEASEIDENTIFIERLOOSE = R++; -src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + - '|' + src[NONNUMERICIDENTIFIER] + ')'; - - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. - -var PRERELEASE = R++; -src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + - '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'; - -var PRERELEASELOOSE = R++; -src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + - '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'; - -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. - -var BUILDIDENTIFIER = R++; -src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; - -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. - -var BUILD = R++; -src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + - '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'; - - -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. - -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. - -var FULL = R++; -var FULLPLAIN = 'v?' + src[MAINVERSION] + - src[PRERELEASE] + '?' + - src[BUILD] + '?'; - -src[FULL] = '^' + FULLPLAIN + '$'; - -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + - src[PRERELEASELOOSE] + '?' + - src[BUILD] + '?'; - -var LOOSE = R++; -src[LOOSE] = '^' + LOOSEPLAIN + '$'; - -var GTLT = R++; -src[GTLT] = '((?:<|>)?=?)'; - -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -var XRANGEIDENTIFIERLOOSE = R++; -src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; -var XRANGEIDENTIFIER = R++; -src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'; - -var XRANGEPLAIN = R++; -src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:' + src[PRERELEASE] + ')?' + - src[BUILD] + '?' + - ')?)?'; - -var XRANGEPLAINLOOSE = R++; -src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:' + src[PRERELEASELOOSE] + ')?' + - src[BUILD] + '?' + - ')?)?'; - -var XRANGE = R++; -src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; -var XRANGELOOSE = R++; -src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'; - -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -var COERCE = R++; -src[COERCE] = '(?:^|[^\\d])' + - '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:$|[^\\d])'; - -// Tilde ranges. -// Meaning is "reasonably at or greater than" -var LONETILDE = R++; -src[LONETILDE] = '(?:~>?)'; - -var TILDETRIM = R++; -src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'; -re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g'); -var tildeTrimReplace = '$1~'; - -var TILDE = R++; -src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'; -var TILDELOOSE = R++; -src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'; - -// Caret ranges. -// Meaning is "at least and backwards compatible with" -var LONECARET = R++; -src[LONECARET] = '(?:\\^)'; - -var CARETTRIM = R++; -src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'; -re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g'); -var caretTrimReplace = '$1^'; - -var CARET = R++; -src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'; -var CARETLOOSE = R++; -src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'; - -// A simple gt/lt/eq thing, or just "" to indicate "any version" -var COMPARATORLOOSE = R++; -src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'; -var COMPARATOR = R++; -src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'; - - -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -var COMPARATORTRIM = R++; -src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + - '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'; - -// this one has to use the /g flag -re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g'); -var comparatorTrimReplace = '$1$2$3'; - - -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -var HYPHENRANGE = R++; -src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAIN] + ')' + - '\\s*$'; - -var HYPHENRANGELOOSE = R++; -src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s*$'; - -// Star ranges basically just allow anything at all. -var STAR = R++; -src[STAR] = '(<|>)?=?\\s*\\*'; - -// Compile to actual regexp objects. -// All are flag-free, unless they were created above with a flag. -for (var i = 0; i < R; i++) { - debug(i, src[i]); - if (!re[i]) - re[i] = new RegExp(src[i]); -} - -exports.parse = parse; -function parse(version, loose) { - if (version instanceof SemVer) - return version; - - if (typeof version !== 'string') - return null; - - if (version.length > MAX_LENGTH) - return null; - - var r = loose ? re[LOOSE] : re[FULL]; - if (!r.test(version)) - return null; - - try { - return new SemVer(version, loose); - } catch (er) { - return null; - } -} - -exports.valid = valid; -function valid(version, loose) { - var v = parse(version, loose); - return v ? v.version : null; -} - - -exports.clean = clean; -function clean(version, loose) { - var s = parse(version.trim().replace(/^[=v]+/, ''), loose); - return s ? s.version : null; -} - -exports.SemVer = SemVer; - -function SemVer(version, loose) { - if (version instanceof SemVer) { - if (version.loose === loose) - return version; - else - version = version.version; - } else if (typeof version !== 'string') { - throw new TypeError('Invalid Version: ' + version); - } - - if (version.length > MAX_LENGTH) - throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') - - if (!(this instanceof SemVer)) - return new SemVer(version, loose); - - debug('SemVer', version, loose); - this.loose = loose; - var m = version.trim().match(loose ? re[LOOSE] : re[FULL]); - - if (!m) - throw new TypeError('Invalid Version: ' + version); - - this.raw = version; - - // these are actually numbers - this.major = +m[1]; - this.minor = +m[2]; - this.patch = +m[3]; - - if (this.major > MAX_SAFE_INTEGER || this.major < 0) - throw new TypeError('Invalid major version') - - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) - throw new TypeError('Invalid minor version') - - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) - throw new TypeError('Invalid patch version') - - // numberify any prerelease numeric ids - if (!m[4]) - this.prerelease = []; - else - this.prerelease = m[4].split('.').map(function(id) { - if (/^[0-9]+$/.test(id)) { - var num = +id; - if (num >= 0 && num < MAX_SAFE_INTEGER) - return num; - } - return id; - }); - - this.build = m[5] ? m[5].split('.') : []; - this.format(); -} - -SemVer.prototype.format = function() { - this.version = this.major + '.' + this.minor + '.' + this.patch; - if (this.prerelease.length) - this.version += '-' + this.prerelease.join('.'); - return this.version; -}; - -SemVer.prototype.toString = function() { - return this.version; -}; - -SemVer.prototype.compare = function(other) { - debug('SemVer.compare', this.version, this.loose, other); - if (!(other instanceof SemVer)) - other = new SemVer(other, this.loose); - - return this.compareMain(other) || this.comparePre(other); -}; - -SemVer.prototype.compareMain = function(other) { - if (!(other instanceof SemVer)) - other = new SemVer(other, this.loose); - - return compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch); -}; - -SemVer.prototype.comparePre = function(other) { - if (!(other instanceof SemVer)) - other = new SemVer(other, this.loose); - - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) - return -1; - else if (!this.prerelease.length && other.prerelease.length) - return 1; - else if (!this.prerelease.length && !other.prerelease.length) - return 0; - - var i = 0; - do { - var a = this.prerelease[i]; - var b = other.prerelease[i]; - debug('prerelease compare', i, a, b); - if (a === undefined && b === undefined) - return 0; - else if (b === undefined) - return 1; - else if (a === undefined) - return -1; - else if (a === b) - continue; - else - return compareIdentifiers(a, b); - } while (++i); -}; - -// preminor will bump the version up to the next minor release, and immediately -// down to pre-release. premajor and prepatch work the same way. -SemVer.prototype.inc = function(release, identifier) { - switch (release) { - case 'premajor': - this.prerelease.length = 0; - this.patch = 0; - this.minor = 0; - this.major++; - this.inc('pre', identifier); - break; - case 'preminor': - this.prerelease.length = 0; - this.patch = 0; - this.minor++; - this.inc('pre', identifier); - break; - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0; - this.inc('patch', identifier); - this.inc('pre', identifier); - break; - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) - this.inc('patch', identifier); - this.inc('pre', identifier); - break; - - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) - this.major++; - this.minor = 0; - this.patch = 0; - this.prerelease = []; - break; - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) - this.minor++; - this.patch = 0; - this.prerelease = []; - break; - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) - this.patch++; - this.prerelease = []; - break; - // This probably shouldn't be used publicly. - // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. - case 'pre': - if (this.prerelease.length === 0) - this.prerelease = [0]; - else { - var i = this.prerelease.length; - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++; - i = -2; - } - } - if (i === -1) // didn't increment anything - this.prerelease.push(0); - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - if (this.prerelease[0] === identifier) { - if (isNaN(this.prerelease[1])) - this.prerelease = [identifier, 0]; - } else - this.prerelease = [identifier, 0]; - } - break; - - default: - throw new Error('invalid increment argument: ' + release); - } - this.format(); - this.raw = this.version; - return this; -}; - -exports.inc = inc; -function inc(version, release, loose, identifier) { - if (typeof(loose) === 'string') { - identifier = loose; - loose = undefined; - } - - try { - return new SemVer(version, loose).inc(release, identifier).version; - } catch (er) { - return null; - } -} - -exports.diff = diff; -function diff(version1, version2) { - if (eq(version1, version2)) { - return null; - } else { - var v1 = parse(version1); - var v2 = parse(version2); - if (v1.prerelease.length || v2.prerelease.length) { - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return 'pre'+key; - } - } - } - return 'prerelease'; - } - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return key; - } - } - } - } -} - -exports.compareIdentifiers = compareIdentifiers; - -var numeric = /^[0-9]+$/; -function compareIdentifiers(a, b) { - var anum = numeric.test(a); - var bnum = numeric.test(b); - - if (anum && bnum) { - a = +a; - b = +b; - } - - return (anum && !bnum) ? -1 : - (bnum && !anum) ? 1 : - a < b ? -1 : - a > b ? 1 : - 0; -} - -exports.rcompareIdentifiers = rcompareIdentifiers; -function rcompareIdentifiers(a, b) { - return compareIdentifiers(b, a); -} - -exports.major = major; -function major(a, loose) { - return new SemVer(a, loose).major; -} - -exports.minor = minor; -function minor(a, loose) { - return new SemVer(a, loose).minor; -} - -exports.patch = patch; -function patch(a, loose) { - return new SemVer(a, loose).patch; -} - -exports.compare = compare; -function compare(a, b, loose) { - return new SemVer(a, loose).compare(new SemVer(b, loose)); -} - -exports.compareLoose = compareLoose; -function compareLoose(a, b) { - return compare(a, b, true); -} - -exports.rcompare = rcompare; -function rcompare(a, b, loose) { - return compare(b, a, loose); -} - -exports.sort = sort; -function sort(list, loose) { - return list.sort(function(a, b) { - return exports.compare(a, b, loose); - }); -} - -exports.rsort = rsort; -function rsort(list, loose) { - return list.sort(function(a, b) { - return exports.rcompare(a, b, loose); - }); -} - -exports.gt = gt; -function gt(a, b, loose) { - return compare(a, b, loose) > 0; -} - -exports.lt = lt; -function lt(a, b, loose) { - return compare(a, b, loose) < 0; -} - -exports.eq = eq; -function eq(a, b, loose) { - return compare(a, b, loose) === 0; -} - -exports.neq = neq; -function neq(a, b, loose) { - return compare(a, b, loose) !== 0; -} - -exports.gte = gte; -function gte(a, b, loose) { - return compare(a, b, loose) >= 0; -} - -exports.lte = lte; -function lte(a, b, loose) { - return compare(a, b, loose) <= 0; -} - -exports.cmp = cmp; -function cmp(a, op, b, loose) { - var ret; - switch (op) { - case '===': - if (typeof a === 'object') a = a.version; - if (typeof b === 'object') b = b.version; - ret = a === b; - break; - case '!==': - if (typeof a === 'object') a = a.version; - if (typeof b === 'object') b = b.version; - ret = a !== b; - break; - case '': case '=': case '==': ret = eq(a, b, loose); break; - case '!=': ret = neq(a, b, loose); break; - case '>': ret = gt(a, b, loose); break; - case '>=': ret = gte(a, b, loose); break; - case '<': ret = lt(a, b, loose); break; - case '<=': ret = lte(a, b, loose); break; - default: throw new TypeError('Invalid operator: ' + op); - } - return ret; -} - -exports.Comparator = Comparator; -function Comparator(comp, loose) { - if (comp instanceof Comparator) { - if (comp.loose === loose) - return comp; - else - comp = comp.value; - } - - if (!(this instanceof Comparator)) - return new Comparator(comp, loose); - - debug('comparator', comp, loose); - this.loose = loose; - this.parse(comp); - - if (this.semver === ANY) - this.value = ''; - else - this.value = this.operator + this.semver.version; - - debug('comp', this); -} - -var ANY = {}; -Comparator.prototype.parse = function(comp) { - var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; - var m = comp.match(r); - - if (!m) - throw new TypeError('Invalid comparator: ' + comp); - - this.operator = m[1]; - if (this.operator === '=') - this.operator = ''; - - // if it literally is just '>' or '' then allow anything. - if (!m[2]) - this.semver = ANY; - else - this.semver = new SemVer(m[2], this.loose); -}; - -Comparator.prototype.toString = function() { - return this.value; -}; - -Comparator.prototype.test = function(version) { - debug('Comparator.test', version, this.loose); - - if (this.semver === ANY) - return true; - - if (typeof version === 'string') - version = new SemVer(version, this.loose); - - return cmp(version, this.operator, this.semver, this.loose); -}; - -Comparator.prototype.intersects = function(comp, loose) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required'); - } - - var rangeTmp; - - if (this.operator === '') { - rangeTmp = new Range(comp.value, loose); - return satisfies(this.value, rangeTmp, loose); - } else if (comp.operator === '') { - rangeTmp = new Range(this.value, loose); - return satisfies(comp.semver, rangeTmp, loose); - } - - var sameDirectionIncreasing = - (this.operator === '>=' || this.operator === '>') && - (comp.operator === '>=' || comp.operator === '>'); - var sameDirectionDecreasing = - (this.operator === '<=' || this.operator === '<') && - (comp.operator === '<=' || comp.operator === '<'); - var sameSemVer = this.semver.version === comp.semver.version; - var differentDirectionsInclusive = - (this.operator === '>=' || this.operator === '<=') && - (comp.operator === '>=' || comp.operator === '<='); - var oppositeDirectionsLessThan = - cmp(this.semver, '<', comp.semver, loose) && - ((this.operator === '>=' || this.operator === '>') && - (comp.operator === '<=' || comp.operator === '<')); - var oppositeDirectionsGreaterThan = - cmp(this.semver, '>', comp.semver, loose) && - ((this.operator === '<=' || this.operator === '<') && - (comp.operator === '>=' || comp.operator === '>')); - - return sameDirectionIncreasing || sameDirectionDecreasing || - (sameSemVer && differentDirectionsInclusive) || - oppositeDirectionsLessThan || oppositeDirectionsGreaterThan; -}; - - -exports.Range = Range; -function Range(range, loose) { - if (range instanceof Range) { - if (range.loose === loose) { - return range; - } else { - return new Range(range.raw, loose); - } - } - - if (range instanceof Comparator) { - return new Range(range.value, loose); - } - - if (!(this instanceof Range)) - return new Range(range, loose); - - this.loose = loose; - - // First, split based on boolean or || - this.raw = range; - this.set = range.split(/\s*\|\|\s*/).map(function(range) { - return this.parseRange(range.trim()); - }, this).filter(function(c) { - // throw out any that are not relevant for whatever reason - return c.length; - }); - - if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range); - } - - this.format(); -} - -Range.prototype.format = function() { - this.range = this.set.map(function(comps) { - return comps.join(' ').trim(); - }).join('||').trim(); - return this.range; -}; - -Range.prototype.toString = function() { - return this.range; -}; - -Range.prototype.parseRange = function(range) { - var loose = this.loose; - range = range.trim(); - debug('range', range, loose); - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]; - range = range.replace(hr, hyphenReplace); - debug('hyphen replace', range); - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace); - debug('comparator trim', range, re[COMPARATORTRIM]); - - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[TILDETRIM], tildeTrimReplace); - - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[CARETTRIM], caretTrimReplace); - - // normalize spaces - range = range.split(/\s+/).join(' '); - - // At this point, the range is completely trimmed and - // ready to be split into comparators. - - var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; - var set = range.split(' ').map(function(comp) { - return parseComparator(comp, loose); - }).join(' ').split(/\s+/); - if (this.loose) { - // in loose mode, throw out any that are not valid comparators - set = set.filter(function(comp) { - return !!comp.match(compRe); - }); - } - set = set.map(function(comp) { - return new Comparator(comp, loose); - }); - - return set; -}; - -Range.prototype.intersects = function(range, loose) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required'); - } - - return this.set.some(function(thisComparators) { - return thisComparators.every(function(thisComparator) { - return range.set.some(function(rangeComparators) { - return rangeComparators.every(function(rangeComparator) { - return thisComparator.intersects(rangeComparator, loose); - }); - }); - }); - }); -}; - -// Mostly just for testing and legacy API reasons -exports.toComparators = toComparators; -function toComparators(range, loose) { - return new Range(range, loose).set.map(function(comp) { - return comp.map(function(c) { - return c.value; - }).join(' ').trim().split(' '); - }); -} - -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -function parseComparator(comp, loose) { - debug('comp', comp); - comp = replaceCarets(comp, loose); - debug('caret', comp); - comp = replaceTildes(comp, loose); - debug('tildes', comp); - comp = replaceXRanges(comp, loose); - debug('xrange', comp); - comp = replaceStars(comp, loose); - debug('stars', comp); - return comp; -} - -function isX(id) { - return !id || id.toLowerCase() === 'x' || id === '*'; -} - -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 -function replaceTildes(comp, loose) { - return comp.trim().split(/\s+/).map(function(comp) { - return replaceTilde(comp, loose); - }).join(' '); -} - -function replaceTilde(comp, loose) { - var r = loose ? re[TILDELOOSE] : re[TILDE]; - return comp.replace(r, function(_, M, m, p, pr) { - debug('tilde', comp, _, M, m, p, pr); - var ret; - - if (isX(M)) - ret = ''; - else if (isX(m)) - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; - else if (isX(p)) - // ~1.2 == >=1.2.0 <1.3.0 - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; - else if (pr) { - debug('replaceTilde pr', pr); - if (pr.charAt(0) !== '-') - pr = '-' + pr; - ret = '>=' + M + '.' + m + '.' + p + pr + - ' <' + M + '.' + (+m + 1) + '.0'; - } else - // ~1.2.3 == >=1.2.3 <1.3.0 - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0'; - - debug('tilde return', ret); - return ret; - }); -} - -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 -// ^1.2.3 --> >=1.2.3 <2.0.0 -// ^1.2.0 --> >=1.2.0 <2.0.0 -function replaceCarets(comp, loose) { - return comp.trim().split(/\s+/).map(function(comp) { - return replaceCaret(comp, loose); - }).join(' '); -} - -function replaceCaret(comp, loose) { - debug('caret', comp, loose); - var r = loose ? re[CARETLOOSE] : re[CARET]; - return comp.replace(r, function(_, M, m, p, pr) { - debug('caret', comp, _, M, m, p, pr); - var ret; - - if (isX(M)) - ret = ''; - else if (isX(m)) - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; - else if (isX(p)) { - if (M === '0') - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; - else - ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; - } else if (pr) { - debug('replaceCaret pr', pr); - if (pr.charAt(0) !== '-') - pr = '-' + pr; - if (M === '0') { - if (m === '0') - ret = '>=' + M + '.' + m + '.' + p + pr + - ' <' + M + '.' + m + '.' + (+p + 1); - else - ret = '>=' + M + '.' + m + '.' + p + pr + - ' <' + M + '.' + (+m + 1) + '.0'; - } else - ret = '>=' + M + '.' + m + '.' + p + pr + - ' <' + (+M + 1) + '.0.0'; - } else { - debug('no pr'); - if (M === '0') { - if (m === '0') - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + m + '.' + (+p + 1); - else - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0'; - } else - ret = '>=' + M + '.' + m + '.' + p + - ' <' + (+M + 1) + '.0.0'; - } - - debug('caret return', ret); - return ret; - }); -} - -function replaceXRanges(comp, loose) { - debug('replaceXRanges', comp, loose); - return comp.split(/\s+/).map(function(comp) { - return replaceXRange(comp, loose); - }).join(' '); -} - -function replaceXRange(comp, loose) { - comp = comp.trim(); - var r = loose ? re[XRANGELOOSE] : re[XRANGE]; - return comp.replace(r, function(ret, gtlt, M, m, p, pr) { - debug('xRange', comp, ret, gtlt, M, m, p, pr); - var xM = isX(M); - var xm = xM || isX(m); - var xp = xm || isX(p); - var anyX = xp; - - if (gtlt === '=' && anyX) - gtlt = ''; - - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0'; - } else { - // nothing is forbidden - ret = '*'; - } - } else if (gtlt && anyX) { - // replace X with 0 - if (xm) - m = 0; - if (xp) - p = 0; - - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - // >1.2.3 => >= 1.2.4 - gtlt = '>='; - if (xm) { - M = +M + 1; - m = 0; - p = 0; - } else if (xp) { - m = +m + 1; - p = 0; - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<'; - if (xm) - M = +M + 1; - else - m = +m + 1; - } - - ret = gtlt + M + '.' + m + '.' + p; - } else if (xm) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; - } else if (xp) { - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; - } - - debug('xRange return', ret); - - return ret; - }); -} - -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -function replaceStars(comp, loose) { - debug('replaceStars', comp, loose); - // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[STAR], ''); -} - -// This function is passed to string.replace(re[HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0 -function hyphenReplace($0, - from, fM, fm, fp, fpr, fb, - to, tM, tm, tp, tpr, tb) { - - if (isX(fM)) - from = ''; - else if (isX(fm)) - from = '>=' + fM + '.0.0'; - else if (isX(fp)) - from = '>=' + fM + '.' + fm + '.0'; - else - from = '>=' + from; - - if (isX(tM)) - to = ''; - else if (isX(tm)) - to = '<' + (+tM + 1) + '.0.0'; - else if (isX(tp)) - to = '<' + tM + '.' + (+tm + 1) + '.0'; - else if (tpr) - to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; - else - to = '<=' + to; - - return (from + ' ' + to).trim(); -} - - -// if ANY of the sets match ALL of its comparators, then pass -Range.prototype.test = function(version) { - if (!version) - return false; - - if (typeof version === 'string') - version = new SemVer(version, this.loose); - - for (var i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version)) - return true; - } - return false; -}; - -function testSet(set, version) { - for (var i = 0; i < set.length; i++) { - if (!set[i].test(version)) - return false; - } - - if (version.prerelease.length) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (var i = 0; i < set.length; i++) { - debug(set[i].semver); - if (set[i].semver === ANY) - continue; - - if (set[i].semver.prerelease.length > 0) { - var allowed = set[i].semver; - if (allowed.major === version.major && - allowed.minor === version.minor && - allowed.patch === version.patch) - return true; - } - } - - // Version has a -pre, but it's not one of the ones we like. - return false; - } - - return true; -} - -exports.satisfies = satisfies; -function satisfies(version, range, loose) { - try { - range = new Range(range, loose); - } catch (er) { - return false; - } - return range.test(version); -} - -exports.maxSatisfying = maxSatisfying; -function maxSatisfying(versions, range, loose) { - var max = null; - var maxSV = null; - try { - var rangeObj = new Range(range, loose); - } catch (er) { - return null; - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { // satisfies(v, range, loose) - if (!max || maxSV.compare(v) === -1) { // compare(max, v, true) - max = v; - maxSV = new SemVer(max, loose); - } - } - }) - return max; -} - -exports.minSatisfying = minSatisfying; -function minSatisfying(versions, range, loose) { - var min = null; - var minSV = null; - try { - var rangeObj = new Range(range, loose); - } catch (er) { - return null; - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { // satisfies(v, range, loose) - if (!min || minSV.compare(v) === 1) { // compare(min, v, true) - min = v; - minSV = new SemVer(min, loose); - } - } - }) - return min; -} - -exports.validRange = validRange; -function validRange(range, loose) { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, loose).range || '*'; - } catch (er) { - return null; - } -} - -// Determine if version is less than all the versions possible in the range -exports.ltr = ltr; -function ltr(version, range, loose) { - return outside(version, range, '<', loose); -} - -// Determine if version is greater than all the versions possible in the range. -exports.gtr = gtr; -function gtr(version, range, loose) { - return outside(version, range, '>', loose); -} - -exports.outside = outside; -function outside(version, range, hilo, loose) { - version = new SemVer(version, loose); - range = new Range(range, loose); - - var gtfn, ltefn, ltfn, comp, ecomp; - switch (hilo) { - case '>': - gtfn = gt; - ltefn = lte; - ltfn = lt; - comp = '>'; - ecomp = '>='; - break; - case '<': - gtfn = lt; - ltefn = gte; - ltfn = gt; - comp = '<'; - ecomp = '<='; - break; - default: - throw new TypeError('Must provide a hilo val of "<" or ">"'); - } - - // If it satisifes the range it is not outside - if (satisfies(version, range, loose)) { - return false; - } - - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. - - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i]; - - var high = null; - var low = null; - - comparators.forEach(function(comparator) { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0') - } - high = high || comparator; - low = low || comparator; - if (gtfn(comparator.semver, high.semver, loose)) { - high = comparator; - } else if (ltfn(comparator.semver, low.semver, loose)) { - low = comparator; - } - }); - - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false; - } - - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false; - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false; - } - } - return true; -} - -exports.prerelease = prerelease; -function prerelease(version, loose) { - var parsed = parse(version, loose); - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null; -} - -exports.intersects = intersects; -function intersects(r1, r2, loose) { - r1 = new Range(r1, loose) - r2 = new Range(r2, loose) - return r1.intersects(r2) -} - -exports.coerce = coerce; -function coerce(version) { - if (version instanceof SemVer) - return version; - - if (typeof version !== 'string') - return null; - - var match = version.match(re[COERCE]); - - if (match == null) - return null; - - return parse((match[1] || '0') + '.' + (match[2] || '0') + '.' + (match[3] || '0')); -} - - -/***/ }), -/* 23 */ -/***/ (function(module, exports) { - -module.exports = require("stream"); - -/***/ }), -/* 24 */ -/***/ (function(module, exports) { - -module.exports = require("url"); - -/***/ }), -/* 25 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subscription; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isArray__ = __webpack_require__(41); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isObject__ = __webpack_require__(444); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isFunction__ = __webpack_require__(155); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_tryCatch__ = __webpack_require__(57); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_errorObject__ = __webpack_require__(48); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__ = __webpack_require__(441); -/** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_tryCatch,_util_errorObject,_util_UnsubscriptionError PURE_IMPORTS_END */ - - - - - - -var Subscription = /*@__PURE__*/ (function () { - function Subscription(unsubscribe) { - this.closed = false; - this._parent = null; - this._parents = null; - this._subscriptions = null; - if (unsubscribe) { - this._unsubscribe = unsubscribe; - } - } - Subscription.prototype.unsubscribe = function () { - var hasErrors = false; - var errors; - if (this.closed) { - return; - } - var _a = this, _parent = _a._parent, _parents = _a._parents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions; - this.closed = true; - this._parent = null; - this._parents = null; - this._subscriptions = null; - var index = -1; - var len = _parents ? _parents.length : 0; - while (_parent) { - _parent.remove(this); - _parent = ++index < len && _parents[index] || null; - } - if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__util_isFunction__["a" /* isFunction */])(_unsubscribe)) { - var trial = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__util_tryCatch__["a" /* tryCatch */])(_unsubscribe).call(this); - if (trial === __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */]) { - hasErrors = true; - errors = errors || (__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */] ? - flattenUnsubscriptionErrors(__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e.errors) : [__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e]); - } - } - if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__util_isArray__["a" /* isArray */])(_subscriptions)) { - index = -1; - len = _subscriptions.length; - while (++index < len) { - var sub = _subscriptions[index]; - if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__util_isObject__["a" /* isObject */])(sub)) { - var trial = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__util_tryCatch__["a" /* tryCatch */])(sub.unsubscribe).call(sub); - if (trial === __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */]) { - hasErrors = true; - errors = errors || []; - var err = __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e; - if (err instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */]) { - errors = errors.concat(flattenUnsubscriptionErrors(err.errors)); - } - else { - errors.push(err); - } - } - } - } - } - if (hasErrors) { - throw new __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */](errors); - } - }; - Subscription.prototype.add = function (teardown) { - if (!teardown || (teardown === Subscription.EMPTY)) { - return Subscription.EMPTY; - } - if (teardown === this) { - return this; - } - var subscription = teardown; - switch (typeof teardown) { - case 'function': - subscription = new Subscription(teardown); - case 'object': - if (subscription.closed || typeof subscription.unsubscribe !== 'function') { - return subscription; - } - else if (this.closed) { - subscription.unsubscribe(); - return subscription; - } - else if (typeof subscription._addParent !== 'function') { - var tmp = subscription; - subscription = new Subscription(); - subscription._subscriptions = [tmp]; - } - break; - default: - throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.'); - } - var subscriptions = this._subscriptions || (this._subscriptions = []); - subscriptions.push(subscription); - subscription._addParent(this); - return subscription; - }; - Subscription.prototype.remove = function (subscription) { - var subscriptions = this._subscriptions; - if (subscriptions) { - var subscriptionIndex = subscriptions.indexOf(subscription); - if (subscriptionIndex !== -1) { - subscriptions.splice(subscriptionIndex, 1); - } - } - }; - Subscription.prototype._addParent = function (parent) { - var _a = this, _parent = _a._parent, _parents = _a._parents; - if (!_parent || _parent === parent) { - this._parent = parent; - } - else if (!_parents) { - this._parents = [parent]; - } - else if (_parents.indexOf(parent) === -1) { - _parents.push(parent); - } - }; - Subscription.EMPTY = (function (empty) { - empty.closed = true; - return empty; - }(new Subscription())); - return Subscription; -}()); - -function flattenUnsubscriptionErrors(errors) { - return errors.reduce(function (errs, err) { return errs.concat((err instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */]) ? err.errors : err); }, []); -} -//# sourceMappingURL=Subscription.js.map - - -/***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { - -// Copyright 2015 Joyent, Inc. - -module.exports = { - bufferSplit: bufferSplit, - addRSAMissing: addRSAMissing, - calculateDSAPublic: calculateDSAPublic, - calculateED25519Public: calculateED25519Public, - calculateX25519Public: calculateX25519Public, - mpNormalize: mpNormalize, - mpDenormalize: mpDenormalize, - ecNormalize: ecNormalize, - countZeros: countZeros, - assertCompatible: assertCompatible, - isCompatible: isCompatible, - opensslKeyDeriv: opensslKeyDeriv, - opensshCipherInfo: opensshCipherInfo, - publicFromPrivateECDSA: publicFromPrivateECDSA, - zeroPadToLength: zeroPadToLength, - writeBitString: writeBitString, - readBitString: readBitString -}; - -var assert = __webpack_require__(16); -var Buffer = __webpack_require__(15).Buffer; -var PrivateKey = __webpack_require__(33); -var Key = __webpack_require__(28); -var crypto = __webpack_require__(11); -var algs = __webpack_require__(32); -var asn1 = __webpack_require__(66); - -var ec, jsbn; -var nacl; - -var MAX_CLASS_DEPTH = 3; - -function isCompatible(obj, klass, needVer) { - if (obj === null || typeof (obj) !== 'object') - return (false); - if (needVer === undefined) - needVer = klass.prototype._sshpkApiVersion; - if (obj instanceof klass && - klass.prototype._sshpkApiVersion[0] == needVer[0]) - return (true); - var proto = Object.getPrototypeOf(obj); - var depth = 0; - while (proto.constructor.name !== klass.name) { - proto = Object.getPrototypeOf(proto); - if (!proto || ++depth > MAX_CLASS_DEPTH) - return (false); - } - if (proto.constructor.name !== klass.name) - return (false); - var ver = proto._sshpkApiVersion; - if (ver === undefined) - ver = klass._oldVersionDetect(obj); - if (ver[0] != needVer[0] || ver[1] < needVer[1]) - return (false); - return (true); -} - -function assertCompatible(obj, klass, needVer, name) { - if (name === undefined) - name = 'object'; - assert.ok(obj, name + ' must not be null'); - assert.object(obj, name + ' must be an object'); - if (needVer === undefined) - needVer = klass.prototype._sshpkApiVersion; - if (obj instanceof klass && - klass.prototype._sshpkApiVersion[0] == needVer[0]) - return; - var proto = Object.getPrototypeOf(obj); - var depth = 0; - while (proto.constructor.name !== klass.name) { - proto = Object.getPrototypeOf(proto); - assert.ok(proto && ++depth <= MAX_CLASS_DEPTH, - name + ' must be a ' + klass.name + ' instance'); - } - assert.strictEqual(proto.constructor.name, klass.name, - name + ' must be a ' + klass.name + ' instance'); - var ver = proto._sshpkApiVersion; - if (ver === undefined) - ver = klass._oldVersionDetect(obj); - assert.ok(ver[0] == needVer[0] && ver[1] >= needVer[1], - name + ' must be compatible with ' + klass.name + ' klass ' + - 'version ' + needVer[0] + '.' + needVer[1]); -} - -var CIPHER_LEN = { - 'des-ede3-cbc': { key: 7, iv: 8 }, - 'aes-128-cbc': { key: 16, iv: 16 } -}; -var PKCS5_SALT_LEN = 8; - -function opensslKeyDeriv(cipher, salt, passphrase, count) { - assert.buffer(salt, 'salt'); - assert.buffer(passphrase, 'passphrase'); - assert.number(count, 'iteration count'); - - var clen = CIPHER_LEN[cipher]; - assert.object(clen, 'supported cipher'); - - salt = salt.slice(0, PKCS5_SALT_LEN); - - var D, D_prev, bufs; - var material = Buffer.alloc(0); - while (material.length < clen.key + clen.iv) { - bufs = []; - if (D_prev) - bufs.push(D_prev); - bufs.push(passphrase); - bufs.push(salt); - D = Buffer.concat(bufs); - for (var j = 0; j < count; ++j) - D = crypto.createHash('md5').update(D).digest(); - material = Buffer.concat([material, D]); - D_prev = D; - } - - return ({ - key: material.slice(0, clen.key), - iv: material.slice(clen.key, clen.key + clen.iv) - }); -} - -/* Count leading zero bits on a buffer */ -function countZeros(buf) { - var o = 0, obit = 8; - while (o < buf.length) { - var mask = (1 << obit); - if ((buf[o] & mask) === mask) - break; - obit--; - if (obit < 0) { - o++; - obit = 8; - } - } - return (o*8 + (8 - obit) - 1); -} - -function bufferSplit(buf, chr) { - assert.buffer(buf); - assert.string(chr); - - var parts = []; - var lastPart = 0; - var matches = 0; - for (var i = 0; i < buf.length; ++i) { - if (buf[i] === chr.charCodeAt(matches)) - ++matches; - else if (buf[i] === chr.charCodeAt(0)) - matches = 1; - else - matches = 0; - - if (matches >= chr.length) { - var newPart = i + 1; - parts.push(buf.slice(lastPart, newPart - matches)); - lastPart = newPart; - matches = 0; - } - } - if (lastPart <= buf.length) - parts.push(buf.slice(lastPart, buf.length)); - - return (parts); -} - -function ecNormalize(buf, addZero) { - assert.buffer(buf); - if (buf[0] === 0x00 && buf[1] === 0x04) { - if (addZero) - return (buf); - return (buf.slice(1)); - } else if (buf[0] === 0x04) { - if (!addZero) - return (buf); - } else { - while (buf[0] === 0x00) - buf = buf.slice(1); - if (buf[0] === 0x02 || buf[0] === 0x03) - throw (new Error('Compressed elliptic curve points ' + - 'are not supported')); - if (buf[0] !== 0x04) - throw (new Error('Not a valid elliptic curve point')); - if (!addZero) - return (buf); - } - var b = Buffer.alloc(buf.length + 1); - b[0] = 0x0; - buf.copy(b, 1); - return (b); -} - -function readBitString(der, tag) { - if (tag === undefined) - tag = asn1.Ber.BitString; - var buf = der.readString(tag, true); - assert.strictEqual(buf[0], 0x00, 'bit strings with unused bits are ' + - 'not supported (0x' + buf[0].toString(16) + ')'); - return (buf.slice(1)); -} - -function writeBitString(der, buf, tag) { - if (tag === undefined) - tag = asn1.Ber.BitString; - var b = Buffer.alloc(buf.length + 1); - b[0] = 0x00; - buf.copy(b, 1); - der.writeBuffer(b, tag); -} - -function mpNormalize(buf) { - assert.buffer(buf); - while (buf.length > 1 && buf[0] === 0x00 && (buf[1] & 0x80) === 0x00) - buf = buf.slice(1); - if ((buf[0] & 0x80) === 0x80) { - var b = Buffer.alloc(buf.length + 1); - b[0] = 0x00; - buf.copy(b, 1); - buf = b; - } - return (buf); -} - -function mpDenormalize(buf) { - assert.buffer(buf); - while (buf.length > 1 && buf[0] === 0x00) - buf = buf.slice(1); - return (buf); -} - -function zeroPadToLength(buf, len) { - assert.buffer(buf); - assert.number(len); - while (buf.length > len) { - assert.equal(buf[0], 0x00); - buf = buf.slice(1); - } - while (buf.length < len) { - var b = Buffer.alloc(buf.length + 1); - b[0] = 0x00; - buf.copy(b, 1); - buf = b; - } - return (buf); -} - -function bigintToMpBuf(bigint) { - var buf = Buffer.from(bigint.toByteArray()); - buf = mpNormalize(buf); - return (buf); -} - -function calculateDSAPublic(g, p, x) { - assert.buffer(g); - assert.buffer(p); - assert.buffer(x); - try { - var bigInt = __webpack_require__(81).BigInteger; - } catch (e) { - throw (new Error('To load a PKCS#8 format DSA private key, ' + - 'the node jsbn library is required.')); - } - g = new bigInt(g); - p = new bigInt(p); - x = new bigInt(x); - var y = g.modPow(x, p); - var ybuf = bigintToMpBuf(y); - return (ybuf); -} - -function calculateED25519Public(k) { - assert.buffer(k); - - if (nacl === undefined) - nacl = __webpack_require__(76); - - var kp = nacl.sign.keyPair.fromSeed(new Uint8Array(k)); - return (Buffer.from(kp.publicKey)); -} - -function calculateX25519Public(k) { - assert.buffer(k); - - if (nacl === undefined) - nacl = __webpack_require__(76); - - var kp = nacl.box.keyPair.fromSeed(new Uint8Array(k)); - return (Buffer.from(kp.publicKey)); -} - -function addRSAMissing(key) { - assert.object(key); - assertCompatible(key, PrivateKey, [1, 1]); - try { - var bigInt = __webpack_require__(81).BigInteger; - } catch (e) { - throw (new Error('To write a PEM private key from ' + - 'this source, the node jsbn lib is required.')); - } - - var d = new bigInt(key.part.d.data); - var buf; - - if (!key.part.dmodp) { - var p = new bigInt(key.part.p.data); - var dmodp = d.mod(p.subtract(1)); - - buf = bigintToMpBuf(dmodp); - key.part.dmodp = {name: 'dmodp', data: buf}; - key.parts.push(key.part.dmodp); - } - if (!key.part.dmodq) { - var q = new bigInt(key.part.q.data); - var dmodq = d.mod(q.subtract(1)); - - buf = bigintToMpBuf(dmodq); - key.part.dmodq = {name: 'dmodq', data: buf}; - key.parts.push(key.part.dmodq); - } -} - -function publicFromPrivateECDSA(curveName, priv) { - assert.string(curveName, 'curveName'); - assert.buffer(priv); - if (ec === undefined) - ec = __webpack_require__(140); - if (jsbn === undefined) - jsbn = __webpack_require__(81).BigInteger; - var params = algs.curves[curveName]; - var p = new jsbn(params.p); - var a = new jsbn(params.a); - var b = new jsbn(params.b); - var curve = new ec.ECCurveFp(p, a, b); - var G = curve.decodePointHex(params.G.toString('hex')); - - var d = new jsbn(mpNormalize(priv)); - var pub = G.multiply(d); - pub = Buffer.from(curve.encodePointHex(pub), 'hex'); - - var parts = []; - parts.push({name: 'curve', data: Buffer.from(curveName)}); - parts.push({name: 'Q', data: pub}); - - var key = new Key({type: 'ecdsa', curve: curve, parts: parts}); - return (key); -} - -function opensshCipherInfo(cipher) { - var inf = {}; - switch (cipher) { - case '3des-cbc': - inf.keySize = 24; - inf.blockSize = 8; - inf.opensslName = 'des-ede3-cbc'; - break; - case 'blowfish-cbc': - inf.keySize = 16; - inf.blockSize = 8; - inf.opensslName = 'bf-cbc'; - break; - case 'aes128-cbc': - case 'aes128-ctr': - case 'aes128-gcm@openssh.com': - inf.keySize = 16; - inf.blockSize = 16; - inf.opensslName = 'aes-128-' + cipher.slice(7, 10); - break; - case 'aes192-cbc': - case 'aes192-ctr': - case 'aes192-gcm@openssh.com': - inf.keySize = 24; - inf.blockSize = 16; - inf.opensslName = 'aes-192-' + cipher.slice(7, 10); - break; - case 'aes256-cbc': - case 'aes256-ctr': - case 'aes256-gcm@openssh.com': - inf.keySize = 32; - inf.blockSize = 16; - inf.opensslName = 'aes-256-' + cipher.slice(7, 10); - break; - default: - throw (new Error( - 'Unsupported openssl cipher "' + cipher + '"')); - } - return (inf); -} - - -/***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -const escapeStringRegexp = __webpack_require__(382); -const ansiStyles = __webpack_require__(474); -const stdoutColor = __webpack_require__(566).stdout; - -const template = __webpack_require__(567); - -const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); - -// `supportsColor.level` → `ansiStyles.color[name]` mapping -const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; - -// `color-convert` models to exclude from the Chalk API due to conflicts and such -const skipModels = new Set(['gray']); - -const styles = Object.create(null); - -function applyOptions(obj, options) { - options = options || {}; - - // Detect level if not set manually - const scLevel = stdoutColor ? stdoutColor.level : 0; - obj.level = options.level === undefined ? scLevel : options.level; - obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0; -} - -function Chalk(options) { - // We check for this.template here since calling `chalk.constructor()` - // by itself will have a `this` of a previously constructed chalk object - if (!this || !(this instanceof Chalk) || this.template) { - const chalk = {}; - applyOptions(chalk, options); - - chalk.template = function () { - const args = [].slice.call(arguments); - return chalkTag.apply(null, [chalk.template].concat(args)); - }; - - Object.setPrototypeOf(chalk, Chalk.prototype); - Object.setPrototypeOf(chalk.template, chalk); - - chalk.template.constructor = Chalk; - - return chalk.template; - } - - applyOptions(this, options); -} - -// Use bright blue on Windows as the normal blue color is illegible -if (isSimpleWindowsTerm) { - ansiStyles.blue.open = '\u001B[94m'; -} - -for (const key of Object.keys(ansiStyles)) { - ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); - - styles[key] = { - get() { - const codes = ansiStyles[key]; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key); - } - }; -} - -styles.visible = { - get() { - return build.call(this, this._styles || [], true, 'visible'); - } -}; - -ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g'); -for (const model of Object.keys(ansiStyles.color.ansi)) { - if (skipModels.has(model)) { - continue; - } - - styles[model] = { - get() { - const level = this.level; - return function () { - const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments); - const codes = { - open, - close: ansiStyles.color.close, - closeRe: ansiStyles.color.closeRe - }; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); - }; - } - }; -} - -ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g'); -for (const model of Object.keys(ansiStyles.bgColor.ansi)) { - if (skipModels.has(model)) { - continue; - } - - const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); - styles[bgModel] = { - get() { - const level = this.level; - return function () { - const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments); - const codes = { - open, - close: ansiStyles.bgColor.close, - closeRe: ansiStyles.bgColor.closeRe - }; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); - }; - } - }; -} - -const proto = Object.defineProperties(() => {}, styles); - -function build(_styles, _empty, key) { - const builder = function () { - return applyStyle.apply(builder, arguments); - }; - - builder._styles = _styles; - builder._empty = _empty; - - const self = this; - - Object.defineProperty(builder, 'level', { - enumerable: true, - get() { - return self.level; - }, - set(level) { - self.level = level; - } - }); - - Object.defineProperty(builder, 'enabled', { - enumerable: true, - get() { - return self.enabled; - }, - set(enabled) { - self.enabled = enabled; - } - }); - - // See below for fix regarding invisible grey/dim combination on Windows - builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; - - // `__proto__` is used because we must return a function, but there is - // no way to create a function with a different prototype - builder.__proto__ = proto; // eslint-disable-line no-proto - - return builder; -} - -function applyStyle() { - // Support varags, but simply cast to string in case there's only one arg - const args = arguments; - const argsLen = args.length; - let str = String(arguments[0]); - - if (argsLen === 0) { - return ''; - } - - if (argsLen > 1) { - // Don't slice `arguments`, it prevents V8 optimizations - for (let a = 1; a < argsLen; a++) { - str += ' ' + args[a]; - } - } - - if (!this.enabled || this.level <= 0 || !str) { - return this._empty ? '' : str; - } - - // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, - // see https://github.com/chalk/chalk/issues/58 - // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. - const originalDim = ansiStyles.dim.open; - if (isSimpleWindowsTerm && this.hasGrey) { - ansiStyles.dim.open = ''; - } - - for (const code of this._styles.slice().reverse()) { - // Replace any instances already present with a re-opening code - // otherwise only the part of the string until said closing code - // will be colored, and the rest will simply be 'plain'. - str = code.open + str.replace(code.closeRe, code.open) + code.close; - - // Close the styling before a linebreak and reopen - // after next line to fix a bleed issue on macOS - // https://github.com/chalk/chalk/pull/92 - str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`); - } - - // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue - ansiStyles.dim.open = originalDim; - - return str; -} - -function chalkTag(chalk, strings) { - if (!Array.isArray(strings)) { - // If chalk() was called by itself or with a string, - // return the string itself as a string. - return [].slice.call(arguments, 1).join(' '); - } - - const args = [].slice.call(arguments, 2); - const parts = [strings.raw[0]]; - - for (let i = 1; i < strings.length; i++) { - parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&')); - parts.push(String(strings.raw[i])); - } - - return template(chalk, parts.join('')); -} - -Object.defineProperties(Chalk.prototype, styles); - -module.exports = Chalk(); // eslint-disable-line new-cap -module.exports.supportsColor = stdoutColor; -module.exports.default = module.exports; // For TypeScript - - -/***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { - -// Copyright 2017 Joyent, Inc. - -module.exports = Key; - -var assert = __webpack_require__(16); -var algs = __webpack_require__(32); -var crypto = __webpack_require__(11); -var Fingerprint = __webpack_require__(157); -var Signature = __webpack_require__(75); -var DiffieHellman = __webpack_require__(326).DiffieHellman; -var errs = __webpack_require__(74); -var utils = __webpack_require__(26); -var PrivateKey = __webpack_require__(33); -var edCompat; - -try { - edCompat = __webpack_require__(454); -} catch (e) { - /* Just continue through, and bail out if we try to use it. */ -} - -var InvalidAlgorithmError = errs.InvalidAlgorithmError; -var KeyParseError = errs.KeyParseError; - -var formats = {}; -formats['auto'] = __webpack_require__(455); -formats['pem'] = __webpack_require__(86); -formats['pkcs1'] = __webpack_require__(328); -formats['pkcs8'] = __webpack_require__(158); -formats['rfc4253'] = __webpack_require__(103); -formats['ssh'] = __webpack_require__(456); -formats['ssh-private'] = __webpack_require__(193); -formats['openssh'] = formats['ssh-private']; -formats['dnssec'] = __webpack_require__(327); - -function Key(opts) { - assert.object(opts, 'options'); - assert.arrayOfObject(opts.parts, 'options.parts'); - assert.string(opts.type, 'options.type'); - assert.optionalString(opts.comment, 'options.comment'); - - var algInfo = algs.info[opts.type]; - if (typeof (algInfo) !== 'object') - throw (new InvalidAlgorithmError(opts.type)); - - var partLookup = {}; - for (var i = 0; i < opts.parts.length; ++i) { - var part = opts.parts[i]; - partLookup[part.name] = part; - } - - this.type = opts.type; - this.parts = opts.parts; - this.part = partLookup; - this.comment = undefined; - this.source = opts.source; - - /* for speeding up hashing/fingerprint operations */ - this._rfc4253Cache = opts._rfc4253Cache; - this._hashCache = {}; - - var sz; - this.curve = undefined; - if (this.type === 'ecdsa') { - var curve = this.part.curve.data.toString(); - this.curve = curve; - sz = algs.curves[curve].size; - } else if (this.type === 'ed25519' || this.type === 'curve25519') { - sz = 256; - this.curve = 'curve25519'; - } else { - var szPart = this.part[algInfo.sizePart]; - sz = szPart.data.length; - sz = sz * 8 - utils.countZeros(szPart.data); - } - this.size = sz; -} - -Key.formats = formats; - -Key.prototype.toBuffer = function (format, options) { - if (format === undefined) - format = 'ssh'; - assert.string(format, 'format'); - assert.object(formats[format], 'formats[format]'); - assert.optionalObject(options, 'options'); - - if (format === 'rfc4253') { - if (this._rfc4253Cache === undefined) - this._rfc4253Cache = formats['rfc4253'].write(this); - return (this._rfc4253Cache); - } - - return (formats[format].write(this, options)); -}; - -Key.prototype.toString = function (format, options) { - return (this.toBuffer(format, options).toString()); -}; - -Key.prototype.hash = function (algo) { - assert.string(algo, 'algorithm'); - algo = algo.toLowerCase(); - if (algs.hashAlgs[algo] === undefined) - throw (new InvalidAlgorithmError(algo)); - - if (this._hashCache[algo]) - return (this._hashCache[algo]); - var hash = crypto.createHash(algo). - update(this.toBuffer('rfc4253')).digest(); - this._hashCache[algo] = hash; - return (hash); -}; - -Key.prototype.fingerprint = function (algo) { - if (algo === undefined) - algo = 'sha256'; - assert.string(algo, 'algorithm'); - var opts = { - type: 'key', - hash: this.hash(algo), - algorithm: algo - }; - return (new Fingerprint(opts)); -}; - -Key.prototype.defaultHashAlgorithm = function () { - var hashAlgo = 'sha1'; - if (this.type === 'rsa') - hashAlgo = 'sha256'; - if (this.type === 'dsa' && this.size > 1024) - hashAlgo = 'sha256'; - if (this.type === 'ed25519') - hashAlgo = 'sha512'; - if (this.type === 'ecdsa') { - if (this.size <= 256) - hashAlgo = 'sha256'; - else if (this.size <= 384) - hashAlgo = 'sha384'; - else - hashAlgo = 'sha512'; - } - return (hashAlgo); -}; - -Key.prototype.createVerify = function (hashAlgo) { - if (hashAlgo === undefined) - hashAlgo = this.defaultHashAlgorithm(); - assert.string(hashAlgo, 'hash algorithm'); - - /* ED25519 is not supported by OpenSSL, use a javascript impl. */ - if (this.type === 'ed25519' && edCompat !== undefined) - return (new edCompat.Verifier(this, hashAlgo)); - if (this.type === 'curve25519') - throw (new Error('Curve25519 keys are not suitable for ' + - 'signing or verification')); - - var v, nm, err; - try { - nm = hashAlgo.toUpperCase(); - v = crypto.createVerify(nm); - } catch (e) { - err = e; - } - if (v === undefined || (err instanceof Error && - err.message.match(/Unknown message digest/))) { - nm = 'RSA-'; - nm += hashAlgo.toUpperCase(); - v = crypto.createVerify(nm); - } - assert.ok(v, 'failed to create verifier'); - var oldVerify = v.verify.bind(v); - var key = this.toBuffer('pkcs8'); - var curve = this.curve; - var self = this; - v.verify = function (signature, fmt) { - if (Signature.isSignature(signature, [2, 0])) { - if (signature.type !== self.type) - return (false); - if (signature.hashAlgorithm && - signature.hashAlgorithm !== hashAlgo) - return (false); - if (signature.curve && self.type === 'ecdsa' && - signature.curve !== curve) - return (false); - return (oldVerify(key, signature.toBuffer('asn1'))); - - } else if (typeof (signature) === 'string' || - Buffer.isBuffer(signature)) { - return (oldVerify(key, signature, fmt)); - - /* - * Avoid doing this on valid arguments, walking the prototype - * chain can be quite slow. - */ - } else if (Signature.isSignature(signature, [1, 0])) { - throw (new Error('signature was created by too old ' + - 'a version of sshpk and cannot be verified')); - - } else { - throw (new TypeError('signature must be a string, ' + - 'Buffer, or Signature object')); - } - }; - return (v); -}; - -Key.prototype.createDiffieHellman = function () { - if (this.type === 'rsa') - throw (new Error('RSA keys do not support Diffie-Hellman')); - - return (new DiffieHellman(this)); -}; -Key.prototype.createDH = Key.prototype.createDiffieHellman; - -Key.parse = function (data, format, options) { - if (typeof (data) !== 'string') - assert.buffer(data, 'data'); - if (format === undefined) - format = 'auto'; - assert.string(format, 'format'); - if (typeof (options) === 'string') - options = { filename: options }; - assert.optionalObject(options, 'options'); - if (options === undefined) - options = {}; - assert.optionalString(options.filename, 'options.filename'); - if (options.filename === undefined) - options.filename = '(unnamed)'; - - assert.object(formats[format], 'formats[format]'); - - try { - var k = formats[format].read(data, options); - if (k instanceof PrivateKey) - k = k.toPublic(); - if (!k.comment) - k.comment = options.filename; - return (k); - } catch (e) { - if (e.name === 'KeyEncryptedError') - throw (e); - throw (new KeyParseError(options.filename, format, e)); - } -}; - -Key.isKey = function (obj, ver) { - return (utils.isCompatible(obj, Key, ver)); -}; - -/* - * API versions for Key: - * [1,0] -- initial ver, may take Signature for createVerify or may not - * [1,1] -- added pkcs1, pkcs8 formats - * [1,2] -- added auto, ssh-private, openssh formats - * [1,3] -- added defaultHashAlgorithm - * [1,4] -- added ed support, createDH - * [1,5] -- first explicitly tagged version - * [1,6] -- changed ed25519 part names - */ -Key.prototype._sshpkApiVersion = [1, 6]; - -Key._oldVersionDetect = function (obj) { - assert.func(obj.toBuffer); - assert.func(obj.fingerprint); - if (obj.createDH) - return ([1, 4]); - if (obj.defaultHashAlgorithm) - return ([1, 3]); - if (obj.formats['auto']) - return ([1, 2]); - if (obj.formats['pkcs1']) - return ([1, 1]); - return ([1, 0]); -}; - - -/***/ }), -/* 29 */ -/***/ (function(module, exports) { - -module.exports = require("assert"); - -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = nullify; -function nullify(obj = {}) { - if (Array.isArray(obj)) { - for (var _iterator = obj, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - const item = _ref; - - nullify(item); - } - } else if (obj !== null && typeof obj === 'object' || typeof obj === 'function') { - Object.setPrototypeOf(obj, null); - - // for..in can only be applied to 'object', not 'function' - if (typeof obj === 'object') { - for (const key in obj) { - nullify(obj[key]); - } - } - } - - return obj; -} - -/***/ }), -/* 31 */ -/***/ (function(module, exports) { - -var core = module.exports = { version: '2.5.7' }; -if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef - - -/***/ }), -/* 32 */ -/***/ (function(module, exports, __webpack_require__) { - -// Copyright 2015 Joyent, Inc. - -var Buffer = __webpack_require__(15).Buffer; - -var algInfo = { - 'dsa': { - parts: ['p', 'q', 'g', 'y'], - sizePart: 'p' - }, - 'rsa': { - parts: ['e', 'n'], - sizePart: 'n' - }, - 'ecdsa': { - parts: ['curve', 'Q'], - sizePart: 'Q' - }, - 'ed25519': { - parts: ['A'], - sizePart: 'A' - } -}; -algInfo['curve25519'] = algInfo['ed25519']; - -var algPrivInfo = { - 'dsa': { - parts: ['p', 'q', 'g', 'y', 'x'] - }, - 'rsa': { - parts: ['n', 'e', 'd', 'iqmp', 'p', 'q'] - }, - 'ecdsa': { - parts: ['curve', 'Q', 'd'] - }, - 'ed25519': { - parts: ['A', 'k'] - } -}; -algPrivInfo['curve25519'] = algPrivInfo['ed25519']; - -var hashAlgs = { - 'md5': true, - 'sha1': true, - 'sha256': true, - 'sha384': true, - 'sha512': true -}; - -/* - * Taken from - * http://csrc.nist.gov/groups/ST/toolkit/documents/dss/NISTReCur.pdf - */ -var curves = { - 'nistp256': { - size: 256, - pkcs8oid: '1.2.840.10045.3.1.7', - p: Buffer.from(('00' + - 'ffffffff 00000001 00000000 00000000' + - '00000000 ffffffff ffffffff ffffffff'). - replace(/ /g, ''), 'hex'), - a: Buffer.from(('00' + - 'FFFFFFFF 00000001 00000000 00000000' + - '00000000 FFFFFFFF FFFFFFFF FFFFFFFC'). - replace(/ /g, ''), 'hex'), - b: Buffer.from(( - '5ac635d8 aa3a93e7 b3ebbd55 769886bc' + - '651d06b0 cc53b0f6 3bce3c3e 27d2604b'). - replace(/ /g, ''), 'hex'), - s: Buffer.from(('00' + - 'c49d3608 86e70493 6a6678e1 139d26b7' + - '819f7e90'). - replace(/ /g, ''), 'hex'), - n: Buffer.from(('00' + - 'ffffffff 00000000 ffffffff ffffffff' + - 'bce6faad a7179e84 f3b9cac2 fc632551'). - replace(/ /g, ''), 'hex'), - G: Buffer.from(('04' + - '6b17d1f2 e12c4247 f8bce6e5 63a440f2' + - '77037d81 2deb33a0 f4a13945 d898c296' + - '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16' + - '2bce3357 6b315ece cbb64068 37bf51f5'). - replace(/ /g, ''), 'hex') - }, - 'nistp384': { - size: 384, - pkcs8oid: '1.3.132.0.34', - p: Buffer.from(('00' + - 'ffffffff ffffffff ffffffff ffffffff' + - 'ffffffff ffffffff ffffffff fffffffe' + - 'ffffffff 00000000 00000000 ffffffff'). - replace(/ /g, ''), 'hex'), - a: Buffer.from(('00' + - 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' + - 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE' + - 'FFFFFFFF 00000000 00000000 FFFFFFFC'). - replace(/ /g, ''), 'hex'), - b: Buffer.from(( - 'b3312fa7 e23ee7e4 988e056b e3f82d19' + - '181d9c6e fe814112 0314088f 5013875a' + - 'c656398d 8a2ed19d 2a85c8ed d3ec2aef'). - replace(/ /g, ''), 'hex'), - s: Buffer.from(('00' + - 'a335926a a319a27a 1d00896a 6773a482' + - '7acdac73'). - replace(/ /g, ''), 'hex'), - n: Buffer.from(('00' + - 'ffffffff ffffffff ffffffff ffffffff' + - 'ffffffff ffffffff c7634d81 f4372ddf' + - '581a0db2 48b0a77a ecec196a ccc52973'). - replace(/ /g, ''), 'hex'), - G: Buffer.from(('04' + - 'aa87ca22 be8b0537 8eb1c71e f320ad74' + - '6e1d3b62 8ba79b98 59f741e0 82542a38' + - '5502f25d bf55296c 3a545e38 72760ab7' + - '3617de4a 96262c6f 5d9e98bf 9292dc29' + - 'f8f41dbd 289a147c e9da3113 b5f0b8c0' + - '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'). - replace(/ /g, ''), 'hex') - }, - 'nistp521': { - size: 521, - pkcs8oid: '1.3.132.0.35', - p: Buffer.from(( - '01ffffff ffffffff ffffffff ffffffff' + - 'ffffffff ffffffff ffffffff ffffffff' + - 'ffffffff ffffffff ffffffff ffffffff' + - 'ffffffff ffffffff ffffffff ffffffff' + - 'ffff').replace(/ /g, ''), 'hex'), - a: Buffer.from(('01FF' + - 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' + - 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' + - 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' + - 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFC'). - replace(/ /g, ''), 'hex'), - b: Buffer.from(('51' + - '953eb961 8e1c9a1f 929a21a0 b68540ee' + - 'a2da725b 99b315f3 b8b48991 8ef109e1' + - '56193951 ec7e937b 1652c0bd 3bb1bf07' + - '3573df88 3d2c34f1 ef451fd4 6b503f00'). - replace(/ /g, ''), 'hex'), - s: Buffer.from(('00' + - 'd09e8800 291cb853 96cc6717 393284aa' + - 'a0da64ba').replace(/ /g, ''), 'hex'), - n: Buffer.from(('01ff' + - 'ffffffff ffffffff ffffffff ffffffff' + - 'ffffffff ffffffff ffffffff fffffffa' + - '51868783 bf2f966b 7fcc0148 f709a5d0' + - '3bb5c9b8 899c47ae bb6fb71e 91386409'). - replace(/ /g, ''), 'hex'), - G: Buffer.from(('04' + - '00c6 858e06b7 0404e9cd 9e3ecb66 2395b442' + - '9c648139 053fb521 f828af60 6b4d3dba' + - 'a14b5e77 efe75928 fe1dc127 a2ffa8de' + - '3348b3c1 856a429b f97e7e31 c2e5bd66' + - '0118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9' + - '98f54449 579b4468 17afbd17 273e662c' + - '97ee7299 5ef42640 c550b901 3fad0761' + - '353c7086 a272c240 88be9476 9fd16650'). - replace(/ /g, ''), 'hex') - } -}; - -module.exports = { - info: algInfo, - privInfo: algPrivInfo, - hashAlgs: hashAlgs, - curves: curves -}; - - -/***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { - -// Copyright 2017 Joyent, Inc. - -module.exports = PrivateKey; - -var assert = __webpack_require__(16); -var Buffer = __webpack_require__(15).Buffer; -var algs = __webpack_require__(32); -var crypto = __webpack_require__(11); -var Fingerprint = __webpack_require__(157); -var Signature = __webpack_require__(75); -var errs = __webpack_require__(74); -var util = __webpack_require__(3); -var utils = __webpack_require__(26); -var dhe = __webpack_require__(326); -var generateECDSA = dhe.generateECDSA; -var generateED25519 = dhe.generateED25519; -var edCompat; -var nacl; - -try { - edCompat = __webpack_require__(454); -} catch (e) { - /* Just continue through, and bail out if we try to use it. */ -} - -var Key = __webpack_require__(28); - -var InvalidAlgorithmError = errs.InvalidAlgorithmError; -var KeyParseError = errs.KeyParseError; -var KeyEncryptedError = errs.KeyEncryptedError; - -var formats = {}; -formats['auto'] = __webpack_require__(455); -formats['pem'] = __webpack_require__(86); -formats['pkcs1'] = __webpack_require__(328); -formats['pkcs8'] = __webpack_require__(158); -formats['rfc4253'] = __webpack_require__(103); -formats['ssh-private'] = __webpack_require__(193); -formats['openssh'] = formats['ssh-private']; -formats['ssh'] = formats['ssh-private']; -formats['dnssec'] = __webpack_require__(327); - -function PrivateKey(opts) { - assert.object(opts, 'options'); - Key.call(this, opts); - - this._pubCache = undefined; -} -util.inherits(PrivateKey, Key); - -PrivateKey.formats = formats; - -PrivateKey.prototype.toBuffer = function (format, options) { - if (format === undefined) - format = 'pkcs1'; - assert.string(format, 'format'); - assert.object(formats[format], 'formats[format]'); - assert.optionalObject(options, 'options'); - - return (formats[format].write(this, options)); -}; - -PrivateKey.prototype.hash = function (algo) { - return (this.toPublic().hash(algo)); -}; - -PrivateKey.prototype.toPublic = function () { - if (this._pubCache) - return (this._pubCache); - - var algInfo = algs.info[this.type]; - var pubParts = []; - for (var i = 0; i < algInfo.parts.length; ++i) { - var p = algInfo.parts[i]; - pubParts.push(this.part[p]); - } - - this._pubCache = new Key({ - type: this.type, - source: this, - parts: pubParts - }); - if (this.comment) - this._pubCache.comment = this.comment; - return (this._pubCache); -}; - -PrivateKey.prototype.derive = function (newType) { - assert.string(newType, 'type'); - var priv, pub, pair; - - if (this.type === 'ed25519' && newType === 'curve25519') { - if (nacl === undefined) - nacl = __webpack_require__(76); - - priv = this.part.k.data; - if (priv[0] === 0x00) - priv = priv.slice(1); - - pair = nacl.box.keyPair.fromSecretKey(new Uint8Array(priv)); - pub = Buffer.from(pair.publicKey); - - return (new PrivateKey({ - type: 'curve25519', - parts: [ - { name: 'A', data: utils.mpNormalize(pub) }, - { name: 'k', data: utils.mpNormalize(priv) } - ] - })); - } else if (this.type === 'curve25519' && newType === 'ed25519') { - if (nacl === undefined) - nacl = __webpack_require__(76); - - priv = this.part.k.data; - if (priv[0] === 0x00) - priv = priv.slice(1); - - pair = nacl.sign.keyPair.fromSeed(new Uint8Array(priv)); - pub = Buffer.from(pair.publicKey); - - return (new PrivateKey({ - type: 'ed25519', - parts: [ - { name: 'A', data: utils.mpNormalize(pub) }, - { name: 'k', data: utils.mpNormalize(priv) } - ] - })); - } - throw (new Error('Key derivation not supported from ' + this.type + - ' to ' + newType)); -}; - -PrivateKey.prototype.createVerify = function (hashAlgo) { - return (this.toPublic().createVerify(hashAlgo)); -}; - -PrivateKey.prototype.createSign = function (hashAlgo) { - if (hashAlgo === undefined) - hashAlgo = this.defaultHashAlgorithm(); - assert.string(hashAlgo, 'hash algorithm'); - - /* ED25519 is not supported by OpenSSL, use a javascript impl. */ - if (this.type === 'ed25519' && edCompat !== undefined) - return (new edCompat.Signer(this, hashAlgo)); - if (this.type === 'curve25519') - throw (new Error('Curve25519 keys are not suitable for ' + - 'signing or verification')); - - var v, nm, err; - try { - nm = hashAlgo.toUpperCase(); - v = crypto.createSign(nm); - } catch (e) { - err = e; - } - if (v === undefined || (err instanceof Error && - err.message.match(/Unknown message digest/))) { - nm = 'RSA-'; - nm += hashAlgo.toUpperCase(); - v = crypto.createSign(nm); - } - assert.ok(v, 'failed to create verifier'); - var oldSign = v.sign.bind(v); - var key = this.toBuffer('pkcs1'); - var type = this.type; - var curve = this.curve; - v.sign = function () { - var sig = oldSign(key); - if (typeof (sig) === 'string') - sig = Buffer.from(sig, 'binary'); - sig = Signature.parse(sig, type, 'asn1'); - sig.hashAlgorithm = hashAlgo; - sig.curve = curve; - return (sig); - }; - return (v); -}; - -PrivateKey.parse = function (data, format, options) { - if (typeof (data) !== 'string') - assert.buffer(data, 'data'); - if (format === undefined) - format = 'auto'; - assert.string(format, 'format'); - if (typeof (options) === 'string') - options = { filename: options }; - assert.optionalObject(options, 'options'); - if (options === undefined) - options = {}; - assert.optionalString(options.filename, 'options.filename'); - if (options.filename === undefined) - options.filename = '(unnamed)'; - - assert.object(formats[format], 'formats[format]'); - - try { - var k = formats[format].read(data, options); - assert.ok(k instanceof PrivateKey, 'key is not a private key'); - if (!k.comment) - k.comment = options.filename; - return (k); - } catch (e) { - if (e.name === 'KeyEncryptedError') - throw (e); - throw (new KeyParseError(options.filename, format, e)); - } -}; - -PrivateKey.isPrivateKey = function (obj, ver) { - return (utils.isCompatible(obj, PrivateKey, ver)); -}; - -PrivateKey.generate = function (type, options) { - if (options === undefined) - options = {}; - assert.object(options, 'options'); - - switch (type) { - case 'ecdsa': - if (options.curve === undefined) - options.curve = 'nistp256'; - assert.string(options.curve, 'options.curve'); - return (generateECDSA(options.curve)); - case 'ed25519': - return (generateED25519()); - default: - throw (new Error('Key generation not supported with key ' + - 'type "' + type + '"')); - } -}; - -/* - * API versions for PrivateKey: - * [1,0] -- initial ver - * [1,1] -- added auto, pkcs[18], openssh/ssh-private formats - * [1,2] -- added defaultHashAlgorithm - * [1,3] -- added derive, ed, createDH - * [1,4] -- first tagged version - * [1,5] -- changed ed25519 part names and format - */ -PrivateKey.prototype._sshpkApiVersion = [1, 5]; - -PrivateKey._oldVersionDetect = function (obj) { - assert.func(obj.toPublic); - assert.func(obj.createSign); - if (obj.derive) - return ([1, 3]); - if (obj.defaultHashAlgorithm) - return ([1, 2]); - if (obj.formats['auto']) - return ([1, 1]); - return ([1, 0]); -}; - - -/***/ }), -/* 34 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.wrapLifecycle = exports.run = exports.install = exports.Install = undefined; - -var _extends2; - -function _load_extends() { - return _extends2 = _interopRequireDefault(__webpack_require__(20)); -} - -var _asyncToGenerator2; - -function _load_asyncToGenerator() { - return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); -} - -let install = exports.install = (() => { - var _ref29 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, lockfile) { - yield wrapLifecycle(config, flags, (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const install = new Install(flags, config, reporter, lockfile); - yield install.init(); - })); - }); - - return function install(_x7, _x8, _x9, _x10) { - return _ref29.apply(this, arguments); - }; -})(); - -let run = exports.run = (() => { - var _ref31 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { - let lockfile; - let error = 'installCommandRenamed'; - if (flags.lockfile === false) { - lockfile = new (_lockfile || _load_lockfile()).default(); - } else { - lockfile = yield (_lockfile || _load_lockfile()).default.fromDirectory(config.lockfileFolder, reporter); - } - - if (args.length) { - const exampleArgs = args.slice(); - - if (flags.saveDev) { - exampleArgs.push('--dev'); - } - if (flags.savePeer) { - exampleArgs.push('--peer'); - } - if (flags.saveOptional) { - exampleArgs.push('--optional'); - } - if (flags.saveExact) { - exampleArgs.push('--exact'); - } - if (flags.saveTilde) { - exampleArgs.push('--tilde'); - } - let command = 'add'; - if (flags.global) { - error = 'globalFlagRemoved'; - command = 'global add'; - } - throw new (_errors || _load_errors()).MessageError(reporter.lang(error, `yarn ${command} ${exampleArgs.join(' ')}`)); - } - - yield install(config, reporter, flags, lockfile); - }); - - return function run(_x11, _x12, _x13, _x14) { - return _ref31.apply(this, arguments); - }; -})(); - -let wrapLifecycle = exports.wrapLifecycle = (() => { - var _ref32 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, flags, factory) { - yield config.executeLifecycleScript('preinstall'); - - yield factory(); - - // npm behaviour, seems kinda funky but yay compatibility - yield config.executeLifecycleScript('install'); - yield config.executeLifecycleScript('postinstall'); - - if (!config.production) { - if (!config.disablePrepublish) { - yield config.executeLifecycleScript('prepublish'); - } - yield config.executeLifecycleScript('prepare'); - } - }); - - return function wrapLifecycle(_x15, _x16, _x17) { - return _ref32.apply(this, arguments); - }; -})(); - -exports.hasWrapper = hasWrapper; -exports.setFlags = setFlags; - -var _objectPath; - -function _load_objectPath() { - return _objectPath = _interopRequireDefault(__webpack_require__(304)); -} - -var _hooks; - -function _load_hooks() { - return _hooks = __webpack_require__(368); -} - -var _index; - -function _load_index() { - return _index = _interopRequireDefault(__webpack_require__(218)); -} - -var _errors; - -function _load_errors() { - return _errors = __webpack_require__(6); -} - -var _integrityChecker; - -function _load_integrityChecker() { - return _integrityChecker = _interopRequireDefault(__webpack_require__(206)); -} - -var _lockfile; - -function _load_lockfile() { - return _lockfile = _interopRequireDefault(__webpack_require__(19)); -} - -var _lockfile2; - -function _load_lockfile2() { - return _lockfile2 = __webpack_require__(19); -} - -var _packageFetcher; - -function _load_packageFetcher() { - return _packageFetcher = _interopRequireWildcard(__webpack_require__(208)); -} - -var _packageInstallScripts; - -function _load_packageInstallScripts() { - return _packageInstallScripts = _interopRequireDefault(__webpack_require__(525)); -} - -var _packageCompatibility; - -function _load_packageCompatibility() { - return _packageCompatibility = _interopRequireWildcard(__webpack_require__(207)); -} - -var _packageResolver; - -function _load_packageResolver() { - return _packageResolver = _interopRequireDefault(__webpack_require__(360)); -} - -var _packageLinker; - -function _load_packageLinker() { - return _packageLinker = _interopRequireDefault(__webpack_require__(209)); -} - -var _index2; - -function _load_index2() { - return _index2 = __webpack_require__(58); -} - -var _index3; - -function _load_index3() { - return _index3 = __webpack_require__(78); -} - -var _autoclean; - -function _load_autoclean() { - return _autoclean = __webpack_require__(348); -} - -var _constants; - -function _load_constants() { - return _constants = _interopRequireWildcard(__webpack_require__(8)); -} - -var _normalizePattern; - -function _load_normalizePattern() { - return _normalizePattern = __webpack_require__(37); -} - -var _fs; - -function _load_fs() { - return _fs = _interopRequireWildcard(__webpack_require__(5)); -} - -var _map; - -function _load_map() { - return _map = _interopRequireDefault(__webpack_require__(30)); -} - -var _yarnVersion; - -function _load_yarnVersion() { - return _yarnVersion = __webpack_require__(105); -} - -var _generatePnpMap; - -function _load_generatePnpMap() { - return _generatePnpMap = __webpack_require__(547); -} - -var _workspaceLayout; - -function _load_workspaceLayout() { - return _workspaceLayout = _interopRequireDefault(__webpack_require__(90)); -} - -var _resolutionMap; - -function _load_resolutionMap() { - return _resolutionMap = _interopRequireDefault(__webpack_require__(212)); -} - -var _guessName; - -function _load_guessName() { - return _guessName = _interopRequireDefault(__webpack_require__(169)); -} - -var _audit; - -function _load_audit() { - return _audit = _interopRequireDefault(__webpack_require__(347)); -} - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const deepEqual = __webpack_require__(599); - -const emoji = __webpack_require__(302); -const invariant = __webpack_require__(9); -const path = __webpack_require__(0); -const semver = __webpack_require__(22); -const uuid = __webpack_require__(120); -const ssri = __webpack_require__(65); - -const ONE_DAY = 1000 * 60 * 60 * 24; - -/** - * Try and detect the installation method for Yarn and provide a command to update it with. - */ - -function getUpdateCommand(installationMethod) { - if (installationMethod === 'tar') { - return `curl --compressed -o- -L ${(_constants || _load_constants()).YARN_INSTALLER_SH} | bash`; - } - - if (installationMethod === 'homebrew') { - return 'brew upgrade yarn'; - } - - if (installationMethod === 'deb') { - return 'sudo apt-get update && sudo apt-get install yarn'; - } - - if (installationMethod === 'rpm') { - return 'sudo yum install yarn'; - } - - if (installationMethod === 'npm') { - return 'npm install --global yarn'; - } - - if (installationMethod === 'chocolatey') { - return 'choco upgrade yarn'; - } - - if (installationMethod === 'apk') { - return 'apk update && apk add -u yarn'; - } - - if (installationMethod === 'portage') { - return 'sudo emerge --sync && sudo emerge -au sys-apps/yarn'; - } - - return null; -} - -function getUpdateInstaller(installationMethod) { - // Windows - if (installationMethod === 'msi') { - return (_constants || _load_constants()).YARN_INSTALLER_MSI; - } - - return null; -} - -function normalizeFlags(config, rawFlags) { - const flags = { - // install - har: !!rawFlags.har, - ignorePlatform: !!rawFlags.ignorePlatform, - ignoreEngines: !!rawFlags.ignoreEngines, - ignoreScripts: !!rawFlags.ignoreScripts, - ignoreOptional: !!rawFlags.ignoreOptional, - force: !!rawFlags.force, - flat: !!rawFlags.flat, - lockfile: rawFlags.lockfile !== false, - pureLockfile: !!rawFlags.pureLockfile, - updateChecksums: !!rawFlags.updateChecksums, - skipIntegrityCheck: !!rawFlags.skipIntegrityCheck, - frozenLockfile: !!rawFlags.frozenLockfile, - linkDuplicates: !!rawFlags.linkDuplicates, - checkFiles: !!rawFlags.checkFiles, - audit: !!rawFlags.audit, - - // add - peer: !!rawFlags.peer, - dev: !!rawFlags.dev, - optional: !!rawFlags.optional, - exact: !!rawFlags.exact, - tilde: !!rawFlags.tilde, - ignoreWorkspaceRootCheck: !!rawFlags.ignoreWorkspaceRootCheck, - - // outdated, update-interactive - includeWorkspaceDeps: !!rawFlags.includeWorkspaceDeps, - - // add, remove, update - workspaceRootIsCwd: rawFlags.workspaceRootIsCwd !== false - }; - - if (config.getOption('ignore-scripts')) { - flags.ignoreScripts = true; - } - - if (config.getOption('ignore-platform')) { - flags.ignorePlatform = true; - } - - if (config.getOption('ignore-engines')) { - flags.ignoreEngines = true; - } - - if (config.getOption('ignore-optional')) { - flags.ignoreOptional = true; - } - - if (config.getOption('force')) { - flags.force = true; - } - - return flags; -} - -class Install { - constructor(flags, config, reporter, lockfile) { - this.rootManifestRegistries = []; - this.rootPatternsToOrigin = (0, (_map || _load_map()).default)(); - this.lockfile = lockfile; - this.reporter = reporter; - this.config = config; - this.flags = normalizeFlags(config, flags); - this.resolutions = (0, (_map || _load_map()).default)(); // Legacy resolutions field used for flat install mode - this.resolutionMap = new (_resolutionMap || _load_resolutionMap()).default(config); // Selective resolutions for nested dependencies - this.resolver = new (_packageResolver || _load_packageResolver()).default(config, lockfile, this.resolutionMap); - this.integrityChecker = new (_integrityChecker || _load_integrityChecker()).default(config); - this.linker = new (_packageLinker || _load_packageLinker()).default(config, this.resolver); - this.scripts = new (_packageInstallScripts || _load_packageInstallScripts()).default(config, this.resolver, this.flags.force); - } - - /** - * Create a list of dependency requests from the current directories manifests. - */ - - fetchRequestFromCwd(excludePatterns = [], ignoreUnusedPatterns = false) { - var _this = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const patterns = []; - const deps = []; - let resolutionDeps = []; - const manifest = {}; - - const ignorePatterns = []; - const usedPatterns = []; - let workspaceLayout; - - // some commands should always run in the context of the entire workspace - const cwd = _this.flags.includeWorkspaceDeps || _this.flags.workspaceRootIsCwd ? _this.config.lockfileFolder : _this.config.cwd; - - // non-workspaces are always root, otherwise check for workspace root - const cwdIsRoot = !_this.config.workspaceRootFolder || _this.config.lockfileFolder === cwd; - - // exclude package names that are in install args - const excludeNames = []; - for (var _iterator = excludePatterns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - const pattern = _ref; - - if ((0, (_index3 || _load_index3()).getExoticResolver)(pattern)) { - excludeNames.push((0, (_guessName || _load_guessName()).default)(pattern)); - } else { - // extract the name - const parts = (0, (_normalizePattern || _load_normalizePattern()).normalizePattern)(pattern); - excludeNames.push(parts.name); - } - } - - const stripExcluded = function stripExcluded(manifest) { - for (var _iterator2 = excludeNames, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { - var _ref2; - - if (_isArray2) { - if (_i2 >= _iterator2.length) break; - _ref2 = _iterator2[_i2++]; - } else { - _i2 = _iterator2.next(); - if (_i2.done) break; - _ref2 = _i2.value; - } - - const exclude = _ref2; - - if (manifest.dependencies && manifest.dependencies[exclude]) { - delete manifest.dependencies[exclude]; - } - if (manifest.devDependencies && manifest.devDependencies[exclude]) { - delete manifest.devDependencies[exclude]; - } - if (manifest.optionalDependencies && manifest.optionalDependencies[exclude]) { - delete manifest.optionalDependencies[exclude]; - } - } - }; - - for (var _iterator3 = Object.keys((_index2 || _load_index2()).registries), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { - var _ref3; - - if (_isArray3) { - if (_i3 >= _iterator3.length) break; - _ref3 = _iterator3[_i3++]; - } else { - _i3 = _iterator3.next(); - if (_i3.done) break; - _ref3 = _i3.value; - } - - const registry = _ref3; - - const filename = (_index2 || _load_index2()).registries[registry].filename; - - const loc = path.join(cwd, filename); - if (!(yield (_fs || _load_fs()).exists(loc))) { - continue; - } - - _this.rootManifestRegistries.push(registry); - - const projectManifestJson = yield _this.config.readJson(loc); - yield (0, (_index || _load_index()).default)(projectManifestJson, cwd, _this.config, cwdIsRoot); - - Object.assign(_this.resolutions, projectManifestJson.resolutions); - Object.assign(manifest, projectManifestJson); - - _this.resolutionMap.init(_this.resolutions); - for (var _iterator4 = Object.keys(_this.resolutionMap.resolutionsByPackage), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { - var _ref4; - - if (_isArray4) { - if (_i4 >= _iterator4.length) break; - _ref4 = _iterator4[_i4++]; - } else { - _i4 = _iterator4.next(); - if (_i4.done) break; - _ref4 = _i4.value; - } - - const packageName = _ref4; - - const optional = (_objectPath || _load_objectPath()).default.has(manifest.optionalDependencies, packageName) && _this.flags.ignoreOptional; - for (var _iterator8 = _this.resolutionMap.resolutionsByPackage[packageName], _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator]();;) { - var _ref9; - - if (_isArray8) { - if (_i8 >= _iterator8.length) break; - _ref9 = _iterator8[_i8++]; - } else { - _i8 = _iterator8.next(); - if (_i8.done) break; - _ref9 = _i8.value; - } - - const _ref8 = _ref9; - const pattern = _ref8.pattern; - - resolutionDeps = [...resolutionDeps, { registry, pattern, optional, hint: 'resolution' }]; - } - } - - const pushDeps = function pushDeps(depType, manifest, { hint, optional }, isUsed) { - if (ignoreUnusedPatterns && !isUsed) { - return; - } - // We only take unused dependencies into consideration to get deterministic hoisting. - // Since flat mode doesn't care about hoisting and everything is top level and specified then we can safely - // leave these out. - if (_this.flags.flat && !isUsed) { - return; - } - const depMap = manifest[depType]; - for (const name in depMap) { - if (excludeNames.indexOf(name) >= 0) { - continue; - } - - let pattern = name; - if (!_this.lockfile.getLocked(pattern)) { - // when we use --save we save the dependency to the lockfile with just the name rather than the - // version combo - pattern += '@' + depMap[name]; - } - - // normalization made sure packages are mentioned only once - if (isUsed) { - usedPatterns.push(pattern); - } else { - ignorePatterns.push(pattern); - } - - _this.rootPatternsToOrigin[pattern] = depType; - patterns.push(pattern); - deps.push({ pattern, registry, hint, optional, workspaceName: manifest.name, workspaceLoc: manifest._loc }); - } - }; - - if (cwdIsRoot) { - pushDeps('dependencies', projectManifestJson, { hint: null, optional: false }, true); - pushDeps('devDependencies', projectManifestJson, { hint: 'dev', optional: false }, !_this.config.production); - pushDeps('optionalDependencies', projectManifestJson, { hint: 'optional', optional: true }, true); - } - - if (_this.config.workspaceRootFolder) { - const workspaceLoc = cwdIsRoot ? loc : path.join(_this.config.lockfileFolder, filename); - const workspacesRoot = path.dirname(workspaceLoc); - - let workspaceManifestJson = projectManifestJson; - if (!cwdIsRoot) { - // the manifest we read before was a child workspace, so get the root - workspaceManifestJson = yield _this.config.readJson(workspaceLoc); - yield (0, (_index || _load_index()).default)(workspaceManifestJson, workspacesRoot, _this.config, true); - } - - const workspaces = yield _this.config.resolveWorkspaces(workspacesRoot, workspaceManifestJson); - workspaceLayout = new (_workspaceLayout || _load_workspaceLayout()).default(workspaces, _this.config); - - // add virtual manifest that depends on all workspaces, this way package hoisters and resolvers will work fine - const workspaceDependencies = (0, (_extends2 || _load_extends()).default)({}, workspaceManifestJson.dependencies); - for (var _iterator5 = Object.keys(workspaces), _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { - var _ref5; - - if (_isArray5) { - if (_i5 >= _iterator5.length) break; - _ref5 = _iterator5[_i5++]; - } else { - _i5 = _iterator5.next(); - if (_i5.done) break; - _ref5 = _i5.value; - } - - const workspaceName = _ref5; - - const workspaceManifest = workspaces[workspaceName].manifest; - workspaceDependencies[workspaceName] = workspaceManifest.version; - - // include dependencies from all workspaces - if (_this.flags.includeWorkspaceDeps) { - pushDeps('dependencies', workspaceManifest, { hint: null, optional: false }, true); - pushDeps('devDependencies', workspaceManifest, { hint: 'dev', optional: false }, !_this.config.production); - pushDeps('optionalDependencies', workspaceManifest, { hint: 'optional', optional: true }, true); - } - } - const virtualDependencyManifest = { - _uid: '', - name: `workspace-aggregator-${uuid.v4()}`, - version: '1.0.0', - _registry: 'npm', - _loc: workspacesRoot, - dependencies: workspaceDependencies, - devDependencies: (0, (_extends2 || _load_extends()).default)({}, workspaceManifestJson.devDependencies), - optionalDependencies: (0, (_extends2 || _load_extends()).default)({}, workspaceManifestJson.optionalDependencies), - private: workspaceManifestJson.private, - workspaces: workspaceManifestJson.workspaces - }; - workspaceLayout.virtualManifestName = virtualDependencyManifest.name; - const virtualDep = {}; - virtualDep[virtualDependencyManifest.name] = virtualDependencyManifest.version; - workspaces[virtualDependencyManifest.name] = { loc: workspacesRoot, manifest: virtualDependencyManifest }; - - // ensure dependencies that should be excluded are stripped from the correct manifest - stripExcluded(cwdIsRoot ? virtualDependencyManifest : workspaces[projectManifestJson.name].manifest); - - pushDeps('workspaces', { workspaces: virtualDep }, { hint: 'workspaces', optional: false }, true); - - const implicitWorkspaceDependencies = (0, (_extends2 || _load_extends()).default)({}, workspaceDependencies); - - for (var _iterator6 = (_constants || _load_constants()).OWNED_DEPENDENCY_TYPES, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) { - var _ref6; - - if (_isArray6) { - if (_i6 >= _iterator6.length) break; - _ref6 = _iterator6[_i6++]; - } else { - _i6 = _iterator6.next(); - if (_i6.done) break; - _ref6 = _i6.value; - } - - const type = _ref6; - - for (var _iterator7 = Object.keys(projectManifestJson[type] || {}), _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) { - var _ref7; - - if (_isArray7) { - if (_i7 >= _iterator7.length) break; - _ref7 = _iterator7[_i7++]; - } else { - _i7 = _iterator7.next(); - if (_i7.done) break; - _ref7 = _i7.value; - } - - const dependencyName = _ref7; - - delete implicitWorkspaceDependencies[dependencyName]; - } - } - - pushDeps('dependencies', { dependencies: implicitWorkspaceDependencies }, { hint: 'workspaces', optional: false }, true); - } - - break; - } - - // inherit root flat flag - if (manifest.flat) { - _this.flags.flat = true; - } - - return { - requests: [...resolutionDeps, ...deps], - patterns, - manifest, - usedPatterns, - ignorePatterns, - workspaceLayout - }; - })(); - } - - /** - * TODO description - */ - - prepareRequests(requests) { - return requests; - } - - preparePatterns(patterns) { - return patterns; - } - preparePatternsForLinking(patterns, cwdManifest, cwdIsRoot) { - return patterns; - } - - prepareManifests() { - var _this2 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const manifests = yield _this2.config.getRootManifests(); - return manifests; - })(); - } - - bailout(patterns, workspaceLayout) { - var _this3 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - // We don't want to skip the audit - it could yield important errors - if (_this3.flags.audit) { - return false; - } - // PNP is so fast that the integrity check isn't pertinent - if (_this3.config.plugnplayEnabled) { - return false; - } - if (_this3.flags.skipIntegrityCheck || _this3.flags.force) { - return false; - } - const lockfileCache = _this3.lockfile.cache; - if (!lockfileCache) { - return false; - } - const lockfileClean = _this3.lockfile.parseResultType === 'success'; - const match = yield _this3.integrityChecker.check(patterns, lockfileCache, _this3.flags, workspaceLayout); - if (_this3.flags.frozenLockfile && (!lockfileClean || match.missingPatterns.length > 0)) { - throw new (_errors || _load_errors()).MessageError(_this3.reporter.lang('frozenLockfileError')); - } - - const haveLockfile = yield (_fs || _load_fs()).exists(path.join(_this3.config.lockfileFolder, (_constants || _load_constants()).LOCKFILE_FILENAME)); - - const lockfileIntegrityPresent = !_this3.lockfile.hasEntriesExistWithoutIntegrity(); - const integrityBailout = lockfileIntegrityPresent || !_this3.config.autoAddIntegrity; - - if (match.integrityMatches && haveLockfile && lockfileClean && integrityBailout) { - _this3.reporter.success(_this3.reporter.lang('upToDate')); - return true; - } - - if (match.integrityFileMissing && haveLockfile) { - // Integrity file missing, force script installations - _this3.scripts.setForce(true); - return false; - } - - if (match.hardRefreshRequired) { - // e.g. node version doesn't match, force script installations - _this3.scripts.setForce(true); - return false; - } - - if (!patterns.length && !match.integrityFileMissing) { - _this3.reporter.success(_this3.reporter.lang('nothingToInstall')); - yield _this3.createEmptyManifestFolders(); - yield _this3.saveLockfileAndIntegrity(patterns, workspaceLayout); - return true; - } - - return false; - })(); - } - - /** - * Produce empty folders for all used root manifests. - */ - - createEmptyManifestFolders() { - var _this4 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (_this4.config.modulesFolder) { - // already created - return; - } - - for (var _iterator9 = _this4.rootManifestRegistries, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator]();;) { - var _ref10; - - if (_isArray9) { - if (_i9 >= _iterator9.length) break; - _ref10 = _iterator9[_i9++]; - } else { - _i9 = _iterator9.next(); - if (_i9.done) break; - _ref10 = _i9.value; - } - - const registryName = _ref10; - const folder = _this4.config.registries[registryName].folder; - - yield (_fs || _load_fs()).mkdirp(path.join(_this4.config.lockfileFolder, folder)); - } - })(); - } - - /** - * TODO description - */ - - markIgnored(patterns) { - for (var _iterator10 = patterns, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : _iterator10[Symbol.iterator]();;) { - var _ref11; - - if (_isArray10) { - if (_i10 >= _iterator10.length) break; - _ref11 = _iterator10[_i10++]; - } else { - _i10 = _iterator10.next(); - if (_i10.done) break; - _ref11 = _i10.value; - } - - const pattern = _ref11; - - const manifest = this.resolver.getStrictResolvedPattern(pattern); - const ref = manifest._reference; - invariant(ref, 'expected package reference'); - - // just mark the package as ignored. if the package is used by a required package, the hoister - // will take care of that. - ref.ignore = true; - } - } - - /** - * helper method that gets only recent manifests - * used by global.ls command - */ - getFlattenedDeps() { - var _this5 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - var _ref12 = yield _this5.fetchRequestFromCwd(); - - const depRequests = _ref12.requests, - rawPatterns = _ref12.patterns; - - - yield _this5.resolver.init(depRequests, {}); - - const manifests = yield (_packageFetcher || _load_packageFetcher()).fetch(_this5.resolver.getManifests(), _this5.config); - _this5.resolver.updateManifests(manifests); - - return _this5.flatten(rawPatterns); - })(); - } - - /** - * TODO description - */ - - init() { - var _this6 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - _this6.checkUpdate(); - - // warn if we have a shrinkwrap - if (yield (_fs || _load_fs()).exists(path.join(_this6.config.lockfileFolder, (_constants || _load_constants()).NPM_SHRINKWRAP_FILENAME))) { - _this6.reporter.warn(_this6.reporter.lang('shrinkwrapWarning')); - } - - // warn if we have an npm lockfile - if (yield (_fs || _load_fs()).exists(path.join(_this6.config.lockfileFolder, (_constants || _load_constants()).NPM_LOCK_FILENAME))) { - _this6.reporter.warn(_this6.reporter.lang('npmLockfileWarning')); - } - - if (_this6.config.plugnplayEnabled) { - _this6.reporter.info(_this6.reporter.lang('plugnplaySuggestV2L1')); - _this6.reporter.info(_this6.reporter.lang('plugnplaySuggestV2L2')); - } - - let flattenedTopLevelPatterns = []; - const steps = []; - - var _ref13 = yield _this6.fetchRequestFromCwd(); - - const depRequests = _ref13.requests, - rawPatterns = _ref13.patterns, - ignorePatterns = _ref13.ignorePatterns, - workspaceLayout = _ref13.workspaceLayout, - manifest = _ref13.manifest; - - let topLevelPatterns = []; - - const artifacts = yield _this6.integrityChecker.getArtifacts(); - if (artifacts) { - _this6.linker.setArtifacts(artifacts); - _this6.scripts.setArtifacts(artifacts); - } - - if ((_packageCompatibility || _load_packageCompatibility()).shouldCheck(manifest, _this6.flags)) { - steps.push((() => { - var _ref14 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { - _this6.reporter.step(curr, total, _this6.reporter.lang('checkingManifest'), emoji.get('mag')); - yield _this6.checkCompatibility(); - }); - - return function (_x, _x2) { - return _ref14.apply(this, arguments); - }; - })()); - } - - const audit = new (_audit || _load_audit()).default(_this6.config, _this6.reporter, { groups: (_constants || _load_constants()).OWNED_DEPENDENCY_TYPES }); - let auditFoundProblems = false; - - steps.push(function (curr, total) { - return (0, (_hooks || _load_hooks()).callThroughHook)('resolveStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - _this6.reporter.step(curr, total, _this6.reporter.lang('resolvingPackages'), emoji.get('mag')); - yield _this6.resolver.init(_this6.prepareRequests(depRequests), { - isFlat: _this6.flags.flat, - isFrozen: _this6.flags.frozenLockfile, - workspaceLayout - }); - topLevelPatterns = _this6.preparePatterns(rawPatterns); - flattenedTopLevelPatterns = yield _this6.flatten(topLevelPatterns); - return { bailout: !_this6.flags.audit && (yield _this6.bailout(topLevelPatterns, workspaceLayout)) }; - })); - }); - - if (_this6.flags.audit) { - steps.push(function (curr, total) { - return (0, (_hooks || _load_hooks()).callThroughHook)('auditStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - _this6.reporter.step(curr, total, _this6.reporter.lang('auditRunning'), emoji.get('mag')); - if (_this6.flags.offline) { - _this6.reporter.warn(_this6.reporter.lang('auditOffline')); - return { bailout: false }; - } - const preparedManifests = yield _this6.prepareManifests(); - // $FlowFixMe - Flow considers `m` in the map operation to be "mixed", so does not recognize `m.object` - const mergedManifest = Object.assign({}, ...Object.values(preparedManifests).map(function (m) { - return m.object; - })); - const auditVulnerabilityCounts = yield audit.performAudit(mergedManifest, _this6.lockfile, _this6.resolver, _this6.linker, topLevelPatterns); - auditFoundProblems = auditVulnerabilityCounts.info || auditVulnerabilityCounts.low || auditVulnerabilityCounts.moderate || auditVulnerabilityCounts.high || auditVulnerabilityCounts.critical; - return { bailout: yield _this6.bailout(topLevelPatterns, workspaceLayout) }; - })); - }); - } - - steps.push(function (curr, total) { - return (0, (_hooks || _load_hooks()).callThroughHook)('fetchStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - _this6.markIgnored(ignorePatterns); - _this6.reporter.step(curr, total, _this6.reporter.lang('fetchingPackages'), emoji.get('truck')); - const manifests = yield (_packageFetcher || _load_packageFetcher()).fetch(_this6.resolver.getManifests(), _this6.config); - _this6.resolver.updateManifests(manifests); - yield (_packageCompatibility || _load_packageCompatibility()).check(_this6.resolver.getManifests(), _this6.config, _this6.flags.ignoreEngines); - })); - }); - - steps.push(function (curr, total) { - return (0, (_hooks || _load_hooks()).callThroughHook)('linkStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - // remove integrity hash to make this operation atomic - yield _this6.integrityChecker.removeIntegrityFile(); - _this6.reporter.step(curr, total, _this6.reporter.lang('linkingDependencies'), emoji.get('link')); - flattenedTopLevelPatterns = _this6.preparePatternsForLinking(flattenedTopLevelPatterns, manifest, _this6.config.lockfileFolder === _this6.config.cwd); - yield _this6.linker.init(flattenedTopLevelPatterns, workspaceLayout, { - linkDuplicates: _this6.flags.linkDuplicates, - ignoreOptional: _this6.flags.ignoreOptional - }); - })); - }); - - if (_this6.config.plugnplayEnabled) { - steps.push(function (curr, total) { - return (0, (_hooks || _load_hooks()).callThroughHook)('pnpStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const pnpPath = `${_this6.config.lockfileFolder}/${(_constants || _load_constants()).PNP_FILENAME}`; - - const code = yield (0, (_generatePnpMap || _load_generatePnpMap()).generatePnpMap)(_this6.config, flattenedTopLevelPatterns, { - resolver: _this6.resolver, - reporter: _this6.reporter, - targetPath: pnpPath, - workspaceLayout - }); - - try { - const file = yield (_fs || _load_fs()).readFile(pnpPath); - if (file === code) { - return; - } - } catch (error) {} - - yield (_fs || _load_fs()).writeFile(pnpPath, code); - yield (_fs || _load_fs()).chmod(pnpPath, 0o755); - })); - }); - } - - steps.push(function (curr, total) { - return (0, (_hooks || _load_hooks()).callThroughHook)('buildStep', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - _this6.reporter.step(curr, total, _this6.flags.force ? _this6.reporter.lang('rebuildingPackages') : _this6.reporter.lang('buildingFreshPackages'), emoji.get('hammer')); - - if (_this6.config.ignoreScripts) { - _this6.reporter.warn(_this6.reporter.lang('ignoredScripts')); - } else { - yield _this6.scripts.init(flattenedTopLevelPatterns); - } - })); - }); - - if (_this6.flags.har) { - steps.push((() => { - var _ref21 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { - const formattedDate = new Date().toISOString().replace(/:/g, '-'); - const filename = `yarn-install_${formattedDate}.har`; - _this6.reporter.step(curr, total, _this6.reporter.lang('savingHar', filename), emoji.get('black_circle_for_record')); - yield _this6.config.requestManager.saveHar(filename); - }); - - return function (_x3, _x4) { - return _ref21.apply(this, arguments); - }; - })()); - } - - if (yield _this6.shouldClean()) { - steps.push((() => { - var _ref22 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { - _this6.reporter.step(curr, total, _this6.reporter.lang('cleaningModules'), emoji.get('recycle')); - yield (0, (_autoclean || _load_autoclean()).clean)(_this6.config, _this6.reporter); - }); - - return function (_x5, _x6) { - return _ref22.apply(this, arguments); - }; - })()); - } - - let currentStep = 0; - for (var _iterator11 = steps, _isArray11 = Array.isArray(_iterator11), _i11 = 0, _iterator11 = _isArray11 ? _iterator11 : _iterator11[Symbol.iterator]();;) { - var _ref23; - - if (_isArray11) { - if (_i11 >= _iterator11.length) break; - _ref23 = _iterator11[_i11++]; - } else { - _i11 = _iterator11.next(); - if (_i11.done) break; - _ref23 = _i11.value; - } - - const step = _ref23; - - const stepResult = yield step(++currentStep, steps.length); - if (stepResult && stepResult.bailout) { - if (_this6.flags.audit) { - audit.summary(); - } - if (auditFoundProblems) { - _this6.reporter.warn(_this6.reporter.lang('auditRunAuditForDetails')); - } - _this6.maybeOutputUpdate(); - return flattenedTopLevelPatterns; - } - } - - // fin! - if (_this6.flags.audit) { - audit.summary(); - } - if (auditFoundProblems) { - _this6.reporter.warn(_this6.reporter.lang('auditRunAuditForDetails')); - } - yield _this6.saveLockfileAndIntegrity(topLevelPatterns, workspaceLayout); - yield _this6.persistChanges(); - _this6.maybeOutputUpdate(); - _this6.config.requestManager.clearCache(); - return flattenedTopLevelPatterns; - })(); - } - - checkCompatibility() { - var _this7 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - var _ref24 = yield _this7.fetchRequestFromCwd(); - - const manifest = _ref24.manifest; - - yield (_packageCompatibility || _load_packageCompatibility()).checkOne(manifest, _this7.config, _this7.flags.ignoreEngines); - })(); - } - - persistChanges() { - var _this8 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - // get all the different registry manifests in this folder - const manifests = yield _this8.config.getRootManifests(); - - if (yield _this8.applyChanges(manifests)) { - yield _this8.config.saveRootManifests(manifests); - } - })(); - } - - applyChanges(manifests) { - let hasChanged = false; - - if (this.config.plugnplayPersist) { - const object = manifests.npm.object; - - - if (typeof object.installConfig !== 'object') { - object.installConfig = {}; - } - - if (this.config.plugnplayEnabled && object.installConfig.pnp !== true) { - object.installConfig.pnp = true; - hasChanged = true; - } else if (!this.config.plugnplayEnabled && typeof object.installConfig.pnp !== 'undefined') { - delete object.installConfig.pnp; - hasChanged = true; - } - - if (Object.keys(object.installConfig).length === 0) { - delete object.installConfig; - } - } - - return Promise.resolve(hasChanged); - } - - /** - * Check if we should run the cleaning step. - */ - - shouldClean() { - return (_fs || _load_fs()).exists(path.join(this.config.lockfileFolder, (_constants || _load_constants()).CLEAN_FILENAME)); - } - - /** - * TODO - */ - - flatten(patterns) { - var _this9 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (!_this9.flags.flat) { - return patterns; - } - - const flattenedPatterns = []; - - for (var _iterator12 = _this9.resolver.getAllDependencyNamesByLevelOrder(patterns), _isArray12 = Array.isArray(_iterator12), _i12 = 0, _iterator12 = _isArray12 ? _iterator12 : _iterator12[Symbol.iterator]();;) { - var _ref25; - - if (_isArray12) { - if (_i12 >= _iterator12.length) break; - _ref25 = _iterator12[_i12++]; - } else { - _i12 = _iterator12.next(); - if (_i12.done) break; - _ref25 = _i12.value; - } - - const name = _ref25; - - const infos = _this9.resolver.getAllInfoForPackageName(name).filter(function (manifest) { - const ref = manifest._reference; - invariant(ref, 'expected package reference'); - return !ref.ignore; - }); - - if (infos.length === 0) { - continue; - } - - if (infos.length === 1) { - // single version of this package - // take out a single pattern as multiple patterns may have resolved to this package - flattenedPatterns.push(_this9.resolver.patternsByPackage[name][0]); - continue; - } - - const options = infos.map(function (info) { - const ref = info._reference; - invariant(ref, 'expected reference'); - return { - // TODO `and is required by {PARENT}`, - name: _this9.reporter.lang('manualVersionResolutionOption', ref.patterns.join(', '), info.version), - - value: info.version - }; - }); - const versions = infos.map(function (info) { - return info.version; - }); - let version; - - const resolutionVersion = _this9.resolutions[name]; - if (resolutionVersion && versions.indexOf(resolutionVersion) >= 0) { - // use json `resolution` version - version = resolutionVersion; - } else { - version = yield _this9.reporter.select(_this9.reporter.lang('manualVersionResolution', name), _this9.reporter.lang('answer'), options); - _this9.resolutions[name] = version; - } - - flattenedPatterns.push(_this9.resolver.collapseAllVersionsOfPackage(name, version)); - } - - // save resolutions to their appropriate root manifest - if (Object.keys(_this9.resolutions).length) { - const manifests = yield _this9.config.getRootManifests(); - - for (const name in _this9.resolutions) { - const version = _this9.resolutions[name]; - - const patterns = _this9.resolver.patternsByPackage[name]; - if (!patterns) { - continue; - } - - let manifest; - for (var _iterator13 = patterns, _isArray13 = Array.isArray(_iterator13), _i13 = 0, _iterator13 = _isArray13 ? _iterator13 : _iterator13[Symbol.iterator]();;) { - var _ref26; - - if (_isArray13) { - if (_i13 >= _iterator13.length) break; - _ref26 = _iterator13[_i13++]; - } else { - _i13 = _iterator13.next(); - if (_i13.done) break; - _ref26 = _i13.value; - } - - const pattern = _ref26; - - manifest = _this9.resolver.getResolvedPattern(pattern); - if (manifest) { - break; - } - } - invariant(manifest, 'expected manifest'); - - const ref = manifest._reference; - invariant(ref, 'expected reference'); - - const object = manifests[ref.registry].object; - object.resolutions = object.resolutions || {}; - object.resolutions[name] = version; - } - - yield _this9.config.saveRootManifests(manifests); - } - - return flattenedPatterns; - })(); - } - - /** - * Remove offline tarballs that are no longer required - */ - - pruneOfflineMirror(lockfile) { - var _this10 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const mirror = _this10.config.getOfflineMirrorPath(); - if (!mirror) { - return; - } - - const requiredTarballs = new Set(); - for (const dependency in lockfile) { - const resolved = lockfile[dependency].resolved; - if (resolved) { - const basename = path.basename(resolved.split('#')[0]); - if (dependency[0] === '@' && basename[0] !== '@') { - requiredTarballs.add(`${dependency.split('/')[0]}-${basename}`); - } - requiredTarballs.add(basename); - } - } - - const mirrorFiles = yield (_fs || _load_fs()).walk(mirror); - for (var _iterator14 = mirrorFiles, _isArray14 = Array.isArray(_iterator14), _i14 = 0, _iterator14 = _isArray14 ? _iterator14 : _iterator14[Symbol.iterator]();;) { - var _ref27; - - if (_isArray14) { - if (_i14 >= _iterator14.length) break; - _ref27 = _iterator14[_i14++]; - } else { - _i14 = _iterator14.next(); - if (_i14.done) break; - _ref27 = _i14.value; - } - - const file = _ref27; - - const isTarball = path.extname(file.basename) === '.tgz'; - // if using experimental-pack-script-packages-in-mirror flag, don't unlink prebuilt packages - const hasPrebuiltPackage = file.relative.startsWith('prebuilt/'); - if (isTarball && !hasPrebuiltPackage && !requiredTarballs.has(file.basename)) { - yield (_fs || _load_fs()).unlink(file.absolute); - } - } - })(); - } - - /** - * Save updated integrity and lockfiles. - */ - - saveLockfileAndIntegrity(patterns, workspaceLayout) { - var _this11 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const resolvedPatterns = {}; - Object.keys(_this11.resolver.patterns).forEach(function (pattern) { - if (!workspaceLayout || !workspaceLayout.getManifestByPattern(pattern)) { - resolvedPatterns[pattern] = _this11.resolver.patterns[pattern]; - } - }); - - // TODO this code is duplicated in a few places, need a common way to filter out workspace patterns from lockfile - patterns = patterns.filter(function (p) { - return !workspaceLayout || !workspaceLayout.getManifestByPattern(p); - }); - - const lockfileBasedOnResolver = _this11.lockfile.getLockfile(resolvedPatterns); - - if (_this11.config.pruneOfflineMirror) { - yield _this11.pruneOfflineMirror(lockfileBasedOnResolver); - } - - // write integrity hash - if (!_this11.config.plugnplayEnabled) { - yield _this11.integrityChecker.save(patterns, lockfileBasedOnResolver, _this11.flags, workspaceLayout, _this11.scripts.getArtifacts()); - } - - // --no-lockfile or --pure-lockfile or --frozen-lockfile - if (_this11.flags.lockfile === false || _this11.flags.pureLockfile || _this11.flags.frozenLockfile) { - return; - } - - const lockFileHasAllPatterns = patterns.every(function (p) { - return _this11.lockfile.getLocked(p); - }); - const lockfilePatternsMatch = Object.keys(_this11.lockfile.cache || {}).every(function (p) { - return lockfileBasedOnResolver[p]; - }); - const resolverPatternsAreSameAsInLockfile = Object.keys(lockfileBasedOnResolver).every(function (pattern) { - const manifest = _this11.lockfile.getLocked(pattern); - return manifest && manifest.resolved === lockfileBasedOnResolver[pattern].resolved && deepEqual(manifest.prebuiltVariants, lockfileBasedOnResolver[pattern].prebuiltVariants); - }); - const integrityPatternsAreSameAsInLockfile = Object.keys(lockfileBasedOnResolver).every(function (pattern) { - const existingIntegrityInfo = lockfileBasedOnResolver[pattern].integrity; - if (!existingIntegrityInfo) { - // if this entry does not have an integrity, no need to re-write the lockfile because of it - return true; - } - const manifest = _this11.lockfile.getLocked(pattern); - if (manifest && manifest.integrity) { - const manifestIntegrity = ssri.stringify(manifest.integrity); - return manifestIntegrity === existingIntegrityInfo; - } - return false; - }); - - // remove command is followed by install with force, lockfile will be rewritten in any case then - if (!_this11.flags.force && _this11.lockfile.parseResultType === 'success' && lockFileHasAllPatterns && lockfilePatternsMatch && resolverPatternsAreSameAsInLockfile && integrityPatternsAreSameAsInLockfile && patterns.length) { - return; - } - - // build lockfile location - const loc = path.join(_this11.config.lockfileFolder, (_constants || _load_constants()).LOCKFILE_FILENAME); - - // write lockfile - const lockSource = (0, (_lockfile2 || _load_lockfile2()).stringify)(lockfileBasedOnResolver, false, _this11.config.enableLockfileVersions); - yield (_fs || _load_fs()).writeFilePreservingEol(loc, lockSource); - - _this11._logSuccessSaveLockfile(); - })(); - } - - _logSuccessSaveLockfile() { - this.reporter.success(this.reporter.lang('savedLockfile')); - } - - /** - * Load the dependency graph of the current install. Only does package resolving and wont write to the cwd. - */ - hydrate(ignoreUnusedPatterns) { - var _this12 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const request = yield _this12.fetchRequestFromCwd([], ignoreUnusedPatterns); - const depRequests = request.requests, - rawPatterns = request.patterns, - ignorePatterns = request.ignorePatterns, - workspaceLayout = request.workspaceLayout; - - - yield _this12.resolver.init(depRequests, { - isFlat: _this12.flags.flat, - isFrozen: _this12.flags.frozenLockfile, - workspaceLayout - }); - yield _this12.flatten(rawPatterns); - _this12.markIgnored(ignorePatterns); - - // fetch packages, should hit cache most of the time - const manifests = yield (_packageFetcher || _load_packageFetcher()).fetch(_this12.resolver.getManifests(), _this12.config); - _this12.resolver.updateManifests(manifests); - yield (_packageCompatibility || _load_packageCompatibility()).check(_this12.resolver.getManifests(), _this12.config, _this12.flags.ignoreEngines); - - // expand minimal manifests - for (var _iterator15 = _this12.resolver.getManifests(), _isArray15 = Array.isArray(_iterator15), _i15 = 0, _iterator15 = _isArray15 ? _iterator15 : _iterator15[Symbol.iterator]();;) { - var _ref28; - - if (_isArray15) { - if (_i15 >= _iterator15.length) break; - _ref28 = _iterator15[_i15++]; - } else { - _i15 = _iterator15.next(); - if (_i15.done) break; - _ref28 = _i15.value; - } - - const manifest = _ref28; - - const ref = manifest._reference; - invariant(ref, 'expected reference'); - const type = ref.remote.type; - // link specifier won't ever hit cache - - let loc = ''; - if (type === 'link') { - continue; - } else if (type === 'workspace') { - if (!ref.remote.reference) { - continue; - } - loc = ref.remote.reference; - } else { - loc = _this12.config.generateModuleCachePath(ref); - } - const newPkg = yield _this12.config.readManifest(loc); - yield _this12.resolver.updateManifest(ref, newPkg); - } - - return request; - })(); - } - - /** - * Check for updates every day and output a nag message if there's a newer version. - */ - - checkUpdate() { - if (this.config.nonInteractive) { - // don't show upgrade dialog on CI or non-TTY terminals - return; - } - - // don't check if disabled - if (this.config.getOption('disable-self-update-check')) { - return; - } - - // only check for updates once a day - const lastUpdateCheck = Number(this.config.getOption('lastUpdateCheck')) || 0; - if (lastUpdateCheck && Date.now() - lastUpdateCheck < ONE_DAY) { - return; - } - - // don't bug for updates on tagged releases - if ((_yarnVersion || _load_yarnVersion()).version.indexOf('-') >= 0) { - return; - } - - this._checkUpdate().catch(() => { - // swallow errors - }); - } - - _checkUpdate() { - var _this13 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - let latestVersion = yield _this13.config.requestManager.request({ - url: (_constants || _load_constants()).SELF_UPDATE_VERSION_URL - }); - invariant(typeof latestVersion === 'string', 'expected string'); - latestVersion = latestVersion.trim(); - if (!semver.valid(latestVersion)) { - return; - } - - // ensure we only check for updates periodically - _this13.config.registries.yarn.saveHomeConfig({ - lastUpdateCheck: Date.now() - }); - - if (semver.gt(latestVersion, (_yarnVersion || _load_yarnVersion()).version)) { - const installationMethod = yield (0, (_yarnVersion || _load_yarnVersion()).getInstallationMethod)(); - _this13.maybeOutputUpdate = function () { - _this13.reporter.warn(_this13.reporter.lang('yarnOutdated', latestVersion, (_yarnVersion || _load_yarnVersion()).version)); - - const command = getUpdateCommand(installationMethod); - if (command) { - _this13.reporter.info(_this13.reporter.lang('yarnOutdatedCommand')); - _this13.reporter.command(command); - } else { - const installer = getUpdateInstaller(installationMethod); - if (installer) { - _this13.reporter.info(_this13.reporter.lang('yarnOutdatedInstaller', installer)); - } - } - }; - } - })(); - } - - /** - * Method to override with a possible upgrade message. - */ - - maybeOutputUpdate() {} -} - -exports.Install = Install; -function hasWrapper(commander, args) { - return true; -} - -function setFlags(commander) { - commander.description('Yarn install is used to install all dependencies for a project.'); - commander.usage('install [flags]'); - commander.option('-A, --audit', 'Run vulnerability audit on installed packages'); - commander.option('-g, --global', 'DEPRECATED'); - commander.option('-S, --save', 'DEPRECATED - save package to your `dependencies`'); - commander.option('-D, --save-dev', 'DEPRECATED - save package to your `devDependencies`'); - commander.option('-P, --save-peer', 'DEPRECATED - save package to your `peerDependencies`'); - commander.option('-O, --save-optional', 'DEPRECATED - save package to your `optionalDependencies`'); - commander.option('-E, --save-exact', 'DEPRECATED'); - commander.option('-T, --save-tilde', 'DEPRECATED'); -} - -/***/ }), -/* 35 */ -/***/ (function(module, exports, __webpack_require__) { - -var isObject = __webpack_require__(53); -module.exports = function (it) { - if (!isObject(it)) throw TypeError(it + ' is not an object!'); - return it; -}; - - -/***/ }), -/* 36 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return SubjectSubscriber; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subject; }); -/* unused harmony export AnonymousSubject */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Observable__ = __webpack_require__(12); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscriber__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Subscription__ = __webpack_require__(25); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__ = __webpack_require__(190); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__SubjectSubscription__ = __webpack_require__(422); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__internal_symbol_rxSubscriber__ = __webpack_require__(322); -/** PURE_IMPORTS_START tslib,_Observable,_Subscriber,_Subscription,_util_ObjectUnsubscribedError,_SubjectSubscription,_internal_symbol_rxSubscriber PURE_IMPORTS_END */ - - - - - - - -var SubjectSubscriber = /*@__PURE__*/ (function (_super) { - __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](SubjectSubscriber, _super); - function SubjectSubscriber(destination) { - var _this = _super.call(this, destination) || this; - _this.destination = destination; - return _this; - } - return SubjectSubscriber; -}(__WEBPACK_IMPORTED_MODULE_2__Subscriber__["a" /* Subscriber */])); - -var Subject = /*@__PURE__*/ (function (_super) { - __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](Subject, _super); - function Subject() { - var _this = _super.call(this) || this; - _this.observers = []; - _this.closed = false; - _this.isStopped = false; - _this.hasError = false; - _this.thrownError = null; - return _this; - } - Subject.prototype[__WEBPACK_IMPORTED_MODULE_6__internal_symbol_rxSubscriber__["a" /* rxSubscriber */]] = function () { - return new SubjectSubscriber(this); - }; - Subject.prototype.lift = function (operator) { - var subject = new AnonymousSubject(this, this); - subject.operator = operator; - return subject; - }; - Subject.prototype.next = function (value) { - if (this.closed) { - throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */](); - } - if (!this.isStopped) { - var observers = this.observers; - var len = observers.length; - var copy = observers.slice(); - for (var i = 0; i < len; i++) { - copy[i].next(value); - } - } - }; - Subject.prototype.error = function (err) { - if (this.closed) { - throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */](); - } - this.hasError = true; - this.thrownError = err; - this.isStopped = true; - var observers = this.observers; - var len = observers.length; - var copy = observers.slice(); - for (var i = 0; i < len; i++) { - copy[i].error(err); - } - this.observers.length = 0; - }; - Subject.prototype.complete = function () { - if (this.closed) { - throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */](); - } - this.isStopped = true; - var observers = this.observers; - var len = observers.length; - var copy = observers.slice(); - for (var i = 0; i < len; i++) { - copy[i].complete(); - } - this.observers.length = 0; - }; - Subject.prototype.unsubscribe = function () { - this.isStopped = true; - this.closed = true; - this.observers = null; - }; - Subject.prototype._trySubscribe = function (subscriber) { - if (this.closed) { - throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */](); - } - else { - return _super.prototype._trySubscribe.call(this, subscriber); - } - }; - Subject.prototype._subscribe = function (subscriber) { - if (this.closed) { - throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */](); - } - else if (this.hasError) { - subscriber.error(this.thrownError); - return __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */].EMPTY; - } - else if (this.isStopped) { - subscriber.complete(); - return __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */].EMPTY; - } - else { - this.observers.push(subscriber); - return new __WEBPACK_IMPORTED_MODULE_5__SubjectSubscription__["a" /* SubjectSubscription */](this, subscriber); - } - }; - Subject.prototype.asObservable = function () { - var observable = new __WEBPACK_IMPORTED_MODULE_1__Observable__["a" /* Observable */](); - observable.source = this; - return observable; - }; - Subject.create = function (destination, source) { - return new AnonymousSubject(destination, source); - }; - return Subject; -}(__WEBPACK_IMPORTED_MODULE_1__Observable__["a" /* Observable */])); - -var AnonymousSubject = /*@__PURE__*/ (function (_super) { - __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](AnonymousSubject, _super); - function AnonymousSubject(destination, source) { - var _this = _super.call(this) || this; - _this.destination = destination; - _this.source = source; - return _this; - } - AnonymousSubject.prototype.next = function (value) { - var destination = this.destination; - if (destination && destination.next) { - destination.next(value); - } - }; - AnonymousSubject.prototype.error = function (err) { - var destination = this.destination; - if (destination && destination.error) { - this.destination.error(err); - } - }; - AnonymousSubject.prototype.complete = function () { - var destination = this.destination; - if (destination && destination.complete) { - this.destination.complete(); - } - }; - AnonymousSubject.prototype._subscribe = function (subscriber) { - var source = this.source; - if (source) { - return this.source.subscribe(subscriber); - } - else { - return __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */].EMPTY; - } - }; - return AnonymousSubject; -}(Subject)); - -//# sourceMappingURL=Subject.js.map - - -/***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.normalizePattern = normalizePattern; - -/** - * Explode and normalize a pattern into its name and range. - */ - -function normalizePattern(pattern) { - let hasVersion = false; - let range = 'latest'; - let name = pattern; - - // if we're a scope then remove the @ and add it back later - let isScoped = false; - if (name[0] === '@') { - isScoped = true; - name = name.slice(1); - } - - // take first part as the name - const parts = name.split('@'); - if (parts.length > 1) { - name = parts.shift(); - range = parts.join('@'); - - if (range) { - hasVersion = true; - } else { - range = '*'; - } - } - - // add back @ scope suffix - if (isScoped) { - name = `@${name}`; - } - - return { name, range, hasVersion }; -} - -/***/ }), -/* 38 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;/** - * @license - * Lodash - * Copyright JS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ -;(function() { - - /** Used as a safe reference for `undefined` in pre-ES5 environments. */ - var undefined; - - /** Used as the semantic version number. */ - var VERSION = '4.17.10'; - - /** Used as the size to enable large array optimizations. */ - var LARGE_ARRAY_SIZE = 200; - - /** Error message constants. */ - var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', - FUNC_ERROR_TEXT = 'Expected a function'; - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; - - /** Used as the maximum memoize cache size. */ - var MAX_MEMOIZE_SIZE = 500; - - /** Used as the internal argument placeholder. */ - var PLACEHOLDER = '__lodash_placeholder__'; - - /** Used to compose bitmasks for cloning. */ - var CLONE_DEEP_FLAG = 1, - CLONE_FLAT_FLAG = 2, - CLONE_SYMBOLS_FLAG = 4; - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG = 1, - COMPARE_UNORDERED_FLAG = 2; - - /** Used to compose bitmasks for function metadata. */ - var WRAP_BIND_FLAG = 1, - WRAP_BIND_KEY_FLAG = 2, - WRAP_CURRY_BOUND_FLAG = 4, - WRAP_CURRY_FLAG = 8, - WRAP_CURRY_RIGHT_FLAG = 16, - WRAP_PARTIAL_FLAG = 32, - WRAP_PARTIAL_RIGHT_FLAG = 64, - WRAP_ARY_FLAG = 128, - WRAP_REARG_FLAG = 256, - WRAP_FLIP_FLAG = 512; - - /** Used as default options for `_.truncate`. */ - var DEFAULT_TRUNC_LENGTH = 30, - DEFAULT_TRUNC_OMISSION = '...'; - - /** Used to detect hot functions by number of calls within a span of milliseconds. */ - var HOT_COUNT = 800, - HOT_SPAN = 16; - - /** Used to indicate the type of lazy iteratees. */ - var LAZY_FILTER_FLAG = 1, - LAZY_MAP_FLAG = 2, - LAZY_WHILE_FLAG = 3; - - /** Used as references for various `Number` constants. */ - var INFINITY = 1 / 0, - MAX_SAFE_INTEGER = 9007199254740991, - MAX_INTEGER = 1.7976931348623157e+308, - NAN = 0 / 0; - - /** Used as references for the maximum length and index of an array. */ - var MAX_ARRAY_LENGTH = 4294967295, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, - HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; - - /** Used to associate wrap methods with their bit flags. */ - var wrapFlags = [ - ['ary', WRAP_ARY_FLAG], - ['bind', WRAP_BIND_FLAG], - ['bindKey', WRAP_BIND_KEY_FLAG], - ['curry', WRAP_CURRY_FLAG], - ['curryRight', WRAP_CURRY_RIGHT_FLAG], - ['flip', WRAP_FLIP_FLAG], - ['partial', WRAP_PARTIAL_FLAG], - ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], - ['rearg', WRAP_REARG_FLAG] - ]; - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - asyncTag = '[object AsyncFunction]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - domExcTag = '[object DOMException]', - errorTag = '[object Error]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - mapTag = '[object Map]', - numberTag = '[object Number]', - nullTag = '[object Null]', - objectTag = '[object Object]', - promiseTag = '[object Promise]', - proxyTag = '[object Proxy]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]', - undefinedTag = '[object Undefined]', - weakMapTag = '[object WeakMap]', - weakSetTag = '[object WeakSet]'; - - var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - - /** Used to match empty string literals in compiled template source. */ - var reEmptyStringLeading = /\b__p \+= '';/g, - reEmptyStringMiddle = /\b(__p \+=) '' \+/g, - reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; - - /** Used to match HTML entities and HTML characters. */ - var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, - reUnescapedHtml = /[&<>"']/g, - reHasEscapedHtml = RegExp(reEscapedHtml.source), - reHasUnescapedHtml = RegExp(reUnescapedHtml.source); - - /** Used to match template delimiters. */ - var reEscape = /<%-([\s\S]+?)%>/g, - reEvaluate = /<%([\s\S]+?)%>/g, - reInterpolate = /<%=([\s\S]+?)%>/g; - - /** Used to match property names within property paths. */ - var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; - - /** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, - reHasRegExpChar = RegExp(reRegExpChar.source); - - /** Used to match leading and trailing whitespace. */ - var reTrim = /^\s+|\s+$/g, - reTrimStart = /^\s+/, - reTrimEnd = /\s+$/; - - /** Used to match wrap detail comments. */ - var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, - reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, - reSplitDetails = /,? & /; - - /** Used to match words composed of alphanumeric characters. */ - var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; - - /** Used to match backslashes in property paths. */ - var reEscapeChar = /\\(\\)?/g; - - /** - * Used to match - * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). - */ - var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - - /** Used to match `RegExp` flags from their coerced string values. */ - var reFlags = /\w*$/; - - /** Used to detect bad signed hexadecimal string values. */ - var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; - - /** Used to detect binary string values. */ - var reIsBinary = /^0b[01]+$/i; - - /** Used to detect host constructors (Safari). */ - var reIsHostCtor = /^\[object .+?Constructor\]$/; - - /** Used to detect octal string values. */ - var reIsOctal = /^0o[0-7]+$/i; - - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; - - /** Used to match Latin Unicode letters (excluding mathematical operators). */ - var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; - - /** Used to ensure capturing order of template delimiters. */ - var reNoMatch = /($^)/; - - /** Used to match unescaped characters in compiled string literals. */ - var reUnescapedString = /['\n\r\u2028\u2029\\]/g; - - /** Used to compose unicode character classes. */ - var rsAstralRange = '\\ud800-\\udfff', - rsComboMarksRange = '\\u0300-\\u036f', - reComboHalfMarksRange = '\\ufe20-\\ufe2f', - rsComboSymbolsRange = '\\u20d0-\\u20ff', - rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, - rsDingbatRange = '\\u2700-\\u27bf', - rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', - rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', - rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', - rsPunctuationRange = '\\u2000-\\u206f', - rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', - rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', - rsVarRange = '\\ufe0e\\ufe0f', - rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; - - /** Used to compose unicode capture groups. */ - var rsApos = "['\u2019]", - rsAstral = '[' + rsAstralRange + ']', - rsBreak = '[' + rsBreakRange + ']', - rsCombo = '[' + rsComboRange + ']', - rsDigits = '\\d+', - rsDingbat = '[' + rsDingbatRange + ']', - rsLower = '[' + rsLowerRange + ']', - rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', - rsFitz = '\\ud83c[\\udffb-\\udfff]', - rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', - rsNonAstral = '[^' + rsAstralRange + ']', - rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', - rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', - rsUpper = '[' + rsUpperRange + ']', - rsZWJ = '\\u200d'; - - /** Used to compose unicode regexes. */ - var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', - rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', - rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', - rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', - reOptMod = rsModifier + '?', - rsOptVar = '[' + rsVarRange + ']?', - rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', - rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', - rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', - rsSeq = rsOptVar + reOptMod + rsOptJoin, - rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, - rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; - - /** Used to match apostrophes. */ - var reApos = RegExp(rsApos, 'g'); - - /** - * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and - * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). - */ - var reComboMark = RegExp(rsCombo, 'g'); - - /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ - var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); - - /** Used to match complex or compound words. */ - var reUnicodeWord = RegExp([ - rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', - rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', - rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, - rsUpper + '+' + rsOptContrUpper, - rsOrdUpper, - rsOrdLower, - rsDigits, - rsEmoji - ].join('|'), 'g'); - - /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ - var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); - - /** Used to detect strings that need a more robust regexp to match words. */ - var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; - - /** Used to assign default `context` object properties. */ - var contextProps = [ - 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', - 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', - 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', - 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', - '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' - ]; - - /** Used to make template sourceURLs easier to identify. */ - var templateCounter = -1; - - /** Used to identify `toStringTag` values of typed arrays. */ - var typedArrayTags = {}; - typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; - typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; - - /** Used to identify `toStringTag` values supported by `_.clone`. */ - var cloneableTags = {}; - cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; - cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; - - /** Used to map Latin Unicode letters to basic Latin letters. */ - var deburredLetters = { - // Latin-1 Supplement block. - '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', - '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', - '\xc7': 'C', '\xe7': 'c', - '\xd0': 'D', '\xf0': 'd', - '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', - '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', - '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', - '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', - '\xd1': 'N', '\xf1': 'n', - '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', - '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', - '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', - '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', - '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', - '\xc6': 'Ae', '\xe6': 'ae', - '\xde': 'Th', '\xfe': 'th', - '\xdf': 'ss', - // Latin Extended-A block. - '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', - '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', - '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', - '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', - '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', - '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', - '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', - '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', - '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', - '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', - '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', - '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', - '\u0134': 'J', '\u0135': 'j', - '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', - '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', - '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', - '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', - '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', - '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', - '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', - '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', - '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', - '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', - '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', - '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', - '\u0163': 't', '\u0165': 't', '\u0167': 't', - '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', - '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', - '\u0174': 'W', '\u0175': 'w', - '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', - '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', - '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', - '\u0132': 'IJ', '\u0133': 'ij', - '\u0152': 'Oe', '\u0153': 'oe', - '\u0149': "'n", '\u017f': 's' - }; - - /** Used to map characters to HTML entities. */ - var htmlEscapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - - /** Used to map HTML entities to characters. */ - var htmlUnescapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - ''': "'" - }; - - /** Used to escape characters for inclusion in compiled string literals. */ - var stringEscapes = { - '\\': '\\', - "'": "'", - '\n': 'n', - '\r': 'r', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - /** Built-in method references without a dependency on `root`. */ - var freeParseFloat = parseFloat, - freeParseInt = parseInt; - - /** Detect free variable `global` from Node.js. */ - var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - - /** Detect free variable `self`. */ - var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - - /** Used as a reference to the global object. */ - var root = freeGlobal || freeSelf || Function('return this')(); - - /** Detect free variable `exports`. */ - var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = freeModule && freeModule.exports === freeExports; - - /** Detect free variable `process` from Node.js. */ - var freeProcess = moduleExports && freeGlobal.process; - - /** Used to access faster Node.js helpers. */ - var nodeUtil = (function() { - try { - // Use `util.types` for Node.js 10+. - var types = freeModule && freeModule.require && freeModule.require('util').types; - - if (types) { - return types; - } - - // Legacy `process.binding('util')` for Node.js < 10. - return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) {} - }()); - - /* Node.js helper references. */ - var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, - nodeIsDate = nodeUtil && nodeUtil.isDate, - nodeIsMap = nodeUtil && nodeUtil.isMap, - nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, - nodeIsSet = nodeUtil && nodeUtil.isSet, - nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; - - /*--------------------------------------------------------------------------*/ - - /** - * A faster alternative to `Function#apply`, this function invokes `func` - * with the `this` binding of `thisArg` and the arguments of `args`. - * - * @private - * @param {Function} func The function to invoke. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} args The arguments to invoke `func` with. - * @returns {*} Returns the result of `func`. - */ - function apply(func, thisArg, args) { - switch (args.length) { - case 0: return func.call(thisArg); - case 1: return func.call(thisArg, args[0]); - case 2: return func.call(thisArg, args[0], args[1]); - case 3: return func.call(thisArg, args[0], args[1], args[2]); - } - return func.apply(thisArg, args); - } - - /** - * A specialized version of `baseAggregator` for arrays. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform keys. - * @param {Object} accumulator The initial aggregated object. - * @returns {Function} Returns `accumulator`. - */ - function arrayAggregator(array, setter, iteratee, accumulator) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - var value = array[index]; - setter(accumulator, value, iteratee(value), array); - } - return accumulator; - } - - /** - * A specialized version of `_.forEach` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ - function arrayEach(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; - } - - /** - * A specialized version of `_.forEachRight` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ - function arrayEachRight(array, iteratee) { - var length = array == null ? 0 : array.length; - - while (length--) { - if (iteratee(array[length], length, array) === false) { - break; - } - } - return array; - } - - /** - * A specialized version of `_.every` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false`. - */ - function arrayEvery(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (!predicate(array[index], index, array)) { - return false; - } - } - return true; - } - - /** - * A specialized version of `_.filter` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function arrayFilter(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result[resIndex++] = value; - } - } - return result; - } - - /** - * A specialized version of `_.includes` for arrays without support for - * specifying an index to search from. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ - function arrayIncludes(array, value) { - var length = array == null ? 0 : array.length; - return !!length && baseIndexOf(array, value, 0) > -1; - } - - /** - * This function is like `arrayIncludes` except that it accepts a comparator. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @param {Function} comparator The comparator invoked per element. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ - function arrayIncludesWith(array, value, comparator) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (comparator(value, array[index])) { - return true; - } - } - return false; - } - - /** - * A specialized version of `_.map` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function arrayMap(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length, - result = Array(length); - - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; - } - - /** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ - function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; - } - - /** - * A specialized version of `_.reduce` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the first element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ - function arrayReduce(array, iteratee, accumulator, initAccum) { - var index = -1, - length = array == null ? 0 : array.length; - - if (initAccum && length) { - accumulator = array[++index]; - } - while (++index < length) { - accumulator = iteratee(accumulator, array[index], index, array); - } - return accumulator; - } - - /** - * A specialized version of `_.reduceRight` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the last element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ - function arrayReduceRight(array, iteratee, accumulator, initAccum) { - var length = array == null ? 0 : array.length; - if (initAccum && length) { - accumulator = array[--length]; - } - while (length--) { - accumulator = iteratee(accumulator, array[length], length, array); - } - return accumulator; - } - - /** - * A specialized version of `_.some` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ - function arraySome(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; - } - - /** - * Gets the size of an ASCII `string`. - * - * @private - * @param {string} string The string inspect. - * @returns {number} Returns the string size. - */ - var asciiSize = baseProperty('length'); - - /** - * Converts an ASCII `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function asciiToArray(string) { - return string.split(''); - } - - /** - * Splits an ASCII `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ - function asciiWords(string) { - return string.match(reAsciiWord) || []; - } - - /** - * The base implementation of methods like `_.findKey` and `_.findLastKey`, - * without support for iteratee shorthands, which iterates over `collection` - * using `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the found element or its key, else `undefined`. - */ - function baseFindKey(collection, predicate, eachFunc) { - var result; - eachFunc(collection, function(value, key, collection) { - if (predicate(value, key, collection)) { - result = key; - return false; - } - }); - return result; - } - - /** - * The base implementation of `_.findIndex` and `_.findLastIndex` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {number} fromIndex The index to search from. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 1 : -1); - - while ((fromRight ? index-- : ++index < length)) { - if (predicate(array[index], index, array)) { - return index; - } - } - return -1; - } - - /** - * The base implementation of `_.indexOf` without `fromIndex` bounds checks. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseIndexOf(array, value, fromIndex) { - return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); - } - - /** - * This function is like `baseIndexOf` except that it accepts a comparator. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @param {Function} comparator The comparator invoked per element. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseIndexOfWith(array, value, fromIndex, comparator) { - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (comparator(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * The base implementation of `_.isNaN` without support for number objects. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - */ - function baseIsNaN(value) { - return value !== value; - } - - /** - * The base implementation of `_.mean` and `_.meanBy` without support for - * iteratee shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the mean. - */ - function baseMean(array, iteratee) { - var length = array == null ? 0 : array.length; - return length ? (baseSum(array, iteratee) / length) : NAN; - } - - /** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ - function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; - } - - /** - * The base implementation of `_.propertyOf` without support for deep paths. - * - * @private - * @param {Object} object The object to query. - * @returns {Function} Returns the new accessor function. - */ - function basePropertyOf(object) { - return function(key) { - return object == null ? undefined : object[key]; - }; - } - - /** - * The base implementation of `_.reduce` and `_.reduceRight`, without support - * for iteratee shorthands, which iterates over `collection` using `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} accumulator The initial value. - * @param {boolean} initAccum Specify using the first or last element of - * `collection` as the initial value. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the accumulated value. - */ - function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { - eachFunc(collection, function(value, index, collection) { - accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); - }); - return accumulator; - } - - /** - * The base implementation of `_.sortBy` which uses `comparer` to define the - * sort order of `array` and replaces criteria objects with their corresponding - * values. - * - * @private - * @param {Array} array The array to sort. - * @param {Function} comparer The function to define sort order. - * @returns {Array} Returns `array`. - */ - function baseSortBy(array, comparer) { - var length = array.length; - - array.sort(comparer); - while (length--) { - array[length] = array[length].value; - } - return array; - } - - /** - * The base implementation of `_.sum` and `_.sumBy` without support for - * iteratee shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the sum. - */ - function baseSum(array, iteratee) { - var result, - index = -1, - length = array.length; - - while (++index < length) { - var current = iteratee(array[index]); - if (current !== undefined) { - result = result === undefined ? current : (result + current); - } - } - return result; - } - - /** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ - function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; - } - - /** - * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array - * of key-value pairs for `object` corresponding to the property names of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the key-value pairs. - */ - function baseToPairs(object, props) { - return arrayMap(props, function(key) { - return [key, object[key]]; - }); - } - - /** - * The base implementation of `_.unary` without support for storing metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - */ - function baseUnary(func) { - return function(value) { - return func(value); - }; - } - - /** - * The base implementation of `_.values` and `_.valuesIn` which creates an - * array of `object` property values corresponding to the property names - * of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the array of property values. - */ - function baseValues(object, props) { - return arrayMap(props, function(key) { - return object[key]; - }); - } - - /** - * Checks if a `cache` value for `key` exists. - * - * @private - * @param {Object} cache The cache to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function cacheHas(cache, key) { - return cache.has(key); - } - - /** - * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the first unmatched string symbol. - */ - function charsStartIndex(strSymbols, chrSymbols) { - var index = -1, - length = strSymbols.length; - - while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; - } - - /** - * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the last unmatched string symbol. - */ - function charsEndIndex(strSymbols, chrSymbols) { - var index = strSymbols.length; - - while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; - } - - /** - * Gets the number of `placeholder` occurrences in `array`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} placeholder The placeholder to search for. - * @returns {number} Returns the placeholder count. - */ - function countHolders(array, placeholder) { - var length = array.length, - result = 0; - - while (length--) { - if (array[length] === placeholder) { - ++result; - } - } - return result; - } - - /** - * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A - * letters to basic Latin letters. - * - * @private - * @param {string} letter The matched letter to deburr. - * @returns {string} Returns the deburred letter. - */ - var deburrLetter = basePropertyOf(deburredLetters); - - /** - * Used by `_.escape` to convert characters to HTML entities. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ - var escapeHtmlChar = basePropertyOf(htmlEscapes); - - /** - * Used by `_.template` to escape characters for inclusion in compiled string literals. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeStringChar(chr) { - return '\\' + stringEscapes[chr]; - } - - /** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function getValue(object, key) { - return object == null ? undefined : object[key]; - } - - /** - * Checks if `string` contains Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a symbol is found, else `false`. - */ - function hasUnicode(string) { - return reHasUnicode.test(string); - } - - /** - * Checks if `string` contains a word composed of Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a word is found, else `false`. - */ - function hasUnicodeWord(string) { - return reHasUnicodeWord.test(string); - } - - /** - * Converts `iterator` to an array. - * - * @private - * @param {Object} iterator The iterator to convert. - * @returns {Array} Returns the converted array. - */ - function iteratorToArray(iterator) { - var data, - result = []; - - while (!(data = iterator.next()).done) { - result.push(data.value); - } - return result; - } - - /** - * Converts `map` to its key-value pairs. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */ - function mapToArray(map) { - var index = -1, - result = Array(map.size); - - map.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; - } - - /** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ - function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; - } - - /** - * Replaces all `placeholder` elements in `array` with an internal placeholder - * and returns an array of their indexes. - * - * @private - * @param {Array} array The array to modify. - * @param {*} placeholder The placeholder to replace. - * @returns {Array} Returns the new array of placeholder indexes. - */ - function replaceHolders(array, placeholder) { - var index = -1, - length = array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value === placeholder || value === PLACEHOLDER) { - array[index] = PLACEHOLDER; - result[resIndex++] = index; - } - } - return result; - } - - /** - * Gets the value at `key`, unless `key` is "__proto__". - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function safeGet(object, key) { - return key == '__proto__' - ? undefined - : object[key]; - } - - /** - * Converts `set` to an array of its values. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the values. - */ - function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; - } - - /** - * Converts `set` to its value-value pairs. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the value-value pairs. - */ - function setToPairs(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = [value, value]; - }); - return result; - } - - /** - * A specialized version of `_.indexOf` which performs strict equality - * comparisons of values, i.e. `===`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function strictIndexOf(array, value, fromIndex) { - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * A specialized version of `_.lastIndexOf` which performs strict equality - * comparisons of values, i.e. `===`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function strictLastIndexOf(array, value, fromIndex) { - var index = fromIndex + 1; - while (index--) { - if (array[index] === value) { - return index; - } - } - return index; - } - - /** - * Gets the number of symbols in `string`. - * - * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the string size. - */ - function stringSize(string) { - return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); - } - - /** - * Converts `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function stringToArray(string) { - return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); - } - - /** - * Used by `_.unescape` to convert HTML entities to characters. - * - * @private - * @param {string} chr The matched character to unescape. - * @returns {string} Returns the unescaped character. - */ - var unescapeHtmlChar = basePropertyOf(htmlUnescapes); - - /** - * Gets the size of a Unicode `string`. - * - * @private - * @param {string} string The string inspect. - * @returns {number} Returns the string size. - */ - function unicodeSize(string) { - var result = reUnicode.lastIndex = 0; - while (reUnicode.test(string)) { - ++result; - } - return result; - } - - /** - * Converts a Unicode `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function unicodeToArray(string) { - return string.match(reUnicode) || []; - } - - /** - * Splits a Unicode `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ - function unicodeWords(string) { - return string.match(reUnicodeWord) || []; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Create a new pristine `lodash` function using the `context` object. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Util - * @param {Object} [context=root] The context object. - * @returns {Function} Returns a new `lodash` function. - * @example - * - * _.mixin({ 'foo': _.constant('foo') }); - * - * var lodash = _.runInContext(); - * lodash.mixin({ 'bar': lodash.constant('bar') }); - * - * _.isFunction(_.foo); - * // => true - * _.isFunction(_.bar); - * // => false - * - * lodash.isFunction(lodash.foo); - * // => false - * lodash.isFunction(lodash.bar); - * // => true - * - * // Create a suped-up `defer` in Node.js. - * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; - */ - var runInContext = (function runInContext(context) { - context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); - - /** Built-in constructor references. */ - var Array = context.Array, - Date = context.Date, - Error = context.Error, - Function = context.Function, - Math = context.Math, - Object = context.Object, - RegExp = context.RegExp, - String = context.String, - TypeError = context.TypeError; - - /** Used for built-in method references. */ - var arrayProto = Array.prototype, - funcProto = Function.prototype, - objectProto = Object.prototype; - - /** Used to detect overreaching core-js shims. */ - var coreJsData = context['__core-js_shared__']; - - /** Used to resolve the decompiled source of functions. */ - var funcToString = funcProto.toString; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** Used to generate unique IDs. */ - var idCounter = 0; - - /** Used to detect methods masquerading as native. */ - var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; - }()); - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString = objectProto.toString; - - /** Used to infer the `Object` constructor. */ - var objectCtorString = funcToString.call(Object); - - /** Used to restore the original `_` reference in `_.noConflict`. */ - var oldDash = root._; - - /** Used to detect if a method is native. */ - var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' - ); - - /** Built-in value references. */ - var Buffer = moduleExports ? context.Buffer : undefined, - Symbol = context.Symbol, - Uint8Array = context.Uint8Array, - allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, - getPrototype = overArg(Object.getPrototypeOf, Object), - objectCreate = Object.create, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - splice = arrayProto.splice, - spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, - symIterator = Symbol ? Symbol.iterator : undefined, - symToStringTag = Symbol ? Symbol.toStringTag : undefined; - - var defineProperty = (function() { - try { - var func = getNative(Object, 'defineProperty'); - func({}, '', {}); - return func; - } catch (e) {} - }()); - - /** Mocked built-ins. */ - var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, - ctxNow = Date && Date.now !== root.Date.now && Date.now, - ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeCeil = Math.ceil, - nativeFloor = Math.floor, - nativeGetSymbols = Object.getOwnPropertySymbols, - nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, - nativeIsFinite = context.isFinite, - nativeJoin = arrayProto.join, - nativeKeys = overArg(Object.keys, Object), - nativeMax = Math.max, - nativeMin = Math.min, - nativeNow = Date.now, - nativeParseInt = context.parseInt, - nativeRandom = Math.random, - nativeReverse = arrayProto.reverse; - - /* Built-in method references that are verified to be native. */ - var DataView = getNative(context, 'DataView'), - Map = getNative(context, 'Map'), - Promise = getNative(context, 'Promise'), - Set = getNative(context, 'Set'), - WeakMap = getNative(context, 'WeakMap'), - nativeCreate = getNative(Object, 'create'); - - /** Used to store function metadata. */ - var metaMap = WeakMap && new WeakMap; - - /** Used to lookup unminified function names. */ - var realNames = {}; - - /** Used to detect maps, sets, and weakmaps. */ - var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map), - promiseCtorString = toSource(Promise), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); - - /** Used to convert symbols to primitives and strings. */ - var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, - symbolToString = symbolProto ? symbolProto.toString : undefined; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` object which wraps `value` to enable implicit method - * chain sequences. Methods that operate on and return arrays, collections, - * and functions can be chained together. Methods that retrieve a single value - * or may return a primitive value will automatically end the chain sequence - * and return the unwrapped value. Otherwise, the value must be unwrapped - * with `_#value`. - * - * Explicit chain sequences, which must be unwrapped with `_#value`, may be - * enabled using `_.chain`. - * - * The execution of chained methods is lazy, that is, it's deferred until - * `_#value` is implicitly or explicitly called. - * - * Lazy evaluation allows several methods to support shortcut fusion. - * Shortcut fusion is an optimization to merge iteratee calls; this avoids - * the creation of intermediate arrays and can greatly reduce the number of - * iteratee executions. Sections of a chain sequence qualify for shortcut - * fusion if the section is applied to an array and iteratees accept only - * one argument. The heuristic for whether a section qualifies for shortcut - * fusion is subject to change. - * - * Chaining is supported in custom builds as long as the `_#value` method is - * directly or indirectly included in the build. - * - * In addition to lodash methods, wrappers have `Array` and `String` methods. - * - * The wrapper `Array` methods are: - * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` - * - * The wrapper `String` methods are: - * `replace` and `split` - * - * The wrapper methods that support shortcut fusion are: - * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, - * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, - * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` - * - * The chainable wrapper methods are: - * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, - * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, - * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, - * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, - * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, - * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, - * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, - * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, - * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, - * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, - * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, - * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, - * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, - * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, - * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, - * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, - * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, - * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, - * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, - * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, - * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, - * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, - * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, - * `zipObject`, `zipObjectDeep`, and `zipWith` - * - * The wrapper methods that are **not** chainable by default are: - * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, - * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, - * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, - * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, - * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, - * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, - * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, - * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, - * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, - * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, - * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, - * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, - * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, - * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, - * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, - * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, - * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, - * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, - * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, - * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, - * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, - * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, - * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, - * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, - * `upperFirst`, `value`, and `words` - * - * @name _ - * @constructor - * @category Seq - * @param {*} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var wrapped = _([1, 2, 3]); - * - * // Returns an unwrapped value. - * wrapped.reduce(_.add); - * // => 6 - * - * // Returns a wrapped value. - * var squares = wrapped.map(square); - * - * _.isArray(squares); - * // => false - * - * _.isArray(squares.value()); - * // => true - */ - function lodash(value) { - if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { - if (value instanceof LodashWrapper) { - return value; - } - if (hasOwnProperty.call(value, '__wrapped__')) { - return wrapperClone(value); - } - } - return new LodashWrapper(value); - } - - /** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} proto The object to inherit from. - * @returns {Object} Returns the new object. - */ - var baseCreate = (function() { - function object() {} - return function(proto) { - if (!isObject(proto)) { - return {}; - } - if (objectCreate) { - return objectCreate(proto); - } - object.prototype = proto; - var result = new object; - object.prototype = undefined; - return result; - }; - }()); - - /** - * The function whose prototype chain sequence wrappers inherit from. - * - * @private - */ - function baseLodash() { - // No operation performed. - } - - /** - * The base constructor for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap. - * @param {boolean} [chainAll] Enable explicit method chain sequences. - */ - function LodashWrapper(value, chainAll) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__chain__ = !!chainAll; - this.__index__ = 0; - this.__values__ = undefined; - } - - /** - * By default, the template delimiters used by lodash are like those in - * embedded Ruby (ERB) as well as ES2015 template strings. Change the - * following template settings to use alternative delimiters. - * - * @static - * @memberOf _ - * @type {Object} - */ - lodash.templateSettings = { - - /** - * Used to detect `data` property values to be HTML-escaped. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'escape': reEscape, - - /** - * Used to detect code to be evaluated. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'evaluate': reEvaluate, - - /** - * Used to detect `data` property values to inject. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'interpolate': reInterpolate, - - /** - * Used to reference the data object in the template text. - * - * @memberOf _.templateSettings - * @type {string} - */ - 'variable': '', - - /** - * Used to import variables into the compiled template. - * - * @memberOf _.templateSettings - * @type {Object} - */ - 'imports': { - - /** - * A reference to the `lodash` function. - * - * @memberOf _.templateSettings.imports - * @type {Function} - */ - '_': lodash - } - }; - - // Ensure wrappers are instances of `baseLodash`. - lodash.prototype = baseLodash.prototype; - lodash.prototype.constructor = lodash; - - LodashWrapper.prototype = baseCreate(baseLodash.prototype); - LodashWrapper.prototype.constructor = LodashWrapper; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. - * - * @private - * @constructor - * @param {*} value The value to wrap. - */ - function LazyWrapper(value) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__dir__ = 1; - this.__filtered__ = false; - this.__iteratees__ = []; - this.__takeCount__ = MAX_ARRAY_LENGTH; - this.__views__ = []; - } - - /** - * Creates a clone of the lazy wrapper object. - * - * @private - * @name clone - * @memberOf LazyWrapper - * @returns {Object} Returns the cloned `LazyWrapper` object. - */ - function lazyClone() { - var result = new LazyWrapper(this.__wrapped__); - result.__actions__ = copyArray(this.__actions__); - result.__dir__ = this.__dir__; - result.__filtered__ = this.__filtered__; - result.__iteratees__ = copyArray(this.__iteratees__); - result.__takeCount__ = this.__takeCount__; - result.__views__ = copyArray(this.__views__); - return result; - } - - /** - * Reverses the direction of lazy iteration. - * - * @private - * @name reverse - * @memberOf LazyWrapper - * @returns {Object} Returns the new reversed `LazyWrapper` object. - */ - function lazyReverse() { - if (this.__filtered__) { - var result = new LazyWrapper(this); - result.__dir__ = -1; - result.__filtered__ = true; - } else { - result = this.clone(); - result.__dir__ *= -1; - } - return result; - } - - /** - * Extracts the unwrapped value from its lazy wrapper. - * - * @private - * @name value - * @memberOf LazyWrapper - * @returns {*} Returns the unwrapped value. - */ - function lazyValue() { - var array = this.__wrapped__.value(), - dir = this.__dir__, - isArr = isArray(array), - isRight = dir < 0, - arrLength = isArr ? array.length : 0, - view = getView(0, arrLength, this.__views__), - start = view.start, - end = view.end, - length = end - start, - index = isRight ? end : (start - 1), - iteratees = this.__iteratees__, - iterLength = iteratees.length, - resIndex = 0, - takeCount = nativeMin(length, this.__takeCount__); - - if (!isArr || (!isRight && arrLength == length && takeCount == length)) { - return baseWrapperValue(array, this.__actions__); - } - var result = []; - - outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } - } - result[resIndex++] = value; - } - return result; - } - - // Ensure `LazyWrapper` is an instance of `baseLodash`. - LazyWrapper.prototype = baseCreate(baseLodash.prototype); - LazyWrapper.prototype.constructor = LazyWrapper; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Hash(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ - function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; - this.size = 0; - } - - /** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function hashDelete(key) { - var result = this.has(key) && delete this.__data__[key]; - this.size -= result ? 1 : 0; - return result; - } - - /** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(data, key) ? data[key] : undefined; - } - - /** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function hashHas(key) { - var data = this.__data__; - return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); - } - - /** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ - function hashSet(key, value) { - var data = this.__data__; - this.size += this.has(key) ? 0 : 1; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; - } - - // Add methods to `Hash`. - Hash.prototype.clear = hashClear; - Hash.prototype['delete'] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - - /*------------------------------------------------------------------------*/ - - /** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function ListCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ - function listCacheClear() { - this.__data__ = []; - this.size = 0; - } - - /** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - --this.size; - return true; - } - - /** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; - } - - /** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; - } - - /** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ - function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - ++this.size; - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; - } - - // Add methods to `ListCache`. - ListCache.prototype.clear = listCacheClear; - ListCache.prototype['delete'] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function MapCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ - function mapCacheClear() { - this.size = 0; - this.__data__ = { - 'hash': new Hash, - 'map': new (Map || ListCache), - 'string': new Hash - }; - } - - /** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function mapCacheDelete(key) { - var result = getMapData(this, key)['delete'](key); - this.size -= result ? 1 : 0; - return result; - } - - /** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function mapCacheGet(key) { - return getMapData(this, key).get(key); - } - - /** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function mapCacheHas(key) { - return getMapData(this, key).has(key); - } - - /** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ - function mapCacheSet(key, value) { - var data = getMapData(this, key), - size = data.size; - - data.set(key, value); - this.size += data.size == size ? 0 : 1; - return this; - } - - // Add methods to `MapCache`. - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype['delete'] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; - - /*------------------------------------------------------------------------*/ - - /** - * - * Creates an array cache object to store unique values. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ - function SetCache(values) { - var index = -1, - length = values == null ? 0 : values.length; - - this.__data__ = new MapCache; - while (++index < length) { - this.add(values[index]); - } - } - - /** - * Adds `value` to the array cache. - * - * @private - * @name add - * @memberOf SetCache - * @alias push - * @param {*} value The value to cache. - * @returns {Object} Returns the cache instance. - */ - function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; - } - - /** - * Checks if `value` is in the array cache. - * - * @private - * @name has - * @memberOf SetCache - * @param {*} value The value to search for. - * @returns {number} Returns `true` if `value` is found, else `false`. - */ - function setCacheHas(value) { - return this.__data__.has(value); - } - - // Add methods to `SetCache`. - SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; - SetCache.prototype.has = setCacheHas; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Stack(entries) { - var data = this.__data__ = new ListCache(entries); - this.size = data.size; - } - - /** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */ - function stackClear() { - this.__data__ = new ListCache; - this.size = 0; - } - - /** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function stackDelete(key) { - var data = this.__data__, - result = data['delete'](key); - - this.size = data.size; - return result; - } - - /** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function stackGet(key) { - return this.__data__.get(key); - } - - /** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function stackHas(key) { - return this.__data__.has(key); - } - - /** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */ - function stackSet(key, value) { - var data = this.__data__; - if (data instanceof ListCache) { - var pairs = data.__data__; - if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { - pairs.push([key, value]); - this.size = ++data.size; - return this; - } - data = this.__data__ = new MapCache(pairs); - } - data.set(key, value); - this.size = data.size; - return this; - } - - // Add methods to `Stack`. - Stack.prototype.clear = stackClear; - Stack.prototype['delete'] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; - - /*------------------------------------------------------------------------*/ - - /** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ - function arrayLikeKeys(value, inherited) { - var isArr = isArray(value), - isArg = !isArr && isArguments(value), - isBuff = !isArr && !isArg && isBuffer(value), - isType = !isArr && !isArg && !isBuff && isTypedArray(value), - skipIndexes = isArr || isArg || isBuff || isType, - result = skipIndexes ? baseTimes(value.length, String) : [], - length = result.length; - - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) - ))) { - result.push(key); - } - } - return result; - } - - /** - * A specialized version of `_.sample` for arrays. - * - * @private - * @param {Array} array The array to sample. - * @returns {*} Returns the random element. - */ - function arraySample(array) { - var length = array.length; - return length ? array[baseRandom(0, length - 1)] : undefined; - } - - /** - * A specialized version of `_.sampleSize` for arrays. - * - * @private - * @param {Array} array The array to sample. - * @param {number} n The number of elements to sample. - * @returns {Array} Returns the random elements. - */ - function arraySampleSize(array, n) { - return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); - } - - /** - * A specialized version of `_.shuffle` for arrays. - * - * @private - * @param {Array} array The array to shuffle. - * @returns {Array} Returns the new shuffled array. - */ - function arrayShuffle(array) { - return shuffleSelf(copyArray(array)); - } - - /** - * This function is like `assignValue` except that it doesn't assign - * `undefined` values. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function assignMergeValue(object, key, value) { - if ((value !== undefined && !eq(object[key], value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } - } - - /** - * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function assignValue(object, key, value) { - var objValue = object[key]; - if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } - } - - /** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; - } - - /** - * Aggregates elements of `collection` on `accumulator` with keys transformed - * by `iteratee` and values set by `setter`. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform keys. - * @param {Object} accumulator The initial aggregated object. - * @returns {Function} Returns `accumulator`. - */ - function baseAggregator(collection, setter, iteratee, accumulator) { - baseEach(collection, function(value, key, collection) { - setter(accumulator, value, iteratee(value), collection); - }); - return accumulator; - } - - /** - * The base implementation of `_.assign` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ - function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); - } - - /** - * The base implementation of `_.assignIn` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ - function baseAssignIn(object, source) { - return object && copyObject(source, keysIn(source), object); - } - - /** - * The base implementation of `assignValue` and `assignMergeValue` without - * value checks. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function baseAssignValue(object, key, value) { - if (key == '__proto__' && defineProperty) { - defineProperty(object, key, { - 'configurable': true, - 'enumerable': true, - 'value': value, - 'writable': true - }); - } else { - object[key] = value; - } - } - - /** - * The base implementation of `_.at` without support for individual paths. - * - * @private - * @param {Object} object The object to iterate over. - * @param {string[]} paths The property paths to pick. - * @returns {Array} Returns the picked elements. - */ - function baseAt(object, paths) { - var index = -1, - length = paths.length, - result = Array(length), - skip = object == null; - - while (++index < length) { - result[index] = skip ? undefined : get(object, paths[index]); - } - return result; - } - - /** - * The base implementation of `_.clamp` which doesn't coerce arguments. - * - * @private - * @param {number} number The number to clamp. - * @param {number} [lower] The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the clamped number. - */ - function baseClamp(number, lower, upper) { - if (number === number) { - if (upper !== undefined) { - number = number <= upper ? number : upper; - } - if (lower !== undefined) { - number = number >= lower ? number : lower; - } - } - return number; - } - - /** - * The base implementation of `_.clone` and `_.cloneDeep` which tracks - * traversed objects. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} bitmask The bitmask flags. - * 1 - Deep clone - * 2 - Flatten inherited properties - * 4 - Clone symbols - * @param {Function} [customizer] The function to customize cloning. - * @param {string} [key] The key of `value`. - * @param {Object} [object] The parent object of `value`. - * @param {Object} [stack] Tracks traversed objects and their clone counterparts. - * @returns {*} Returns the cloned value. - */ - function baseClone(value, bitmask, customizer, key, object, stack) { - var result, - isDeep = bitmask & CLONE_DEEP_FLAG, - isFlat = bitmask & CLONE_FLAT_FLAG, - isFull = bitmask & CLONE_SYMBOLS_FLAG; - - if (customizer) { - result = object ? customizer(value, key, object, stack) : customizer(value); - } - if (result !== undefined) { - return result; - } - if (!isObject(value)) { - return value; - } - var isArr = isArray(value); - if (isArr) { - result = initCloneArray(value); - if (!isDeep) { - return copyArray(value, result); - } - } else { - var tag = getTag(value), - isFunc = tag == funcTag || tag == genTag; - - if (isBuffer(value)) { - return cloneBuffer(value, isDeep); - } - if (tag == objectTag || tag == argsTag || (isFunc && !object)) { - result = (isFlat || isFunc) ? {} : initCloneObject(value); - if (!isDeep) { - return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); - } - } else { - if (!cloneableTags[tag]) { - return object ? value : {}; - } - result = initCloneByTag(value, tag, isDeep); - } - } - // Check for circular references and return its corresponding clone. - stack || (stack = new Stack); - var stacked = stack.get(value); - if (stacked) { - return stacked; - } - stack.set(value, result); - - if (isSet(value)) { - value.forEach(function(subValue) { - result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); - }); - - return result; - } - - if (isMap(value)) { - value.forEach(function(subValue, key) { - result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); - - return result; - } - - var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); - - var props = isArr ? undefined : keysFunc(value); - arrayEach(props || value, function(subValue, key) { - if (props) { - key = subValue; - subValue = value[key]; - } - // Recursively populate clone (susceptible to call stack limits). - assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); - return result; - } - - /** - * The base implementation of `_.conforms` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property predicates to conform to. - * @returns {Function} Returns the new spec function. - */ - function baseConforms(source) { - var props = keys(source); - return function(object) { - return baseConformsTo(object, source, props); - }; - } - - /** - * The base implementation of `_.conformsTo` which accepts `props` to check. - * - * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property predicates to conform to. - * @returns {boolean} Returns `true` if `object` conforms, else `false`. - */ - function baseConformsTo(object, source, props) { - var length = props.length; - if (object == null) { - return !length; - } - object = Object(object); - while (length--) { - var key = props[length], - predicate = source[key], - value = object[key]; - - if ((value === undefined && !(key in object)) || !predicate(value)) { - return false; - } - } - return true; - } - - /** - * The base implementation of `_.delay` and `_.defer` which accepts `args` - * to provide to `func`. - * - * @private - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {Array} args The arguments to provide to `func`. - * @returns {number|Object} Returns the timer id or timeout object. - */ - function baseDelay(func, wait, args) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return setTimeout(function() { func.apply(undefined, args); }, wait); - } - - /** - * The base implementation of methods like `_.difference` without support - * for excluding multiple arrays or iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Array} values The values to exclude. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - */ - function baseDifference(array, values, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - isCommon = true, - length = array.length, - result = [], - valuesLength = values.length; - - if (!length) { - return result; - } - if (iteratee) { - values = arrayMap(values, baseUnary(iteratee)); - } - if (comparator) { - includes = arrayIncludesWith; - isCommon = false; - } - else if (values.length >= LARGE_ARRAY_SIZE) { - includes = cacheHas; - isCommon = false; - values = new SetCache(values); - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.forEach` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - */ - var baseEach = createBaseEach(baseForOwn); - - /** - * The base implementation of `_.forEachRight` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - */ - var baseEachRight = createBaseEach(baseForOwnRight, true); - - /** - * The base implementation of `_.every` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false` - */ - function baseEvery(collection, predicate) { - var result = true; - baseEach(collection, function(value, index, collection) { - result = !!predicate(value, index, collection); - return result; - }); - return result; - } - - /** - * The base implementation of methods like `_.max` and `_.min` which accepts a - * `comparator` to determine the extremum value. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The iteratee invoked per iteration. - * @param {Function} comparator The comparator used to compare values. - * @returns {*} Returns the extremum value. - */ - function baseExtremum(array, iteratee, comparator) { - var index = -1, - length = array.length; - - while (++index < length) { - var value = array[index], - current = iteratee(value); - - if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { - var computed = current, - result = value; - } - } - return result; - } - - /** - * The base implementation of `_.fill` without an iteratee call guard. - * - * @private - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - */ - function baseFill(array, value, start, end) { - var length = array.length; - - start = toInteger(start); - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = (end === undefined || end > length) ? length : toInteger(end); - if (end < 0) { - end += length; - } - end = start > end ? 0 : toLength(end); - while (start < end) { - array[start++] = value; - } - return array; - } - - /** - * The base implementation of `_.filter` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function baseFilter(collection, predicate) { - var result = []; - baseEach(collection, function(value, index, collection) { - if (predicate(value, index, collection)) { - result.push(value); - } - }); - return result; - } - - /** - * The base implementation of `_.flatten` with support for restricting flattening. - * - * @private - * @param {Array} array The array to flatten. - * @param {number} depth The maximum recursion depth. - * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. - * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. - * @param {Array} [result=[]] The initial result value. - * @returns {Array} Returns the new flattened array. - */ - function baseFlatten(array, depth, predicate, isStrict, result) { - var index = -1, - length = array.length; - - predicate || (predicate = isFlattenable); - result || (result = []); - - while (++index < length) { - var value = array[index]; - if (depth > 0 && predicate(value)) { - if (depth > 1) { - // Recursively flatten arrays (susceptible to call stack limits). - baseFlatten(value, depth - 1, predicate, isStrict, result); - } else { - arrayPush(result, value); - } - } else if (!isStrict) { - result[result.length] = value; - } - } - return result; - } - - /** - * The base implementation of `baseForOwn` which iterates over `object` - * properties returned by `keysFunc` and invokes `iteratee` for each property. - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ - var baseFor = createBaseFor(); - - /** - * This function is like `baseFor` except that it iterates over properties - * in the opposite order. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ - var baseForRight = createBaseFor(true); - - /** - * The base implementation of `_.forOwn` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ - function baseForOwn(object, iteratee) { - return object && baseFor(object, iteratee, keys); - } - - /** - * The base implementation of `_.forOwnRight` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ - function baseForOwnRight(object, iteratee) { - return object && baseForRight(object, iteratee, keys); - } - - /** - * The base implementation of `_.functions` which creates an array of - * `object` function property names filtered from `props`. - * - * @private - * @param {Object} object The object to inspect. - * @param {Array} props The property names to filter. - * @returns {Array} Returns the function names. - */ - function baseFunctions(object, props) { - return arrayFilter(props, function(key) { - return isFunction(object[key]); - }); - } - - /** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ - function baseGet(object, path) { - path = castPath(path, object); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[toKey(path[index++])]; - } - return (index && index == length) ? object : undefined; - } - - /** - * The base implementation of `getAllKeys` and `getAllKeysIn` which uses - * `keysFunc` and `symbolsFunc` to get the enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Function} keysFunc The function to get the keys of `object`. - * @param {Function} symbolsFunc The function to get the symbols of `object`. - * @returns {Array} Returns the array of property names and symbols. - */ - function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); - } - - /** - * The base implementation of `getTag` without fallbacks for buggy environments. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; - } - return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); - } - - /** - * The base implementation of `_.gt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, - * else `false`. - */ - function baseGt(value, other) { - return value > other; - } - - /** - * The base implementation of `_.has` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ - function baseHas(object, key) { - return object != null && hasOwnProperty.call(object, key); - } - - /** - * The base implementation of `_.hasIn` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ - function baseHasIn(object, key) { - return object != null && key in Object(object); - } - - /** - * The base implementation of `_.inRange` which doesn't coerce arguments. - * - * @private - * @param {number} number The number to check. - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @returns {boolean} Returns `true` if `number` is in the range, else `false`. - */ - function baseInRange(number, start, end) { - return number >= nativeMin(start, end) && number < nativeMax(start, end); - } - - /** - * The base implementation of methods like `_.intersection`, without support - * for iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of shared values. - */ - function baseIntersection(arrays, iteratee, comparator) { - var includes = comparator ? arrayIncludesWith : arrayIncludes, - length = arrays[0].length, - othLength = arrays.length, - othIndex = othLength, - caches = Array(othLength), - maxLength = Infinity, - result = []; - - while (othIndex--) { - var array = arrays[othIndex]; - if (othIndex && iteratee) { - array = arrayMap(array, baseUnary(iteratee)); - } - maxLength = nativeMin(array.length, maxLength); - caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; - } - array = arrays[0]; - - var index = -1, - seen = caches[0]; - - outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) - )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) - ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.invert` and `_.invertBy` which inverts - * `object` with values transformed by `iteratee` and set by `setter`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform values. - * @param {Object} accumulator The initial inverted object. - * @returns {Function} Returns `accumulator`. - */ - function baseInverter(object, setter, iteratee, accumulator) { - baseForOwn(object, function(value, key, object) { - setter(accumulator, iteratee(value), key, object); - }); - return accumulator; - } - - /** - * The base implementation of `_.invoke` without support for individual - * method arguments. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {Array} args The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. - */ - function baseInvoke(object, path, args) { - path = castPath(path, object); - object = parent(object, path); - var func = object == null ? object : object[toKey(last(path))]; - return func == null ? undefined : apply(func, object, args); - } - - /** - * The base implementation of `_.isArguments`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - */ - function baseIsArguments(value) { - return isObjectLike(value) && baseGetTag(value) == argsTag; - } - - /** - * The base implementation of `_.isArrayBuffer` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. - */ - function baseIsArrayBuffer(value) { - return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; - } - - /** - * The base implementation of `_.isDate` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. - */ - function baseIsDate(value) { - return isObjectLike(value) && baseGetTag(value) == dateTag; - } - - /** - * The base implementation of `_.isEqual` which supports partial comparisons - * and tracks traversed objects. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {boolean} bitmask The bitmask flags. - * 1 - Unordered comparison - * 2 - Partial comparison - * @param {Function} [customizer] The function to customize comparisons. - * @param {Object} [stack] Tracks traversed `value` and `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ - function baseIsEqual(value, other, bitmask, customizer, stack) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); - } - - /** - * A specialized version of `baseIsEqual` for arrays and objects which performs - * deep comparisons and tracks traversed objects enabling objects with circular - * references to be compared. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = objIsArr ? arrayTag : getTag(object), - othTag = othIsArr ? arrayTag : getTag(other); - - objTag = objTag == argsTag ? objectTag : objTag; - othTag = othTag == argsTag ? objectTag : othTag; - - var objIsObj = objTag == objectTag, - othIsObj = othTag == objectTag, - isSameTag = objTag == othTag; - - if (isSameTag && isBuffer(object)) { - if (!isBuffer(other)) { - return false; - } - objIsArr = true; - objIsObj = false; - } - if (isSameTag && !objIsObj) { - stack || (stack = new Stack); - return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); - } - if (!(bitmask & COMPARE_PARTIAL_FLAG)) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - - if (objIsWrapped || othIsWrapped) { - var objUnwrapped = objIsWrapped ? object.value() : object, - othUnwrapped = othIsWrapped ? other.value() : other; - - stack || (stack = new Stack); - return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); - } - } - if (!isSameTag) { - return false; - } - stack || (stack = new Stack); - return equalObjects(object, other, bitmask, customizer, equalFunc, stack); - } - - /** - * The base implementation of `_.isMap` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - */ - function baseIsMap(value) { - return isObjectLike(value) && getTag(value) == mapTag; - } - - /** - * The base implementation of `_.isMatch` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Array} matchData The property names, values, and compare flags to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - */ - function baseIsMatch(object, source, matchData, customizer) { - var index = matchData.length, - length = index, - noCustomizer = !customizer; - - if (object == null) { - return !length; - } - object = Object(object); - while (index--) { - var data = matchData[index]; - if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { - return false; - } - } - while (++index < length) { - data = matchData[index]; - var key = data[0], - objValue = object[key], - srcValue = data[1]; - - if (noCustomizer && data[2]) { - if (objValue === undefined && !(key in object)) { - return false; - } - } else { - var stack = new Stack; - if (customizer) { - var result = customizer(objValue, srcValue, key, object, source, stack); - } - if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { - return false; - } - } - } - return true; - } - - /** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ - function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); - } - - /** - * The base implementation of `_.isRegExp` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. - */ - function baseIsRegExp(value) { - return isObjectLike(value) && baseGetTag(value) == regexpTag; - } - - /** - * The base implementation of `_.isSet` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - */ - function baseIsSet(value) { - return isObjectLike(value) && getTag(value) == setTag; - } - - /** - * The base implementation of `_.isTypedArray` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - */ - function baseIsTypedArray(value) { - return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; - } - - /** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ - function baseIteratee(value) { - // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. - // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. - if (typeof value == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (typeof value == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); - } - - /** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; - } - - /** - * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeysIn(object) { - if (!isObject(object)) { - return nativeKeysIn(object); - } - var isProto = isPrototype(object), - result = []; - - for (var key in object) { - if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; - } - - /** - * The base implementation of `_.lt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, - * else `false`. - */ - function baseLt(value, other) { - return value < other; - } - - /** - * The base implementation of `_.map` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function baseMap(collection, iteratee) { - var index = -1, - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value, key, collection) { - result[++index] = iteratee(value, key, collection); - }); - return result; - } - - /** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new spec function. - */ - function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - return matchesStrictComparable(matchData[0][0], matchData[0][1]); - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; - } - - /** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. - */ - function baseMatchesProperty(path, srcValue) { - if (isKey(path) && isStrictComparable(srcValue)) { - return matchesStrictComparable(toKey(path), srcValue); - } - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); - }; - } - - /** - * The base implementation of `_.merge` without support for multiple sources. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {number} srcIndex The index of `source`. - * @param {Function} [customizer] The function to customize merged values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - */ - function baseMerge(object, source, srcIndex, customizer, stack) { - if (object === source) { - return; - } - baseFor(source, function(srcValue, key) { - if (isObject(srcValue)) { - stack || (stack = new Stack); - baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); - } - else { - var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; - - if (newValue === undefined) { - newValue = srcValue; - } - assignMergeValue(object, key, newValue); - } - }, keysIn); - } - - /** - * A specialized version of `baseMerge` for arrays and objects which performs - * deep merges and tracks traversed objects enabling objects with circular - * references to be merged. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {string} key The key of the value to merge. - * @param {number} srcIndex The index of `source`. - * @param {Function} mergeFunc The function to merge values. - * @param {Function} [customizer] The function to customize assigned values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - */ - function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { - var objValue = safeGet(object, key), - srcValue = safeGet(source, key), - stacked = stack.get(srcValue); - - if (stacked) { - assignMergeValue(object, key, stacked); - return; - } - var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; - - var isCommon = newValue === undefined; - - if (isCommon) { - var isArr = isArray(srcValue), - isBuff = !isArr && isBuffer(srcValue), - isTyped = !isArr && !isBuff && isTypedArray(srcValue); - - newValue = srcValue; - if (isArr || isBuff || isTyped) { - if (isArray(objValue)) { - newValue = objValue; - } - else if (isArrayLikeObject(objValue)) { - newValue = copyArray(objValue); - } - else if (isBuff) { - isCommon = false; - newValue = cloneBuffer(srcValue, true); - } - else if (isTyped) { - isCommon = false; - newValue = cloneTypedArray(srcValue, true); - } - else { - newValue = []; - } - } - else if (isPlainObject(srcValue) || isArguments(srcValue)) { - newValue = objValue; - if (isArguments(objValue)) { - newValue = toPlainObject(objValue); - } - else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { - newValue = initCloneObject(srcValue); - } - } - else { - isCommon = false; - } - } - if (isCommon) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, newValue); - mergeFunc(newValue, srcValue, srcIndex, customizer, stack); - stack['delete'](srcValue); - } - assignMergeValue(object, key, newValue); - } - - /** - * The base implementation of `_.nth` which doesn't coerce arguments. - * - * @private - * @param {Array} array The array to query. - * @param {number} n The index of the element to return. - * @returns {*} Returns the nth element of `array`. - */ - function baseNth(array, n) { - var length = array.length; - if (!length) { - return; - } - n += n < 0 ? length : 0; - return isIndex(n, length) ? array[n] : undefined; - } - - /** - * The base implementation of `_.orderBy` without param guards. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. - * @param {string[]} orders The sort orders of `iteratees`. - * @returns {Array} Returns the new sorted array. - */ - function baseOrderBy(collection, iteratees, orders) { - var index = -1; - iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee())); - - var result = baseMap(collection, function(value, key, collection) { - var criteria = arrayMap(iteratees, function(iteratee) { - return iteratee(value); - }); - return { 'criteria': criteria, 'index': ++index, 'value': value }; - }); - - return baseSortBy(result, function(object, other) { - return compareMultiple(object, other, orders); - }); - } - - /** - * The base implementation of `_.pick` without support for individual - * property identifiers. - * - * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @returns {Object} Returns the new object. - */ - function basePick(object, paths) { - return basePickBy(object, paths, function(value, path) { - return hasIn(object, path); - }); - } - - /** - * The base implementation of `_.pickBy` without support for iteratee shorthands. - * - * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @param {Function} predicate The function invoked per property. - * @returns {Object} Returns the new object. - */ - function basePickBy(object, paths, predicate) { - var index = -1, - length = paths.length, - result = {}; - - while (++index < length) { - var path = paths[index], - value = baseGet(object, path); - - if (predicate(value, path)) { - baseSet(result, castPath(path, object), value); - } - } - return result; - } - - /** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new accessor function. - */ - function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; - } - - /** - * The base implementation of `_.pullAllBy` without support for iteratee - * shorthands. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns `array`. - */ - function basePullAll(array, values, iteratee, comparator) { - var indexOf = comparator ? baseIndexOfWith : baseIndexOf, - index = -1, - length = values.length, - seen = array; - - if (array === values) { - values = copyArray(values); - } - if (iteratee) { - seen = arrayMap(array, baseUnary(iteratee)); - } - while (++index < length) { - var fromIndex = 0, - value = values[index], - computed = iteratee ? iteratee(value) : value; - - while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { - if (seen !== array) { - splice.call(seen, fromIndex, 1); - } - splice.call(array, fromIndex, 1); - } - } - return array; - } - - /** - * The base implementation of `_.pullAt` without support for individual - * indexes or capturing the removed elements. - * - * @private - * @param {Array} array The array to modify. - * @param {number[]} indexes The indexes of elements to remove. - * @returns {Array} Returns `array`. - */ - function basePullAt(array, indexes) { - var length = array ? indexes.length : 0, - lastIndex = length - 1; - - while (length--) { - var index = indexes[length]; - if (length == lastIndex || index !== previous) { - var previous = index; - if (isIndex(index)) { - splice.call(array, index, 1); - } else { - baseUnset(array, index); - } - } - } - return array; - } - - /** - * The base implementation of `_.random` without support for returning - * floating-point numbers. - * - * @private - * @param {number} lower The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the random number. - */ - function baseRandom(lower, upper) { - return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); - } - - /** - * The base implementation of `_.range` and `_.rangeRight` which doesn't - * coerce arguments. - * - * @private - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @param {number} step The value to increment or decrement by. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the range of numbers. - */ - function baseRange(start, end, step, fromRight) { - var index = -1, - length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), - result = Array(length); - - while (length--) { - result[fromRight ? length : ++index] = start; - start += step; - } - return result; - } - - /** - * The base implementation of `_.repeat` which doesn't coerce arguments. - * - * @private - * @param {string} string The string to repeat. - * @param {number} n The number of times to repeat the string. - * @returns {string} Returns the repeated string. - */ - function baseRepeat(string, n) { - var result = ''; - if (!string || n < 1 || n > MAX_SAFE_INTEGER) { - return result; - } - // Leverage the exponentiation by squaring algorithm for a faster repeat. - // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. - do { - if (n % 2) { - result += string; - } - n = nativeFloor(n / 2); - if (n) { - string += string; - } - } while (n); - - return result; - } - - /** - * The base implementation of `_.rest` which doesn't validate or coerce arguments. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - */ - function baseRest(func, start) { - return setToString(overRest(func, start, identity), func + ''); - } - - /** - * The base implementation of `_.sample`. - * - * @private - * @param {Array|Object} collection The collection to sample. - * @returns {*} Returns the random element. - */ - function baseSample(collection) { - return arraySample(values(collection)); - } - - /** - * The base implementation of `_.sampleSize` without param guards. - * - * @private - * @param {Array|Object} collection The collection to sample. - * @param {number} n The number of elements to sample. - * @returns {Array} Returns the random elements. - */ - function baseSampleSize(collection, n) { - var array = values(collection); - return shuffleSelf(array, baseClamp(n, 0, array.length)); - } - - /** - * The base implementation of `_.set`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. - */ - function baseSet(object, path, value, customizer) { - if (!isObject(object)) { - return object; - } - path = castPath(path, object); - - var index = -1, - length = path.length, - lastIndex = length - 1, - nested = object; - - while (nested != null && ++index < length) { - var key = toKey(path[index]), - newValue = value; - - if (index != lastIndex) { - var objValue = nested[key]; - newValue = customizer ? customizer(objValue, key, nested) : undefined; - if (newValue === undefined) { - newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); - } - } - assignValue(nested, key, newValue); - nested = nested[key]; - } - return object; - } - - /** - * The base implementation of `setData` without support for hot loop shorting. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ - var baseSetData = !metaMap ? identity : function(func, data) { - metaMap.set(func, data); - return func; - }; - - /** - * The base implementation of `setToString` without support for hot loop shorting. - * - * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. - */ - var baseSetToString = !defineProperty ? identity : function(func, string) { - return defineProperty(func, 'toString', { - 'configurable': true, - 'enumerable': false, - 'value': constant(string), - 'writable': true - }); - }; - - /** - * The base implementation of `_.shuffle`. - * - * @private - * @param {Array|Object} collection The collection to shuffle. - * @returns {Array} Returns the new shuffled array. - */ - function baseShuffle(collection) { - return shuffleSelf(values(collection)); - } - - /** - * The base implementation of `_.slice` without an iteratee call guard. - * - * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ - function baseSlice(array, start, end) { - var index = -1, - length = array.length; - - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = end > length ? length : end; - if (end < 0) { - end += length; - } - length = start > end ? 0 : ((end - start) >>> 0); - start >>>= 0; - - var result = Array(length); - while (++index < length) { - result[index] = array[index + start]; - } - return result; - } - - /** - * The base implementation of `_.some` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ - function baseSome(collection, predicate) { - var result; - - baseEach(collection, function(value, index, collection) { - result = predicate(value, index, collection); - return !result; - }); - return !!result; - } - - /** - * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which - * performs a binary search of `array` to determine the index at which `value` - * should be inserted into `array` in order to maintain its sort order. - * - * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - */ - function baseSortedIndex(array, value, retHighest) { - var low = 0, - high = array == null ? low : array.length; - - if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { - while (low < high) { - var mid = (low + high) >>> 1, - computed = array[mid]; - - if (computed !== null && !isSymbol(computed) && - (retHighest ? (computed <= value) : (computed < value))) { - low = mid + 1; - } else { - high = mid; - } - } - return high; - } - return baseSortedIndexBy(array, value, identity, retHighest); - } - - /** - * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` - * which invokes `iteratee` for `value` and each element of `array` to compute - * their sort ranking. The iteratee is invoked with one argument; (value). - * - * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} iteratee The iteratee invoked per element. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - */ - function baseSortedIndexBy(array, value, iteratee, retHighest) { - value = iteratee(value); - - var low = 0, - high = array == null ? 0 : array.length, - valIsNaN = value !== value, - valIsNull = value === null, - valIsSymbol = isSymbol(value), - valIsUndefined = value === undefined; - - while (low < high) { - var mid = nativeFloor((low + high) / 2), - computed = iteratee(array[mid]), - othIsDefined = computed !== undefined, - othIsNull = computed === null, - othIsReflexive = computed === computed, - othIsSymbol = isSymbol(computed); - - if (valIsNaN) { - var setLow = retHighest || othIsReflexive; - } else if (valIsUndefined) { - setLow = othIsReflexive && (retHighest || othIsDefined); - } else if (valIsNull) { - setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); - } else if (valIsSymbol) { - setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); - } else if (othIsNull || othIsSymbol) { - setLow = false; - } else { - setLow = retHighest ? (computed <= value) : (computed < value); - } - if (setLow) { - low = mid + 1; - } else { - high = mid; - } - } - return nativeMin(high, MAX_ARRAY_INDEX); - } - - /** - * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ - function baseSortedUniq(array, iteratee) { - var index = -1, - length = array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (!index || !eq(computed, seen)) { - var seen = computed; - result[resIndex++] = value === 0 ? 0 : value; - } - } - return result; - } - - /** - * The base implementation of `_.toNumber` which doesn't ensure correct - * conversions of binary, hexadecimal, or octal string values. - * - * @private - * @param {*} value The value to process. - * @returns {number} Returns the number. - */ - function baseToNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - return +value; - } - - /** - * The base implementation of `_.toString` which doesn't convert nullish - * values to empty strings. - * - * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. - */ - function baseToString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - if (isArray(value)) { - // Recursively convert values (susceptible to call stack limits). - return arrayMap(value, baseToString) + ''; - } - if (isSymbol(value)) { - return symbolToString ? symbolToString.call(value) : ''; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; - } - - /** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ - function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.unset`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The property path to unset. - * @returns {boolean} Returns `true` if the property is deleted, else `false`. - */ - function baseUnset(object, path) { - path = castPath(path, object); - object = parent(object, path); - return object == null || delete object[toKey(last(path))]; - } - - /** - * The base implementation of `_.update`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to update. - * @param {Function} updater The function to produce the updated value. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. - */ - function baseUpdate(object, path, updater, customizer) { - return baseSet(object, path, updater(baseGet(object, path)), customizer); - } - - /** - * The base implementation of methods like `_.dropWhile` and `_.takeWhile` - * without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to query. - * @param {Function} predicate The function invoked per iteration. - * @param {boolean} [isDrop] Specify dropping elements instead of taking them. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the slice of `array`. - */ - function baseWhile(array, predicate, isDrop, fromRight) { - var length = array.length, - index = fromRight ? length : -1; - - while ((fromRight ? index-- : ++index < length) && - predicate(array[index], index, array)) {} - - return isDrop - ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) - : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); - } - - /** - * The base implementation of `wrapperValue` which returns the result of - * performing a sequence of actions on the unwrapped `value`, where each - * successive action is supplied the return value of the previous. - * - * @private - * @param {*} value The unwrapped value. - * @param {Array} actions Actions to perform to resolve the unwrapped value. - * @returns {*} Returns the resolved value. - */ - function baseWrapperValue(value, actions) { - var result = value; - if (result instanceof LazyWrapper) { - result = result.value(); - } - return arrayReduce(actions, function(result, action) { - return action.func.apply(action.thisArg, arrayPush([result], action.args)); - }, result); - } - - /** - * The base implementation of methods like `_.xor`, without support for - * iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of values. - */ - function baseXor(arrays, iteratee, comparator) { - var length = arrays.length; - if (length < 2) { - return length ? baseUniq(arrays[0]) : []; - } - var index = -1, - result = Array(length); - - while (++index < length) { - var array = arrays[index], - othIndex = -1; - - while (++othIndex < length) { - if (othIndex != index) { - result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); - } - } - } - return baseUniq(baseFlatten(result, 1), iteratee, comparator); - } - - /** - * This base implementation of `_.zipObject` which assigns values using `assignFunc`. - * - * @private - * @param {Array} props The property identifiers. - * @param {Array} values The property values. - * @param {Function} assignFunc The function to assign values. - * @returns {Object} Returns the new object. - */ - function baseZipObject(props, values, assignFunc) { - var index = -1, - length = props.length, - valsLength = values.length, - result = {}; - - while (++index < length) { - var value = index < valsLength ? values[index] : undefined; - assignFunc(result, props[index], value); - } - return result; - } - - /** - * Casts `value` to an empty array if it's not an array like object. - * - * @private - * @param {*} value The value to inspect. - * @returns {Array|Object} Returns the cast array-like object. - */ - function castArrayLikeObject(value) { - return isArrayLikeObject(value) ? value : []; - } - - /** - * Casts `value` to `identity` if it's not a function. - * - * @private - * @param {*} value The value to inspect. - * @returns {Function} Returns cast function. - */ - function castFunction(value) { - return typeof value == 'function' ? value : identity; - } - - /** - * Casts `value` to a path array if it's not one. - * - * @private - * @param {*} value The value to inspect. - * @param {Object} [object] The object to query keys on. - * @returns {Array} Returns the cast property path array. - */ - function castPath(value, object) { - if (isArray(value)) { - return value; - } - return isKey(value, object) ? [value] : stringToPath(toString(value)); - } - - /** - * A `baseRest` alias which can be replaced with `identity` by module - * replacement plugins. - * - * @private - * @type {Function} - * @param {Function} func The function to apply a rest parameter to. - * @returns {Function} Returns the new function. - */ - var castRest = baseRest; - - /** - * Casts `array` to a slice if it's needed. - * - * @private - * @param {Array} array The array to inspect. - * @param {number} start The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the cast slice. - */ - function castSlice(array, start, end) { - var length = array.length; - end = end === undefined ? length : end; - return (!start && end >= length) ? array : baseSlice(array, start, end); - } - - /** - * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). - * - * @private - * @param {number|Object} id The timer id or timeout object of the timer to clear. - */ - var clearTimeout = ctxClearTimeout || function(id) { - return root.clearTimeout(id); - }; - - /** - * Creates a clone of `buffer`. - * - * @private - * @param {Buffer} buffer The buffer to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Buffer} Returns the cloned buffer. - */ - function cloneBuffer(buffer, isDeep) { - if (isDeep) { - return buffer.slice(); - } - var length = buffer.length, - result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); - - buffer.copy(result); - return result; - } - - /** - * Creates a clone of `arrayBuffer`. - * - * @private - * @param {ArrayBuffer} arrayBuffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. - */ - function cloneArrayBuffer(arrayBuffer) { - var result = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array(result).set(new Uint8Array(arrayBuffer)); - return result; - } - - /** - * Creates a clone of `dataView`. - * - * @private - * @param {Object} dataView The data view to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned data view. - */ - function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; - return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); - } - - /** - * Creates a clone of `regexp`. - * - * @private - * @param {Object} regexp The regexp to clone. - * @returns {Object} Returns the cloned regexp. - */ - function cloneRegExp(regexp) { - var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); - result.lastIndex = regexp.lastIndex; - return result; - } - - /** - * Creates a clone of the `symbol` object. - * - * @private - * @param {Object} symbol The symbol object to clone. - * @returns {Object} Returns the cloned symbol object. - */ - function cloneSymbol(symbol) { - return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; - } - - /** - * Creates a clone of `typedArray`. - * - * @private - * @param {Object} typedArray The typed array to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned typed array. - */ - function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); - } - - /** - * Compares values to sort them in ascending order. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {number} Returns the sort order indicator for `value`. - */ - function compareAscending(value, other) { - if (value !== other) { - var valIsDefined = value !== undefined, - valIsNull = value === null, - valIsReflexive = value === value, - valIsSymbol = isSymbol(value); - - var othIsDefined = other !== undefined, - othIsNull = other === null, - othIsReflexive = other === other, - othIsSymbol = isSymbol(other); - - if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || - (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || - (valIsNull && othIsDefined && othIsReflexive) || - (!valIsDefined && othIsReflexive) || - !valIsReflexive) { - return 1; - } - if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || - (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || - (othIsNull && valIsDefined && valIsReflexive) || - (!othIsDefined && valIsReflexive) || - !othIsReflexive) { - return -1; - } - } - return 0; - } - - /** - * Used by `_.orderBy` to compare multiple properties of a value to another - * and stable sort them. - * - * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, - * specify an order of "desc" for descending or "asc" for ascending sort order - * of corresponding values. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {boolean[]|string[]} orders The order to sort by for each property. - * @returns {number} Returns the sort order indicator for `object`. - */ - function compareMultiple(object, other, orders) { - var index = -1, - objCriteria = object.criteria, - othCriteria = other.criteria, - length = objCriteria.length, - ordersLength = orders.length; - - while (++index < length) { - var result = compareAscending(objCriteria[index], othCriteria[index]); - if (result) { - if (index >= ordersLength) { - return result; - } - var order = orders[index]; - return result * (order == 'desc' ? -1 : 1); - } - } - // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications - // that causes it, under certain circumstances, to provide the same value for - // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 - // for more details. - // - // This also ensures a stable sort in V8 and other engines. - // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. - return object.index - other.index; - } - - /** - * Creates an array that is the composition of partially applied arguments, - * placeholders, and provided arguments into a single array of arguments. - * - * @private - * @param {Array} args The provided arguments. - * @param {Array} partials The arguments to prepend to those provided. - * @param {Array} holders The `partials` placeholder indexes. - * @params {boolean} [isCurried] Specify composing for a curried function. - * @returns {Array} Returns the new array of composed arguments. - */ - function composeArgs(args, partials, holders, isCurried) { - var argsIndex = -1, - argsLength = args.length, - holdersLength = holders.length, - leftIndex = -1, - leftLength = partials.length, - rangeLength = nativeMax(argsLength - holdersLength, 0), - result = Array(leftLength + rangeLength), - isUncurried = !isCurried; - - while (++leftIndex < leftLength) { - result[leftIndex] = partials[leftIndex]; - } - while (++argsIndex < holdersLength) { - if (isUncurried || argsIndex < argsLength) { - result[holders[argsIndex]] = args[argsIndex]; - } - } - while (rangeLength--) { - result[leftIndex++] = args[argsIndex++]; - } - return result; - } - - /** - * This function is like `composeArgs` except that the arguments composition - * is tailored for `_.partialRight`. - * - * @private - * @param {Array} args The provided arguments. - * @param {Array} partials The arguments to append to those provided. - * @param {Array} holders The `partials` placeholder indexes. - * @params {boolean} [isCurried] Specify composing for a curried function. - * @returns {Array} Returns the new array of composed arguments. - */ - function composeArgsRight(args, partials, holders, isCurried) { - var argsIndex = -1, - argsLength = args.length, - holdersIndex = -1, - holdersLength = holders.length, - rightIndex = -1, - rightLength = partials.length, - rangeLength = nativeMax(argsLength - holdersLength, 0), - result = Array(rangeLength + rightLength), - isUncurried = !isCurried; - - while (++argsIndex < rangeLength) { - result[argsIndex] = args[argsIndex]; - } - var offset = argsIndex; - while (++rightIndex < rightLength) { - result[offset + rightIndex] = partials[rightIndex]; - } - while (++holdersIndex < holdersLength) { - if (isUncurried || argsIndex < argsLength) { - result[offset + holders[holdersIndex]] = args[argsIndex++]; - } - } - return result; - } - - /** - * Copies the values of `source` to `array`. - * - * @private - * @param {Array} source The array to copy values from. - * @param {Array} [array=[]] The array to copy values to. - * @returns {Array} Returns `array`. - */ - function copyArray(source, array) { - var index = -1, - length = source.length; - - array || (array = Array(length)); - while (++index < length) { - array[index] = source[index]; - } - return array; - } - - /** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property identifiers to copy. - * @param {Object} [object={}] The object to copy properties to. - * @param {Function} [customizer] The function to customize copied values. - * @returns {Object} Returns `object`. - */ - function copyObject(source, props, object, customizer) { - var isNew = !object; - object || (object = {}); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - - var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; - - if (newValue === undefined) { - newValue = source[key]; - } - if (isNew) { - baseAssignValue(object, key, newValue); - } else { - assignValue(object, key, newValue); - } - } - return object; - } - - /** - * Copies own symbols of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ - function copySymbols(source, object) { - return copyObject(source, getSymbols(source), object); - } - - /** - * Copies own and inherited symbols of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ - function copySymbolsIn(source, object) { - return copyObject(source, getSymbolsIn(source), object); - } - - /** - * Creates a function like `_.groupBy`. - * - * @private - * @param {Function} setter The function to set accumulator values. - * @param {Function} [initializer] The accumulator object initializer. - * @returns {Function} Returns the new aggregator function. - */ - function createAggregator(setter, initializer) { - return function(collection, iteratee) { - var func = isArray(collection) ? arrayAggregator : baseAggregator, - accumulator = initializer ? initializer() : {}; - - return func(collection, setter, getIteratee(iteratee, 2), accumulator); - }; - } - - /** - * Creates a function like `_.assign`. - * - * @private - * @param {Function} assigner The function to assign values. - * @returns {Function} Returns the new assigner function. - */ - function createAssigner(assigner) { - return baseRest(function(object, sources) { - var index = -1, - length = sources.length, - customizer = length > 1 ? sources[length - 1] : undefined, - guard = length > 2 ? sources[2] : undefined; - - customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; - - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - customizer = length < 3 ? undefined : customizer; - length = 1; - } - object = Object(object); - while (++index < length) { - var source = sources[index]; - if (source) { - assigner(object, source, index, customizer); - } - } - return object; - }); - } - - /** - * Creates a `baseEach` or `baseEachRight` function. - * - * @private - * @param {Function} eachFunc The function to iterate over a collection. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ - function createBaseEach(eachFunc, fromRight) { - return function(collection, iteratee) { - if (collection == null) { - return collection; - } - if (!isArrayLike(collection)) { - return eachFunc(collection, iteratee); - } - var length = collection.length, - index = fromRight ? length : -1, - iterable = Object(collection); - - while ((fromRight ? index-- : ++index < length)) { - if (iteratee(iterable[index], index, iterable) === false) { - break; - } - } - return collection; - }; - } - - /** - * Creates a base function for methods like `_.forIn` and `_.forOwn`. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ - function createBaseFor(fromRight) { - return function(object, iteratee, keysFunc) { - var index = -1, - iterable = Object(object), - props = keysFunc(object), - length = props.length; - - while (length--) { - var key = props[fromRight ? length : ++index]; - if (iteratee(iterable[key], key, iterable) === false) { - break; - } - } - return object; - }; - } - - /** - * Creates a function that wraps `func` to invoke it with the optional `this` - * binding of `thisArg`. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} [thisArg] The `this` binding of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createBind(func, bitmask, thisArg) { - var isBind = bitmask & WRAP_BIND_FLAG, - Ctor = createCtor(func); - - function wrapper() { - var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - return fn.apply(isBind ? thisArg : this, arguments); - } - return wrapper; - } - - /** - * Creates a function like `_.lowerFirst`. - * - * @private - * @param {string} methodName The name of the `String` case method to use. - * @returns {Function} Returns the new case function. - */ - function createCaseFirst(methodName) { - return function(string) { - string = toString(string); - - var strSymbols = hasUnicode(string) - ? stringToArray(string) - : undefined; - - var chr = strSymbols - ? strSymbols[0] - : string.charAt(0); - - var trailing = strSymbols - ? castSlice(strSymbols, 1).join('') - : string.slice(1); - - return chr[methodName]() + trailing; - }; - } - - /** - * Creates a function like `_.camelCase`. - * - * @private - * @param {Function} callback The function to combine each word. - * @returns {Function} Returns the new compounder function. - */ - function createCompounder(callback) { - return function(string) { - return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); - }; - } - - /** - * Creates a function that produces an instance of `Ctor` regardless of - * whether it was invoked as part of a `new` expression or by `call` or `apply`. - * - * @private - * @param {Function} Ctor The constructor to wrap. - * @returns {Function} Returns the new wrapped function. - */ - function createCtor(Ctor) { - return function() { - // Use a `switch` statement to work with class constructors. See - // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist - // for more details. - var args = arguments; - switch (args.length) { - case 0: return new Ctor; - case 1: return new Ctor(args[0]); - case 2: return new Ctor(args[0], args[1]); - case 3: return new Ctor(args[0], args[1], args[2]); - case 4: return new Ctor(args[0], args[1], args[2], args[3]); - case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); - case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); - case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); - } - var thisBinding = baseCreate(Ctor.prototype), - result = Ctor.apply(thisBinding, args); - - // Mimic the constructor's `return` behavior. - // See https://es5.github.io/#x13.2.2 for more details. - return isObject(result) ? result : thisBinding; - }; - } - - /** - * Creates a function that wraps `func` to enable currying. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {number} arity The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createCurry(func, bitmask, arity) { - var Ctor = createCtor(func); - - function wrapper() { - var length = arguments.length, - args = Array(length), - index = length, - placeholder = getHolder(wrapper); - - while (index--) { - args[index] = arguments[index]; - } - var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); - - length -= holders.length; - if (length < arity) { - return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); - } - var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - return apply(fn, this, args); - } - return wrapper; - } - - /** - * Creates a `_.find` or `_.findLast` function. - * - * @private - * @param {Function} findIndexFunc The function to find the collection index. - * @returns {Function} Returns the new find function. - */ - function createFind(findIndexFunc) { - return function(collection, predicate, fromIndex) { - var iterable = Object(collection); - if (!isArrayLike(collection)) { - var iteratee = getIteratee(predicate, 3); - collection = keys(collection); - predicate = function(key) { return iteratee(iterable[key], key, iterable); }; - } - var index = findIndexFunc(collection, predicate, fromIndex); - return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; - }; - } - - /** - * Creates a `_.flow` or `_.flowRight` function. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new flow function. - */ - function createFlow(fromRight) { - return flatRest(function(funcs) { - var length = funcs.length, - index = length, - prereq = LodashWrapper.prototype.thru; - - if (fromRight) { - funcs.reverse(); - } - while (index--) { - var func = funcs[index]; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - if (prereq && !wrapper && getFuncName(func) == 'wrapper') { - var wrapper = new LodashWrapper([], true); - } - } - index = wrapper ? index : length; - while (++index < length) { - func = funcs[index]; - - var funcName = getFuncName(func), - data = funcName == 'wrapper' ? getData(func) : undefined; - - if (data && isLaziable(data[0]) && - data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && - !data[4].length && data[9] == 1 - ) { - wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); - } else { - wrapper = (func.length == 1 && isLaziable(func)) - ? wrapper[funcName]() - : wrapper.thru(func); - } - } - return function() { - var args = arguments, - value = args[0]; - - if (wrapper && args.length == 1 && isArray(value)) { - return wrapper.plant(value).value(); - } - var index = 0, - result = length ? funcs[index].apply(this, args) : value; - - while (++index < length) { - result = funcs[index].call(this, result); - } - return result; - }; - }); - } - - /** - * Creates a function that wraps `func` to invoke it with optional `this` - * binding of `thisArg`, partial application, and currying. - * - * @private - * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to - * the new function. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [partialsRight] The arguments to append to those provided - * to the new function. - * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { - var isAry = bitmask & WRAP_ARY_FLAG, - isBind = bitmask & WRAP_BIND_FLAG, - isBindKey = bitmask & WRAP_BIND_KEY_FLAG, - isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), - isFlip = bitmask & WRAP_FLIP_FLAG, - Ctor = isBindKey ? undefined : createCtor(func); - - function wrapper() { - var length = arguments.length, - args = Array(length), - index = length; - - while (index--) { - args[index] = arguments[index]; - } - if (isCurried) { - var placeholder = getHolder(wrapper), - holdersCount = countHolders(args, placeholder); - } - if (partials) { - args = composeArgs(args, partials, holders, isCurried); - } - if (partialsRight) { - args = composeArgsRight(args, partialsRight, holdersRight, isCurried); - } - length -= holdersCount; - if (isCurried && length < arity) { - var newHolders = replaceHolders(args, placeholder); - return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length - ); - } - var thisBinding = isBind ? thisArg : this, - fn = isBindKey ? thisBinding[func] : func; - - length = args.length; - if (argPos) { - args = reorder(args, argPos); - } else if (isFlip && length > 1) { - args.reverse(); - } - if (isAry && ary < length) { - args.length = ary; - } - if (this && this !== root && this instanceof wrapper) { - fn = Ctor || createCtor(fn); - } - return fn.apply(thisBinding, args); - } - return wrapper; - } - - /** - * Creates a function like `_.invertBy`. - * - * @private - * @param {Function} setter The function to set accumulator values. - * @param {Function} toIteratee The function to resolve iteratees. - * @returns {Function} Returns the new inverter function. - */ - function createInverter(setter, toIteratee) { - return function(object, iteratee) { - return baseInverter(object, setter, toIteratee(iteratee), {}); - }; - } - - /** - * Creates a function that performs a mathematical operation on two values. - * - * @private - * @param {Function} operator The function to perform the operation. - * @param {number} [defaultValue] The value used for `undefined` arguments. - * @returns {Function} Returns the new mathematical operation function. - */ - function createMathOperation(operator, defaultValue) { - return function(value, other) { - var result; - if (value === undefined && other === undefined) { - return defaultValue; - } - if (value !== undefined) { - result = value; - } - if (other !== undefined) { - if (result === undefined) { - return other; - } - if (typeof value == 'string' || typeof other == 'string') { - value = baseToString(value); - other = baseToString(other); - } else { - value = baseToNumber(value); - other = baseToNumber(other); - } - result = operator(value, other); - } - return result; - }; - } - - /** - * Creates a function like `_.over`. - * - * @private - * @param {Function} arrayFunc The function to iterate over iteratees. - * @returns {Function} Returns the new over function. - */ - function createOver(arrayFunc) { - return flatRest(function(iteratees) { - iteratees = arrayMap(iteratees, baseUnary(getIteratee())); - return baseRest(function(args) { - var thisArg = this; - return arrayFunc(iteratees, function(iteratee) { - return apply(iteratee, thisArg, args); - }); - }); - }); - } - - /** - * Creates the padding for `string` based on `length`. The `chars` string - * is truncated if the number of characters exceeds `length`. - * - * @private - * @param {number} length The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padding for `string`. - */ - function createPadding(length, chars) { - chars = chars === undefined ? ' ' : baseToString(chars); - - var charsLength = chars.length; - if (charsLength < 2) { - return charsLength ? baseRepeat(chars, length) : chars; - } - var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); - return hasUnicode(chars) - ? castSlice(stringToArray(result), 0, length).join('') - : result.slice(0, length); - } - - /** - * Creates a function that wraps `func` to invoke it with the `this` binding - * of `thisArg` and `partials` prepended to the arguments it receives. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} partials The arguments to prepend to those provided to - * the new function. - * @returns {Function} Returns the new wrapped function. - */ - function createPartial(func, bitmask, thisArg, partials) { - var isBind = bitmask & WRAP_BIND_FLAG, - Ctor = createCtor(func); - - function wrapper() { - var argsIndex = -1, - argsLength = arguments.length, - leftIndex = -1, - leftLength = partials.length, - args = Array(leftLength + argsLength), - fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - - while (++leftIndex < leftLength) { - args[leftIndex] = partials[leftIndex]; - } - while (argsLength--) { - args[leftIndex++] = arguments[++argsIndex]; - } - return apply(fn, isBind ? thisArg : this, args); - } - return wrapper; - } - - /** - * Creates a `_.range` or `_.rangeRight` function. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new range function. - */ - function createRange(fromRight) { - return function(start, end, step) { - if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { - end = step = undefined; - } - // Ensure the sign of `-0` is preserved. - start = toFinite(start); - if (end === undefined) { - end = start; - start = 0; - } else { - end = toFinite(end); - } - step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); - return baseRange(start, end, step, fromRight); - }; - } - - /** - * Creates a function that performs a relational operation on two values. - * - * @private - * @param {Function} operator The function to perform the operation. - * @returns {Function} Returns the new relational operation function. - */ - function createRelationalOperation(operator) { - return function(value, other) { - if (!(typeof value == 'string' && typeof other == 'string')) { - value = toNumber(value); - other = toNumber(other); - } - return operator(value, other); - }; - } - - /** - * Creates a function that wraps `func` to continue currying. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {Function} wrapFunc The function to create the `func` wrapper. - * @param {*} placeholder The placeholder value. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to - * the new function. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { - var isCurry = bitmask & WRAP_CURRY_FLAG, - newHolders = isCurry ? holders : undefined, - newHoldersRight = isCurry ? undefined : holders, - newPartials = isCurry ? partials : undefined, - newPartialsRight = isCurry ? undefined : partials; - - bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); - bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); - - if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { - bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); - } - var newData = [ - func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, - newHoldersRight, argPos, ary, arity - ]; - - var result = wrapFunc.apply(undefined, newData); - if (isLaziable(func)) { - setData(result, newData); - } - result.placeholder = placeholder; - return setWrapToString(result, func, bitmask); - } - - /** - * Creates a function like `_.round`. - * - * @private - * @param {string} methodName The name of the `Math` method to use when rounding. - * @returns {Function} Returns the new round function. - */ - function createRound(methodName) { - var func = Math[methodName]; - return function(number, precision) { - number = toNumber(number); - precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); - if (precision) { - // Shift with exponential notation to avoid floating-point issues. - // See [MDN](https://mdn.io/round#Examples) for more details. - var pair = (toString(number) + 'e').split('e'), - value = func(pair[0] + 'e' + (+pair[1] + precision)); - - pair = (toString(value) + 'e').split('e'); - return +(pair[0] + 'e' + (+pair[1] - precision)); - } - return func(number); - }; - } - - /** - * Creates a set object of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ - var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { - return new Set(values); - }; - - /** - * Creates a `_.toPairs` or `_.toPairsIn` function. - * - * @private - * @param {Function} keysFunc The function to get the keys of a given object. - * @returns {Function} Returns the new pairs function. - */ - function createToPairs(keysFunc) { - return function(object) { - var tag = getTag(object); - if (tag == mapTag) { - return mapToArray(object); - } - if (tag == setTag) { - return setToPairs(object); - } - return baseToPairs(object, keysFunc(object)); - }; - } - - /** - * Creates a function that either curries or invokes `func` with optional - * `this` binding and partially applied arguments. - * - * @private - * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask flags. - * 1 - `_.bind` - * 2 - `_.bindKey` - * 4 - `_.curry` or `_.curryRight` of a bound function - * 8 - `_.curry` - * 16 - `_.curryRight` - * 32 - `_.partial` - * 64 - `_.partialRight` - * 128 - `_.rearg` - * 256 - `_.ary` - * 512 - `_.flip` - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to be partially applied. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { - var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; - if (!isBindKey && typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - var length = partials ? partials.length : 0; - if (!length) { - bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); - partials = holders = undefined; - } - ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); - arity = arity === undefined ? arity : toInteger(arity); - length -= holders ? holders.length : 0; - - if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { - var partialsRight = partials, - holdersRight = holders; - - partials = holders = undefined; - } - var data = isBindKey ? undefined : getData(func); - - var newData = [ - func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, - argPos, ary, arity - ]; - - if (data) { - mergeData(newData, data); - } - func = newData[0]; - bitmask = newData[1]; - thisArg = newData[2]; - partials = newData[3]; - holders = newData[4]; - arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); - - if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { - bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); - } - if (!bitmask || bitmask == WRAP_BIND_FLAG) { - var result = createBind(func, bitmask, thisArg); - } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { - result = createCurry(func, bitmask, arity); - } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { - result = createPartial(func, bitmask, thisArg, partials); - } else { - result = createHybrid.apply(undefined, newData); - } - var setter = data ? baseSetData : setData; - return setWrapToString(setter(result, newData), func, bitmask); - } - - /** - * Used by `_.defaults` to customize its `_.assignIn` use to assign properties - * of source objects to the destination object for all destination properties - * that resolve to `undefined`. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to assign. - * @param {Object} object The parent object of `objValue`. - * @returns {*} Returns the value to assign. - */ - function customDefaultsAssignIn(objValue, srcValue, key, object) { - if (objValue === undefined || - (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { - return srcValue; - } - return objValue; - } - - /** - * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source - * objects into destination objects that are passed thru. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to merge. - * @param {Object} object The parent object of `objValue`. - * @param {Object} source The parent object of `srcValue`. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - * @returns {*} Returns the value to assign. - */ - function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { - if (isObject(objValue) && isObject(srcValue)) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, objValue); - baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); - stack['delete'](srcValue); - } - return objValue; - } - - /** - * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain - * objects. - * - * @private - * @param {*} value The value to inspect. - * @param {string} key The key of the property to inspect. - * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. - */ - function customOmitClone(value) { - return isPlainObject(value) ? undefined : value; - } - - /** - * A specialized version of `baseIsEqualDeep` for arrays with support for - * partial deep comparisons. - * - * @private - * @param {Array} array The array to compare. - * @param {Array} other The other array to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `array` and `other` objects. - * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. - */ - function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - arrLength = array.length, - othLength = other.length; - - if (arrLength != othLength && !(isPartial && othLength > arrLength)) { - return false; - } - // Assume cyclic values are equal. - var stacked = stack.get(array); - if (stacked && stack.get(other)) { - return stacked == other; - } - var index = -1, - result = true, - seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; - - stack.set(array, other); - stack.set(other, array); - - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); - } - if (compared !== undefined) { - if (compared) { - continue; - } - result = false; - break; - } - // Recursively compare arrays (susceptible to call stack limits). - if (seen) { - if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { - result = false; - break; - } - } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { - result = false; - break; - } - } - stack['delete'](array); - stack['delete'](other); - return result; - } - - /** - * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `toStringTag`. - * - * **Note:** This function only supports comparing values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {string} tag The `toStringTag` of the objects to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { - switch (tag) { - case dataViewTag: - if ((object.byteLength != other.byteLength) || - (object.byteOffset != other.byteOffset)) { - return false; - } - object = object.buffer; - other = other.buffer; - - case arrayBufferTag: - if ((object.byteLength != other.byteLength) || - !equalFunc(new Uint8Array(object), new Uint8Array(other))) { - return false; - } - return true; - - case boolTag: - case dateTag: - case numberTag: - // Coerce booleans to `1` or `0` and dates to milliseconds. - // Invalid dates are coerced to `NaN`. - return eq(+object, +other); - - case errorTag: - return object.name == other.name && object.message == other.message; - - case regexpTag: - case stringTag: - // Coerce regexes to strings and treat strings, primitives and objects, - // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring - // for more details. - return object == (other + ''); - - case mapTag: - var convert = mapToArray; - - case setTag: - var isPartial = bitmask & COMPARE_PARTIAL_FLAG; - convert || (convert = setToArray); - - if (object.size != other.size && !isPartial) { - return false; - } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked) { - return stacked == other; - } - bitmask |= COMPARE_UNORDERED_FLAG; - - // Recursively compare objects (susceptible to call stack limits). - stack.set(object, other); - var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); - stack['delete'](object); - return result; - - case symbolTag: - if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other); - } - } - return false; - } - - /** - * A specialized version of `baseIsEqualDeep` for objects with support for - * partial deep comparisons. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - objProps = getAllKeys(object), - objLength = objProps.length, - othProps = getAllKeys(other), - othLength = othProps.length; - - if (objLength != othLength && !isPartial) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { - return false; - } - } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked && stack.get(other)) { - return stacked == other; - } - var result = true; - stack.set(object, other); - stack.set(other, object); - - var skipCtor = isPartial; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); - } - // Recursively compare objects (susceptible to call stack limits). - if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { - result = false; - break; - } - skipCtor || (skipCtor = key == 'constructor'); - } - if (result && !skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - - // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && - ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { - result = false; - } - } - stack['delete'](object); - stack['delete'](other); - return result; - } - - /** - * A specialized version of `baseRest` which flattens the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @returns {Function} Returns the new function. - */ - function flatRest(func) { - return setToString(overRest(func, undefined, flatten), func + ''); - } - - /** - * Creates an array of own enumerable property names and symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ - function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); - } - - /** - * Creates an array of own and inherited enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ - function getAllKeysIn(object) { - return baseGetAllKeys(object, keysIn, getSymbolsIn); - } - - /** - * Gets metadata for `func`. - * - * @private - * @param {Function} func The function to query. - * @returns {*} Returns the metadata for `func`. - */ - var getData = !metaMap ? noop : function(func) { - return metaMap.get(func); - }; - - /** - * Gets the name of `func`. - * - * @private - * @param {Function} func The function to query. - * @returns {string} Returns the function name. - */ - function getFuncName(func) { - var result = (func.name + ''), - array = realNames[result], - length = hasOwnProperty.call(realNames, result) ? array.length : 0; - - while (length--) { - var data = array[length], - otherFunc = data.func; - if (otherFunc == null || otherFunc == func) { - return data.name; - } - } - return result; - } - - /** - * Gets the argument placeholder value for `func`. - * - * @private - * @param {Function} func The function to inspect. - * @returns {*} Returns the placeholder value. - */ - function getHolder(func) { - var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; - return object.placeholder; - } - - /** - * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, - * this function returns the custom method, otherwise it returns `baseIteratee`. - * If arguments are provided, the chosen function is invoked with them and - * its result is returned. - * - * @private - * @param {*} [value] The value to convert to an iteratee. - * @param {number} [arity] The arity of the created iteratee. - * @returns {Function} Returns the chosen function or its result. - */ - function getIteratee() { - var result = lodash.iteratee || iteratee; - result = result === iteratee ? baseIteratee : result; - return arguments.length ? result(arguments[0], arguments[1]) : result; - } - - /** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ - function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; - } - - /** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ - function getMatchData(object) { - var result = keys(object), - length = result.length; - - while (length--) { - var key = result[length], - value = object[key]; - - result[length] = [key, value, isStrictComparable(value)]; - } - return result; - } - - /** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ - function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; - } - - /** - * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the raw `toStringTag`. - */ - function getRawTag(value) { - var isOwn = hasOwnProperty.call(value, symToStringTag), - tag = value[symToStringTag]; - - try { - value[symToStringTag] = undefined; - var unmasked = true; - } catch (e) {} - - var result = nativeObjectToString.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag] = tag; - } else { - delete value[symToStringTag]; - } - } - return result; - } - - /** - * Creates an array of the own enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbols = !nativeGetSymbols ? stubArray : function(object) { - if (object == null) { - return []; - } - object = Object(object); - return arrayFilter(nativeGetSymbols(object), function(symbol) { - return propertyIsEnumerable.call(object, symbol); - }); - }; - - /** - * Creates an array of the own and inherited enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { - var result = []; - while (object) { - arrayPush(result, getSymbols(object)); - object = getPrototype(object); - } - return result; - }; - - /** - * Gets the `toStringTag` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - var getTag = baseGetTag; - - // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. - if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || - (Map && getTag(new Map) != mapTag) || - (Promise && getTag(Promise.resolve()) != promiseTag) || - (Set && getTag(new Set) != setTag) || - (WeakMap && getTag(new WeakMap) != weakMapTag)) { - getTag = function(value) { - var result = baseGetTag(value), - Ctor = result == objectTag ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : ''; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: return dataViewTag; - case mapCtorString: return mapTag; - case promiseCtorString: return promiseTag; - case setCtorString: return setTag; - case weakMapCtorString: return weakMapTag; - } - } - return result; - }; - } - - /** - * Gets the view, applying any `transforms` to the `start` and `end` positions. - * - * @private - * @param {number} start The start of the view. - * @param {number} end The end of the view. - * @param {Array} transforms The transformations to apply to the view. - * @returns {Object} Returns an object containing the `start` and `end` - * positions of the view. - */ - function getView(start, end, transforms) { - var index = -1, - length = transforms.length; - - while (++index < length) { - var data = transforms[index], - size = data.size; - - switch (data.type) { - case 'drop': start += size; break; - case 'dropRight': end -= size; break; - case 'take': end = nativeMin(end, start + size); break; - case 'takeRight': start = nativeMax(start, end - size); break; - } - } - return { 'start': start, 'end': end }; - } - - /** - * Extracts wrapper details from the `source` body comment. - * - * @private - * @param {string} source The source to inspect. - * @returns {Array} Returns the wrapper details. - */ - function getWrapDetails(source) { - var match = source.match(reWrapDetails); - return match ? match[1].split(reSplitDetails) : []; - } - - /** - * Checks if `path` exists on `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @param {Function} hasFunc The function to check properties. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - */ - function hasPath(object, path, hasFunc) { - path = castPath(path, object); - - var index = -1, - length = path.length, - result = false; - - while (++index < length) { - var key = toKey(path[index]); - if (!(result = object != null && hasFunc(object, key))) { - break; - } - object = object[key]; - } - if (result || ++index != length) { - return result; - } - length = object == null ? 0 : object.length; - return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); - } - - /** - * Initializes an array clone. - * - * @private - * @param {Array} array The array to clone. - * @returns {Array} Returns the initialized clone. - */ - function initCloneArray(array) { - var length = array.length, - result = new array.constructor(length); - - // Add properties assigned by `RegExp#exec`. - if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { - result.index = array.index; - result.input = array.input; - } - return result; - } - - /** - * Initializes an object clone. - * - * @private - * @param {Object} object The object to clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneObject(object) { - return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; - } - - /** - * Initializes an object clone based on its `toStringTag`. - * - * **Note:** This function only supports cloning values with tags of - * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. - * - * @private - * @param {Object} object The object to clone. - * @param {string} tag The `toStringTag` of the object to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneByTag(object, tag, isDeep) { - var Ctor = object.constructor; - switch (tag) { - case arrayBufferTag: - return cloneArrayBuffer(object); - - case boolTag: - case dateTag: - return new Ctor(+object); - - case dataViewTag: - return cloneDataView(object, isDeep); - - case float32Tag: case float64Tag: - case int8Tag: case int16Tag: case int32Tag: - case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: - return cloneTypedArray(object, isDeep); - - case mapTag: - return new Ctor; - - case numberTag: - case stringTag: - return new Ctor(object); - - case regexpTag: - return cloneRegExp(object); - - case setTag: - return new Ctor; - - case symbolTag: - return cloneSymbol(object); - } - } - - /** - * Inserts wrapper `details` in a comment at the top of the `source` body. - * - * @private - * @param {string} source The source to modify. - * @returns {Array} details The details to insert. - * @returns {string} Returns the modified source. - */ - function insertWrapDetails(source, details) { - var length = details.length; - if (!length) { - return source; - } - var lastIndex = length - 1; - details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; - details = details.join(length > 2 ? ', ' : ' '); - return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); - } - - /** - * Checks if `value` is a flattenable `arguments` object or array. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. - */ - function isFlattenable(value) { - return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); - } - - /** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ - function isIndex(value, length) { - var type = typeof value; - length = length == null ? MAX_SAFE_INTEGER : length; - - return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); - } - - /** - * Checks if the given arguments are from an iteratee call. - * - * @private - * @param {*} value The potential iteratee value argument. - * @param {*} index The potential iteratee index or key argument. - * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, - * else `false`. - */ - function isIterateeCall(value, index, object) { - if (!isObject(object)) { - return false; - } - var type = typeof index; - if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { - return eq(object[index], value); - } - return false; - } - - /** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ - function isKey(value, object) { - if (isArray(value)) { - return false; - } - var type = typeof value; - if (type == 'number' || type == 'symbol' || type == 'boolean' || - value == null || isSymbol(value)) { - return true; - } - return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); - } - - /** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ - function isKeyable(value) { - var type = typeof value; - return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); - } - - /** - * Checks if `func` has a lazy counterpart. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` has a lazy counterpart, - * else `false`. - */ - function isLaziable(func) { - var funcName = getFuncName(func), - other = lodash[funcName]; - - if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { - return false; - } - if (func === other) { - return true; - } - var data = getData(other); - return !!data && func === data[0]; - } - - /** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. - */ - function isMasked(func) { - return !!maskSrcKey && (maskSrcKey in func); - } - - /** - * Checks if `func` is capable of being masked. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `func` is maskable, else `false`. - */ - var isMaskable = coreJsData ? isFunction : stubFalse; - - /** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ - function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; - } - - /** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ - function isStrictComparable(value) { - return value === value && !isObject(value); - } - - /** - * A specialized version of `matchesProperty` for source values suitable - * for strict equality comparisons, i.e. `===`. - * - * @private - * @param {string} key The key of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. - */ - function matchesStrictComparable(key, srcValue) { - return function(object) { - if (object == null) { - return false; - } - return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); - }; - } - - /** - * A specialized version of `_.memoize` which clears the memoized function's - * cache when it exceeds `MAX_MEMOIZE_SIZE`. - * - * @private - * @param {Function} func The function to have its output memoized. - * @returns {Function} Returns the new memoized function. - */ - function memoizeCapped(func) { - var result = memoize(func, function(key) { - if (cache.size === MAX_MEMOIZE_SIZE) { - cache.clear(); - } - return key; - }); - - var cache = result.cache; - return result; - } - - /** - * Merges the function metadata of `source` into `data`. - * - * Merging metadata reduces the number of wrappers used to invoke a function. - * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` - * may be applied regardless of execution order. Methods like `_.ary` and - * `_.rearg` modify function arguments, making the order in which they are - * executed important, preventing the merging of metadata. However, we make - * an exception for a safe combined case where curried functions have `_.ary` - * and or `_.rearg` applied. - * - * @private - * @param {Array} data The destination metadata. - * @param {Array} source The source metadata. - * @returns {Array} Returns `data`. - */ - function mergeData(data, source) { - var bitmask = data[1], - srcBitmask = source[1], - newBitmask = bitmask | srcBitmask, - isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); - - var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); - - // Exit early if metadata can't be merged. - if (!(isCommon || isCombo)) { - return data; - } - // Use source `thisArg` if available. - if (srcBitmask & WRAP_BIND_FLAG) { - data[2] = source[2]; - // Set when currying a bound function. - newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; - } - // Compose partial arguments. - var value = source[3]; - if (value) { - var partials = data[3]; - data[3] = partials ? composeArgs(partials, value, source[4]) : value; - data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; - } - // Compose partial right arguments. - value = source[5]; - if (value) { - partials = data[5]; - data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; - data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; - } - // Use source `argPos` if available. - value = source[7]; - if (value) { - data[7] = value; - } - // Use source `ary` if it's smaller. - if (srcBitmask & WRAP_ARY_FLAG) { - data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); - } - // Use source `arity` if one is not provided. - if (data[9] == null) { - data[9] = source[9]; - } - // Use source `func` and merge bitmasks. - data[0] = source[0]; - data[1] = newBitmask; - - return data; - } - - /** - * This function is like - * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * except that it includes inherited enumerable properties. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function nativeKeysIn(object) { - var result = []; - if (object != null) { - for (var key in Object(object)) { - result.push(key); - } - } - return result; - } - - /** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */ - function objectToString(value) { - return nativeObjectToString.call(value); - } - - /** - * A specialized version of `baseRest` which transforms the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @param {Function} transform The rest array transform. - * @returns {Function} Returns the new function. - */ - function overRest(func, start, transform) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = transform(array); - return apply(func, this, otherArgs); - }; - } - - /** - * Gets the parent value at `path` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} path The path to get the parent value of. - * @returns {*} Returns the parent value. - */ - function parent(object, path) { - return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); - } - - /** - * Reorder `array` according to the specified indexes where the element at - * the first index is assigned as the first element, the element at - * the second index is assigned as the second element, and so on. - * - * @private - * @param {Array} array The array to reorder. - * @param {Array} indexes The arranged array indexes. - * @returns {Array} Returns `array`. - */ - function reorder(array, indexes) { - var arrLength = array.length, - length = nativeMin(indexes.length, arrLength), - oldArray = copyArray(array); - - while (length--) { - var index = indexes[length]; - array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; - } - return array; - } - - /** - * Sets metadata for `func`. - * - * **Note:** If this function becomes hot, i.e. is invoked a lot in a short - * period of time, it will trip its breaker and transition to an identity - * function to avoid garbage collection pauses in V8. See - * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) - * for more details. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ - var setData = shortOut(baseSetData); - - /** - * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). - * - * @private - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @returns {number|Object} Returns the timer id or timeout object. - */ - var setTimeout = ctxSetTimeout || function(func, wait) { - return root.setTimeout(func, wait); - }; - - /** - * Sets the `toString` method of `func` to return `string`. - * - * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. - */ - var setToString = shortOut(baseSetToString); - - /** - * Sets the `toString` method of `wrapper` to mimic the source of `reference` - * with wrapper details in a comment at the top of the source body. - * - * @private - * @param {Function} wrapper The function to modify. - * @param {Function} reference The reference function. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @returns {Function} Returns `wrapper`. - */ - function setWrapToString(wrapper, reference, bitmask) { - var source = (reference + ''); - return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); - } - - /** - * Creates a function that'll short out and invoke `identity` instead - * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` - * milliseconds. - * - * @private - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new shortable function. - */ - function shortOut(func) { - var count = 0, - lastCalled = 0; - - return function() { - var stamp = nativeNow(), - remaining = HOT_SPAN - (stamp - lastCalled); - - lastCalled = stamp; - if (remaining > 0) { - if (++count >= HOT_COUNT) { - return arguments[0]; - } - } else { - count = 0; - } - return func.apply(undefined, arguments); - }; - } - - /** - * A specialized version of `_.shuffle` which mutates and sets the size of `array`. - * - * @private - * @param {Array} array The array to shuffle. - * @param {number} [size=array.length] The size of `array`. - * @returns {Array} Returns `array`. - */ - function shuffleSelf(array, size) { - var index = -1, - length = array.length, - lastIndex = length - 1; - - size = size === undefined ? length : size; - while (++index < size) { - var rand = baseRandom(index, lastIndex), - value = array[rand]; - - array[rand] = array[index]; - array[index] = value; - } - array.length = size; - return array; - } - - /** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ - var stringToPath = memoizeCapped(function(string) { - var result = []; - if (string.charCodeAt(0) === 46 /* . */) { - result.push(''); - } - string.replace(rePropName, function(match, number, quote, subString) { - result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; - }); - - /** - * Converts `value` to a string key if it's not a string or symbol. - * - * @private - * @param {*} value The value to inspect. - * @returns {string|symbol} Returns the key. - */ - function toKey(value) { - if (typeof value == 'string' || isSymbol(value)) { - return value; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; - } - - /** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to convert. - * @returns {string} Returns the source code. - */ - function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; - } - - /** - * Updates wrapper `details` based on `bitmask` flags. - * - * @private - * @returns {Array} details The details to modify. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @returns {Array} Returns `details`. - */ - function updateWrapDetails(details, bitmask) { - arrayEach(wrapFlags, function(pair) { - var value = '_.' + pair[0]; - if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { - details.push(value); - } - }); - return details.sort(); - } - - /** - * Creates a clone of `wrapper`. - * - * @private - * @param {Object} wrapper The wrapper to clone. - * @returns {Object} Returns the cloned wrapper. - */ - function wrapperClone(wrapper) { - if (wrapper instanceof LazyWrapper) { - return wrapper.clone(); - } - var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); - result.__actions__ = copyArray(wrapper.__actions__); - result.__index__ = wrapper.__index__; - result.__values__ = wrapper.__values__; - return result; - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates an array of elements split into groups the length of `size`. - * If `array` can't be split evenly, the final chunk will be the remaining - * elements. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to process. - * @param {number} [size=1] The length of each chunk - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the new array of chunks. - * @example - * - * _.chunk(['a', 'b', 'c', 'd'], 2); - * // => [['a', 'b'], ['c', 'd']] - * - * _.chunk(['a', 'b', 'c', 'd'], 3); - * // => [['a', 'b', 'c'], ['d']] - */ - function chunk(array, size, guard) { - if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { - size = 1; - } else { - size = nativeMax(toInteger(size), 0); - } - var length = array == null ? 0 : array.length; - if (!length || size < 1) { - return []; - } - var index = 0, - resIndex = 0, - result = Array(nativeCeil(length / size)); - - while (index < length) { - result[resIndex++] = baseSlice(array, index, (index += size)); - } - return result; - } - - /** - * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are falsey. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to compact. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.compact([0, 1, false, 2, '', 3]); - * // => [1, 2, 3] - */ - function compact(array) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value) { - result[resIndex++] = value; - } - } - return result; - } - - /** - * Creates a new array concatenating `array` with any additional arrays - * and/or values. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to concatenate. - * @param {...*} [values] The values to concatenate. - * @returns {Array} Returns the new concatenated array. - * @example - * - * var array = [1]; - * var other = _.concat(array, 2, [3], [[4]]); - * - * console.log(other); - * // => [1, 2, 3, [4]] - * - * console.log(array); - * // => [1] - */ - function concat() { - var length = arguments.length; - if (!length) { - return []; - } - var args = Array(length - 1), - array = arguments[0], - index = length; - - while (index--) { - args[index - 1] = arguments[index]; - } - return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); - } - - /** - * Creates an array of `array` values not included in the other given arrays - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order and references of result values are - * determined by the first array. - * - * **Note:** Unlike `_.pullAll`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @returns {Array} Returns the new array of filtered values. - * @see _.without, _.xor - * @example - * - * _.difference([2, 1], [2, 3]); - * // => [1] - */ - var difference = baseRest(function(array, values) { - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; - }); - - /** - * This method is like `_.difference` except that it accepts `iteratee` which - * is invoked for each element of `array` and `values` to generate the criterion - * by which they're compared. The order and references of result values are - * determined by the first array. The iteratee is invoked with one argument: - * (value). - * - * **Note:** Unlike `_.pullAllBy`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [1.2] - * - * // The `_.property` iteratee shorthand. - * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); - * // => [{ 'x': 2 }] - */ - var differenceBy = baseRest(function(array, values) { - var iteratee = last(values); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) - : []; - }); - - /** - * This method is like `_.difference` except that it accepts `comparator` - * which is invoked to compare elements of `array` to `values`. The order and - * references of result values are determined by the first array. The comparator - * is invoked with two arguments: (arrVal, othVal). - * - * **Note:** Unlike `_.pullAllWith`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * - * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); - * // => [{ 'x': 2, 'y': 1 }] - */ - var differenceWith = baseRest(function(array, values) { - var comparator = last(values); - if (isArrayLikeObject(comparator)) { - comparator = undefined; - } - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) - : []; - }); - - /** - * Creates a slice of `array` with `n` elements dropped from the beginning. - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.drop([1, 2, 3]); - * // => [2, 3] - * - * _.drop([1, 2, 3], 2); - * // => [3] - * - * _.drop([1, 2, 3], 5); - * // => [] - * - * _.drop([1, 2, 3], 0); - * // => [1, 2, 3] - */ - function drop(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - return baseSlice(array, n < 0 ? 0 : n, length); - } - - /** - * Creates a slice of `array` with `n` elements dropped from the end. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.dropRight([1, 2, 3]); - * // => [1, 2] - * - * _.dropRight([1, 2, 3], 2); - * // => [1] - * - * _.dropRight([1, 2, 3], 5); - * // => [] - * - * _.dropRight([1, 2, 3], 0); - * // => [1, 2, 3] - */ - function dropRight(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, 0, n < 0 ? 0 : n); - } - - /** - * Creates a slice of `array` excluding elements dropped from the end. - * Elements are dropped until `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.dropRightWhile(users, function(o) { return !o.active; }); - * // => objects for ['barney'] - * - * // The `_.matches` iteratee shorthand. - * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); - * // => objects for ['barney', 'fred'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.dropRightWhile(users, ['active', false]); - * // => objects for ['barney'] - * - * // The `_.property` iteratee shorthand. - * _.dropRightWhile(users, 'active'); - * // => objects for ['barney', 'fred', 'pebbles'] - */ - function dropRightWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), true, true) - : []; - } - - /** - * Creates a slice of `array` excluding elements dropped from the beginning. - * Elements are dropped until `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.dropWhile(users, function(o) { return !o.active; }); - * // => objects for ['pebbles'] - * - * // The `_.matches` iteratee shorthand. - * _.dropWhile(users, { 'user': 'barney', 'active': false }); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.dropWhile(users, ['active', false]); - * // => objects for ['pebbles'] - * - * // The `_.property` iteratee shorthand. - * _.dropWhile(users, 'active'); - * // => objects for ['barney', 'fred', 'pebbles'] - */ - function dropWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), true) - : []; - } - - /** - * Fills elements of `array` with `value` from `start` up to, but not - * including, `end`. - * - * **Note:** This method mutates `array`. - * - * @static - * @memberOf _ - * @since 3.2.0 - * @category Array - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3]; - * - * _.fill(array, 'a'); - * console.log(array); - * // => ['a', 'a', 'a'] - * - * _.fill(Array(3), 2); - * // => [2, 2, 2] - * - * _.fill([4, 6, 8, 10], '*', 1, 3); - * // => [4, '*', '*', 10] - */ - function fill(array, value, start, end) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { - start = 0; - end = length; - } - return baseFill(array, value, start, end); - } - - /** - * This method is like `_.find` except that it returns the index of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.findIndex(users, function(o) { return o.user == 'barney'; }); - * // => 0 - * - * // The `_.matches` iteratee shorthand. - * _.findIndex(users, { 'user': 'fred', 'active': false }); - * // => 1 - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findIndex(users, ['active', false]); - * // => 0 - * - * // The `_.property` iteratee shorthand. - * _.findIndex(users, 'active'); - * // => 2 - */ - function findIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseFindIndex(array, getIteratee(predicate, 3), index); - } - - /** - * This method is like `_.findIndex` except that it iterates over elements - * of `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); - * // => 2 - * - * // The `_.matches` iteratee shorthand. - * _.findLastIndex(users, { 'user': 'barney', 'active': true }); - * // => 0 - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findLastIndex(users, ['active', false]); - * // => 2 - * - * // The `_.property` iteratee shorthand. - * _.findLastIndex(users, 'active'); - * // => 0 - */ - function findLastIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = length - 1; - if (fromIndex !== undefined) { - index = toInteger(fromIndex); - index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); - } - return baseFindIndex(array, getIteratee(predicate, 3), index, true); - } - - /** - * Flattens `array` a single level deep. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flatten([1, [2, [3, [4]], 5]]); - * // => [1, 2, [3, [4]], 5] - */ - function flatten(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, 1) : []; - } - - /** - * Recursively flattens `array`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flattenDeep([1, [2, [3, [4]], 5]]); - * // => [1, 2, 3, 4, 5] - */ - function flattenDeep(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, INFINITY) : []; - } - - /** - * Recursively flatten `array` up to `depth` times. - * - * @static - * @memberOf _ - * @since 4.4.0 - * @category Array - * @param {Array} array The array to flatten. - * @param {number} [depth=1] The maximum recursion depth. - * @returns {Array} Returns the new flattened array. - * @example - * - * var array = [1, [2, [3, [4]], 5]]; - * - * _.flattenDepth(array, 1); - * // => [1, 2, [3, [4]], 5] - * - * _.flattenDepth(array, 2); - * // => [1, 2, 3, [4], 5] - */ - function flattenDepth(array, depth) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - depth = depth === undefined ? 1 : toInteger(depth); - return baseFlatten(array, depth); - } - - /** - * The inverse of `_.toPairs`; this method returns an object composed - * from key-value `pairs`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} pairs The key-value pairs. - * @returns {Object} Returns the new object. - * @example - * - * _.fromPairs([['a', 1], ['b', 2]]); - * // => { 'a': 1, 'b': 2 } - */ - function fromPairs(pairs) { - var index = -1, - length = pairs == null ? 0 : pairs.length, - result = {}; - - while (++index < length) { - var pair = pairs[index]; - result[pair[0]] = pair[1]; - } - return result; - } - - /** - * Gets the first element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @alias first - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the first element of `array`. - * @example - * - * _.head([1, 2, 3]); - * // => 1 - * - * _.head([]); - * // => undefined - */ - function head(array) { - return (array && array.length) ? array[0] : undefined; - } - - /** - * Gets the index at which the first occurrence of `value` is found in `array` - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. If `fromIndex` is negative, it's used as the - * offset from the end of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.indexOf([1, 2, 1, 2], 2); - * // => 1 - * - * // Search from the `fromIndex`. - * _.indexOf([1, 2, 1, 2], 2, 2); - * // => 3 - */ - function indexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseIndexOf(array, value, index); - } - - /** - * Gets all but the last element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.initial([1, 2, 3]); - * // => [1, 2] - */ - function initial(array) { - var length = array == null ? 0 : array.length; - return length ? baseSlice(array, 0, -1) : []; - } - - /** - * Creates an array of unique values that are included in all given arrays - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order and references of result values are - * determined by the first array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * _.intersection([2, 1], [2, 3]); - * // => [2] - */ - var intersection = baseRest(function(arrays) { - var mapped = arrayMap(arrays, castArrayLikeObject); - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; - }); - - /** - * This method is like `_.intersection` except that it accepts `iteratee` - * which is invoked for each element of each `arrays` to generate the criterion - * by which they're compared. The order and references of result values are - * determined by the first array. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [2.1] - * - * // The `_.property` iteratee shorthand. - * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }] - */ - var intersectionBy = baseRest(function(arrays) { - var iteratee = last(arrays), - mapped = arrayMap(arrays, castArrayLikeObject); - - if (iteratee === last(mapped)) { - iteratee = undefined; - } else { - mapped.pop(); - } - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped, getIteratee(iteratee, 2)) - : []; - }); - - /** - * This method is like `_.intersection` except that it accepts `comparator` - * which is invoked to compare elements of `arrays`. The order and references - * of result values are determined by the first array. The comparator is - * invoked with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.intersectionWith(objects, others, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }] - */ - var intersectionWith = baseRest(function(arrays) { - var comparator = last(arrays), - mapped = arrayMap(arrays, castArrayLikeObject); - - comparator = typeof comparator == 'function' ? comparator : undefined; - if (comparator) { - mapped.pop(); - } - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped, undefined, comparator) - : []; - }); - - /** - * Converts all elements in `array` into a string separated by `separator`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to convert. - * @param {string} [separator=','] The element separator. - * @returns {string} Returns the joined string. - * @example - * - * _.join(['a', 'b', 'c'], '~'); - * // => 'a~b~c' - */ - function join(array, separator) { - return array == null ? '' : nativeJoin.call(array, separator); - } - - /** - * Gets the last element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the last element of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - */ - function last(array) { - var length = array == null ? 0 : array.length; - return length ? array[length - 1] : undefined; - } - - /** - * This method is like `_.indexOf` except that it iterates over elements of - * `array` from right to left. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.lastIndexOf([1, 2, 1, 2], 2); - * // => 3 - * - * // Search from the `fromIndex`. - * _.lastIndexOf([1, 2, 1, 2], 2, 2); - * // => 1 - */ - function lastIndexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = length; - if (fromIndex !== undefined) { - index = toInteger(fromIndex); - index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); - } - return value === value - ? strictLastIndexOf(array, value, index) - : baseFindIndex(array, baseIsNaN, index, true); - } - - /** - * Gets the element at index `n` of `array`. If `n` is negative, the nth - * element from the end is returned. - * - * @static - * @memberOf _ - * @since 4.11.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=0] The index of the element to return. - * @returns {*} Returns the nth element of `array`. - * @example - * - * var array = ['a', 'b', 'c', 'd']; - * - * _.nth(array, 1); - * // => 'b' - * - * _.nth(array, -2); - * // => 'c'; - */ - function nth(array, n) { - return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; - } - - /** - * Removes all given values from `array` using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` - * to remove elements from an array by predicate. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {...*} [values] The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; - * - * _.pull(array, 'a', 'c'); - * console.log(array); - * // => ['b', 'b'] - */ - var pull = baseRest(pullAll); - - /** - * This method is like `_.pull` except that it accepts an array of values to remove. - * - * **Note:** Unlike `_.difference`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; - * - * _.pullAll(array, ['a', 'c']); - * console.log(array); - * // => ['b', 'b'] - */ - function pullAll(array, values) { - return (array && array.length && values && values.length) - ? basePullAll(array, values) - : array; - } - - /** - * This method is like `_.pullAll` except that it accepts `iteratee` which is - * invoked for each element of `array` and `values` to generate the criterion - * by which they're compared. The iteratee is invoked with one argument: (value). - * - * **Note:** Unlike `_.differenceBy`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns `array`. - * @example - * - * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; - * - * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); - * console.log(array); - * // => [{ 'x': 2 }] - */ - function pullAllBy(array, values, iteratee) { - return (array && array.length && values && values.length) - ? basePullAll(array, values, getIteratee(iteratee, 2)) - : array; - } - - /** - * This method is like `_.pullAll` except that it accepts `comparator` which - * is invoked to compare elements of `array` to `values`. The comparator is - * invoked with two arguments: (arrVal, othVal). - * - * **Note:** Unlike `_.differenceWith`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns `array`. - * @example - * - * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; - * - * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); - * console.log(array); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] - */ - function pullAllWith(array, values, comparator) { - return (array && array.length && values && values.length) - ? basePullAll(array, values, undefined, comparator) - : array; - } - - /** - * Removes elements from `array` corresponding to `indexes` and returns an - * array of removed elements. - * - * **Note:** Unlike `_.at`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {...(number|number[])} [indexes] The indexes of elements to remove. - * @returns {Array} Returns the new array of removed elements. - * @example - * - * var array = ['a', 'b', 'c', 'd']; - * var pulled = _.pullAt(array, [1, 3]); - * - * console.log(array); - * // => ['a', 'c'] - * - * console.log(pulled); - * // => ['b', 'd'] - */ - var pullAt = flatRest(function(array, indexes) { - var length = array == null ? 0 : array.length, - result = baseAt(array, indexes); - - basePullAt(array, arrayMap(indexes, function(index) { - return isIndex(index, length) ? +index : index; - }).sort(compareAscending)); - - return result; - }); - - /** - * Removes all elements from `array` that `predicate` returns truthy for - * and returns an array of the removed elements. The predicate is invoked - * with three arguments: (value, index, array). - * - * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` - * to pull elements from an array by value. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4]; - * var evens = _.remove(array, function(n) { - * return n % 2 == 0; - * }); - * - * console.log(array); - * // => [1, 3] - * - * console.log(evens); - * // => [2, 4] - */ - function remove(array, predicate) { - var result = []; - if (!(array && array.length)) { - return result; - } - var index = -1, - indexes = [], - length = array.length; - - predicate = getIteratee(predicate, 3); - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result.push(value); - indexes.push(index); - } - } - basePullAt(array, indexes); - return result; - } - - /** - * Reverses `array` so that the first element becomes the last, the second - * element becomes the second to last, and so on. - * - * **Note:** This method mutates `array` and is based on - * [`Array#reverse`](https://mdn.io/Array/reverse). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3]; - * - * _.reverse(array); - * // => [3, 2, 1] - * - * console.log(array); - * // => [3, 2, 1] - */ - function reverse(array) { - return array == null ? array : nativeReverse.call(array); - } - - /** - * Creates a slice of `array` from `start` up to, but not including, `end`. - * - * **Note:** This method is used instead of - * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are - * returned. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ - function slice(array, start, end) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { - start = 0; - end = length; - } - else { - start = start == null ? 0 : toInteger(start); - end = end === undefined ? length : toInteger(end); - } - return baseSlice(array, start, end); - } - - /** - * Uses a binary search to determine the lowest index at which `value` - * should be inserted into `array` in order to maintain its sort order. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * _.sortedIndex([30, 50], 40); - * // => 1 - */ - function sortedIndex(array, value) { - return baseSortedIndex(array, value); - } - - /** - * This method is like `_.sortedIndex` except that it accepts `iteratee` - * which is invoked for `value` and each element of `array` to compute their - * sort ranking. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * var objects = [{ 'x': 4 }, { 'x': 5 }]; - * - * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); - * // => 0 - * - * // The `_.property` iteratee shorthand. - * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); - * // => 0 - */ - function sortedIndexBy(array, value, iteratee) { - return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); - } - - /** - * This method is like `_.indexOf` except that it performs a binary - * search on a sorted `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.sortedIndexOf([4, 5, 5, 5, 6], 5); - * // => 1 - */ - function sortedIndexOf(array, value) { - var length = array == null ? 0 : array.length; - if (length) { - var index = baseSortedIndex(array, value); - if (index < length && eq(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.sortedIndex` except that it returns the highest - * index at which `value` should be inserted into `array` in order to - * maintain its sort order. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * _.sortedLastIndex([4, 5, 5, 5, 6], 5); - * // => 4 - */ - function sortedLastIndex(array, value) { - return baseSortedIndex(array, value, true); - } - - /** - * This method is like `_.sortedLastIndex` except that it accepts `iteratee` - * which is invoked for `value` and each element of `array` to compute their - * sort ranking. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * var objects = [{ 'x': 4 }, { 'x': 5 }]; - * - * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); - * // => 1 - * - * // The `_.property` iteratee shorthand. - * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); - * // => 1 - */ - function sortedLastIndexBy(array, value, iteratee) { - return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); - } - - /** - * This method is like `_.lastIndexOf` except that it performs a binary - * search on a sorted `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); - * // => 3 - */ - function sortedLastIndexOf(array, value) { - var length = array == null ? 0 : array.length; - if (length) { - var index = baseSortedIndex(array, value, true) - 1; - if (eq(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.uniq` except that it's designed and optimized - * for sorted arrays. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.sortedUniq([1, 1, 2]); - * // => [1, 2] - */ - function sortedUniq(array) { - return (array && array.length) - ? baseSortedUniq(array) - : []; - } - - /** - * This method is like `_.uniqBy` except that it's designed and optimized - * for sorted arrays. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); - * // => [1.1, 2.3] - */ - function sortedUniqBy(array, iteratee) { - return (array && array.length) - ? baseSortedUniq(array, getIteratee(iteratee, 2)) - : []; - } - - /** - * Gets all but the first element of `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to query. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.tail([1, 2, 3]); - * // => [2, 3] - */ - function tail(array) { - var length = array == null ? 0 : array.length; - return length ? baseSlice(array, 1, length) : []; - } - - /** - * Creates a slice of `array` with `n` elements taken from the beginning. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.take([1, 2, 3]); - * // => [1] - * - * _.take([1, 2, 3], 2); - * // => [1, 2] - * - * _.take([1, 2, 3], 5); - * // => [1, 2, 3] - * - * _.take([1, 2, 3], 0); - * // => [] - */ - function take(array, n, guard) { - if (!(array && array.length)) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - return baseSlice(array, 0, n < 0 ? 0 : n); - } - - /** - * Creates a slice of `array` with `n` elements taken from the end. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.takeRight([1, 2, 3]); - * // => [3] - * - * _.takeRight([1, 2, 3], 2); - * // => [2, 3] - * - * _.takeRight([1, 2, 3], 5); - * // => [1, 2, 3] - * - * _.takeRight([1, 2, 3], 0); - * // => [] - */ - function takeRight(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, n < 0 ? 0 : n, length); - } - - /** - * Creates a slice of `array` with elements taken from the end. Elements are - * taken until `predicate` returns falsey. The predicate is invoked with - * three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.takeRightWhile(users, function(o) { return !o.active; }); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.matches` iteratee shorthand. - * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); - * // => objects for ['pebbles'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.takeRightWhile(users, ['active', false]); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.property` iteratee shorthand. - * _.takeRightWhile(users, 'active'); - * // => [] - */ - function takeRightWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), false, true) - : []; - } - - /** - * Creates a slice of `array` with elements taken from the beginning. Elements - * are taken until `predicate` returns falsey. The predicate is invoked with - * three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.takeWhile(users, function(o) { return !o.active; }); - * // => objects for ['barney', 'fred'] - * - * // The `_.matches` iteratee shorthand. - * _.takeWhile(users, { 'user': 'barney', 'active': false }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.takeWhile(users, ['active', false]); - * // => objects for ['barney', 'fred'] - * - * // The `_.property` iteratee shorthand. - * _.takeWhile(users, 'active'); - * // => [] - */ - function takeWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3)) - : []; - } - - /** - * Creates an array of unique values, in order, from all given arrays using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of combined values. - * @example - * - * _.union([2], [1, 2]); - * // => [2, 1] - */ - var union = baseRest(function(arrays) { - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); - }); - - /** - * This method is like `_.union` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by - * which uniqueness is computed. Result values are chosen from the first - * array in which the value occurs. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of combined values. - * @example - * - * _.unionBy([2.1], [1.2, 2.3], Math.floor); - * // => [2.1, 1.2] - * - * // The `_.property` iteratee shorthand. - * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - var unionBy = baseRest(function(arrays) { - var iteratee = last(arrays); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); - }); - - /** - * This method is like `_.union` except that it accepts `comparator` which - * is invoked to compare elements of `arrays`. Result values are chosen from - * the first array in which the value occurs. The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of combined values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.unionWith(objects, others, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] - */ - var unionWith = baseRest(function(arrays) { - var comparator = last(arrays); - comparator = typeof comparator == 'function' ? comparator : undefined; - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); - }); - - /** - * Creates a duplicate-free version of an array, using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons, in which only the first occurrence of each element - * is kept. The order of result values is determined by the order they occur - * in the array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.uniq([2, 1, 2]); - * // => [2, 1] - */ - function uniq(array) { - return (array && array.length) ? baseUniq(array) : []; - } - - /** - * This method is like `_.uniq` except that it accepts `iteratee` which is - * invoked for each element in `array` to generate the criterion by which - * uniqueness is computed. The order of result values is determined by the - * order they occur in the array. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.uniqBy([2.1, 1.2, 2.3], Math.floor); - * // => [2.1, 1.2] - * - * // The `_.property` iteratee shorthand. - * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - function uniqBy(array, iteratee) { - return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; - } - - /** - * This method is like `_.uniq` except that it accepts `comparator` which - * is invoked to compare elements of `array`. The order of result values is - * determined by the order they occur in the array.The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.uniqWith(objects, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] - */ - function uniqWith(array, comparator) { - comparator = typeof comparator == 'function' ? comparator : undefined; - return (array && array.length) ? baseUniq(array, undefined, comparator) : []; - } - - /** - * This method is like `_.zip` except that it accepts an array of grouped - * elements and creates an array regrouping the elements to their pre-zip - * configuration. - * - * @static - * @memberOf _ - * @since 1.2.0 - * @category Array - * @param {Array} array The array of grouped elements to process. - * @returns {Array} Returns the new array of regrouped elements. - * @example - * - * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); - * // => [['a', 1, true], ['b', 2, false]] - * - * _.unzip(zipped); - * // => [['a', 'b'], [1, 2], [true, false]] - */ - function unzip(array) { - if (!(array && array.length)) { - return []; - } - var length = 0; - array = arrayFilter(array, function(group) { - if (isArrayLikeObject(group)) { - length = nativeMax(group.length, length); - return true; - } - }); - return baseTimes(length, function(index) { - return arrayMap(array, baseProperty(index)); - }); - } - - /** - * This method is like `_.unzip` except that it accepts `iteratee` to specify - * how regrouped values should be combined. The iteratee is invoked with the - * elements of each group: (...group). - * - * @static - * @memberOf _ - * @since 3.8.0 - * @category Array - * @param {Array} array The array of grouped elements to process. - * @param {Function} [iteratee=_.identity] The function to combine - * regrouped values. - * @returns {Array} Returns the new array of regrouped elements. - * @example - * - * var zipped = _.zip([1, 2], [10, 20], [100, 200]); - * // => [[1, 10, 100], [2, 20, 200]] - * - * _.unzipWith(zipped, _.add); - * // => [3, 30, 300] - */ - function unzipWith(array, iteratee) { - if (!(array && array.length)) { - return []; - } - var result = unzip(array); - if (iteratee == null) { - return result; - } - return arrayMap(result, function(group) { - return apply(iteratee, undefined, group); - }); - } - - /** - * Creates an array excluding all given values using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * **Note:** Unlike `_.pull`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...*} [values] The values to exclude. - * @returns {Array} Returns the new array of filtered values. - * @see _.difference, _.xor - * @example - * - * _.without([2, 1, 2, 3], 1, 2); - * // => [3] - */ - var without = baseRest(function(array, values) { - return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; - }); - - /** - * Creates an array of unique values that is the - * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) - * of the given arrays. The order of result values is determined by the order - * they occur in the arrays. - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of filtered values. - * @see _.difference, _.without - * @example - * - * _.xor([2, 1], [2, 3]); - * // => [1, 3] - */ - var xor = baseRest(function(arrays) { - return baseXor(arrayFilter(arrays, isArrayLikeObject)); - }); - - /** - * This method is like `_.xor` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by - * which by which they're compared. The order of result values is determined - * by the order they occur in the arrays. The iteratee is invoked with one - * argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [1.2, 3.4] - * - * // The `_.property` iteratee shorthand. - * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 2 }] - */ - var xorBy = baseRest(function(arrays) { - var iteratee = last(arrays); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); - }); - - /** - * This method is like `_.xor` except that it accepts `comparator` which is - * invoked to compare elements of `arrays`. The order of result values is - * determined by the order they occur in the arrays. The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.xorWith(objects, others, _.isEqual); - * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] - */ - var xorWith = baseRest(function(arrays) { - var comparator = last(arrays); - comparator = typeof comparator == 'function' ? comparator : undefined; - return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); - }); - - /** - * Creates an array of grouped elements, the first of which contains the - * first elements of the given arrays, the second of which contains the - * second elements of the given arrays, and so on. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to process. - * @returns {Array} Returns the new array of grouped elements. - * @example - * - * _.zip(['a', 'b'], [1, 2], [true, false]); - * // => [['a', 1, true], ['b', 2, false]] - */ - var zip = baseRest(unzip); - - /** - * This method is like `_.fromPairs` except that it accepts two arrays, - * one of property identifiers and one of corresponding values. - * - * @static - * @memberOf _ - * @since 0.4.0 - * @category Array - * @param {Array} [props=[]] The property identifiers. - * @param {Array} [values=[]] The property values. - * @returns {Object} Returns the new object. - * @example - * - * _.zipObject(['a', 'b'], [1, 2]); - * // => { 'a': 1, 'b': 2 } - */ - function zipObject(props, values) { - return baseZipObject(props || [], values || [], assignValue); - } - - /** - * This method is like `_.zipObject` except that it supports property paths. - * - * @static - * @memberOf _ - * @since 4.1.0 - * @category Array - * @param {Array} [props=[]] The property identifiers. - * @param {Array} [values=[]] The property values. - * @returns {Object} Returns the new object. - * @example - * - * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); - * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } - */ - function zipObjectDeep(props, values) { - return baseZipObject(props || [], values || [], baseSet); - } - - /** - * This method is like `_.zip` except that it accepts `iteratee` to specify - * how grouped values should be combined. The iteratee is invoked with the - * elements of each group: (...group). - * - * @static - * @memberOf _ - * @since 3.8.0 - * @category Array - * @param {...Array} [arrays] The arrays to process. - * @param {Function} [iteratee=_.identity] The function to combine - * grouped values. - * @returns {Array} Returns the new array of grouped elements. - * @example - * - * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { - * return a + b + c; - * }); - * // => [111, 222] - */ - var zipWith = baseRest(function(arrays) { - var length = arrays.length, - iteratee = length > 1 ? arrays[length - 1] : undefined; - - iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; - return unzipWith(arrays, iteratee); - }); - - /*------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` wrapper instance that wraps `value` with explicit method - * chain sequences enabled. The result of such sequences must be unwrapped - * with `_#value`. - * - * @static - * @memberOf _ - * @since 1.3.0 - * @category Seq - * @param {*} value The value to wrap. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'pebbles', 'age': 1 } - * ]; - * - * var youngest = _ - * .chain(users) - * .sortBy('age') - * .map(function(o) { - * return o.user + ' is ' + o.age; - * }) - * .head() - * .value(); - * // => 'pebbles is 1' - */ - function chain(value) { - var result = lodash(value); - result.__chain__ = true; - return result; - } - - /** - * This method invokes `interceptor` and returns `value`. The interceptor - * is invoked with one argument; (value). The purpose of this method is to - * "tap into" a method chain sequence in order to modify intermediate results. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @param {*} value The value to provide to `interceptor`. - * @param {Function} interceptor The function to invoke. - * @returns {*} Returns `value`. - * @example - * - * _([1, 2, 3]) - * .tap(function(array) { - * // Mutate input array. - * array.pop(); - * }) - * .reverse() - * .value(); - * // => [2, 1] - */ - function tap(value, interceptor) { - interceptor(value); - return value; - } - - /** - * This method is like `_.tap` except that it returns the result of `interceptor`. - * The purpose of this method is to "pass thru" values replacing intermediate - * results in a method chain sequence. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Seq - * @param {*} value The value to provide to `interceptor`. - * @param {Function} interceptor The function to invoke. - * @returns {*} Returns the result of `interceptor`. - * @example - * - * _(' abc ') - * .chain() - * .trim() - * .thru(function(value) { - * return [value]; - * }) - * .value(); - * // => ['abc'] - */ - function thru(value, interceptor) { - return interceptor(value); - } - - /** - * This method is the wrapper version of `_.at`. - * - * @name at - * @memberOf _ - * @since 1.0.0 - * @category Seq - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; - * - * _(object).at(['a[0].b.c', 'a[1]']).value(); - * // => [3, 4] - */ - var wrapperAt = flatRest(function(paths) { - var length = paths.length, - start = length ? paths[0] : 0, - value = this.__wrapped__, - interceptor = function(object) { return baseAt(object, paths); }; - - if (length > 1 || this.__actions__.length || - !(value instanceof LazyWrapper) || !isIndex(start)) { - return this.thru(interceptor); - } - value = value.slice(start, +start + (length ? 1 : 0)); - value.__actions__.push({ - 'func': thru, - 'args': [interceptor], - 'thisArg': undefined - }); - return new LodashWrapper(value, this.__chain__).thru(function(array) { - if (length && !array.length) { - array.push(undefined); - } - return array; - }); - }); - - /** - * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. - * - * @name chain - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 } - * ]; - * - * // A sequence without explicit chaining. - * _(users).head(); - * // => { 'user': 'barney', 'age': 36 } - * - * // A sequence with explicit chaining. - * _(users) - * .chain() - * .head() - * .pick('user') - * .value(); - * // => { 'user': 'barney' } - */ - function wrapperChain() { - return chain(this); - } - - /** - * Executes the chain sequence and returns the wrapped result. - * - * @name commit - * @memberOf _ - * @since 3.2.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var array = [1, 2]; - * var wrapped = _(array).push(3); - * - * console.log(array); - * // => [1, 2] - * - * wrapped = wrapped.commit(); - * console.log(array); - * // => [1, 2, 3] - * - * wrapped.last(); - * // => 3 - * - * console.log(array); - * // => [1, 2, 3] - */ - function wrapperCommit() { - return new LodashWrapper(this.value(), this.__chain__); - } - - /** - * Gets the next value on a wrapped object following the - * [iterator protocol](https://mdn.io/iteration_protocols#iterator). - * - * @name next - * @memberOf _ - * @since 4.0.0 - * @category Seq - * @returns {Object} Returns the next iterator value. - * @example - * - * var wrapped = _([1, 2]); - * - * wrapped.next(); - * // => { 'done': false, 'value': 1 } - * - * wrapped.next(); - * // => { 'done': false, 'value': 2 } - * - * wrapped.next(); - * // => { 'done': true, 'value': undefined } - */ - function wrapperNext() { - if (this.__values__ === undefined) { - this.__values__ = toArray(this.value()); - } - var done = this.__index__ >= this.__values__.length, - value = done ? undefined : this.__values__[this.__index__++]; - - return { 'done': done, 'value': value }; - } - - /** - * Enables the wrapper to be iterable. - * - * @name Symbol.iterator - * @memberOf _ - * @since 4.0.0 - * @category Seq - * @returns {Object} Returns the wrapper object. - * @example - * - * var wrapped = _([1, 2]); - * - * wrapped[Symbol.iterator]() === wrapped; - * // => true - * - * Array.from(wrapped); - * // => [1, 2] - */ - function wrapperToIterator() { - return this; - } - - /** - * Creates a clone of the chain sequence planting `value` as the wrapped value. - * - * @name plant - * @memberOf _ - * @since 3.2.0 - * @category Seq - * @param {*} value The value to plant. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var wrapped = _([1, 2]).map(square); - * var other = wrapped.plant([3, 4]); - * - * other.value(); - * // => [9, 16] - * - * wrapped.value(); - * // => [1, 4] - */ - function wrapperPlant(value) { - var result, - parent = this; - - while (parent instanceof baseLodash) { - var clone = wrapperClone(parent); - clone.__index__ = 0; - clone.__values__ = undefined; - if (result) { - previous.__wrapped__ = clone; - } else { - result = clone; - } - var previous = clone; - parent = parent.__wrapped__; - } - previous.__wrapped__ = value; - return result; - } - - /** - * This method is the wrapper version of `_.reverse`. - * - * **Note:** This method mutates the wrapped array. - * - * @name reverse - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var array = [1, 2, 3]; - * - * _(array).reverse().value() - * // => [3, 2, 1] - * - * console.log(array); - * // => [3, 2, 1] - */ - function wrapperReverse() { - var value = this.__wrapped__; - if (value instanceof LazyWrapper) { - var wrapped = value; - if (this.__actions__.length) { - wrapped = new LazyWrapper(this); - } - wrapped = wrapped.reverse(); - wrapped.__actions__.push({ - 'func': thru, - 'args': [reverse], - 'thisArg': undefined - }); - return new LodashWrapper(wrapped, this.__chain__); - } - return this.thru(reverse); - } - - /** - * Executes the chain sequence to resolve the unwrapped value. - * - * @name value - * @memberOf _ - * @since 0.1.0 - * @alias toJSON, valueOf - * @category Seq - * @returns {*} Returns the resolved unwrapped value. - * @example - * - * _([1, 2, 3]).value(); - * // => [1, 2, 3] - */ - function wrapperValue() { - return baseWrapperValue(this.__wrapped__, this.__actions__); - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The corresponding value of - * each key is the number of times the key was returned by `iteratee`. The - * iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.countBy([6.1, 4.2, 6.3], Math.floor); - * // => { '4': 1, '6': 2 } - * - * // The `_.property` iteratee shorthand. - * _.countBy(['one', 'two', 'three'], 'length'); - * // => { '3': 2, '5': 1 } - */ - var countBy = createAggregator(function(result, value, key) { - if (hasOwnProperty.call(result, key)) { - ++result[key]; - } else { - baseAssignValue(result, key, 1); - } - }); - - /** - * Checks if `predicate` returns truthy for **all** elements of `collection`. - * Iteration is stopped once `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * **Note:** This method returns `true` for - * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because - * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of - * elements of empty collections. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false`. - * @example - * - * _.every([true, 1, null, 'yes'], Boolean); - * // => false - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.every(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // The `_.matchesProperty` iteratee shorthand. - * _.every(users, ['active', false]); - * // => true - * - * // The `_.property` iteratee shorthand. - * _.every(users, 'active'); - * // => false - */ - function every(collection, predicate, guard) { - var func = isArray(collection) ? arrayEvery : baseEvery; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined; - } - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Iterates over elements of `collection`, returning an array of all elements - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * **Note:** Unlike `_.remove`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - * @see _.reject - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * _.filter(users, function(o) { return !o.active; }); - * // => objects for ['fred'] - * - * // The `_.matches` iteratee shorthand. - * _.filter(users, { 'age': 36, 'active': true }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.filter(users, ['active', false]); - * // => objects for ['fred'] - * - * // The `_.property` iteratee shorthand. - * _.filter(users, 'active'); - * // => objects for ['barney'] - */ - function filter(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Iterates over elements of `collection`, returning the first element - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false }, - * { 'user': 'pebbles', 'age': 1, 'active': true } - * ]; - * - * _.find(users, function(o) { return o.age < 40; }); - * // => object for 'barney' - * - * // The `_.matches` iteratee shorthand. - * _.find(users, { 'age': 1, 'active': true }); - * // => object for 'pebbles' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.find(users, ['active', false]); - * // => object for 'fred' - * - * // The `_.property` iteratee shorthand. - * _.find(users, 'active'); - * // => object for 'barney' - */ - var find = createFind(findIndex); - - /** - * This method is like `_.find` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=collection.length-1] The index to search from. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * _.findLast([1, 2, 3, 4], function(n) { - * return n % 2 == 1; - * }); - * // => 3 - */ - var findLast = createFind(findLastIndex); - - /** - * Creates a flattened array of values by running each element in `collection` - * thru `iteratee` and flattening the mapped results. The iteratee is invoked - * with three arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [n, n]; - * } - * - * _.flatMap([1, 2], duplicate); - * // => [1, 1, 2, 2] - */ - function flatMap(collection, iteratee) { - return baseFlatten(map(collection, iteratee), 1); - } - - /** - * This method is like `_.flatMap` except that it recursively flattens the - * mapped results. - * - * @static - * @memberOf _ - * @since 4.7.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [[[n, n]]]; - * } - * - * _.flatMapDeep([1, 2], duplicate); - * // => [1, 1, 2, 2] - */ - function flatMapDeep(collection, iteratee) { - return baseFlatten(map(collection, iteratee), INFINITY); - } - - /** - * This method is like `_.flatMap` except that it recursively flattens the - * mapped results up to `depth` times. - * - * @static - * @memberOf _ - * @since 4.7.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {number} [depth=1] The maximum recursion depth. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [[[n, n]]]; - * } - * - * _.flatMapDepth([1, 2], duplicate, 2); - * // => [[1, 1], [2, 2]] - */ - function flatMapDepth(collection, iteratee, depth) { - depth = depth === undefined ? 1 : toInteger(depth); - return baseFlatten(map(collection, iteratee), depth); - } - - /** - * Iterates over elements of `collection` and invokes `iteratee` for each element. - * The iteratee is invoked with three arguments: (value, index|key, collection). - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * **Note:** As with other "Collections" methods, objects with a "length" - * property are iterated like arrays. To avoid this behavior use `_.forIn` - * or `_.forOwn` for object iteration. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @alias each - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @see _.forEachRight - * @example - * - * _.forEach([1, 2], function(value) { - * console.log(value); - * }); - * // => Logs `1` then `2`. - * - * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a' then 'b' (iteration order is not guaranteed). - */ - function forEach(collection, iteratee) { - var func = isArray(collection) ? arrayEach : baseEach; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.forEach` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @alias eachRight - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @see _.forEach - * @example - * - * _.forEachRight([1, 2], function(value) { - * console.log(value); - * }); - * // => Logs `2` then `1`. - */ - function forEachRight(collection, iteratee) { - var func = isArray(collection) ? arrayEachRight : baseEachRight; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The order of grouped values - * is determined by the order they occur in `collection`. The corresponding - * value of each key is an array of elements responsible for generating the - * key. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.groupBy([6.1, 4.2, 6.3], Math.floor); - * // => { '4': [4.2], '6': [6.1, 6.3] } - * - * // The `_.property` iteratee shorthand. - * _.groupBy(['one', 'two', 'three'], 'length'); - * // => { '3': ['one', 'two'], '5': ['three'] } - */ - var groupBy = createAggregator(function(result, value, key) { - if (hasOwnProperty.call(result, key)) { - result[key].push(value); - } else { - baseAssignValue(result, key, [value]); - } - }); - - /** - * Checks if `value` is in `collection`. If `collection` is a string, it's - * checked for a substring of `value`, otherwise - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * is used for equality comparisons. If `fromIndex` is negative, it's used as - * the offset from the end of `collection`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object|string} collection The collection to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. - * @returns {boolean} Returns `true` if `value` is found, else `false`. - * @example - * - * _.includes([1, 2, 3], 1); - * // => true - * - * _.includes([1, 2, 3], 1, 2); - * // => false - * - * _.includes({ 'a': 1, 'b': 2 }, 1); - * // => true - * - * _.includes('abcd', 'bc'); - * // => true - */ - function includes(collection, value, fromIndex, guard) { - collection = isArrayLike(collection) ? collection : values(collection); - fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; - - var length = collection.length; - if (fromIndex < 0) { - fromIndex = nativeMax(length + fromIndex, 0); - } - return isString(collection) - ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) - : (!!length && baseIndexOf(collection, value, fromIndex) > -1); - } - - /** - * Invokes the method at `path` of each element in `collection`, returning - * an array of the results of each invoked method. Any additional arguments - * are provided to each invoked method. If `path` is a function, it's invoked - * for, and `this` bound to, each element in `collection`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Array|Function|string} path The path of the method to invoke or - * the function invoked per iteration. - * @param {...*} [args] The arguments to invoke each method with. - * @returns {Array} Returns the array of results. - * @example - * - * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); - * // => [[1, 5, 7], [1, 2, 3]] - * - * _.invokeMap([123, 456], String.prototype.split, ''); - * // => [['1', '2', '3'], ['4', '5', '6']] - */ - var invokeMap = baseRest(function(collection, path, args) { - var index = -1, - isFunc = typeof path == 'function', - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value) { - result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); - }); - return result; - }); - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The corresponding value of - * each key is the last element responsible for generating the key. The - * iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * var array = [ - * { 'dir': 'left', 'code': 97 }, - * { 'dir': 'right', 'code': 100 } - * ]; - * - * _.keyBy(array, function(o) { - * return String.fromCharCode(o.code); - * }); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - * - * _.keyBy(array, 'dir'); - * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } - */ - var keyBy = createAggregator(function(result, value, key) { - baseAssignValue(result, key, value); - }); - - /** - * Creates an array of values by running each element in `collection` thru - * `iteratee`. The iteratee is invoked with three arguments: - * (value, index|key, collection). - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. - * - * The guarded methods are: - * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, - * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, - * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, - * `template`, `trim`, `trimEnd`, `trimStart`, and `words` - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - * @example - * - * function square(n) { - * return n * n; - * } - * - * _.map([4, 8], square); - * // => [16, 64] - * - * _.map({ 'a': 4, 'b': 8 }, square); - * // => [16, 64] (iteration order is not guaranteed) - * - * var users = [ - * { 'user': 'barney' }, - * { 'user': 'fred' } - * ]; - * - * // The `_.property` iteratee shorthand. - * _.map(users, 'user'); - * // => ['barney', 'fred'] - */ - function map(collection, iteratee) { - var func = isArray(collection) ? arrayMap : baseMap; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.sortBy` except that it allows specifying the sort - * orders of the iteratees to sort by. If `orders` is unspecified, all values - * are sorted in ascending order. Otherwise, specify an order of "desc" for - * descending or "asc" for ascending sort order of corresponding values. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] - * The iteratees to sort by. - * @param {string[]} [orders] The sort orders of `iteratees`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. - * @returns {Array} Returns the new sorted array. - * @example - * - * var users = [ - * { 'user': 'fred', 'age': 48 }, - * { 'user': 'barney', 'age': 34 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'barney', 'age': 36 } - * ]; - * - * // Sort by `user` in ascending order and by `age` in descending order. - * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] - */ - function orderBy(collection, iteratees, orders, guard) { - if (collection == null) { - return []; - } - if (!isArray(iteratees)) { - iteratees = iteratees == null ? [] : [iteratees]; - } - orders = guard ? undefined : orders; - if (!isArray(orders)) { - orders = orders == null ? [] : [orders]; - } - return baseOrderBy(collection, iteratees, orders); - } - - /** - * Creates an array of elements split into two groups, the first of which - * contains elements `predicate` returns truthy for, the second of which - * contains elements `predicate` returns falsey for. The predicate is - * invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the array of grouped elements. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': true }, - * { 'user': 'pebbles', 'age': 1, 'active': false } - * ]; - * - * _.partition(users, function(o) { return o.active; }); - * // => objects for [['fred'], ['barney', 'pebbles']] - * - * // The `_.matches` iteratee shorthand. - * _.partition(users, { 'age': 1, 'active': false }); - * // => objects for [['pebbles'], ['barney', 'fred']] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.partition(users, ['active', false]); - * // => objects for [['barney', 'pebbles'], ['fred']] - * - * // The `_.property` iteratee shorthand. - * _.partition(users, 'active'); - * // => objects for [['fred'], ['barney', 'pebbles']] - */ - var partition = createAggregator(function(result, value, key) { - result[key ? 0 : 1].push(value); - }, function() { return [[], []]; }); - - /** - * Reduces `collection` to a value which is the accumulated result of running - * each element in `collection` thru `iteratee`, where each successive - * invocation is supplied the return value of the previous. If `accumulator` - * is not given, the first element of `collection` is used as the initial - * value. The iteratee is invoked with four arguments: - * (accumulator, value, index|key, collection). - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.reduce`, `_.reduceRight`, and `_.transform`. - * - * The guarded methods are: - * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, - * and `sortBy` - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @returns {*} Returns the accumulated value. - * @see _.reduceRight - * @example - * - * _.reduce([1, 2], function(sum, n) { - * return sum + n; - * }, 0); - * // => 3 - * - * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { - * (result[value] || (result[value] = [])).push(key); - * return result; - * }, {}); - * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) - */ - function reduce(collection, iteratee, accumulator) { - var func = isArray(collection) ? arrayReduce : baseReduce, - initAccum = arguments.length < 3; - - return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); - } - - /** - * This method is like `_.reduce` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @returns {*} Returns the accumulated value. - * @see _.reduce - * @example - * - * var array = [[0, 1], [2, 3], [4, 5]]; - * - * _.reduceRight(array, function(flattened, other) { - * return flattened.concat(other); - * }, []); - * // => [4, 5, 2, 3, 0, 1] - */ - function reduceRight(collection, iteratee, accumulator) { - var func = isArray(collection) ? arrayReduceRight : baseReduce, - initAccum = arguments.length < 3; - - return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); - } - - /** - * The opposite of `_.filter`; this method returns the elements of `collection` - * that `predicate` does **not** return truthy for. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - * @see _.filter - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': true } - * ]; - * - * _.reject(users, function(o) { return !o.active; }); - * // => objects for ['fred'] - * - * // The `_.matches` iteratee shorthand. - * _.reject(users, { 'age': 40, 'active': true }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.reject(users, ['active', false]); - * // => objects for ['fred'] - * - * // The `_.property` iteratee shorthand. - * _.reject(users, 'active'); - * // => objects for ['barney'] - */ - function reject(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - return func(collection, negate(getIteratee(predicate, 3))); - } - - /** - * Gets a random element from `collection`. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Collection - * @param {Array|Object} collection The collection to sample. - * @returns {*} Returns the random element. - * @example - * - * _.sample([1, 2, 3, 4]); - * // => 2 - */ - function sample(collection) { - var func = isArray(collection) ? arraySample : baseSample; - return func(collection); - } - - /** - * Gets `n` random elements at unique keys from `collection` up to the - * size of `collection`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to sample. - * @param {number} [n=1] The number of elements to sample. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the random elements. - * @example - * - * _.sampleSize([1, 2, 3], 2); - * // => [3, 1] - * - * _.sampleSize([1, 2, 3], 4); - * // => [2, 3, 1] - */ - function sampleSize(collection, n, guard) { - if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { - n = 1; - } else { - n = toInteger(n); - } - var func = isArray(collection) ? arraySampleSize : baseSampleSize; - return func(collection, n); - } - - /** - * Creates an array of shuffled values, using a version of the - * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to shuffle. - * @returns {Array} Returns the new shuffled array. - * @example - * - * _.shuffle([1, 2, 3, 4]); - * // => [4, 1, 3, 2] - */ - function shuffle(collection) { - var func = isArray(collection) ? arrayShuffle : baseShuffle; - return func(collection); - } - - /** - * Gets the size of `collection` by returning its length for array-like - * values or the number of own enumerable string keyed properties for objects. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object|string} collection The collection to inspect. - * @returns {number} Returns the collection size. - * @example - * - * _.size([1, 2, 3]); - * // => 3 - * - * _.size({ 'a': 1, 'b': 2 }); - * // => 2 - * - * _.size('pebbles'); - * // => 7 - */ - function size(collection) { - if (collection == null) { - return 0; - } - if (isArrayLike(collection)) { - return isString(collection) ? stringSize(collection) : collection.length; - } - var tag = getTag(collection); - if (tag == mapTag || tag == setTag) { - return collection.size; - } - return baseKeys(collection).length; - } - - /** - * Checks if `predicate` returns truthy for **any** element of `collection`. - * Iteration is stopped once `predicate` returns truthy. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - * @example - * - * _.some([null, 0, 'yes', false], Boolean); - * // => true - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.some(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // The `_.matchesProperty` iteratee shorthand. - * _.some(users, ['active', false]); - * // => true - * - * // The `_.property` iteratee shorthand. - * _.some(users, 'active'); - * // => true - */ - function some(collection, predicate, guard) { - var func = isArray(collection) ? arraySome : baseSome; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined; - } - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection thru each iteratee. This method - * performs a stable sort, that is, it preserves the original sort order of - * equal elements. The iteratees are invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {...(Function|Function[])} [iteratees=[_.identity]] - * The iteratees to sort by. - * @returns {Array} Returns the new sorted array. - * @example - * - * var users = [ - * { 'user': 'fred', 'age': 48 }, - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'barney', 'age': 34 } - * ]; - * - * _.sortBy(users, [function(o) { return o.user; }]); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] - * - * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] - */ - var sortBy = baseRest(function(collection, iteratees) { - if (collection == null) { - return []; - } - var length = iteratees.length; - if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { - iteratees = []; - } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { - iteratees = [iteratees[0]]; - } - return baseOrderBy(collection, baseFlatten(iteratees, 1), []); - }); - - /*------------------------------------------------------------------------*/ - - /** - * Gets the timestamp of the number of milliseconds that have elapsed since - * the Unix epoch (1 January 1970 00:00:00 UTC). - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Date - * @returns {number} Returns the timestamp. - * @example - * - * _.defer(function(stamp) { - * console.log(_.now() - stamp); - * }, _.now()); - * // => Logs the number of milliseconds it took for the deferred invocation. - */ - var now = ctxNow || function() { - return root.Date.now(); - }; - - /*------------------------------------------------------------------------*/ - - /** - * The opposite of `_.before`; this method creates a function that invokes - * `func` once it's called `n` or more times. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {number} n The number of calls before `func` is invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var saves = ['profile', 'settings']; - * - * var done = _.after(saves.length, function() { - * console.log('done saving!'); - * }); - * - * _.forEach(saves, function(type) { - * asyncSave({ 'type': type, 'complete': done }); - * }); - * // => Logs 'done saving!' after the two async saves have completed. - */ - function after(n, func) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n < 1) { - return func.apply(this, arguments); - } - }; - } - - /** - * Creates a function that invokes `func`, with up to `n` arguments, - * ignoring any additional arguments. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to cap arguments for. - * @param {number} [n=func.length] The arity cap. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new capped function. - * @example - * - * _.map(['6', '8', '10'], _.ary(parseInt, 1)); - * // => [6, 8, 10] - */ - function ary(func, n, guard) { - n = guard ? undefined : n; - n = (func && n == null) ? func.length : n; - return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); - } - - /** - * Creates a function that invokes `func`, with the `this` binding and arguments - * of the created function, while it's called less than `n` times. Subsequent - * calls to the created function return the result of the last `func` invocation. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {number} n The number of calls at which `func` is no longer invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * jQuery(element).on('click', _.before(5, addContactToList)); - * // => Allows adding up to 4 contacts to the list. - */ - function before(n, func) { - var result; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n > 0) { - result = func.apply(this, arguments); - } - if (n <= 1) { - func = undefined; - } - return result; - }; - } - - /** - * Creates a function that invokes `func` with the `this` binding of `thisArg` - * and `partials` prepended to the arguments it receives. - * - * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for partially applied arguments. - * - * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" - * property of bound functions. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to bind. - * @param {*} thisArg The `this` binding of `func`. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * function greet(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * } - * - * var object = { 'user': 'fred' }; - * - * var bound = _.bind(greet, object, 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * // Bound with placeholders. - * var bound = _.bind(greet, object, _, '!'); - * bound('hi'); - * // => 'hi fred!' - */ - var bind = baseRest(function(func, thisArg, partials) { - var bitmask = WRAP_BIND_FLAG; - if (partials.length) { - var holders = replaceHolders(partials, getHolder(bind)); - bitmask |= WRAP_PARTIAL_FLAG; - } - return createWrap(func, bitmask, thisArg, partials, holders); - }); - - /** - * Creates a function that invokes the method at `object[key]` with `partials` - * prepended to the arguments it receives. - * - * This method differs from `_.bind` by allowing bound functions to reference - * methods that may be redefined or don't yet exist. See - * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) - * for more details. - * - * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * @static - * @memberOf _ - * @since 0.10.0 - * @category Function - * @param {Object} object The object to invoke the method on. - * @param {string} key The key of the method. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var object = { - * 'user': 'fred', - * 'greet': function(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * } - * }; - * - * var bound = _.bindKey(object, 'greet', 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * object.greet = function(greeting, punctuation) { - * return greeting + 'ya ' + this.user + punctuation; - * }; - * - * bound('!'); - * // => 'hiya fred!' - * - * // Bound with placeholders. - * var bound = _.bindKey(object, 'greet', _, '!'); - * bound('hi'); - * // => 'hiya fred!' - */ - var bindKey = baseRest(function(object, key, partials) { - var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; - if (partials.length) { - var holders = replaceHolders(partials, getHolder(bindKey)); - bitmask |= WRAP_PARTIAL_FLAG; - } - return createWrap(key, bitmask, object, partials, holders); - }); - - /** - * Creates a function that accepts arguments of `func` and either invokes - * `func` returning its result, if at least `arity` number of arguments have - * been provided, or returns a function that accepts the remaining `func` - * arguments, and so on. The arity of `func` may be specified if `func.length` - * is not sufficient. - * - * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for provided arguments. - * - * **Note:** This method doesn't set the "length" property of curried functions. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Function - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new curried function. - * @example - * - * var abc = function(a, b, c) { - * return [a, b, c]; - * }; - * - * var curried = _.curry(abc); - * - * curried(1)(2)(3); - * // => [1, 2, 3] - * - * curried(1, 2)(3); - * // => [1, 2, 3] - * - * curried(1, 2, 3); - * // => [1, 2, 3] - * - * // Curried with placeholders. - * curried(1)(_, 3)(2); - * // => [1, 2, 3] - */ - function curry(func, arity, guard) { - arity = guard ? undefined : arity; - var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curry.placeholder; - return result; - } - - /** - * This method is like `_.curry` except that arguments are applied to `func` - * in the manner of `_.partialRight` instead of `_.partial`. - * - * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for provided arguments. - * - * **Note:** This method doesn't set the "length" property of curried functions. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new curried function. - * @example - * - * var abc = function(a, b, c) { - * return [a, b, c]; - * }; - * - * var curried = _.curryRight(abc); - * - * curried(3)(2)(1); - * // => [1, 2, 3] - * - * curried(2, 3)(1); - * // => [1, 2, 3] - * - * curried(1, 2, 3); - * // => [1, 2, 3] - * - * // Curried with placeholders. - * curried(3)(1, _)(2); - * // => [1, 2, 3] - */ - function curryRight(func, arity, guard) { - arity = guard ? undefined : arity; - var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curryRight.placeholder; - return result; - } - - /** - * Creates a debounced function that delays invoking `func` until after `wait` - * milliseconds have elapsed since the last time the debounced function was - * invoked. The debounced function comes with a `cancel` method to cancel - * delayed `func` invocations and a `flush` method to immediately invoke them. - * Provide `options` to indicate whether `func` should be invoked on the - * leading and/or trailing edge of the `wait` timeout. The `func` is invoked - * with the last arguments provided to the debounced function. Subsequent - * calls to the debounced function return the result of the last `func` - * invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is - * invoked on the trailing edge of the timeout only if the debounced function - * is invoked more than once during the `wait` timeout. - * - * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred - * until to the next tick, similar to `setTimeout` with a timeout of `0`. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.debounce` and `_.throttle`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to debounce. - * @param {number} [wait=0] The number of milliseconds to delay. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=false] - * Specify invoking on the leading edge of the timeout. - * @param {number} [options.maxWait] - * The maximum time `func` is allowed to be delayed before it's invoked. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // Avoid costly calculations while the window size is in flux. - * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); - * - * // Invoke `sendMail` when clicked, debouncing subsequent calls. - * jQuery(element).on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * })); - * - * // Ensure `batchLog` is invoked once after 1 second of debounced calls. - * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); - * var source = new EventSource('/stream'); - * jQuery(source).on('message', debounced); - * - * // Cancel the trailing debounced invocation. - * jQuery(window).on('popstate', debounced.cancel); - */ - function debounce(func, wait, options) { - var lastArgs, - lastThis, - maxWait, - result, - timerId, - lastCallTime, - lastInvokeTime = 0, - leading = false, - maxing = false, - trailing = true; - - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - wait = toNumber(wait) || 0; - if (isObject(options)) { - leading = !!options.leading; - maxing = 'maxWait' in options; - maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - - function invokeFunc(time) { - var args = lastArgs, - thisArg = lastThis; - - lastArgs = lastThis = undefined; - lastInvokeTime = time; - result = func.apply(thisArg, args); - return result; - } - - function leadingEdge(time) { - // Reset any `maxWait` timer. - lastInvokeTime = time; - // Start the timer for the trailing edge. - timerId = setTimeout(timerExpired, wait); - // Invoke the leading edge. - return leading ? invokeFunc(time) : result; - } - - function remainingWait(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime, - timeWaiting = wait - timeSinceLastCall; - - return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; - } - - function shouldInvoke(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime; - - // Either this is the first call, activity has stopped and we're at the - // trailing edge, the system time has gone backwards and we're treating - // it as the trailing edge, or we've hit the `maxWait` limit. - return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); - } - - function timerExpired() { - var time = now(); - if (shouldInvoke(time)) { - return trailingEdge(time); - } - // Restart the timer. - timerId = setTimeout(timerExpired, remainingWait(time)); - } - - function trailingEdge(time) { - timerId = undefined; - - // Only invoke if we have `lastArgs` which means `func` has been - // debounced at least once. - if (trailing && lastArgs) { - return invokeFunc(time); - } - lastArgs = lastThis = undefined; - return result; - } - - function cancel() { - if (timerId !== undefined) { - clearTimeout(timerId); - } - lastInvokeTime = 0; - lastArgs = lastCallTime = lastThis = timerId = undefined; - } - - function flush() { - return timerId === undefined ? result : trailingEdge(now()); - } - - function debounced() { - var time = now(), - isInvoking = shouldInvoke(time); - - lastArgs = arguments; - lastThis = this; - lastCallTime = time; - - if (isInvoking) { - if (timerId === undefined) { - return leadingEdge(lastCallTime); - } - if (maxing) { - // Handle invocations in a tight loop. - timerId = setTimeout(timerExpired, wait); - return invokeFunc(lastCallTime); - } - } - if (timerId === undefined) { - timerId = setTimeout(timerExpired, wait); - } - return result; - } - debounced.cancel = cancel; - debounced.flush = flush; - return debounced; - } - - /** - * Defers invoking the `func` until the current call stack has cleared. Any - * additional arguments are provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to defer. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.defer(function(text) { - * console.log(text); - * }, 'deferred'); - * // => Logs 'deferred' after one millisecond. - */ - var defer = baseRest(function(func, args) { - return baseDelay(func, 1, args); - }); - - /** - * Invokes `func` after `wait` milliseconds. Any additional arguments are - * provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.delay(function(text) { - * console.log(text); - * }, 1000, 'later'); - * // => Logs 'later' after one second. - */ - var delay = baseRest(function(func, wait, args) { - return baseDelay(func, toNumber(wait) || 0, args); - }); - - /** - * Creates a function that invokes `func` with arguments reversed. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @param {Function} func The function to flip arguments for. - * @returns {Function} Returns the new flipped function. - * @example - * - * var flipped = _.flip(function() { - * return _.toArray(arguments); - * }); - * - * flipped('a', 'b', 'c', 'd'); - * // => ['d', 'c', 'b', 'a'] - */ - function flip(func) { - return createWrap(func, WRAP_FLIP_FLAG); - } - - /** - * Creates a function that memoizes the result of `func`. If `resolver` is - * provided, it determines the cache key for storing the result based on the - * arguments provided to the memoized function. By default, the first argument - * provided to the memoized function is used as the map cache key. The `func` - * is invoked with the `this` binding of the memoized function. - * - * **Note:** The cache is exposed as the `cache` property on the memoized - * function. Its creation may be customized by replacing the `_.memoize.Cache` - * constructor with one whose instances implement the - * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) - * method interface of `clear`, `delete`, `get`, `has`, and `set`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to have its output memoized. - * @param {Function} [resolver] The function to resolve the cache key. - * @returns {Function} Returns the new memoized function. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * var other = { 'c': 3, 'd': 4 }; - * - * var values = _.memoize(_.values); - * values(object); - * // => [1, 2] - * - * values(other); - * // => [3, 4] - * - * object.a = 2; - * values(object); - * // => [1, 2] - * - * // Modify the result cache. - * values.cache.set(object, ['a', 'b']); - * values(object); - * // => ['a', 'b'] - * - * // Replace `_.memoize.Cache`. - * _.memoize.Cache = WeakMap; - */ - function memoize(func, resolver) { - if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { - throw new TypeError(FUNC_ERROR_TEXT); - } - var memoized = function() { - var args = arguments, - key = resolver ? resolver.apply(this, args) : args[0], - cache = memoized.cache; - - if (cache.has(key)) { - return cache.get(key); - } - var result = func.apply(this, args); - memoized.cache = cache.set(key, result) || cache; - return result; - }; - memoized.cache = new (memoize.Cache || MapCache); - return memoized; - } - - // Expose `MapCache`. - memoize.Cache = MapCache; - - /** - * Creates a function that negates the result of the predicate `func`. The - * `func` predicate is invoked with the `this` binding and arguments of the - * created function. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} predicate The predicate to negate. - * @returns {Function} Returns the new negated function. - * @example - * - * function isEven(n) { - * return n % 2 == 0; - * } - * - * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); - * // => [1, 3, 5] - */ - function negate(predicate) { - if (typeof predicate != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return function() { - var args = arguments; - switch (args.length) { - case 0: return !predicate.call(this); - case 1: return !predicate.call(this, args[0]); - case 2: return !predicate.call(this, args[0], args[1]); - case 3: return !predicate.call(this, args[0], args[1], args[2]); - } - return !predicate.apply(this, args); - }; - } - - /** - * Creates a function that is restricted to invoking `func` once. Repeat calls - * to the function return the value of the first invocation. The `func` is - * invoked with the `this` binding and arguments of the created function. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var initialize = _.once(createApplication); - * initialize(); - * initialize(); - * // => `createApplication` is invoked once - */ - function once(func) { - return before(2, func); - } - - /** - * Creates a function that invokes `func` with its arguments transformed. - * - * @static - * @since 4.0.0 - * @memberOf _ - * @category Function - * @param {Function} func The function to wrap. - * @param {...(Function|Function[])} [transforms=[_.identity]] - * The argument transforms. - * @returns {Function} Returns the new function. - * @example - * - * function doubled(n) { - * return n * 2; - * } - * - * function square(n) { - * return n * n; - * } - * - * var func = _.overArgs(function(x, y) { - * return [x, y]; - * }, [square, doubled]); - * - * func(9, 3); - * // => [81, 6] - * - * func(10, 5); - * // => [100, 10] - */ - var overArgs = castRest(function(func, transforms) { - transforms = (transforms.length == 1 && isArray(transforms[0])) - ? arrayMap(transforms[0], baseUnary(getIteratee())) - : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); - - var funcsLength = transforms.length; - return baseRest(function(args) { - var index = -1, - length = nativeMin(args.length, funcsLength); - - while (++index < length) { - args[index] = transforms[index].call(this, args[index]); - } - return apply(func, this, args); - }); - }); - - /** - * Creates a function that invokes `func` with `partials` prepended to the - * arguments it receives. This method is like `_.bind` except it does **not** - * alter the `this` binding. - * - * The `_.partial.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * **Note:** This method doesn't set the "length" property of partially - * applied functions. - * - * @static - * @memberOf _ - * @since 0.2.0 - * @category Function - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * function greet(greeting, name) { - * return greeting + ' ' + name; - * } - * - * var sayHelloTo = _.partial(greet, 'hello'); - * sayHelloTo('fred'); - * // => 'hello fred' - * - * // Partially applied with placeholders. - * var greetFred = _.partial(greet, _, 'fred'); - * greetFred('hi'); - * // => 'hi fred' - */ - var partial = baseRest(function(func, partials) { - var holders = replaceHolders(partials, getHolder(partial)); - return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); - }); - - /** - * This method is like `_.partial` except that partially applied arguments - * are appended to the arguments it receives. - * - * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * **Note:** This method doesn't set the "length" property of partially - * applied functions. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Function - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * function greet(greeting, name) { - * return greeting + ' ' + name; - * } - * - * var greetFred = _.partialRight(greet, 'fred'); - * greetFred('hi'); - * // => 'hi fred' - * - * // Partially applied with placeholders. - * var sayHelloTo = _.partialRight(greet, 'hello', _); - * sayHelloTo('fred'); - * // => 'hello fred' - */ - var partialRight = baseRest(function(func, partials) { - var holders = replaceHolders(partials, getHolder(partialRight)); - return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); - }); - - /** - * Creates a function that invokes `func` with arguments arranged according - * to the specified `indexes` where the argument value at the first index is - * provided as the first argument, the argument value at the second index is - * provided as the second argument, and so on. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to rearrange arguments for. - * @param {...(number|number[])} indexes The arranged argument indexes. - * @returns {Function} Returns the new function. - * @example - * - * var rearged = _.rearg(function(a, b, c) { - * return [a, b, c]; - * }, [2, 0, 1]); - * - * rearged('b', 'c', 'a') - * // => ['a', 'b', 'c'] - */ - var rearg = flatRest(function(func, indexes) { - return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); - }); - - /** - * Creates a function that invokes `func` with the `this` binding of the - * created function and arguments from `start` and beyond provided as - * an array. - * - * **Note:** This method is based on the - * [rest parameter](https://mdn.io/rest_parameters). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - * @example - * - * var say = _.rest(function(what, names) { - * return what + ' ' + _.initial(names).join(', ') + - * (_.size(names) > 1 ? ', & ' : '') + _.last(names); - * }); - * - * say('hello', 'fred', 'barney', 'pebbles'); - * // => 'hello fred, barney, & pebbles' - */ - function rest(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - start = start === undefined ? start : toInteger(start); - return baseRest(func, start); - } - - /** - * Creates a function that invokes `func` with the `this` binding of the - * create function and an array of arguments much like - * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). - * - * **Note:** This method is based on the - * [spread operator](https://mdn.io/spread_operator). - * - * @static - * @memberOf _ - * @since 3.2.0 - * @category Function - * @param {Function} func The function to spread arguments over. - * @param {number} [start=0] The start position of the spread. - * @returns {Function} Returns the new function. - * @example - * - * var say = _.spread(function(who, what) { - * return who + ' says ' + what; - * }); - * - * say(['fred', 'hello']); - * // => 'fred says hello' - * - * var numbers = Promise.all([ - * Promise.resolve(40), - * Promise.resolve(36) - * ]); - * - * numbers.then(_.spread(function(x, y) { - * return x + y; - * })); - * // => a Promise of 76 - */ - function spread(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - start = start == null ? 0 : nativeMax(toInteger(start), 0); - return baseRest(function(args) { - var array = args[start], - otherArgs = castSlice(args, 0, start); - - if (array) { - arrayPush(otherArgs, array); - } - return apply(func, this, otherArgs); - }); - } - - /** - * Creates a throttled function that only invokes `func` at most once per - * every `wait` milliseconds. The throttled function comes with a `cancel` - * method to cancel delayed `func` invocations and a `flush` method to - * immediately invoke them. Provide `options` to indicate whether `func` - * should be invoked on the leading and/or trailing edge of the `wait` - * timeout. The `func` is invoked with the last arguments provided to the - * throttled function. Subsequent calls to the throttled function return the - * result of the last `func` invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is - * invoked on the trailing edge of the timeout only if the throttled function - * is invoked more than once during the `wait` timeout. - * - * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred - * until to the next tick, similar to `setTimeout` with a timeout of `0`. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.throttle` and `_.debounce`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to throttle. - * @param {number} [wait=0] The number of milliseconds to throttle invocations to. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=true] - * Specify invoking on the leading edge of the timeout. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new throttled function. - * @example - * - * // Avoid excessively updating the position while scrolling. - * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); - * - * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. - * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); - * jQuery(element).on('click', throttled); - * - * // Cancel the trailing throttled invocation. - * jQuery(window).on('popstate', throttled.cancel); - */ - function throttle(func, wait, options) { - var leading = true, - trailing = true; - - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - if (isObject(options)) { - leading = 'leading' in options ? !!options.leading : leading; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - return debounce(func, wait, { - 'leading': leading, - 'maxWait': wait, - 'trailing': trailing - }); - } - - /** - * Creates a function that accepts up to one argument, ignoring any - * additional arguments. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - * @example - * - * _.map(['6', '8', '10'], _.unary(parseInt)); - * // => [6, 8, 10] - */ - function unary(func) { - return ary(func, 1); - } - - /** - * Creates a function that provides `value` to `wrapper` as its first - * argument. Any additional arguments provided to the function are appended - * to those provided to the `wrapper`. The wrapper is invoked with the `this` - * binding of the created function. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {*} value The value to wrap. - * @param {Function} [wrapper=identity] The wrapper function. - * @returns {Function} Returns the new function. - * @example - * - * var p = _.wrap(_.escape, function(func, text) { - * return '

' + func(text) + '

'; - * }); - * - * p('fred, barney, & pebbles'); - * // => '

fred, barney, & pebbles

' - */ - function wrap(value, wrapper) { - return partial(castFunction(wrapper), value); - } - - /*------------------------------------------------------------------------*/ - - /** - * Casts `value` as an array if it's not one. - * - * @static - * @memberOf _ - * @since 4.4.0 - * @category Lang - * @param {*} value The value to inspect. - * @returns {Array} Returns the cast array. - * @example - * - * _.castArray(1); - * // => [1] - * - * _.castArray({ 'a': 1 }); - * // => [{ 'a': 1 }] - * - * _.castArray('abc'); - * // => ['abc'] - * - * _.castArray(null); - * // => [null] - * - * _.castArray(undefined); - * // => [undefined] - * - * _.castArray(); - * // => [] - * - * var array = [1, 2, 3]; - * console.log(_.castArray(array) === array); - * // => true - */ - function castArray() { - if (!arguments.length) { - return []; - } - var value = arguments[0]; - return isArray(value) ? value : [value]; - } - - /** - * Creates a shallow clone of `value`. - * - * **Note:** This method is loosely based on the - * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) - * and supports cloning arrays, array buffers, booleans, date objects, maps, - * numbers, `Object` objects, regexes, sets, strings, symbols, and typed - * arrays. The own enumerable properties of `arguments` objects are cloned - * as plain objects. An empty object is returned for uncloneable values such - * as error objects, functions, DOM nodes, and WeakMaps. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to clone. - * @returns {*} Returns the cloned value. - * @see _.cloneDeep - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var shallow = _.clone(objects); - * console.log(shallow[0] === objects[0]); - * // => true - */ - function clone(value) { - return baseClone(value, CLONE_SYMBOLS_FLAG); - } - - /** - * This method is like `_.clone` except that it accepts `customizer` which - * is invoked to produce the cloned value. If `customizer` returns `undefined`, - * cloning is handled by the method instead. The `customizer` is invoked with - * up to four arguments; (value [, index|key, object, stack]). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to clone. - * @param {Function} [customizer] The function to customize cloning. - * @returns {*} Returns the cloned value. - * @see _.cloneDeepWith - * @example - * - * function customizer(value) { - * if (_.isElement(value)) { - * return value.cloneNode(false); - * } - * } - * - * var el = _.cloneWith(document.body, customizer); - * - * console.log(el === document.body); - * // => false - * console.log(el.nodeName); - * // => 'BODY' - * console.log(el.childNodes.length); - * // => 0 - */ - function cloneWith(value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); - } - - /** - * This method is like `_.clone` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @returns {*} Returns the deep cloned value. - * @see _.clone - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var deep = _.cloneDeep(objects); - * console.log(deep[0] === objects[0]); - * // => false - */ - function cloneDeep(value) { - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); - } - - /** - * This method is like `_.cloneWith` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @param {Function} [customizer] The function to customize cloning. - * @returns {*} Returns the deep cloned value. - * @see _.cloneWith - * @example - * - * function customizer(value) { - * if (_.isElement(value)) { - * return value.cloneNode(true); - * } - * } - * - * var el = _.cloneDeepWith(document.body, customizer); - * - * console.log(el === document.body); - * // => false - * console.log(el.nodeName); - * // => 'BODY' - * console.log(el.childNodes.length); - * // => 20 - */ - function cloneDeepWith(value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); - } - - /** - * Checks if `object` conforms to `source` by invoking the predicate - * properties of `source` with the corresponding property values of `object`. - * - * **Note:** This method is equivalent to `_.conforms` when `source` is - * partially applied. - * - * @static - * @memberOf _ - * @since 4.14.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property predicates to conform to. - * @returns {boolean} Returns `true` if `object` conforms, else `false`. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * - * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); - * // => true - * - * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); - * // => false - */ - function conformsTo(object, source) { - return source == null || baseConformsTo(object, source, keys(source)); - } - - /** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ - function eq(value, other) { - return value === other || (value !== value && other !== other); - } - - /** - * Checks if `value` is greater than `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, - * else `false`. - * @see _.lt - * @example - * - * _.gt(3, 1); - * // => true - * - * _.gt(3, 3); - * // => false - * - * _.gt(1, 3); - * // => false - */ - var gt = createRelationalOperation(baseGt); - - /** - * Checks if `value` is greater than or equal to `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than or equal to - * `other`, else `false`. - * @see _.lte - * @example - * - * _.gte(3, 1); - * // => true - * - * _.gte(3, 3); - * // => true - * - * _.gte(1, 3); - * // => false - */ - var gte = createRelationalOperation(function(value, other) { - return value >= other; - }); - - /** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { - return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); - }; - - /** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ - var isArray = Array.isArray; - - /** - * Checks if `value` is classified as an `ArrayBuffer` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. - * @example - * - * _.isArrayBuffer(new ArrayBuffer(2)); - * // => true - * - * _.isArrayBuffer(new Array(2)); - * // => false - */ - var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; - - /** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ - function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); - } - - /** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */ - function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); - } - - /** - * Checks if `value` is classified as a boolean primitive or object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. - * @example - * - * _.isBoolean(false); - * // => true - * - * _.isBoolean(null); - * // => false - */ - function isBoolean(value) { - return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); - } - - /** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */ - var isBuffer = nativeIsBuffer || stubFalse; - - /** - * Checks if `value` is classified as a `Date` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. - * @example - * - * _.isDate(new Date); - * // => true - * - * _.isDate('Mon April 23 2012'); - * // => false - */ - var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; - - /** - * Checks if `value` is likely a DOM element. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. - * @example - * - * _.isElement(document.body); - * // => true - * - * _.isElement(''); - * // => false - */ - function isElement(value) { - return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); - } - - /** - * Checks if `value` is an empty object, collection, map, or set. - * - * Objects are considered empty if they have no own enumerable string keyed - * properties. - * - * Array-like values such as `arguments` objects, arrays, buffers, strings, or - * jQuery-like collections are considered empty if they have a `length` of `0`. - * Similarly, maps and sets are considered empty if they have a `size` of `0`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is empty, else `false`. - * @example - * - * _.isEmpty(null); - * // => true - * - * _.isEmpty(true); - * // => true - * - * _.isEmpty(1); - * // => true - * - * _.isEmpty([1, 2, 3]); - * // => false - * - * _.isEmpty({ 'a': 1 }); - * // => false - */ - function isEmpty(value) { - if (value == null) { - return true; - } - if (isArrayLike(value) && - (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { - return !value.length; - } - var tag = getTag(value); - if (tag == mapTag || tag == setTag) { - return !value.size; - } - if (isPrototype(value)) { - return !baseKeys(value).length; - } - for (var key in value) { - if (hasOwnProperty.call(value, key)) { - return false; - } - } - return true; - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent. - * - * **Note:** This method supports comparing arrays, array buffers, booleans, - * date objects, error objects, maps, numbers, `Object` objects, regexes, - * sets, strings, symbols, and typed arrays. `Object` objects are compared - * by their own, not inherited, enumerable properties. Functions and DOM - * nodes are compared by strict equality, i.e. `===`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.isEqual(object, other); - * // => true - * - * object === other; - * // => false - */ - function isEqual(value, other) { - return baseIsEqual(value, other); - } - - /** - * This method is like `_.isEqual` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined`, comparisons - * are handled by the method instead. The `customizer` is invoked with up to - * six arguments: (objValue, othValue [, index|key, object, other, stack]). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * function isGreeting(value) { - * return /^h(?:i|ello)$/.test(value); - * } - * - * function customizer(objValue, othValue) { - * if (isGreeting(objValue) && isGreeting(othValue)) { - * return true; - * } - * } - * - * var array = ['hello', 'goodbye']; - * var other = ['hi', 'goodbye']; - * - * _.isEqualWith(array, other, customizer); - * // => true - */ - function isEqualWith(value, other, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - var result = customizer ? customizer(value, other) : undefined; - return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; - } - - /** - * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, - * `SyntaxError`, `TypeError`, or `URIError` object. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an error object, else `false`. - * @example - * - * _.isError(new Error); - * // => true - * - * _.isError(Error); - * // => false - */ - function isError(value) { - if (!isObjectLike(value)) { - return false; - } - var tag = baseGetTag(value); - return tag == errorTag || tag == domExcTag || - (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); - } - - /** - * Checks if `value` is a finite primitive number. - * - * **Note:** This method is based on - * [`Number.isFinite`](https://mdn.io/Number/isFinite). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. - * @example - * - * _.isFinite(3); - * // => true - * - * _.isFinite(Number.MIN_VALUE); - * // => true - * - * _.isFinite(Infinity); - * // => false - * - * _.isFinite('3'); - * // => false - */ - function isFinite(value) { - return typeof value == 'number' && nativeIsFinite(value); - } - - /** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ - function isFunction(value) { - if (!isObject(value)) { - return false; - } - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 9 which returns 'object' for typed arrays and other constructors. - var tag = baseGetTag(value); - return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; - } - - /** - * Checks if `value` is an integer. - * - * **Note:** This method is based on - * [`Number.isInteger`](https://mdn.io/Number/isInteger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an integer, else `false`. - * @example - * - * _.isInteger(3); - * // => true - * - * _.isInteger(Number.MIN_VALUE); - * // => false - * - * _.isInteger(Infinity); - * // => false - * - * _.isInteger('3'); - * // => false - */ - function isInteger(value) { - return typeof value == 'number' && value == toInteger(value); - } - - /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ - function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; - } - - /** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ - function isObject(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); - } - - /** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ - function isObjectLike(value) { - return value != null && typeof value == 'object'; - } - - /** - * Checks if `value` is classified as a `Map` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - * @example - * - * _.isMap(new Map); - * // => true - * - * _.isMap(new WeakMap); - * // => false - */ - var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; - - /** - * Performs a partial deep comparison between `object` and `source` to - * determine if `object` contains equivalent property values. - * - * **Note:** This method is equivalent to `_.matches` when `source` is - * partially applied. - * - * Partial comparisons will match empty array and empty object `source` - * values against any array or object value, respectively. See `_.isEqual` - * for a list of supported value comparisons. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * - * _.isMatch(object, { 'b': 2 }); - * // => true - * - * _.isMatch(object, { 'b': 1 }); - * // => false - */ - function isMatch(object, source) { - return object === source || baseIsMatch(object, source, getMatchData(source)); - } - - /** - * This method is like `_.isMatch` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined`, comparisons - * are handled by the method instead. The `customizer` is invoked with five - * arguments: (objValue, srcValue, index|key, object, source). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - * @example - * - * function isGreeting(value) { - * return /^h(?:i|ello)$/.test(value); - * } - * - * function customizer(objValue, srcValue) { - * if (isGreeting(objValue) && isGreeting(srcValue)) { - * return true; - * } - * } - * - * var object = { 'greeting': 'hello' }; - * var source = { 'greeting': 'hi' }; - * - * _.isMatchWith(object, source, customizer); - * // => true - */ - function isMatchWith(object, source, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseIsMatch(object, source, getMatchData(source), customizer); - } - - /** - * Checks if `value` is `NaN`. - * - * **Note:** This method is based on - * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as - * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for - * `undefined` and other non-number values. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - * @example - * - * _.isNaN(NaN); - * // => true - * - * _.isNaN(new Number(NaN)); - * // => true - * - * isNaN(undefined); - * // => true - * - * _.isNaN(undefined); - * // => false - */ - function isNaN(value) { - // An `NaN` primitive is the only value that is not equal to itself. - // Perform the `toStringTag` check first to avoid errors with some - // ActiveX objects in IE. - return isNumber(value) && value != +value; - } - - /** - * Checks if `value` is a pristine native function. - * - * **Note:** This method can't reliably detect native functions in the presence - * of the core-js package because core-js circumvents this kind of detection. - * Despite multiple requests, the core-js maintainer has made it clear: any - * attempt to fix the detection will be obstructed. As a result, we're left - * with little choice but to throw an error. Unfortunately, this also affects - * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), - * which rely on core-js. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ - function isNative(value) { - if (isMaskable(value)) { - throw new Error(CORE_ERROR_TEXT); - } - return baseIsNative(value); - } - - /** - * Checks if `value` is `null`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `null`, else `false`. - * @example - * - * _.isNull(null); - * // => true - * - * _.isNull(void 0); - * // => false - */ - function isNull(value) { - return value === null; - } - - /** - * Checks if `value` is `null` or `undefined`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is nullish, else `false`. - * @example - * - * _.isNil(null); - * // => true - * - * _.isNil(void 0); - * // => true - * - * _.isNil(NaN); - * // => false - */ - function isNil(value) { - return value == null; - } - - /** - * Checks if `value` is classified as a `Number` primitive or object. - * - * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are - * classified as numbers, use the `_.isFinite` method. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a number, else `false`. - * @example - * - * _.isNumber(3); - * // => true - * - * _.isNumber(Number.MIN_VALUE); - * // => true - * - * _.isNumber(Infinity); - * // => true - * - * _.isNumber('3'); - * // => false - */ - function isNumber(value) { - return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); - } - - /** - * Checks if `value` is a plain object, that is, an object created by the - * `Object` constructor or one with a `[[Prototype]]` of `null`. - * - * @static - * @memberOf _ - * @since 0.8.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * _.isPlainObject(new Foo); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'x': 0, 'y': 0 }); - * // => true - * - * _.isPlainObject(Object.create(null)); - * // => true - */ - function isPlainObject(value) { - if (!isObjectLike(value) || baseGetTag(value) != objectTag) { - return false; - } - var proto = getPrototype(value); - if (proto === null) { - return true; - } - var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; - return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; - } - - /** - * Checks if `value` is classified as a `RegExp` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. - * @example - * - * _.isRegExp(/abc/); - * // => true - * - * _.isRegExp('/abc/'); - * // => false - */ - var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; - - /** - * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 - * double precision number which isn't the result of a rounded unsafe integer. - * - * **Note:** This method is based on - * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. - * @example - * - * _.isSafeInteger(3); - * // => true - * - * _.isSafeInteger(Number.MIN_VALUE); - * // => false - * - * _.isSafeInteger(Infinity); - * // => false - * - * _.isSafeInteger('3'); - * // => false - */ - function isSafeInteger(value) { - return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; - } - - /** - * Checks if `value` is classified as a `Set` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - * @example - * - * _.isSet(new Set); - * // => true - * - * _.isSet(new WeakSet); - * // => false - */ - var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; - - /** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ - function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); - } - - /** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ - function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); - } - - /** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ - var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; - - /** - * Checks if `value` is `undefined`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. - * @example - * - * _.isUndefined(void 0); - * // => true - * - * _.isUndefined(null); - * // => false - */ - function isUndefined(value) { - return value === undefined; - } - - /** - * Checks if `value` is classified as a `WeakMap` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. - * @example - * - * _.isWeakMap(new WeakMap); - * // => true - * - * _.isWeakMap(new Map); - * // => false - */ - function isWeakMap(value) { - return isObjectLike(value) && getTag(value) == weakMapTag; - } - - /** - * Checks if `value` is classified as a `WeakSet` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. - * @example - * - * _.isWeakSet(new WeakSet); - * // => true - * - * _.isWeakSet(new Set); - * // => false - */ - function isWeakSet(value) { - return isObjectLike(value) && baseGetTag(value) == weakSetTag; - } - - /** - * Checks if `value` is less than `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, - * else `false`. - * @see _.gt - * @example - * - * _.lt(1, 3); - * // => true - * - * _.lt(3, 3); - * // => false - * - * _.lt(3, 1); - * // => false - */ - var lt = createRelationalOperation(baseLt); - - /** - * Checks if `value` is less than or equal to `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than or equal to - * `other`, else `false`. - * @see _.gte - * @example - * - * _.lte(1, 3); - * // => true - * - * _.lte(3, 3); - * // => true - * - * _.lte(3, 1); - * // => false - */ - var lte = createRelationalOperation(function(value, other) { - return value <= other; - }); - - /** - * Converts `value` to an array. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to convert. - * @returns {Array} Returns the converted array. - * @example - * - * _.toArray({ 'a': 1, 'b': 2 }); - * // => [1, 2] - * - * _.toArray('abc'); - * // => ['a', 'b', 'c'] - * - * _.toArray(1); - * // => [] - * - * _.toArray(null); - * // => [] - */ - function toArray(value) { - if (!value) { - return []; - } - if (isArrayLike(value)) { - return isString(value) ? stringToArray(value) : copyArray(value); - } - if (symIterator && value[symIterator]) { - return iteratorToArray(value[symIterator]()); - } - var tag = getTag(value), - func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); - - return func(value); - } - - /** - * Converts `value` to a finite number. - * - * @static - * @memberOf _ - * @since 4.12.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted number. - * @example - * - * _.toFinite(3.2); - * // => 3.2 - * - * _.toFinite(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toFinite(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toFinite('3.2'); - * // => 3.2 - */ - function toFinite(value) { - if (!value) { - return value === 0 ? value : 0; - } - value = toNumber(value); - if (value === INFINITY || value === -INFINITY) { - var sign = (value < 0 ? -1 : 1); - return sign * MAX_INTEGER; - } - return value === value ? value : 0; - } - - /** - * Converts `value` to an integer. - * - * **Note:** This method is loosely based on - * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toInteger(3.2); - * // => 3 - * - * _.toInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toInteger(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toInteger('3.2'); - * // => 3 - */ - function toInteger(value) { - var result = toFinite(value), - remainder = result % 1; - - return result === result ? (remainder ? result - remainder : result) : 0; - } - - /** - * Converts `value` to an integer suitable for use as the length of an - * array-like object. - * - * **Note:** This method is based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toLength(3.2); - * // => 3 - * - * _.toLength(Number.MIN_VALUE); - * // => 0 - * - * _.toLength(Infinity); - * // => 4294967295 - * - * _.toLength('3.2'); - * // => 3 - */ - function toLength(value) { - return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; - } - - /** - * Converts `value` to a number. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {number} Returns the number. - * @example - * - * _.toNumber(3.2); - * // => 3.2 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3.2'); - * // => 3.2 - */ - function toNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - if (isObject(value)) { - var other = typeof value.valueOf == 'function' ? value.valueOf() : value; - value = isObject(other) ? (other + '') : other; - } - if (typeof value != 'string') { - return value === 0 ? value : +value; - } - value = value.replace(reTrim, ''); - var isBinary = reIsBinary.test(value); - return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); - } - - /** - * Converts `value` to a plain object flattening inherited enumerable string - * keyed properties of `value` to own properties of the plain object. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {Object} Returns the converted plain object. - * @example - * - * function Foo() { - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.assign({ 'a': 1 }, new Foo); - * // => { 'a': 1, 'b': 2 } - * - * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); - * // => { 'a': 1, 'b': 2, 'c': 3 } - */ - function toPlainObject(value) { - return copyObject(value, keysIn(value)); - } - - /** - * Converts `value` to a safe integer. A safe integer can be compared and - * represented correctly. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toSafeInteger(3.2); - * // => 3 - * - * _.toSafeInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toSafeInteger(Infinity); - * // => 9007199254740991 - * - * _.toSafeInteger('3.2'); - * // => 3 - */ - function toSafeInteger(value) { - return value - ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) - : (value === 0 ? value : 0); - } - - /** - * Converts `value` to a string. An empty string is returned for `null` - * and `undefined` values. The sign of `-0` is preserved. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.toString(null); - * // => '' - * - * _.toString(-0); - * // => '-0' - * - * _.toString([1, 2, 3]); - * // => '1,2,3' - */ - function toString(value) { - return value == null ? '' : baseToString(value); - } - - /*------------------------------------------------------------------------*/ - - /** - * Assigns own enumerable string keyed properties of source objects to the - * destination object. Source objects are applied from left to right. - * Subsequent sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object` and is loosely based on - * [`Object.assign`](https://mdn.io/Object/assign). - * - * @static - * @memberOf _ - * @since 0.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assignIn - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * function Bar() { - * this.c = 3; - * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assign({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'c': 3 } - */ - var assign = createAssigner(function(object, source) { - if (isPrototype(source) || isArrayLike(source)) { - copyObject(source, keys(source), object); - return; - } - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - assignValue(object, key, source[key]); - } - } - }); - - /** - * This method is like `_.assign` except that it iterates over own and - * inherited source properties. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias extend - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assign - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * function Bar() { - * this.c = 3; - * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assignIn({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } - */ - var assignIn = createAssigner(function(object, source) { - copyObject(source, keysIn(source), object); - }); - - /** - * This method is like `_.assignIn` except that it accepts `customizer` - * which is invoked to produce the assigned values. If `customizer` returns - * `undefined`, assignment is handled by the method instead. The `customizer` - * is invoked with five arguments: (objValue, srcValue, key, object, source). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias extendWith - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @see _.assignWith - * @example - * - * function customizer(objValue, srcValue) { - * return _.isUndefined(objValue) ? srcValue : objValue; - * } - * - * var defaults = _.partialRight(_.assignInWith, customizer); - * - * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keysIn(source), object, customizer); - }); - - /** - * This method is like `_.assign` except that it accepts `customizer` - * which is invoked to produce the assigned values. If `customizer` returns - * `undefined`, assignment is handled by the method instead. The `customizer` - * is invoked with five arguments: (objValue, srcValue, key, object, source). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @see _.assignInWith - * @example - * - * function customizer(objValue, srcValue) { - * return _.isUndefined(objValue) ? srcValue : objValue; - * } - * - * var defaults = _.partialRight(_.assignWith, customizer); - * - * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var assignWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keys(source), object, customizer); - }); - - /** - * Creates an array of values corresponding to `paths` of `object`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Array} Returns the picked values. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; - * - * _.at(object, ['a[0].b.c', 'a[1]']); - * // => [3, 4] - */ - var at = flatRest(baseAt); - - /** - * Creates an object that inherits from the `prototype` object. If a - * `properties` object is given, its own enumerable string keyed properties - * are assigned to the created object. - * - * @static - * @memberOf _ - * @since 2.3.0 - * @category Object - * @param {Object} prototype The object to inherit from. - * @param {Object} [properties] The properties to assign to the object. - * @returns {Object} Returns the new object. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * function Circle() { - * Shape.call(this); - * } - * - * Circle.prototype = _.create(Shape.prototype, { - * 'constructor': Circle - * }); - * - * var circle = new Circle; - * circle instanceof Circle; - * // => true - * - * circle instanceof Shape; - * // => true - */ - function create(prototype, properties) { - var result = baseCreate(prototype); - return properties == null ? result : baseAssign(result, properties); - } - - /** - * Assigns own and inherited enumerable string keyed properties of source - * objects to the destination object for all destination properties that - * resolve to `undefined`. Source objects are applied from left to right. - * Once a property is set, additional values of the same property are ignored. - * - * **Note:** This method mutates `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.defaultsDeep - * @example - * - * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var defaults = baseRest(function(object, sources) { - object = Object(object); - - var index = -1; - var length = sources.length; - var guard = length > 2 ? sources[2] : undefined; - - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - length = 1; - } - - while (++index < length) { - var source = sources[index]; - var props = keysIn(source); - var propsIndex = -1; - var propsLength = props.length; - - while (++propsIndex < propsLength) { - var key = props[propsIndex]; - var value = object[key]; - - if (value === undefined || - (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { - object[key] = source[key]; - } - } - } - - return object; - }); - - /** - * This method is like `_.defaults` except that it recursively assigns - * default properties. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 3.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.defaults - * @example - * - * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); - * // => { 'a': { 'b': 2, 'c': 3 } } - */ - var defaultsDeep = baseRest(function(args) { - args.push(undefined, customDefaultsMerge); - return apply(mergeWith, undefined, args); - }); - - /** - * This method is like `_.find` except that it returns the key of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Object - * @param {Object} object The object to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, - * else `undefined`. - * @example - * - * var users = { - * 'barney': { 'age': 36, 'active': true }, - * 'fred': { 'age': 40, 'active': false }, - * 'pebbles': { 'age': 1, 'active': true } - * }; - * - * _.findKey(users, function(o) { return o.age < 40; }); - * // => 'barney' (iteration order is not guaranteed) - * - * // The `_.matches` iteratee shorthand. - * _.findKey(users, { 'age': 1, 'active': true }); - * // => 'pebbles' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findKey(users, ['active', false]); - * // => 'fred' - * - * // The `_.property` iteratee shorthand. - * _.findKey(users, 'active'); - * // => 'barney' - */ - function findKey(object, predicate) { - return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); - } - - /** - * This method is like `_.findKey` except that it iterates over elements of - * a collection in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, - * else `undefined`. - * @example - * - * var users = { - * 'barney': { 'age': 36, 'active': true }, - * 'fred': { 'age': 40, 'active': false }, - * 'pebbles': { 'age': 1, 'active': true } - * }; - * - * _.findLastKey(users, function(o) { return o.age < 40; }); - * // => returns 'pebbles' assuming `_.findKey` returns 'barney' - * - * // The `_.matches` iteratee shorthand. - * _.findLastKey(users, { 'age': 36, 'active': true }); - * // => 'barney' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findLastKey(users, ['active', false]); - * // => 'fred' - * - * // The `_.property` iteratee shorthand. - * _.findLastKey(users, 'active'); - * // => 'pebbles' - */ - function findLastKey(object, predicate) { - return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); - } - - /** - * Iterates over own and inherited enumerable string keyed properties of an - * object and invokes `iteratee` for each property. The iteratee is invoked - * with three arguments: (value, key, object). Iteratee functions may exit - * iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 0.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forInRight - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forIn(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). - */ - function forIn(object, iteratee) { - return object == null - ? object - : baseFor(object, getIteratee(iteratee, 3), keysIn); - } - - /** - * This method is like `_.forIn` except that it iterates over properties of - * `object` in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forIn - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forInRight(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. - */ - function forInRight(object, iteratee) { - return object == null - ? object - : baseForRight(object, getIteratee(iteratee, 3), keysIn); - } - - /** - * Iterates over own enumerable string keyed properties of an object and - * invokes `iteratee` for each property. The iteratee is invoked with three - * arguments: (value, key, object). Iteratee functions may exit iteration - * early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 0.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forOwnRight - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forOwn(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a' then 'b' (iteration order is not guaranteed). - */ - function forOwn(object, iteratee) { - return object && baseForOwn(object, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.forOwn` except that it iterates over properties of - * `object` in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forOwn - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forOwnRight(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. - */ - function forOwnRight(object, iteratee) { - return object && baseForOwnRight(object, getIteratee(iteratee, 3)); - } - - /** - * Creates an array of function property names from own enumerable properties - * of `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to inspect. - * @returns {Array} Returns the function names. - * @see _.functionsIn - * @example - * - * function Foo() { - * this.a = _.constant('a'); - * this.b = _.constant('b'); - * } - * - * Foo.prototype.c = _.constant('c'); - * - * _.functions(new Foo); - * // => ['a', 'b'] - */ - function functions(object) { - return object == null ? [] : baseFunctions(object, keys(object)); - } - - /** - * Creates an array of function property names from own and inherited - * enumerable properties of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to inspect. - * @returns {Array} Returns the function names. - * @see _.functions - * @example - * - * function Foo() { - * this.a = _.constant('a'); - * this.b = _.constant('b'); - * } - * - * Foo.prototype.c = _.constant('c'); - * - * _.functionsIn(new Foo); - * // => ['a', 'b', 'c'] - */ - function functionsIn(object) { - return object == null ? [] : baseFunctions(object, keysIn(object)); - } - - /** - * Gets the value at `path` of `object`. If the resolved value is - * `undefined`, the `defaultValue` is returned in its place. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.get(object, 'a[0].b.c'); - * // => 3 - * - * _.get(object, ['a', '0', 'b', 'c']); - * // => 3 - * - * _.get(object, 'a.b.c', 'default'); - * // => 'default' - */ - function get(object, path, defaultValue) { - var result = object == null ? undefined : baseGet(object, path); - return result === undefined ? defaultValue : result; - } - - /** - * Checks if `path` is a direct property of `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = { 'a': { 'b': 2 } }; - * var other = _.create({ 'a': _.create({ 'b': 2 }) }); - * - * _.has(object, 'a'); - * // => true - * - * _.has(object, 'a.b'); - * // => true - * - * _.has(object, ['a', 'b']); - * // => true - * - * _.has(other, 'a'); - * // => false - */ - function has(object, path) { - return object != null && hasPath(object, path, baseHas); - } - - /** - * Checks if `path` is a direct or inherited property of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = _.create({ 'a': _.create({ 'b': 2 }) }); - * - * _.hasIn(object, 'a'); - * // => true - * - * _.hasIn(object, 'a.b'); - * // => true - * - * _.hasIn(object, ['a', 'b']); - * // => true - * - * _.hasIn(object, 'b'); - * // => false - */ - function hasIn(object, path) { - return object != null && hasPath(object, path, baseHasIn); - } - - /** - * Creates an object composed of the inverted keys and values of `object`. - * If `object` contains duplicate values, subsequent values overwrite - * property assignments of previous values. - * - * @static - * @memberOf _ - * @since 0.7.0 - * @category Object - * @param {Object} object The object to invert. - * @returns {Object} Returns the new inverted object. - * @example - * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; - * - * _.invert(object); - * // => { '1': 'c', '2': 'b' } - */ - var invert = createInverter(function(result, value, key) { - if (value != null && - typeof value.toString != 'function') { - value = nativeObjectToString.call(value); - } - - result[value] = key; - }, constant(identity)); - - /** - * This method is like `_.invert` except that the inverted object is generated - * from the results of running each element of `object` thru `iteratee`. The - * corresponding inverted value of each inverted key is an array of keys - * responsible for generating the inverted value. The iteratee is invoked - * with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.1.0 - * @category Object - * @param {Object} object The object to invert. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Object} Returns the new inverted object. - * @example - * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; - * - * _.invertBy(object); - * // => { '1': ['a', 'c'], '2': ['b'] } - * - * _.invertBy(object, function(value) { - * return 'group' + value; - * }); - * // => { 'group1': ['a', 'c'], 'group2': ['b'] } - */ - var invertBy = createInverter(function(result, value, key) { - if (value != null && - typeof value.toString != 'function') { - value = nativeObjectToString.call(value); - } - - if (hasOwnProperty.call(result, value)) { - result[value].push(key); - } else { - result[value] = [key]; - } - }, getIteratee); - - /** - * Invokes the method at `path` of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {...*} [args] The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. - * @example - * - * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; - * - * _.invoke(object, 'a[0].b.c.slice', 1, 3); - * // => [2, 3] - */ - var invoke = baseRest(baseInvoke); - - /** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ - function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); - } - - /** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */ - function keysIn(object) { - return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); - } - - /** - * The opposite of `_.mapValues`; this method creates an object with the - * same values as `object` and keys generated by running each own enumerable - * string keyed property of `object` thru `iteratee`. The iteratee is invoked - * with three arguments: (value, key, object). - * - * @static - * @memberOf _ - * @since 3.8.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns the new mapped object. - * @see _.mapValues - * @example - * - * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { - * return key + value; - * }); - * // => { 'a1': 1, 'b2': 2 } - */ - function mapKeys(object, iteratee) { - var result = {}; - iteratee = getIteratee(iteratee, 3); - - baseForOwn(object, function(value, key, object) { - baseAssignValue(result, iteratee(value, key, object), value); - }); - return result; - } - - /** - * Creates an object with the same keys as `object` and values generated - * by running each own enumerable string keyed property of `object` thru - * `iteratee`. The iteratee is invoked with three arguments: - * (value, key, object). - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns the new mapped object. - * @see _.mapKeys - * @example - * - * var users = { - * 'fred': { 'user': 'fred', 'age': 40 }, - * 'pebbles': { 'user': 'pebbles', 'age': 1 } - * }; - * - * _.mapValues(users, function(o) { return o.age; }); - * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) - * - * // The `_.property` iteratee shorthand. - * _.mapValues(users, 'age'); - * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) - */ - function mapValues(object, iteratee) { - var result = {}; - iteratee = getIteratee(iteratee, 3); - - baseForOwn(object, function(value, key, object) { - baseAssignValue(result, key, iteratee(value, key, object)); - }); - return result; - } - - /** - * This method is like `_.assign` except that it recursively merges own and - * inherited enumerable string keyed properties of source objects into the - * destination object. Source properties that resolve to `undefined` are - * skipped if a destination value exists. Array and plain object properties - * are merged recursively. Other objects and value types are overridden by - * assignment. Source objects are applied from left to right. Subsequent - * sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @example - * - * var object = { - * 'a': [{ 'b': 2 }, { 'd': 4 }] - * }; - * - * var other = { - * 'a': [{ 'c': 3 }, { 'e': 5 }] - * }; - * - * _.merge(object, other); - * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } - */ - var merge = createAssigner(function(object, source, srcIndex) { - baseMerge(object, source, srcIndex); - }); - - /** - * This method is like `_.merge` except that it accepts `customizer` which - * is invoked to produce the merged values of the destination and source - * properties. If `customizer` returns `undefined`, merging is handled by the - * method instead. The `customizer` is invoked with six arguments: - * (objValue, srcValue, key, object, source, stack). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} customizer The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * function customizer(objValue, srcValue) { - * if (_.isArray(objValue)) { - * return objValue.concat(srcValue); - * } - * } - * - * var object = { 'a': [1], 'b': [2] }; - * var other = { 'a': [3], 'b': [4] }; - * - * _.mergeWith(object, other, customizer); - * // => { 'a': [1, 3], 'b': [2, 4] } - */ - var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { - baseMerge(object, source, srcIndex, customizer); - }); - - /** - * The opposite of `_.pick`; this method creates an object composed of the - * own and inherited enumerable property paths of `object` that are not omitted. - * - * **Note:** This method is considerably slower than `_.pick`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {...(string|string[])} [paths] The property paths to omit. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.omit(object, ['a', 'c']); - * // => { 'b': '2' } - */ - var omit = flatRest(function(object, paths) { - var result = {}; - if (object == null) { - return result; - } - var isDeep = false; - paths = arrayMap(paths, function(path) { - path = castPath(path, object); - isDeep || (isDeep = path.length > 1); - return path; - }); - copyObject(object, getAllKeysIn(object), result); - if (isDeep) { - result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); - } - var length = paths.length; - while (length--) { - baseUnset(result, paths[length]); - } - return result; - }); - - /** - * The opposite of `_.pickBy`; this method creates an object composed of - * the own and inherited enumerable string keyed properties of `object` that - * `predicate` doesn't return truthy for. The predicate is invoked with two - * arguments: (value, key). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The source object. - * @param {Function} [predicate=_.identity] The function invoked per property. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.omitBy(object, _.isNumber); - * // => { 'b': '2' } - */ - function omitBy(object, predicate) { - return pickBy(object, negate(getIteratee(predicate))); - } - - /** - * Creates an object composed of the picked `object` properties. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.pick(object, ['a', 'c']); - * // => { 'a': 1, 'c': 3 } - */ - var pick = flatRest(function(object, paths) { - return object == null ? {} : basePick(object, paths); - }); - - /** - * Creates an object composed of the `object` properties `predicate` returns - * truthy for. The predicate is invoked with two arguments: (value, key). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The source object. - * @param {Function} [predicate=_.identity] The function invoked per property. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.pickBy(object, _.isNumber); - * // => { 'a': 1, 'c': 3 } - */ - function pickBy(object, predicate) { - if (object == null) { - return {}; - } - var props = arrayMap(getAllKeysIn(object), function(prop) { - return [prop]; - }); - predicate = getIteratee(predicate); - return basePickBy(object, props, function(value, path) { - return predicate(value, path[0]); - }); - } - - /** - * This method is like `_.get` except that if the resolved value is a - * function it's invoked with the `this` binding of its parent object and - * its result is returned. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to resolve. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; - * - * _.result(object, 'a[0].b.c1'); - * // => 3 - * - * _.result(object, 'a[0].b.c2'); - * // => 4 - * - * _.result(object, 'a[0].b.c3', 'default'); - * // => 'default' - * - * _.result(object, 'a[0].b.c3', _.constant('default')); - * // => 'default' - */ - function result(object, path, defaultValue) { - path = castPath(path, object); - - var index = -1, - length = path.length; - - // Ensure the loop is entered when path is empty. - if (!length) { - length = 1; - object = undefined; - } - while (++index < length) { - var value = object == null ? undefined : object[toKey(path[index])]; - if (value === undefined) { - index = length; - value = defaultValue; - } - object = isFunction(value) ? value.call(object) : value; - } - return object; - } - - /** - * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, - * it's created. Arrays are created for missing index properties while objects - * are created for all other missing properties. Use `_.setWith` to customize - * `path` creation. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @returns {Object} Returns `object`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.set(object, 'a[0].b.c', 4); - * console.log(object.a[0].b.c); - * // => 4 - * - * _.set(object, ['x', '0', 'y', 'z'], 5); - * console.log(object.x[0].y.z); - * // => 5 - */ - function set(object, path, value) { - return object == null ? object : baseSet(object, path, value); - } - - /** - * This method is like `_.set` except that it accepts `customizer` which is - * invoked to produce the objects of `path`. If `customizer` returns `undefined` - * path creation is handled by the method instead. The `customizer` is invoked - * with three arguments: (nsValue, key, nsObject). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * var object = {}; - * - * _.setWith(object, '[0][1]', 'a', Object); - * // => { '0': { '1': 'a' } } - */ - function setWith(object, path, value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return object == null ? object : baseSet(object, path, value, customizer); - } - - /** - * Creates an array of own enumerable string keyed-value pairs for `object` - * which can be consumed by `_.fromPairs`. If `object` is a map or set, its - * entries are returned. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias entries - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the key-value pairs. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.toPairs(new Foo); - * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) - */ - var toPairs = createToPairs(keys); - - /** - * Creates an array of own and inherited enumerable string keyed-value pairs - * for `object` which can be consumed by `_.fromPairs`. If `object` is a map - * or set, its entries are returned. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias entriesIn - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the key-value pairs. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.toPairsIn(new Foo); - * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) - */ - var toPairsIn = createToPairs(keysIn); - - /** - * An alternative to `_.reduce`; this method transforms `object` to a new - * `accumulator` object which is the result of running each of its own - * enumerable string keyed properties thru `iteratee`, with each invocation - * potentially mutating the `accumulator` object. If `accumulator` is not - * provided, a new object with the same `[[Prototype]]` will be used. The - * iteratee is invoked with four arguments: (accumulator, value, key, object). - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 1.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The custom accumulator value. - * @returns {*} Returns the accumulated value. - * @example - * - * _.transform([2, 3, 4], function(result, n) { - * result.push(n *= n); - * return n % 2 == 0; - * }, []); - * // => [4, 9] - * - * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { - * (result[value] || (result[value] = [])).push(key); - * }, {}); - * // => { '1': ['a', 'c'], '2': ['b'] } - */ - function transform(object, iteratee, accumulator) { - var isArr = isArray(object), - isArrLike = isArr || isBuffer(object) || isTypedArray(object); - - iteratee = getIteratee(iteratee, 4); - if (accumulator == null) { - var Ctor = object && object.constructor; - if (isArrLike) { - accumulator = isArr ? new Ctor : []; - } - else if (isObject(object)) { - accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; - } - else { - accumulator = {}; - } - } - (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { - return iteratee(accumulator, value, index, object); - }); - return accumulator; - } - - /** - * Removes the property at `path` of `object`. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to unset. - * @returns {boolean} Returns `true` if the property is deleted, else `false`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 7 } }] }; - * _.unset(object, 'a[0].b.c'); - * // => true - * - * console.log(object); - * // => { 'a': [{ 'b': {} }] }; - * - * _.unset(object, ['a', '0', 'b', 'c']); - * // => true - * - * console.log(object); - * // => { 'a': [{ 'b': {} }] }; - */ - function unset(object, path) { - return object == null ? true : baseUnset(object, path); - } - - /** - * This method is like `_.set` except that accepts `updater` to produce the - * value to set. Use `_.updateWith` to customize `path` creation. The `updater` - * is invoked with one argument: (value). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {Function} updater The function to produce the updated value. - * @returns {Object} Returns `object`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.update(object, 'a[0].b.c', function(n) { return n * n; }); - * console.log(object.a[0].b.c); - * // => 9 - * - * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); - * console.log(object.x[0].y.z); - * // => 0 - */ - function update(object, path, updater) { - return object == null ? object : baseUpdate(object, path, castFunction(updater)); - } - - /** - * This method is like `_.update` except that it accepts `customizer` which is - * invoked to produce the objects of `path`. If `customizer` returns `undefined` - * path creation is handled by the method instead. The `customizer` is invoked - * with three arguments: (nsValue, key, nsObject). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {Function} updater The function to produce the updated value. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * var object = {}; - * - * _.updateWith(object, '[0][1]', _.constant('a'), Object); - * // => { '0': { '1': 'a' } } - */ - function updateWith(object, path, updater, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); - } - - /** - * Creates an array of the own enumerable string keyed property values of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property values. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.values(new Foo); - * // => [1, 2] (iteration order is not guaranteed) - * - * _.values('hi'); - * // => ['h', 'i'] - */ - function values(object) { - return object == null ? [] : baseValues(object, keys(object)); - } - - /** - * Creates an array of the own and inherited enumerable string keyed property - * values of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property values. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.valuesIn(new Foo); - * // => [1, 2, 3] (iteration order is not guaranteed) - */ - function valuesIn(object) { - return object == null ? [] : baseValues(object, keysIn(object)); - } - - /*------------------------------------------------------------------------*/ - - /** - * Clamps `number` within the inclusive `lower` and `upper` bounds. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Number - * @param {number} number The number to clamp. - * @param {number} [lower] The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the clamped number. - * @example - * - * _.clamp(-10, -5, 5); - * // => -5 - * - * _.clamp(10, -5, 5); - * // => 5 - */ - function clamp(number, lower, upper) { - if (upper === undefined) { - upper = lower; - lower = undefined; - } - if (upper !== undefined) { - upper = toNumber(upper); - upper = upper === upper ? upper : 0; - } - if (lower !== undefined) { - lower = toNumber(lower); - lower = lower === lower ? lower : 0; - } - return baseClamp(toNumber(number), lower, upper); - } - - /** - * Checks if `n` is between `start` and up to, but not including, `end`. If - * `end` is not specified, it's set to `start` with `start` then set to `0`. - * If `start` is greater than `end` the params are swapped to support - * negative ranges. - * - * @static - * @memberOf _ - * @since 3.3.0 - * @category Number - * @param {number} number The number to check. - * @param {number} [start=0] The start of the range. - * @param {number} end The end of the range. - * @returns {boolean} Returns `true` if `number` is in the range, else `false`. - * @see _.range, _.rangeRight - * @example - * - * _.inRange(3, 2, 4); - * // => true - * - * _.inRange(4, 8); - * // => true - * - * _.inRange(4, 2); - * // => false - * - * _.inRange(2, 2); - * // => false - * - * _.inRange(1.2, 2); - * // => true - * - * _.inRange(5.2, 4); - * // => false - * - * _.inRange(-3, -2, -6); - * // => true - */ - function inRange(number, start, end) { - start = toFinite(start); - if (end === undefined) { - end = start; - start = 0; - } else { - end = toFinite(end); - } - number = toNumber(number); - return baseInRange(number, start, end); - } - - /** - * Produces a random number between the inclusive `lower` and `upper` bounds. - * If only one argument is provided a number between `0` and the given number - * is returned. If `floating` is `true`, or either `lower` or `upper` are - * floats, a floating-point number is returned instead of an integer. - * - * **Note:** JavaScript follows the IEEE-754 standard for resolving - * floating-point values which can produce unexpected results. - * - * @static - * @memberOf _ - * @since 0.7.0 - * @category Number - * @param {number} [lower=0] The lower bound. - * @param {number} [upper=1] The upper bound. - * @param {boolean} [floating] Specify returning a floating-point number. - * @returns {number} Returns the random number. - * @example - * - * _.random(0, 5); - * // => an integer between 0 and 5 - * - * _.random(5); - * // => also an integer between 0 and 5 - * - * _.random(5, true); - * // => a floating-point number between 0 and 5 - * - * _.random(1.2, 5.2); - * // => a floating-point number between 1.2 and 5.2 - */ - function random(lower, upper, floating) { - if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { - upper = floating = undefined; - } - if (floating === undefined) { - if (typeof upper == 'boolean') { - floating = upper; - upper = undefined; - } - else if (typeof lower == 'boolean') { - floating = lower; - lower = undefined; - } - } - if (lower === undefined && upper === undefined) { - lower = 0; - upper = 1; - } - else { - lower = toFinite(lower); - if (upper === undefined) { - upper = lower; - lower = 0; - } else { - upper = toFinite(upper); - } - } - if (lower > upper) { - var temp = lower; - lower = upper; - upper = temp; - } - if (floating || lower % 1 || upper % 1) { - var rand = nativeRandom(); - return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); - } - return baseRandom(lower, upper); - } - - /*------------------------------------------------------------------------*/ - - /** - * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the camel cased string. - * @example - * - * _.camelCase('Foo Bar'); - * // => 'fooBar' - * - * _.camelCase('--foo-bar--'); - * // => 'fooBar' - * - * _.camelCase('__FOO_BAR__'); - * // => 'fooBar' - */ - var camelCase = createCompounder(function(result, word, index) { - word = word.toLowerCase(); - return result + (index ? capitalize(word) : word); - }); - - /** - * Converts the first character of `string` to upper case and the remaining - * to lower case. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to capitalize. - * @returns {string} Returns the capitalized string. - * @example - * - * _.capitalize('FRED'); - * // => 'Fred' - */ - function capitalize(string) { - return upperFirst(toString(string).toLowerCase()); - } - - /** - * Deburrs `string` by converting - * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) - * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) - * letters to basic Latin letters and removing - * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to deburr. - * @returns {string} Returns the deburred string. - * @example - * - * _.deburr('déjà vu'); - * // => 'deja vu' - */ - function deburr(string) { - string = toString(string); - return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); - } - - /** - * Checks if `string` ends with the given target string. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to inspect. - * @param {string} [target] The string to search for. - * @param {number} [position=string.length] The position to search up to. - * @returns {boolean} Returns `true` if `string` ends with `target`, - * else `false`. - * @example - * - * _.endsWith('abc', 'c'); - * // => true - * - * _.endsWith('abc', 'b'); - * // => false - * - * _.endsWith('abc', 'b', 2); - * // => true - */ - function endsWith(string, target, position) { - string = toString(string); - target = baseToString(target); - - var length = string.length; - position = position === undefined - ? length - : baseClamp(toInteger(position), 0, length); - - var end = position; - position -= target.length; - return position >= 0 && string.slice(position, end) == target; - } - - /** - * Converts the characters "&", "<", ">", '"', and "'" in `string` to their - * corresponding HTML entities. - * - * **Note:** No other characters are escaped. To escape additional - * characters use a third-party library like [_he_](https://mths.be/he). - * - * Though the ">" character is escaped for symmetry, characters like - * ">" and "/" don't need escaping in HTML and have no special meaning - * unless they're part of a tag or unquoted attribute value. See - * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) - * (under "semi-related fun fact") for more details. - * - * When working with HTML you should always - * [quote attribute values](http://wonko.com/post/html-escaping) to reduce - * XSS vectors. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escape('fred, barney, & pebbles'); - * // => 'fred, barney, & pebbles' - */ - function escape(string) { - string = toString(string); - return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; - } - - /** - * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", - * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escapeRegExp('[lodash](https://lodash.com/)'); - * // => '\[lodash\]\(https://lodash\.com/\)' - */ - function escapeRegExp(string) { - string = toString(string); - return (string && reHasRegExpChar.test(string)) - ? string.replace(reRegExpChar, '\\$&') - : string; - } - - /** - * Converts `string` to - * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the kebab cased string. - * @example - * - * _.kebabCase('Foo Bar'); - * // => 'foo-bar' - * - * _.kebabCase('fooBar'); - * // => 'foo-bar' - * - * _.kebabCase('__FOO_BAR__'); - * // => 'foo-bar' - */ - var kebabCase = createCompounder(function(result, word, index) { - return result + (index ? '-' : '') + word.toLowerCase(); - }); - - /** - * Converts `string`, as space separated words, to lower case. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the lower cased string. - * @example - * - * _.lowerCase('--Foo-Bar--'); - * // => 'foo bar' - * - * _.lowerCase('fooBar'); - * // => 'foo bar' - * - * _.lowerCase('__FOO_BAR__'); - * // => 'foo bar' - */ - var lowerCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + word.toLowerCase(); - }); - - /** - * Converts the first character of `string` to lower case. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.lowerFirst('Fred'); - * // => 'fred' - * - * _.lowerFirst('FRED'); - * // => 'fRED' - */ - var lowerFirst = createCaseFirst('toLowerCase'); - - /** - * Pads `string` on the left and right sides if it's shorter than `length`. - * Padding characters are truncated if they can't be evenly divided by `length`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.pad('abc', 8); - * // => ' abc ' - * - * _.pad('abc', 8, '_-'); - * // => '_-abc_-_' - * - * _.pad('abc', 3); - * // => 'abc' - */ - function pad(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - if (!length || strLength >= length) { - return string; - } - var mid = (length - strLength) / 2; - return ( - createPadding(nativeFloor(mid), chars) + - string + - createPadding(nativeCeil(mid), chars) - ); - } - - /** - * Pads `string` on the right side if it's shorter than `length`. Padding - * characters are truncated if they exceed `length`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.padEnd('abc', 6); - * // => 'abc ' - * - * _.padEnd('abc', 6, '_-'); - * // => 'abc_-_' - * - * _.padEnd('abc', 3); - * // => 'abc' - */ - function padEnd(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - return (length && strLength < length) - ? (string + createPadding(length - strLength, chars)) - : string; - } - - /** - * Pads `string` on the left side if it's shorter than `length`. Padding - * characters are truncated if they exceed `length`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.padStart('abc', 6); - * // => ' abc' - * - * _.padStart('abc', 6, '_-'); - * // => '_-_abc' - * - * _.padStart('abc', 3); - * // => 'abc' - */ - function padStart(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - return (length && strLength < length) - ? (createPadding(length - strLength, chars) + string) - : string; - } - - /** - * Converts `string` to an integer of the specified radix. If `radix` is - * `undefined` or `0`, a `radix` of `10` is used unless `value` is a - * hexadecimal, in which case a `radix` of `16` is used. - * - * **Note:** This method aligns with the - * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category String - * @param {string} string The string to convert. - * @param {number} [radix=10] The radix to interpret `value` by. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {number} Returns the converted integer. - * @example - * - * _.parseInt('08'); - * // => 8 - * - * _.map(['6', '08', '10'], _.parseInt); - * // => [6, 8, 10] - */ - function parseInt(string, radix, guard) { - if (guard || radix == null) { - radix = 0; - } else if (radix) { - radix = +radix; - } - return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); - } - - /** - * Repeats the given string `n` times. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to repeat. - * @param {number} [n=1] The number of times to repeat the string. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {string} Returns the repeated string. - * @example - * - * _.repeat('*', 3); - * // => '***' - * - * _.repeat('abc', 2); - * // => 'abcabc' - * - * _.repeat('abc', 0); - * // => '' - */ - function repeat(string, n, guard) { - if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { - n = 1; - } else { - n = toInteger(n); - } - return baseRepeat(toString(string), n); - } - - /** - * Replaces matches for `pattern` in `string` with `replacement`. - * - * **Note:** This method is based on - * [`String#replace`](https://mdn.io/String/replace). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to modify. - * @param {RegExp|string} pattern The pattern to replace. - * @param {Function|string} replacement The match replacement. - * @returns {string} Returns the modified string. - * @example - * - * _.replace('Hi Fred', 'Fred', 'Barney'); - * // => 'Hi Barney' - */ - function replace() { - var args = arguments, - string = toString(args[0]); - - return args.length < 3 ? string : string.replace(args[1], args[2]); - } - - /** - * Converts `string` to - * [snake case](https://en.wikipedia.org/wiki/Snake_case). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the snake cased string. - * @example - * - * _.snakeCase('Foo Bar'); - * // => 'foo_bar' - * - * _.snakeCase('fooBar'); - * // => 'foo_bar' - * - * _.snakeCase('--FOO-BAR--'); - * // => 'foo_bar' - */ - var snakeCase = createCompounder(function(result, word, index) { - return result + (index ? '_' : '') + word.toLowerCase(); - }); - - /** - * Splits `string` by `separator`. - * - * **Note:** This method is based on - * [`String#split`](https://mdn.io/String/split). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to split. - * @param {RegExp|string} separator The separator pattern to split by. - * @param {number} [limit] The length to truncate results to. - * @returns {Array} Returns the string segments. - * @example - * - * _.split('a-b-c', '-', 2); - * // => ['a', 'b'] - */ - function split(string, separator, limit) { - if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { - separator = limit = undefined; - } - limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; - if (!limit) { - return []; - } - string = toString(string); - if (string && ( - typeof separator == 'string' || - (separator != null && !isRegExp(separator)) - )) { - separator = baseToString(separator); - if (!separator && hasUnicode(string)) { - return castSlice(stringToArray(string), 0, limit); - } - } - return string.split(separator, limit); - } - - /** - * Converts `string` to - * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). - * - * @static - * @memberOf _ - * @since 3.1.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the start cased string. - * @example - * - * _.startCase('--foo-bar--'); - * // => 'Foo Bar' - * - * _.startCase('fooBar'); - * // => 'Foo Bar' - * - * _.startCase('__FOO_BAR__'); - * // => 'FOO BAR' - */ - var startCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + upperFirst(word); - }); - - /** - * Checks if `string` starts with the given target string. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to inspect. - * @param {string} [target] The string to search for. - * @param {number} [position=0] The position to search from. - * @returns {boolean} Returns `true` if `string` starts with `target`, - * else `false`. - * @example - * - * _.startsWith('abc', 'a'); - * // => true - * - * _.startsWith('abc', 'b'); - * // => false - * - * _.startsWith('abc', 'b', 1); - * // => true - */ - function startsWith(string, target, position) { - string = toString(string); - position = position == null - ? 0 - : baseClamp(toInteger(position), 0, string.length); - - target = baseToString(target); - return string.slice(position, position + target.length) == target; - } - - /** - * Creates a compiled template function that can interpolate data properties - * in "interpolate" delimiters, HTML-escape interpolated data properties in - * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data - * properties may be accessed as free variables in the template. If a setting - * object is given, it takes precedence over `_.templateSettings` values. - * - * **Note:** In the development build `_.template` utilizes - * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) - * for easier debugging. - * - * For more information on precompiling templates see - * [lodash's custom builds documentation](https://lodash.com/custom-builds). - * - * For more information on Chrome extension sandboxes see - * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category String - * @param {string} [string=''] The template string. - * @param {Object} [options={}] The options object. - * @param {RegExp} [options.escape=_.templateSettings.escape] - * The HTML "escape" delimiter. - * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] - * The "evaluate" delimiter. - * @param {Object} [options.imports=_.templateSettings.imports] - * An object to import into the template as free variables. - * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] - * The "interpolate" delimiter. - * @param {string} [options.sourceURL='lodash.templateSources[n]'] - * The sourceURL of the compiled template. - * @param {string} [options.variable='obj'] - * The data object variable name. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the compiled template function. - * @example - * - * // Use the "interpolate" delimiter to create a compiled template. - * var compiled = _.template('hello <%= user %>!'); - * compiled({ 'user': 'fred' }); - * // => 'hello fred!' - * - * // Use the HTML "escape" delimiter to escape data property values. - * var compiled = _.template('<%- value %>'); - * compiled({ 'value': ' - - - - - - - - - - - - diff --git a/adev/src/content/examples/setup/src/main.ts b/adev/src/content/examples/setup/src/main.ts deleted file mode 100644 index 7ee4587a88ea..000000000000 --- a/adev/src/content/examples/setup/src/main.ts +++ /dev/null @@ -1,8 +0,0 @@ -// #docregion -import {platformBrowser} from '@angular/platform-browser'; - -import {AppModule} from './app/app.module'; - -platformBrowser() - .bootstrapModule(AppModule) - .catch((err) => console.error(err)); diff --git a/adev/src/content/examples/setup/src/systemjs.config.extras.js b/adev/src/content/examples/setup/src/systemjs.config.extras.js deleted file mode 100644 index 027dfe58cf28..000000000000 --- a/adev/src/content/examples/setup/src/systemjs.config.extras.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Add barrels and stuff - * Adjust as necessary for your application needs. - */ -// (function (global) { -// System.config({ -// packages: { -// // add packages here -// } -// }); -// })(this); diff --git a/adev/src/content/examples/structural-directives/src/app/hero-switch.components.ts b/adev/src/content/examples/structural-directives/src/app/hero-switch.components.ts index b1e884e269a3..9d2b14c2e1d8 100644 --- a/adev/src/content/examples/structural-directives/src/app/hero-switch.components.ts +++ b/adev/src/content/examples/structural-directives/src/app/hero-switch.components.ts @@ -1,5 +1,5 @@ // #docregion -import {Component, computed, input, Input} from '@angular/core'; +import {Component, computed, input} from '@angular/core'; import {Hero} from './hero'; @Component({ @@ -7,7 +7,7 @@ import {Hero} from './hero'; template: 'Wow. You like {{hero().name}}. What a happy hero ... just like you.', }) export class HappyHeroComponent { - hero = input.required(); + readonly hero = input.required(); } @Component({ @@ -15,7 +15,7 @@ export class HappyHeroComponent { template: 'You like {{hero().name}}? Such a sad hero. Are you sad too?', }) export class SadHeroComponent { - hero = input.required(); + readonly hero = input.required(); } @Component({ @@ -23,7 +23,7 @@ export class SadHeroComponent { template: 'Are you as confused as {{hero().name}}?', }) export class ConfusedHeroComponent { - hero = input.required(); + readonly hero = input.required(); } @Component({ @@ -31,9 +31,9 @@ export class ConfusedHeroComponent { template: '{{message()}}', }) export class UnknownHeroComponent { - hero = input.required(); + readonly hero = input.required(); - message = computed(() => { + readonly message = computed(() => { const heroName = this.hero()?.name; return heroName ? `${heroName} is strange and mysterious.` : 'Are you feeling indecisive?'; }); diff --git a/adev/src/content/examples/testing/src/app/about/about.component.ts b/adev/src/content/examples/testing/src/app/about/about.component.ts index b49431c55e45..0d863133be08 100755 --- a/adev/src/content/examples/testing/src/app/about/about.component.ts +++ b/adev/src/content/examples/testing/src/app/about/about.component.ts @@ -8,7 +8,7 @@ import {TwainComponent} from '../twain/twain.component'; template: `

About

Quote of the day:

- + `, imports: [TwainComponent, HighlightDirective], }) diff --git a/adev/src/content/examples/testing/src/app/app.component.html b/adev/src/content/examples/testing/src/app/app.component.html index d73c1162c034..c0d2670fab5e 100644 --- a/adev/src/content/examples/testing/src/app/app.component.html +++ b/adev/src/content/examples/testing/src/app/app.component.html @@ -1,6 +1,6 @@ - - + + - + diff --git a/adev/src/content/examples/testing/src/app/app.component.router.spec.ts b/adev/src/content/examples/testing/src/app/app.component.router.spec.ts index b25464e59b36..4b9c47bdb3f9 100755 --- a/adev/src/content/examples/testing/src/app/app.component.router.spec.ts +++ b/adev/src/content/examples/testing/src/app/app.component.router.spec.ts @@ -28,7 +28,6 @@ describe('AppComponent & router testing', () => { Object.assign({}, appConfig, { providers: [ {provide: HeroService, useClass: TestHeroService}, - UserService, TwainService, provideHttpClient(), provideLocationMocks(), diff --git a/adev/src/content/examples/testing/src/app/app.component.spec.ts b/adev/src/content/examples/testing/src/app/app.component.spec.ts index ae66f1302a20..a573f2c168bb 100755 --- a/adev/src/content/examples/testing/src/app/app.component.spec.ts +++ b/adev/src/content/examples/testing/src/app/app.component.spec.ts @@ -1,12 +1,13 @@ // #docplaster import {Component, DebugElement, NO_ERRORS_SCHEMA} from '@angular/core'; -import {ComponentFixture, fakeAsync, TestBed, tick, waitForAsync} from '@angular/core/testing'; +import {ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; -import {provideRouter, Router, RouterLink} from '@angular/router'; +import {provideRouter, Router, RouterLink, RouterOutlet} from '@angular/router'; import {AppComponent} from './app.component'; import {appConfig} from './app.config'; import {UserService} from './model'; +import {WelcomeComponent} from './welcome/welcome.component'; // #docregion component-stubs @Component({selector: 'app-banner', template: ''}) @@ -23,54 +24,67 @@ let comp: AppComponent; let fixture: ComponentFixture; describe('AppComponent & TestModule', () => { - beforeEach(waitForAsync(() => { + beforeEach(() => { // #docregion testbed-stubs TestBed.configureTestingModule( Object.assign({}, appConfig, { - imports: [ - AppComponent, - BannerStubComponent, - RouterLink, - RouterOutletStubComponent, - WelcomeStubComponent, - ], providers: [provideRouter([]), UserService], }), - ) - // #enddocregion testbed-stubs - - .then(() => { - fixture = TestBed.createComponent(AppComponent); - comp = fixture.componentInstance; - }); - })); + ).overrideComponent(AppComponent, { + set: { + imports: [BannerStubComponent, RouterLink, RouterOutletStubComponent, WelcomeStubComponent], + }, + }); + // #enddocregion testbed-stubs + + fixture = TestBed.createComponent(AppComponent); + comp = fixture.componentInstance; + }); tests(); }); //////// Testing w/ NO_ERRORS_SCHEMA ////// describe('AppComponent & NO_ERRORS_SCHEMA', () => { - beforeEach(waitForAsync(() => { - // #docregion no-errors-schema, mixed-setup + beforeEach(() => { + // #docregion no-errors-schema TestBed.configureTestingModule( Object.assign({}, appConfig, { - imports: [ - AppComponent, - // #enddocregion no-errors-schema - BannerStubComponent, - // #docregion no-errors-schema - RouterLink, - ], providers: [provideRouter([]), UserService], + }), + ).overrideComponent(AppComponent, { + set: { + imports: [], // resets all imports schemas: [NO_ERRORS_SCHEMA], + }, + }); + // #enddocregion no-errors-schema + + fixture = TestBed.createComponent(AppComponent); + comp = fixture.componentInstance; + }); + tests(); +}); + +describe('AppComponent & NO_ERRORS_SCHEMA', () => { + beforeEach(() => { + // #docregion mixed-setup + TestBed.configureTestingModule( + Object.assign({}, appConfig, { + providers: [provideRouter([]), UserService], }), - ) - // #enddocregion no-errors-schema, mixed-setup + ).overrideComponent(AppComponent, { + remove: { + imports: [RouterOutlet, WelcomeComponent], + }, + set: { + schemas: [NO_ERRORS_SCHEMA], + }, + }); + // #enddocregion mixed-setup - .then(() => { - fixture = TestBed.createComponent(AppComponent); - comp = fixture.componentInstance; - }); - })); + fixture = TestBed.createComponent(AppComponent); + comp = fixture.componentInstance; + }); tests(); }); diff --git a/adev/src/content/examples/testing/src/app/banner/banner-external.component.spec.ts b/adev/src/content/examples/testing/src/app/banner/banner-external.component.spec.ts index 5febcddd4e4c..6badd6972b72 100755 --- a/adev/src/content/examples/testing/src/app/banner/banner-external.component.spec.ts +++ b/adev/src/content/examples/testing/src/app/banner/banner-external.component.spec.ts @@ -28,7 +28,7 @@ describe('BannerComponent (external files)', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [BannerComponent], - }); // compile template and css + }).compileComponents(); // compile template and css }); // #enddocregion async-before-each diff --git a/adev/src/content/examples/testing/src/app/banner/banner.component.spec.ts b/adev/src/content/examples/testing/src/app/banner/banner.component.spec.ts index 956c2755fa7a..34d043fbb6a7 100755 --- a/adev/src/content/examples/testing/src/app/banner/banner.component.spec.ts +++ b/adev/src/content/examples/testing/src/app/banner/banner.component.spec.ts @@ -11,9 +11,6 @@ describe('BannerComponent (inline template)', () => { let h1: HTMLElement; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [BannerComponent], - }); fixture = TestBed.createComponent(BannerComponent); component = fixture.componentInstance; // BannerComponent test instance h1 = fixture.nativeElement.querySelector('h1'); diff --git a/adev/src/content/examples/testing/src/app/dashboard/dashboard-hero.component.spec.ts b/adev/src/content/examples/testing/src/app/dashboard/dashboard-hero.component.spec.ts index 16550730e7cb..13750e348209 100755 --- a/adev/src/content/examples/testing/src/app/dashboard/dashboard-hero.component.spec.ts +++ b/adev/src/content/examples/testing/src/app/dashboard/dashboard-hero.component.spec.ts @@ -109,7 +109,6 @@ describe('DashboardHeroComponent when inside a test host', () => { // #docregion test-host-setup TestBed.configureTestingModule({ providers: appProviders, - imports: [DashboardHeroComponent, TestHostComponent], }); // #enddocregion test-host-setup })); diff --git a/adev/src/content/examples/testing/src/app/dashboard/dashboard-hero.component.ts b/adev/src/content/examples/testing/src/app/dashboard/dashboard-hero.component.ts index 56729b6828d7..4036eea2bd35 100755 --- a/adev/src/content/examples/testing/src/app/dashboard/dashboard-hero.component.ts +++ b/adev/src/content/examples/testing/src/app/dashboard/dashboard-hero.component.ts @@ -17,8 +17,8 @@ import {Hero} from '../model/hero'; }) // #docregion class export class DashboardHeroComponent { - hero = input.required(); - selected = output(); + readonly hero = input.required(); + readonly selected = output(); click() { this.selected.emit(this.hero()); } diff --git a/adev/src/content/examples/testing/src/app/dashboard/dashboard.component.spec.ts b/adev/src/content/examples/testing/src/app/dashboard/dashboard.component.spec.ts index 47c3f06ffe47..1f3e02c9b170 100755 --- a/adev/src/content/examples/testing/src/app/dashboard/dashboard.component.spec.ts +++ b/adev/src/content/examples/testing/src/app/dashboard/dashboard.component.spec.ts @@ -69,7 +69,6 @@ function compileAndCreate() { // #docregion router-harness TestBed.configureTestingModule( Object.assign({}, appConfig, { - imports: [DashboardComponent], providers: [ provideRouter([{path: '**', component: DashboardComponent}]), provideHttpClient(), diff --git a/adev/src/content/examples/testing/src/app/demo/demo.ts b/adev/src/content/examples/testing/src/app/demo/demo.ts index 9bc7c4b35896..81b49880f8cc 100755 --- a/adev/src/content/examples/testing/src/app/demo/demo.ts +++ b/adev/src/content/examples/testing/src/app/demo/demo.ts @@ -183,8 +183,8 @@ export class ParentComponent {} '', }) export class IoComponent { - hero = input.required(); - selected = output(); + readonly hero = input.required(); + readonly selected = output(); click() { this.selected.emit(this.hero); diff --git a/adev/src/content/examples/testing/src/app/hero/hero-detail.component.ts b/adev/src/content/examples/testing/src/app/hero/hero-detail.component.ts index 21d5081b3307..c7e1d51293a1 100755 --- a/adev/src/content/examples/testing/src/app/hero/hero-detail.component.ts +++ b/adev/src/content/examples/testing/src/app/hero/hero-detail.component.ts @@ -13,7 +13,7 @@ import {HeroDetailService} from './hero-detail.service'; templateUrl: './hero-detail.component.html', styleUrls: ['./hero-detail.component.css'], providers: [HeroDetailService], - imports: [sharedImports, RouterLink], + imports: [...sharedImports], }) export class HeroDetailComponent { // #docregion inject diff --git a/adev/src/content/examples/testing/src/app/shared/canvas.component.spec.ts b/adev/src/content/examples/testing/src/app/shared/canvas.component.spec.ts index c1127063e215..3d8f0006427d 100755 --- a/adev/src/content/examples/testing/src/app/shared/canvas.component.spec.ts +++ b/adev/src/content/examples/testing/src/app/shared/canvas.component.spec.ts @@ -17,12 +17,6 @@ describe('CanvasComponent', () => { }); // #enddocregion enable-toBlob-macrotask // #docregion without-toBlob-macrotask - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [CanvasComponent], - }); - }); - it('should be able to generate blob data from canvas', fakeAsync(() => { const fixture = TestBed.createComponent(CanvasComponent); const canvasComp = fixture.componentInstance; diff --git a/adev/src/content/examples/testing/src/app/twain/twain.component.spec.ts b/adev/src/content/examples/testing/src/app/twain/twain.component.spec.ts index b2336adde877..874c1f677288 100755 --- a/adev/src/content/examples/testing/src/app/twain/twain.component.spec.ts +++ b/adev/src/content/examples/testing/src/app/twain/twain.component.spec.ts @@ -26,7 +26,6 @@ describe('TwainComponent', () => { // #docregion setup beforeEach(() => { TestBed.configureTestingModule({ - imports: [TwainComponent], providers: [TwainService], }); testQuote = 'Test Quote'; diff --git a/adev/src/content/guide/BUILD.bazel b/adev/src/content/guide/BUILD.bazel index 184f2eecfdca..250b53fb8fd1 100644 --- a/adev/src/content/guide/BUILD.bazel +++ b/adev/src/content/guide/BUILD.bazel @@ -6,6 +6,7 @@ generate_guides( srcs = glob([ "*.md", ]), + api_manifest = "//adev/src/assets:docs_api_manifest", data = [ "//adev/src/content/examples", ], diff --git a/adev/src/content/guide/animations/BUILD.bazel b/adev/src/content/guide/animations/BUILD.bazel index 49a50ad1c6b8..64926046863a 100644 --- a/adev/src/content/guide/animations/BUILD.bazel +++ b/adev/src/content/guide/animations/BUILD.bazel @@ -6,6 +6,7 @@ generate_guides( srcs = glob([ "*.md", ]), + api_manifest = "//adev/src/assets:docs_api_manifest", data = [ "//adev/src/content/examples", ], diff --git a/adev/src/content/guide/animations/complex-sequences.md b/adev/src/content/guide/animations/complex-sequences.md index d2d281ccc55c..e9fc06ac1a65 100644 --- a/adev/src/content/guide/animations/complex-sequences.md +++ b/adev/src/content/guide/animations/complex-sequences.md @@ -1,6 +1,6 @@ # Complex animation sequences -IMPORTANT: The Angular team recommends using native CSS for animations instead of the Animations package for all new code. Use this guide to understand existing code built with the Animations Package. See [Migrating away from Angular's Animations package](guide/animations/migration#complex-sequences) to learn how you can start using pure CSS animations in your apps. +IMPORTANT: The `@angular/animations` package is now deprecated. The Angular team recommends using native CSS with `animate.enter` and `animate.leave` for animations for all new code. Learn more at the new enter and leave [animation guide](guide/animations/enter-and-leave). Also see [Migrating away from Angular's Animations package](guide/animations/migration) to learn how you can start migrating to pure CSS animations in your apps. So far, we've learned simple animations of single HTML elements. Angular also lets you animate coordinated sequences, such as an entire grid or list of elements as they enter and leave a page. @@ -8,26 +8,26 @@ You can choose to run multiple animations in parallel, or run discrete animation The functions that control complex animation sequences are: -| Functions | Details | -|:--- |:--- | -| `query()` | Finds one or more inner HTML elements. | +| Functions | Details | +| :-------------------------------- | :------------------------------------------------------------- | +| `query()` | Finds one or more inner HTML elements. | | `stagger()` | Applies a cascading delay to animations for multiple elements. | -| [`group()`](api/animations/group) | Runs multiple animation steps in parallel. | -| `sequence()` | Runs animation steps one after another. | +| [`group()`](api/animations/group) | Runs multiple animation steps in parallel. | +| `sequence()` | Runs animation steps one after another. | ## The query() function Most complex animations rely on the `query()` function to find child elements and apply animations to them, basic examples of such are: -| Examples | Details | -|:--- |:--- | -| `query()` followed by `animate()` | Used to query simple HTML elements and directly apply animations to them. | +| Examples | Details | +| :------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `query()` followed by `animate()` | Used to query simple HTML elements and directly apply animations to them. | | `query()` followed by `animateChild()` | Used to query child elements, which themselves have animations metadata applied to them and trigger such animation \(which would be otherwise be blocked by the current/parent element's animation\). | The first argument of `query()` is a [css selector](https://developer.mozilla.org/docs/Web/CSS/CSS_Selectors) string which can also contain the following Angular-specific tokens: -| Tokens | Details | -|:--- |:--- | +| Tokens | Details | +| :------------------------- | :------------------------------------------- | | `:enter`
`:leave` | For entering/leaving elements. | | `:animating` | For elements currently animating. | | `@*`
`@triggerName` | For elements with any—or a specific—trigger. | @@ -37,7 +37,7 @@ The first argument of `query()` is a [css selector](https://developer.mozilla.or Not all child elements are actually considered as entering/leaving; this can, at times, be counterintuitive and confusing. Please see the [query api docs](api/animations/query#entering-and-leaving-elements) for more information. -You can also see an illustration of this in the animations example \(introduced in the animations [introduction section](guide/animations#about-this-guide)\) under the Querying tab. +You can also see an illustration of this in the animations example \(introduced in the animations [introduction section](guide/legacy-animations#about-this-guide)\) under the Querying tab. @@ -47,14 +47,14 @@ After having queried child elements via `query()`, the `stagger()` function lets The following example demonstrates how to use the `query()` and `stagger()` functions to animate a list \(of heroes\) adding each in sequence, with a slight delay, from top to bottom. -* Use `query()` to look for an element entering the page that meets certain criteria -* For each of these elements, use `style()` to set the same initial style for the element. - Make it transparent and use `transform` to move it out of position so that it can slide into place. +- Use `query()` to look for an element entering the page that meets certain criteria +- For each of these elements, use `style()` to set the same initial style for the element. + Make it transparent and use `transform` to move it out of position so that it can slide into place. -* Use `stagger()` to delay each animation by 30 milliseconds -* Animate each element on screen for 0.5 seconds using a custom-defined easing curve, simultaneously fading it in and un-transforming it +- Use `stagger()` to delay each animation by 30 milliseconds +- Animate each element on screen for 0.5 seconds using a custom-defined easing curve, simultaneously fading it in and un-transforming it - + ## Parallel animation using group() function @@ -63,11 +63,11 @@ But you might also want to configure animations that happen in parallel. For example, you might want to animate two CSS properties of the same element but use a different `easing` function for each one. For this, you can use the animation [`group()`](api/animations/group) function. -HELPFUL: The [`group()`](api/animations/group) function is used to group animation *steps*, rather than animated elements. +HELPFUL: The [`group()`](api/animations/group) function is used to group animation _steps_, rather than animated elements. The following example uses [`group()`](api/animations/group)s on both `:enter` and `:leave` for two different timing configurations, thus applying two independent animations to the same element in parallel. - + ## Sequential vs. parallel animations @@ -77,8 +77,8 @@ But what if you want to create an animation involving several animations happeni A second function called `sequence()` lets you run those same animations one after the other. Within `sequence()`, the animation steps consist of either `style()` or `animate()` function calls. -* Use `style()` to apply the provided styling data immediately. -* Use `animate()` to apply styling data over a given time interval. +- Use `style()` to apply the provided styling data immediately. +- Use `animate()` to apply styling data over a given time interval. ## Filter animation example @@ -91,24 +91,24 @@ The heroes list gradually re-enters the page as you delete each letter in the fi The HTML template contains a trigger called `filterAnimation`. - + The `filterAnimation` in the component's decorator contains three transitions. - + The code in this example performs the following tasks: -* Skips animations when the user first opens or navigates to this page \(the filter animation narrows what is already there, so it only works on elements that already exist in the DOM\) -* Filters heroes based on the search input's value +- Skips animations when the user first opens or navigates to this page \(the filter animation narrows what is already there, so it only works on elements that already exist in the DOM\) +- Filters heroes based on the search input's value For each change: -* Hides an element leaving the DOM by setting its opacity and width to 0 -* Animates an element entering the DOM over 300 milliseconds. - During the animation, the element assumes its default width and opacity. +- Hides an element leaving the DOM by setting its opacity and width to 0 +- Animates an element entering the DOM over 300 milliseconds. + During the animation, the element assumes its default width and opacity. -* If there are multiple elements entering or leaving the DOM, staggers each animation starting at the top of the page, with a 50-millisecond delay between each element +- If there are multiple elements entering or leaving the DOM, staggers each animation starting at the top of the page, with a 50-millisecond delay between each element ## Animating the items of a reordering list @@ -121,11 +121,11 @@ IMPORTANT: If you need to animate the items of an `*ngFor` list and there is a p ## Animations and Component View Encapsulation -Angular animations are based on the components DOM structure and do not directly take [View Encapsulation](guide/components/styling#style-scoping) into account, this means that components using `ViewEncapsulation.Emulated` behave exactly as if they were using `ViewEncapsulation.None` (`ViewEncapsulation.ShadowDom` and `ViewEncapsulation.IsolatedShadowDom` behave differently as we'll discuss shortly). +Angular animations are based on the components DOM structure and do not directly take [View Encapsulation](guide/components/styling#style-scoping) into account, this means that components using `ViewEncapsulation.Emulated` behave exactly as if they were using `ViewEncapsulation.None` (`ViewEncapsulation.ShadowDom` behaves differently as we'll discuss shortly). For example if the `query()` function (which you'll see more of in the rest of the Animations guide) were to be applied at the top of a tree of components using the emulated view encapsulation, such query would be able to identify (and thus animate) DOM elements on any depth of the tree. -On the other hand the `ViewEncapsulation.ShadowDom` and `ViewEncapsulation.IsolatedShadowDom` changes the component's DOM structure by "hiding" DOM elements inside [`ShadowRoot`](https://developer.mozilla.org/docs/Web/API/ShadowRoot) elements. Such DOM manipulations do prevent some of the animations implementation to work properly since it relies on simple DOM structures and doesn't take `ShadowRoot` elements into account. Therefore it is advised to avoid applying animations to views incorporating components using the ShadowDom view encapsulation. +On the other hand the `ViewEncapsulation.ShadowDom` changes the component's DOM structure by "hiding" DOM elements inside [`ShadowRoot`](https://developer.mozilla.org/docs/Web/API/ShadowRoot) elements. Such DOM manipulations do prevent some of the animations implementation to work properly since it relies on simple DOM structures and doesn't take `ShadowRoot` elements into account. Therefore it is advised to avoid applying animations to views incorporating components using the ShadowDom view encapsulation. ## Animation sequence summary @@ -137,8 +137,9 @@ The remaining functions, `stagger()`, [`group()`](api/animations/group), and `se You might also be interested in the following: - - - + + + - \ No newline at end of file + + diff --git a/adev/src/content/guide/animations/css.md b/adev/src/content/guide/animations/css.md index 2d89ecb0e81a..0e68cf254042 100644 --- a/adev/src/content/guide/animations/css.md +++ b/adev/src/content/guide/animations/css.md @@ -4,14 +4,14 @@ CSS offers a robust set of tools for you to create beautiful and engaging animat ## How to write animations in native CSS -If you've never written any native CSS animations, there are a number of excellent guides to get you started. Here's a few of them: -[MDN's CSS Animations guide](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animations/Using_CSS_animations) -[W3Schools CSS3 Animations guide](https://www.w3schools.com/css/css3_animations.asp) -[The Complete CSS Animations Tutorial](https://www.lambdatest.com/blog/css-animations-tutorial/) -[CSS Animation for Beginners](https://thoughtbot.com/blog/css-animation-for-beginners) - -and a couple of videos: -[Learn CSS Animation in 9 Minutes](https://www.youtube.com/watch?v=z2LQYsZhsFw) +If you've never written any native CSS animations, there are a number of excellent guides to get you started. Here's a few of them: +[MDN's CSS Animations guide](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animations/Using_CSS_animations) +[W3Schools CSS3 Animations guide](https://www.w3schools.com/css/css3_animations.asp) +[The Complete CSS Animations Tutorial](https://www.lambdatest.com/blog/css-animations-tutorial/) +[CSS Animation for Beginners](https://thoughtbot.com/blog/css-animation-for-beginners) + +and a couple of videos: +[Learn CSS Animation in 9 Minutes](https://www.youtube.com/watch?v=z2LQYsZhsFw) [Net Ninja CSS Animation Tutorial Playlist](https://www.youtube.com/watch?v=jgw82b5Y2MU&list=PL4cUxeGkcC9iGYgmEd2dm3zAKzyCGDtM5) Check some of these various guides and tutorials out, and then come back to this guide. @@ -20,7 +20,7 @@ Check some of these various guides and tutorials out, and then come back to this You can create reusable animations that can be shared across your application using `@keyframes`. Define keyframe animations in a shared CSS file, and you'll be able to re-use those keyframe animations wherever you want within your application. - + Adding the class `animated-class` to an element would trigger the animation on that element. @@ -30,7 +30,7 @@ Adding the class `animated-class` to an element would trigger the animation on t You may want to animate between two different states, for example when an element is opened or closed. You can accomplish this by using CSS classes either using a keyframe animation or transition styling. - + Triggering the `open` or `closed` state is done by toggling classes on the element in your component. You can find examples of how to do this in our [template guide](guide/templates/binding#css-class-and-style-property-bindings). @@ -42,20 +42,20 @@ Animating often requires adjusting timing, delays and easeing behaviors. This ca Specify `animation-duration`, `animation-delay`, and `animation-timing-function` for a keyframe animation in CSS, or alternatively use the `animation` shorthand property. - + Similarly, you can use `transition-duration`, `transition-delay`, and `transition-timing-function` and the `transition` shorthand for animations that are not using `@keyframes`. - + ### Triggering an Animation Animations can be triggered by toggling CSS styles or classes. Once a class is present on an element, the animation will occur. Removing the class will revert the element back to whatever CSS is defined for that element. Here's an example: - - - + + + ## Transition and Triggers @@ -65,9 +65,9 @@ Animations can be triggered by toggling CSS styles or classes. Once a class is p You can use css-grid to animate to auto height. - - - + + + If you don't have to worry about supporting all browsers, you can also check out `calc-size()`, which is the true solution to animating auto height. See [MDN's docs](https://developer.mozilla.org/en-US/docs/Web/CSS/calc-size) and (this tutorial)[https://frontendmasters.com/blog/one-of-the-boss-battles-of-css-is-almost-won-transitioning-to-auto/] for more information. @@ -77,29 +77,29 @@ If you don't have to worry about supporting all browsers, you can also check out You can create animations for when an item enters a view or leaves a view. Let's start by looking at how to animate an element entering a view. We'll do this with `animate.enter`, which will apply animation classes when an element enters the view. - - - + + + Animating an element when it leaves the view is similar to animating when entering a view. Use `animate.leave` to specify which CSS classes to apply when the element leaves the view. - - - + + + -For more information on `animate.enter` and `animate.leave`, see the [Enter and Leave animations guide](guide/animations/enter-and-leave). +For more information on `animate.enter` and `animate.leave`, see the [Enter and Leave animations guide](guide/animations). ### Animating increment and decrement Animating on increment and decrement is a common pattern in applications. Here's an example of how you can accomplish that behavior. - - - + + + ### Disabling an animation or all animations @@ -128,12 +128,12 @@ If you have actions you would like to execute at certain points during animation [`OnAnimationStart`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationstart_event) [`OnAnimationEnd`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationend_event) [`OnAnimationIteration`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationitration_event) -[`OnAnimationCancel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationcancel_event) +[`OnAnimationCancel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationcancel_event) [`OnTransitionStart`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionstart_event) [`OnTransitionRun`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionrun_event) [`OnTransitionEnd`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionend_event) -[`OnTransitionCancel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitioncancel_event) +[`OnTransitionCancel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitioncancel_event) The Web Animations API has a lot of additional functionality. [Take a look at the documentation](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API) to see all the available animation APIs. @@ -148,9 +148,9 @@ Animations are often more complicated than just a simple fade in or fade out. Yo One common effect is to stagger the animations of each item in a list to create a cascade effect. This can be accomplished by utilizing `animation-delay` or `transition-delay`. Here is an example of what that CSS might look like. - - - + + + ### Parallel Animations @@ -167,14 +167,23 @@ In this example, the `rotate` and `fade-in` animations fire at the same time, bu ### Animating the items of a reordering list -Items in a `@for` loop will be removed and re-added, which will fire off animations using `@starting-styles` for entry animations. Alternatively, you can use `animate.enter` for this same behavior. Use `animate.leave` to animate elements as they are removed, as seen in the example above. +Items in a `@for` loop will be removed and re-added, which will fire off animations using `@starting-styles` for entry animations. Alternatively, you can use `animate.enter` for this same behavior. Use `animate.leave` to animate elements as they are removed, as seen in the example below. - - - + + + ## Programmatic control of animations You can retrieve animations off an element directly using [`Element.getAnimations()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAnimations). This returns an array of every [`Animation`](https://developer.mozilla.org/en-US/docs/Web/API/Animation) on that element. You can use the `Animation` API to do much more than you could with what the `AnimationPlayer` from the animations package offered. From here you can `cancel()`, `play()`, `pause()`, `reverse()` and much more. This native API should provide everything you need to control your animations. + +## More on Angular animations + +You might also be interested in the following: + + + + + diff --git a/adev/src/content/guide/animations/enter-and-leave.md b/adev/src/content/guide/animations/enter-and-leave.md index 61ec5a158e5c..8ab48087deb7 100644 --- a/adev/src/content/guide/animations/enter-and-leave.md +++ b/adev/src/content/guide/animations/enter-and-leave.md @@ -3,20 +3,20 @@ Well-designed animations can make your application more fun and straightforward to use, but they aren't just cosmetic. Animations can improve your application and user experience in a number of ways: -* Without animations, web page transitions can seem abrupt and jarring -* Motion greatly enhances the user experience, so animations give users a chance to detect the application's response to their actions -* Good animations can smoothly direct the user's attention throughout a workflow +- Without animations, web page transitions can seem abrupt and jarring +- Motion greatly enhances the user experience, so animations give users a chance to detect the application's response to their actions +- Good animations can smoothly direct the user's attention throughout a workflow Angular provides `animate.enter` and `animate.leave` to animate your application's elements. These two features apply enter and leave CSS classes at the appropriate times or call functions to apply animations from third party libraries. `animate.enter` and `animate.leave` are not directives. They are special API supported directly by the Angular compiler. They can be used on elements directly and can also be used as a host binding. ## `animate.enter` -You can use `animate.enter` to animate elements as they _enter_ the DOM. You can define enter animations using CSS classes with either transforms or keyframe animations. +You can use `animate.enter` to animate elements as they _enter_ the DOM. You can define enter animations using CSS classes with either transitions or keyframe animations. - - - + + + When the animation completes, Angular removes the class or classes that you specified in `animate.enter` from the DOM. Animation classes are only be present while the animation is active. @@ -25,10 +25,12 @@ NOTE: When using multiple keyframe animations or transition properties on an ele You can use `animate.enter` with any other Angular features, such as control flow or dynamic expressions. `animate.enter` accepts both a single class string (with multiple classes separated by spaces), or an array of class strings. +A quick note about using CSS transitions: If you choose to use transitions instead of keyframe animations, the classes added to the element with `animate.enter` represent the state that the transition will animate _to_. Your base element CSS is what the element will look like when no animations run, which is likely similar to the end state of the CSS transition. So you would still need to pair it with `@starting-style` to have an appropriate _from_ state for your transition to work. + - - - + + + ## `animate.leave` @@ -36,9 +38,9 @@ You can use `animate.enter` with any other Angular features, such as control flo You can use `animate.leave` to animate elements as they _leave_ the DOM. You can define leave animations using CSS classes with either transforms or keyframe animations. - - - + + + When the animation completes, Angular automatically removes the animated element from the DOM. @@ -48,9 +50,9 @@ NOTE: When using multiple keyframe animations or transition properties on a an e `animate.leave` can also be used with signals, and other bindings. You can use `animate.leave` with a single class or multiple classes. Either specify it as a simple string with spaces or a string array. - - - + + + ## Event Bindings, Functions, and Third-party Libraries @@ -58,9 +60,9 @@ NOTE: When using multiple keyframe animations or transition properties on a an e Both `animate.enter` and `animate.leave` support event binding syntax that allows for function calls. You can use this syntax to call a function in your component code or utilize third-party animation libraries, like [GSAP](https://gsap.com/), [anime.js](https://animejs.com/), or any other JavaScript animation library. - - - + + + The `$event` object has the type `AnimationCallbackEvent`. It includes the element as the `target` and provides an `animationComplete()` function to notify the framework when the animation finishes. @@ -73,6 +75,10 @@ If you don't call `animationComplete()` when using `animate.leave`, Angular call { provide: MAX_ANIMATION_TIMEOUT, useValue: 6000 } ``` +## Compatibility with Legacy Angular Animations + +You cannot use legacy animations alongside `animate.enter` and `animate.leave` within the same component. Doing so would result in enter classes remaining on the element or leaving nodes not being removed. It is otherwise fine to use both legacy animations and the new `animate.enter` and `animate.leave` animations within the same _application_. The only caveat is content projection. If you are projecting content from one component with legacy animations into another component with `animate.enter` or `animate.leave`, or vice versa, this will result in the same behavior as if they are used together in the same component. This is not supported. + ## Testing TestBed provides built-in support for enabling or disabling animations in your test environment. CSS animations require a browser to run, and many of the APIs are not available in a test environment. By default, TestBed disables animations for you in your test environments. @@ -86,3 +92,12 @@ If you want to test that the animations are animating in a browser test, for exa This will configure animations in your test environment to behave normally. NOTE: Some test environments do not emit animation events like `animationstart`, `animationend` and their transition event equivalents. + +## More on Angular animations + +You might also be interested in the following: + + + + + diff --git a/adev/src/content/guide/animations/migration.md b/adev/src/content/guide/animations/migration.md index 22862b116641..60890a17368b 100644 --- a/adev/src/content/guide/animations/migration.md +++ b/adev/src/content/guide/animations/migration.md @@ -1,6 +1,6 @@ # Migrating away from Angular's Animations package -The `@angular/animations` package is deprecated as of v20.2, which also introduced the new `animate.enter` and `animate.leave` feature to add animations to your application. Using these new features, you can replace all animations based on `@angular/animations` with plain CSS or JS animation libraries. Removing `@angular/animations` from your application can significantly reduce the size of your JavaScript bundle. Native CSS animations generally offer superior performance, as they can benefit from hardware acceleration. This guide walks through the process of refactoring your code from `@angular/animations` to native CSS animations. +The `@angular/animations` package is deprecated as of v20.2, which also introduced the new `animate.enter` and `animate.leave` feature to add animations to your application. Using these new features, you can replace all animations based on `@angular/animations` with plain CSS or JS animation libraries. Removing `@angular/animations` from your application can significantly reduce the size of your JavaScript bundle. Native CSS animations generally offer superior performance, as they can benefit from hardware acceleration. This guide walks through the process of refactoring your code from `@angular/animations` to native CSS animations. ## How to write animations in native CSS @@ -8,7 +8,7 @@ If you've never written any native CSS animations, there are a number of excelle [MDN's CSS Animations guide](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animations/Using_CSS_animations) [W3Schools CSS3 Animations guide](https://www.w3schools.com/css/css3_animations.asp) [The Complete CSS Animations Tutorial](https://www.lambdatest.com/blog/css-animations-tutorial/) -[CSS Animation for Beginners](https://thoughtbot.com/blog/css-animation-for-beginners) +[CSS Animation for Beginners](https://thoughtbot.com/blog/css-animation-for-beginners) and a couple of videos: [Learn CSS Animation in 9 Minutes](https://www.youtube.com/watch?v=z2LQYsZhsFw) @@ -21,10 +21,12 @@ Check some of these various guides and tutorials out, and then come back to this Just like with the animations package, you can create reusable animations that can be shared across your application. The animations package version of this had you using the `animation()` function in a shared typescript file. The native CSS version of this is similar, but lives in a shared CSS file. #### With Animations Package - + + #### With Native CSS - + + Adding the class `animated-class` to an element would trigger the animation on that element. @@ -35,12 +37,14 @@ Adding the class `animated-class` to an element would trigger the animation on t The animations package allowed you to define various states using the [`state()`](api/animations/state) function within a component. Examples might be an `open` or `closed` state containing the styles for each respective state within the definition. For example: #### With Animations Package - + + This same behavior can be accomplished natively by using CSS classes either using a keyframe animation or transition styling. #### With Native CSS - + + Triggering the `open` or `closed` state is done by toggling classes on the element in your component. You can find examples of how to do this in our [template guide](guide/templates/binding#css-class-and-style-property-bindings). @@ -52,28 +56,30 @@ The animations package `animate()` function allows for providing timing, like du Specify `animation-duration`, `animation-delay`, and `animation-timing-function` for a keyframe animation in CSS, or alternatively use the `animation` shorthand property. - + Similarly, you can use `transition-duration`, `transition-delay`, and `transition-timing-function` and the `transition` shorthand for animations that are not using `@keyframes`. - + ### Triggering an Animation The animations package required specifying triggers using the `trigger()` function and nesting all of your states within it. With native CSS, this is unnecessary. Animations can be triggered by toggling CSS styles or classes. Once a class is present on an element, the animation will occur. Removing the class will revert the element back to whatever CSS is defined for that element. This results in significantly less code to do the same animation. Here's an example: #### With Animations Package + - - - + + + #### With Native CSS + - - - + + + ## Transition and Triggers @@ -89,19 +95,21 @@ These state matching patterns are not needed at all when animating with CSS dire The animations package offers the ability to animate things that have been historically difficult to animate, like animating a set height to `height: auto`. You can now do this with pure CSS as well. #### With Animations Package + - - - + + + You can use css-grid to animate to auto height. #### With Native CSS + - - - + + + If you don't have to worry about supporting all browsers, you can also check out `calc-size()`, which is the true solution to animating auto height. See [MDN's docs](https://developer.mozilla.org/en-US/docs/Web/CSS/calc-size) and (this tutorial)[https://frontendmasters.com/blog/one-of-the-boss-battles-of-css-is-almost-won-transitioning-to-auto/] for more information. @@ -111,48 +119,53 @@ If you don't have to worry about supporting all browsers, you can also check out The animations package offered the previously mentioned pattern matching for entering and leaving but also included the shorthand aliases of `:enter` and `:leave`. #### With Animations Package + - - - + + + Here's how the same thing can be accomplished without the animations package using `animate.enter`. #### With Native CSS + - - - + + + Use `animate.leave` to animate elements as they leave the view, which will apply the specified CSS classes to the element as it leaves the view. #### With Native CSS + - - - + + + -For more information on `animate.enter` and `animate.leave`, see the [Enter and Leave animations guide](guide/animations/enter-and-leave). +For more information on `animate.enter` and `animate.leave`, see the [Enter and Leave animations guide](guide/animations). ### Animating increment and decrement Along with the aforementioned `:enter` and `:leave`, there's also `:increment` and `:decrement`. You can animate these also by adding and removing classes. Unlike the animation package built-in aliases, there is no automatic application of classes when the values go up or down. You can apply the appropriate classes programmatically. Here's an example: #### With Animations Package + - - - + + + #### With Native CSS + - - - + + + ### Parent / Child Animations @@ -185,12 +198,12 @@ The animations package exposed callbacks for you to use in the case that you wan [`OnAnimationStart`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationstart_event) [`OnAnimationEnd`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationend_event) [`OnAnimationIteration`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationitration_event) -[`OnAnimationCancel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationcancel_event) +[`OnAnimationCancel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animationcancel_event) [`OnTransitionStart`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionstart_event) [`OnTransitionRun`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionrun_event) [`OnTransitionEnd`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionend_event) -[`OnTransitionCancel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitioncancel_event) +[`OnTransitionCancel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitioncancel_event) The Web Animations API has a lot of additional functionality. [Take a look at the documentation](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API) to see all the available animation APIs. @@ -211,17 +224,19 @@ To toggle classes for child nodes within a template, you can use class and style The `stagger()` function allowed you to delay the animation of each item in a list of items by a specified time to create a cascade effect. You can replicate this behavior in native CSS by utilizing `animation-delay` or `transition-delay`. Here is an example of what that CSS might look like. #### With Animations Package + - - - + + + #### With Native CSS + - - - + + + ### Parallel Animations @@ -241,20 +256,21 @@ In this example, the `rotate` and `fade-in` animations fire at the same time. Items reordering in a list works out of the box using the previously described techniques. No additional special work is required. Items in a `@for` loop will be removed and re-added properly, which will fire off animations using `@starting-styles` for entry animations. Alternatively, you can use `animate.enter` for this same behavior. Use `animate.leave` to animate elements as they are removed, as seen in the example above. #### With Animations Package< + - - - + + + #### With Native CSS + - - - + + + - ## Migrating usages of AnimationPlayer The `AnimationPlayer` class allows access to an animation to do more advanced things like pause, play, restart, and finish an animation through code. All of these things can be handled natively as well. @@ -263,4 +279,4 @@ You can retrieve animations off an element directly using [`Element.getAnimation ## Route Transitions -You can use view transitions to animate between routes. See the [Route Transition Animations Guide](guide/routing/route-transition-animations) to get started. \ No newline at end of file +You can use view transitions to animate between routes. See the [Route Transition Animations Guide](guide/routing/route-transition-animations) to get started. diff --git a/adev/src/content/guide/animations/overview.md b/adev/src/content/guide/animations/overview.md index 733f84b47456..cd2e30af9cbd 100644 --- a/adev/src/content/guide/animations/overview.md +++ b/adev/src/content/guide/animations/overview.md @@ -1,16 +1,16 @@ # Introduction to Angular animations -IMPORTANT: The Angular team recommends using native CSS for animations instead of the Animations package for all new code. Use this guide to understand existing code built with the Animations Package. See [Migrating away from Angular's Animations package](guide/animations/migration) to learn how you can start using pure CSS animations in your apps. +IMPORTANT: The `@angular/animations` package is now deprecated. The Angular team recommends using native CSS with `animate.enter` and `animate.leave` for animations for all new code. Learn more at the new enter and leave [animation guide](guide/animations/enter-and-leave). Also see [Migrating away from Angular's Animations package](guide/animations/migration) to learn how you can start migrating to pure CSS animations in your apps. Animation provides the illusion of motion: HTML elements change styling over time. Well-designed animations can make your application more fun and straightforward to use, but they aren't just cosmetic. Animations can improve your application and user experience in a number of ways: -* Without animations, web page transitions can seem abrupt and jarring -* Motion greatly enhances the user experience, so animations give users a chance to detect the application's response to their actions -* Good animations intuitively call the user's attention to where it is needed +- Without animations, web page transitions can seem abrupt and jarring +- Motion greatly enhances the user experience, so animations give users a chance to detect the application's response to their actions +- Good animations intuitively call the user's attention to where it is needed -Typically, animations involve multiple style *transformations* over time. +Typically, animations involve multiple style _transformations_ over time. An HTML element can move, change color, grow or shrink, fade, or slide off the page. These changes can occur simultaneously or sequentially. You can control the timing of each transformation. @@ -49,21 +49,21 @@ bootstrapApplication(AppComponent, { For `NgModule` based applications import `BrowserAnimationsModule`, which introduces the animation capabilities into your Angular root application module. - + If you plan to use specific animation functions in component files, import those functions from `@angular/animations`. - + -See all [available animation functions](guide/animations#animations-api-summary) at the end of this guide. +See all [available animation functions](guide/legacy-animations#animations-api-summary) at the end of this guide. In the component file, add a metadata property called `animations:` within the `@Component()` decorator. You put the trigger that defines an animation within the `animations` metadata property. - + @@ -97,24 +97,24 @@ This function takes two arguments: A unique name like `open` or `closed` and a `style()` function. Use the `style()` function to define a set of styles to associate with a given state name. -You must use *camelCase* for style attributes that contain dashes, such as `backgroundColor` or wrap them in quotes, such as `'background-color'`. +You must use _camelCase_ for style attributes that contain dashes, such as `backgroundColor` or wrap them in quotes, such as `'background-color'`. Let's see how Angular's [`state()`](api/animations/state) function works with the `style⁣­(⁠)` function to set CSS style attributes. In this code snippet, multiple style attributes are set at the same time for the state. In the `open` state, the button has a height of 200 pixels, an opacity of 1, and a yellow background color. - + In the following `closed` state, the button has a height of 100 pixels, an opacity of 0.8, and a background color of blue. - + ### Transitions and timing In Angular, you can set multiple styles without any animation. However, without further refinement, the button instantly transforms with no fade, no shrinkage, or other visible indicator that a change is occurring. -To make the change less abrupt, you need to define an animation *transition* to specify the changes that occur between one state and another over a period of time. +To make the change less abrupt, you need to define an animation _transition_ to specify the changes that occur between one state and another over a period of time. The `transition()` function accepts two arguments: The first argument accepts an expression that defines the direction between two transition states, and the second argument accepts one or a series of `animate()` steps. @@ -146,40 +146,40 @@ The first part, `duration`, is required. The duration can be expressed in milliseconds as a number without quotes, or in seconds with quotes and a time specifier. For example, a duration of a tenth of a second can be expressed as follows: -* As a plain number, in milliseconds: - `100` +- As a plain number, in milliseconds: + `100` -* In a string, as milliseconds: - `'100ms'` +- In a string, as milliseconds: + `'100ms'` -* In a string, as seconds: - `'0.1s'` +- In a string, as seconds: + `'0.1s'` The second argument, `delay`, has the same syntax as `duration`. For example: -* Wait for 100ms and then run for 200ms: `'0.2s 100ms'` +- Wait for 100ms and then run for 200ms: `'0.2s 100ms'` The third argument, `easing`, controls how the animation [accelerates and decelerates](https://easings.net) during its runtime. For example, `ease-in` causes the animation to begin slowly, and to pick up speed as it progresses. -* Wait for 100ms, run for 200ms. - Use a deceleration curve to start out fast and slowly decelerate to a resting point: - `'0.2s 100ms ease-out'` +- Wait for 100ms, run for 200ms. + Use a deceleration curve to start out fast and slowly decelerate to a resting point: + `'0.2s 100ms ease-out'` -* Run for 200ms, with no delay. - Use a standard curve to start slow, accelerate in the middle, and then decelerate slowly at the end: - `'0.2s ease-in-out'` +- Run for 200ms, with no delay. + Use a standard curve to start slow, accelerate in the middle, and then decelerate slowly at the end: + `'0.2s ease-in-out'` -* Start immediately, run for 200ms. - Use an acceleration curve to start slow and end at full velocity: - `'0.2s ease-in'` +- Start immediately, run for 200ms. + Use an acceleration curve to start slow and end at full velocity: + `'0.2s ease-in'` HELPFUL: See the Material Design website's topic on [Natural easing curves](https://material.io/design/motion/speed.html#easing) for general information on easing curves. This example provides a state transition from `open` to `closed` with a 1-second transition between states. - + In the preceding code snippet, the `=>` operator indicates unidirectional transitions, and `<=>` is bidirectional. Within the transition, `animate()` specifies how long the transition takes. @@ -187,24 +187,24 @@ In this case, the state change from `open` to `closed` takes 1 second, expressed This example adds a state transition from the `closed` state to the `open` state with a 0.5-second transition animation arc. - + HELPFUL: Some additional notes on using styles within [`state`](api/animations/state) and `transition` functions. -* Use [`state()`](api/animations/state) to define styles that are applied at the end of each transition, they persist after the animation completes -* Use `transition()` to define intermediate styles, which create the illusion of motion during the animation -* When animations are disabled, `transition()` styles can be skipped, but [`state()`](api/animations/state) styles can't -* Include multiple state pairs within the same `transition()` argument: +- Use [`state()`](api/animations/state) to define styles that are applied at the end of each transition, they persist after the animation completes +- Use `transition()` to define intermediate styles, which create the illusion of motion during the animation +- When animations are disabled, `transition()` styles can be skipped, but [`state()`](api/animations/state) styles can't +- Include multiple state pairs within the same `transition()` argument: - transition( 'on => off, off => void' ) + transition( 'on => off, off => void' ) ### Triggering the animation -An animation requires a *trigger*, so that it knows when to start. +An animation requires a _trigger_, so that it knows when to start. The `trigger()` function collects the states and transitions, and gives the animation a name, so that you can attach it to the triggering element in the HTML template. The `trigger()` function describes the property name to watch for changes. @@ -222,7 +222,7 @@ However, it's possible for multiple triggers to be active at once. Animations are defined in the metadata of the component that controls the HTML element to be animated. Put the code that defines your animations under the `animations:` property within the `@Component()` decorator. - + When you've defined an animation trigger for a component, attach it to an element in that component's template by wrapping the trigger name in brackets and preceding it with an `@` symbol. Then, you can bind the trigger to a template expression using standard Angular property binding syntax as shown below, where `triggerName` is the name of the trigger, and `expression` evaluates to a defined animation state. @@ -237,7 +237,7 @@ The animation is executed or triggered when the expression value changes to a ne The following code snippet binds the trigger to the value of the `isOpen` property. - + In this example, when the `isOpen` expression evaluates to a defined state of `open` or `closed`, it notifies the trigger `openClose` of a state change. Then it's up to the `openClose` code to handle the state change and kick off a state change animation. @@ -254,16 +254,16 @@ In the HTML template file, use the trigger name to attach the defined animations Here are the code files discussed in the transition example. - - - + + + ### Summary You learned to add animation to a transition between two states, using `style()` and [`state()`](api/animations/state) along with `animate()` for the timing. -Learn about more advanced features in Angular animations under the Animation section, beginning with advanced techniques in [transition and triggers](guide/animations/transition-and-triggers). +Learn about more advanced features in Angular animations under the Animation section, beginning with advanced techniques in [transition and triggers](guide/legacy-animations/transition-and-triggers). ## Animations API summary @@ -271,14 +271,14 @@ The functional API provided by the `@angular/animations` module provides a domai See the [API reference](api#animations) for a complete listing and syntax details of the core functions and related data structures. | Function name | What it does | -|:--- |:--- | +| :-------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `trigger()` | Kicks off the animation and serves as a container for all other animation function calls. HTML template binds to `triggerName`. Use the first argument to declare a unique trigger name. Uses array syntax. | | `style()` | Defines one or more CSS styles to use in animations. Controls the visual appearance of HTML elements during animations. Uses object syntax. | | [`state()`](api/animations/state) | Creates a named set of CSS styles that should be applied on successful transition to a given state. The state can then be referenced by name within other animation functions. | | `animate()` | Specifies the timing information for a transition. Optional values for `delay` and `easing`. Can contain `style()` calls within. | | `transition()` | Defines the animation sequence between two named states. Uses array syntax. | | `keyframes()` | Allows a sequential change between styles within a specified time interval. Use within `animate()`. Can include multiple `style()` calls within each `keyframe()`. Uses array syntax. | -| [`group()`](api/animations/group) | Specifies a group of animation steps \(*inner animations*\) to be run in parallel. Animation continues only after all inner animation steps have completed. Used within `sequence()` or `transition()`. | +| [`group()`](api/animations/group) | Specifies a group of animation steps \(_inner animations_\) to be run in parallel. Animation continues only after all inner animation steps have completed. Used within `sequence()` or `transition()`. | | `query()` | Finds one or more inner HTML elements within the current element. | | `sequence()` | Specifies a list of animation steps that are run sequentially, one by one. | | `stagger()` | Staggers the starting time for animations for multiple elements. | @@ -295,8 +295,9 @@ HELPFUL: Check out this [presentation](https://www.youtube.com/watch?v=rnTK9meY5 You might also be interested in the following: - - - + + + + diff --git a/adev/src/content/guide/animations/reusable-animations.md b/adev/src/content/guide/animations/reusable-animations.md index 1fc7361c9849..17c2e9bdd8e1 100644 --- a/adev/src/content/guide/animations/reusable-animations.md +++ b/adev/src/content/guide/animations/reusable-animations.md @@ -1,6 +1,6 @@ # Reusable animations -IMPORTANT: The Angular team recommends using native CSS for animations instead of the Animations package for all new code. Use this guide to understand existing code built with the Animations Package. See [Migrating away from Angular's Animations package](guide/animations/migration#creating-reusable-animations) to learn how you can start using pure CSS animations in your apps. +IMPORTANT: The `@angular/animations` package is now deprecated. The Angular team recommends using native CSS with `animate.enter` and `animate.leave` for animations for all new code. Learn more at the new enter and leave [animation guide](guide/animations/enter-and-leave). Also see [Migrating away from Angular's Animations package](guide/animations/migration) to learn how you can start migrating to pure CSS animations in your apps. This topic provides some examples of how to create reusable animations. @@ -9,7 +9,7 @@ This topic provides some examples of how to create reusable animations. To create a reusable animation, use the [`animation()`](api/animations/animation) function to define an animation in a separate `.ts` file and declare this animation definition as a `const` export variable. You can then import and reuse this animation in any of your application components using the [`useAnimation()`](api/animations/useAnimation) function. - + In the preceding code snippet, `transitionAnimation` is made reusable by declaring it as an export variable. @@ -18,20 +18,21 @@ HELPFUL: The `height`, `opacity`, `backgroundColor`, and `time` inputs are repla You can also export a part of an animation. For example, the following snippet exports the animation `trigger`. - + From this point, you can import reusable animation variables in your component class. For example, the following code snippet imports the `transitionAnimation` variable and uses it via the `useAnimation()` function. - + ## More on Angular animations You might also be interested in the following: - - - + + + + diff --git a/adev/src/content/guide/animations/transition-and-triggers.md b/adev/src/content/guide/animations/transition-and-triggers.md index fcb6d2c211e8..13be61108daf 100644 --- a/adev/src/content/guide/animations/transition-and-triggers.md +++ b/adev/src/content/guide/animations/transition-and-triggers.md @@ -1,6 +1,6 @@ # Animation transitions and triggers -IMPORTANT: The Angular team recommends using native CSS for animations instead of the Animations package for all new code. Use this guide to understand existing code built with the Animations Package. See [Migrating away from Angular's Animations package](guide/animations/migration#transition-and-triggers) to learn how you can start using pure CSS animations in your apps. +IMPORTANT: The `@angular/animations` package is now deprecated. The Angular team recommends using native CSS with `animate.enter` and `animate.leave` for animations for all new code. Learn more at the new enter and leave [animation guide](guide/animations/enter-and-leave). Also see [Migrating away from Angular's Animations package](guide/animations/migration) to learn how you can start migrating to pure CSS animations in your apps. This guide goes into depth on special transition states such as the `*` wildcard and `void`. It shows how these special states are used for elements entering and leaving a view. This section also explores multiple animation triggers, animation callbacks, and sequence-based animation using keyframes. @@ -11,7 +11,7 @@ In Angular, transition states can be defined explicitly through the [`state()`]( ### Wildcard state -An asterisk `*` or *wildcard* matches any animation state. +An asterisk `*` or _wildcard_ matches any animation state. This is useful for defining transitions that apply regardless of the HTML element's start or end state. For example, a transition of `open => *` applies when the element's state changes from open to anything else. @@ -23,11 +23,11 @@ Instead of defining each state-to-state transition pair, any transition to `clos This allows the addition of new states without having to include separate transitions for each one. - + Use a double arrow syntax to specify state-to-state transitions in both directions. - + ### Use wildcard state with multiple transition states @@ -37,7 +37,7 @@ If the button can change from `open` to either `closed` or something like `inPro wildcard state with 3 states - + The `* => *` transition applies when any change between two states takes place. @@ -45,27 +45,27 @@ Transitions are matched in the order in which they are defined. Thus, you can apply other transitions on top of the `* => *` transition. For example, define style changes or animations that would apply just to `open => closed`, then use `* => *` as a fallback for state pairings that aren't otherwise called out. -To do this, list the more specific transitions *before* `* => *`. +To do this, list the more specific transitions _before_ `* => *`. ### Use wildcards with styles Use the wildcard `*` with a style to tell the animation to use whatever the current style value is, and animate with that. Wildcard is a fallback value that's used if the state being animated isn't declared within the trigger. - + ### Void state Use the `void` state to configure transitions for an element that is entering or leaving a page. -See [Animating entering and leaving a view](guide/animations/transition-and-triggers#aliases-enter-and-leave). +See [Animating entering and leaving a view](guide/legacy-animations/transition-and-triggers#aliases-enter-and-leave). ### Combine wildcard and void states Combine wildcard and void states in a transition to trigger animations that enter and leave the page: -* A transition of `* => void` applies when the element leaves a view, regardless of what state it was in before it left -* A transition of `void => *` applies when the element enters a view, regardless of what state it assumes when entering -* The wildcard state `*` matches to *any* state, including `void` +- A transition of `* => void` applies when the element leaves a view, regardless of what state it was in before it left +- A transition of `void => *` applies when the element enters a view, regardless of what state it assumes when entering +- The wildcard state `*` matches to _any_ state, including `void` ## Animate entering and leaving a view @@ -73,10 +73,10 @@ This section shows how to animate elements entering or leaving a page. Add a new behavior: -* When you add a hero to the list of heroes, it appears to fly onto the page from the left -* When you remove a hero from the list, it appears to fly out to the right +- When you add a hero to the list of heroes, it appears to fly onto the page from the left +- When you remove a hero from the list, it appears to fly out to the right - + In the preceding code, you applied the `void` state when the HTML element isn't attached to a view. @@ -87,8 +87,8 @@ These aliases are used by several animation functions. -transition ( ':enter', [ … ] ); // alias for void => * -transition ( ':leave', [ … ] ); // alias for * => void +transition ( ':enter', [ … ] ); // alias for void => _ +transition ( ':leave', [ … ] ); // alias for _ => void @@ -105,11 +105,11 @@ As a rule of thumb consider that any element being added to the DOM by Angular p This example has a special trigger for the enter and leave animation called `myInsertRemoveTrigger`. The HTML template contains the following code. - + In the component file, the `:enter` transition sets an initial opacity of 0. It then animates it to change that opacity to 1 as the element is inserted into the view. - + Note that this example doesn't need to use [`state()`](api/animations/state). @@ -119,15 +119,15 @@ The `transition()` function takes other selector values, `:increment` and `:decr Use these to kick off a transition when a numeric value has increased or decreased in value. HELPFUL: The following example uses `query()` and `stagger()` methods. -For more information on these methods, see the [complex sequences](guide/animations/complex-sequences) page. +For more information on these methods, see the [complex sequences](guide/legacy-animations/complex-sequences) page. - + ## Boolean values in transitions If a trigger contains a Boolean value as a binding value, then this value can be matched using a `transition()` expression that compares `true` and `false`, or `1` and `0`. - + In the code snippet above, the HTML template binds a `
` element to a trigger named `openClose` with a status expression of `isOpen`, and with possible values of `true` and `false`. This pattern is an alternative to the practice of creating two named states like `open` and `close`. @@ -136,7 +136,7 @@ Inside the `@Component` metadata under the `animations:` property, when the stat In this case, the animation uses whatever height the element already had before the animation started. When the element is `closed`, the element gets animated to a height of 0, which makes it invisible. - + ## Multiple animation triggers @@ -156,8 +156,8 @@ When true, the `@.disabled` binding prevents all animations from rendering. The following code sample shows how to use this feature. - - + + When the `@.disabled` binding is true, the `@childAnimation` trigger doesn't kick off. @@ -167,31 +167,31 @@ You can't selectively turn off multiple animations on a single element. -* A child animation can be queried by a parent and then later animated with the `animateChild()` function +- A child animation can be queried by a parent and then later animated with the `animateChild()` function #### Disable all animations To turn off all animations for an Angular application, place the `@.disabled` host binding on the topmost Angular component. - + HELPFUL: Disabling animations application-wide is useful during end-to-end \(E2E\) testing. ## Animation callbacks -The animation `trigger()` function emits *callbacks* when it starts and when it finishes. +The animation `trigger()` function emits _callbacks_ when it starts and when it finishes. The following example features a component that contains an `openClose` trigger. - + In the HTML template, the animation event is passed back via `$event`, as `@triggerName.start` and `@triggerName.done`, where `triggerName` is the name of the trigger being used. In this example, the trigger `openClose` appears as follows. - + A potential use for animation callbacks could be to cover for a slow API call, such as a database lookup. For example, an **InProgress** button can be set up to have its own looping animation while the backend system operation finishes. @@ -199,16 +199,16 @@ For example, an **InProgress** button can be set up to have its own looping anim Another animation can be called when the current animation finishes. For example, the button goes from the `inProgress` state to the `closed` state when the API call is completed. -An animation can influence an end user to *perceive* the operation as faster, even when it is not. +An animation can influence an end user to _perceive_ the operation as faster, even when it is not. Callbacks can serve as a debugging tool, for example in conjunction with `console.warn()` to view the application's progress in a browser's Developer JavaScript Console. The following code snippet creates console log output for the original example, a button with the two states of `open` and `closed`. - + ## Keyframes -To create an animation with multiple steps run in sequence, use *keyframes*. +To create an animation with multiple steps run in sequence, use _keyframes_. Angular's `keyframe()` function allows several style changes within a single timing segment. For example, the button, instead of fading, could change color several times over a single 2-second time span. @@ -217,7 +217,7 @@ For example, the button, instead of fading, could change color several times ove The code for this color change might look like this. - + ### Offset @@ -233,7 +233,7 @@ Specifying an offset of 0.8 for the middle transition in the preceding example m The code with offsets specified would be as follows. - + You can combine keyframes with `duration`, `delay`, and `easing` within a single animation. @@ -243,14 +243,14 @@ Use keyframes to create a pulse effect in your animations by defining styles at Here's an example of using keyframes to create a pulse effect: -* The original `open` and `closed` states, with the original changes in height, color, and opacity, occurring over a timeframe of 1 second -* A keyframes sequence inserted in the middle that causes the button to appear to pulsate irregularly over the course of that same 1 second timeframe +- The original `open` and `closed` states, with the original changes in height, color, and opacity, occurring over a timeframe of 1 second +- A keyframes sequence inserted in the middle that causes the button to appear to pulsate irregularly over the course of that same 1 second timeframe keyframes with irregular pulsation The code snippet for this animation might look like this. - + ### Animatable properties and units @@ -260,14 +260,14 @@ The W3C maintains a list of animatable properties on its [CSS Transitions](https For properties with a numeric value, define a unit by providing the value as a string, in quotes, with the appropriate suffix: -* 50 pixels: - `'50px'` +- 50 pixels: + `'50px'` -* Relative font size: - `'3em'` +- Relative font size: + `'3em'` -* Percentage: - `'100%'` +- Percentage: + `'100%'` You can also provide the value as a number. In such cases Angular assumes a default unit of pixels, or `px`. Expressing 50 pixels as `50` is the same as saying `'50px'`. @@ -285,7 +285,7 @@ In these cases, you can use a special wildcard `*` property value under `style() The following example has a trigger called `shrinkOut`, used when an HTML element leaves the page. The animation takes whatever height the element has before it leaves, and animates from that height to zero. - + ### Keyframes summary @@ -296,8 +296,9 @@ The `keyframes()` function in Angular allows you to specify multiple interim sty You might also be interested in the following: - - - + + + + diff --git a/adev/src/content/guide/components/BUILD.bazel b/adev/src/content/guide/components/BUILD.bazel index aee1573dc856..83596c30911d 100644 --- a/adev/src/content/guide/components/BUILD.bazel +++ b/adev/src/content/guide/components/BUILD.bazel @@ -6,6 +6,7 @@ generate_guides( srcs = glob([ "*.md", ]), + api_manifest = "//adev/src/assets:docs_api_manifest", data = [ "//adev/src/assets/images:components.svg", ], diff --git a/adev/src/content/guide/components/anatomy-of-components.md b/adev/src/content/guide/components/anatomy-of-components.md index e90ce3677982..5a301b26aaf6 100644 --- a/adev/src/content/guide/components/anatomy-of-components.md +++ b/adev/src/content/guide/components/anatomy-of-components.md @@ -5,9 +5,9 @@ TIP: This guide assumes you've already read the [Essentials Guide](essentials). Every component must have: -* A TypeScript class with _behaviors_ such as handling user input and fetching data from a server -* An HTML template that controls what renders into the DOM -* A [CSS selector](https://developer.mozilla.org/docs/Learn/CSS/Building_blocks/Selectors) that defines how the component is used in HTML +- A TypeScript class with _behaviors_ such as handling user input and fetching data from a server +- An HTML template that controls what renders into the DOM +- A [CSS selector](https://developer.mozilla.org/docs/Learn/CSS/Building_blocks/Selectors) that defines how the component is used in HTML You provide Angular-specific information for a component by adding a `@Component` [decorator](https://www.typescriptlang.org/docs/handbook/decorators.html) on top of the TypeScript class: @@ -58,7 +58,7 @@ Both `templateUrl` and `styleUrl` are relative to the directory in which the com To use a component, [directive](guide/directives), or [pipe](guide/templates/pipes), you must add it to the `imports` array in the `@Component` decorator: -```angular-ts +```ts import {ProfilePhoto} from './profile-photo'; @Component({ @@ -70,7 +70,7 @@ import {ProfilePhoto} from './profile-photo'; export class UserProfile { } ``` -By default, Angular components are *standalone*, meaning that you can directly add them to the `imports` array of other components. Components created with an earlier version of Angular may instead specify `standalone: false` in their `@Component` decorator. For these components, you instead import the `NgModule` in which the component is defined. See the full [`NgModule` guide](guide/ngmodules) for details. +By default, Angular components are _standalone_, meaning that you can directly add them to the `imports` array of other components. Components created with an earlier version of Angular may instead specify `standalone: false` in their `@Component` decorator. For these components, you instead import the `NgModule` in which the component is defined. See the full [`NgModule` guide](guide/ngmodules) for details. Important: In Angular versions before 19.0.0, the `standalone` option defaults to `false`. @@ -97,8 +97,8 @@ You show a component by creating a matching HTML element in the template of _oth export class ProfilePhoto { } @Component({ - imports: [ProfilePhoto], - template: `` +imports: [ProfilePhoto], +template: `` }) export class UserProfile { } @@ -121,5 +121,4 @@ flowchart TD E[UserBio] ``` - This tree structure is important to understanding several other Angular concepts, including [dependency injection](guide/di) and [child queries](guide/components/queries). diff --git a/adev/src/content/guide/components/content-projection.md b/adev/src/content/guide/components/content-projection.md index 666748698bf7..efa351cabf9a 100644 --- a/adev/src/content/guide/components/content-projection.md +++ b/adev/src/content/guide/components/content-projection.md @@ -18,7 +18,7 @@ export class CustomCard {/* ... */} ```angular-ts @Component({ selector: 'custom-card', - template: '
', + template: '
', }) export class CustomCard {/* ... */} ``` @@ -68,7 +68,7 @@ placeholder that tells Angular where to render content. Angular's compiler proce all `` elements at build-time. You cannot insert, remove, or modify `` at run time. You cannot add directives, styles, or arbitrary attributes to ``. -You should not conditionally include `` with `@if`, `@for`, or `@switch`. Angular always +IMPORTANT: You should not conditionally include `` with `@if`, `@for`, or `@switch`. Angular always instantiates and creates DOM nodes for content rendered to a `` placeholder, even if that `` placeholder is hidden. For conditional rendering of component content, see [Template fragments](api/core/ng-template). @@ -79,21 +79,48 @@ Angular supports projecting multiple different elements into different `card-title`, +}) +export class CardTitle {} + +@Component({ + selector: 'card-body', + template: `card-body`, +}) +export class CardBody {} +``` + +```angular-ts -
- -
- -
+Component({ + selector: 'custom-card', + template: ` +
+ +
+ +
+ `, +}) +export class CustomCard {} ``` -```angular-html +```angular-ts - - Hello - Welcome to the example - +@Component({ + selector: 'app-root', + imports: [CustomCard, CardTitle, CardBody], + template: ` + + Hello + Welcome to the example + +`, +}) +export class App {} ``` ```angular-html @@ -150,7 +177,7 @@ elements that don't match one of the component's placeholders do not render into ## Fallback content -Angular can show *fallback content* for a component's `` placeholder if that component doesn't have any matching child content. You can specify fallback content by adding child content to the `` element itself. +Angular can show _fallback content_ for a component's `` placeholder if that component doesn't have any matching child content. You can specify fallback content by adding child content to the `` element itself. ```angular-html diff --git a/adev/src/content/guide/components/host-elements.md b/adev/src/content/guide/components/host-elements.md index 8401ed41f1dc..38f5080b34ce 100644 --- a/adev/src/content/guide/components/host-elements.md +++ b/adev/src/content/guide/components/host-elements.md @@ -37,7 +37,7 @@ In the above example, `` is the host element of the `ProfilePhoto ## Binding to the host element -A component can bind properties, attributes, and events to its host element. This behaves +A component can bind properties, attributes, styles and events to its host element. This behaves identically to bindings on elements inside the component's template, but instead defined with the `host` property in the `@Component` decorator: @@ -48,6 +48,7 @@ the `host` property in the `@Component` decorator: 'role': 'slider', '[attr.aria-valuenow]': 'value', '[class.active]': 'isActive()', + '[style.background]' : `hasError() ? 'red' : 'green'`, '[tabIndex]': 'disabled ? -1 : 0', '(keydown)': 'updateValue($event)', }, @@ -56,6 +57,7 @@ export class CustomSlider { value: number = 0; disabled: boolean = false; isActive = signal(false); + hasError = signal(false); updateValue(event: KeyboardEvent) { /* ... */ } /* ... */ @@ -67,9 +69,9 @@ export class CustomSlider { You can alternatively bind to the host element by applying the `@HostBinding` and `@HostListener` decorator to class members. -`@HostBinding` lets you bind host properties and attributes to properties and methods: +`@HostBinding` lets you bind host properties and attributes to properties and getters: -```angular-ts +```ts @Component({ /* ... */ }) @@ -78,7 +80,7 @@ export class CustomSlider { value: number = 0; @HostBinding('tabIndex') - getTabIndex() { + get tabIndex() { return this.disabled ? -1 : 0; } @@ -98,8 +100,10 @@ export class CustomSlider { } ``` -**Always prefer using the `host` property over `@HostBinding` and `@HostListener`.** These + + **Always prefer using the `host` property over `@HostBinding` and `@HostListener`.** These decorators exist exclusively for backwards compatibility. + ## Binding collisions @@ -126,3 +130,58 @@ In cases like this, the following rules determine which value wins: - If both values are static, the instance binding wins. - If one value is static and the other dynamic, the dynamic value wins. - If both values are dynamic, the component's host binding wins. + +## Styling with CSS custom properties + +Developers often rely on [CSS Custom Properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_cascading_variables/Using_CSS_custom_properties) to enable a flexible configuration of their component's styles. +You can set such custom properties on a host element with a [style binding][style binding](guide/templates/binding#css-style-properties). + +```angular-ts +@Component({ + /* ... */ + host: { + '[style.--my-background]': 'color()', + } +}) +export class MyComponent { + color = signal('lightgreen'); +} +``` + +In this example, the `--my-background` CSS custom property is bound to the `color` signal. The value of the custom property will automatically update whenever the `color` signal changes. This will affect the current component and all its children that rely on this custom property. + +### Setting custom properties on children compoents + +Alternatively, it is also possible to set css custom properties on the host element of children components with a [style binding](guide/templates/binding#css-style-properties). + +```angular-ts +@Component({ + selector: 'my-component', + template: ``, +}) +export class MyComponent { + color = signal('lightgreen'); +} +``` + +## Injecting host element attributes + +Components and directives can read static attributes from their host element by using `HostAttributeToken` together with the [`inject`](api/core/inject) function. + +```ts +import { Component, HostAttributeToken, inject } from '@angular/core'; + +@Component({ + selector: 'app-button', + ..., +}) +export class Button { + variation = inject(new HostAttributeToken('variation')); +} +``` + +```angular-html +Click me +``` + +HELPFUL: `HostAttributeToken` throws an error if the attribute is missing, unless the injection is marked as optional. diff --git a/adev/src/content/guide/components/inputs.md b/adev/src/content/guide/components/inputs.md index 77cceea06e50..2988345ad92b 100644 --- a/adev/src/content/guide/components/inputs.md +++ b/adev/src/content/guide/components/inputs.md @@ -7,13 +7,13 @@ TIP: If you're familiar with other web frameworks, input properties are similar When you use a component, you commonly want to pass some data to it. A component specifies the data that it accepts by declaring **inputs**: - + import {Component, input} from '@angular/core'; -@Component({/*...*/}) +@Component({/_..._/}) export class CustomSlider { - // Declare an input named 'value' with a default value of zero. - value = input(0); +// Declare an input named 'value' with a default value of zero. +value = input(0); } @@ -25,7 +25,7 @@ This lets you bind to the property in a template: If an input has a default value, TypeScript infers the type from the default value: -```typescript +```ts @Component({/*...*/}) export class CustomSlider { // TypeScript infers that this input is a number, returning InputSignal. @@ -37,7 +37,7 @@ You can explicitly declare a type for the input by specifying a generic paramete If an input without a default value is not set, its value is `undefined`: -```typescript +```ts @Component({/*...*/}) export class CustomSlider { // Produces an InputSignal because `value` may not be set. @@ -60,13 +60,13 @@ The `input` function returns an `InputSignal`. You can read the value by calling import {Component, input} from '@angular/core'; -@Component({/*...*/}) +@Component({/_..._/}) export class CustomSlider { - // Declare an input named 'value' with a default value of zero. - value = input(0); +// Declare an input named 'value' with a default value of zero. +value = input(0); - // Create a computed expression that reads the value input - label = computed(() => `The slider's value is ${this.value()}`); +// Create a computed expression that reads the value input +label = computed(() => `The slider's value is ${this.value()}`); } @@ -106,7 +106,7 @@ export class CustomSlider { } function trimString(value: string | undefined): string { - return value?.trim() ?? ''; +return value?.trim() ?? ''; } @@ -133,7 +133,7 @@ export class CustomSlider { } function appendPx(value: number): string { - return `${value}px`; +return `${value}px`; }
@@ -146,10 +146,10 @@ Angular includes two built-in transform functions for the two most common scenar import {Component, input, booleanAttribute, numberAttribute} from '@angular/core'; -@Component({/*...*/}) +@Component({/_..._/}) export class CustomSlider { - disabled = input(false, {transform: booleanAttribute}); - value = input(0, {transform: numberAttribute}); +disabled = input(false, {transform: booleanAttribute}); +value = input(0, {transform: numberAttribute}); } @@ -185,14 +185,14 @@ When creating a component, you can define a model input similarly to how you cre Both types of input allow someone to bind a value into the property. However, **model inputs allow the component author to write values into the property**. If the property is bound with a two-way binding, the new value propagates to that binding. -```typescript +```angular-ts @Component({ /* ... */}) export class CustomSlider { // Define a model input named "value". value = model(0); increment() { - // Update the model input with a new value, propagating the value to any bindings. + // Update the model input with a new value, propagating the value to any bindings. this.value.update(oldValue => oldValue + 10); } } @@ -205,7 +205,7 @@ export class CustomSlider { template: ``, }) export class MediaControls { - // Create a writable signal for the `volume` local state. + // Create a writable signal for the `volume` local state. volume = signal(0); } ``` @@ -238,7 +238,7 @@ In the example above, the `CustomSlider` can write values into its `value` model When you declare a model input in a component or directive, Angular automatically creates a corresponding [output](guide/components/outputs) for that model. The output's name is the model input's name suffixed with "Change". -```angular-ts +```ts @Directive({ /* ... */ }) export class CustomCheckbox { // This automatically creates an output named "checkedChange". @@ -342,7 +342,7 @@ Input aliases work the same way as for signal-based inputs described above. When using decorator-based inputs, a property implemented with a getter and setter can be an input: - +```ts export class CustomSlider { @Input() get value(): number { @@ -353,11 +353,11 @@ export class CustomSlider { private internalValue = 0; } - +``` You can even create a _write-only_ input by only defining a public setter: - +```ts export class CustomSlider { @Input() set value(newValue: number) { @@ -366,7 +366,7 @@ export class CustomSlider { private internalValue = 0; } - +``` **Prefer using input transforms instead of getters and setters** if possible. diff --git a/adev/src/content/guide/components/lifecycle.md b/adev/src/content/guide/components/lifecycle.md index 09ae04a4ec6a..2d8428061254 100644 --- a/adev/src/content/guide/components/lifecycle.md +++ b/adev/src/content/guide/components/lifecycle.md @@ -161,6 +161,12 @@ destroyed. You can also use `DestroyRef` to keep setup code close to cleanup code, rather than putting all cleanup code in the `ngOnDestroy` method. +##### Detecting instance destruction + +`DestroyRef` provides a `destroyed` property that allows checking whether a given instance has already been destroyed. This is useful for avoiding operations on destroyed components, especially when dealing with delayed or asynchronous logic. + +By checking `destroyRef.destroyed`, you can prevent executing code after the instance has been cleaned up, avoiding potential errors such as `NG0911: View has already been destroyed.`. + ### ngDoCheck The `ngDoCheck` method runs before every time Angular checks a component's template for changes. @@ -237,7 +243,7 @@ See [Using DOM APIs](guide/components/dom-apis) for guidance on working with the Render callbacks do not run during server-side rendering or during build-time pre-rendering. -#### after*Render phases +#### after\*Render phases When using `afterEveryRender` or `afterNextRender`, you can optionally split the work into phases. The phase gives you control over the sequencing of DOM operations, letting you sequence _write_ diff --git a/adev/src/content/guide/components/outputs.md b/adev/src/content/guide/components/outputs.md index ad8bbcacc70a..a80dbd9f0bc9 100644 --- a/adev/src/content/guide/components/outputs.md +++ b/adev/src/content/guide/components/outputs.md @@ -17,9 +17,9 @@ export class ExpandablePanel { The `output` function returns an `OutputEmitterRef`. You can emit an event by calling the `emit` method on the `OutputEmitterRef`: - +```ts this.panelClosed.emit(); - +``` Angular refers to properties initialized with the `output` function as **outputs**. You can use outputs to raise custom events, similar to native browser events like `click`. @@ -35,7 +35,7 @@ The `output` function has special meaning to the Angular compiler. **You can exc You can pass event data when calling `emit`: - +```ts // You can emit primitive values. this.valueChanged.emit(7); @@ -44,7 +44,7 @@ this.thumbDropped.emit({ pointerX: 123, pointerY: 456, }) - +``` When defining an event listener in a template, you can access the event data from the `$event` variable: @@ -52,16 +52,30 @@ When defining an event listener in a template, you can access the event data fro ``` +Receive the event data in the parent component: + +```ts +@Component({ + /*...*/ +}) +export class App { + logValue(value: number) { + ... + } +} + +``` + ## Customizing output names The `output` function accepts a parameter that lets you specify a different name for the event in a template: - +```ts @Component({/*...*/}) export class CustomSlider { changed = output({alias: 'valueChanged'}); } - +``` ```angular-html @@ -86,7 +100,7 @@ someComponentRef.instance.someEventProperty.subscribe(eventData => { Angular automatically cleans up event subscriptions when it destroys components with subscribers. Alternatively, you can manually unsubscribe from an event. The `subscribe` function returns an `OutputRefSubscription` with an `unsubscribe` method: -```typescript +```ts const eventSubscription = someComponent.someEventProperty.subscribe(eventData => { console.log(eventData); }); @@ -115,12 +129,12 @@ original decorator-based `@Output` API remains fully supported. You can alternatively define custom events by assigning a property to a new `EventEmitter` and adding the `@Output` decorator: - +```ts @Component({/*...*/}) export class ExpandablePanel { @Output() panelClosed = new EventEmitter(); } - +``` You can emit an event by calling the `emit` method on the `EventEmitter`. @@ -128,12 +142,12 @@ You can emit an event by calling the `emit` method on the `EventEmitter`. The `@Output` decorator accepts a parameter that lets you specify a different name for the event in a template: - +```ts @Component({/*...*/}) export class CustomSlider { @Output('valueChanged') changed = new EventEmitter(); } - +``` ```angular-html @@ -145,22 +159,22 @@ This alias does not affect usage of the property in TypeScript code. In addition to the `@Output` decorator, you can also specify a component's outputs with the `outputs` property in the `@Component` decorator. This can be useful when a component inherits a property from a base class: - +```ts // `CustomSlider` inherits the `valueChanged` property from `BaseSlider`. @Component({ /*...*/ outputs: ['valueChanged'], }) export class CustomSlider extends BaseSlider {} - +``` You can additionally specify an output alias in the `outputs` list by putting the alias after a colon in the string: - +```ts // `CustomSlider` inherits the `valueChanged` property from `BaseSlider`. @Component({ /*...*/ outputs: ['valueChanged: volumeChanged'], }) export class CustomSlider extends BaseSlider {} - +``` diff --git a/adev/src/content/guide/components/programmatic-rendering.md b/adev/src/content/guide/components/programmatic-rendering.md index 678d49dc2194..51887ae3591b 100644 --- a/adev/src/content/guide/components/programmatic-rendering.md +++ b/adev/src/content/guide/components/programmatic-rendering.md @@ -2,16 +2,16 @@ TIP: This guide assumes you've already read the [Essentials Guide](essentials). Read that first if you're new to Angular. -In addition to using a component directly in a template, you can also dynamically render components -programmatically. This is helpful for situations when a component is unknown initially (thus can not +In addition to using a component directly in a template, you can also dynamically render components +programmatically. This is helpful for situations when a component is unknown initially (thus can not be referenced in a template directly) and it depends on some conditions. There are two main ways to render a component programmatically: in a template using `NgComponentOutlet`, -or in your TypeScript code using `ViewContainerRef`. +or in your TypeScript code using `ViewContainerRef`. -HELPFUL: for lazy-loading use-cases (for example if you want to delay loading of a heavy component), consider -using the built-in [`@defer` feature](/guide/templates/defer) instead. The `@defer` feature allows the code -of any components, directives, and pipes inside the `@defer` block to be extracted into separate JavaScript +HELPFUL: for lazy-loading use-cases (for example if you want to delay loading of a heavy component), consider +using the built-in [`@defer` feature](/guide/templates/defer) instead. The `@defer` feature allows the code +of any components, directives, and pipes inside the `@defer` block to be extracted into separate JavaScript chunks automatically and loaded only when necessary, based on the configured triggers. ## Using NgComponentOutlet @@ -103,10 +103,10 @@ In the example above, clicking the "Load content" button results in the followin ## Lazy-loading components -HELPFUL: if you want to lazy-load some components, you may consider using the built-in [`@defer` feature](/guide/templates/defer) +HELPFUL: if you want to lazy-load some components, you may consider using the built-in [`@defer` feature](/guide/templates/defer) instead. -If your use-case is not covered by the `@defer` feature, you can use either `NgComponentOutlet` or +If your use-case is not covered by the `@defer` feature, you can use either `NgComponentOutlet` or `ViewContainerRef` with a standard JavaScript [dynamic import](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/import). ```angular-ts @@ -119,9 +119,11 @@ If your use-case is not covered by the `@defer` feature, you can use either `NgC

Advanced settings

- + @if(!advancedSettings) { + + }
` @@ -137,3 +139,117 @@ export class AdminSettings { ``` The example above loads and displays the `AdvancedSettings` upon receiving a button click. + +## Binding inputs, outputs and setting host directives at creation + +When dynamically creating components, manually setting inputs and subscribing to outputs can be error-prone. You often need to write extra code just to wire up bindings after the component is instantiated. + +To simplify this, both `createComponent` and `ViewContainerRef.createComponent` support passing a `bindings` array with helpers like `inputBinding()`, `outputBinding()`, and `twoWayBinding()` to configure inputs and outputs up front. You can also specify a `directives` array to apply any host directives. This enables creating components programmatically with template-like bindings in a single, declarative call. + +### Host view using `ViewContainerRef.createComponent` + +`ViewContainerRef.createComponent` creates a component and automatically inserts its host view and host element into the container’s view hierarchy at the container’s location. Use this when the dynamic component should become part of the container’s logical and visual structure (for example, adding list items or inline UI). + +By contrast, the standalone `createComponent` API does not attach the new component to any existing view or DOM location — it returns a `ComponentRef` and gives you explicit control over where to place the component’s host element. + +```angular-ts +import { Component, input, model, output } from "@angular/core"; + +@Component({ + selector: 'app-warning', + template: ` + @if(isExpanded()) { +
+

Warning: Action needed!

+ +
+ } + ` +}) +export class AppWarningComponent { + readonly canClose = input.required(); + readonly isExpanded = model(); + readonly close = output(); +} +``` + +```ts +import { Component, ViewContainerRef, signal, inputBinding, outputBinding, twoWayBinding, inject } from '@angular/core'; +import { FocusTrap } from "@angular/cdk/a11y"; +import { ThemeDirective } from '../theme.directive'; + +@Component({ + template: `` +}) +export class HostComponent { + private vcr = inject(ViewContainerRef); + readonly canClose = signal(true); + readonly isExpanded = signal(true); + + showWarning() { + const compRef = this.vcr.createComponent(AppWarningComponent, { + bindings: [ + inputBinding('canClose', this.canClose), + twoWayBinding('isExpanded', this.isExpanded), + outputBinding('close', (confirmed) => { + console.log('Closed with result:', confirmed); + }) + ], + directives: [ + FocusTrap, + { type: ThemeDirective, bindings: [inputBinding('theme', () => 'warning')] } + ] + }); + } +} +``` + +In the example above, the dynamic **AppWarningComponent** is created with its `canClose` input bound to a reactive signal, a two-way binding on its `isExpanded` state, and an output listener for `close`. The `FocusTrap` and `ThemeDirective` are attached to the host element via `directives`. + +### Popup attached to `document.body` with `createComponent` + `hostElement` + +Use this when rendering outside the current view hierarchy (e.g., overlays). The provided `hostElement` becomes the component’s host in the DOM, so Angular doesn’t create a new element matching the selector. Lets you configure **bindings** directly. + +```ts +import { + ApplicationRef, + createComponent, + EnvironmentInjector, + inject, + Injectable, + inputBinding, + outputBinding, +} from '@angular/core'; +import { PopupComponent } from './popup.component'; + +@Injectable({ providedIn: 'root' }) +export class PopupService { + private readonly injector = inject(EnvironmentInjector); + private readonly appRef = inject(ApplicationRef); + + show(message: string) { + // Create a host element for the popup + const host = document.createElement('popup-host'); + + // Create the component and bind in one call + const ref = createComponent(PopupComponent, { + environmentInjector: this.injector, + hostElement: host, + bindings: [ + inputBinding('message', () => message), + outputBinding('closed', () => { + document.body.removeChild(host); + this.appRef.detachView(ref.hostView); + ref.destroy(); + }), + ], + }); + + // Registers the component’s view so it participates in change detection cycle. + this.appRef.attachView(ref.hostView); + // Inserts the provided host element into the DOM (outside the normal Angular view hierarchy). + // This is what makes the popup visible on screen, typically used for overlays or modals. + document.body.appendChild(host); + } +} +``` diff --git a/adev/src/content/guide/components/queries.md b/adev/src/content/guide/components/queries.md index 31b7374b7f62..5e80d0764b6d 100644 --- a/adev/src/content/guide/components/queries.md +++ b/adev/src/content/guide/components/queries.md @@ -25,12 +25,12 @@ export class CustomCardHeader { } @Component({ - selector: 'custom-card', - template: 'Visit sunny California!', +selector: 'custom-card', +template: 'Visit sunny California!', }) export class CustomCard { - header = viewChild(CustomCardHeader); - headerText = computed(() => this.header()?.text); +header = viewChild(CustomCardHeader); +headerText = computed(() => this.header()?.text); }
@@ -50,15 +50,14 @@ export class CustomCardAction { } @Component({ - selector: 'custom-card', - template: ` - Save +selector: 'custom-card', +template: ` Save Cancel `, }) export class CustomCard { - actions = viewChildren(CustomCardAction); - actionsTexts = computed(() => this.actions().map(action => action.text); +actions = viewChildren(CustomCardAction); +actionsTexts = computed(() => this.actions().map(action => action.text); }
@@ -80,19 +79,18 @@ export class CustomToggle { } @Component({ - selector: 'custom-expando', - /*...*/ +selector: 'custom-expando', +/_..._/ }) export class CustomExpando { - toggle = contentChild(CustomToggle); - toggleText = computed(() => this.toggle()?.text); +toggle = contentChild(CustomToggle); +toggleText = computed(() => this.toggle()?.text); } -@Component({ - /* ... */ - // CustomToggle is used inside CustomExpando as content. - template: ` - +@Component({ +/_ ... _/ +// CustomToggle is used inside CustomExpando as content. + template: ` Show ` @@ -118,18 +116,17 @@ export class CustomMenuItem { } @Component({ - selector: 'custom-menu', - /*...*/ +selector: 'custom-menu', +/_..._/ }) export class CustomMenu { - items = contentChildren(CustomMenuItem); - itemTexts = computed(() => this.items().map(item => item.text)); +items = contentChildren(CustomMenuItem); +itemTexts = computed(() => this.items().map(item => item.text)); } @Component({ - selector: 'user-profile', - template: ` - +selector: 'user-profile', +template: ` Cheese Tomato @@ -146,7 +143,7 @@ export class UserProfile { } If a child query (`viewChild` or `contentChild`) does not find a result, its value is `undefined`. This may occur if the target element is hidden by a control flow statement like `@if` or `@for`. Because of this, the child queries return a signal that include `undefined` in their value type. -In some cases, especially with `viewChild`, you know with certainty that a specific child is always available. In other cases, you may want to strictly enforce that a specific child is present. For these cases, you can use a *required query*. +In some cases, especially with `viewChild`, you know with certainty that a specific child is always available. In other cases, you may want to strictly enforce that a specific child is present. For these cases, you can use a _required query_. ```angular-ts @Component({/* ... */}) @@ -230,7 +227,7 @@ Developers most commonly use `read` to retrieve `ElementRef` and `TemplateRef`. ### Content descendants By default, `contentChildren` queries find only _direct_ children of the component and do not traverse into descendants. -`contentChild` queries do traverse into descendants by default. +`contentChild` queries do traverse into descendants by default. @Component({ @@ -243,9 +240,8 @@ export class CustomExpando { } @Component({ - selector: 'user-profile', - template: ` - +selector: 'user-profile', +template: ` Show @@ -260,6 +256,7 @@ In the example above, `CustomExpando` cannot find `` with `conten View queries do not have this option because they _always_ traverse into descendants. ## Decorator-based queries + TIP: While the Angular team recommends using the signal-based query function for new projects, the original decorator-based query APIs remain fully supported. @@ -279,15 +276,15 @@ export class CustomCardHeader { } @Component({ - selector: 'custom-card', - template: 'Visit sunny California!', +selector: 'custom-card', +template: 'Visit sunny California!', }) export class CustomCard { - @ViewChild(CustomCardHeader) header: CustomCardHeader; +@ViewChild(CustomCardHeader) header: CustomCardHeader; - ngAfterViewInit() { - console.log(this.header.text); - } +ngAfterViewInit() { +console.log(this.header.text); +} } @@ -309,20 +306,19 @@ export class CustomCardAction { } @Component({ - selector: 'custom-card', - template: ` - Save +selector: 'custom-card', +template: ` Save Cancel `, }) export class CustomCard { - @ViewChildren(CustomCardAction) actions: QueryList; +@ViewChildren(CustomCardAction) actions: QueryList; - ngAfterViewInit() { - this.actions.forEach(action => { - console.log(action.text); - }); - } +ngAfterViewInit() { +this.actions.forEach(action => { +console.log(action.text); +}); +} }
@@ -342,21 +338,20 @@ export class CustomToggle { } @Component({ - selector: 'custom-expando', - /*...*/ +selector: 'custom-expando', +/_..._/ }) export class CustomExpando { - @ContentChild(CustomToggle) toggle: CustomToggle; +@ContentChild(CustomToggle) toggle: CustomToggle; - ngAfterContentInit() { - console.log(this.toggle.text); - } +ngAfterContentInit() { +console.log(this.toggle.text); +} } @Component({ - selector: 'user-profile', - template: ` - +selector: 'user-profile', +template: ` Show ` @@ -382,23 +377,22 @@ export class CustomMenuItem { } @Component({ - selector: 'custom-menu', - /*...*/ +selector: 'custom-menu', +/_..._/ }) export class CustomMenu { - @ContentChildren(CustomMenuItem) items: QueryList; +@ContentChildren(CustomMenuItem) items: QueryList; - ngAfterContentInit() { - this.items.forEach(item => { - console.log(item.text); - }); - } +ngAfterContentInit() { +this.items.forEach(item => { +console.log(item.text); +}); +} } @Component({ - selector: 'user-profile', - template: ` - +selector: 'user-profile', +template: ` Cheese Tomato diff --git a/adev/src/content/guide/components/selectors.md b/adev/src/content/guide/components/selectors.md index eb77b16a090c..b473b4d14a2e 100644 --- a/adev/src/content/guide/components/selectors.md +++ b/adev/src/content/guide/components/selectors.md @@ -118,8 +118,7 @@ prefix your components with `yt-`, with components like `yt-menu`, `yt-player`, your selectors like this makes it immediately clear where a particular component comes from. By default, the Angular CLI uses `app-`. -Angular uses the `ng` selector prefix for its own framework APIs. Never use `ng` as a selector -prefix for your own custom components. +IMPORTANT: Angular uses the `ng` selector prefix for its own framework APIs. Never use `ng` as a selector prefix for your own custom components. ### When to use an attribute selector diff --git a/adev/src/content/guide/components/styling.md b/adev/src/content/guide/components/styling.md index 25ea1bf87d20..25d69d54a330 100644 --- a/adev/src/content/guide/components/styling.md +++ b/adev/src/content/guide/components/styling.md @@ -36,7 +36,7 @@ and [stylus](https://stylus-lang.com). ## Style scoping Every component has a **view encapsulation** setting that determines how the framework scopes a -component's styles. There are four view encapsulation modes: `Emulated`, `ShadowDom`, `IsolatedShadowDom`, and `None`. +component's styles. There are three view encapsulation modes: `Emulated`, `ShadowDom`, and `None`. You can specify the mode in the `@Component` decorator: @@ -59,10 +59,11 @@ global styles defined outside of a component may still affect elements inside a emulated encapsulation. In emulated mode, Angular supports -the [`:host`](https://developer.mozilla.org/docs/Web/CSS/:host) -and [`:host-context()`](https://developer.mozilla.org/docs/Web/CSS/:host-context) pseudo -classes without -using [Shadow DOM](https://developer.mozilla.org/docs/Web/Web_Components/Using_shadow_DOM). +the [`:host`](https://developer.mozilla.org/docs/Web/CSS/:host) pseudo-class. +While the [`:host-context()`](https://developer.mozilla.org/docs/Web/CSS/:host-context) pseudo-class +is deprecated in modern browsers, Angular's compiler provides full support for it. Both pseudo-classes +can be used without relying on native +[Shadow DOM](https://developer.mozilla.org/docs/Web/Web_Components/Using_shadow_DOM). During compilation, the framework transforms these pseudo classes into attributes so it doesn't comply with these native pseudo classes' rules at runtime (e.g. browser compatibility, specificity). Angular's emulated encapsulation mode does not support any other pseudo classes related to Shadow DOM, such @@ -82,7 +83,9 @@ using [the web standard Shadow DOM API](https://developer.mozilla.org/docs/Web/W When enabling this mode, Angular attaches a shadow root to the component's host element and renders the component's template and styles into the corresponding shadow tree. -Styles inside the shadow tree cannot affect elements outside of that shadow tree. +This mode strictly guarantees that _only_ that component's styles apply to elements in the +component's template. Global styles cannot affect elements in a shadow tree and styles inside the +shadow tree cannot affect elements outside of that shadow tree. Enabling `ShadowDom` encapsulation, however, impacts more than style scoping. Rendering the component in a shadow tree affects event propagation, interaction @@ -90,12 +93,6 @@ with [the `` API](https://developer.mozilla.org/docs/Web/Web_Components/Us and how browser developer tools show elements. Always understand the full implications of using Shadow DOM in your application before enabling this option. -### ViewEncapsulation.IsolatedShadowDom - -Behaves as above, except this mode strictly guarantees that _only_ that component's styles apply to elements in the -component's template. Global styles cannot affect elements in a shadow tree and styles inside the -shadow tree cannot affect elements outside of that shadow tree. - ### ViewEncapsulation.None This mode disables all style encapsulation for the component. Any styles associated with the @@ -118,4 +115,4 @@ use [the `` element](https://developer.mozilla.org/docs/Web/HTML/Element/l reference CSS files. Additionally, your CSS may use [the `@import`at-rule](https://developer.mozilla.org/docs/Web/CSS/@import) to reference CSS files. Angular treats these references as _external_ styles. External styles are not affected by -emulated view encapsulation. \ No newline at end of file +emulated view encapsulation. diff --git a/adev/src/content/guide/di/BUILD.bazel b/adev/src/content/guide/di/BUILD.bazel index ece84845336c..fd7c2fada68b 100644 --- a/adev/src/content/guide/di/BUILD.bazel +++ b/adev/src/content/guide/di/BUILD.bazel @@ -6,6 +6,8 @@ generate_guides( srcs = glob([ "*.md", ]), + api_manifest = + "//adev/src/assets:docs_api_manifest", data = [ "//adev/src/assets/images:dependency_injection.svg", "//adev/src/content/examples", diff --git a/adev/src/content/guide/di/creating-and-using-services.md b/adev/src/content/guide/di/creating-and-using-services.md new file mode 100644 index 000000000000..f8df5139a9b4 --- /dev/null +++ b/adev/src/content/guide/di/creating-and-using-services.md @@ -0,0 +1,105 @@ +# Creating and using services + +Services are reusable pieces of code that can be shared across your Angular application. They typically handle data fetching, business logic, or other functionality that multiple components need to access. + +## Creating a service + +You can create a service with the [Angular CLI](tools/cli) with the following command: + +```bash +ng generate service CUSTOM_NAME +``` + +This creates a dedicated `CUSTOM_NAME.ts` file in your `src` directory. + +You can also manually create a service by adding the `@Injectable()` decorator to a TypeScript class. This tells Angular that the service can be injected as a dependency. + +Here is an example of a service that allows users to add and request data: + +```ts +// 📄 src/app/basic-data-store.ts +import { Injectable } from '@angular/core'; + +@Injectable({ providedIn: 'root' }) +export class BasicDataStore { + private data: string[] = [] + + addData(item: string): void { + this.data.push(item) + } + + getData(): string[] { + return [...this.data] + } +} +``` + +## How services become available + +When you use `@Injectable({ providedIn: 'root' })` in your service, Angular: + +- **Creates a single instance** (singleton) for your entire application +- **Makes it available everywhere** without any additional configuration +- **Enables tree-shaking** so the service is only included in your JavaScript bundle if it's actually used + +This is the recommended approach for most services. + +## Injecting a service + +Once you've created a service with `providedIn: 'root'`, you can inject it anywhere in your application using the `inject()` function from `@angular/core`. + +### Injecting into a component + +```angular-ts +import { Component, inject } from '@angular/core'; +import { BasicDataStore } from './basic-data-store'; + +@Component({ + selector: 'app-example', + template: ` +
+

{{ dataStore.getData() }}

+ +
+ ` +}) +export class ExampleComponent { + dataStore = inject(BasicDataStore); +} +``` + +### Injecting into another service + +```ts +import { inject, Injectable } from '@angular/core'; +import { AdvancedDataStore } from './advanced-data-store'; + +@Injectable({ + providedIn: 'root', +}) +export class BasicDataStore { + private advancedDataStore = inject(AdvancedDataStore); + private data: string[] = []; + + addData(item: string): void { + this.data.push(item); + } + + getData(): string[] { + return [...this.data, ...this.advancedDataStore.getData()]; + } +} +``` + +## Next steps + +While `providedIn: 'root'` covers most use cases, Angular offers additional ways to provide services for specialized scenarios: + +- **Component-specific instances** - When components need their own isolated service instances +- **Manual configuration** - For services that require runtime configuration +- **Factory providers** - For dynamic service creation based on runtime conditions +- **Value providers** - For providing configuration objects or constants + +You can learn more about these advanced patterns in the next guide: [defining dependency providers](/guide/di/defining-dependency-providers). diff --git a/adev/src/content/guide/di/creating-injectable-service.md b/adev/src/content/guide/di/creating-injectable-service.md index ebe5b6a592a0..e90000c5d425 100644 --- a/adev/src/content/guide/di/creating-injectable-service.md +++ b/adev/src/content/guide/di/creating-injectable-service.md @@ -21,7 +21,7 @@ Angular helps you follow these principles by making it easy to factor your appli Here's an example of a service class that logs to the browser console: - + export class Logger { log(msg: unknown) { console.log(msg); } error(msg: unknown) { console.error(msg); } @@ -33,27 +33,27 @@ Services can depend on other services. For example, here's a `HeroService` that depends on the `Logger` service, and also uses `BackendService` to get heroes. That service in turn might depend on the `HttpClient` service to fetch heroes asynchronously from a server: - import { inject } from "@angular/core"; export class HeroService { - private heroes: Hero[] = []; - - private backend = inject(BackendService); - private logger = inject(Logger); - - async getHeroes() { - // Fetch - this.heroes = await this.backend.getAll(Hero); - // Log - this.logger.log(`Fetched ${this.heroes.length} heroes.`); - return this.heroes; - } +private heroes: Hero[] = []; + +private backend = inject(BackendService); +private logger = inject(Logger); + +async getHeroes() { +// Fetch +this.heroes = await this.backend.getAll(Hero); +// Log +this.logger.log(`Fetched ${this.heroes.length} heroes.`); +return this.heroes; +} } -## Creating an injectable service +## Creating an injectable service with the CLI The Angular CLI provides a command to create a new service. In the following example, you add a new service to an existing application. @@ -67,11 +67,11 @@ ng generate service heroes/hero This command creates the following default `HeroService`: - + import { Injectable } from '@angular/core'; @Injectable({ - providedIn: 'root', +providedIn: 'root', }) export class HeroService {} @@ -81,19 +81,19 @@ The metadata, `providedIn: 'root'`, means that the `HeroService` is provided thr Add a `getHeroes()` method that returns the heroes from `mock.heroes.ts` to get the hero mock data: - + import { Injectable } from '@angular/core'; import { HEROES } from './mock-heroes'; @Injectable({ - // declares that this service should be created - // by the root application injector. - providedIn: 'root', +// declares that this service should be created +// by the root application injector. +providedIn: 'root', }) export class HeroService { - getHeroes() { - return HEROES; - } +getHeroes() { +return HEROES; +} } @@ -106,17 +106,17 @@ To inject a service as a dependency into a component, you can declare a class fi The following example specifies the `HeroService` in the `HeroListComponent`. The type of `heroService` is `HeroService`. - + import { inject } from "@angular/core"; export class HeroListComponent { - private heroService = inject(HeroService); +private heroService = inject(HeroService); } It is also possible to inject a service into a component using the component's constructor: - + constructor(private heroService: HeroService) @@ -127,22 +127,22 @@ The `inject` method can be used in both classes and functions, while the constru When a service depends on another service, follow the same pattern as injecting into a component. In the following example, `HeroService` depends on a `Logger` service to report its activities: - import { inject, Injectable } from '@angular/core'; import { HEROES } from './mock-heroes'; import { Logger } from '../logger.service'; @Injectable({ - providedIn: 'root', +providedIn: 'root', }) export class HeroService { - private logger = inject(Logger); +private logger = inject(Logger); - getHeroes() { - this.logger.log('Getting heroes.'); - return HEROES; - } +getHeroes() { +this.logger.log('Getting heroes.'); +return HEROES; +} } diff --git a/adev/src/content/guide/di/defining-dependency-providers.md b/adev/src/content/guide/di/defining-dependency-providers.md new file mode 100644 index 000000000000..3702715d59b6 --- /dev/null +++ b/adev/src/content/guide/di/defining-dependency-providers.md @@ -0,0 +1,923 @@ +# Defining dependency providers + +Angular provides two ways to make services available for injection: + +1. **Automatic provision** - Using `providedIn` in the `@Injectable` decorator or by providing a factory in the `InjectionToken` configuration +2. **Manual provision** - Using the `providers` array in components, directives, routes, or application config + +In the [previous guide](/guide/di/creating-and-using-services), you learned how to create services using `providedIn: 'root'`, which handles most common use cases. This guide explores additional patterns for both automatic and manual provider configuration. + +## Automatic provision for non-class dependencies + +While the `@Injectable` decorator with `providedIn: 'root'` works great for services (classes), you might need to provide other types of values globally - like configuration objects, functions, or primitive values. Angular provides `InjectionToken` for this purpose. + +### What is an InjectionToken? + +An `InjectionToken` is an object that Angular's dependency injection system uses to uniquely identify values for injection. Think of it as a special key that lets you store and retrieve any type of value in Angular's DI system: + +```ts +import { InjectionToken } from '@angular/core'; + +// Create a token for a string value +export const API_URL = new InjectionToken('api.url'); + +// Create a token for a function +export const LOGGER = new InjectionToken<(msg: string) => void>('logger.function'); + +// Create a token for a complex type +export interface Config { + apiUrl: string; + timeout: number; +} +export const CONFIG_TOKEN = new InjectionToken('app.config'); +``` + +NOTE: The string parameter (e.g., `'api.url'`) is a description purely for debugging — Angular identifies tokens by their object reference, not this string. + +### InjectionToken with `providedIn: 'root'` + +An `InjectionToken` that has a `factory` results in `providedIn: 'root'` by default (but can be overidden via the `providedIn` prop). + +```ts +// 📁 /app/config.token.ts +import { InjectionToken } from '@angular/core'; + +export interface AppConfig { + apiUrl: string; + version: string; + features: Record; +} + +// Globally available configuration using providedIn +export const APP_CONFIG = new InjectionToken('app.config', { + providedIn: 'root', + factory: () => ({ + apiUrl: 'https://api.example.com', + version: '1.0.0', + features: { + darkMode: true, + analytics: false + } + }) +}); + +// No need to add to providers array - available everywhere! +@Component({ + selector: 'app-header', + template: `

Version: {{ config.version }}

` +}) +export class HeaderComponent { + config = inject(APP_CONFIG); // Automatically available +} +``` + +### When to use InjectionToken with factory functions + +InjectionToken with factory functions is ideal when you can't use a class but need to provide dependencies globally: + +```ts +// 📁 /app/logger.token.ts +import { InjectionToken, inject } from '@angular/core'; +import { APP_CONFIG } from './config.token'; + +// Logger function type +export type LoggerFn = (level: string, message: string) => void; + +// Global logger function with dependencies +export const LOGGER_FN = new InjectionToken('logger.function', { + providedIn: 'root', + factory: () => { + const config = inject(APP_CONFIG); + + return (level: string, message: string) => { + if (config.features.logging !== false) { + console[level](`[${new Date().toISOString()}] ${message}`); + } + }; + } +}); + +// 📁 /app/storage.token.ts +// Providing browser APIs as tokens +export const LOCAL_STORAGE = new InjectionToken('localStorage', { + // providedIn: 'root' is configured as the default + factory: () => window.localStorage +}); + +export const SESSION_STORAGE = new InjectionToken('sessionStorage', { + providedIn: 'root', + factory: () => window.sessionStorage +}); + +// 📁 /app/feature-flags.token.ts +// Complex configuration with runtime logic +export const FEATURE_FLAGS = new InjectionToken>('feature.flags', { + providedIn: 'root', + factory: () => { + const flags = new Map(); + + // Parse from environment or URL params + const urlParams = new URLSearchParams(window.location.search); + const enableBeta = urlParams.get('beta') === 'true'; + + flags.set('betaFeatures', enableBeta); + flags.set('darkMode', true); + flags.set('newDashboard', false); + + return flags; + } +}); +``` + +This approach offers several advantages: + +- **No manual provider configuration needed** - Works just like `providedIn: 'root'` for services +- **Tree-shakeable** - Only included if actually used +- **Type-safe** - Full TypeScript support for non-class values +- **Can inject other dependencies** - Factory functions can use `inject()` to access other services + +## Understanding manual provider configuration + +When you need more control than `providedIn: 'root'` offers, you can manually configure providers. Manual configuration through the `providers` array is useful when: + +1. **The service doesn't have `providedIn`** - Services without automatic provision must be manually provided +2. **You want a new instance** - To create a separate instance at the component/directive level instead of using the shared one +3. **You need runtime configuration** - When service behavior depends on runtime values +4. **You're providing non-class values** - Configuration objects, functions, or primitive values + +### Example: Service without `providedIn` + +```ts +import { Injectable, Component, inject } from '@angular/core'; + +// Service without providedIn +@Injectable() +export class LocalDataStore { + private data: string[] = []; + + addData(item: string) { + this.data.push(item); + } +} + +// Component must provide it +@Component({ + selector: 'app-example', + // A provider is required here because the `LocalDataStore` service has no providedIn. + providers: [LocalDataStore], + template: `...` +}) +export class ExampleComponent { + dataStore = inject(LocalDataStore); +} +``` + +### Example: Creating component-specific instances + +Services with `providedIn: 'root'` can be overridden at the component level. This ties the instance of the service to the life of a component. As a result, when the component gets destroyed, the provided service is also destroyed as well. + +```ts +import { Injectable, Component, inject } from '@angular/core'; + +@Injectable({ providedIn: 'root' }) +export class DataStore { + private data: ListItem[] = []; +} + +// This component gets its own instance +@Component({ + selector: 'app-isolated', + // Creates new instance of `DataStore` rather than using the root-provided instance. + providers: [DataStore], + template: `...` +}) +export class IsolatedComponent { + dataStore = inject(DataStore); // Component-specific instance +} +``` + +## Injector hierarchy in Angular + +Angular's dependency injection system is hierarchical. When a component requests a dependency, Angular starts with that component's injector and walks up the tree until it finds a provider for that dependency. Each component in your application tree can have its own injector, and these injectors form a hierarchy that mirrors your component tree. + +This hierarchy enables: + +- **Scoped instances**: Different parts of your app can have different instances of the same service +- **Override behavior**: Child components can override providers from parent components +- **Memory efficiency**: Services are only instantiated where needed + +In Angular, any element with a component or directive can provide values to all of its descendants. + +```mermaid +graph TD + subgraph platform + subgraph root + direction TB + A[SocialApp] --> B[UserProfile] + A --> C[FriendList] + C --> D[FriendEntry] + end + end +``` + +In the example above: + +1. `SocialApp` can provide values for `UserProfile` and `FriendList` +2. `FriendList` can provide values for injection to `FriendEntry`, but cannot provide values for injection in `UserProfile` because it's not part of the tree + +## Declaring a provider + +Think of Angular's dependency injection system as a hash map or dictionary. Each provider configuration object defines a key-value pair: + +- **Key (Provider identifier)**: The unique identifier you use to request a dependency +- **Value**: What Angular should return when that token is requested + +When manually providing dependencies, you typically see this shorthand syntax: + +```angular-ts +import { Component } from '@angular/core'; +import { LocalService } from './local-service'; + +@Component({ + selector: 'app-example', + providers: [LocalService] // Service without providedIn +}) +export class ExampleComponent { } +``` + +This is actually a shorthand for a more detailed provider configuration: + +```ts +{ + // This is the shorthand version + providers: [LocalService], + + // This is the full version + providers: [ + { provide: LocalService, useClass: LocalService } + ] +} +``` + +### Provider configuration object + +Every provider configuration object has two primary parts: + +1. **Provider identifier**: The unique key that Angular uses to get the dependency (set via the `provide` property) +2. **Value**: The actual dependency that you want Angular to fetch, configured with different keys based on the desired type: + - `useClass` - Provides a JavaScript class + - `useValue` - Provides a static value + - `useFactory` - Provides a factory function that returns the value + - `useExisting` - Provides an alias to an existing provider + +### Provider identifiers + +Provider identifiers allow Angular's dependency injection (DI) system to retrieve a dependency through a unique ID. You can generate provider identifiers in two ways: + +1. [Class names](#class-names) +2. [Injection tokens](#injection-tokens) + +#### Class names + +Class name use the imported class directly as the identifier: + +```angular-ts +import { Component } from '@angular/core'; +import { LocalService } from './local-service'; + +@Component({ + selector: 'app-example', + providers: [ + { provide: LocalService, useClass: LocalService } + ] +}) +export class ExampleComponent { /* ... */ } +``` + +The class serves as both the identifier and the implementation, which is why Angular provides the shorthand `providers: [LocalService]`. + +#### Injection tokens + +Angular provides a built-in [`InjectionToken`](api/core/InjectionToken) class that creates a unique object reference for injectable values or when you want to provide multiple implementations of the same interface. + +```ts +// 📁 /app/tokens.ts +import { InjectionToken } from '@angular/core'; +import { DataService } from './data-service.interface'; + +export const DATA_SERVICE_TOKEN = new InjectionToken('DataService'); +``` + +NOTE: The string `'DataService'` is a description used purely for debugging purposes. Angular identifies the token by its object reference, not this string. + +Use the token in your provider configuration: + +```angular-ts +import { Component, inject } from '@angular/core'; +import { LocalDataService } from './local-data-service'; +import { DATA_SERVICE_TOKEN } from './tokens'; + +@Component({ + selector: 'app-example', + providers: [ + { provide: DATA_SERVICE_TOKEN, useClass: LocalDataService } + ] +}) +export class ExampleComponent { + private dataService = inject(DATA_SERVICE_TOKEN); +} +``` + +#### Can TypeScript interfaces be identifiers for injection? + +TypeScript interfaces cannot be used for injection because they don't exist at runtime: + +```ts +// ❌ This won't work! +interface DataService { + getData(): string[]; +} + +// Interfaces disappear after TypeScript compilation +@Component({ + providers: [ + { provide: DataService, useClass: LocalDataService } // Error! + ] +}) +export class ExampleComponent { + private dataService = inject(DataService); // Error! +} + +// ✅ Use InjectionToken instead +export const DATA_SERVICE_TOKEN = new InjectionToken('DataService'); + +@Component({ + providers: [ + { provide: DATA_SERVICE_TOKEN, useClass: LocalDataService } + ] +}) +export class ExampleComponent { + private dataService = inject(DATA_SERVICE_TOKEN); // Works! +} +``` + +The InjectionToken provides a runtime value that Angular's DI system can use, while still maintaining type safety through TypeScript's generic type parameter. + +### Provider value types + +#### useClass + +`useClass` provides a JavaScript class as a dependency. This is the default when using the shorthand syntax: + +```ts +// Shorthand +providers: [DataService] + +// Full syntax +providers: [ + { provide: DataService, useClass: DataService } +] + +// Different implementation +providers: [ + { provide: DataService, useClass: MockDataService } +] + +// Conditional implementation +providers: [ + { + provide: StorageService, + useClass: environment.production ? CloudStorageService : LocalStorageService + } +] +``` + +#### Practical example: Logger substitution + +You can substitute implementations to extend functionality: + +```ts +import { Injectable, Component, inject } from '@angular/core'; + +// Base logger +@Injectable() +export class Logger { + log(message: string) { + console.log(message); + } +} + +// Enhanced logger with timestamp +@Injectable() +export class BetterLogger extends Logger { + override log(message: string) { + super.log(`[${new Date().toISOString()}] ${message}`); + } +} + +// Logger that includes user context +@Injectable() +export class EvenBetterLogger extends Logger { + private userService = inject(UserService); + + override log(message: string) { + const name = this.userService.user.name; + super.log(`Message to ${name}: ${message}`); + } +} + +// In your component +@Component({ + selector: 'app-example', + providers: [ + UserService, // EvenBetterLogger needs this + { provide: Logger, useClass: EvenBetterLogger } + ] +}) +export class ExampleComponent { + private logger = inject(Logger); // Gets EvenBetterLogger instance +} +``` + +#### useValue + +`useValue` provides any JavaScript data type as a static value: + +```ts +providers: [ + { provide: API_URL_TOKEN, useValue: 'https://api.example.com' }, + { provide: MAX_RETRIES_TOKEN, useValue: 3 }, + { provide: FEATURE_FLAGS_TOKEN, useValue: { darkMode: true, beta: false } } +] +``` + +IMPORTANT: TypeScript types and interfaces cannot serve as dependency values. They exist only at compile-time. + +#### Practical example: Application configuration + +A common use case for `useValue` is providing application configuration: + +```ts +// Define configuration interface +export interface AppConfig { + apiUrl: string; + appTitle: string; + features: { + darkMode: boolean; + analytics: boolean; + }; +} + +// Create injection token +export const APP_CONFIG = new InjectionToken('app.config'); + +// Define configuration +const appConfig: AppConfig = { + apiUrl: 'https://api.example.com', + appTitle: 'My Application', + features: { + darkMode: true, + analytics: false + } +}; + +// Provide in bootstrap +bootstrapApplication(AppComponent, { + providers: [ + { provide: APP_CONFIG, useValue: appConfig } + ] +}); + +// Use in component +@Component({ + selector: 'app-header', + template: `

{{ title }}

` +}) +export class HeaderComponent { + private config = inject(APP_CONFIG); + title = this.config.appTitle; +} +``` + +#### useFactory + +`useFactory` provides a function that generates a new value for injection: + +```ts +export const loggerFactory = (config: AppConfig) => { + return new LoggerService(config.logLevel, config.endpoint); +}; + +providers: [ + { + provide: LoggerService, + useFactory: loggerFactory, + deps: [APP_CONFIG] // Dependencies for the factory function + } +] +``` + +You can mark factory dependencies as optional: + +```ts +import { Optional } from '@angular/core'; + +providers: [ + { + provide: MyService, + useFactory: (required: RequiredService, optional?: OptionalService) => { + return new MyService(required, optional || new DefaultService()); + }, + deps: [RequiredService, [new Optional(), OptionalService]] + } +] +``` + +#### Practical example: Configuration-based API client + +Here's a complete example showing how to use a factory to create a service with runtime configuration: + +```ts +// Service that needs runtime configuration +class ApiClient { + constructor( + private http: HttpClient, + private baseUrl: string, + private rateLimitMs: number + ) {} + + async fetchData(endpoint: string) { + // Apply rate limiting based on user tier + await this.applyRateLimit(); + return this.http.get(`${this.baseUrl}/${endpoint}`); + } + + private async applyRateLimit() { + // Simplified example - real implementation would track request timing + return new Promise(resolve => setTimeout(resolve, this.rateLimitMs)); + } +} + +// Factory function that configures based on user tier +import { inject } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +const apiClientFactory = () => { + const http = inject(HttpClient); + const userService = inject(UserService); + + // Assuming userService provides these values + const baseUrl = userService.getApiBaseUrl(); + const rateLimitMs = userService.getRateLimit(); + + return new ApiClient(http, baseUrl, rateLimitMs); +}; + +// Provider configuration +export const apiClientProvider = { + provide: ApiClient, + useFactory: apiClientFactory +}; + +// Usage in component +@Component({ + selector: 'app-dashboard', + providers: [apiClientProvider] +}) +export class DashboardComponent { + private apiClient = inject(ApiClient); +} +``` + +#### useExisting + +`useExisting` creates an alias for a provider that was already defined. Both tokens return the same instance: + +```ts +providers: [ + NewLogger, // The actual service + { provide: OldLogger, useExisting: NewLogger } // The alias +] +``` + +IMPORTANT: Don't confuse `useExisting` with `useClass`. `useClass` creates separate instances, while `useExisting` ensures you get the same singleton instance. + +### Multiple providers + +Use the `multi: true` flag when multiple providers contribute values to the same token: + +```ts +export const INTERCEPTOR_TOKEN = new InjectionToken('interceptors'); + +providers: [ + { provide: INTERCEPTOR_TOKEN, useClass: AuthInterceptor, multi: true }, + { provide: INTERCEPTOR_TOKEN, useClass: LoggingInterceptor, multi: true }, + { provide: INTERCEPTOR_TOKEN, useClass: RetryInterceptor, multi: true } +] +``` + +When you inject `INTERCEPTOR_TOKEN`, you'll receive an array containing instances of all three interceptors. + +## Where can you specify providers? + +Angular offers several levels where you can register providers, each with different implications for scope, lifecycle, and performance: + +- [**Application bootstrap**](#application-bootstrap) - Global singletons available everywhere +- [**On an element (component or directive)**](#component-or-directive-providers) - Isolated instances for specific component trees +- [**Route**](#route-providers) - Feature-specific services for lazy-loaded modules + +### Application bootstrap + +Use application-level providers in `bootstrapApplication` when: + +- **The service is used across multiple feature areas** - Services like HTTP clients, logging, or authentication that many parts of your app need +- **You want a true singleton** - One instance shared by the entire application +- **The service has no component-specific configuration** - General-purpose utilities that work the same everywhere +- **You're providing global configuration** - API endpoints, feature flags, or environment settings + +```ts +// main.ts +bootstrapApplication(AppComponent, { + providers: [ + { provide: API_BASE_URL, useValue: 'https://api.example.com' }, + { provide: INTERCEPTOR_TOKEN, useClass: AuthInterceptor, multi: true }, + LoggingService, // Used throughout the app + { provide: ErrorHandler, useClass: GlobalErrorHandler } + ] +}); +``` + +**Benefits:** + +- Single instance reduces memory usage +- Available everywhere without additional setup +- Easier to manage global state + +**Drawbacks:** + +- Always included in your JavaScript bundle, even if the value is never injected +- Cannot be easily customized per feature +- Harder to test individual components in isolation + +#### Why provide during bootstrap instead of using `providedIn: 'root'`? + +You might want a provider during bootstrap when: + +- The provider has side-effects (e.g., installing the client-side router) +- The provider requires configuration (e.g., routes) +- You're using Angular's `provideSomething` pattern (e.g., `provideRouter`, `provideHttpClient`) + +### Component or directive providers + +Use component or directive providers when: + +- **The service has component-specific state** - Form validators, component-specific caches, or UI state managers +- **You need isolated instances** - Each component needs its own copy of the service +- **The service is only used by one component tree** - Specialized services that don't need global access +- **You're creating reusable components** - Components that should work independently with their own services + +```angular-ts +// Specialized form component with its own validation service +@Component({ + selector: 'app-advanced-form', + providers: [ + FormValidationService, // Each form gets its own validator + { provide: FORM_CONFIG, useValue: { strictMode: true } } + ] +}) +export class AdvancedFormComponent { } + +// Modal component with isolated state management +@Component({ + selector: 'app-modal', + providers: [ + ModalStateService // Each modal manages its own state + ] +}) +export class ModalComponent { } +``` + +**Benefits:** + +- Better encapsulation and isolation +- Easier to test components individually +- Multiple instances can coexist with different configurations + +**Drawbacks:** + +- New instance created for each component (higher memory usage) +- No shared state between components +- Must be provided wherever needed +- Always included in the same JavaScript bundle as the component or directive, even if the value is never injected + +NOTE: If multiple directives on the same element provide the same token, one will win, but which one is undefined. + +### Route providers + +Use route-level providers for: + +- **Feature-specific services** - Services only needed for particular routes or feature modules +- **Lazy-loaded module dependencies** - Services that should only load with specific features +- **Route-specific configuration** - Settings that vary by application area + +```ts +// routes.ts +export const routes: Routes = [ + { + path: 'admin', + providers: [ + AdminService, // Only loaded with admin routes + { provide: FEATURE_FLAGS, useValue: { adminMode: true } } + ], + loadChildren: () => import('./admin/admin.routes') + }, + { + path: 'shop', + providers: [ + ShoppingCartService, // Isolated shopping state + PaymentService + ], + loadChildren: () => import('./shop/shop.routes') + } +]; +``` + +## Library author patterns + +When creating Angular libraries, you often need to provide flexible configuration options for consumers while maintaining clean APIs. Angular's own libraries demonstrate powerful patterns for achieving this. + +### The `provide` pattern + +Instead of requiring users to manually configure complex providers, library authors can export functions that return provider configurations: + +```ts +// 📁 /libs/analytics/src/providers.ts +import { InjectionToken, Provider, inject } from '@angular/core'; + +// Configuration interface +export interface AnalyticsConfig { + trackingId: string; + enableDebugMode?: boolean; + anonymizeIp?: boolean; +} + +// Internal token for configuration +const ANALYTICS_CONFIG = new InjectionToken('analytics.config'); + +// Main service that uses the configuration +export class AnalyticsService { + private config = inject(ANALYTICS_CONFIG); + + track(event: string, properties?: any) { + // Implementation using config + } +} + +// Provider function for consumers +export function provideAnalytics(config: AnalyticsConfig): Provider[] { + return [ + { provide: ANALYTICS_CONFIG, useValue: config }, + AnalyticsService + ]; +} + +// Usage in consumer app +// main.ts +bootstrapApplication(AppComponent, { + providers: [ + provideAnalytics({ + trackingId: 'GA-12345', + enableDebugMode: !environment.production + }) + ] +}); +``` + +### Advanced provider patterns with options + +For more complex scenarios, you can combine multiple configuration approaches: + +```ts +// 📁 /libs/http-client/src/provider.ts +import { Provider, InjectionToken, inject } from '@angular/core'; + +// Feature flags for optional functionality +export enum HttpFeatures { + Interceptors = 'interceptors', + Caching = 'caching', + Retry = 'retry' +} + +// Configuration interfaces +export interface HttpConfig { + baseUrl?: string; + timeout?: number; + headers?: Record; +} + +export interface RetryConfig { + maxAttempts: number; + delayMs: number; +} + +// Internal tokens +const HTTP_CONFIG = new InjectionToken('http.config'); +const RETRY_CONFIG = new InjectionToken('retry.config'); +const HTTP_FEATURES = new InjectionToken>('http.features'); + +// Core service +class HttpClientService { + private config = inject(HTTP_CONFIG, { optional: true }); + private features = inject(HTTP_FEATURES); + + get(url: string) { + // Use config and check features + } +} + +// Feature services +class RetryInterceptor { + private config = inject(RETRY_CONFIG); + // Retry logic +} + +class CacheInterceptor { + // Caching logic +} + +// Main provider function +export function provideHttpClient( + config?: HttpConfig, + ...features: HttpFeature[] +): Provider[] { + const providers: Provider[] = [ + { provide: HTTP_CONFIG, useValue: config || {} }, + { provide: HTTP_FEATURES, useValue: new Set(features.map(f => f.kind)) }, + HttpClientService + ]; + + // Add feature-specific providers + features.forEach(feature => { + providers.push(...feature.providers); + }); + + return providers; +} + +// Feature configuration functions +export interface HttpFeature { + kind: HttpFeatures; + providers: Provider[]; +} + +export function withInterceptors(...interceptors: any[]): HttpFeature { + return { + kind: HttpFeatures.Interceptors, + providers: interceptors.map(interceptor => ({ + provide: INTERCEPTOR_TOKEN, + useClass: interceptor, + multi: true + })) + }; +} + +export function withCaching(): HttpFeature { + return { + kind: HttpFeatures.Caching, + providers: [CacheInterceptor] + }; +} + +export function withRetry(config: RetryConfig): HttpFeature { + return { + kind: HttpFeatures.Retry, + providers: [ + { provide: RETRY_CONFIG, useValue: config }, + RetryInterceptor + ] + }; +} + +// Consumer usage with multiple features +bootstrapApplication(AppComponent, { + providers: [ + provideHttpClient( + { baseUrl: 'https://api.example.com' }, + withInterceptors(AuthInterceptor, LoggingInterceptor), + withCaching(), + withRetry({ maxAttempts: 3, delayMs: 1000 }) + ) + ] +}); +``` + +### Why use provider functions instead of direct configuration? + +Provider functions offer several advantages for library authors: + +1. **Encapsulation** - Internal tokens and implementation details remain private +2. **Type safety** - TypeScript ensures correct configuration at compile time +3. **Flexibility** - Easily compose features with `with*` pattern +4. **Future-proofing** - Internal implementation can change without breaking consumers +5. **Consistency** - Aligns with Angular's own patterns (`provideRouter`, `provideHttpClient`, etc.) + +This pattern is extensively used in Angular's own libraries and is considered a best practice for library authors who need to provide configurable services. diff --git a/adev/src/content/guide/di/dependency-injection-context.md b/adev/src/content/guide/di/dependency-injection-context.md index b242b87d2c80..0254fe7a70b5 100644 --- a/adev/src/content/guide/di/dependency-injection-context.md +++ b/adev/src/content/guide/di/dependency-injection-context.md @@ -1,32 +1,20 @@ # Injection context The dependency injection (DI) system relies internally on a runtime context where the current injector is available. + This means that injectors can only work when code is executed in such a context. The injection context is available in these situations: -* During construction (via the `constructor`) of a class being instantiated by the DI system, such as an `@Injectable` or `@Component`. -* In the initializer for fields of such classes. -* In the factory function specified for `useFactory` of a `Provider` or an `@Injectable`. -* In the `factory` function specified for an `InjectionToken`. -* Within a stack frame that runs in an injection context. +- During construction (via the `constructor`) of a class being instantiated by the DI system, such as an `@Injectable` or `@Component`. +- In the initializer for fields of such classes. +- In the factory function specified for `useFactory` of a `Provider` or an `@Injectable`. +- In the `factory` function specified for an `InjectionToken`. +- Within a stack frame that runs in an injection context. Knowing when you are in an injection context will allow you to use the [`inject`](api/core/inject) function to inject instances. -## Class constructors - -Every time the DI system instantiates a class, it does so in an injection context. This is handled by the framework itself. The constructor of the class is executed in that runtime context, which also allows injection of a token using the [`inject`](api/core/inject) function. - - -class MyComponent { - private service1: Service1; - private service2: Service2 = inject(Service2); // In context - - constructor() { - this.service1 = inject(Service1) // In context - } -} - +NOTE: For basic examples of using `inject()` in class constructors and field initializers, see the [overview guide](guide/di/overview#where-can-inject-be-used). ## Stack frame in context @@ -66,7 +54,32 @@ Note that `inject` will return an instance only if the injector can resolve the ## Asserts the context -Angular provides the `assertInInjectionContext` helper function to assert that the current context is an injection context. +Angular provides the `assertInInjectionContext` helper function to assert that the current context is an injection context and throws a clear error if not. Pass a reference to the calling function so the error message points to the correct API entry point. This produces a clearer, more actionable message than the default generic injection error. + +```ts +import { ElementRef, assertInInjectionContext, inject } from '@angular/core'; + +export function injectNativeElement(): T { + assertInInjectionContext(injectNativeElement); + return inject(ElementRef).nativeElement; +} +``` + +You can then call this helper **from an injection context** (constructor, field initializer, provider factory, or code executed via `runInInjectionContext`): + +```ts +import { Component, inject } from '@angular/core'; +import { injectNativeElement } from './dom-helpers'; + +@Component({ /* … */ }) +export class PreviewCard { + readonly hostEl = injectNativeElement(); // Field initializer runs in an injection context. + + onAction() { + const anotherRef = injectNativeElement(); // Fails: runs outside an injection context. + } +} +``` ## Using DI outside of a context diff --git a/adev/src/content/guide/di/dependency-injection-providers.md b/adev/src/content/guide/di/dependency-injection-providers.md deleted file mode 100644 index cc51d1a682c0..000000000000 --- a/adev/src/content/guide/di/dependency-injection-providers.md +++ /dev/null @@ -1,212 +0,0 @@ -# Configuring dependency providers - -The previous sections described how to use class instances as dependencies. -Aside from classes, you can also use values such as `boolean`, `string`, `Date`, and objects as dependencies. -Angular provides the necessary APIs to make the dependency configuration flexible, so you can make those values available in DI. - -## Specifying a provider token - -If you specify the service class as the provider token, the default behavior is for the injector to instantiate that class using the `new` operator. - -In the following example, the app component provides a `Logger` instance: - - -providers: [Logger], - - -You can, however, configure DI to associate the `Logger` provider token with a different class or any other value. -So when the `Logger` is injected, the configured value is used instead. - -In fact, the class provider syntax is a shorthand expression that expands into a provider configuration, defined by the `Provider` interface. -Angular expands the `providers` value in this case into a full provider object as follows: - - -[{ provide: Logger, useClass: Logger }] - - -The expanded provider configuration is an object literal with two properties: - -- The `provide` property holds the token that serves as the key for consuming the dependency value. -- The second property is a provider definition object, which tells the injector **how** to create the dependency value. The provider-definition can be one of the following: - - `useClass` - this option tells Angular DI to instantiate a provided class when a dependency is injected - - `useExisting` - allows you to alias a token and reference any existing one. - - `useFactory` - allows you to define a function that constructs a dependency. - - `useValue` - provides a static value that should be used as a dependency. - -The sections below describe how to use the different provider definitions. - -### Class providers: useClass - -The `useClass` provider key lets you create and return a new instance of the specified class. - -You can use this type of provider to substitute an alternative implementation for a common or default class. -The alternative implementation can, for example, implement a different strategy, extend the default class, or emulate the behavior of the real class in a test case. - -In the following example, `BetterLogger` would be instantiated when the `Logger` dependency is requested in a component or any other class: - - -[{ provide: Logger, useClass: BetterLogger }] - - -If the alternative class providers have their own dependencies, specify both providers in the providers metadata property of the parent module or component: - - -[ - UserService, // dependency needed in `EvenBetterLogger`. - { provide: Logger, useClass: EvenBetterLogger }, -] - - -In this example, `EvenBetterLogger` displays the user name in the log message. This logger gets the user from an injected `UserService` instance: - - -@Injectable() -export class EvenBetterLogger extends Logger { - private userService = inject(UserService); - - override log(message: string) { - const name = this.userService.user.name; - super.log(`Message to ${name}: ${message}`); - } -} - - -Angular DI knows how to construct the `UserService` dependency, since it has been configured above and is available in the injector. - -### Alias providers: useExisting - -The `useExisting` provider key lets you map one token to another. -In effect, the first token is an alias for the service associated with the second token, creating two ways to access the same service object. - -In the following example, the injector injects the singleton instance of `NewLogger` when the component asks for either the new or the old logger: -In this way, `OldLogger` is an alias for `NewLogger`. - - -[ - NewLogger, - // Alias OldLogger w/ reference to NewLogger - { provide: OldLogger, useExisting: NewLogger}, -] - - -NOTE: Ensure you do not alias `OldLogger` to `NewLogger` with `useClass`, as this creates two different `NewLogger` instances. - -### Factory providers: useFactory - -The `useFactory` provider key lets you create a dependency object by calling a factory function. -With this approach, you can create a dynamic value based on information available in the DI and elsewhere in the app. - -In the following example, only authorized users should see secret heroes in the `HeroService`. -Authorization can change during the course of a single application session, as when a different user logs in . - -To keep security-sensitive information in `UserService` and out of `HeroService`, give the `HeroService` constructor a boolean flag to control display of secret heroes: - - -class HeroService { - constructor( - private logger: Logger, - private isAuthorized: boolean) { } - - getHeroes() { - const auth = this.isAuthorized ? 'authorized' : 'unauthorized'; - this.logger.log(`Getting heroes for ${auth} user.`); - return HEROES.filter(hero => this.isAuthorized || !hero.isSecret); - } -} - - -To implement the `isAuthorized` flag, use a factory provider to create a new logger instance for `HeroService`. -This is necessary as we need to manually pass `Logger` when constructing the hero service: - - -const heroServiceFactory = (logger: Logger, userService: UserService) => - new HeroService(logger, userService.user.isAuthorized); - - -The factory function has access to `UserService`. -You inject both `Logger` and `UserService` into the factory provider so the injector can pass them along to the factory function: - - -export const heroServiceProvider = { - provide: HeroService, - useFactory: heroServiceFactory, - deps: [Logger, UserService] -}; - - -- The `useFactory` field specifies that the provider is a factory function whose implementation is `heroServiceFactory`. -- The `deps` property is an array of provider tokens. -The `Logger` and `UserService` classes serve as tokens for their own class providers. -The injector resolves these tokens and injects the corresponding services into the matching `heroServiceFactory` factory function parameters, based on the order specified. - -Capturing the factory provider in the exported variable, `heroServiceProvider`, makes the factory provider reusable. - -### Value providers: useValue - -The `useValue` key lets you associate a static value with a DI token. - -Use this technique to provide runtime configuration constants such as website base addresses and feature flags. -You can also use a value provider in a unit test to provide mock data in place of a production data service. - -The next section provides more information about the `useValue` key. - -## Using an `InjectionToken` object - -Use an `InjectionToken` object as provider token for non-class dependencies. -The following example defines a token, `APP_CONFIG`. of the type `InjectionToken`: - - -import { InjectionToken } from '@angular/core'; - -export interface AppConfig { - title: string; -} - -export const APP_CONFIG = new InjectionToken('app.config description'); - - -The optional type parameter, ``, and the token description, `app.config description`, specify the token's purpose. - -Next, register the dependency provider in the component using the `InjectionToken` object of `APP_CONFIG`: - - -const MY_APP_CONFIG_VARIABLE: AppConfig = { - title: 'Hello', -}; - -providers: [{ provide: APP_CONFIG, useValue: MY_APP_CONFIG_VARIABLE }] - - -Now, inject the configuration object in the constructor body with the `inject` function: - - -export class AppComponent { - constructor() { - const config = inject(APP_CONFIG); - this.title = config.title; - } -} - - -### Interfaces and DI - -Though the TypeScript `AppConfig` interface supports typing within the class, the `AppConfig` interface plays no role in DI. -In TypeScript, an interface is a design-time artifact, and does not have a runtime representation, or token, that the DI framework can use. - -When the TypeScript transpiles to JavaScript, the interface disappears because JavaScript doesn't have interfaces. -Because there is no interface for Angular to find at runtime, the interface cannot be a token, nor can you inject it: - - -// Can't use interface as provider token -[{ provide: AppConfig, useValue: MY_APP_CONFIG_VARIABLE })] - - - -export class AppComponent { - // Can't inject using the interface as the parameter type - private config = inject(AppConfig); -} - diff --git a/adev/src/content/guide/di/dependency-injection.md b/adev/src/content/guide/di/dependency-injection.md deleted file mode 100644 index 95558f91300f..000000000000 --- a/adev/src/content/guide/di/dependency-injection.md +++ /dev/null @@ -1,140 +0,0 @@ -# Understanding dependency injection - -Dependency injection, or DI, is one of the fundamental concepts in Angular. DI is wired into the Angular framework and allows classes with Angular decorators, such as Components, Directives, Pipes, and Injectables, to configure dependencies that they need. - -Two main roles exist in the DI system: dependency consumer and dependency provider. - -Angular facilitates the interaction between dependency consumers and dependency providers using an abstraction called `Injector`. When a dependency is requested, the injector checks its registry to see if there is an instance already available there. If not, a new instance is created and stored in the registry. Angular creates an application-wide injector (also known as the "root" injector) during the application bootstrap process. In most cases you don't need to manually create injectors, but you should know that there is a layer that connects providers and consumers. - -This topic covers basic scenarios of how a class can act as a dependency. Angular also allows you to use functions, objects, primitive types such as string or Boolean, or any other types as dependencies. For more information, see [Dependency providers](guide/di/dependency-injection-providers). - -## Providing a dependency - -Consider a class called `HeroService` that needs to act as a dependency in a component. - -The first step is to add the `@Injectable` decorator to show that the class can be injected. - - -@Injectable() -class HeroService {} - - -The next step is to make it available in the DI by providing it. -A dependency can be provided in multiple places: - -- [**Preferred**: At the application root level using `providedIn`](#preferred-at-the-application-root-level-using-providedin) -- [At the Component level](#at-the-component-level) -- [At the application root level using `ApplicationConfig`](#at-the-application-root-level-using-applicationconfig) -- [`NgModule` based applications](#ngmodule-based-applications) - -### **Preferred**: At the application root level using `providedIn` - -Providing a service at the application root level using `providedIn` allows injecting the service into all other classes. -Using `providedIn` enables Angular and JavaScript code optimizers to effectively remove services that are unused (known as tree-shaking). - -You can provide a service by using `providedIn: 'root'` in the `@Injectable` decorator: - - -@Injectable({ - providedIn: 'root' -}) -class HeroService {} - - -When you provide the service at the root level, Angular creates a single, shared instance of the `HeroService` and injects it into any class that asks for it. - -### At the Component level - -You can provide services at `@Component` level by using the `providers` field of the `@Component` decorator. -In this case the `HeroService` becomes available to all instances of this component and other components and directives used in the template. - -For example: - - -@Component({ - selector: 'hero-list', - template: '...', - providers: [HeroService] -}) -class HeroListComponent {} - - -When you register a provider at the component level, you get a new instance of the service with each new instance of that component. - -NOTE: Declaring a service like this causes `HeroService` to always be included in your application— even if the service is unused. - -### At the application root level using `ApplicationConfig` - -You can use the `providers` field of the `ApplicationConfig` (passed to the `bootstrapApplication` function) to provide a service or other `Injectable` at the application level. - -In the example below, the `HeroService` is available to all components, directives, and pipes: - - -export const appConfig: ApplicationConfig = { - providers: [ - { provide: HeroService }, - ] -}; - - -Then, in `main.ts`: - - -bootstrapApplication(AppComponent, appConfig) - - -NOTE: Declaring a service like this causes `HeroService` to always be included in your application— even if the service is unused. - -### `NgModule` based applications - -`@NgModule`-based applications use the `providers` field of the `@NgModule` decorator to provide a service or other `Injectable` available at the application level. - -A service provided in a module is available to all declarations of the module, or to any other modules which share the same `ModuleInjector`. -To understand all edge-cases, see [Hierarchical injectors](guide/di/hierarchical-dependency-injection). - -NOTE: Declaring a service using `providers` causes the service to be included in your application— even if the service is unused. - -## Injecting/consuming a dependency - -Use Angular's `inject` function to retrieve dependencies. - -```ts -import {inject, Component} from 'angular/core'; - -@Component({/* ... */}) -export class UserProfile { - // You can use the `inject` function in property initializers. - private userClient = inject(UserClient); - - constructor() { - // You can also use the `inject` function in a constructor. - const logger = inject(Logger); - } -} -``` - -You can use the `inject` function in any [injection context](guide/di/dependency-injection-context). Most of the time, this is in a class property initializer or a class constructor for components, directives, services, and pipes. - -When Angular discovers that a component depends on a service, it first checks if the injector has any existing instances of that service. If a requested service instance doesn't yet exist, the injector creates one using the registered provider, and adds it to the injector before returning the service to Angular. - -When all requested services have been resolved and returned, Angular can call the component's constructor with those services as arguments. - -```mermaid -graph TD; -subgraph Injector -serviceA[Service A] -heroService[HeroService] -serviceC[Service C] -serviceD[Service D] -end -direction TB -componentProperty["Component
heroService = inject(HeroService)"] -heroService-->componentProperty -style componentProperty text-align: left -``` - -## What's next - - - - diff --git a/adev/src/content/guide/di/di-in-action.md b/adev/src/content/guide/di/di-in-action.md index 4d1d3b6c7caa..cefb93787eee 100644 --- a/adev/src/content/guide/di/di-in-action.md +++ b/adev/src/content/guide/di/di-in-action.md @@ -2,40 +2,7 @@ This guide explores additional features of dependency injection in Angular. -## Custom providers with `@Inject` - -Using a custom provider allows you to provide a concrete implementation for implicit dependencies, such as built-in browser APIs. -The following example uses an `InjectionToken` to provide the [localStorage](https://developer.mozilla.org/docs/Web/API/Window/localStorage) browser API as a dependency in the `BrowserStorageService`: - - -import { Inject, Injectable, InjectionToken } from '@angular/core'; - -export const BROWSER_STORAGE = new InjectionToken('Browser Storage', { - providedIn: 'root', - factory: () => localStorage -}); - -@Injectable({ - providedIn: 'root' -}) -export class BrowserStorageService { - public storage = inject(BROWSER_STORAGE); - - get(key: string) { - return this.storage.getItem(key); - } - - set(key: string, value: string) { - this.storage.setItem(key, value); - } -} - - -The `factory` function returns the `localStorage` property that is attached to the browser's window object. -The `inject` function initializes the `storage` property with an instance of the token. - -This custom provider can now be overridden during testing with a mock API of `localStorage` instead of interacting with real browser APIs. +NOTE: For comprehensive coverage of InjectionToken and custom providers, see the [defining dependency providers guide](guide/di/defining-dependency-providers#injection-tokens). ## Inject the component's DOM element @@ -48,14 +15,14 @@ Angular exposes the underlying element of a `@Component` or `@Directive` via inj import { Directive, ElementRef } from '@angular/core'; @Directive({ - selector: '[appHighlight]' +selector: '[appHighlight]' }) export class HighlightDirective { - private element = inject(ElementRef) +private element = inject(ElementRef) - update() { - this.element.nativeElement.style.color = 'red'; - } +update() { +this.element.nativeElement.style.color = 'red'; +} }
@@ -64,13 +31,13 @@ export class HighlightDirective { The order of class declaration matters in TypeScript. You can't refer directly to a class until it's been defined. -This isn't usually a problem, especially if you adhere to the recommended *one class per file* rule. +This isn't usually a problem, especially if you adhere to the recommended _one class per file_ rule. But sometimes circular references are unavoidable. For example, when class 'A' refers to class 'B' and 'B' refers to 'A', one of them has to be defined first. -The Angular `forwardRef()` function creates an *indirect* reference that Angular can resolve later. +The Angular `forwardRef()` function creates an _indirect_ reference that Angular can resolve later. -You face a similar problem when a class makes *a reference to itself*. +You face a similar problem when a class makes _a reference to itself_. For example, in its `providers` array. The `providers` array is a property of the `@Component()` decorator function, which must appear before the class definition. You can break such circular references by using `forwardRef`. diff --git a/adev/src/content/guide/di/hierarchical-dependency-injection.md b/adev/src/content/guide/di/hierarchical-dependency-injection.md index 5cceb0196e5c..e746a604469a 100644 --- a/adev/src/content/guide/di/hierarchical-dependency-injection.md +++ b/adev/src/content/guide/di/hierarchical-dependency-injection.md @@ -1,23 +1,17 @@ # Hierarchical injectors -Injectors in Angular have rules that you can leverage to achieve the desired visibility of injectables in your applications. -By understanding these rules, you can determine whether to declare a provider at the application level, in a Component, or in a Directive. +This guide provides in-depth coverage of Angular's hierarchical dependency injection system, including resolution rules, modifiers, and advanced patterns. -The applications you build with Angular can become quite large, and one way to manage this complexity is to split up the application into a well-defined tree of components. - -There can be sections of your page that work in a completely independent way than the rest of the application, with its own local copies of the services and other dependencies that it needs. -Some of the services that these sections of the application use might be shared with other parts of the application, or with parent components that are further up in the component tree, while other dependencies are meant to be private. - -With hierarchical dependency injection, you can isolate sections of the application and give them their own private dependencies not shared with the rest of the application, or have parent components share certain dependencies with its child components only but not with the rest of the component tree, and so on. Hierarchical dependency injection enables you to share dependencies between different parts of the application only when and if you need to. +NOTE: For basic concepts about injector hierarchy and provider scoping, see the [defining dependency providers guide](guide/di/defining-dependency-providers#injector-hierarchy-in-angular). ## Types of injector hierarchies Angular has two injector hierarchies: -| Injector hierarchies | Details | -|:--- |:--- | -| `EnvironmentInjector` hierarchy | Configure an `EnvironmentInjector` in this hierarchy using `@Injectable()` or `providers` array in `ApplicationConfig`. | -| `ElementInjector` hierarchy | Created implicitly at each DOM element. An `ElementInjector` is empty by default unless you configure it in the `providers` property on `@Directive()` or `@Component()`. | +| Injector hierarchies | Details | +| :------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `EnvironmentInjector` hierarchy | Configure an `EnvironmentInjector` in this hierarchy using `@Injectable()` or `providers` array in `ApplicationConfig`. | +| `ElementInjector` hierarchy | Created implicitly at each DOM element. An `ElementInjector` is empty by default unless you configure it in the `providers` property on `@Directive()` or `@Component()`. | For `NgModule` based applications, you can provide dependencies with the `ModuleInjector` hierarchy using an `@NgModule()` or `@Injectable()` annotation. @@ -27,8 +21,8 @@ For `NgModule` based applications, you can provide dependencies with the `Module The `EnvironmentInjector` can be configured in one of two ways by using: -* The `@Injectable()` `providedIn` property to refer to `root` or `platform` -* The `ApplicationConfig` `providers` array +- The `@Injectable()` `providedIn` property to refer to `root` or `platform` +- The `ApplicationConfig` `providers` array @@ -46,10 +40,10 @@ Provide services using `providedIn` of `@Injectable()` as follows: import { Injectable } from '@angular/core'; @Injectable({ - providedIn: 'root' // <--provides this service in the root EnvironmentInjector +providedIn: 'root' // <--provides this service in the root EnvironmentInjector }) export class ItemService { - name = 'telephone'; +name = 'telephone'; }
@@ -61,8 +55,8 @@ The `providedIn` property configures a specific `EnvironmentInjector`, here `roo In the case of `NgModule` based applications, the ModuleInjector can be configured in one of two ways by using: -* The `@Injectable()` `providedIn` property to refer to `root` or `platform` -* The `@NgModule()` `providers` array +- The `@Injectable()` `providedIn` property to refer to `root` or `platform` +- The `@NgModule()` `providers` array `ModuleInjector` is configured by the `@NgModule.providers` and `NgModule.imports` property. `ModuleInjector` is a flattening of all the providers arrays that can be reached by following the `NgModule.imports` recursively. @@ -184,17 +178,17 @@ Import each of them from `@angular/core` and use each in the `inject` configurat Resolution modifiers fall into three categories: -* What to do if Angular doesn't find what you're looking for, that is `optional` -* Where to start looking, that is `skipSelf` -* Where to stop looking, `host` and `self` +- What to do if Angular doesn't find what you're looking for, that is `optional` +- Where to start looking, that is `skipSelf` +- Where to stop looking, `host` and `self` By default, Angular always starts at the current `Injector` and keeps searching all the way up. Modifiers allow you to change the starting, or _self_, location and the ending location. Additionally, you can combine all of the modifiers except: -* `host` and `self` -* `skipSelf` and `self`. +- `host` and `self` +- `skipSelf` and `self`. ### `optional` @@ -220,12 +214,12 @@ For example, in the following `SelfNoDataComponent`, notice the injected `LeafSe @Component({ - selector: 'app-self-no-data', - templateUrl: './self-no-data.component.html', - styleUrls: ['./self-no-data.component.css'] +selector: 'app-self-no-data', +templateUrl: './self-no-data.component.html', +styleUrls: ['./self-no-data.component.css'] }) export class SelfNoDataComponent { - public leaf = inject(LeafService, {optional: true, self: true}); +public leaf = inject(LeafService, {optional: true, self: true}); } @@ -256,15 +250,15 @@ This is when you'd use `skipSelf`: @Component({ - selector: 'app-skipself', - templateUrl: './skipself.component.html', - styleUrls: ['./skipself.component.css'], - // Angular would ignore this LeafService instance - providers: [{ provide: LeafService, useValue: { emoji: '🍁' } }] +selector: 'app-skipself', +templateUrl: './skipself.component.html', +styleUrls: ['./skipself.component.css'], +// Angular would ignore this LeafService instance +providers: [{ provide: LeafService, useValue: { emoji: '🍁' } }] }) export class SkipselfComponent { - // Use skipSelf as inject option - public leaf = inject(LeafService, {skipSelf: true}); +// Use skipSelf as inject option +public leaf = inject(LeafService, {skipSelf: true}); } @@ -295,21 +289,21 @@ Use `host` as follows: @Component({ - selector: 'app-host', - templateUrl: './host.component.html', - styleUrls: ['./host.component.css'], - // provide the service - providers: [{ provide: FlowerService, useValue: { emoji: '🌷' } }] +selector: 'app-host', +templateUrl: './host.component.html', +styleUrls: ['./host.component.css'], +// provide the service +providers: [{ provide: FlowerService, useValue: { emoji: '🌷' } }] }) export class HostComponent { - // use host when injecting the service - flower = inject(FlowerService, {host: true, optional: true}); +// use host when injecting the service +flower = inject(FlowerService, {host: true, optional: true}); } Since `HostComponent` has the `host` option , no matter what the parent of `HostComponent` might have as a `flower.emoji` value, the `HostComponent` will use tulip 🌷. -### Modifiers with constructor injection +### Modifiers with constructor injection Similarly as presented before, the behavior of constructor injection can be modified with `@Optional()`, `@Self()`, `@SkipSelf()` and `@Host()`. @@ -363,8 +357,8 @@ The following sections demonstrate `providers` and `viewProviders` along with wa A component class can provide services in two ways: -| Arrays | Details | -|:--- |:--- | +| Arrays | Details | +| :--------------------------- | :--------------------------------------------- | | With a `providers` array | `@Component({ providers: [SomeService] })` | | With a `viewProviders` array | `@Component({ viewProviders: [SomeService] })` | @@ -375,11 +369,11 @@ For example, the logical tree will show that `` is a direct chi In the logical tree, you will see special attributes: `@Provide`, `@Inject`, and `@ApplicationConfig`. These aren't real attributes but are here to demonstrate what is going on under the hood. -| Angular service attribute | Details | -|:--- |:--- | -| `@Inject(Token)=>Value` | If `Token` is injected at this location in the logical tree, its value would be `Value`. | -| `@Provide(Token=Value)` | Indicates that `Token` is provided with `Value` at this location in the logical tree. | -| `@ApplicationConfig` | Demonstrates that a fallback `EnvironmentInjector` should be used at this location. | +| Angular service attribute | Details | +| :------------------------ | :--------------------------------------------------------------------------------------- | +| `@Inject(Token)=>Value` | If `Token` is injected at this location in the logical tree, its value would be `Value`. | +| `@Provide(Token=Value)` | Indicates that `Token` is provided with `Value` at this location in the logical tree. | +| `@ApplicationConfig` | Demonstrates that a fallback `EnvironmentInjector` should be used at this location. | ### Example app structure @@ -400,8 +394,8 @@ The most basic rendered view would look like nested HTML elements such as the fo - - + + @@ -464,19 +458,18 @@ When `` requests the `FlowerService`, it is the injector's job to reso The resolution of the token happens in two phases: 1. The injector determines the starting location in the logical tree and an ending location of the search. - The injector begins with the starting location and looks for the token at each view level in the logical tree. - If the token is found it is returned. + The injector begins with the starting location and looks for the token at each view level in the logical tree. + If the token is found it is returned. 1. If the token is not found, the injector looks for the closest parent `EnvironmentInjector` to delegate the request to. In the example case, the constraints are: 1. Start with `<#VIEW>` belonging to `` and end with ``. - - * Normally the starting point for search is at the point of injection. - However, in this case `` is a component. `@Component`s are special in that they also include their own `viewProviders`, which is why the search starts at `<#VIEW>` belonging to ``. - This would not be the case for a directive matched at the same location. - * The ending location happens to be the same as the component itself, because it is the topmost component in this application. + - Normally the starting point for search is at the point of injection. + However, in this case `` is a component. `@Component`s are special in that they also include their own `viewProviders`, which is why the search starts at `<#VIEW>` belonging to ``. + This would not be the case for a directive matched at the same location. + - The ending location happens to be the same as the component itself, because it is the topmost component in this application. 1. The `EnvironmentInjector` provided by the `ApplicationConfig` acts as the fallback injector when the injection token can't be found in the `ElementInjector` hierarchies. @@ -487,15 +480,15 @@ Now, in the `ChildComponent` class, add a provider for `FlowerService` to demons @Component({ - selector: 'app-child', - templateUrl: './child.component.html', - styleUrls: ['./child.component.css'], - // use the providers array to provide a service - providers: [{ provide: FlowerService, useValue: { emoji: '🌻' } }] +selector: 'app-child', +templateUrl: './child.component.html', +styleUrls: ['./child.component.css'], +// use the providers array to provide a service +providers: [{ provide: FlowerService, useValue: { emoji: '🌻' } }] }) export class ChildComponent { - // inject the service - flower = inject(FlowerService); +// inject the service +flower = inject(FlowerService); } @@ -520,17 +513,18 @@ In the logical tree, this is represented as follows: "🌺"> - <#VIEW> -

Emoji from FlowerService: {{flower.emoji}} (🌺)

- "🌻"> - <#VIEW> -

Child Component

-

Emoji from FlowerService: {{flower.emoji}} (🌻)

- -
- +@Inject(FlowerService) flower=>"🌺"> +<#VIEW> + +

Emoji from FlowerService: {{flower.emoji}} (🌺)

+"🌻"> +<#VIEW> +

Child Component

+

Emoji from FlowerService: {{flower.emoji}} (🌻)

+ +
+
@@ -557,10 +551,10 @@ First, create an `AnimalService` with an `emoji` property of whale ὃ import { Injectable } from '@angular/core'; @Injectable({ - providedIn: 'root' +providedIn: 'root' }) export class AnimalService { - emoji = '🐳'; +emoji = '🐳'; }
@@ -581,17 +575,17 @@ Here, it has a value of dog 🐶. @Component({ - selector: 'app-child', - templateUrl: './child.component.html', - styleUrls: ['./child.component.css'], - // provide services - providers: [{ provide: FlowerService, useValue: { emoji: '🌻' } }], - viewProviders: [{ provide: AnimalService, useValue: { emoji: '🐶' } }] +selector: 'app-child', +templateUrl: './child.component.html', +styleUrls: ['./child.component.css'], +// provide services +providers: [{ provide: FlowerService, useValue: { emoji: '🌻' } }], +viewProviders: [{ provide: AnimalService, useValue: { emoji: '🐶' } }] }) export class ChildComponent { - // inject services - flower = inject(FlowerService); - animal = inject(AnimalService) +// inject services +flower = inject(FlowerService); +animal = inject(AnimalService) ... } @@ -626,16 +620,17 @@ The logic tree for this example of `viewProviders` is as follows: "🐳"> - <#VIEW> - - <#VIEW @Provide(AnimalService="🐶") - @Inject(AnimalService=>"🐶")> - -

Emoji from AnimalService: {{animal.emoji}} (🐶)

- -
- +@Inject(AnimalService) animal=>"🐳"> +<#VIEW> + +<#VIEW @Provide(AnimalService="🐶") +@Inject(AnimalService=>"🐶")> + + +

Emoji from AnimalService: {{animal.emoji}} (🐶)

+ +
+
@@ -673,8 +668,8 @@ Remember to add the `InspectorComponent` to the `ChildComponent` `imports` array @Component({ - ... - imports: [InspectorComponent] +... +imports: [InspectorComponent] }) @@ -729,13 +724,14 @@ The `AnimalService` in the logical tree would look like this: "🐳"> - <#VIEW> - - <#VIEW @Provide(AnimalService="🐶") - @Inject(AnimalService=>"🐶")> - -

Emoji from AnimalService: {{animal.emoji}} (🐶)

+@Inject(AnimalService) animal=>"🐳"> +<#VIEW> + +<#VIEW @Provide(AnimalService="🐶") +@Inject(AnimalService=>"🐶")> + + +

Emoji from AnimalService: {{animal.emoji}} (🐶)

Content projection

@@ -751,7 +747,8 @@ The `AnimalService` in the logical tree would look like this: - + + @@ -787,14 +784,16 @@ In a logical tree, this same idea might look like this: "🌺"> - <#VIEW> - - <#VIEW @Inject(FlowerService, SkipSelf)=>"🌺"> - - - - +@Inject(FlowerService) flower=>"🌺"> +<#VIEW> + +<#VIEW @Inject(FlowerService, SkipSelf)=>"🌺"> + + + + + + @@ -808,13 +807,13 @@ Here's the idea in the logical tree: "🌺"> - <#VIEW> - - <#VIEW inject(FlowerService, {skipSelf: true, host: true, optional:true})=>null> - - - +@Inject(FlowerService) flower=>"🌺"> +<#VIEW> + +<#VIEW inject(FlowerService, {skipSelf: true, host: true, optional:true})=>null> + + + @@ -826,7 +825,7 @@ Here, the services and their values are the same, but `host` stops the injector Remember, `` provides the `AnimalService` in the `viewProviders` array with the value of dog 🐶. Because the injector has only to look at the `ElementInjector` of the `` for the `AnimalService`, it never sees the whale 🐳. -As in the `FlowerService` example, if you add `skipSelf` to the `inject()` of `AnimalService`, the injector won't look in the `ElementInjector` of the current `` for the `AnimalService`. +As in the `FlowerService` example, if you add `skipSelf` to the `inject()` of `AnimalService`, the injector won't look in the `ElementInjector` of the current `` for the `AnimalService`. Instead, the injector will begin at the `` `ElementInjector`. @@ -844,15 +843,17 @@ The logical tree looks like this with `skipSelf` in ``: "🐳")> - <#VIEW> - - <#VIEW @Provide(AnimalService="🐶") - @Inject(AnimalService, SkipSelf=>"🐳")> - - - - +@Inject(AnimalService=>"🐳")> +<#VIEW> + +<#VIEW @Provide(AnimalService="🐶") +@Inject(AnimalService, SkipSelf=>"🐳")> + + + + + + @@ -883,14 +884,14 @@ export class ChildComponent { "🐳")> - <#VIEW> - - <#VIEW @Provide(AnimalService="🐶") - inject(AnimalService, {host: true}=>"🐶")> - - - +@Inject(AnimalService=>"🐳")> +<#VIEW> + +<#VIEW @Provide(AnimalService="🐶") +inject(AnimalService, {host: true}=>"🐶")> + + + @@ -933,17 +934,18 @@ The logical tree representation shows why this is: "🐳")> - <#VIEW @Provide(AnimalService="🦔") - @Inject(AnimalService, @Optional)=>"🦔"> - - - <#VIEW @Provide(AnimalService="🐶") - inject(AnimalService, {skipSelf:true, host: true, optional: true})=>"🦔"> - - - - +@Inject(AnimalService=>"🐳")> +<#VIEW @Provide(AnimalService="🦔") +@Inject(AnimalService, @Optional)=>"🦔"> + + + +<#VIEW @Provide(AnimalService="🐶") +inject(AnimalService, {skipSelf:true, host: true, optional: true})=>"🦔"> + + + + @@ -969,9 +971,9 @@ Instead, you should provide the `VillainsService` in the `providers` metadata of @Component({ - selector: 'app-villains-list', - templateUrl: './villains-list.component.html', - providers: [VillainsService] +selector: 'app-villains-list', +templateUrl: './villains-list.component.html', +providers: [VillainsService] }) export class VillainsListComponent {} @@ -993,9 +995,9 @@ Each selected hero tax return opens in its own component and multiple returns ca Each tax return component has the following characteristics: -* Is its own tax return editing session -* Can change a tax return without affecting a return in another component -* Has the ability to save the changes to its tax return or cancel them +- Is its own tax return editing session +- Can change a tax return without affecting a return in another component +- Has the ability to save the changes to its tax return or cancel them Suppose that the `HeroTaxReturnComponent` had logic to manage and restore changes. That would be a straightforward task for a hero tax return. @@ -1012,28 +1014,28 @@ import { HeroesService } from './heroes.service'; @Injectable() export class HeroTaxReturnService { - private currentTaxReturn!: HeroTaxReturn; - private originalTaxReturn!: HeroTaxReturn; +private currentTaxReturn!: HeroTaxReturn; +private originalTaxReturn!: HeroTaxReturn; - private heroService = inject(HeroesService); +private heroService = inject(HeroesService); - set taxReturn(htr: HeroTaxReturn) { - this.originalTaxReturn = htr; - this.currentTaxReturn = htr.clone(); - } +set taxReturn(htr: HeroTaxReturn) { +this.originalTaxReturn = htr; +this.currentTaxReturn = htr.clone(); +} - get taxReturn(): HeroTaxReturn { - return this.currentTaxReturn; - } +get taxReturn(): HeroTaxReturn { +return this.currentTaxReturn; +} - restoreTaxReturn() { - this.taxReturn = this.originalTaxReturn; - } +restoreTaxReturn() { +this.taxReturn = this.originalTaxReturn; +} - saveTaxReturn() { - this.taxReturn = this.currentTaxReturn; - this.heroService.saveTaxReturn(this.currentTaxReturn).subscribe(); - } +saveTaxReturn() { +this.taxReturn = this.currentTaxReturn; +this.heroService.saveTaxReturn(this.currentTaxReturn).subscribe(); +} } @@ -1045,46 +1047,46 @@ import { HeroTaxReturn } from './hero'; import { HeroTaxReturnService } from './hero-tax-return.service'; @Component({ - selector: 'app-hero-tax-return', - templateUrl: './hero-tax-return.component.html', - styleUrls: [ './hero-tax-return.component.css' ], - providers: [ HeroTaxReturnService ] +selector: 'app-hero-tax-return', +templateUrl: './hero-tax-return.component.html', +styleUrls: [ './hero-tax-return.component.css' ], +providers: [ HeroTaxReturnService ] }) export class HeroTaxReturnComponent { - message = ''; +message = ''; - close = output(); +close = output(); - get taxReturn(): HeroTaxReturn { - return this.heroTaxReturnService.taxReturn; - } +get taxReturn(): HeroTaxReturn { +return this.heroTaxReturnService.taxReturn; +} - taxReturn = input.required(); +taxReturn = input.required(); - constructor() { - effect(() => { - this.heroTaxReturnService.taxReturn = this.taxReturn(); - }) - } +constructor() { +effect(() => { +this.heroTaxReturnService.taxReturn = this.taxReturn(); +}) +} - private heroTaxReturnService = inject(HeroTaxReturnService); +private heroTaxReturnService = inject(HeroTaxReturnService); - onCanceled() { - this.flashMessage('Canceled'); - this.heroTaxReturnService.restoreTaxReturn(); - } +onCanceled() { +this.flashMessage('Canceled'); +this.heroTaxReturnService.restoreTaxReturn(); +} - onClose() { this.close.emit(); } +onClose() { this.close.emit(); } - onSaved() { - this.flashMessage('Saved'); - this.heroTaxReturnService.saveTaxReturn(); - } +onSaved() { +this.flashMessage('Saved'); +this.heroTaxReturnService.saveTaxReturn(); +} - flashMessage(msg: string) { - this.message = msg; - setTimeout(() => this.message = '', 500); - } +flashMessage(msg: string) { +this.message = msg; +setTimeout(() => this.message = '', 500); +} } @@ -1116,7 +1118,7 @@ For example, consider a `Car` component that includes tire service information a The root injector, marked as (A), uses _generic_ providers for details about `CarService` and `EngineService`. -1. `Car` component (A). Component (A) displays tire service data about a car and specifies generic services to provide more information about the car. +1. `Car` component (A). Component (A) displays tire service data about a car and specifies generic services to provide more information about the car. 2. Child component (B). Component (B) defines its own, _specialized_ providers for `CarService` and `EngineService` that have special capabilities suitable for what's going on in component (B). @@ -1141,9 +1143,9 @@ Behind the scenes, each component sets up its own injector with zero, one, or mo When you resolve an instance of `Car` at the deepest component (C), its injector produces: -* An instance of `Car` resolved by injector (C) -* An `Engine` resolved by injector (B) -* Its `Tires` resolved by the root injector (A). +- An instance of `Car` resolved by injector (C) +- An `Engine` resolved by injector (B) +- Its `Tires` resolved by the root injector (A). ```mermaid graph BT; diff --git a/adev/src/content/guide/di/lightweight-injection-tokens.md b/adev/src/content/guide/di/lightweight-injection-tokens.md index b20c8e31d3b8..d7fe0e79f0dc 100644 --- a/adev/src/content/guide/di/lightweight-injection-tokens.md +++ b/adev/src/content/guide/di/lightweight-injection-tokens.md @@ -1,7 +1,7 @@ # Optimizing client application size with lightweight injection tokens This page provides a conceptual overview of a dependency injection technique that is recommended for library developers. -Designing your library with *lightweight injection tokens* helps optimize the bundle size of client applications that use your library. +Designing your library with _lightweight injection tokens_ helps optimize the bundle size of client applications that use your library. You can manage the dependency structure among your components and injectable services to optimize bundle size by using tree-shakable providers. This normally ensures that if a provided component or service is never actually used by the application, the compiler can remove its code from the bundle. @@ -25,7 +25,7 @@ This component contains a body and can contain an optional header: ; - ; +; ; @@ -40,11 +40,11 @@ In a likely implementation, the `` component uses `@ContentChild()` or class LibHeaderComponent {} @Component({ - selector: 'lib-card', - …, +selector: 'lib-card', +…, }) class LibCardComponent { - @ContentChild(LibHeaderComponent) header: LibHeaderComponent|null = null; +@ContentChild(LibHeaderComponent) header: LibHeaderComponent|null = null; } @@ -57,13 +57,13 @@ This is because `LibCardComponent` actually contains two references to the `LibH @ContentChild(LibHeaderComponent) header: LibHeaderComponent; -* One of these reference is in the *type position*-- that is, it specifies `LibHeaderComponent` as a type: `header: LibHeaderComponent;`. -* The other reference is in the *value position*-- that is, LibHeaderComponent is the value of the `@ContentChild()` parameter decorator: `@ContentChild(LibHeaderComponent)`. +- One of these reference is in the _type position_-- that is, it specifies `LibHeaderComponent` as a type: `header: LibHeaderComponent;`. +- The other reference is in the _value position_-- that is, LibHeaderComponent is the value of the `@ContentChild()` parameter decorator: `@ContentChild(LibHeaderComponent)`. The compiler handles token references in these positions differently: -* The compiler erases *type position* references after conversion from TypeScript, so they have no impact on tree-shaking. -* The compiler must keep *value position* references at runtime, which **prevents** the component from being tree-shaken. +- The compiler erases _type position_ references after conversion from TypeScript, so they have no impact on tree-shaking. +- The compiler must keep _value position_ references at runtime, which **prevents** the component from being tree-shaken. In the example, the compiler retains the `LibHeaderComponent` token that occurs in the value position. This prevents the referenced component from being tree-shaken, even if the application does not actually use `` anywhere. @@ -74,8 +74,8 @@ If `LibHeaderComponent` 's code, template, and styles combine to become too larg The tree-shaking problem arises when a component is used as an injection token. There are two cases when that can happen: -* The token is used in the value position of a [content query](guide/components/queries#content-queries). -* The token is used as a type specifier for constructor injection. +- The token is used in the value position of a [content query](guide/components/queries#content-queries). +- The token is used as a type specifier for constructor injection. In the following example, both uses of the `OtherComponent` token cause retention of `OtherComponent`, preventing it from being tree-shaken when it is not used: @@ -83,7 +83,7 @@ In the following example, both uses of the `OtherComponent` token cause retentio class MyComponent { constructor(@Optional() other: OtherComponent) {} - @ContentChild(OtherComponent) other: OtherComponent|null; +@ContentChild(OtherComponent) other: OtherComponent|null; } @@ -104,20 +104,20 @@ The following example shows how this works for the `LibHeaderComponent`: abstract class LibHeaderToken {} @Component({ - selector: 'lib-header', - providers: [ - {provide: LibHeaderToken, useExisting: LibHeaderComponent} - ] - …, +selector: 'lib-header', +providers: [ +{provide: LibHeaderToken, useExisting: LibHeaderComponent} +] +…, }) class LibHeaderComponent extends LibHeaderToken {} @Component({ - selector: 'lib-card', - …, +selector: 'lib-card', +…, }) class LibCardComponent { - @ContentChild(LibHeaderToken) header: LibHeaderToken|null = null; +@ContentChild(LibHeaderToken) header: LibHeaderToken|null = null; } @@ -152,30 +152,30 @@ abstract class LibHeaderToken { } @Component({ - selector: 'lib-header', - providers: [ - {provide: LibHeaderToken, useExisting: LibHeaderComponent} - ] - …, +selector: 'lib-header', +providers: [ +{provide: LibHeaderToken, useExisting: LibHeaderComponent} +] +…, }) class LibHeaderComponent extends LibHeaderToken { - doSomething(): void { - // Concrete implementation of `doSomething` - } +doSomething(): void { +// Concrete implementation of `doSomething` +} } @Component({ - selector: 'lib-card', - …, +selector: 'lib-card', +…, }) class LibCardComponent implement AfterContentInit { - @ContentChild(LibHeaderToken) header: LibHeaderToken|null = null; +@ContentChild(LibHeaderToken) header: LibHeaderToken|null = null; - ngAfterContentInit(): void { - if (this.header !== null) { - this.header?.doSomething(); - } - } +ngAfterContentInit(): void { +if (this.header !== null) { +this.header?.doSomething(); +} +} } diff --git a/adev/src/content/guide/di/overview.md b/adev/src/content/guide/di/overview.md index 1620a7edcb1b..03de6b1889f4 100644 --- a/adev/src/content/guide/di/overview.md +++ b/adev/src/content/guide/di/overview.md @@ -1,29 +1,154 @@ -"DI" is a design pattern and mechanism for creating and delivering some parts of an app to other parts of an app that require them. + +Dependency Injection (DI) is a design pattern used to organize and share code across an application. TIP: Check out Angular's [Essentials](essentials/dependency-injection) before diving into this comprehensive guide. -When you develop a smaller part of your system, like a module or a class, you may need to use features from other classes. For example, you may need an HTTP service to make backend calls. Dependency Injection, or DI, is a design pattern and mechanism for creating and delivering some parts of an application to other parts of an application that require them. Angular supports this design pattern and you can use it in your applications to increase flexibility and modularity. - -In Angular, dependencies are typically services, but they also can be values, such as strings or functions. An injector for an application (created automatically during bootstrap) instantiates dependencies when needed, using a configured provider of the service or value. - -## Learn about Angular dependency injection - - - - Learn basic principles of dependency injection in Angular. - - - Describes how to create a service and inject it in other services and components. - - - Describes how to configure dependencies using the providers field on the @Component and @NgModule decorators. Also describes how to use InjectionToken to provide and inject values in DI, which can be helpful when you want to use a value other than classes as dependencies. - - - Describes what an injection context is and how to use the DI system where you need it. - - - Hierarchical DI enables you to share dependencies between different parts of the application only when and if you need to. This is an advanced topic. - - +As an application grows, developers often need to reuse and share features across different parts of the codebase. [Dependency Injection (DI)](https://en.wikipedia.org/wiki/Dependency_injection) is a design pattern used to organize and share code across an application by allowing you to "inject" features into different parts. + +Dependency injection is a popular pattern because it allows developers to address common challenges such as: + +- **Improved code maintainability**: Dependency injection allows cleaner separation of concerns which enables easier refactoring and reducing code duplication. +- **Scalability**: Modular functionality can be reused across multiple contexts and allows for easier scaling. +- **Better testing**: DI allows unit tests to easily use [test doubles](https://en.wikipedia.org/wiki/Test_double) for situations when using a real implementation is not practical. + +## How does dependency injection work in Angular? + +A dependency is any object, value, function or service that a class needs to work but does not create itself. In other words, it creates a relationship between different parts of your application since it wouldn't work without the dependency. + +There are two ways that code interacts with any dependency injection system: + +- Code can _provide_, or make available, values. +- Code can _inject_, or ask for, those values as dependencies. + +"Values," in this context, can be any JavaScript value, including objects and functions. Common types of injected dependencies include: + +- **Configuration values**: Environment-specific constants, API URLs, feature flags, etc. +- **Factories**: Functions that create objects or values based on runtime conditions +- **Services**: Classes that provide common functionality, business logic, or state + +Angular components and directives automatically participate in DI, meaning that they can inject dependencies _and_ they are available to be injected. + +## What are services? + +An Angular _service_ is a TypeScript class decorated with `@Injectable`, which makes an instance of the class available to be injected as a dependency. Services are the most common way of sharing data and functionality across an application. + +Common types of services include: + +- **Data clients:** Abstracts the details of making requests to a server for data retrieval and mutation +- **State management:** Defines state shared across multiple components or pages +- **Authentication and authorization:** Manages user authentication, token storage, and access control +- **Logging and error handling:** Establishes a common API for logging or communicating error states to the user +- **Event handling and dispatch:** Handles events or notifications that are not associated with a specific component, or for dispatching events and notifications to components, following the [observer pattern](https://en.wikipedia.org/wiki/Observer_pattern) +- **Utility functions:** Offers reusable utility functions like data formatting, validation, or calculations + +The following example declares a service named `AnalyticsLogger`: + +```ts +import { Injectable } from '@angular/core'; + +@Injectable({ providedIn: 'root' }) +export class AnalyticsLogger { + trackEvent(category: string, value: string) { + console.log('Analytics event logged:', { + category, + value, + timestamp: new Date().toISOString() + }) + } +} +``` + +NOTE: The `providedIn: 'root'` option makes this service available throughout your entire application as a singleton. This is the recommended approach for most services. + +## Injecting dependencies with `inject()` + +You can inject dependencies using Angular's `inject()` function. + +Here is an example of a navigation bar that injects `AnalyticsLogger` and Angular `Router` service to allow users to navigate to a different page while tracking the event. + +```angular-ts +import { Component, inject } from '@angular/core'; +import { Router } from '@angular/router'; +import { AnalyticsLogger } from './analytics-logger'; + +@Component({ + selector: 'app-navbar', + template: ` + Detail Page + `, +}) +export class NavbarComponent { + private router = inject(Router); + private analytics = inject(AnalyticsLogger); + + navigateToDetail(event: Event) { + event.preventDefault(); + this.analytics.trackEvent('navigation', '/details'); + this.router.navigate(['/details']); + } +} +``` + +### Where can `inject()` be used? + +You can inject dependencies during construction of a component, directive, or service. The call to `inject` can appear in either the `constructor` or in a field initializer. Here are some common examples: + +```ts +@Component({...}) +export class MyComponent { + // ✅ In class field initializer + private service = inject(MyService); + + // ✅ In constructor body + private anotherService: MyService; + + constructor() { + this.anotherService = inject(MyService); + } +} +``` + +```ts +@Directive({...}) +export class MyDirective { + // ✅ In class field initializer + private element = inject(ElementRef); +} +``` + +```ts +import { Injectable, inject } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ providedIn: 'root' }) +export class MyService { + // ✅ In a service + private http = inject(HttpClient); +} +``` + +```ts +export const authGuard = () => { + // ✅ In a route guard + const auth = inject(AuthService); + return auth.isAuthenticated(); +} +``` + +Angular uses the term "injection context" to describe any place in your code where you can call `inject`. While component, directive, and service construction is the most common, see [injection contexts](/guide/di/dependency-injection-context) for more details. + +For more information, see the [inject API docs](api/core/inject#usage-notes). + +## Next steps + +Now that you understand the fundamentals of dependency injection in Angular, you're ready to learn how to create your own services. + +The next guide, [Creating and using services](guide/di/creating-and-using-services), will show you: + +- How to create a service with the Angular CLI or manually +- How the `providedIn: 'root'` pattern works +- How to inject services into components and other services + +This covers the most common use case for services in Angular applications. diff --git a/adev/src/content/guide/directives/BUILD.bazel b/adev/src/content/guide/directives/BUILD.bazel index a16a99e80e88..24325441f4d9 100644 --- a/adev/src/content/guide/directives/BUILD.bazel +++ b/adev/src/content/guide/directives/BUILD.bazel @@ -6,6 +6,7 @@ generate_guides( srcs = glob([ "*.md", ]), + api_manifest = "//adev/src/assets:docs_api_manifest", data = [ "//adev/src/assets/images:directives.svg", "//adev/src/content/examples", diff --git a/adev/src/content/guide/directives/attribute-directives.md b/adev/src/content/guide/directives/attribute-directives.md index 69403a04e9a5..7dd83c173ece 100644 --- a/adev/src/content/guide/directives/attribute-directives.md +++ b/adev/src/content/guide/directives/attribute-directives.md @@ -8,36 +8,36 @@ This section walks you through creating a highlight directive that sets the back 1. To create a directive, use the CLI command [`ng generate directive`](tools/cli/schematics). - + - ng generate directive highlight + ng generate directive highlight - + - The CLI creates `src/app/highlight.directive.ts`, a corresponding test file `src/app/highlight.directive.spec.ts`. + The CLI creates `src/app/highlight.directive.ts`, a corresponding test file `src/app/highlight.directive.spec.ts`. - + - The `@Directive()` decorator's configuration property specifies the directive's CSS attribute selector, `[appHighlight]`. + The `@Directive()` decorator's configuration property specifies the directive's CSS attribute selector, `[appHighlight]`. 1. Import `ElementRef` from `@angular/core`. - `ElementRef` grants direct access to the host DOM element through its `nativeElement` property. + `ElementRef` grants direct access to the host DOM element through its `nativeElement` property. 1. Add `ElementRef` in the directive's `constructor()` to [inject](guide/di) a reference to the host DOM element, the element to which you apply `appHighlight`. 1. Add logic to the `HighlightDirective` class that sets the background to yellow. - + -HELPFUL: Directives *do not* support namespaces. +HELPFUL: Directives _do not_ support namespaces. - + ## Applying an attribute directive 1. To use the `HighlightDirective`, add a `

` element to the HTML template with the directive as an attribute. - + Angular creates an instance of the `HighlightDirective` class and injects a reference to the `

` element into the directive's constructor, which sets the `

` element's background style to yellow. @@ -45,21 +45,21 @@ Angular creates an instance of the `HighlightDirective` class and injects a refe This section shows you how to detect when a user mouses into or out of the element and to respond by setting or clearing the highlight color. -1. Import `HostListener` from '@angular/core'. +1. Configure host event bindings using the `host` property in the `@Directive()` decorator. - + -1. Add two event handlers that respond when the mouse enters or leaves, each with the `@HostListener()` decorator. +1. Add two event handler methods, and map host element events to them via the `host` property. - + -Subscribe to events of the DOM element that hosts an attribute directive, the `

` in this case, with the `@HostListener()` decorator. +Subscribe to events of the DOM element that hosts an attribute directive (the `

` in this case) by configuring event listeners on the directive's [`host` property](guide/components/host-elements#binding-to-the-host-element). HELPFUL: The handlers delegate to a helper method, `highlight()`, that sets the color on the host DOM element, `el`. The complete directive is as follows: - + The background color appears when the pointer hovers over the paragraph element and disappears as the pointer moves out. @@ -71,26 +71,25 @@ This section walks you through setting the highlight color while applying the `H 1. In `highlight.directive.ts`, import `Input` from `@angular/core`. - + -1. Add an `appHighlight` `input` property. +2. Add an `appHighlight` `input` property. - + - The `input()` function adds metadata to the class that makes the directive's `appHighlight` property available for binding. + The `input()` function adds metadata to the class that makes the directive's `appHighlight` property available for binding. -2. In `app.component.ts`, add a `color` property to the `AppComponent`. +3. In `app.component.ts`, add a `color` property to the `AppComponent`. - + -3. To simultaneously apply the directive and the color, use property binding with the `appHighlight` directive selector, setting it equal to `color`. +4. To simultaneously apply the directive and the color, use property binding with the `appHighlight` directive selector, setting it equal to `color`. - + - The `[appHighlight]` attribute binding performs two tasks: - - * Applies the highlighting directive to the `

` element - * Sets the directive's highlight color with a property binding + The `[appHighlight]` attribute binding performs two tasks: + - Applies the highlighting directive to the `

` element + - Sets the directive's highlight color with a property binding ### Setting the value with user input @@ -98,38 +97,38 @@ This section guides you through adding radio buttons to bind your color choice t 1. Add markup to `app.component.html` for choosing a color as follows: - + 1. Revise the `AppComponent.color` so that it has no initial value. - + 1. In `highlight.directive.ts`, revise `onMouseEnter` method so that it first tries to highlight with `appHighlight` and falls back to `red` if `appHighlight` is `undefined`. - + 1. Serve your application to verify that the user can choose the color with the radio buttons. - Animated gif of the refactored highlight directive changing color according to the radio button the user selects +Animated gif of the refactored highlight directive changing color according to the radio button the user selects ## Binding to a second property This section guides you through configuring your application so the developer can set the default color. -1. Add a second `Input()` property to `HighlightDirective` called `defaultColor`. +1. Add a second `input()` property to `HighlightDirective` called `defaultColor`. - + 1. Revise the directive's `onMouseEnter` so that it first tries to highlight with the `appHighlight`, then with the `defaultColor`, and falls back to `red` if both properties are `undefined`. - + 1. To bind to the `AppComponent.color` and fall back to "violet" as the default color, add the following HTML. - In this case, the `defaultColor` binding doesn't use square brackets, `[]`, because it is static. + In this case, the `defaultColor` binding doesn't use square brackets, `[]`, because it is static. - + - As with components, you can add multiple directive property bindings to a host element. + As with components, you can add multiple directive property bindings to a host element. The default color is red if there is no default color binding. When the user chooses a color the selected color becomes the active highlight color. @@ -143,12 +142,12 @@ To prevent expression evaluation in the browser, add `ngNonBindable` to the host In the following example, the expression `{{ 1 + 1 }}` renders just as it does in your code editor, and does not display `2`. - + Applying `ngNonBindable` to an element stops binding for that element's child elements. However, `ngNonBindable` still lets directives work on the element where you apply `ngNonBindable`. In the following example, the `appHighlight` directive is still active but Angular does not evaluate the expression `{{ 1 + 1 }}`. - + If you apply `ngNonBindable` to a parent element, Angular disables interpolation and binding of any sort, such as property binding or event binding, for the element's children. diff --git a/adev/src/content/guide/directives/directive-composition-api.md b/adev/src/content/guide/directives/directive-composition-api.md index c898326894d0..53694c00b4b8 100644 --- a/adev/src/content/guide/directives/directive-composition-api.md +++ b/adev/src/content/guide/directives/directive-composition-api.md @@ -3,13 +3,13 @@ Angular directives offer a great way to encapsulate reusable behaviors— directives can apply attributes, CSS classes, and event listeners to an element. -The *directive composition API* lets you apply directives to a component's host element from -*within* the component TypeScript class. +The _directive composition API_ lets you apply directives to a component's host element from +_within_ the component TypeScript class. ## Adding directives to a component You apply directives to a component by adding a `hostDirectives` property to a component's -decorator. We call such directives *host directives*. +decorator. We call such directives _host directives_. In this example, we apply the directive `MenuBehavior` to the host element of `AdminMenu`. This works similarly to applying the `MenuBehavior` to the `` element in a template. diff --git a/adev/src/content/guide/directives/overview.md b/adev/src/content/guide/directives/overview.md index 07a62d2c98c4..2ea704759ebf 100644 --- a/adev/src/content/guide/directives/overview.md +++ b/adev/src/content/guide/directives/overview.md @@ -38,7 +38,7 @@ HELPFUL: To add or remove a _single_ class, use [class binding](guide/templates/ To use `NgClass`, add it to the component's `imports` list. - + ### Using `NgClass` with an expression @@ -46,7 +46,7 @@ On the element you'd like to style, add `[ngClass]` and set it equal to an expre In this case, `isSpecial` is a boolean set to `true` in `app.component.ts`. Because `isSpecial` is true, `ngClass` applies the class of `special` to the `

`. - + ### Using `NgClass` with a method @@ -57,11 +57,11 @@ Because `isSpecial` is true, `ngClass` applies the class of `special` to the ` + 1. In the template, add the `ngClass` property binding to `currentClasses` to set the element's classes: - + For this use case, Angular applies the classes on initialization and in case of changes caused by reassigning the `currentClasses` object. The full example calls `setCurrentClasses()` initially with `ngOnInit()` when the user clicks on the `Refresh currentClasses` button. @@ -75,7 +75,7 @@ HELPFUL: To add or remove a _single_ style, use [style bindings](guide/templates To use `NgStyle`, add it to the component's `imports` list. - + Use `NgStyle` to set multiple inline styles simultaneously, based on the state of the component. @@ -83,11 +83,11 @@ Use `NgStyle` to set multiple inline styles simultaneously, based on the state o In the following example, `setCurrentStyles()` sets the property `currentStyles` with an object that defines three styles, based on the state of three other component properties. - + 1. To set the element's styles, add an `ngStyle` property binding to `currentStyles`. - + For this use case, Angular applies the styles upon initialization and in case of changes. To do this, the full example calls `setCurrentStyles()` initially with `ngOnInit()` and when the dependent properties change through a button click. @@ -101,7 +101,7 @@ Use `` when there's no single element to host the directive. Here's a conditional paragraph using ``. - + ngcontainer paragraph with proper style @@ -111,7 +111,7 @@ Here's a conditional paragraph using ``. 1. To conditionally exclude an `