diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 4587848a..5cd43415 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -36,6 +36,7 @@ jobs: - run: npm ci - run: npm run build - run: npm run test:unit -w packages/ace-linters + - run: npm run test:unit -w packages/ace-legacy-linters - run: | npm run prepare:ui-smoke diff --git a/package-lock.json b/package-lock.json index 974646f3..c30f80fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ace-linters-root", - "version": "2.2.1", + "version": "2.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ace-linters-root", - "version": "2.2.1", + "version": "2.3.0", "workspaces": [ "./packages/*" ], @@ -291,7 +291,9 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.23.4", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", "dev": true, "license": "MIT", "engines": { @@ -299,7 +301,9 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.20", + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", "dev": true, "license": "MIT", "engines": { @@ -405,9 +409,14 @@ } }, "node_modules/@babel/parser": { - "version": "7.23.6", + "version": "7.29.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.2.tgz", + "integrity": "sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA==", "dev": true, "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.0" + }, "bin": { "parser": "bin/babel-parser.js" }, @@ -457,13 +466,14 @@ } }, "node_modules/@babel/types": { - "version": "7.23.6", + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", + "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.23.4", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.28.5" }, "engines": { "node": ">=6.9.0" @@ -2468,6 +2478,13 @@ "@types/json-schema": "*" } }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/estree": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", @@ -2838,6 +2855,10 @@ "integrity": "sha512-kkv0pYvNUvTBYCmN9H8vuWpY7Ah8xyrjKrX+bYu5OgK0THLjN3j7p+bAfen0ACNqEPQ//4aq81fX+fCLR1MCHw==", "license": "MIT" }, + "node_modules/ace-legacy-linters": { + "resolved": "packages/ace-legacy-linters", + "link": true + }, "node_modules/ace-linters": { "resolved": "packages/ace-linters", "link": true @@ -8278,9 +8299,9 @@ } }, "node_modules/prettier": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.1.tgz", - "integrity": "sha512-hPpFQvHwL3Qv5AdRvBFMhnKo4tYxp0ReXiPn2bxkiohEX6mBeBwEpBSQTkD458RaaDKQMYSp4hX4UtfUTA5wDw==", + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.1.tgz", + "integrity": "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==", "dev": true, "license": "MIT", "bin": { @@ -9573,14 +9594,6 @@ "dev": true, "license": "MIT" }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -10403,17 +10416,16 @@ } }, "node_modules/yaml-language-server": { - "version": "1.19.2", - "resolved": "https://registry.npmjs.org/yaml-language-server/-/yaml-language-server-1.19.2.tgz", - "integrity": "sha512-9F3myNmJzUN/679jycdMxqtydPSDRAarSj3wPiF7pchEPnO9Dg07Oc+gIYLqXR4L+g+FSEVXXv2+mr54StLFOg==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/yaml-language-server/-/yaml-language-server-1.21.0.tgz", + "integrity": "sha512-fpDEAF7s0mO9e7xbi/retaN5P6wpbHDBszLsogiWNZ+F4CQ0QFBoGI4QbPZwoMmel6av6Pq+LPeKNZYljgu28w==", "dev": true, "license": "MIT", "dependencies": { "@vscode/l10n": "^0.0.18", "ajv": "^8.17.1", "ajv-draft-04": "^1.0.0", - "lodash": "4.17.21", - "prettier": "^3.5.0", + "prettier": "^3.8.1", "request-light": "^0.5.7", "vscode-json-languageservice": "4.1.8", "vscode-languageserver": "^9.0.0", @@ -10617,7 +10629,69 @@ }, "packages/ace-legacy-linters": { "version": "1.0.0", - "extraneous": true + "license": "MIT", + "devDependencies": { + "@babel/parser": "^7.29.2", + "@xml-tools/ast": "^5.0.5", + "@xml-tools/constraints": "^1.1.1", + "@xml-tools/parser": "^1.0.11", + "@xml-tools/simple-schema": "^3.0.5", + "ace-code": "^1.43.6", + "chai": "^4.3.7", + "eslint-scope": "^9.1.2", + "htmlhint": "^1.9.2", + "luaparse": "^0.3.1", + "mocha": "^10.2.0", + "php-parser": "^3.4.0", + "vscode-css-languageservice": "^6.3.10", + "vscode-json-languageservice": "^5.7.2", + "yaml": "^2.8.3" + } + }, + "packages/ace-legacy-linters/node_modules/eslint-scope": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "packages/ace-legacy-linters/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "packages/ace-legacy-linters/node_modules/yaml": { + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz", + "integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==", + "dev": true, + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14.6" + }, + "funding": { + "url": "https://github.com/sponsors/eemeli" + } }, "packages/ace-linters": { "version": "2.1.2", @@ -10847,7 +10921,7 @@ "path-browserify": "^1.0.0", "prettier": "^3.5.1", "vscode-languageserver-textdocument": "^1.0.0", - "yaml-language-server": "^1.19.2" + "yaml-language-server": "^1.21.0" } } } diff --git a/package.json b/package.json index 3900a9da..4f718677 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "ace-linters-root", - "version": "2.2.1", + "version": "2.3.0", "scripts": { "build:parts": "npm run build -ws", "build": "npm run build:parts && vite build", "start-dev": "vite", "prepare:ui-smoke": "node tools/prepare-ui-smoke-dist.js", - "start-test-server:ui-smoke": "npm run prepare:ui-smoke && http-server --cors='*' tests/ui-smoke/dist", + "start-test-server:ui-smoke": "npm run prepare:ui-smoke && http-server --cors='*' tests/ui-smoke/dist -c-1", "test:ui:smoke": "mocha --exit" }, "dependencies": { diff --git a/packages/ace-legacy-linters/.mocharc.js b/packages/ace-legacy-linters/.mocharc.js new file mode 100644 index 00000000..74aa8e86 --- /dev/null +++ b/packages/ace-legacy-linters/.mocharc.js @@ -0,0 +1,11 @@ +const path = require("path"); + +process.env.TS_NODE_PROJECT = path.join(__dirname, "tsconfig.json"); + +module.exports = { + extension: ["ts"], + reporter: "spec", + timeout: 15000, + spec: "tests/**/*.tests.ts", + require: "ts-node/register/transpile-only" +}; diff --git a/packages/ace-legacy-linters/LICENSE b/packages/ace-legacy-linters/LICENSE new file mode 100644 index 00000000..319b7edd --- /dev/null +++ b/packages/ace-legacy-linters/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Azat Alimov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/ace-legacy-linters/README.md b/packages/ace-legacy-linters/README.md new file mode 100644 index 00000000..ac088240 --- /dev/null +++ b/packages/ace-legacy-linters/README.md @@ -0,0 +1,24 @@ +# ace-legacy-linters + +This package contains drop-in replacements for legacy Ace Editor worker files. + +Its purpose is simple: +- build standalone worker scripts that can replace legacy Ace workers +- keep the existing Ace worker loading flow unchanged +- provide updated linting or syntax-checking behavior without modifying Ace itself + +The generated files are intended to be used in place of the corresponding Ace worker assets, such as files under +`ace-builds/src` or `ace-builds/src-noconflict`. + +Currently this package replaces these Ace workers: +- `worker-php.js` +- `worker-lua.js` +- `worker-html.js` +- `worker-json.js` +- `worker-css.js` +- `worker-xml.js` +- `worker-yaml.js` +- `worker-javascript.js` + +This package is not a general-purpose language service layer. It is only for compatibility replacements of legacy Ace +workers. diff --git a/packages/ace-legacy-linters/build-worker.mjs b/packages/ace-legacy-linters/build-worker.mjs new file mode 100644 index 00000000..07b2d703 --- /dev/null +++ b/packages/ace-legacy-linters/build-worker.mjs @@ -0,0 +1,237 @@ +import {build} from "esbuild"; +import fs from "node:fs/promises"; +import path from "node:path"; +import {minify} from "terser"; +import {fileURLToPath} from "node:url"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const packageDir = __dirname; + +const outputTargets = [ + { + moduleFactory: "define", + outDir: "build/src", + minify: false + }, { + moduleFactory: "define", + outDir: "build/src-min", + minify: true + }, { + moduleFactory: "ace.define", + outDir: "build/src-noconflict", + minify: false + }, { + moduleFactory: "ace.define", + outDir: "build/src-min-noconflict", + minify: true + } +]; +const workerConfigs = [ + { + entry: "src/workers/php-worker.ts", + exportName: "PhpWorker", + className: "PhpWorker", + moduleId: "ace/mode/php_worker", + fileName: "worker-php.js", + modulePrelude: ` +var globalObj = typeof globalThis !== "undefined" ? globalThis : self; +var processShim = globalObj.process = globalObj.process || {}; +processShim.arch = processShim.arch || "x64"; +`.trim() + }, { + entry: "src/workers/lua-worker.ts", + exportName: "LuaWorker", + className: "Worker", + moduleId: "ace/mode/lua_worker", + fileName: "worker-lua.js" + }, { + entry: "src/workers/html-worker.ts", + exportName: "HtmlWorker", + className: "Worker", + moduleId: "ace/mode/html_worker", + fileName: "worker-html.js" + }, { + entry: "src/workers/json-worker.ts", + exportName: "JsonWorker", + className: "JsonWorker", + moduleId: "ace/mode/json_worker", + fileName: "worker-json.js" + }, { + entry: "src/workers/css-worker.ts", + exportName: "CssWorker", + className: "Worker", + moduleId: "ace/mode/css_worker", + fileName: "worker-css.js" + }, { + entry: "src/workers/xml-worker.ts", + exportName: "XmlWorker", + className: "Worker", + moduleId: "ace/mode/xml_worker", + fileName: "worker-xml.js" + }, { + entry: "src/workers/yaml-worker.ts", + exportName: "YamlWorker", + className: "YamlWorker", + moduleId: "ace/mode/yaml_worker", + fileName: "worker-yaml.js", + aliases: [ + { + from: /^path$/, + to: fileURLToPath(new URL("../../node_modules/path-browserify/index.js", import.meta.url)) + } + ] + }, { + entry: "src/workers/javascript-worker.ts", + exportName: "JavaScriptWorker", + className: "JavaScriptWorker", + moduleId: "ace/mode/javascript_worker", + fileName: "worker-javascript.js" + } +]; + +const bootstrapFile = path.join(packageDir, "src", "worker.js"); +const oopSourceFile = path.join(packageDir, "..", "..", "node_modules", "ace-code", "src", "lib", "oop.js"); +const eventEmitterSourceFile = path.join( + packageDir, "..", "..", "node_modules", "ace-code", "src", "lib", "event_emitter.js"); +function createAceModule(moduleFactory, workerConfig, bundleCode) { + const prelude = workerConfig.modulePrelude ? `${workerConfig.modulePrelude}\n` : ""; + const className = workerConfig.className || workerConfig.exportName; + return ` +${moduleFactory}(${JSON.stringify(workerConfig.moduleId)}, [], function(require, exports, module) { +"use strict"; +${prelude}var define = undefined; +${bundleCode} +exports.${className} = aceLegacyWorkerModule.${workerConfig.exportName}; +}); +`.trim(); +} + +function wrapAceCodeModule(moduleFactory, moduleId, source) { + const normalizedSource = source + .replace(/^\uFEFF?/, "") + .replace(/^"use strict";\s*/, ""); + + return ` +${moduleFactory}(${JSON.stringify(moduleId)}, [], function(require, exports, module) { +"use strict"; +${normalizedSource.trim()} +}); +`.trim(); +} + +function createAliasPlugin(workerConfig) { + const aliasEntries = workerConfig.aliases || []; + + return { + name: "alias", + setup({ + onResolve, + }) { + for (const aliasEntry of aliasEntries) { + onResolve({filter: aliasEntry.from}, ({ + path: importPath, + ..._resolveOptions + }) => { + if (aliasEntry.to) { + return { + path: aliasEntry.to, + external: false, + sideEffects: false + }; + } + + return null; + }); + } + } + }; +} + +async function bundleWorkerModule(workerConfig) { + const result = await build({ + absWorkingDir: packageDir, + entryPoints: [path.join(packageDir, workerConfig.entry)], + bundle: true, + write: false, + format: "iife", + globalName: "aceLegacyWorkerModule", + platform: "browser", + target: "es2019", + sourcemap: false, + minify: false, + banner: { + js: `var aceLegacyWorkerModule;` + }, + footer: { + js: `aceLegacyWorkerModule = aceLegacyWorkerModule.default || aceLegacyWorkerModule;` + }, + logLevel: "info", + plugins: aliasEntriesFor(workerConfig).length ? [createAliasPlugin(workerConfig)] : [] + }); + + return result.outputFiles[0].text; +} + +function aliasEntriesFor(workerConfig) { + return workerConfig.aliases || []; +} + +function asciify(text) { + return text.replace(/[\x00-\x08\x0b\x0c\x0e\x19\x80-\uffff]/g, (char) => { + const hex = char.charCodeAt(0).toString(16); + if (hex.length === 1) return `\\x0${hex}`; + if (hex.length === 2) return `\\x${hex}`; + if (hex.length === 3) return `\\u0${hex}`; + return `\\u${hex}`; + }); +} + +async function compress(text) { + const result = await minify(text, { + compress: true, + mangle: { + toplevel: true, + reserved: ["ACE_NAMESPACE", "requirejs"] + }, + format: { + ascii_only: true, + inline_script: true + } + }); + + if (!result.code) { + throw new Error("Terser returned no output"); + } + + return asciify(result.code); +} + +async function writeWorkerFile(workerConfig, target, bootstrap, bundleCode, oopModule, eventEmitterModule) { + const fileContents = [ + bootstrap.trimEnd(), "", wrapAceCodeModule(target.moduleFactory, "ace/lib/oop", oopModule), "", + wrapAceCodeModule(target.moduleFactory, "ace/lib/event_emitter", eventEmitterModule), "", + createAceModule(target.moduleFactory, workerConfig, bundleCode), "" + ].join("\n"); + const finalContents = target.minify ? await compress(fileContents) : fileContents; + const outfile = path.join(packageDir, target.outDir, workerConfig.fileName); + + await fs.mkdir(path.dirname(outfile), {recursive: true}); + await fs.writeFile(outfile, finalContents); + + return outfile; +} + +const [bootstrap, oopModule, eventEmitterModule] = await Promise.all([ + fs.readFile(bootstrapFile, "utf8"), fs.readFile(oopSourceFile, "utf8"), fs.readFile(eventEmitterSourceFile, "utf8") +]); + +for (const workerConfig of workerConfigs) { + const bundleCode = await bundleWorkerModule(workerConfig); + + for (const target of outputTargets) { + const outfile = await writeWorkerFile( + workerConfig, target, bootstrap, bundleCode, oopModule, eventEmitterModule); + console.log(`built ${path.relative(packageDir, outfile).replace(/\\/g, "/")}`); + } +} diff --git a/packages/ace-legacy-linters/generate-css-diagnostics-data.js b/packages/ace-legacy-linters/generate-css-diagnostics-data.js new file mode 100644 index 00000000..864a6297 --- /dev/null +++ b/packages/ace-legacy-linters/generate-css-diagnostics-data.js @@ -0,0 +1,66 @@ +#!/usr/bin/env node + +const fs = require("fs"); +const path = require("path"); +const {pathToFileURL} = require("url"); + +const packageDir = __dirname; +const rootDir = path.resolve(packageDir, "..", ".."); +const defaultInput = path.join( + rootDir, "node_modules", "vscode-css-languageservice", "lib", "esm", "data", + "webCustomData.js" +); +const defaultOutput = path.join(packageDir, "src", "workers", "css-diagnostics-data.generated.js"); + +function sortByName(entries) { + return entries.slice().sort((left, right) => left.name.localeCompare(right.name)); +} + +function stripProperties(properties) { + return sortByName(properties.map((property) => { + const next = {name: property.name}; + if (property.status) { + next.status = property.status; + } + return next; + })); +} + +function stripNamedEntries(entries) { + return sortByName(entries.map((entry) => ({name: entry.name}))); +} + +function buildDiagnosticsData(cssData, keepPseudos) { + return { + version: cssData.version, + properties: stripProperties(cssData.properties || []), + atDirectives: stripNamedEntries(cssData.atDirectives || []), + pseudoClasses: keepPseudos ? stripNamedEntries(cssData.pseudoClasses || []) : [], + pseudoElements: keepPseudos ? stripNamedEntries(cssData.pseudoElements || []) : [] + }; +} + +async function loadCssData(inputPath) { + const moduleUrl = pathToFileURL(inputPath).href; + const imported = await import(moduleUrl); + if (!imported.cssData) { + throw new Error(`No cssData export found in ${inputPath}`); + } + return imported.cssData; +} + +function writeOutput(outputPath, diagnosticsData) { + fs.mkdirSync(path.dirname(outputPath), {recursive: true}); + fs.writeFileSync(outputPath, `export const cssData = ${JSON.stringify(diagnosticsData, null, 2)};\n`); +} + +async function main() { + const cssData = await loadCssData(defaultInput); + const diagnosticsData = buildDiagnosticsData(cssData, false); + writeOutput(defaultOutput, diagnosticsData); +} + +main().catch((error) => { + console.error(error.message || error); + process.exit(1); +}); diff --git a/packages/ace-legacy-linters/package.json b/packages/ace-legacy-linters/package.json new file mode 100644 index 00000000..5dc6dbd0 --- /dev/null +++ b/packages/ace-legacy-linters/package.json @@ -0,0 +1,33 @@ +{ + "name": "ace-legacy-linters", + "license": "MIT", + "version": "1.0.0", + "description": "drop-in replacements for legacy Ace Editor worker files", + "scripts": { + "build:css-diagnostics-data": "node generate-css-diagnostics-data.js", + "build": "npm run build:css-diagnostics-data && node build-worker.mjs", + "test:unit": "mocha --config .mocharc.js --exit", + "test": "npm run test:unit" + }, + "repository": { + "type": "git", + "url": "https://github.com/mkslanc/ace-linters.git" + }, + "devDependencies": { + "php-parser": "^3.4.0", + "ace-code": "^1.43.6", + "luaparse": "^0.3.1", + "htmlhint": "^1.9.2", + "vscode-json-languageservice": "^5.7.2", + "vscode-css-languageservice": "^6.3.10", + "@xml-tools/constraints": "^1.1.1", + "@xml-tools/parser": "^1.0.11", + "@xml-tools/ast": "^5.0.5", + "@xml-tools/simple-schema": "^3.0.5", + "yaml": "^2.8.3", + "@babel/parser": "^7.29.2", + "eslint-scope": "^9.1.2", + "chai": "^4.3.7", + "mocha": "^10.2.0" + } +} diff --git a/packages/ace-legacy-linters/src/min-document.ts b/packages/ace-legacy-linters/src/min-document.ts new file mode 100644 index 00000000..11d13a09 --- /dev/null +++ b/packages/ace-legacy-linters/src/min-document.ts @@ -0,0 +1,410 @@ +import {Ace} from "ace-code"; + +var oop = require("ace-code/src/lib/oop"); +var applyDelta = require("ace-code/src/apply_delta").applyDelta; +var EventEmitter = require("ace-code/src/lib/event_emitter").EventEmitter; +var Range = require("ace-code/src/range").Range; + +export class MinDocument { + $lines: string[]; + $autoNewLine = ""; + $newLineMode = "auto"; + constructor(textOrLines) { + this.$lines = [""]; + + if (textOrLines.length === 0) { + this.$lines = [""]; + } else if (Array.isArray(textOrLines)) { + this.insertMergedLines({row: 0, column: 0}, textOrLines); + } else { + this.insert({row: 0, column:0}, textOrLines); + } + } + + setValue(text) { + var len = this.getLength() - 1; + this.remove(new Range(0, 0, len, this.getLine(len).length)); + this.insert({row: 0, column: 0}, text || ""); + } + + getValue() { + return this.getAllLines().join(this.getNewLineCharacter()); + } + + $detectNewLine(text) { + var match = text.match(/^.*?(\r\n|\r|\n)/m); + this.$autoNewLine = match ? match[1] : "\n"; + //@ts-expect-error + this._signal("changeNewLineMode"); + } + + getNewLineCharacter() { + switch (this.$newLineMode) { + case "windows": + return "\r\n"; + case "unix": + return "\n"; + default: + return this.$autoNewLine || "\n"; + } + } + + setNewLineMode(newLineMode) { + if (this.$newLineMode === newLineMode) + return; + + this.$newLineMode = newLineMode; + //@ts-expect-error + this._signal("changeNewLineMode"); + } + + getNewLineMode() { + return this.$newLineMode; + } + + isNewLine(text) { + return (text == "\r\n" || text == "\r" || text == "\n"); + } + + getLine(row) { + return this.$lines[row] || ""; + } + + getLines(firstRow, lastRow) { + return this.$lines.slice(firstRow, lastRow + 1); + } + + getAllLines() { + return this.getLines(0, this.getLength()); + } + + getLength() { + return this.$lines.length; + } + + getTextRange(range) { + return this.getLinesForRange(range).join(this.getNewLineCharacter()); + } + + getLinesForRange(range) { + var lines; + if (range.start.row === range.end.row) { + // Handle a single-line range. + lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)]; + } else { + // Handle a multi-line range. + lines = this.getLines(range.start.row, range.end.row); + lines[0] = (lines[0] || "").substring(range.start.column); + var l = lines.length - 1; + if (range.end.row - range.start.row == l) + lines[l] = lines[l].substring(0, range.end.column); + } + return lines; + } + + insert(position, text) { + // Only detect new lines if the document has no line break yet. + if (this.getLength() <= 1) + this.$detectNewLine(text); + + return this.insertMergedLines(position, this.$split(text)); + } + + insertInLine(position, text) { + var start = this.clippedPos(position.row, position.column); + var end = this.pos(position.row, position.column + text.length); + + this.applyDelta({ + start: start, + end: end, + action: "insert", + lines: [text] + }, true); + + return this.clonePos(end); + } + + clippedPos(row, column) { + var length = this.getLength(); + if (row === undefined) { + row = length; + } else if (row < 0) { + row = 0; + } else if (row >= length) { + row = length - 1; + column = undefined; + } + var line = this.getLine(row); + if (column == undefined) + column = line.length; + column = Math.min(Math.max(column, 0), line.length); + return {row: row, column: column}; + } + + clonePos(pos) { + return {row: pos.row, column: pos.column}; + } + + pos(row, column) { + return {row: row, column: column}; + } + + $clipPosition(position) { + var length = this.getLength(); + if (position.row >= length) { + position.row = Math.max(0, length - 1); + position.column = this.getLine(length - 1).length; + } else { + position.row = Math.max(0, position.row); + position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length); + } + return position; + } + + insertFullLines(row, lines) { + // Clip to document. + // Allow one past the document end. + row = Math.min(Math.max(row, 0), this.getLength()); + + // Calculate insertion point. + var column = 0; + if (row < this.getLength()) { + // Insert before the specified row. + lines = lines.concat([""]); + column = 0; + } else { + // Insert after the last row in the document. + lines = [""].concat(lines); + row--; + column = this.$lines[row].length; + } + + // Insert. + this.insertMergedLines({row: row, column: column}, lines); + } + + insertMergedLines(position, lines) { + var start = this.clippedPos(position.row, position.column); + var end = { + row: start.row + lines.length - 1, + column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length + }; + + this.applyDelta({ + start: start, + end: end, + action: "insert", + lines: lines + }); + + return this.clonePos(end); + } + + remove(range) { + var start = this.clippedPos(range.start.row, range.start.column); + var end = this.clippedPos(range.end.row, range.end.column); + this.applyDelta({ + start: start, + end: end, + action: "remove", + lines: this.getLinesForRange({start: start, end: end}) + }); + return this.clonePos(start); + } + + removeInLine(row, startColumn, endColumn) { + var start = this.clippedPos(row, startColumn); + var end = this.clippedPos(row, endColumn); + + this.applyDelta({ + start: start, + end: end, + action: "remove", + lines: this.getLinesForRange({start: start, end: end}) + }, true); + + return this.clonePos(start); + } + + removeFullLines(firstRow, lastRow) { + // Clip to document. + firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1); + lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1); + + // Calculate deletion range. + // Delete the ending new line unless we're at the end of the document. + // If we're at the end of the document, delete the starting new line. + var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0; + var deleteLastNewLine = lastRow < this.getLength() - 1; + var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow ); + var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 ); + var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow ); + var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length ); + var range = new Range(startRow, startCol, endRow, endCol); + + // Store delelted lines with bounding newlines ommitted (maintains previous behavior). + var deletedLines = this.$lines.slice(firstRow, lastRow + 1); + + this.applyDelta({ + start: range.start, + end: range.end, + action: "remove", + lines: this.getLinesForRange(range) + }); + + // Return the deleted lines. + return deletedLines; + } + + removeNewLine(row) { + if (row < this.getLength() - 1 && row >= 0) { + this.applyDelta({ + start: this.pos(row, this.getLine(row).length), + end: this.pos(row + 1, 0), + action: "remove", + lines: ["", ""] + }); + } + } + + replace(range, text) { + if (!(range instanceof Range)) + range = Range.fromPoints(range.start, range.end); + if (text.length === 0 && range.isEmpty()) + return range.start; + + // Shortcut: If the text we want to insert is the same as it is already + // in the document, we don't have to replace anything. + if (text == this.getTextRange(range)) + return range.end; + + this.remove(range); + var end; + if (text) { + end = this.insert(range.start, text); + } + else { + end = range.start; + } + + return end; + } + + applyDeltas(deltas) { + for (var i=0; i=0; i--) { + this.revertDelta(deltas[i]); + } + } + + /** + * Applies `delta` to the document. + * @param {Delta} delta A delta object (can include "insert" and "remove" actions) + * @param {boolean} [doNotValidate] + **/ + applyDelta(delta: Ace.Delta, doNotValidate?: boolean) { + var isInsert = delta.action == "insert"; + // An empty range is a NOOP. + if (isInsert ? delta.lines.length <= 1 && !delta.lines[0] + : !Range.comparePoints(delta.start, delta.end)) { + return; + } + + if (isInsert && delta.lines.length > 20000) { + this.$splitAndapplyLargeDelta(delta, 20000); + } + else { + applyDelta(this.$lines, delta, doNotValidate); + //@ts-expect-error + this._signal("change", delta); + } + } + + /** + * @param {Delta} delta + */ + $safeApplyDelta(delta) { + var docLength = this.$lines.length; + // verify that delta is in the document to prevent applyDelta from corrupting lines array + if ( + delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength + || delta.action == "insert" && delta.start.row <= docLength + ) { + this.applyDelta(delta); + } + } + + $splitAndapplyLargeDelta(delta, MAX) { + // Split large insert deltas. This is necessary because: + // 1. We need to support splicing delta lines into the document via $lines.splice.apply(...) + // 2. fn.apply() doesn't work for a large number of params. The smallest threshold is on chrome 40 ~42000. + // we use 20000 to leave some space for actual stack + // + // To Do: Ideally we'd be consistent and also split 'delete' deltas. We don't do this now, because delete + // delta handling is too slow. If we make delete delta handling faster we can split all large deltas + // as shown in https://gist.github.com/aldendaniels/8367109#file-document-snippet-js + // If we do this, update validateDelta() to limit the number of lines in a delete delta. + var lines = delta.lines; + var l = lines.length - MAX + 1; + var row = delta.start.row; + var column = delta.start.column; + for (var from = 0, to = 0; from < l; from = to) { + to += MAX - 1; + var chunk = lines.slice(from, to); + chunk.push(""); + this.applyDelta({ + start: this.pos(row + from, column), + end: this.pos(row + to, column = 0), + action: delta.action, + lines: chunk + }, true); + } + // Update remaining delta. + delta.lines = lines.slice(from); + delta.start.row = row + from; + delta.start.column = column; + this.applyDelta(delta, true); + } + + revertDelta(delta) { + this.$safeApplyDelta({ + start: this.clonePos(delta.start), + end: this.clonePos(delta.end), + action: (delta.action == "insert" ? "remove" : "insert"), + lines: delta.lines.slice() + }); + } + + indexToPosition(index: number, startRow?: number | undefined) { + var lines = this.$lines || this.getAllLines(); + var newlineLength = this.getNewLineCharacter().length; + for (var i = startRow || 0, l = lines.length; i < l; i++) { + index -= lines[i].length + newlineLength; + if (index < 0) + return {row: i, column: index + lines[i].length + newlineLength}; + } + return {row: l-1, column: index + lines[l-1].length + newlineLength}; + } + + positionToIndex(pos, startRow) { + var lines = this.$lines || this.getAllLines(); + var newlineLength = this.getNewLineCharacter().length; + var index = 0; + var row = Math.min(pos.row, lines.length); + for (var i = startRow || 0; i < row; ++i) + index += lines[i].length + newlineLength; + + return index + pos.column; + } + + $split(text) { + return text.split(/\r\n|\r|\n/); + } +} + +oop.implement(MinDocument.prototype, EventEmitter); \ No newline at end of file diff --git a/packages/ace-legacy-linters/src/mirror.ts b/packages/ace-legacy-linters/src/mirror.ts new file mode 100644 index 00000000..3602c362 --- /dev/null +++ b/packages/ace-legacy-linters/src/mirror.ts @@ -0,0 +1,72 @@ +import * as lang from "ace-code/src/lib/lang"; +import {MinDocument} from "./min-document"; + +export abstract class Mirror { + $timeout = 500; + sender: any; + doc: MinDocument; + $path: string; + deferredUpdate: any; + + protected constructor(sender) { + this.sender = sender; + var doc = (this.doc = new MinDocument("")); + + var deferredUpdate = (this.deferredUpdate = lang.delayedCall( + this.onUpdate.bind(this), + )); + + var _self = this; + sender.on("change", function (e) { + var data = e.data; + if (data[0].start) { + doc.applyDeltas(data); + } else { + for (var i = 0; i < data.length; i += 2) { + var d, err; + if (Array.isArray(data[i + 1])) { + d = {action: "insert", start: data[i], lines: data[i + 1]}; + } else { + d = {action: "remove", start: data[i], end: data[i + 1]}; + } + + if ( + (d.action == "insert" ? d.start : d.end).row >= doc["$lines"].length + ) { + err = new Error("Invalid delta"); + err.data = { + path: _self.$path, + linesLength: doc["$lines"].length, + start: d.start, + end: d.end, + }; + throw err; + } + + doc.applyDelta(d, true); + } + } + if (_self.$timeout) return deferredUpdate.schedule(_self.$timeout); + _self.onUpdate(); + }); + } + + setTimeout(timeout) { + this.$timeout = timeout; + } + + setValue(value) { + this.doc.setValue(value); + this.deferredUpdate.schedule(this.$timeout); + } + + getValue(callbackId) { + this.sender.callback(this.doc.getValue(), callbackId); + } + + abstract onUpdate(); + + isPending() { + return this.deferredUpdate.isPending(); + } +} diff --git a/packages/ace-legacy-linters/src/utils.ts b/packages/ace-legacy-linters/src/utils.ts new file mode 100644 index 00000000..ffe08cca --- /dev/null +++ b/packages/ace-legacy-linters/src/utils.ts @@ -0,0 +1,16 @@ +import type {Diagnostic} from "vscode-languageserver-protocol"; +import type {Ace} from "ace-code"; + +export function toAnnotations(diagnostics: Diagnostic[]): Ace.Annotation[] { + return diagnostics?.map((el) => { + const annotation = { + row: el.range.start.line, + column: el.range.start.character, + text: el.message, + type: el.severity === 1 ? "error" : el.severity === 2 ? "warning" : "info", + code: el.code, + data: el.data + }; + return annotation as Ace.Annotation; + }); +} \ No newline at end of file diff --git a/packages/ace-legacy-linters/src/vscode-text-document-min.ts b/packages/ace-legacy-linters/src/vscode-text-document-min.ts new file mode 100644 index 00000000..e8f69b38 --- /dev/null +++ b/packages/ace-legacy-linters/src/vscode-text-document-min.ts @@ -0,0 +1,134 @@ +export interface Position { + line: number; + character: number; +} + +export interface Range { + start: Position; + end: Position; +} + +export class MinTextDocument { + private _uri: string; + private _languageId: string; + private _version: number; + private _content: string; + private _lineOffsets: number[] | undefined; + + public constructor(uri: string, languageId: string, version: number, content: string) { + this._uri = uri; + this._languageId = languageId; + this._version = version; + this._content = content; + this._lineOffsets = undefined; + } + + public get uri(): string { + return this._uri; + } + + public get languageId(): string { + return this._languageId; + } + + public get version(): number { + return this._version; + } + + public getText(range?: Range): string { + if (range) { + const start = this.offsetAt(range.start); + const end = this.offsetAt(range.end); + return this._content.substring(start, end); + } + return this._content; + } + + private getLineOffsets(): number[] { + if (this._lineOffsets === undefined) { + this._lineOffsets = computeLineOffsets(this._content, true); + } + return this._lineOffsets; + } + + public positionAt(offset: number): Position { + offset = Math.max(Math.min(offset, this._content.length), 0); + + const lineOffsets = this.getLineOffsets(); + let low = 0, high = lineOffsets.length; + if (high === 0) { + return { line: 0, character: offset }; + } + while (low < high) { + const mid = Math.floor((low + high) / 2); + if (lineOffsets[mid] > offset) { + high = mid; + } else { + low = mid + 1; + } + } + // low is the least x for which the line offset is larger than the current offset + // or array.length if no line offset is larger than the current offset + const line = low - 1; + + offset = this.ensureBeforeEOL(offset, lineOffsets[line]); + return { line, character: offset - lineOffsets[line] }; + } + + public offsetAt(position: Position) { + const lineOffsets = this.getLineOffsets(); + if (position.line >= lineOffsets.length) { + return this._content.length; + } else if (position.line < 0) { + return 0; + } + const lineOffset = lineOffsets[position.line]; + if (position.character <= 0) { + return lineOffset; + } + + const nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length; + const offset = Math.min(lineOffset + position.character, nextLineOffset); + return this.ensureBeforeEOL(offset, lineOffset); + } + + private ensureBeforeEOL(offset: number, lineOffset: number): number { + while (offset > lineOffset && isEOL(this._content.charCodeAt(offset - 1))) { + offset--; + } + return offset; + } + + public get lineCount() { + return this.getLineOffsets().length; + } +} + +const enum CharCode { + /** + * The `\n` character. + */ + LineFeed = 10, + /** + * The `\r` character. + */ + CarriageReturn = 13, +} + +function computeLineOffsets(text: string, isAtLineStart: boolean, textOffset = 0): number[] { + const result: number[] = isAtLineStart ? [textOffset] : []; + for (let i = 0; i < text.length; i++) { + const ch = text.charCodeAt(i); + if (isEOL(ch)) { + if (ch === CharCode.CarriageReturn && i + 1 < text.length && text.charCodeAt(i + 1) === CharCode.LineFeed) { + i++; + } + result.push(textOffset + i + 1); + } + } + return result; +} + +function isEOL(char: number) { + return char === CharCode.CarriageReturn || char === CharCode.LineFeed; +} \ No newline at end of file diff --git a/packages/ace-legacy-linters/src/worker.js b/packages/ace-legacy-linters/src/worker.js new file mode 100644 index 00000000..e243a6c5 --- /dev/null +++ b/packages/ace-legacy-linters/src/worker.js @@ -0,0 +1,217 @@ +"no use strict"; +!(function(window) { +if (typeof window.window != "undefined" && window.document) + return; +if (window.require && window.define) + return; + +if (!window.console) { + window.console = function() { + var msgs = Array.prototype.slice.call(arguments, 0); + postMessage({type: "log", data: msgs}); + }; + window.console.error = + window.console.warn = + window.console.log = + window.console.trace = window.console; +} +window.window = window; +window.ace = window; + +window.onerror = function(message, file, line, col, err) { + postMessage({type: "error", data: { + message: message, + data: err && err.data, + file: file, + line: line, + col: col, + stack: err && err.stack + }}); +}; + +window.normalizeModule = function(parentId, moduleName) { + // normalize plugin requires + if (moduleName.indexOf("!") !== -1) { + var chunks = moduleName.split("!"); + return window.normalizeModule(parentId, chunks[0]) + "!" + window.normalizeModule(parentId, chunks[1]); + } + // normalize relative requires + if (moduleName.charAt(0) == ".") { + var base = parentId.split("/").slice(0, -1).join("/"); + moduleName = (base ? base + "/" : "") + moduleName; + + while (moduleName.indexOf(".") !== -1 && previous != moduleName) { + var previous = moduleName; + moduleName = moduleName.replace(/^\.\//, "").replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, ""); + } + } + + return moduleName; +}; + +window.require = function require(parentId, id) { + if (!id) { + id = parentId; + parentId = null; + } + if (!id.charAt) + throw new Error("worker.js require() accepts only (parentId, id) as arguments"); + + id = window.normalizeModule(parentId, id); + + var module = window.require.modules[id]; + if (module) { + if (!module.initialized) { + module.initialized = true; + module.exports = module.factory().exports; + } + return module.exports; + } + + if (!window.require.tlns) + return console.log("unable to load " + id); + + var path = resolveModuleId(id, window.require.tlns); + if (path.slice(-3) != ".js") path += ".js"; + + window.require.id = id; + window.require.modules[id] = {}; // prevent infinite loop on broken modules + importScripts(path); + return window.require(parentId, id); +}; +function resolveModuleId(id, paths) { + var testPath = id, tail = ""; + while (testPath) { + var alias = paths[testPath]; + if (typeof alias == "string") { + return alias + tail; + } else if (alias) { + return alias.location.replace(/\/*$/, "/") + (tail || alias.main || alias.name); + } else if (alias === false) { + return ""; + } + var i = testPath.lastIndexOf("/"); + if (i === -1) break; + tail = testPath.substr(i) + tail; + testPath = testPath.slice(0, i); + } + return id; +} +window.require.modules = {}; +window.require.tlns = {}; + +window.define = function(id, deps, factory) { + if (arguments.length == 2) { + factory = deps; + if (typeof id != "string") { + deps = id; + id = window.require.id; + } + } else if (arguments.length == 1) { + factory = id; + deps = []; + id = window.require.id; + } + + if (typeof factory != "function") { + window.require.modules[id] = { + exports: factory, + initialized: true + }; + return; + } + + if (!deps.length) + // If there is no dependencies, we inject "require", "exports" and + // "module" as dependencies, to provide CommonJS compatibility. + deps = ["require", "exports", "module"]; + + var req = function(childId) { + return window.require(id, childId); + }; + + window.require.modules[id] = { + exports: {}, + factory: function() { + var module = this; + var returnExports = factory.apply(this, deps.slice(0, factory.length).map(function(dep) { + switch (dep) { + // Because "require", "exports" and "module" aren't actual + // dependencies, we must handle them seperately. + case "require": return req; + case "exports": return module.exports; + case "module": return module; + // But for all other dependencies, we can just go ahead and + // require them. + default: return req(dep); + } + })); + if (returnExports) + module.exports = returnExports; + return module; + } + }; +}; +window.define.amd = {}; +window.require.tlns = {}; +window.initBaseUrls = function initBaseUrls(topLevelNamespaces) { + for (var i in topLevelNamespaces) + this.require.tlns[i] = topLevelNamespaces[i]; +}; + +window.initSender = function initSender() { + + var EventEmitter = window.require("ace/lib/event_emitter").EventEmitter; + var oop = window.require("ace/lib/oop"); + + var Sender = function() {}; + + (function() { + + oop.implement(this, EventEmitter); + + this.callback = function(data, callbackId) { + postMessage({ + type: "call", + id: callbackId, + data: data + }); + }; + + this.emit = function(name, data) { + postMessage({ + type: "event", + name: name, + data: data + }); + }; + + }).call(Sender.prototype); + + return new Sender(); +}; + +var main = window.main = null; +var sender = window.sender = null; + +window.onmessage = function(e) { + var msg = e.data; + if (msg.event && sender) { + sender._signal(msg.event, msg.data); + } + else if (msg.command) { + if (main[msg.command]) + main[msg.command].apply(main, msg.args); + else if (window[msg.command]) + window[msg.command].apply(window, msg.args); + else + throw new Error("Unknown command:" + msg.command); + } + else if (msg.init) { + window.initBaseUrls(msg.tlns); + sender = window.sender = window.initSender(); + var clazz = this.require(msg.module)[msg.classname]; + main = window.main = new clazz(sender); + } +}; +})(this); diff --git a/packages/ace-legacy-linters/src/workers/css-diagnostics-service.ts b/packages/ace-legacy-linters/src/workers/css-diagnostics-service.ts new file mode 100644 index 00000000..0bfa5e66 --- /dev/null +++ b/packages/ace-legacy-linters/src/workers/css-diagnostics-service.ts @@ -0,0 +1,149 @@ +import {Parser} from 'vscode-css-languageservice/lib/esm/parser/cssParser'; +import {CSSValidation} from 'vscode-css-languageservice/lib/esm/services/cssValidation'; +import {CSSDataProvider} from 'vscode-css-languageservice/lib/esm/languageFacts/dataProvider'; +import {SCSSParser} from 'vscode-css-languageservice/lib/esm/parser/scssParser'; +import {LESSParser} from 'vscode-css-languageservice/lib/esm/parser/lessParser'; +import {LanguageService} from "vscode-css-languageservice"; +import * as objects from 'vscode-css-languageservice/lib/esm/utils/objects'; +import {cssData} from "./css-diagnostics-data.generated"; + +export type CssDiagnosticsService = Pick + +function createFacade(parser, validation) { + return { + configure: (settings) => { + validation.configure(settings); + }, + doValidation: validation.doValidation.bind(validation), + parseStylesheet: parser.parseStylesheet.bind(parser), + }; +} + +const defaultLanguageServiceOptions = {}; + +export function getCSSDiagnosticsService(options = defaultLanguageServiceOptions): CssDiagnosticsService { + const cssDataManager = new CSSDataManager(options); + return createFacade(new Parser(), new CSSValidation(cssDataManager)); +} + +export function getSCSSDiagnosticsService(options = defaultLanguageServiceOptions): CssDiagnosticsService { + const cssDataManager = new CSSDataManager(options); + return createFacade(new SCSSParser(), new CSSValidation(cssDataManager)); +} + +export function getLESSDiagnosticsService(options = defaultLanguageServiceOptions): CssDiagnosticsService { + const cssDataManager = new CSSDataManager(options); + return createFacade(new LESSParser(), new CSSValidation(cssDataManager)); +} + + +class CSSDataManager { + private dataProviders: any[]; + private _propertySet: {}; + private _atDirectiveSet: {}; + private _pseudoClassSet: {}; + private _pseudoElementSet: {}; + private _properties: any[]; + private _atDirectives: any[]; + private _pseudoClasses: any[]; + private _pseudoElements: any[]; + + constructor(options) { + this.dataProviders = []; + this._propertySet = {}; + this._atDirectiveSet = {}; + this._pseudoClassSet = {}; + this._pseudoElementSet = {}; + this._properties = []; + this._atDirectives = []; + this._pseudoClasses = []; + this._pseudoElements = []; + this.setDataProviders(options?.useDefaultDataProvider !== false, options?.customDataProviders || []); + } + + setDataProviders(builtIn, providers) { + this.dataProviders = []; + if (builtIn) { + this.dataProviders.push(new CSSDataProvider(cssData)); + } + this.dataProviders.push(...providers); + this.collectData(); + } + + /** + * Collect all data & handle duplicates + */ + collectData() { + this._propertySet = {}; + this._atDirectiveSet = {}; + this._pseudoClassSet = {}; + this._pseudoElementSet = {}; + this.dataProviders.forEach(provider => { + provider.provideProperties().forEach(p => { + if (!this._propertySet[p.name]) { + this._propertySet[p.name] = p; + } + }); + provider.provideAtDirectives().forEach(p => { + if (!this._atDirectiveSet[p.name]) { + this._atDirectiveSet[p.name] = p; + } + }); + provider.providePseudoClasses().forEach(p => { + if (!this._pseudoClassSet[p.name]) { + this._pseudoClassSet[p.name] = p; + } + }); + provider.providePseudoElements().forEach(p => { + if (!this._pseudoElementSet[p.name]) { + this._pseudoElementSet[p.name] = p; + } + }); + }); + this._properties = objects.values(this._propertySet); + this._atDirectives = objects.values(this._atDirectiveSet); + this._pseudoClasses = objects.values(this._pseudoClassSet); + this._pseudoElements = objects.values(this._pseudoElementSet); + } + + getProperty(name) { + return this._propertySet[name]; + } + + getAtDirective(name) { + return this._atDirectiveSet[name]; + } + + getPseudoClass(name) { + return this._pseudoClassSet[name]; + } + + getPseudoElement(name) { + return this._pseudoElementSet[name]; + } + + getProperties() { + return this._properties; + } + + getAtDirectives() { + return this._atDirectives; + } + + getPseudoClasses() { + return this._pseudoClasses; + } + + getPseudoElements() { + return this._pseudoElements; + } + + isKnownProperty(name) { + return name.toLowerCase() in this._propertySet; + } + + isStandardProperty(name) { + return this.isKnownProperty(name) && + (!this._propertySet[name.toLowerCase()].status || this._propertySet[name.toLowerCase()].status === 'standard'); + } +} diff --git a/packages/ace-legacy-linters/src/workers/css-worker.ts b/packages/ace-legacy-linters/src/workers/css-worker.ts new file mode 100644 index 00000000..d2d81fff --- /dev/null +++ b/packages/ace-legacy-linters/src/workers/css-worker.ts @@ -0,0 +1,62 @@ +import {Mirror} from "../mirror"; +import {Ace} from "ace-code"; +import {MinTextDocument} from "../vscode-text-document-min"; +import {toAnnotations} from "../utils"; +import { + CssDiagnosticsService, + getCSSDiagnosticsService, + getLESSDiagnosticsService, + getSCSSDiagnosticsService +} from "./css-diagnostics-service"; + +export class CssWorker extends Mirror { + service: CssDiagnosticsService; + mode?: string; + $languageId = "css"; + + constructor(sender) { + super(sender); + + this.setTimeout(500); + + this.service = getCSSDiagnosticsService(); + } + + setOptions(opts) { + this.mode = opts && opts.mode; + this.$configureService(); + } + + $configureService() { + switch (this.mode) { + case "less": + this.$languageId = "less"; + this.service = getLESSDiagnosticsService(); + break; + case "scss": + this.$languageId = "scss"; + this.service = getSCSSDiagnosticsService(); + break; + case "css": + default: + this.$languageId = "css"; + this.service = getCSSDiagnosticsService(); + break; + } + } + + async onUpdate() { + var value = this.doc.getValue(); + var errors: Ace.Annotation[] = []; + + var fullDocument = new MinTextDocument("file:///foo." + this.$languageId, this.$languageId, 1, value); + + try { + let cssDocument = this.service.parseStylesheet(fullDocument); + errors = toAnnotations(this.service.doValidation(fullDocument, cssDocument)); + } catch (e) { + console.error(e); + } + this.sender.emit("annotate", errors); + } +} \ No newline at end of file diff --git a/packages/ace-legacy-linters/src/workers/eslint-rules/ast-utils.js b/packages/ace-legacy-linters/src/workers/eslint-rules/ast-utils.js new file mode 100644 index 00000000..9e99ddb7 --- /dev/null +++ b/packages/ace-legacy-linters/src/workers/eslint-rules/ast-utils.js @@ -0,0 +1,92 @@ +/** @typedef {any} ASTNode */ + +const anyFunctionPattern = + /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression)$/u; +const anyLoopPattern = /^(?:DoWhile|For|ForIn|ForOf|While)Statement$/u; +const LOGICAL_ASSIGNMENT_OPERATORS = new Set(["&&=", "||=", "??="]); + +/** + * Checks whether a given node is a function node or not. + * The following types are function nodes: + * + * - ArrowFunctionExpression + * - FunctionDeclaration + * - FunctionExpression + * @param {any} node A node to check. + * @returns {boolean} `true` if the node is a function node. + */ +export function isFunction(node) { + return Boolean(node && anyFunctionPattern.test(node.type)); +} + +/** + * Checks whether the given node is in a loop or not. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is in a loop. + */ +export function isInLoop(node) { + for ( + let currentNode = node; + currentNode && !isFunction(currentNode); + currentNode = currentNode.parent + ) { + if (isLoop(currentNode)) { + return true; + } + } + + return false; +} + +/** + * Checks whether a given node is a loop node or not. + * The following types are loop nodes: + * + * - DoWhileStatement + * - ForInStatement + * - ForOfStatement + * - ForStatement + * - WhileStatement + * @param {ASTNode|null} node A node to check. + * @returns {boolean} `true` if the node is a loop node. + */ +export function isLoop(node) { + return Boolean(node && anyLoopPattern.test(node.type)); +} + +/** + * Finds a function node from ancestors of a node. + * @param {ASTNode} node A start node to find. + * @returns {Node|null} A found function node. + */ +export function getUpperFunction(node) { + for ( + let currentNode = node; + currentNode; + currentNode = currentNode.parent + ) { + if (anyFunctionPattern.test(currentNode.type)) { + return currentNode; + } + } + return null; +} + +/** + * Checks if the given operator is a logical assignment operator. + * @param {string} operator The operator to check. + * @returns {boolean} `true` if the operator is a logical assignment operator. + */ +export function isLogicalAssignmentOperator(operator) { + return LOGICAL_ASSIGNMENT_OPERATORS.has(operator); +} + +export function interpolate(text, data) { + if (!data) { + return text; + } + return text.replace(/\{\{([^{}]+)\}\}/g, (_, name) => { + name = name.trim(); + return name in data ? String(data[name]) : `{{${name}}}`; + }); +} \ No newline at end of file diff --git a/packages/ace-legacy-linters/src/workers/eslint-rules/no-undef.js b/packages/ace-legacy-linters/src/workers/eslint-rules/no-undef.js new file mode 100644 index 00000000..c0fb1ce2 --- /dev/null +++ b/packages/ace-legacy-linters/src/workers/eslint-rules/no-undef.js @@ -0,0 +1,32 @@ +/** @typedef {import("eslint-scope").Scope} Scope */ +/** @typedef {import("eslint-scope").ScopeManager} ScopeManager */ +/** @typedef {any} ASTNode */ + +import {interpolate} from "./ast-utils"; + +/** + * Convert found undeclared variables into ace annotations + * @param {Scope} scope + * @param {ScopeManager} scopeManager + * @return {*[]} + */ +export function getAnnotations(scope, scopeManager) { + const globalScope = scope; + + if (!globalScope) { + return []; + } + + return globalScope.through.map((ref) => { + const identifier = ref.identifier; + if (!identifier.loc) { + return; + } + return { + row: identifier.loc.start.line - 1, + column: identifier.loc.start.column, + text: interpolate("'{{name}}' is not defined.", identifier), + type: "warning" + }; + }).filter(Boolean); +} diff --git a/packages/ace-legacy-linters/src/workers/eslint-rules/no-unused-vars.js b/packages/ace-legacy-linters/src/workers/eslint-rules/no-unused-vars.js new file mode 100644 index 00000000..524c92a8 --- /dev/null +++ b/packages/ace-legacy-linters/src/workers/eslint-rules/no-unused-vars.js @@ -0,0 +1,570 @@ +/** @typedef {import("eslint-scope").Variable} Variable */ +/** @typedef {import("eslint-scope").Reference} Reference */ +/** @typedef {import("eslint-scope").Scope} Scope */ +/** @typedef {import("eslint-scope").ScopeManager} ScopeManager */ +/** @typedef {any} ASTNode */ +import * as astUtils from "./ast-utils"; + +const STATEMENT_TYPE = /(?:Statement|Declaration)$/u; + +/** + * Gets an array of variables without read references. + * @param {Scope} scope an eslint-scope Scope object. + * @param {Variable[]} unusedVars an array that saving result. + * @param {ScopeManager} scopeManager + * @returns {Variable[]} unused variables of the scope and descendant scopes. + * @private + */ +function collectUnusedVariables(scope, unusedVars, scopeManager) { + const variables = scope.variables; + const childScopes = scope.childScopes; + let i, l; + + // if (scope.type !== "global" || config.vars === "all") { + for (i = 0, l = variables.length; i < l; ++i) { + const variable = variables[i]; + + // skip a variable of class itself name in the class scope + //@ts-expect-error + if (scope.type === "class" && scope.block.id === variable.identifiers[0]) { + continue; + } + + // skip function expression names + if (scope.functionExpressionScope) { + continue; + } + + // skip implicit "arguments" variable + if (scope.type === "function" && variable.name === "arguments" && variable.identifiers.length === 0) { + continue; + } + + // explicit global variables don't have definitions. + const def = variable.defs[0]; + + if (def) { + const type = def.type; + + if (type === "Parameter") { + // skip any setter argument + //@ts-expect-error + if ((def.node.parent.type === "Property" || def.node.parent.type === "MethodDefinition") && def.node.parent.kind === "set") { + continue; + } + + // if "args" option is "after-used", skip used variables + //@ts-expect-error + if (astUtils.isFunction(def.name.parent) && !isAfterLastUsedArg(variable, scopeManager)) { + continue; + } + } + } + + if (!isUsedVariable(variable) && !isExported(variable) && !hasRestSpreadSibling(variable)) { + unusedVars.push(variable); + } + } + // } + + for (i = 0, l = childScopes.length; i < l; ++i) { + collectUnusedVariables(childScopes[i], unusedVars, scopeManager); + } + + return unusedVars; +} + +/** + * Checks whether the given variable is after the last used parameter. + * @param {Variable} variable The variable to check. + * @param {ScopeManager} scopeManager + * @returns {boolean} `true` if the variable is defined after the last + * used parameter. + */ +function isAfterLastUsedArg(variable, scopeManager) { + const def = variable.defs[0]; + const params = scopeManager.getDeclaredVariables(def.node); + const posteriorParams = params.slice(params.indexOf(variable) + 1); + + // If any used parameters occur after this parameter, do not report. + return !posteriorParams.some(v => v.references.length > 0 /*|| v.eslintUsed*/); +} + +/** + * Determines if the variable is used. + * @param {Variable} variable The variable to check. + * @returns {boolean} True if the variable is used + * @private + */ +function isUsedVariable(variable) { + const functionNodes = getFunctionDefinitions(variable); + const isFunctionDefinition = functionNodes.length > 0; + + let rhsNode = null; + + return variable.references.some(ref => { + if (isForInOfRef(ref)) { + return true; + } + + const forItself = isReadForItself(ref, rhsNode); + + rhsNode = getRhsNode(ref, rhsNode); + + return (isReadRef(ref) && !forItself && !(isFunctionDefinition && isSelfReference(ref, functionNodes))); + }); +} + +/** + * Gets a list of function definitions for a specified variable. + * @param {Variable} variable eslint-scope variable object. + * @returns {ASTNode[]} Function nodes. + * @private + */ +function getFunctionDefinitions(variable) { + const functionDefinitions = []; + + variable.defs.forEach(def => { + const { + type, + node + } = def; + + // FunctionDeclarations + if (type === "FunctionName") { + functionDefinitions.push(node); + } + + // FunctionExpressions + if (type === "Variable" && node.init && (node.init.type === "FunctionExpression" || node.init.type + === "ArrowFunctionExpression")) { + functionDefinitions.push(node.init); + } + }); + return functionDefinitions; +} + +/** + * Determine if an identifier is used either in for-in or for-of loops. + * @param {Reference} ref The reference to check. + * @returns {boolean} whether reference is used in the for-in loops + * @private + */ +function isForInOfRef(ref) { + //@ts-expect-error + let target = ref.identifier.parent; + + // "for (var ...) { return; }" + if (target.type === "VariableDeclarator") { + target = target.parent.parent; + } + + if (target.type !== "ForInStatement" && target.type !== "ForOfStatement") { + return false; + } + + // "for (...) { return; }" + if (target.body.type === "BlockStatement") { + target = target.body.body[0]; + + // "for (...) return;" + } + else { + target = target.body; + } + + // For empty loop body + if (!target) { + return false; + } + + return target.type === "ReturnStatement"; +} + +/** + * Checks whether a given reference is a read to update itself or not. + * @param {Reference} ref A reference to check. + * @param {ASTNode} rhsNode The RHS node of the previous assignment. + * @returns {boolean} The reference is a read to update itself. + * @private + */ +function isReadForItself(ref, rhsNode) { + const id = ref.identifier; + //@ts-expect-error + const parent = id.parent; + + return (ref.isRead() && // self update. e.g. `a += 1`, `a++` + ((parent.type === "AssignmentExpression" && parent.left === id && isUnusedExpression(parent) + && !astUtils.isLogicalAssignmentOperator(parent.operator)) || (parent.type === "UpdateExpression" + && isUnusedExpression(parent)) || // in RHS of an assignment for itself. e.g. `a = a + 1` + (rhsNode && isInside(id, rhsNode) && !isInsideOfStorableFunction(id, rhsNode)))); +} + +/** + * If a given reference is left-hand side of an assignment, this gets + * the right-hand side node of the assignment. + * + * In the following cases, this returns null. + * + * - The reference is not the LHS of an assignment expression. + * - The reference is inside of a loop. + * - The reference is inside of a function scope which is different from + * the declaration. + * @param {Reference} ref A reference to check. + * @param {ASTNode} prevRhsNode The previous RHS node. + * @returns {ASTNode|null} The RHS node or null. + * @private + */ +function getRhsNode(ref, prevRhsNode) { + const id = ref.identifier; + //@ts-expect-error + const parent = id.parent; + const refScope = ref.from.variableScope; + //@ts-expect-error + const varScope = ref.resolved.scope.variableScope; + const canBeUsedLater = refScope !== varScope || astUtils.isInLoop(id); + + /* + * Inherits the previous node if this reference is in the node. + * This is for `a = a + a`-like code. + */ + if (prevRhsNode && isInside(id, prevRhsNode)) { + return prevRhsNode; + } + + if (parent.type === "AssignmentExpression" && isUnusedExpression(parent) && id === parent.left && !canBeUsedLater) { + return parent.right; + } + return null; +} + +/** + * Determines if a reference is a read operation. + * @param {Reference} ref An eslint-scope Reference + * @returns {boolean} whether the given reference represents a read operation + * @private + */ +function isReadRef(ref) { + return ref.isRead(); +} + +/** + * Determine if an identifier is referencing an enclosing function name. + * @param {Reference} ref The reference to check. + * @param {ASTNode[]} nodes The candidate function nodes. + * @returns {boolean} True if it's a self-reference, false if not. + * @private + */ +function isSelfReference(ref, nodes) { + let scope = ref.from; + + while (scope) { + if (nodes.includes(scope.block)) { + return true; + } + //@ts-expect-error + scope = scope.upper; + } + + return false; +} + +/** + * Checks whether a given node is unused expression or not. + * @param {ASTNode} node The node itself + * @returns {boolean} The node is an unused expression. + * @private + */ +function isUnusedExpression(node) { + const parent = node.parent; + + if (parent.type === "ExpressionStatement") { + return true; + } + + if (parent.type === "SequenceExpression") { + const isLastExpression = parent.expressions.at(-1) === node; + + if (!isLastExpression) { + return true; + } + return isUnusedExpression(parent); + } + + return false; +} + +/** + * Checks the position of given nodes. + * @param {ASTNode} inner A node which is expected as inside. + * @param {ASTNode} outer A node which is expected as outside. + * @returns {boolean} `true` if the `inner` node exists in the `outer` node. + * @private + */ +function isInside(inner, outer) { + return (inner.range[0] >= outer.range[0] && inner.range[1] <= outer.range[1]); +} + +/** + * Checks whether a given Identifier node exists inside of a function node which can be used later. + * + * "can be used later" means: + * - the function is assigned to a variable. + * - the function is bound to a property and the object can be used later. + * - the function is bound as an argument of a function call. + * + * If a reference exists in a function which can be used later, the reference is read when the function is called. + * @param {ASTNode} id An Identifier node to check. + * @param {ASTNode} rhsNode The RHS node of the previous assignment. + * @returns {boolean | null} `true` if the `id` node exists inside of a function node which can be used later. + * @private + */ +function isInsideOfStorableFunction(id, rhsNode) { + const funcNode = astUtils.getUpperFunction(id); + + return (funcNode && isInside(funcNode, rhsNode) && isStorableFunction(funcNode, rhsNode)); +} + +/** + * Checks whether a given function node is stored to somewhere or not. + * If the function node is stored, the function can be used later. + * @param {ASTNode} funcNode A function node to check. + * @param {ASTNode} rhsNode The RHS node of the previous assignment. + * @returns {boolean} `true` if under the following conditions: + * - the funcNode is assigned to a variable. + * - the funcNode is bound as an argument of a function call. + * - the function is bound to a property and the object satisfies above conditions. + * @private + */ +function isStorableFunction(funcNode, rhsNode) { + let node = funcNode; + let parent = funcNode.parent; + + while (parent && isInside(parent, rhsNode)) { + switch (parent.type) { + case "SequenceExpression": + if (parent.expressions.at(-1) !== node) { + return false; + } + break; + + case "CallExpression": + case "NewExpression": + return parent.callee !== node; + + case "AssignmentExpression": + case "TaggedTemplateExpression": + case "YieldExpression": + return true; + + default: + if (STATEMENT_TYPE.test(parent.type)) { + /* + * If it encountered statements, this is a complex pattern. + * Since analyzing complex patterns is hard, this returns `true` to avoid false positive. + */ + return true; + } + } + + node = parent; + parent = parent.parent; + } + + return false; +} + +/** + * Determines if a given variable is being exported from a module. + * @param {Variable} variable eslint-scope variable object. + * @returns {boolean} True if the variable is exported, false if not. + * @private + */ +function isExported(variable) { + const definition = variable.defs[0]; + + if (definition) { + let node = definition.node; + + if (node.type === "VariableDeclarator") { + //@ts-expect-error + node = node.parent; + } + else if (definition.type === "Parameter") { + return false; + } + //@ts-expect-error + return node.parent.type.indexOf("Export") === 0; + } + return false; +} + +/** + * Determines if a variable has a sibling rest property + * @param {Variable} variable eslint-scope variable object. + * @returns {boolean} True if the variable has a sibling rest property, false if not. + * @private + */ +function hasRestSpreadSibling(variable) { + return false; +} + +/** + * Generate the warning message about the variable being + * assigned and unused, including the ignore pattern if configured. + * @param {Variable} unusedVar eslint-scope variable object. + * @returns {any} The message data to be used with this unused variable. + */ +function getAssignedMessageData(unusedVar) { + const def = unusedVar.defs && unusedVar.defs[0]; + let additionalMessageData = ""; + + if (def) { + const [variableDescription, pattern] = getVariableDescription(defToVariableType(def)); + + if (pattern && variableDescription) { + additionalMessageData = `. Allowed unused ${variableDescription} must match ${pattern}`; + } + } + + return { + varName: unusedVar.name, + action: "assigned a value", + additional: additionalMessageData + }; +} + +/** + * Gets a given variable's description and configured ignore pattern + * based on the provided variableType + * @param {any} variableType a simple name for the types of variables that this rule supports + * @throws {Error} (Unreachable) + * @returns {[string | undefined, string | undefined]} the given variable's description and + * ignore pattern + */ +function getVariableDescription(variableType) { + let pattern; + let variableDescription; + + switch (variableType) { + case "array-destructure": + variableDescription = "elements of array destructuring"; + break; + + case "catch-clause": + variableDescription = "caught errors"; + break; + + case "parameter": + variableDescription = "args"; + break; + + case "variable": + variableDescription = "vars"; + break; + + default: + throw new Error(`Unexpected variable type: ${variableType}`); + } + + return [variableDescription, pattern]; +} + +/** + * Determines what variable type a def is. + * @param {Object} def the declaration to check + * @returns {any} a simple name for the types of variables that this rule supports + */ +function defToVariableType(def) { + switch (def.type) { + case "CatchClause": + return "catch-clause"; + case "Parameter": + return "parameter"; + + default: + return "variable"; + } +} + +/** + * Generates the message data about the variable being defined and unused, + * including the ignore pattern if configured. + * @param {Variable} unusedVar eslint-scope variable object. + * @returns {any} The message data to be used with this unused variable. + */ +function getDefinedMessageData(unusedVar) { + const def = unusedVar.defs && unusedVar.defs[0]; + let additionalMessageData = ""; + + if (def) { + const [variableDescription, pattern] = getVariableDescription(defToVariableType(def)); + + if (pattern && variableDescription) { + additionalMessageData = `. Allowed unused ${variableDescription} must match ${pattern}`; + } + } + + return { + varName: unusedVar.name, + action: "defined", + additional: additionalMessageData + }; +} + +function toUnusedVarAnnotation(unusedVar) { + const node = unusedVar.identifiers?.[0]; + + if (!node?.loc?.start) { + return null; + } + + const data = unusedVar.references.some((ref) => ref.isWrite()) ? getAssignedMessageData(unusedVar) + : getDefinedMessageData(unusedVar); + + return { + row: node.loc.start.line - 1, + column: node.loc.start.column, + text: astUtils.interpolate(UNUSED_VAR_MESSAGE, data), + type: "info" + }; +} + +const UNUSED_VAR_MESSAGE = "'{{varName}}' is {{action}} but never used{{additional}}."; + + + +/** + * Convert found unused variables into ace annotations + * @param {Scope} scope + * @param {ScopeManager} scopeManager + * @return {*[]} + */ +export function getAnnotations(scope, scopeManager) { + var unusedVars = collectUnusedVariables(scope, [], scopeManager); + var annotations = []; + + for (let i = 0, l = unusedVars.length; i < l; ++i) { + const unusedVar = unusedVars[i]; + + // Report the first declaration. + if (unusedVar.defs.length > 0) { + // report last write reference, https://github.com/eslint/eslint/issues/14324 + const writeReferences = unusedVar.references.filter( + ref => ref.isWrite() && ref.from.variableScope === unusedVar.scope.variableScope); + + let referenceToReport; + + if (writeReferences.length > 0) { + referenceToReport = writeReferences.at(-1); + } + + var transpiled = toUnusedVarAnnotation(unusedVar); + if (transpiled) { + annotations.push(toUnusedVarAnnotation(unusedVar)); + } + } + } + + return annotations; +} diff --git a/packages/ace-legacy-linters/src/workers/eslint-rules/scopes-analyzer.ts b/packages/ace-legacy-linters/src/workers/eslint-rules/scopes-analyzer.ts new file mode 100644 index 00000000..60e64ca4 --- /dev/null +++ b/packages/ace-legacy-linters/src/workers/eslint-rules/scopes-analyzer.ts @@ -0,0 +1,121 @@ +import {analyze, ScopeManager} from "eslint-scope"; +import * as unusedVars from "./no-unused-vars"; +import * as undef from "./no-undef"; +import {Ace} from "ace-code"; + +export interface JsOptions { + /** + * Rule to disallow unused variables. + * @default true + */ + "no-unused-vars"?: boolean + /** + * Rule to disallow the use of undeclared variables + * @default true + */ + "no-undef"?: boolean + /** + * Indicate the mode the code should be parsed in. Can be one of "script", "commonjs", "module", or "unambiguous". + * "unambiguous" will make @babel/parser attempt to guess, based on the presence of ES6 import or export statements. + * Files with ES6 imports and exports are considered "module" and are otherwise "script". + * + * Use "commonjs" to parse code that is intended to be run in a CommonJS environment such as Node.js. + * @default "unambiguous" + */ + sourceType?: "script" | "commonjs" | "module" | "unambiguous", + /** + * to parse jsx or not + * @default true + */ + jsx?: boolean +} + +export class ScopesAnalyzer { + private options: JsOptions; + scopeManager: ScopeManager; + + constructor(options: JsOptions) { + this.options = options; + } + + setOptions(options: JsOptions) { + this.options = options; + } + + analyze(program: any) { + attachParents(program); + var annotations: Ace.Annotation[] = []; + + this.scopeManager = analyze(program, { + ecmaVersion: 2024, + sourceType: program.sourceType, + jsx: this.options.jsx, + }); + var scope = this.getScope(this.scopeManager.scopes[0]); + if (this.options["no-unused-vars"]) { + if (this.scopeManager.scopes && this.scopeManager.scopes.length > 0) { + annotations = [...annotations, ...unusedVars.getAnnotations(scope, this.scopeManager)]; + } + } + if (this.options["no-undef"]) { + if (this.scopeManager.scopes && this.scopeManager.scopes.length > 0) { + annotations = [...annotations, ...undef.getAnnotations(scope, this.scopeManager)]; + } + } + + return annotations; + } + + private getScope(currentNode) { + if (!currentNode) { + throw new TypeError("Missing required argument: node."); + } + const inner = currentNode.type !== "Program"; + + for (let node = currentNode; node; node = node.parent) { + const scope = this.scopeManager.acquire(node, inner); + + if (scope) { + if (scope.type === "function-expression-name") { + return scope.childScopes[0]; + } + + return scope; + } + } + + return this.scopeManager.scopes[0]; + } + +} + +function attachParents(node: any, parent: any = null): void { + if (!node || typeof node !== "object") { + return; + } + + Object.defineProperty(node, "parent", { + value: parent, + writable: true, + configurable: true, + enumerable: false, + }); + + for (const key of Object.keys(node)) { + if (key === "parent") { + continue; + } + + const value = node[key]; + + if (Array.isArray(value)) { + for (const child of value) { + if (child && typeof child === "object" && typeof child.type === "string") { + attachParents(child, node); + } + } + } else if (value && typeof value === "object" && typeof value.type === "string") { + attachParents(value, node); + } + } +} diff --git a/packages/ace-legacy-linters/src/workers/html-worker.ts b/packages/ace-legacy-linters/src/workers/html-worker.ts new file mode 100644 index 00000000..89f6defe --- /dev/null +++ b/packages/ace-legacy-linters/src/workers/html-worker.ts @@ -0,0 +1,65 @@ +import {Mirror} from "../mirror"; +import {Ace} from "ace-code"; +import {HTMLHint} from 'htmlhint'; +import {Ruleset} from "htmlhint/dist/core/types"; + +export class HtmlWorker extends Mirror { + parser; + + defaultValidationOptions: Ruleset = { + "attr-no-duplication": true, + "body-no-duplicates": true, + "head-body-descendents-html": true, + "head-no-duplicates": true, + "head-valid-children": true, + "html-no-duplicates": true, + "html-root-node": true, + "html-valid-children": true, + "html-valid-children-order": true, + "img-src-required": true, + "invalid-attribute-char": true, + "nested-paragraphs": true, + "spec-char-escape": true, + "src-not-empty": true, + "tag-pair": true + } + + validationOptions: Ruleset; + + constructor(sender) { + super(sender); + + this.setTimeout(500); + + this.parser = HTMLHint; + } + + setOptions(options: {context?, validationOptions: Ruleset}) { + if (options && options.context) { //legacy options + delete options.context; + } + + this.validationOptions = options.validationOptions; + }; + + onUpdate() { + var value = this.doc.getValue(); + var errors: Ace.Annotation[] = []; + + try { + let options = this.validationOptions ?? this.defaultValidationOptions; + errors = this.parser.verify(value, options).map(el => { + return { + row: el.line - 1, + column: el.col - 1, + text: el.message, + type: el.type === "error" ? "error" : el.type === "warning" ? "warning" : "info", + }; + + }) + } catch(e) { + console.error(e); + } + this.sender.emit("error", errors); + } +} \ No newline at end of file diff --git a/packages/ace-legacy-linters/src/workers/javascript-worker.ts b/packages/ace-legacy-linters/src/workers/javascript-worker.ts new file mode 100644 index 00000000..50b6df89 --- /dev/null +++ b/packages/ace-legacy-linters/src/workers/javascript-worker.ts @@ -0,0 +1,77 @@ +import {parse, ParseError} from "@babel/parser"; +import {Mirror} from "../mirror"; +import {Ace} from "ace-code"; +import {JsOptions, ScopesAnalyzer} from "./eslint-rules/scopes-analyzer"; + +export class JavaScriptWorker extends Mirror { + options: JsOptions; + analyzer: ScopesAnalyzer + + constructor(sender) { + super(sender); + this.setTimeout(500); + this.setOptions(); + this.analyzer = new ScopesAnalyzer(this.options); + } + + setOptions(options?: JsOptions) { + this.options = options || { + "no-unused-vars": true, + "no-undef": true, + sourceType: "unambiguous", + jsx: true + }; + if (this.analyzer) { + this.analyzer.setOptions(this.options); + } + } + + onUpdate() { + var value = this.doc.getValue(); + var errors: Ace.Annotation[] = []; + let ast; + try { + var plugins = ["estree"] + if (this.options.jsx) { + plugins.push("jsx"); + } + ast = parse(value, { + sourceType: this.options.sourceType, + errorRecovery: true, + plugins: plugins as any, + ranges: true, + strictMode: true, + allowReturnOutsideFunction: true, + }); + + errors = ast.errors?.map(err => ({ + row: err.loc.line - 1, + column: err.loc.column, + text: err.message, + type: "error", + })); + } catch (e) { + if ((e as ParseError) instanceof SyntaxError) { + var syntaxError: Ace.Annotation = { + row: e.loc.line - 1, + column: e.loc.column, + text: e.message, + type: "error", + }; + errors.push(syntaxError); + } else { + console.error(e); + } + } + + try { + if (ast && ast.program) { + const result = this.analyzer.analyze(ast.program); + errors = [...errors, ...result]; + } + } catch (e) { + console.warn(e); + } + this.sender.emit("annotate", errors); + } +} \ No newline at end of file diff --git a/packages/ace-legacy-linters/src/workers/json-diagnostics-service.ts b/packages/ace-legacy-linters/src/workers/json-diagnostics-service.ts new file mode 100644 index 00000000..48fb5278 --- /dev/null +++ b/packages/ace-legacy-linters/src/workers/json-diagnostics-service.ts @@ -0,0 +1,26 @@ +import {JSONValidation} from 'vscode-json-languageservice/lib/esm/services/jsonValidation'; +import {parse as parseJSON} from 'vscode-json-languageservice/lib/esm/parser/jsonParser'; +import {schemaContributions} from 'vscode-json-languageservice/lib/esm/services/configuration'; +import {JSONSchemaService} from 'vscode-json-languageservice/lib/esm/services/jsonSchemaService'; +import {LanguageService} from "vscode-json-languageservice"; + +export type JsonDiagnosticsService = Pick + +export function getJsonDiagnosticsService(params): JsonDiagnosticsService { + const promise = Promise; + const jsonSchemaService = new JSONSchemaService(params.schemaRequestService, params.workspaceContext, promise); + jsonSchemaService.setSchemaContributions(schemaContributions); + const jsonValidation = new JSONValidation(jsonSchemaService, promise); + return { + configure: (settings) => { + jsonSchemaService.clearExternalSchemas(); + settings.schemas?.forEach(jsonSchemaService.registerExternalSchema.bind(jsonSchemaService)); + jsonValidation.configure(settings); + }, + resetSchema: (uri) => jsonSchemaService.onResourceChange(uri), + doValidation: jsonValidation.doValidation.bind(jsonValidation), + getLanguageStatus: jsonValidation.getLanguageStatus.bind(jsonValidation), + parseJSONDocument: (document) => parseJSON(document, {collectComments: true}), + getMatchingSchemas: jsonSchemaService.getMatchingSchemas.bind(jsonSchemaService), + }; +} diff --git a/packages/ace-legacy-linters/src/workers/json-worker.ts b/packages/ace-legacy-linters/src/workers/json-worker.ts new file mode 100644 index 00000000..ac43ef49 --- /dev/null +++ b/packages/ace-legacy-linters/src/workers/json-worker.ts @@ -0,0 +1,57 @@ +import {Mirror} from "../mirror"; +import {Ace} from "ace-code"; +import {JsonDiagnosticsService, getJsonDiagnosticsService} from "./json-diagnostics-service"; +import {MinTextDocument} from "../vscode-text-document-min"; +import {toAnnotations} from "../utils"; + +export class JsonWorker extends Mirror { + service: JsonDiagnosticsService; + isJson5?: boolean; + + constructor(sender) { + super(sender); + + this.setTimeout(500); + + var params = { + schemaRequestService: (uri) => { + return; + }, + workspaceContext: { + resolveRelativePath: (relativePath: string, resource: string) => { + return; + } + }, + } + + this.service = getJsonDiagnosticsService(params); + this.$configureService(); + } + + $configureService() { + this.service.configure({ + allowComments: this.isJson5, + validate: true + }); + } + + setOptions(opts) { + this.isJson5 = opts && opts.isJson5; + this.$configureService(); + } + + async onUpdate() { + var value = this.doc.getValue(); + var errors: Ace.Annotation[] = []; + + var fullDocument = new MinTextDocument("file:///foo.json", "json", 1, value); + + try { + let jsonDocument = this.service.parseJSONDocument(fullDocument); + errors = toAnnotations(await this.service.doValidation(fullDocument, jsonDocument, {trailingCommas: this.isJson5 ? "ignore" : "error"})); + } catch (e) { + console.error(e); + } + this.sender.emit("annotate", errors); + } +} \ No newline at end of file diff --git a/packages/ace-legacy-linters/src/workers/lua-worker.ts b/packages/ace-legacy-linters/src/workers/lua-worker.ts new file mode 100644 index 00000000..b19b78bb --- /dev/null +++ b/packages/ace-legacy-linters/src/workers/lua-worker.ts @@ -0,0 +1,34 @@ +import * as lua from "luaparse"; +import {Mirror} from "../mirror"; +import {Ace} from "ace-code"; + +export class LuaWorker extends Mirror { + parser; + + constructor(sender) { + super(sender); + + this.setTimeout(500); + + this.parser = lua; + } + + onUpdate() { + var value = this.doc.getValue(); + var errors: Ace.Annotation[] = []; + + try { + this.parser.parse(value); + } catch(e) { + if (e instanceof this.parser.SyntaxError) { + errors.push({ + row: e.line - 1, + column: e.column, + text: e.message, + type: "error" + }); + } + } + this.sender.emit("annotate", errors); + } +} \ No newline at end of file diff --git a/packages/ace-legacy-linters/src/workers/php-worker.ts b/packages/ace-legacy-linters/src/workers/php-worker.ts new file mode 100644 index 00000000..f27c6156 --- /dev/null +++ b/packages/ace-legacy-linters/src/workers/php-worker.ts @@ -0,0 +1,64 @@ +import {Mirror} from "../mirror"; + +import {Engine} from "php-parser"; + +export class PhpWorker extends Mirror { + parser: Engine; + inlinePhp: boolean = false; + + constructor(sender) { + super(sender); + + this.setTimeout(500); + + this.parser = new Engine({ + parser: { + extractDoc: false, + suppressErrors: true, + }, + ast: { + withPositions: false, + withSource: false, + }, + lexer: { + all_tokens: false, + comment_tokens: false, + mode_eval: false, + asp_tags: false, + short_tags: true, + }, + }); + } + + setOptions(opts) { + this.inlinePhp = opts && opts.inline; + } + + onUpdate() { + var value = this.doc.getValue(); + var errors = []; + + try { + let result; + if (this.inlinePhp) { + result = this.parser.parseEval(value); + } else { + result = this.parser.parseCode(value, "foo.php"); + } + if (result && result.errors) { + errors = result.errors.map((el) => { + return { + row: el.line - 1, + column: null, + text: el.message, + type: "error", + }; + }); + } + } catch (e) { + console.error(e); + } + + this.sender.emit("annotate", errors); + } +} \ No newline at end of file diff --git a/packages/ace-legacy-linters/src/workers/xml-worker.ts b/packages/ace-legacy-linters/src/workers/xml-worker.ts new file mode 100644 index 00000000..787d763a --- /dev/null +++ b/packages/ace-legacy-linters/src/workers/xml-worker.ts @@ -0,0 +1,105 @@ +import {Mirror} from "../mirror"; +import {Ace} from "ace-code"; +import {DocumentCstNode, parse} from "@xml-tools/parser"; +import {buildAst} from "@xml-tools/ast"; +import {checkConstraints} from "@xml-tools/constraints"; +import {AttributeValidator, ElementValidator, validate} from "@xml-tools/validation"; +import {namespaceValidator} from "ace-linters/src/services/xml/validators"; +import {MinDocument} from "../min-document"; + +export class XmlWorker extends Mirror { + parser; + + constructor(sender) { + super(sender); + + this.setTimeout(500); + } + + onUpdate() { + var value = this.doc.getValue(); + var errors: Ace.Annotation[] = []; + + if (!/^\s*$/s.test(value)) { + try { + const {cst, tokenVector, lexErrors, parseErrors} = parse( + value + ); + const xmlDoc = buildAst(cst as DocumentCstNode, tokenVector); + const constraintsIssues = checkConstraints(xmlDoc as any); + + const elementValidators: ElementValidator[] = [namespaceValidator]; + const attributeValidators: AttributeValidator[] = []; + + const customIssues = validate({ + doc: xmlDoc, + validators: { + element: elementValidators, + attribute: attributeValidators, + }, + }); + + errors = [ + ...lexingErrorsToDiagnostic( + lexErrors, + this.doc, + ), + ...parsingErrorsToDiagnostic( + parseErrors, + this.doc, + ), + ...issuesToDiagnostic( + constraintsIssues, + this.doc, + ), + ...issuesToDiagnostic( + customIssues, + this.doc, + ), + ]; + } catch (e) { + console.error(e); + } + } + + this.sender.emit("error", errors); + } +} + +export function lexingErrorsToDiagnostic(errors: any[], document: MinDocument): Ace.Annotation[] { + return errors.map((el) => { + var position = document.indexToPosition(el.offset); + + return { + text: el.message, + row: position.row, + column: position.column, + type: el.severity ?? "error", + }; + }); +} + +export function parsingErrorsToDiagnostic(errors: any[], document: MinDocument): Ace.Annotation[] { + return errors.map((el) => { + var position = document.indexToPosition(el.token.startOffset); + return { + text: el.message, + row: position.row, + column: position.column, + type: el.severity ?? "error", + }; + }); +} + +export function issuesToDiagnostic(errors: any[], document: MinDocument): Ace.Annotation[] { + return errors.map((el) => { + var position = document.indexToPosition(el.position.startOffset); + + return { + text: el.msg, + row: position.row, + column: position.column, + type: el.severity ?? "error", + }; + }); +} \ No newline at end of file diff --git a/packages/ace-legacy-linters/src/workers/yaml-worker.ts b/packages/ace-legacy-linters/src/workers/yaml-worker.ts new file mode 100644 index 00000000..76ca4bf5 --- /dev/null +++ b/packages/ace-legacy-linters/src/workers/yaml-worker.ts @@ -0,0 +1,49 @@ +import {Mirror} from "../mirror"; +import {Ace} from "ace-code"; +import {parseAllDocuments, YAMLError} from "yaml"; + +export class YamlWorker extends Mirror { + + constructor(sender) { + super(sender); + + this.setTimeout(500); + } + + async onUpdate() { + var value = this.doc.getValue(); + var errors: Ace.Annotation[] = []; + + try { + var diagnostics: YAMLError[] = [] + var yamlAllDocuments = parseAllDocuments(value, { + prettyErrors: false + }); + yamlAllDocuments.forEach(doc => { + diagnostics.push(...doc.errors, ...doc.warnings); + }) + errors = diagnostics.map((diagnostic) => { + var start = diagnostic.linePos?.[0]; + var row, column; + if (start) { + row = start && start.line > 0 ? start.line : 0; + column = start && start.col > 0 ? start.line : 0; + } else { + var pos = this.doc.indexToPosition(diagnostic.pos[0]); + row = pos.row; + column = pos.column; + } + + return { + row, + column, + text: diagnostic.message, + type: diagnostic.name === "YAMLWarning" ? "warning" : "error" + }; + }); + } catch (e) { + console.error(e); + } + this.sender.emit("annotate", errors); + } +} diff --git a/packages/ace-legacy-linters/tests/javascript-worker.tests.ts b/packages/ace-legacy-linters/tests/javascript-worker.tests.ts new file mode 100644 index 00000000..6aec638c --- /dev/null +++ b/packages/ace-legacy-linters/tests/javascript-worker.tests.ts @@ -0,0 +1,178 @@ +import {expect} from "chai"; +import {Ace} from "ace-code"; +import {JavaScriptWorker} from "../src/workers/javascript-worker"; +import {JsOptions} from "../src/workers/eslint-rules/scopes-analyzer"; +import {MockWorker} from "ace-linters/src/misc/mock-worker"; + +function createWorker(options?: JsOptions) { + const sender = new MockWorker(true); + const emitted: Array<{name: string, data: Ace.Annotation[]}> = []; + const worker = new JavaScriptWorker(sender); + + sender.on("annotate", (data) => { + emitted.push({name: "annotate", data}); + }); + + if (options) { + worker.setOptions(options); + } + + return {sender, worker, emitted}; +} + +function annotate(code: string, options?: JsOptions) { + const {worker, emitted} = createWorker(options); + worker.doc.setValue(code); + worker.onUpdate(); + + const annotationEvent = [...emitted].reverse().find((event) => event.name === "annotate"); + + expect(annotationEvent, "worker should emit annotate").to.exist; + return annotationEvent!.data; +} + +function texts(annotations: Ace.Annotation[]) { + return annotations.map((annotation) => annotation.text); +} + +function textsByType(annotations: Ace.Annotation[], type: Ace.Annotation["type"]) { + return annotations + .filter((annotation) => annotation.type === type) + .map((annotation) => annotation.text); +} + +function errorTexts(annotations: Ace.Annotation[]) { + return textsByType(annotations, "error"); +} + +function hasAnnotationForVariable( + annotations: Ace.Annotation[], + type: Ace.Annotation["type"], + variableName: string, + pattern?: RegExp +) { + return annotations.some((annotation) => + annotation.type === type && + new RegExp(`['"]${variableName}['"]`).test(annotation.text) && + (!pattern || pattern.test(annotation.text)) + ); +} + +describe("JavaScriptWorker", () => { + describe("rule annotations", () => { + it("reports no-unused-vars by default", () => { + const annotations = annotate("const foo = 1;"); + + expect(hasAnnotationForVariable(annotations, "info", "foo", /never used/i)).to.equal(true); + }); + + it("reports no-undef by default", () => { + const annotations = annotate("foo = 1;"); + + expect(hasAnnotationForVariable(annotations, "warning", "foo", /not defined/i)).to.equal(true); + }); + + it("can disable no-unused-vars while keeping no-undef", () => { + const annotations = annotate("const foo = bar;", { + "no-unused-vars": false, + "no-undef": true, + sourceType: "module" + }); + + expect(hasAnnotationForVariable(annotations, "info", "foo", /never used/i)).to.equal(false); + expect(hasAnnotationForVariable(annotations, "warning", "bar", /not defined/i)).to.equal(true); + }); + + it("can disable no-undef while keeping no-unused-vars", () => { + const annotations = annotate("const foo = bar;", { + "no-unused-vars": true, + "no-undef": false, + sourceType: "module" + }); + + expect(hasAnnotationForVariable(annotations, "info", "foo", /never used/i)).to.equal(true); + expect(hasAnnotationForVariable(annotations, "warning", "bar", /not defined/i)).to.equal(false); + }); + + it("updates analyzer behavior when options change on the same worker", () => { + const {worker, emitted} = createWorker(); + + worker.doc.setValue("const foo = bar;"); + worker.onUpdate(); + + let first = emitted.at(-1)?.data || []; + expect(hasAnnotationForVariable(first, "info", "foo", /never used/i)).to.equal(true); + expect(hasAnnotationForVariable(first, "warning", "bar", /not defined/i)).to.equal(true); + + worker.setOptions({ + "no-unused-vars": false, + "no-undef": true, + sourceType: "module" + }); + worker.doc.setValue("const foo = bar;"); + worker.onUpdate(); + + let second = emitted.at(-1)?.data || []; + expect(hasAnnotationForVariable(second, "info", "foo", /never used/i)).to.equal(false); + expect(hasAnnotationForVariable(second, "warning", "bar", /not defined/i)).to.equal(true); + }); + + it("handles jsx fragments without overflowing analyze", () => { + const annotations = annotate("const View = <>; const foo = bar;"); + + expect(errorTexts(annotations)).to.deep.equal([]); + expect(hasAnnotationForVariable(annotations, "info", "View", /never used/i)).to.equal(true); + expect(hasAnnotationForVariable(annotations, "info", "foo", /never used/i)).to.equal(true); + expect(hasAnnotationForVariable(annotations, "warning", "bar", /not defined/i)).to.equal(true); + }); + }); + + describe("parser errors", () => { + it("reports recoverable parser errors from ast.errors", () => { + const annotations = annotate("class A { #x; #x; }"); + + expect(errorTexts(annotations).length).to.be.greaterThan(0); + expect(errorTexts(annotations).some((text) => /#x/.test(text))).to.equal(true); + }); + + it("can report several parser errors from ast.errors", () => { + const annotations = annotate([ + "\"use strict\";", + "let first = 1;", + "let first = 2;", + "let second = 3;", + "let second = 4;", + ].join("\n")); + + const errors = errorTexts(annotations); + + expect(errors.length).to.be.greaterThan(1); + expect(errors.some((text) => /['"]first['"].*already been declared/i.test(text))).to.equal(true); + expect(errors.some((text) => /['"]second['"].*already been declared/i.test(text))).to.equal(true); + }); + + it("reports thrown syntax errors", () => { + const annotations = annotate("const value = ;"); + + expect(errorTexts(annotations).length).to.be.greaterThan(0); + }); + + it("allows return outside function without parser errors", () => { + const annotations = annotate("return 1;"); + + expect(errorTexts(annotations)).to.deep.equal([]); + }); + + it("reports recoverable parser errors together with scope-analyzer annotations", () => { + const annotations = annotate([ + "({ __proto__: 1, __proto__: 2 });", + "const foo = bar;", + ].join("\n")); + + expect(errorTexts(annotations).length).to.be.greaterThan(0); + expect(errorTexts(annotations).some((text) => /__proto__/i.test(text))).to.equal(true); + expect(hasAnnotationForVariable(annotations, "info", "foo", /never used/i)).to.equal(true); + expect(hasAnnotationForVariable(annotations, "warning", "bar", /not defined/i)).to.equal(true); + }); + }); +}); diff --git a/packages/ace-legacy-linters/tsconfig.json b/packages/ace-legacy-linters/tsconfig.json new file mode 100644 index 00000000..bc36c2be --- /dev/null +++ b/packages/ace-legacy-linters/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "skipLibCheck": true, + "outDir": "./out", + "allowJs": true, + "checkJs": true, + "strictNullChecks": true, + "target": "es2019", + "allowSyntheticDefaultImports": true, + "sourceMap": true, + "module": "CommonJS", + "moduleResolution": "node", + "esModuleInterop": true, + "declaration": true, + "declarationDir": "./types", + "noEmit": true, + "types": ["mocha", "node"] + }, + "ts-node": { + "transpileOnly": true + }, + "exclude": [ + "node_modules" + ], + "include": [ + "./src/**/*", + "./tests/**/*" + ] +} diff --git a/packages/ace-linters/src/services/yaml/lib/index.js b/packages/ace-linters/src/services/yaml/lib/index.js index af1cbc61..edfb9276 100644 --- a/packages/ace-linters/src/services/yaml/lib/index.js +++ b/packages/ace-linters/src/services/yaml/lib/index.js @@ -4,6 +4,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; +var __typeError = (msg) => { + throw TypeError(msg); +}; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; @@ -33,6 +36,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); +var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); +var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); +var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); +var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); +var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method); // ../../node_modules/vscode-languageserver-types/lib/esm/main.js var main_exports = {}; @@ -1578,7 +1586,7 @@ var require_path_browserify = __commonJS({ } return dir + sep + base; } - var posix = { + var posix2 = { // path.resolve([from ...], to) resolve: function resolve2() { var resolvedPath = ""; @@ -1643,14 +1651,14 @@ var require_path_browserify = __commonJS({ } if (joined === void 0) return "."; - return posix.normalize(joined); + return posix2.normalize(joined); }, relative: function relative(from, to) { assertPath(from); assertPath(to); if (from === to) return ""; - from = posix.resolve(from); - to = posix.resolve(to); + from = posix2.resolve(from); + to = posix2.resolve(to); if (from === to) return ""; var fromStart = 1; for (; fromStart < from.length; ++fromStart) { @@ -1897,8 +1905,8 @@ var require_path_browserify = __commonJS({ win32: null, posix: null }; - posix.posix = posix; - module.exports = posix; + posix2.posix = posix2; + module.exports = posix2; } }); @@ -1959,7 +1967,7 @@ var require_code = __commonJS({ }; exports._Code = _Code; exports.nil = new _Code(""); - function _2(strs, ...args) { + function _(strs, ...args) { const code = [strs[0]]; let i = 0; while (i < args.length) { @@ -1968,7 +1976,7 @@ var require_code = __commonJS({ } return new _Code(code); } - exports._ = _2; + exports._ = _; var plus = new _Code("+"); function str(strs, ...args) { const expr = [safeStringify(strs[0])]; @@ -2039,7 +2047,7 @@ var require_code = __commonJS({ } exports.safeStringify = safeStringify; function getProperty(key) { - return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _2`[${key}]`; + return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _`[${key}]`; } exports.getProperty = getProperty; function getEsmExportName(key) { @@ -3739,8 +3747,8 @@ var require_keyword = __commonJS({ var _a; const { gen, keyword, schema: schema4, parentSchema, $data, it } = cxt; checkAsyncKeyword(it, def); - const validate3 = !$data && def.compile ? def.compile.call(it.self, schema4, parentSchema, it) : def.validate; - const validateRef = useKeyword(gen, keyword, validate3); + const validate2 = !$data && def.compile ? def.compile.call(it.self, schema4, parentSchema, it) : def.validate; + const validateRef = useKeyword(gen, keyword, validate2); const valid = gen.let("valid"); cxt.block$data(valid, validateKeyword); cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid); @@ -4136,7 +4144,7 @@ var require_resolve = __commonJS({ const pathPrefix = getFullPath(uriResolver, schId, false); const localRefs = {}; const schemaRefs = /* @__PURE__ */ new Set(); - traverse(schema4, { allKeys: true }, (sch, jsonPtr, _2, parentJsonPtr) => { + traverse(schema4, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => { if (parentJsonPtr === void 0) return; const fullPath = pathPrefix + jsonPtr; @@ -4813,28 +4821,28 @@ var require_compile = __commonJS({ if (this.opts.code.process) sourceCode = this.opts.code.process(sourceCode, sch); const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode); - const validate3 = makeValidate(this, this.scope.get()); - this.scope.value(validateName, { ref: validate3 }); - validate3.errors = null; - validate3.schema = sch.schema; - validate3.schemaEnv = sch; + const validate2 = makeValidate(this, this.scope.get()); + this.scope.value(validateName, { ref: validate2 }); + validate2.errors = null; + validate2.schema = sch.schema; + validate2.schemaEnv = sch; if (sch.$async) - validate3.$async = true; + validate2.$async = true; if (this.opts.code.source === true) { - validate3.source = { validateName, validateCode, scopeValues: gen._values }; + validate2.source = { validateName, validateCode, scopeValues: gen._values }; } if (this.opts.unevaluated) { const { props, items } = schemaCxt; - validate3.evaluated = { + validate2.evaluated = { props: props instanceof codegen_1.Name ? void 0 : props, items: items instanceof codegen_1.Name ? void 0 : items, dynamicProps: props instanceof codegen_1.Name, dynamicItems: items instanceof codegen_1.Name }; - if (validate3.source) - validate3.source.evaluated = (0, codegen_1.stringify)(validate3.evaluated); + if (validate2.source) + validate2.source.evaluated = (0, codegen_1.stringify)(validate2.evaluated); } - sch.validate = validate3; + sch.validate = validate2; return sch; } catch (e) { delete sch.validate; @@ -8653,289 +8661,1570 @@ var require_dist = __commonJS({ } }); -// ../../node_modules/prettier/plugins/yaml.js -var require_yaml = __commonJS({ - "../../node_modules/prettier/plugins/yaml.js"(exports, module) { - (function(f2) { - function e() { - var i = f2(); - return i.default || i; +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +var require_dynamicAnchor = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.dynamicAnchor = void 0; + var codegen_1 = require_codegen(); + var names_1 = require_names(); + var compile_1 = require_compile(); + var ref_1 = require_ref(); + var def = { + keyword: "$dynamicAnchor", + schemaType: "string", + code: (cxt) => dynamicAnchor(cxt, cxt.schema) + }; + function dynamicAnchor(cxt, anchor) { + const { gen, it } = cxt; + it.schemaEnv.root.dynamicAnchors[anchor] = true; + const v = (0, codegen_1._)`${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`; + const validate2 = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt); + gen.if((0, codegen_1._)`!${v}`, () => gen.assign(v, validate2)); + } + exports.dynamicAnchor = dynamicAnchor; + function _getValidate(cxt) { + const { schemaEnv, schema: schema4, self: self2 } = cxt.it; + const { root, baseId, localRefs, meta } = schemaEnv.root; + const { schemaId } = self2.opts; + const sch = new compile_1.SchemaEnv({ schema: schema4, schemaId, root, baseId, localRefs, meta }); + compile_1.compileSchema.call(self2, sch); + return (0, ref_1.getValidate)(cxt, sch); + } + exports.default = def; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +var require_dynamicRef = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.dynamicRef = void 0; + var codegen_1 = require_codegen(); + var names_1 = require_names(); + var ref_1 = require_ref(); + var def = { + keyword: "$dynamicRef", + schemaType: "string", + code: (cxt) => dynamicRef(cxt, cxt.schema) + }; + function dynamicRef(cxt, ref) { + const { gen, keyword, it } = cxt; + if (ref[0] !== "#") + throw new Error(`"${keyword}" only supports hash fragment reference`); + const anchor = ref.slice(1); + if (it.allErrors) { + _dynamicRef(); + } else { + const valid = gen.let("valid", false); + _dynamicRef(valid); + cxt.ok(valid); } - if (typeof exports == "object" && typeof module == "object") module.exports = e(); - else if (typeof define == "function" && define.amd) define(e); - else { - var t2 = typeof globalThis < "u" ? globalThis : typeof global < "u" ? global : typeof self < "u" ? self : this || {}; - t2.prettierPlugins = t2.prettierPlugins || {}, t2.prettierPlugins.yaml = e(); + function _dynamicRef(valid) { + if (it.schemaEnv.root.dynamicAnchors[anchor]) { + const v = gen.let("_v", (0, codegen_1._)`${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`); + gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid)); + } else { + _callRef(it.validateName, valid)(); + } } - })(function() { - "use strict"; - var Ti = Object.create; - var yt = Object.defineProperty; - var Ci = Object.getOwnPropertyDescriptor; - var Mi = Object.getOwnPropertyNames; - var ki = Object.getPrototypeOf, vi = Object.prototype.hasOwnProperty; - var te = (t2, e) => () => (e || t2((e = { exports: {} }).exports, e), e.exports), nr = (t2, e) => { - for (var n in e) yt(t2, n, { get: e[n], enumerable: true }); - }, rr = (t2, e, n, r) => { - if (e && typeof e == "object" || typeof e == "function") for (let s of Mi(e)) !vi.call(t2, s) && s !== n && yt(t2, s, { get: () => e[s], enumerable: !(r = Ci(e, s)) || r.enumerable }); - return t2; - }; - var sr = (t2, e, n) => (n = t2 != null ? Ti(ki(t2)) : {}, rr(e || !t2 || !t2.__esModule ? yt(n, "default", { value: t2, enumerable: true }) : n, t2)), Ii = (t2) => rr(yt({}, "__esModule", { value: true }), t2); - var le = te((U) => { - "use strict"; - var re = { ANCHOR: "&", COMMENT: "#", TAG: "!", DIRECTIVES_END: "-", DOCUMENT_END: "." }, lt = { ALIAS: "ALIAS", BLANK_LINE: "BLANK_LINE", BLOCK_FOLDED: "BLOCK_FOLDED", BLOCK_LITERAL: "BLOCK_LITERAL", COMMENT: "COMMENT", DIRECTIVE: "DIRECTIVE", DOCUMENT: "DOCUMENT", FLOW_MAP: "FLOW_MAP", FLOW_SEQ: "FLOW_SEQ", MAP: "MAP", MAP_KEY: "MAP_KEY", MAP_VALUE: "MAP_VALUE", PLAIN: "PLAIN", QUOTE_DOUBLE: "QUOTE_DOUBLE", QUOTE_SINGLE: "QUOTE_SINGLE", SEQ: "SEQ", SEQ_ITEM: "SEQ_ITEM" }, Ao = "tag:yaml.org,2002:", To = { MAP: "tag:yaml.org,2002:map", SEQ: "tag:yaml.org,2002:seq", STR: "tag:yaml.org,2002:str" }; - function Ps(t2) { - let e = [0], n = t2.indexOf(` -`); - for (; n !== -1; ) n += 1, e.push(n), n = t2.indexOf(` -`, n); - return e; + function _callRef(validate2, valid) { + return valid ? () => gen.block(() => { + (0, ref_1.callRef)(cxt, validate2); + gen.let(valid, true); + }) : () => (0, ref_1.callRef)(cxt, validate2); + } + } + exports.dynamicRef = dynamicRef; + exports.default = def; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +var require_recursiveAnchor = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var dynamicAnchor_1 = require_dynamicAnchor(); + var util_1 = require_util(); + var def = { + keyword: "$recursiveAnchor", + schemaType: "boolean", + code(cxt) { + if (cxt.schema) + (0, dynamicAnchor_1.dynamicAnchor)(cxt, ""); + else + (0, util_1.checkStrictMode)(cxt.it, "$recursiveAnchor: false is ignored"); + } + }; + exports.default = def; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +var require_recursiveRef = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var dynamicRef_1 = require_dynamicRef(); + var def = { + keyword: "$recursiveRef", + schemaType: "string", + code: (cxt) => (0, dynamicRef_1.dynamicRef)(cxt, cxt.schema) + }; + exports.default = def; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/dynamic/index.js +var require_dynamic = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/dynamic/index.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var dynamicAnchor_1 = require_dynamicAnchor(); + var dynamicRef_1 = require_dynamicRef(); + var recursiveAnchor_1 = require_recursiveAnchor(); + var recursiveRef_1 = require_recursiveRef(); + var dynamic = [dynamicAnchor_1.default, dynamicRef_1.default, recursiveAnchor_1.default, recursiveRef_1.default]; + exports.default = dynamic; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +var require_dependentRequired = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var dependencies_1 = require_dependencies(); + var def = { + keyword: "dependentRequired", + type: "object", + schemaType: "object", + error: dependencies_1.error, + code: (cxt) => (0, dependencies_1.validatePropertyDeps)(cxt) + }; + exports.default = def; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +var require_dependentSchemas = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var dependencies_1 = require_dependencies(); + var def = { + keyword: "dependentSchemas", + type: "object", + schemaType: "object", + code: (cxt) => (0, dependencies_1.validateSchemaDeps)(cxt) + }; + exports.default = def; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/validation/limitContains.js +var require_limitContains = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/validation/limitContains.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var util_1 = require_util(); + var def = { + keyword: ["maxContains", "minContains"], + type: "array", + schemaType: "number", + code({ keyword, parentSchema, it }) { + if (parentSchema.contains === void 0) { + (0, util_1.checkStrictMode)(it, `"${keyword}" without "contains" is ignored`); } - function _s(t2) { - let e, n; - return typeof t2 == "string" ? (e = Ps(t2), n = t2) : (Array.isArray(t2) && (t2 = t2[0]), t2 && t2.context && (t2.lineStarts || (t2.lineStarts = Ps(t2.context.src)), e = t2.lineStarts, n = t2.context.src)), { lineStarts: e, src: n }; + } + }; + exports.default = def; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/next.js +var require_next = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/next.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var dependentRequired_1 = require_dependentRequired(); + var dependentSchemas_1 = require_dependentSchemas(); + var limitContains_1 = require_limitContains(); + var next = [dependentRequired_1.default, dependentSchemas_1.default, limitContains_1.default]; + exports.default = next; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +var require_unevaluatedProperties = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var names_1 = require_names(); + var error = { + message: "must NOT have unevaluated properties", + params: ({ params }) => (0, codegen_1._)`{unevaluatedProperty: ${params.unevaluatedProperty}}` + }; + var def = { + keyword: "unevaluatedProperties", + type: "object", + schemaType: ["boolean", "object"], + trackErrors: true, + error, + code(cxt) { + const { gen, schema: schema4, data, errsCount, it } = cxt; + if (!errsCount) + throw new Error("ajv implementation error"); + const { allErrors, props } = it; + if (props instanceof codegen_1.Name) { + gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key)))); + } else if (props !== true) { + gen.forIn("key", data, (key) => props === void 0 ? unevaluatedPropCode(key) : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key))); } - function Tn(t2, e) { - if (typeof t2 != "number" || t2 < 0) return null; - let { lineStarts: n, src: r } = _s(e); - if (!n || !r || t2 > r.length) return null; - for (let i = 0; i < n.length; ++i) { - let o = n[i]; - if (t2 < o) return { line: i, col: t2 - n[i - 1] + 1 }; - if (t2 === o) return { line: i + 1, col: 1 }; + it.props = true; + cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`); + function unevaluatedPropCode(key) { + if (schema4 === false) { + cxt.setParams({ unevaluatedProperty: key }); + cxt.error(); + if (!allErrors) + gen.break(); + return; + } + if (!(0, util_1.alwaysValidSchema)(it, schema4)) { + const valid = gen.name("valid"); + cxt.subschema({ + keyword: "unevaluatedProperties", + dataProp: key, + dataPropType: util_1.Type.Str + }, valid); + if (!allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); } - let s = n.length; - return { line: s, col: t2 - n[s - 1] + 1 }; } - function Co(t2, e) { - let { lineStarts: n, src: r } = _s(e); - if (!n || !(t2 >= 1) || t2 > n.length) return null; - let s = n[t2 - 1], i = n[t2]; - for (; i && i > s && r[i - 1] === ` -`; ) --i; - return r.slice(s, i); + function unevaluatedDynamic(evaluatedProps, key) { + return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${key}]`; } - function Mo({ start: t2, end: e }, n, r = 80) { - let s = Co(t2.line, n); - if (!s) return null; - let { col: i } = t2; - if (s.length > r) if (i <= r - 10) s = s.substr(0, r - 1) + "\u2026"; - else { - let f2 = Math.round(r / 2); - s.length > i + f2 && (s = s.substr(0, i + f2 - 1) + "\u2026"), i -= s.length - r, s = "\u2026" + s.substr(1 - r); + function unevaluatedStatic(evaluatedProps, key) { + const ps = []; + for (const p in evaluatedProps) { + if (evaluatedProps[p] === true) + ps.push((0, codegen_1._)`${key} !== ${p}`); } - let o = 1, a2 = ""; - e && (e.line === t2.line && i + (e.col - t2.col) <= r + 1 ? o = e.col - t2.col : (o = Math.min(s.length + 1, r) - i, a2 = "\u2026")); - let c = i > 1 ? " ".repeat(i - 1) : "", l = "^".repeat(o); - return `${s} -${c}${l}${a2}`; + return (0, codegen_1.and)(...ps); } - var Be = class t2 { - static copy(e) { - return new t2(e.start, e.end); - } - constructor(e, n) { - this.start = e, this.end = n || e; - } - isEmpty() { - return typeof this.start != "number" || !this.end || this.end <= this.start; - } - setOrigRange(e, n) { - let { start: r, end: s } = this; - if (e.length === 0 || s <= e[0]) return this.origStart = r, this.origEnd = s, n; - let i = n; - for (; i < e.length && !(e[i] > r); ) ++i; - this.origStart = r + i; - let o = i; - for (; i < e.length && !(e[i] >= s); ) ++i; - return this.origEnd = s + i, o; - } - }, se = class t2 { - static addStringTerminator(e, n, r) { - if (r[r.length - 1] === ` -`) return r; - let s = t2.endOfWhiteSpace(e, n); - return s >= e.length || e[s] === ` -` ? r + ` -` : r; - } - static atDocumentBoundary(e, n, r) { - let s = e[n]; - if (!s) return true; - let i = e[n - 1]; - if (i && i !== ` -`) return false; - if (r) { - if (s !== r) return false; - } else if (s !== re.DIRECTIVES_END && s !== re.DOCUMENT_END) return false; - let o = e[n + 1], a2 = e[n + 2]; - if (o !== s || a2 !== s) return false; - let c = e[n + 3]; - return !c || c === ` -` || c === " " || c === " "; - } - static endOfIdentifier(e, n) { - let r = e[n], s = r === "<", i = s ? [` -`, " ", " ", ">"] : [` -`, " ", " ", "[", "]", "{", "}", ","]; - for (; r && i.indexOf(r) === -1; ) r = e[n += 1]; - return s && r === ">" && (n += 1), n; - } - static endOfIndent(e, n) { - let r = e[n]; - for (; r === " "; ) r = e[n += 1]; - return n; + } + }; + exports.default = def; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +var require_unevaluatedItems = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var error = { + message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`, + params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}` + }; + var def = { + keyword: "unevaluatedItems", + type: "array", + schemaType: ["boolean", "object"], + error, + code(cxt) { + const { gen, schema: schema4, data, it } = cxt; + const items = it.items || 0; + if (items === true) + return; + const len = gen.const("len", (0, codegen_1._)`${data}.length`); + if (schema4 === false) { + cxt.setParams({ len: items }); + cxt.fail((0, codegen_1._)`${len} > ${items}`); + } else if (typeof schema4 == "object" && !(0, util_1.alwaysValidSchema)(it, schema4)) { + const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items}`); + gen.if((0, codegen_1.not)(valid), () => validateItems(valid, items)); + cxt.ok(valid); + } + it.items = true; + function validateItems(valid, from) { + gen.forRange("i", from, len, (i) => { + cxt.subschema({ keyword: "unevaluatedItems", dataProp: i, dataPropType: util_1.Type.Num }, valid); + if (!it.allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + }); + } + } + }; + exports.default = def; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/unevaluated/index.js +var require_unevaluated = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/unevaluated/index.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var unevaluatedProperties_1 = require_unevaluatedProperties(); + var unevaluatedItems_1 = require_unevaluatedItems(); + var unevaluated = [unevaluatedProperties_1.default, unevaluatedItems_1.default]; + exports.default = unevaluated; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json +var require_schema = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2019-09/schema", + $id: "https://json-schema.org/draft/2019-09/schema", + $vocabulary: { + "https://json-schema.org/draft/2019-09/vocab/core": true, + "https://json-schema.org/draft/2019-09/vocab/applicator": true, + "https://json-schema.org/draft/2019-09/vocab/validation": true, + "https://json-schema.org/draft/2019-09/vocab/meta-data": true, + "https://json-schema.org/draft/2019-09/vocab/format": false, + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + $recursiveAnchor: true, + title: "Core and Validation specifications meta-schema", + allOf: [ + { $ref: "meta/core" }, + { $ref: "meta/applicator" }, + { $ref: "meta/validation" }, + { $ref: "meta/meta-data" }, + { $ref: "meta/format" }, + { $ref: "meta/content" } + ], + type: ["object", "boolean"], + properties: { + definitions: { + $comment: "While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.", + type: "object", + additionalProperties: { $recursiveRef: "#" }, + default: {} + }, + dependencies: { + $comment: '"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"', + type: "object", + additionalProperties: { + anyOf: [{ $recursiveRef: "#" }, { $ref: "meta/validation#/$defs/stringArray" }] } - static endOfLine(e, n) { - let r = e[n]; - for (; r && r !== ` -`; ) r = e[n += 1]; - return n; + } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json +var require_applicator2 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2019-09/schema", + $id: "https://json-schema.org/draft/2019-09/meta/applicator", + $vocabulary: { + "https://json-schema.org/draft/2019-09/vocab/applicator": true + }, + $recursiveAnchor: true, + title: "Applicator vocabulary meta-schema", + type: ["object", "boolean"], + properties: { + additionalItems: { $recursiveRef: "#" }, + unevaluatedItems: { $recursiveRef: "#" }, + items: { + anyOf: [{ $recursiveRef: "#" }, { $ref: "#/$defs/schemaArray" }] + }, + contains: { $recursiveRef: "#" }, + additionalProperties: { $recursiveRef: "#" }, + unevaluatedProperties: { $recursiveRef: "#" }, + properties: { + type: "object", + additionalProperties: { $recursiveRef: "#" }, + default: {} + }, + patternProperties: { + type: "object", + additionalProperties: { $recursiveRef: "#" }, + propertyNames: { format: "regex" }, + default: {} + }, + dependentSchemas: { + type: "object", + additionalProperties: { + $recursiveRef: "#" } - static endOfWhiteSpace(e, n) { - let r = e[n]; - for (; r === " " || r === " "; ) r = e[n += 1]; - return n; + }, + propertyNames: { $recursiveRef: "#" }, + if: { $recursiveRef: "#" }, + then: { $recursiveRef: "#" }, + else: { $recursiveRef: "#" }, + allOf: { $ref: "#/$defs/schemaArray" }, + anyOf: { $ref: "#/$defs/schemaArray" }, + oneOf: { $ref: "#/$defs/schemaArray" }, + not: { $recursiveRef: "#" } + }, + $defs: { + schemaArray: { + type: "array", + minItems: 1, + items: { $recursiveRef: "#" } + } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json +var require_content = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2019-09/schema", + $id: "https://json-schema.org/draft/2019-09/meta/content", + $vocabulary: { + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + $recursiveAnchor: true, + title: "Content vocabulary meta-schema", + type: ["object", "boolean"], + properties: { + contentMediaType: { type: "string" }, + contentEncoding: { type: "string" }, + contentSchema: { $recursiveRef: "#" } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json +var require_core4 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2019-09/schema", + $id: "https://json-schema.org/draft/2019-09/meta/core", + $vocabulary: { + "https://json-schema.org/draft/2019-09/vocab/core": true + }, + $recursiveAnchor: true, + title: "Core vocabulary meta-schema", + type: ["object", "boolean"], + properties: { + $id: { + type: "string", + format: "uri-reference", + $comment: "Non-empty fragments not allowed.", + pattern: "^[^#]*#?$" + }, + $schema: { + type: "string", + format: "uri" + }, + $anchor: { + type: "string", + pattern: "^[A-Za-z][-A-Za-z0-9.:_]*$" + }, + $ref: { + type: "string", + format: "uri-reference" + }, + $recursiveRef: { + type: "string", + format: "uri-reference" + }, + $recursiveAnchor: { + type: "boolean", + default: false + }, + $vocabulary: { + type: "object", + propertyNames: { + type: "string", + format: "uri" + }, + additionalProperties: { + type: "boolean" } - static startOfLine(e, n) { - let r = e[n - 1]; - if (r === ` -`) return n; - for (; r && r !== ` -`; ) r = e[n -= 1]; - return n + 1; + }, + $comment: { + type: "string" + }, + $defs: { + type: "object", + additionalProperties: { $recursiveRef: "#" }, + default: {} + } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json +var require_format3 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2019-09/schema", + $id: "https://json-schema.org/draft/2019-09/meta/format", + $vocabulary: { + "https://json-schema.org/draft/2019-09/vocab/format": true + }, + $recursiveAnchor: true, + title: "Format vocabulary meta-schema", + type: ["object", "boolean"], + properties: { + format: { type: "string" } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json +var require_meta_data = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2019-09/schema", + $id: "https://json-schema.org/draft/2019-09/meta/meta-data", + $vocabulary: { + "https://json-schema.org/draft/2019-09/vocab/meta-data": true + }, + $recursiveAnchor: true, + title: "Meta-data vocabulary meta-schema", + type: ["object", "boolean"], + properties: { + title: { + type: "string" + }, + description: { + type: "string" + }, + default: true, + deprecated: { + type: "boolean", + default: false + }, + readOnly: { + type: "boolean", + default: false + }, + writeOnly: { + type: "boolean", + default: false + }, + examples: { + type: "array", + items: true + } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json +var require_validation3 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2019-09/schema", + $id: "https://json-schema.org/draft/2019-09/meta/validation", + $vocabulary: { + "https://json-schema.org/draft/2019-09/vocab/validation": true + }, + $recursiveAnchor: true, + title: "Validation vocabulary meta-schema", + type: ["object", "boolean"], + properties: { + multipleOf: { + type: "number", + exclusiveMinimum: 0 + }, + maximum: { + type: "number" + }, + exclusiveMaximum: { + type: "number" + }, + minimum: { + type: "number" + }, + exclusiveMinimum: { + type: "number" + }, + maxLength: { $ref: "#/$defs/nonNegativeInteger" }, + minLength: { $ref: "#/$defs/nonNegativeIntegerDefault0" }, + pattern: { + type: "string", + format: "regex" + }, + maxItems: { $ref: "#/$defs/nonNegativeInteger" }, + minItems: { $ref: "#/$defs/nonNegativeIntegerDefault0" }, + uniqueItems: { + type: "boolean", + default: false + }, + maxContains: { $ref: "#/$defs/nonNegativeInteger" }, + minContains: { + $ref: "#/$defs/nonNegativeInteger", + default: 1 + }, + maxProperties: { $ref: "#/$defs/nonNegativeInteger" }, + minProperties: { $ref: "#/$defs/nonNegativeIntegerDefault0" }, + required: { $ref: "#/$defs/stringArray" }, + dependentRequired: { + type: "object", + additionalProperties: { + $ref: "#/$defs/stringArray" } - static endOfBlockIndent(e, n, r) { - let s = t2.endOfIndent(e, r); - if (s > r + n) return s; + }, + const: true, + enum: { + type: "array", + items: true + }, + type: { + anyOf: [ + { $ref: "#/$defs/simpleTypes" }, { - let i = t2.endOfWhiteSpace(e, s), o = e[i]; - if (!o || o === ` -`) return i; - } - return null; - } - static atBlank(e, n, r) { - let s = e[n]; - return s === ` -` || s === " " || s === " " || r && !s; - } - static nextNodeIsIndented(e, n, r) { - return !e || n < 0 ? false : n > 0 ? true : r && e === "-"; - } - static normalizeOffset(e, n) { - let r = e[n]; - return r ? r !== ` -` && e[n - 1] === ` -` ? n - 1 : t2.endOfWhiteSpace(e, n) : n; - } - static foldNewline(e, n, r) { - let s = 0, i = false, o = "", a2 = e[n + 1]; - for (; a2 === " " || a2 === " " || a2 === ` -`; ) { - switch (a2) { - case ` -`: - s = 0, n += 1, o += ` -`; - break; - case " ": - s <= r && (i = true), n = t2.endOfWhiteSpace(e, n + 2) - 1; - break; - case " ": - s += 1, n += 1; - break; - } - a2 = e[n + 1]; + type: "array", + items: { $ref: "#/$defs/simpleTypes" }, + minItems: 1, + uniqueItems: true } - return o || (o = " "), a2 && s <= r && (i = true), { fold: o, offset: n, error: i }; - } - constructor(e, n, r) { - Object.defineProperty(this, "context", { value: r || null, writable: true }), this.error = null, this.range = null, this.valueRange = null, this.props = n || [], this.type = e, this.value = null; - } - getPropValue(e, n, r) { - if (!this.context) return null; - let { src: s } = this.context, i = this.props[e]; - return i && s[i.start] === n ? s.slice(i.start + (r ? 1 : 0), i.end) : null; - } - get anchor() { - for (let e = 0; e < this.props.length; ++e) { - let n = this.getPropValue(e, re.ANCHOR, true); - if (n != null) return n; - } - return null; + ] + } + }, + $defs: { + nonNegativeInteger: { + type: "integer", + minimum: 0 + }, + nonNegativeIntegerDefault0: { + $ref: "#/$defs/nonNegativeInteger", + default: 0 + }, + simpleTypes: { + enum: ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + stringArray: { + type: "array", + items: { type: "string" }, + uniqueItems: true, + default: [] + } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/index.js +var require_json_schema_2019_09 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2019-09/index.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var metaSchema = require_schema(); + var applicator = require_applicator2(); + var content = require_content(); + var core = require_core4(); + var format6 = require_format3(); + var metadata = require_meta_data(); + var validation = require_validation3(); + var META_SUPPORT_DATA = ["/properties"]; + function addMetaSchema2019($data) { + ; + [ + metaSchema, + applicator, + content, + core, + with$data(this, format6), + metadata, + with$data(this, validation) + ].forEach((sch) => this.addMetaSchema(sch, void 0, false)); + return this; + function with$data(ajv, sch) { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch; + } + } + exports.default = addMetaSchema2019; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/2019.js +var require__ = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/2019.js"(exports, module) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv2019 = void 0; + var core_1 = require_core(); + var draft7_1 = require_draft7(); + var dynamic_1 = require_dynamic(); + var next_1 = require_next(); + var unevaluated_1 = require_unevaluated(); + var discriminator_1 = require_discriminator(); + var json_schema_2019_09_1 = require_json_schema_2019_09(); + var META_SCHEMA_ID = "https://json-schema.org/draft/2019-09/schema"; + var Ajv20192 = class extends core_1.default { + constructor(opts = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true + }); + } + _addVocabularies() { + super._addVocabularies(); + this.addVocabulary(dynamic_1.default); + draft7_1.default.forEach((v) => this.addVocabulary(v)); + this.addVocabulary(next_1.default); + this.addVocabulary(unevaluated_1.default); + if (this.opts.discriminator) + this.addKeyword(discriminator_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + const { $data, meta } = this.opts; + if (!meta) + return; + json_schema_2019_09_1.default.call(this, $data); + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; + } + defaultMeta() { + return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : void 0); + } + }; + exports.Ajv2019 = Ajv20192; + module.exports = exports = Ajv20192; + module.exports.Ajv2019 = Ajv20192; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = Ajv20192; + var validate_1 = require_validate(); + Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() { + return validate_1.KeywordCxt; + } }); + var codegen_1 = require_codegen(); + Object.defineProperty(exports, "_", { enumerable: true, get: function() { + return codegen_1._; + } }); + Object.defineProperty(exports, "str", { enumerable: true, get: function() { + return codegen_1.str; + } }); + Object.defineProperty(exports, "stringify", { enumerable: true, get: function() { + return codegen_1.stringify; + } }); + Object.defineProperty(exports, "nil", { enumerable: true, get: function() { + return codegen_1.nil; + } }); + Object.defineProperty(exports, "Name", { enumerable: true, get: function() { + return codegen_1.Name; + } }); + Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() { + return codegen_1.CodeGen; + } }); + var validation_error_1 = require_validation_error(); + Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function() { + return validation_error_1.default; + } }); + var ref_error_1 = require_ref_error(); + Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function() { + return ref_error_1.default; + } }); + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/draft2020.js +var require_draft2020 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/vocabularies/draft2020.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var core_1 = require_core2(); + var validation_1 = require_validation(); + var applicator_1 = require_applicator(); + var dynamic_1 = require_dynamic(); + var next_1 = require_next(); + var unevaluated_1 = require_unevaluated(); + var format_1 = require_format2(); + var metadata_1 = require_metadata(); + var draft2020Vocabularies = [ + dynamic_1.default, + core_1.default, + validation_1.default, + (0, applicator_1.default)(true), + format_1.default, + metadata_1.metadataVocabulary, + metadata_1.contentVocabulary, + next_1.default, + unevaluated_1.default + ]; + exports.default = draft2020Vocabularies; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json +var require_schema2 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2020-12/schema", + $id: "https://json-schema.org/draft/2020-12/schema", + $vocabulary: { + "https://json-schema.org/draft/2020-12/vocab/core": true, + "https://json-schema.org/draft/2020-12/vocab/applicator": true, + "https://json-schema.org/draft/2020-12/vocab/unevaluated": true, + "https://json-schema.org/draft/2020-12/vocab/validation": true, + "https://json-schema.org/draft/2020-12/vocab/meta-data": true, + "https://json-schema.org/draft/2020-12/vocab/format-annotation": true, + "https://json-schema.org/draft/2020-12/vocab/content": true + }, + $dynamicAnchor: "meta", + title: "Core and Validation specifications meta-schema", + allOf: [ + { $ref: "meta/core" }, + { $ref: "meta/applicator" }, + { $ref: "meta/unevaluated" }, + { $ref: "meta/validation" }, + { $ref: "meta/meta-data" }, + { $ref: "meta/format-annotation" }, + { $ref: "meta/content" } + ], + type: ["object", "boolean"], + $comment: "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.", + properties: { + definitions: { + $comment: '"definitions" has been replaced by "$defs".', + type: "object", + additionalProperties: { $dynamicRef: "#meta" }, + deprecated: true, + default: {} + }, + dependencies: { + $comment: '"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.', + type: "object", + additionalProperties: { + anyOf: [{ $dynamicRef: "#meta" }, { $ref: "meta/validation#/$defs/stringArray" }] + }, + deprecated: true, + default: {} + }, + $recursiveAnchor: { + $comment: '"$recursiveAnchor" has been replaced by "$dynamicAnchor".', + $ref: "meta/core#/$defs/anchorString", + deprecated: true + }, + $recursiveRef: { + $comment: '"$recursiveRef" has been replaced by "$dynamicRef".', + $ref: "meta/core#/$defs/uriReferenceString", + deprecated: true + } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json +var require_applicator3 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2020-12/schema", + $id: "https://json-schema.org/draft/2020-12/meta/applicator", + $vocabulary: { + "https://json-schema.org/draft/2020-12/vocab/applicator": true + }, + $dynamicAnchor: "meta", + title: "Applicator vocabulary meta-schema", + type: ["object", "boolean"], + properties: { + prefixItems: { $ref: "#/$defs/schemaArray" }, + items: { $dynamicRef: "#meta" }, + contains: { $dynamicRef: "#meta" }, + additionalProperties: { $dynamicRef: "#meta" }, + properties: { + type: "object", + additionalProperties: { $dynamicRef: "#meta" }, + default: {} + }, + patternProperties: { + type: "object", + additionalProperties: { $dynamicRef: "#meta" }, + propertyNames: { format: "regex" }, + default: {} + }, + dependentSchemas: { + type: "object", + additionalProperties: { $dynamicRef: "#meta" }, + default: {} + }, + propertyNames: { $dynamicRef: "#meta" }, + if: { $dynamicRef: "#meta" }, + then: { $dynamicRef: "#meta" }, + else: { $dynamicRef: "#meta" }, + allOf: { $ref: "#/$defs/schemaArray" }, + anyOf: { $ref: "#/$defs/schemaArray" }, + oneOf: { $ref: "#/$defs/schemaArray" }, + not: { $dynamicRef: "#meta" } + }, + $defs: { + schemaArray: { + type: "array", + minItems: 1, + items: { $dynamicRef: "#meta" } + } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json +var require_unevaluated2 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2020-12/schema", + $id: "https://json-schema.org/draft/2020-12/meta/unevaluated", + $vocabulary: { + "https://json-schema.org/draft/2020-12/vocab/unevaluated": true + }, + $dynamicAnchor: "meta", + title: "Unevaluated applicator vocabulary meta-schema", + type: ["object", "boolean"], + properties: { + unevaluatedItems: { $dynamicRef: "#meta" }, + unevaluatedProperties: { $dynamicRef: "#meta" } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json +var require_content2 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2020-12/schema", + $id: "https://json-schema.org/draft/2020-12/meta/content", + $vocabulary: { + "https://json-schema.org/draft/2020-12/vocab/content": true + }, + $dynamicAnchor: "meta", + title: "Content vocabulary meta-schema", + type: ["object", "boolean"], + properties: { + contentEncoding: { type: "string" }, + contentMediaType: { type: "string" }, + contentSchema: { $dynamicRef: "#meta" } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json +var require_core5 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2020-12/schema", + $id: "https://json-schema.org/draft/2020-12/meta/core", + $vocabulary: { + "https://json-schema.org/draft/2020-12/vocab/core": true + }, + $dynamicAnchor: "meta", + title: "Core vocabulary meta-schema", + type: ["object", "boolean"], + properties: { + $id: { + $ref: "#/$defs/uriReferenceString", + $comment: "Non-empty fragments not allowed.", + pattern: "^[^#]*#?$" + }, + $schema: { $ref: "#/$defs/uriString" }, + $ref: { $ref: "#/$defs/uriReferenceString" }, + $anchor: { $ref: "#/$defs/anchorString" }, + $dynamicRef: { $ref: "#/$defs/uriReferenceString" }, + $dynamicAnchor: { $ref: "#/$defs/anchorString" }, + $vocabulary: { + type: "object", + propertyNames: { $ref: "#/$defs/uriString" }, + additionalProperties: { + type: "boolean" } - get comment() { - let e = []; - for (let n = 0; n < this.props.length; ++n) { - let r = this.getPropValue(n, re.COMMENT, true); - r != null && e.push(r); + }, + $comment: { + type: "string" + }, + $defs: { + type: "object", + additionalProperties: { $dynamicRef: "#meta" } + } + }, + $defs: { + anchorString: { + type: "string", + pattern: "^[A-Za-z_][-A-Za-z0-9._]*$" + }, + uriString: { + type: "string", + format: "uri" + }, + uriReferenceString: { + type: "string", + format: "uri-reference" + } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json +var require_format_annotation = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2020-12/schema", + $id: "https://json-schema.org/draft/2020-12/meta/format-annotation", + $vocabulary: { + "https://json-schema.org/draft/2020-12/vocab/format-annotation": true + }, + $dynamicAnchor: "meta", + title: "Format vocabulary meta-schema for annotation results", + type: ["object", "boolean"], + properties: { + format: { type: "string" } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json +var require_meta_data2 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2020-12/schema", + $id: "https://json-schema.org/draft/2020-12/meta/meta-data", + $vocabulary: { + "https://json-schema.org/draft/2020-12/vocab/meta-data": true + }, + $dynamicAnchor: "meta", + title: "Meta-data vocabulary meta-schema", + type: ["object", "boolean"], + properties: { + title: { + type: "string" + }, + description: { + type: "string" + }, + default: true, + deprecated: { + type: "boolean", + default: false + }, + readOnly: { + type: "boolean", + default: false + }, + writeOnly: { + type: "boolean", + default: false + }, + examples: { + type: "array", + items: true + } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json +var require_validation4 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json"(exports, module) { + module.exports = { + $schema: "https://json-schema.org/draft/2020-12/schema", + $id: "https://json-schema.org/draft/2020-12/meta/validation", + $vocabulary: { + "https://json-schema.org/draft/2020-12/vocab/validation": true + }, + $dynamicAnchor: "meta", + title: "Validation vocabulary meta-schema", + type: ["object", "boolean"], + properties: { + type: { + anyOf: [ + { $ref: "#/$defs/simpleTypes" }, + { + type: "array", + items: { $ref: "#/$defs/simpleTypes" }, + minItems: 1, + uniqueItems: true } - return e.length > 0 ? e.join(` -`) : null; + ] + }, + const: true, + enum: { + type: "array", + items: true + }, + multipleOf: { + type: "number", + exclusiveMinimum: 0 + }, + maximum: { + type: "number" + }, + exclusiveMaximum: { + type: "number" + }, + minimum: { + type: "number" + }, + exclusiveMinimum: { + type: "number" + }, + maxLength: { $ref: "#/$defs/nonNegativeInteger" }, + minLength: { $ref: "#/$defs/nonNegativeIntegerDefault0" }, + pattern: { + type: "string", + format: "regex" + }, + maxItems: { $ref: "#/$defs/nonNegativeInteger" }, + minItems: { $ref: "#/$defs/nonNegativeIntegerDefault0" }, + uniqueItems: { + type: "boolean", + default: false + }, + maxContains: { $ref: "#/$defs/nonNegativeInteger" }, + minContains: { + $ref: "#/$defs/nonNegativeInteger", + default: 1 + }, + maxProperties: { $ref: "#/$defs/nonNegativeInteger" }, + minProperties: { $ref: "#/$defs/nonNegativeIntegerDefault0" }, + required: { $ref: "#/$defs/stringArray" }, + dependentRequired: { + type: "object", + additionalProperties: { + $ref: "#/$defs/stringArray" } - commentHasRequiredWhitespace(e) { - let { src: n } = this.context; - if (this.header && e === this.header.end || !this.valueRange) return false; - let { end: r } = this.valueRange; - return e !== r || t2.atBlank(n, r - 1); + } + }, + $defs: { + nonNegativeInteger: { + type: "integer", + minimum: 0 + }, + nonNegativeIntegerDefault0: { + $ref: "#/$defs/nonNegativeInteger", + default: 0 + }, + simpleTypes: { + enum: ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + stringArray: { + type: "array", + items: { type: "string" }, + uniqueItems: true, + default: [] + } + } + }; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +var require_json_schema_2020_12 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/refs/json-schema-2020-12/index.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var metaSchema = require_schema2(); + var applicator = require_applicator3(); + var unevaluated = require_unevaluated2(); + var content = require_content2(); + var core = require_core5(); + var format6 = require_format_annotation(); + var metadata = require_meta_data2(); + var validation = require_validation4(); + var META_SUPPORT_DATA = ["/properties"]; + function addMetaSchema2020($data) { + ; + [ + metaSchema, + applicator, + unevaluated, + content, + core, + with$data(this, format6), + metadata, + with$data(this, validation) + ].forEach((sch) => this.addMetaSchema(sch, void 0, false)); + return this; + function with$data(ajv, sch) { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch; + } + } + exports.default = addMetaSchema2020; + } +}); + +// ../../node_modules/yaml-language-server/node_modules/ajv/dist/2020.js +var require__2 = __commonJS({ + "../../node_modules/yaml-language-server/node_modules/ajv/dist/2020.js"(exports, module) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv2020 = void 0; + var core_1 = require_core(); + var draft2020_1 = require_draft2020(); + var discriminator_1 = require_discriminator(); + var json_schema_2020_12_1 = require_json_schema_2020_12(); + var META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema"; + var Ajv20202 = class extends core_1.default { + constructor(opts = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true + }); + } + _addVocabularies() { + super._addVocabularies(); + draft2020_1.default.forEach((v) => this.addVocabulary(v)); + if (this.opts.discriminator) + this.addKeyword(discriminator_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + const { $data, meta } = this.opts; + if (!meta) + return; + json_schema_2020_12_1.default.call(this, $data); + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; + } + defaultMeta() { + return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : void 0); + } + }; + exports.Ajv2020 = Ajv20202; + module.exports = exports = Ajv20202; + module.exports.Ajv2020 = Ajv20202; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = Ajv20202; + var validate_1 = require_validate(); + Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() { + return validate_1.KeywordCxt; + } }); + var codegen_1 = require_codegen(); + Object.defineProperty(exports, "_", { enumerable: true, get: function() { + return codegen_1._; + } }); + Object.defineProperty(exports, "str", { enumerable: true, get: function() { + return codegen_1.str; + } }); + Object.defineProperty(exports, "stringify", { enumerable: true, get: function() { + return codegen_1.stringify; + } }); + Object.defineProperty(exports, "nil", { enumerable: true, get: function() { + return codegen_1.nil; + } }); + Object.defineProperty(exports, "Name", { enumerable: true, get: function() { + return codegen_1.Name; + } }); + Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() { + return codegen_1.CodeGen; + } }); + var validation_error_1 = require_validation_error(); + Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function() { + return validation_error_1.default; + } }); + var ref_error_1 = require_ref_error(); + Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function() { + return ref_error_1.default; + } }); + } +}); + +// ../../node_modules/prettier/plugins/yaml.js +var require_yaml = __commonJS({ + "../../node_modules/prettier/plugins/yaml.js"(exports, module) { + (function(f2) { + function e() { + var i = f2(); + return i.default || i; + } + if (typeof exports == "object" && typeof module == "object") module.exports = e(); + else if (typeof define == "function" && define.amd) define(e); + else { + var t2 = typeof globalThis < "u" ? globalThis : typeof global < "u" ? global : typeof self < "u" ? self : this || {}; + t2.prettierPlugins = t2.prettierPlugins || {}, t2.prettierPlugins.yaml = e(); + } + })(function() { + "use strict"; + var _a2, _e2, _t, _zn_instances, n_fn, r_fn, _b; + var Mi = Object.create; + var mt = Object.defineProperty; + var ki = Object.getOwnPropertyDescriptor; + var Pi = Object.getOwnPropertyNames; + var vi = Object.getPrototypeOf, Ii = Object.prototype.hasOwnProperty; + var ne = (t2, e) => () => (e || t2((e = { exports: {} }).exports, e), e.exports), sr = (t2, e) => { + for (var n in e) mt(t2, n, { get: e[n], enumerable: true }); + }, ir = (t2, e, n, r) => { + if (e && typeof e == "object" || typeof e == "function") for (let s of Pi(e)) !Ii.call(t2, s) && s !== n && mt(t2, s, { get: () => e[s], enumerable: !(r = ki(e, s)) || r.enumerable }); + return t2; + }; + var or = (t2, e, n) => (n = t2 != null ? Mi(vi(t2)) : {}, ir(e || !t2 || !t2.__esModule ? mt(n, "default", { value: t2, enumerable: true }) : n, t2)), _i = (t2) => ir(mt({}, "__esModule", { value: true }), t2); + var ce = ne((B) => { + "use strict"; + var ie = { ANCHOR: "&", COMMENT: "#", TAG: "!", DIRECTIVES_END: "-", DOCUMENT_END: "." }, st = { ALIAS: "ALIAS", BLANK_LINE: "BLANK_LINE", BLOCK_FOLDED: "BLOCK_FOLDED", BLOCK_LITERAL: "BLOCK_LITERAL", COMMENT: "COMMENT", DIRECTIVE: "DIRECTIVE", DOCUMENT: "DOCUMENT", FLOW_MAP: "FLOW_MAP", FLOW_SEQ: "FLOW_SEQ", MAP: "MAP", MAP_KEY: "MAP_KEY", MAP_VALUE: "MAP_VALUE", PLAIN: "PLAIN", QUOTE_DOUBLE: "QUOTE_DOUBLE", QUOTE_SINGLE: "QUOTE_SINGLE", SEQ: "SEQ", SEQ_ITEM: "SEQ_ITEM" }, po = "tag:yaml.org,2002:", mo = { MAP: "tag:yaml.org,2002:map", SEQ: "tag:yaml.org,2002:seq", STR: "tag:yaml.org,2002:str" }; + function Wr(t2) { + let e = [0], n = t2.indexOf(` +`); + for (; n !== -1; ) n += 1, e.push(n), n = t2.indexOf(` +`, n); + return e; + } + function Kr(t2) { + let e, n; + return typeof t2 == "string" ? (e = Wr(t2), n = t2) : (Array.isArray(t2) && (t2 = t2[0]), t2 && t2.context && (t2.lineStarts || (t2.lineStarts = Wr(t2.context.src)), e = t2.lineStarts, n = t2.context.src)), { lineStarts: e, src: n }; + } + function Sn(t2, e) { + if (typeof t2 != "number" || t2 < 0) return null; + let { lineStarts: n, src: r } = Kr(e); + if (!n || !r || t2 > r.length) return null; + for (let i = 0; i < n.length; ++i) { + let o = n[i]; + if (t2 < o) return { line: i, col: t2 - n[i - 1] + 1 }; + if (t2 === o) return { line: i + 1, col: 1 }; } - get hasComment() { - if (this.context) { - let { src: e } = this.context; - for (let n = 0; n < this.props.length; ++n) if (e[this.props[n].start] === re.COMMENT) return true; - } - return false; + let s = n.length; + return { line: s, col: t2 - n[s - 1] + 1 }; + } + function ho(t2, e) { + let { lineStarts: n, src: r } = Kr(e); + if (!n || !(t2 >= 1) || t2 > n.length) return null; + let s = n[t2 - 1], i = n[t2]; + for (; i && i > s && r[i - 1] === ` +`; ) --i; + return r.slice(s, i); + } + function go({ start: t2, end: e }, n, r = 80) { + let s = ho(t2.line, n); + if (!s) return null; + let { col: i } = t2; + if (s.length > r) if (i <= r - 10) s = s.substr(0, r - 1) + "\u2026"; + else { + let f2 = Math.round(r / 2); + s.length > i + f2 && (s = s.substr(0, i + f2 - 1) + "\u2026"), i -= s.length - r, s = "\u2026" + s.substr(1 - r); } - get hasProps() { - if (this.context) { - let { src: e } = this.context; - for (let n = 0; n < this.props.length; ++n) if (e[this.props[n].start] !== re.COMMENT) return true; - } - return false; + let o = 1, a2 = ""; + e && (e.line === t2.line && i + (e.col - t2.col) <= r + 1 ? o = e.col - t2.col : (o = Math.min(s.length + 1, r) - i, a2 = "\u2026")); + let c = i > 1 ? " ".repeat(i - 1) : "", l = "^".repeat(o); + return `${s} +${c}${l}${a2}`; + } + var xe = class t2 { + static copy(e) { + return new t2(e.start, e.end); } - get includesTrailingLines() { - return false; + constructor(e, n) { + this.start = e, this.end = n || e; } - get jsonLike() { - return [lt.FLOW_MAP, lt.FLOW_SEQ, lt.QUOTE_DOUBLE, lt.QUOTE_SINGLE].indexOf(this.type) !== -1; + isEmpty() { + return typeof this.start != "number" || !this.end || this.end <= this.start; } - get rangeAsLinePos() { - if (!this.range || !this.context) return; - let e = Tn(this.range.start, this.context.root); - if (!e) return; - let n = Tn(this.range.end, this.context.root); - return { start: e, end: n }; + setOrigRange(e, n) { + let { start: r, end: s } = this; + if (e.length === 0 || s <= e[0]) return this.origStart = r, this.origEnd = s, n; + let i = n; + for (; i < e.length && !(e[i] > r); ) ++i; + this.origStart = r + i; + let o = i; + for (; i < e.length && !(e[i] >= s); ) ++i; + return this.origEnd = s + i, o; } - get rawValue() { - if (!this.valueRange || !this.context) return null; - let { start: e, end: n } = this.valueRange; - return this.context.src.slice(e, n); + }, oe = class t2 { + static addStringTerminator(e, n, r) { + if (r[r.length - 1] === ` +`) return r; + let s = t2.endOfWhiteSpace(e, n); + return s >= e.length || e[s] === ` +` ? r + ` +` : r; } - get tag() { - for (let e = 0; e < this.props.length; ++e) { - let n = this.getPropValue(e, re.TAG, false); - if (n != null) { - if (n[1] === "<") return { verbatim: n.slice(2, -1) }; - { - let [r, s, i] = n.match(/^(.*!)([^!]*)$/); - return { handle: s, suffix: i }; - } - } - } - return null; + static atDocumentBoundary(e, n, r) { + let s = e[n]; + if (!s) return true; + let i = e[n - 1]; + if (i && i !== ` +`) return false; + if (r) { + if (s !== r) return false; + } else if (s !== ie.DIRECTIVES_END && s !== ie.DOCUMENT_END) return false; + let o = e[n + 1], a2 = e[n + 2]; + if (o !== s || a2 !== s) return false; + let c = e[n + 3]; + return !c || c === ` +` || c === " " || c === " "; } - get valueRangeContainsNewline() { - if (!this.valueRange || !this.context) return false; - let { start: e, end: n } = this.valueRange, { src: r } = this.context; + static endOfIdentifier(e, n) { + let r = e[n], s = r === "<", i = s ? [` +`, " ", " ", ">"] : [` +`, " ", " ", "[", "]", "{", "}", ","]; + for (; r && i.indexOf(r) === -1; ) r = e[n += 1]; + return s && r === ">" && (n += 1), n; + } + static endOfIndent(e, n) { + let r = e[n]; + for (; r === " "; ) r = e[n += 1]; + return n; + } + static endOfLine(e, n) { + let r = e[n]; + for (; r && r !== ` +`; ) r = e[n += 1]; + return n; + } + static endOfWhiteSpace(e, n) { + let r = e[n]; + for (; r === " " || r === " "; ) r = e[n += 1]; + return n; + } + static startOfLine(e, n) { + let r = e[n - 1]; + if (r === ` +`) return n; + for (; r && r !== ` +`; ) r = e[n -= 1]; + return n + 1; + } + static endOfBlockIndent(e, n, r) { + let s = t2.endOfIndent(e, r); + if (s > r + n) return s; + { + let i = t2.endOfWhiteSpace(e, s), o = e[i]; + if (!o || o === ` +`) return i; + } + return null; + } + static atBlank(e, n, r) { + let s = e[n]; + return s === ` +` || s === " " || s === " " || r && !s; + } + static nextNodeIsIndented(e, n, r) { + return !e || n < 0 ? false : n > 0 ? true : r && e === "-"; + } + static normalizeOffset(e, n) { + let r = e[n]; + return r ? r !== ` +` && e[n - 1] === ` +` ? n - 1 : t2.endOfWhiteSpace(e, n) : n; + } + static foldNewline(e, n, r) { + let s = 0, i = false, o = "", a2 = e[n + 1]; + for (; a2 === " " || a2 === " " || a2 === ` +`; ) { + switch (a2) { + case ` +`: + s = 0, n += 1, o += ` +`; + break; + case " ": + s <= r && (i = true), n = t2.endOfWhiteSpace(e, n + 2) - 1; + break; + case " ": + s += 1, n += 1; + break; + } + a2 = e[n + 1]; + } + return o || (o = " "), a2 && s <= r && (i = true), { fold: o, offset: n, error: i }; + } + constructor(e, n, r) { + Object.defineProperty(this, "context", { value: r || null, writable: true }), this.error = null, this.range = null, this.valueRange = null, this.props = n || [], this.type = e, this.value = null; + } + getPropValue(e, n, r) { + if (!this.context) return null; + let { src: s } = this.context, i = this.props[e]; + return i && s[i.start] === n ? s.slice(i.start + (r ? 1 : 0), i.end) : null; + } + get anchor() { + for (let e = 0; e < this.props.length; ++e) { + let n = this.getPropValue(e, ie.ANCHOR, true); + if (n != null) return n; + } + return null; + } + get comment() { + let e = []; + for (let n = 0; n < this.props.length; ++n) { + let r = this.getPropValue(n, ie.COMMENT, true); + r != null && e.push(r); + } + return e.length > 0 ? e.join(` +`) : null; + } + commentHasRequiredWhitespace(e) { + let { src: n } = this.context; + if (this.header && e === this.header.end || !this.valueRange) return false; + let { end: r } = this.valueRange; + return e !== r || t2.atBlank(n, r - 1); + } + get hasComment() { + if (this.context) { + let { src: e } = this.context; + for (let n = 0; n < this.props.length; ++n) if (e[this.props[n].start] === ie.COMMENT) return true; + } + return false; + } + get hasProps() { + if (this.context) { + let { src: e } = this.context; + for (let n = 0; n < this.props.length; ++n) if (e[this.props[n].start] !== ie.COMMENT) return true; + } + return false; + } + get includesTrailingLines() { + return false; + } + get jsonLike() { + return [st.FLOW_MAP, st.FLOW_SEQ, st.QUOTE_DOUBLE, st.QUOTE_SINGLE].indexOf(this.type) !== -1; + } + get rangeAsLinePos() { + if (!this.range || !this.context) return; + let e = Sn(this.range.start, this.context.root); + if (!e) return; + let n = Sn(this.range.end, this.context.root); + return { start: e, end: n }; + } + get rawValue() { + if (!this.valueRange || !this.context) return null; + let { start: e, end: n } = this.valueRange; + return this.context.src.slice(e, n); + } + get tag() { + for (let e = 0; e < this.props.length; ++e) { + let n = this.getPropValue(e, ie.TAG, false); + if (n != null) { + if (n[1] === "<") return { verbatim: n.slice(2, -1) }; + { + let [r, s, i] = n.match(/^(.*!)([^!]*)$/); + return { handle: s, suffix: i }; + } + } + } + return null; + } + get valueRangeContainsNewline() { + if (!this.valueRange || !this.context) return false; + let { start: e, end: n } = this.valueRange, { src: r } = this.context; for (let s = e; s < n; ++s) if (r[s] === ` `) return true; return false; } parseComment(e) { let { src: n } = this.context; - if (n[e] === re.COMMENT) { - let r = t2.endOfLine(n, e + 1), s = new Be(e, r); + if (n[e] === ie.COMMENT) { + let r = t2.endOfLine(n, e + 1), s = new xe(e, r); return this.props.push(s), r; } return e; @@ -8949,9 +10238,9 @@ ${c}${l}${a2}`; let s = e.slice(n.start, n.end); return t2.addStringTerminator(e, n.end, s); } - }, ye = class extends Error { + }, ge = class extends Error { constructor(e, n, r) { - if (!r || !(n instanceof se)) throw new Error(`Invalid arguments for new ${e}`); + if (!r || !(n instanceof oe)) throw new Error(`Invalid arguments for new ${e}`); super(), this.name = e, this.message = r, this.source = n; } makePretty() { @@ -8959,8 +10248,8 @@ ${c}${l}${a2}`; this.nodeType = this.source.type; let e = this.source.context && this.source.context.root; if (typeof this.offset == "number") { - this.range = new Be(this.offset, this.offset + 1); - let n = e && Tn(this.offset, e); + this.range = new xe(this.offset, this.offset + 1); + let n = e && Sn(this.offset, e); if (n) { let r = { line: n.line, col: n.col + 1 }; this.linePos = { start: n, end: r }; @@ -8970,7 +10259,7 @@ ${c}${l}${a2}`; if (this.linePos) { let { line: n, col: r } = this.linePos.start; this.message += ` at line ${n}, column ${r}`; - let s = e && Mo(this.linePos, e); + let s = e && go(this.linePos, e); s && (this.message += `: ${s} @@ -8978,27 +10267,27 @@ ${s} } delete this.source; } - }, Cn = class extends ye { + }, wn = class extends ge { constructor(e, n) { super("YAMLReferenceError", e, n); } - }, ft = class extends ye { + }, it = class extends ge { constructor(e, n) { super("YAMLSemanticError", e, n); } - }, Mn = class extends ye { + }, bn = class extends ge { constructor(e, n) { super("YAMLSyntaxError", e, n); } - }, kn = class extends ye { + }, Nn = class extends ge { constructor(e, n) { super("YAMLWarning", e, n); } }; - function ko(t2, e, n) { + function yo(t2, e, n) { return e in t2 ? Object.defineProperty(t2, e, { value: n, enumerable: true, configurable: true, writable: true }) : t2[e] = n, t2; } - var vn = class t2 extends se { + var On = class t2 extends oe { static endOfLine(e, n, r) { let s = e[n], i = n; for (; s && s !== ` @@ -9020,7 +10309,7 @@ ${s} let c = r[a2]; if (c === ` `) { - let { fold: l, offset: f2 } = se.foldNewline(r, a2, -1); + let { fold: l, offset: f2 } = oe.foldNewline(r, a2, -1); i += l, a2 = f2; } else if (c === " " || c === " ") { let l = a2, f2 = r[a2 + 1]; @@ -9033,12 +10322,12 @@ ${s} switch (o) { case " ": { let a2 = "Plain value cannot start with a tab character"; - return { errors: [new ft(this, a2)], str: i }; + return { errors: [new it(this, a2)], str: i }; } case "@": case "`": { let a2 = `Plain value cannot start with reserved character ${o}`; - return { errors: [new ft(this, a2)], str: i }; + return { errors: [new it(this, a2)], str: i }; } default: return i; @@ -9047,8 +10336,8 @@ ${s} parseBlockValue(e) { let { indent: n, inFlow: r, src: s } = this.context, i = e, o = e; for (let a2 = s[i]; a2 === ` -` && !se.atDocumentBoundary(s, i + 1); a2 = s[i]) { - let c = se.endOfBlockIndent(s, n, i + 1); +` && !oe.atDocumentBoundary(s, i + 1); a2 = s[i]) { + let c = oe.endOfBlockIndent(s, n, i + 1); if (c === null || s[c] === "#") break; s[c] === ` ` ? i = c : (o = t2.endOfLine(s, c, r), i = o); @@ -9059,26 +10348,26 @@ ${s} this.context = e; let { inFlow: r, src: s } = e, i = n, o = s[i]; return o && o !== "#" && o !== ` -` && (i = t2.endOfLine(s, n, r)), this.valueRange = new Be(n, i), i = se.endOfWhiteSpace(s, i), i = this.parseComment(i), (!this.hasComment || this.valueRange.isEmpty()) && (i = this.parseBlockValue(i)), i; +` && (i = t2.endOfLine(s, n, r)), this.valueRange = new xe(n, i), i = oe.endOfWhiteSpace(s, i), i = this.parseComment(i), (!this.hasComment || this.valueRange.isEmpty()) && (i = this.parseBlockValue(i)), i; } }; - U.Char = re; - U.Node = se; - U.PlainValue = vn; - U.Range = Be; - U.Type = lt; - U.YAMLError = ye; - U.YAMLReferenceError = Cn; - U.YAMLSemanticError = ft; - U.YAMLSyntaxError = Mn; - U.YAMLWarning = kn; - U._defineProperty = ko; - U.defaultTagPrefix = Ao; - U.defaultTags = To; + B.Char = ie; + B.Node = oe; + B.PlainValue = On; + B.Range = xe; + B.Type = st; + B.YAMLError = ge; + B.YAMLReferenceError = wn; + B.YAMLSemanticError = it; + B.YAMLSyntaxError = bn; + B.YAMLWarning = Nn; + B._defineProperty = yo; + B.defaultTagPrefix = po; + B.defaultTags = mo; }); - var Rs = te((xs) => { + var Qr = ne((jr) => { "use strict"; - var u = le(), Se = class extends u.Node { + var u = ce(), Ee = class extends u.Node { constructor() { super(u.Type.BLANK_LINE); } @@ -9088,7 +10377,7 @@ ${s} parse(e, n) { return this.context = e, this.range = new u.Range(n, n + 1), n + 1; } - }, ut = class extends u.Node { + }, ot = class extends u.Node { constructor(e, n) { super(e, n), this.node = null; } @@ -9099,7 +10388,7 @@ ${s} this.context = e; let { parseNode: r, src: s } = e, { atLineStart: i, lineStart: o } = e; !i && this.type === u.Type.SEQ_ITEM && (this.error = new u.YAMLSemanticError(this, "Sequence items must not have preceding content on the same line")); - let a2 = i ? n - o : e.indent, c = u.Node.endOfWhiteSpace(s, n + 1), l = s[c], f2 = l === "#", m = [], d = null; + let a2 = i ? n - o : e.indent, c = u.Node.endOfWhiteSpace(s, n + 1), l = s[c], f2 = l === "#", m = [], g = null; for (; l === ` ` || l === "#"; ) { if (l === "#") { @@ -9109,14 +10398,14 @@ ${s} i = true, o = c + 1; let h = u.Node.endOfWhiteSpace(s, o); s[h] === ` -` && m.length === 0 && (d = new Se(), o = d.parse({ src: s }, o)), c = u.Node.endOfIndent(s, o); +` && m.length === 0 && (g = new Ee(), o = g.parse({ src: s }, o)), c = u.Node.endOfIndent(s, o); } l = s[c]; } if (u.Node.nextNodeIsIndented(l, c - (o + a2), this.type !== u.Type.SEQ_ITEM) ? this.node = r({ atLineStart: i, inCollection: false, indent: a2, lineStart: o, parent: this }, c) : l && o > n + 1 && (c = o - 1), this.node) { - if (d) { + if (g) { let h = e.parent.items || e.parent.contents; - h && h.push(d); + h && h.push(g); } m.length && Array.prototype.push.apply(this.props, m), c = this.node.range.end; } else if (f2) { @@ -9135,7 +10424,7 @@ ${s} let i = n ? e.slice(r.start, n.range.start) + String(n) : e.slice(r.start, r.end); return u.Node.addStringTerminator(e, r.end, i); } - }, Ee = class extends u.Node { + }, ye = class extends u.Node { constructor() { super(u.Type.COMMENT); } @@ -9145,10 +10434,10 @@ ${s} return this.range = new u.Range(n, r), r; } }; - function In(t2) { + function An(t2) { let e = t2; - for (; e instanceof ut; ) e = e.node; - if (!(e instanceof Bt)) return null; + for (; e instanceof ot; ) e = e.node; + if (!(e instanceof _t2)) return null; let n = e.items.length, r = -1; for (let o = n - 1; o >= 0; --o) { let a2 = e.items[o]; @@ -9164,7 +10453,7 @@ ${s} for (; e.range.end = i, e.valueRange && e.valueRange.end > i && (e.valueRange.end = i), e !== t2; ) e = e.context.parent; return s; } - var Bt = class t2 extends u.Node { + var _t2 = class t2 extends u.Node { static nextContentHasIndent(e, n, r) { let s = u.Node.endOfLine(e, n) + 1; n = u.Node.endOfWhiteSpace(e, s); @@ -9181,7 +10470,7 @@ ${s} break; } this.items = [e]; - let n = In(e); + let n = An(e); n && Array.prototype.push.apply(this.items, n); } get includesTrailingLines() { @@ -9199,7 +10488,7 @@ ${s} ` || l === "#"; ) { if (f2 && l === ` ` && !m) { - let h = new Se(); + let h = new Ee(); if (c = h.parse({ src: s }, c), this.valueRange.end = c, c >= s.length) { l = null; break; @@ -9207,16 +10496,16 @@ ${s} this.items.push(h), c -= 1; } else if (l === "#") { if (c < i + a2 && !t2.nextContentHasIndent(s, c, a2)) return c; - let h = new Ee(); + let h = new ye(); if (c = h.parse({ indent: a2, lineStart: i, src: s }, c), this.items.push(h), this.valueRange.end = c, c >= s.length) { l = null; break; } } if (i = c + 1, c = u.Node.endOfIndent(s, i), u.Node.atBlank(s, c)) { - let h = u.Node.endOfWhiteSpace(s, c), g = s[h]; - (!g || g === ` -` || g === "#") && (c = h); + let h = u.Node.endOfWhiteSpace(s, c), d = s[h]; + (!d || d === ` +` || d === "#") && (c = h); } l = s[c], f2 = true; } @@ -9239,19 +10528,19 @@ ${s} let h = s[c + 1]; if (!h || h === ` ` || h === " " || h === " ") { - let g = "A collection cannot be both a mapping and a sequence"; - this.error = new u.YAMLSyntaxError(this, g); + let d = "A collection cannot be both a mapping and a sequence"; + this.error = new u.YAMLSyntaxError(this, d); } } - let d = r({ atLineStart: f2, inCollection: true, indent: a2, lineStart: i, parent: this }, c); - if (!d) return c; - if (this.items.push(d), this.valueRange.end = d.valueRange.end, c = u.Node.normalizeOffset(s, d.range.end), l = s[c], f2 = false, m = d.includesTrailingLines, l) { - let h = c - 1, g = s[h]; - for (; g === " " || g === " "; ) g = s[--h]; - g === ` + let g = r({ atLineStart: f2, inCollection: true, indent: a2, lineStart: i, parent: this }, c); + if (!g) return c; + if (this.items.push(g), this.valueRange.end = g.valueRange.end, c = u.Node.normalizeOffset(s, g.range.end), l = s[c], f2 = false, m = g.includesTrailingLines, l) { + let h = c - 1, d = s[h]; + for (; d === " " || d === " "; ) d = s[--h]; + d === ` ` && (i = h + 1, f2 = true); } - let y = In(d); + let y = An(g); y && Array.prototype.push.apply(this.items, y); } return c; @@ -9272,7 +10561,7 @@ ${s} } return u.Node.addStringTerminator(e, r.end, i); } - }, Pn = class extends u.Node { + }, Ln = class extends u.Node { constructor() { super(u.Type.DIRECTIVE), this.name = null; } @@ -9297,7 +10586,7 @@ ${s} let r = this.parseName(n + 1); return r = this.parseParameters(r), r = this.parseComment(r), this.range = new u.Range(n, r), r; } - }, _n = class t2 extends u.Node { + }, Tn = class t2 extends u.Node { static startCommentOrEndBlankLine(e, n) { let r = u.Node.endOfWhiteSpace(e, n), s = e[r]; return s === "#" || s === ` @@ -9314,19 +10603,19 @@ ${s} case ` `: if (r) { - let o = new Se(); + let o = new Ee(); i = o.parse({ src: n }, i), i < n.length && this.directives.push(o); } else i += 1, r = true; break; case "#": { - let o = new Ee(); + let o = new ye(); i = o.parse({ src: n }, i), this.directives.push(o), r = false; } break; case "%": { - let o = new Pn(); + let o = new Ln(); i = o.parse({ parent: this, src: n }, i), this.directives.push(o), s = true, r = false; } break; @@ -9346,14 +10635,14 @@ ${s} case ` `: if (o) { - let a2 = new Se(); + let a2 = new Ee(); i = a2.parse({ src: r }, i), i < r.length && this.contents.push(a2); } else i += 1, o = true; s = i; break; case "#": { - let a2 = new Ee(); + let a2 = new ye(); i = a2.parse({ src: r }, i), this.contents.push(a2), o = false; } break; @@ -9361,7 +10650,7 @@ ${s} let a2 = u.Node.endOfIndent(r, i), l = n({ atLineStart: o, indent: -1, inFlow: false, inCollection: false, lineStart: s, parent: this }, a2); if (!l) return this.valueRange.end = a2; this.contents.push(l), i = l.range.end, o = false; - let f2 = In(l); + let f2 = An(l); f2 && Array.prototype.push.apply(this.contents, f2); } } @@ -9369,7 +10658,7 @@ ${s} } if (this.valueRange.end = i, r[i] && (this.documentEndMarker = new u.Range(i, i + 3), i += 3, r[i])) { if (i = u.Node.endOfWhiteSpace(r, i), r[i] === "#") { - let a2 = new Ee(); + let a2 = new ye(); i = a2.parse({ src: r }, i), this.contents.push(a2); } switch (r[i]) { @@ -9406,18 +10695,18 @@ ${s} ` && (s += ` `), s; } - }, xn = class extends u.Node { + }, Cn = class extends u.Node { parse(e, n) { this.context = e; let { src: r } = e, s = u.Node.endOfIdentifier(r, n + 1); return this.valueRange = new u.Range(n + 1, s), s = u.Node.endOfWhiteSpace(r, s), s = this.parseComment(s), s; } - }, fe = { CLIP: "CLIP", KEEP: "KEEP", STRIP: "STRIP" }, Rn = class extends u.Node { + }, le = { CLIP: "CLIP", KEEP: "KEEP", STRIP: "STRIP" }, Mn = class extends u.Node { constructor(e, n) { - super(e, n), this.blockIndent = null, this.chomping = fe.CLIP, this.header = null; + super(e, n), this.blockIndent = null, this.chomping = le.CLIP, this.header = null; } get includesTrailingLines() { - return this.chomping === fe.KEEP; + return this.chomping === le.KEEP; } get strValue() { if (!this.valueRange || !this.context) return null; @@ -9427,34 +10716,34 @@ ${s} for (; o === ` ` || o === " " || o === " "; ) { if (n -= 1, n <= e) { - if (this.chomping === fe.KEEP) break; + if (this.chomping === le.KEEP) break; return ""; } o === ` ` && (i = n), o = s[n - 1]; } let a2 = n + 1; - i && (this.chomping === fe.KEEP ? (a2 = i, n = this.valueRange.end) : n = i); - let c = r + this.blockIndent, l = this.type === u.Type.BLOCK_FOLDED, f2 = true, m = "", d = "", y = false; + i && (this.chomping === le.KEEP ? (a2 = i, n = this.valueRange.end) : n = i); + let c = r + this.blockIndent, l = this.type === u.Type.BLOCK_FOLDED, f2 = true, m = "", g = "", y = false; for (let h = e; h < n; ++h) { for (let w = 0; w < c && s[h] === " "; ++w) h += 1; - let g = s[h]; - if (g === ` -`) d === ` + let d = s[h]; + if (d === ` +`) g === ` ` ? m += ` -` : d = ` +` : g = ` `; else { - let w = u.Node.endOfLine(s, h), C = s.slice(h, w); - h = w, l && (g === " " || g === " ") && h < a2 ? (d === " " ? d = ` -` : !y && !f2 && d === ` -` && (d = ` + let w = u.Node.endOfLine(s, h), P = s.slice(h, w); + h = w, l && (d === " " || d === " ") && h < a2 ? (g === " " ? g = ` +` : !y && !f2 && g === ` +` && (g = ` -`), m += d + C, d = w < n && s[w] || "", y = true) : (m += d + C, d = l && h < a2 ? " " : ` -`, y = false), f2 && C !== "" && (f2 = false); +`), m += g + P, g = w < n && s[w] || "", y = true) : (m += g + P, g = l && h < a2 ? " " : ` +`, y = false), f2 && P !== "" && (f2 = false); } } - return this.chomping === fe.STRIP ? m : m + ` + return this.chomping === le.STRIP ? m : m + ` `; } parseBlockHeader(e) { @@ -9463,10 +10752,10 @@ ${s} let i = n[r]; switch (i) { case "-": - this.chomping = fe.STRIP; + this.chomping = le.STRIP; break; case "+": - this.chomping = fe.KEEP; + this.chomping = le.KEEP; break; case "0": case "1": @@ -9505,15 +10794,15 @@ ${s} } else if (r[l] !== ` `) { if (m < a2) { - let d = "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"; - this.error = new u.YAMLSemanticError(this, d); + let g = "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"; + this.error = new u.YAMLSemanticError(this, g); } this.blockIndent = m; } else m > a2 && (a2 = m); r[l] === ` ` ? i = l : i = o = u.Node.endOfLine(r, l); } - return this.chomping !== fe.KEEP && (i = r[o] ? o + 1 : o), this.valueRange = new u.Range(e + 1, i), i; + return this.chomping !== le.KEEP && (i = r[o] ? o + 1 : o), this.valueRange = new u.Range(e + 1, i), i; } parse(e, n) { this.context = e; @@ -9523,7 +10812,7 @@ ${s} setOrigRanges(e, n) { return n = super.setOrigRanges(e, n), this.header ? this.header.setOrigRange(e, n) : n; } - }, Dn = class extends u.Node { + }, kn = class extends u.Node { constructor(e, n) { super(e, n), this.items = null; } @@ -9545,7 +10834,7 @@ ${s} let l = u.Node.endOfWhiteSpace(s, o); if (s[l] === ` `) { - let f2 = new Se(); + let f2 = new Ee(); o = f2.parse({ src: s }, o), this.items.push(f2); } if (c = u.Node.endOfIndent(s, o), c <= o + i && (a2 = s[c], c < o + i || a2 !== "]" && a2 !== "}")) { @@ -9559,7 +10848,7 @@ ${s} break; case "#": { - let l = new Ee(); + let l = new ye(); c = l.parse({ src: s }, c), this.items.push(l); } break; @@ -9605,7 +10894,7 @@ ${s} ` && (a2 += 1); }), o += e.slice(a2, r.end), u.Node.addStringTerminator(e, r.end, o); } - }, Yn = class t2 extends u.Node { + }, Pn = class t2 extends u.Node { static endOfQuote(e, n) { let r = e[n]; for (; r && r !== '"'; ) n += r === "\\" ? 2 : 1, r = e[n]; @@ -9713,7 +11002,7 @@ ${s} let { src: r } = e, s = t2.endOfQuote(r, n + 1); return this.valueRange = new u.Range(n, s), s = u.Node.endOfWhiteSpace(r, s), s = this.parseComment(s), s; } - }, $n = class t2 extends u.Node { + }, vn = class t2 extends u.Node { static endOfQuote(e, n) { let r = e[n]; for (; r; ) if (r === "'") { @@ -9750,32 +11039,32 @@ ${s} return this.valueRange = new u.Range(n, s), s = u.Node.endOfWhiteSpace(r, s), s = this.parseComment(s), s; } }; - function vo(t2, e) { + function Eo(t2, e) { switch (t2) { case u.Type.ALIAS: - return new xn(t2, e); + return new Cn(t2, e); case u.Type.BLOCK_FOLDED: case u.Type.BLOCK_LITERAL: - return new Rn(t2, e); + return new Mn(t2, e); case u.Type.FLOW_MAP: case u.Type.FLOW_SEQ: - return new Dn(t2, e); + return new kn(t2, e); case u.Type.MAP_KEY: case u.Type.MAP_VALUE: case u.Type.SEQ_ITEM: - return new ut(t2, e); + return new ot(t2, e); case u.Type.COMMENT: case u.Type.PLAIN: return new u.PlainValue(t2, e); case u.Type.QUOTE_DOUBLE: - return new Yn(t2, e); + return new Pn(t2, e); case u.Type.QUOTE_SINGLE: - return new $n(t2, e); + return new vn(t2, e); default: return null; } } - var Bn = class t2 { + var In = class t2 { static parseType(e, n, r) { switch (e[n]) { case "*": @@ -9805,11 +11094,11 @@ ${s} constructor(e = {}, { atLineStart: n, inCollection: r, inFlow: s, indent: i, lineStart: o, parent: a2 } = {}) { u._defineProperty(this, "parseNode", (c, l) => { if (u.Node.atDocumentBoundary(this.src, l)) return null; - let f2 = new t2(this, c), { props: m, type: d, valueStart: y } = f2.parseProps(l), h = vo(d, m), g = h.parse(f2, y); - if (h.range = new u.Range(l, g), g <= l && (h.error = new Error("Node#parse consumed no characters"), h.error.parseEnd = g, h.error.source = h, h.range.end = l + 1), f2.nodeStartsCollection(h)) { + let f2 = new t2(this, c), { props: m, type: g, valueStart: y } = f2.parseProps(l), h = Eo(g, m), d = h.parse(f2, y); + if (h.range = new u.Range(l, d), d <= l && (h.error = new Error("Node#parse consumed no characters"), h.error.parseEnd = d, h.error.source = h, h.range.end = l + 1), f2.nodeStartsCollection(h)) { !h.error && !f2.atLineStart && f2.parent.type === u.Type.DOCUMENT && (h.error = new u.YAMLSyntaxError(h, "Block collection must not have preceding content here (e.g. directives-end indicator)")); - let w = new Bt(h); - return g = w.parse(new t2(f2), g), w.range = new u.Range(l, g), w; + let w = new _t2(h); + return d = w.parse(new t2(f2), d), w.range = new u.Range(l, d), w; } return h; }), this.atLineStart = n != null ? n : e.atLineStart || false, this.inCollection = r != null ? r : e.inCollection || false, this.inFlow = s != null ? s : e.inFlow || false, this.indent = i != null ? i : e.indent, this.lineStart = o != null ? o : e.lineStart, this.parent = a2 != null ? a2 : e.parent || {}, this.root = e.root, this.src = e.src; @@ -9817,7 +11106,7 @@ ${s} nodeStartsCollection(e) { let { inCollection: n, inFlow: r, src: s } = this; if (n || r) return false; - if (e instanceof ut) return true; + if (e instanceof ot) return true; let i = e.range.end; return s[i] === ` ` || s[i - 1] === ` @@ -9836,8 +11125,8 @@ ${s} f2 = l + 1, l = u.Node.endOfIndent(s, f2); while (s[l] === ` `); - let m = l - (f2 + this.indent), d = r.type === u.Type.SEQ_ITEM && r.context.atLineStart; - if (s[l] !== "#" && !u.Node.nextNodeIsIndented(s[l], m, !d)) break; + let m = l - (f2 + this.indent), g = r.type === u.Type.SEQ_ITEM && r.context.atLineStart; + if (s[l] !== "#" && !u.Node.nextNodeIsIndented(s[l], m, !g)) break; this.atLineStart = true, this.lineStart = f2, o = false, e = l; } else if (a2 === u.Char.COMMENT) { let l = u.Node.endOfLine(s, e + 1); @@ -9853,15258 +11142,10128 @@ ${s} return { props: i, type: c, valueStart: e }; } }; - function Io(t2) { + function So(t2) { let e = []; t2.indexOf("\r") !== -1 && (t2 = t2.replace(/\r\n?/g, (s, i) => (s.length > 1 && e.push(i), ` `))); let n = [], r = 0; do { - let s = new _n(), i = new Bn({ src: t2 }); + let s = new Tn(), i = new In({ src: t2 }); r = s.parse(i, r), n.push(s); } while (r < t2.length); return n.setOrigRanges = () => { if (e.length === 0) return false; - for (let i = 1; i < e.length; ++i) e[i] -= i; - let s = 0; - for (let i = 0; i < n.length; ++i) s = n[i].setOrigRanges(e, s); - return e.splice(0, e.length), true; - }, n.toString = () => n.join(`... -`), n; - } - xs.parse = Io; - }); - var qe = te((k) => { - "use strict"; - var p = le(); - function Po(t2, e, n) { - return n ? `#${n.replace(/[\s\S]^/gm, `$&${e}#`)} -${e}${t2}` : t2; - } - function Fe(t2, e, n) { - return n ? n.indexOf(` -`) === -1 ? `${t2} #${n}` : `${t2} -` + n.replace(/^/gm, `${e || ""}#`) : t2; - } - var W = class { - }; - function ue(t2, e, n) { - if (Array.isArray(t2)) return t2.map((r, s) => ue(r, String(s), n)); - if (t2 && typeof t2.toJSON == "function") { - let r = n && n.anchors && n.anchors.get(t2); - r && (n.onCreate = (i) => { - r.res = i, delete n.onCreate; - }); - let s = t2.toJSON(e, n); - return r && n.onCreate && n.onCreate(s), s; - } - return (!n || !n.keep) && typeof t2 == "bigint" ? Number(t2) : t2; - } - var P = class extends W { - constructor(e) { - super(), this.value = e; - } - toJSON(e, n) { - return n && n.keep ? this.value : ue(this.value, e, n); - } - toString() { - return String(this.value); - } - }; - function Ds(t2, e, n) { - let r = n; - for (let s = e.length - 1; s >= 0; --s) { - let i = e[s]; - if (Number.isInteger(i) && i >= 0) { - let o = []; - o[i] = r, r = o; - } else { - let o = {}; - Object.defineProperty(o, i, { value: r, writable: true, enumerable: true, configurable: true }), r = o; - } - } - return t2.createNode(r, false); - } - var Bs = (t2) => t2 == null || typeof t2 == "object" && t2[Symbol.iterator]().next().done, j = class t2 extends W { - constructor(e) { - super(), p._defineProperty(this, "items", []), this.schema = e; - } - addIn(e, n) { - if (Bs(e)) this.add(n); - else { - let [r, ...s] = e, i = this.get(r, true); - if (i instanceof t2) i.addIn(s, n); - else if (i === void 0 && this.schema) this.set(r, Ds(this.schema, s, n)); - else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`); - } - } - deleteIn([e, ...n]) { - if (n.length === 0) return this.delete(e); - let r = this.get(e, true); - if (r instanceof t2) return r.deleteIn(n); - throw new Error(`Expected YAML collection at ${e}. Remaining path: ${n}`); - } - getIn([e, ...n], r) { - let s = this.get(e, true); - return n.length === 0 ? !r && s instanceof P ? s.value : s : s instanceof t2 ? s.getIn(n, r) : void 0; - } - hasAllNullValues() { - return this.items.every((e) => { - if (!e || e.type !== "PAIR") return false; - let n = e.value; - return n == null || n instanceof P && n.value == null && !n.commentBefore && !n.comment && !n.tag; - }); - } - hasIn([e, ...n]) { - if (n.length === 0) return this.has(e); - let r = this.get(e, true); - return r instanceof t2 ? r.hasIn(n) : false; - } - setIn([e, ...n], r) { - if (n.length === 0) this.set(e, r); - else { - let s = this.get(e, true); - if (s instanceof t2) s.setIn(n, r); - else if (s === void 0 && this.schema) this.set(e, Ds(this.schema, n, r)); - else throw new Error(`Expected YAML collection at ${e}. Remaining path: ${n}`); - } - } - toJSON() { - return null; - } - toString(e, { blockItem: n, flowChars: r, isMap: s, itemIndent: i }, o, a2) { - let { indent: c, indentStep: l, stringify: f2 } = e, m = this.type === p.Type.FLOW_MAP || this.type === p.Type.FLOW_SEQ || e.inFlow; - m && (i += l); - let d = s && this.hasAllNullValues(); - e = Object.assign({}, e, { allNullValues: d, indent: i, inFlow: m, type: null }); - let y = false, h = false, g = this.items.reduce((C, L, M) => { - let A2; - L && (!y && L.spaceBefore && C.push({ type: "comment", str: "" }), L.commentBefore && L.commentBefore.match(/^.*$/gm).forEach((Ai) => { - C.push({ type: "comment", str: `#${Ai}` }); - }), L.comment && (A2 = L.comment), m && (!y && L.spaceBefore || L.commentBefore || L.comment || L.key && (L.key.commentBefore || L.key.comment) || L.value && (L.value.commentBefore || L.value.comment)) && (h = true)), y = false; - let _2 = f2(L, e, () => A2 = null, () => y = true); - return m && !h && _2.includes(` -`) && (h = true), m && M < this.items.length - 1 && (_2 += ","), _2 = Fe(_2, i, A2), y && (A2 || m) && (y = false), C.push({ type: "item", str: _2 }), C; - }, []), w; - if (g.length === 0) w = r.start + r.end; - else if (m) { - let { start: C, end: L } = r, M = g.map((A2) => A2.str); - if (h || M.reduce((A2, _2) => A2 + _2.length + 2, 2) > t2.maxFlowStringSingleLineLength) { - w = C; - for (let A2 of M) w += A2 ? ` -${l}${c}${A2}` : ` -`; - w += ` -${c}${L}`; - } else w = `${C} ${M.join(" ")} ${L}`; - } else { - let C = g.map(n); - w = C.shift(); - for (let L of C) w += L ? ` -${c}${L}` : ` -`; - } - return this.comment ? (w += ` -` + this.comment.replace(/^/gm, `${c}#`), o && o()) : y && a2 && a2(), w; - } - }; - p._defineProperty(j, "maxFlowStringSingleLineLength", 60); - function Ft(t2) { - let e = t2 instanceof P ? t2.value : t2; - return e && typeof e == "string" && (e = Number(e)), Number.isInteger(e) && e >= 0 ? e : null; - } - var pe = class extends j { - add(e) { - this.items.push(e); - } - delete(e) { - let n = Ft(e); - return typeof n != "number" ? false : this.items.splice(n, 1).length > 0; - } - get(e, n) { - let r = Ft(e); - if (typeof r != "number") return; - let s = this.items[r]; - return !n && s instanceof P ? s.value : s; - } - has(e) { - let n = Ft(e); - return typeof n == "number" && n < this.items.length; - } - set(e, n) { - let r = Ft(e); - if (typeof r != "number") throw new Error(`Expected a valid index, not ${e}.`); - this.items[r] = n; - } - toJSON(e, n) { - let r = []; - n && n.onCreate && n.onCreate(r); - let s = 0; - for (let i of this.items) r.push(ue(i, String(s++), n)); - return r; - } - toString(e, n, r) { - return e ? super.toString(e, { blockItem: (s) => s.type === "comment" ? s.str : `- ${s.str}`, flowChars: { start: "[", end: "]" }, isMap: false, itemIndent: (e.indent || "") + " " }, n, r) : JSON.stringify(this); - } - }, _o = (t2, e, n) => e === null ? "" : typeof e != "object" ? String(e) : t2 instanceof W && n && n.doc ? t2.toString({ anchors: /* @__PURE__ */ Object.create(null), doc: n.doc, indent: "", indentStep: n.indentStep, inFlow: true, inStringifyKey: true, stringify: n.stringify }) : JSON.stringify(e), T = class t2 extends W { - constructor(e, n = null) { - super(), this.key = e, this.value = n, this.type = t2.Type.PAIR; - } - get commentBefore() { - return this.key instanceof W ? this.key.commentBefore : void 0; - } - set commentBefore(e) { - if (this.key == null && (this.key = new P(null)), this.key instanceof W) this.key.commentBefore = e; - else { - let n = "Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node."; - throw new Error(n); - } - } - addToJSMap(e, n) { - let r = ue(this.key, "", e); - if (n instanceof Map) { - let s = ue(this.value, r, e); - n.set(r, s); - } else if (n instanceof Set) n.add(r); - else { - let s = _o(this.key, r, e), i = ue(this.value, s, e); - s in n ? Object.defineProperty(n, s, { value: i, writable: true, enumerable: true, configurable: true }) : n[s] = i; - } - return n; - } - toJSON(e, n) { - let r = n && n.mapAsMap ? /* @__PURE__ */ new Map() : {}; - return this.addToJSMap(n, r); - } - toString(e, n, r) { - if (!e || !e.doc) return JSON.stringify(this); - let { indent: s, indentSeq: i, simpleKeys: o } = e.doc.options, { key: a2, value: c } = this, l = a2 instanceof W && a2.comment; - if (o) { - if (l) throw new Error("With simple keys, key nodes cannot have comments"); - if (a2 instanceof j) { - let _2 = "With simple keys, collection cannot be used as a key value"; - throw new Error(_2); - } - } - let f2 = !o && (!a2 || l || (a2 instanceof W ? a2 instanceof j || a2.type === p.Type.BLOCK_FOLDED || a2.type === p.Type.BLOCK_LITERAL : typeof a2 == "object")), { doc: m, indent: d, indentStep: y, stringify: h } = e; - e = Object.assign({}, e, { implicitKey: !f2, indent: d + y }); - let g = false, w = h(a2, e, () => l = null, () => g = true); - if (w = Fe(w, e.indent, l), !f2 && w.length > 1024) { - if (o) throw new Error("With simple keys, single line scalar must not span more than 1024 characters"); - f2 = true; - } - if (e.allNullValues && !o) return this.comment ? (w = Fe(w, e.indent, this.comment), n && n()) : g && !l && r && r(), e.inFlow && !f2 ? w : `? ${w}`; - w = f2 ? `? ${w} -${d}:` : `${w}:`, this.comment && (w = Fe(w, e.indent, this.comment), n && n()); - let C = "", L = null; - if (c instanceof W) { - if (c.spaceBefore && (C = ` -`), c.commentBefore) { - let _2 = c.commentBefore.replace(/^/gm, `${e.indent}#`); - C += ` -${_2}`; - } - L = c.comment; - } else c && typeof c == "object" && (c = m.schema.createNode(c, true)); - e.implicitKey = false, !f2 && !this.comment && c instanceof P && (e.indentAtStart = w.length + 1), g = false, !i && s >= 2 && !e.inFlow && !f2 && c instanceof pe && c.type !== p.Type.FLOW_SEQ && !c.tag && !m.anchors.getName(c) && (e.indent = e.indent.substr(2)); - let M = h(c, e, () => L = null, () => g = true), A2 = " "; - return C || this.comment ? A2 = `${C} -${e.indent}` : !f2 && c instanceof j ? (!(M[0] === "[" || M[0] === "{") || M.includes(` -`)) && (A2 = ` -${e.indent}`) : M[0] === ` -` && (A2 = ""), g && !L && r && r(), Fe(w + A2 + M, e.indent, L); - } - }; - p._defineProperty(T, "Type", { PAIR: "PAIR", MERGE_PAIR: "MERGE_PAIR" }); - var qt = (t2, e) => { - if (t2 instanceof be) { - let n = e.get(t2.source); - return n.count * n.aliasCount; - } else if (t2 instanceof j) { - let n = 0; - for (let r of t2.items) { - let s = qt(r, e); - s > n && (n = s); - } - return n; - } else if (t2 instanceof T) { - let n = qt(t2.key, e), r = qt(t2.value, e); - return Math.max(n, r); - } - return 1; - }, be = class t2 extends W { - static stringify({ range: e, source: n }, { anchors: r, doc: s, implicitKey: i, inStringifyKey: o }) { - let a2 = Object.keys(r).find((l) => r[l] === n); - if (!a2 && o && (a2 = s.anchors.getName(n) || s.anchors.newName()), a2) return `*${a2}${i ? " " : ""}`; - let c = s.anchors.getName(n) ? "Alias node must be after source node" : "Source node not found for alias node"; - throw new Error(`${c} [${e}]`); - } - constructor(e) { - super(), this.source = e, this.type = p.Type.ALIAS; - } - set tag(e) { - throw new Error("Alias nodes cannot have tags"); - } - toJSON(e, n) { - if (!n) return ue(this.source, e, n); - let { anchors: r, maxAliasCount: s } = n, i = r.get(this.source); - if (!i || i.res === void 0) { - let o = "This should not happen: Alias anchor was not resolved?"; - throw this.cstNode ? new p.YAMLReferenceError(this.cstNode, o) : new ReferenceError(o); - } - if (s >= 0 && (i.count += 1, i.aliasCount === 0 && (i.aliasCount = qt(this.source, r)), i.count * i.aliasCount > s)) { - let o = "Excessive alias count indicates a resource exhaustion attack"; - throw this.cstNode ? new p.YAMLReferenceError(this.cstNode, o) : new ReferenceError(o); - } - return i.res; - } - toString(e) { - return t2.stringify(this, e); - } - }; - p._defineProperty(be, "default", true); - function pt(t2, e) { - let n = e instanceof P ? e.value : e; - for (let r of t2) if (r instanceof T && (r.key === e || r.key === n || r.key && r.key.value === n)) return r; - } - var mt = class extends j { - add(e, n) { - e ? e instanceof T || (e = new T(e.key || e, e.value)) : e = new T(e); - let r = pt(this.items, e.key), s = this.schema && this.schema.sortMapEntries; - if (r) if (n) r.value = e.value; - else throw new Error(`Key ${e.key} already set`); - else if (s) { - let i = this.items.findIndex((o) => s(e, o) < 0); - i === -1 ? this.items.push(e) : this.items.splice(i, 0, e); - } else this.items.push(e); - } - delete(e) { - let n = pt(this.items, e); - return n ? this.items.splice(this.items.indexOf(n), 1).length > 0 : false; - } - get(e, n) { - let r = pt(this.items, e), s = r && r.value; - return !n && s instanceof P ? s.value : s; - } - has(e) { - return !!pt(this.items, e); - } - set(e, n) { - this.add(new T(e, n), true); - } - toJSON(e, n, r) { - let s = r ? new r() : n && n.mapAsMap ? /* @__PURE__ */ new Map() : {}; - n && n.onCreate && n.onCreate(s); - for (let i of this.items) i.addToJSMap(n, s); - return s; - } - toString(e, n, r) { - if (!e) return JSON.stringify(this); - for (let s of this.items) if (!(s instanceof T)) throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`); - return super.toString(e, { blockItem: (s) => s.str, flowChars: { start: "{", end: "}" }, isMap: true, itemIndent: e.indent || "" }, n, r); - } - }, Fs = "<<", Vt = class extends T { - constructor(e) { - if (e instanceof T) { - let n = e.value; - n instanceof pe || (n = new pe(), n.items.push(e.value), n.range = e.value.range), super(e.key, n), this.range = e.range; - } else super(new P(Fs), new pe()); - this.type = T.Type.MERGE_PAIR; - } - addToJSMap(e, n) { - for (let { source: r } of this.value.items) { - if (!(r instanceof mt)) throw new Error("Merge sources must be maps"); - let s = r.toJSON(null, e, Map); - for (let [i, o] of s) n instanceof Map ? n.has(i) || n.set(i, o) : n instanceof Set ? n.add(i) : Object.prototype.hasOwnProperty.call(n, i) || Object.defineProperty(n, i, { value: o, writable: true, enumerable: true, configurable: true }); - } - return n; - } - toString(e, n) { - let r = this.value; - if (r.items.length > 1) return super.toString(e, n); - this.value = r.items[0]; - let s = super.toString(e, n); - return this.value = r, s; - } - }, xo = { defaultType: p.Type.BLOCK_LITERAL, lineWidth: 76 }, Ro = { trueStr: "true", falseStr: "false" }, Do = { asBigInt: false }, Yo = { nullStr: "null" }, Ne = { defaultType: p.Type.PLAIN, doubleQuoted: { jsonEncoding: false, minMultiLineLength: 40 }, fold: { lineWidth: 80, minContentWidth: 20 } }; - function qn(t2, e, n) { - for (let { format: r, test: s, resolve: i } of e) if (s) { - let o = t2.match(s); - if (o) { - let a2 = i.apply(null, o); - return a2 instanceof P || (a2 = new P(a2)), r && (a2.format = r), a2; - } - } - return n && (t2 = n(t2)), new P(t2); - } - var qs = "flow", Fn = "block", Ut = "quoted", Ys = (t2, e) => { - let n = t2[e + 1]; - for (; n === " " || n === " "; ) { - do - n = t2[e += 1]; - while (n && n !== ` -`); - n = t2[e + 1]; - } - return e; - }; - function Wt(t2, e, n, { indentAtStart: r, lineWidth: s = 80, minContentWidth: i = 20, onFold: o, onOverflow: a2 }) { - if (!s || s < 0) return t2; - let c = Math.max(1 + i, 1 + s - e.length); - if (t2.length <= c) return t2; - let l = [], f2 = {}, m = s - e.length; - typeof r == "number" && (r > s - Math.max(2, i) ? l.push(0) : m = s - r); - let d, y, h = false, g = -1, w = -1, C = -1; - n === Fn && (g = Ys(t2, g), g !== -1 && (m = g + c)); - for (let M; M = t2[g += 1]; ) { - if (n === Ut && M === "\\") { - switch (w = g, t2[g + 1]) { - case "x": - g += 3; - break; - case "u": - g += 5; - break; - case "U": - g += 9; - break; - default: - g += 1; - } - C = g; - } - if (M === ` -`) n === Fn && (g = Ys(t2, g)), m = g + c, d = void 0; - else { - if (M === " " && y && y !== " " && y !== ` -` && y !== " ") { - let A2 = t2[g + 1]; - A2 && A2 !== " " && A2 !== ` -` && A2 !== " " && (d = g); - } - if (g >= m) if (d) l.push(d), m = d + c, d = void 0; - else if (n === Ut) { - for (; y === " " || y === " "; ) y = M, M = t2[g += 1], h = true; - let A2 = g > C + 1 ? g - 2 : w - 1; - if (f2[A2]) return t2; - l.push(A2), f2[A2] = true, m = A2 + c, d = void 0; - } else h = true; - } - y = M; - } - if (h && a2 && a2(), l.length === 0) return t2; - o && o(); - let L = t2.slice(0, l[0]); - for (let M = 0; M < l.length; ++M) { - let A2 = l[M], _2 = l[M + 1] || t2.length; - A2 === 0 ? L = ` -${e}${t2.slice(0, _2)}` : (n === Ut && f2[A2] && (L += `${t2[A2]}\\`), L += ` -${e}${t2.slice(A2 + 1, _2)}`); - } - return L; - } - var Un = ({ indentAtStart: t2 }) => t2 ? Object.assign({ indentAtStart: t2 }, Ne.fold) : Ne.fold, jt = (t2) => /^(%|---|\.\.\.)/m.test(t2); - function $o(t2, e, n) { - if (!e || e < 0) return false; - let r = e - n, s = t2.length; - if (s <= r) return false; - for (let i = 0, o = 0; i < s; ++i) if (t2[i] === ` -`) { - if (i - o > r) return true; - if (o = i + 1, s - o <= r) return false; - } - return true; - } - function we(t2, e) { - let { implicitKey: n } = e, { jsonEncoding: r, minMultiLineLength: s } = Ne.doubleQuoted, i = JSON.stringify(t2); - if (r) return i; - let o = e.indent || (jt(t2) ? " " : ""), a2 = "", c = 0; - for (let l = 0, f2 = i[l]; f2; f2 = i[++l]) if (f2 === " " && i[l + 1] === "\\" && i[l + 2] === "n" && (a2 += i.slice(c, l) + "\\ ", l += 1, c = l, f2 = "\\"), f2 === "\\") switch (i[l + 1]) { - case "u": - { - a2 += i.slice(c, l); - let m = i.substr(l + 2, 4); - switch (m) { - case "0000": - a2 += "\\0"; - break; - case "0007": - a2 += "\\a"; - break; - case "000b": - a2 += "\\v"; - break; - case "001b": - a2 += "\\e"; - break; - case "0085": - a2 += "\\N"; - break; - case "00a0": - a2 += "\\_"; - break; - case "2028": - a2 += "\\L"; - break; - case "2029": - a2 += "\\P"; - break; - default: - m.substr(0, 2) === "00" ? a2 += "\\x" + m.substr(2) : a2 += i.substr(l, 6); - } - l += 5, c = l + 1; - } - break; - case "n": - if (n || i[l + 2] === '"' || i.length < s) l += 1; - else { - for (a2 += i.slice(c, l) + ` - -`; i[l + 2] === "\\" && i[l + 3] === "n" && i[l + 4] !== '"'; ) a2 += ` -`, l += 2; - a2 += o, i[l + 2] === " " && (a2 += "\\"), l += 1, c = l + 1; - } - break; - default: - l += 1; - } - return a2 = c ? a2 + i.slice(c) : i, n ? a2 : Wt(a2, o, Ut, Un(e)); - } - function Us(t2, e) { - if (e.implicitKey) { - if (/\n/.test(t2)) return we(t2, e); - } else if (/[ \t]\n|\n[ \t]/.test(t2)) return we(t2, e); - let n = e.indent || (jt(t2) ? " " : ""), r = "'" + t2.replace(/'/g, "''").replace(/\n+/g, `$& -${n}`) + "'"; - return e.implicitKey ? r : Wt(r, n, qs, Un(e)); - } - function Kt({ comment: t2, type: e, value: n }, r, s, i) { - if (/\n[\t ]+$/.test(n) || /^\s*$/.test(n)) return we(n, r); - let o = r.indent || (r.forceBlockIndent || jt(n) ? " " : ""), a2 = o ? "2" : "1", c = e === p.Type.BLOCK_FOLDED ? false : e === p.Type.BLOCK_LITERAL ? true : !$o(n, Ne.fold.lineWidth, o.length), l = c ? "|" : ">"; - if (!n) return l + ` -`; - let f2 = "", m = ""; - if (n = n.replace(/[\n\t ]*$/, (y) => { - let h = y.indexOf(` -`); - return h === -1 ? l += "-" : (n === y || h !== y.length - 1) && (l += "+", i && i()), m = y.replace(/\n$/, ""), ""; - }).replace(/^[\n ]*/, (y) => { - y.indexOf(" ") !== -1 && (l += a2); - let h = y.match(/ +$/); - return h ? (f2 = y.slice(0, -h[0].length), h[0]) : (f2 = y, ""); - }), m && (m = m.replace(/\n+(?!\n|$)/g, `$&${o}`)), f2 && (f2 = f2.replace(/\n+/g, `$&${o}`)), t2 && (l += " #" + t2.replace(/ ?[\r\n]+/g, " "), s && s()), !n) return `${l}${a2} -${o}${m}`; - if (c) return n = n.replace(/\n+/g, `$&${o}`), `${l} -${o}${f2}${n}${m}`; - n = n.replace(/\n+/g, ` -$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${o}`); - let d = Wt(`${f2}${n}${m}`, o, Fn, Ne.fold); - return `${l} -${o}${d}`; - } - function Bo(t2, e, n, r) { - let { comment: s, type: i, value: o } = t2, { actualString: a2, implicitKey: c, indent: l, inFlow: f2 } = e; - if (c && /[\n[\]{},]/.test(o) || f2 && /[[\]{},]/.test(o)) return we(o, e); - if (!o || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o)) return c || f2 || o.indexOf(` -`) === -1 ? o.indexOf('"') !== -1 && o.indexOf("'") === -1 ? Us(o, e) : we(o, e) : Kt(t2, e, n, r); - if (!c && !f2 && i !== p.Type.PLAIN && o.indexOf(` -`) !== -1) return Kt(t2, e, n, r); - if (l === "" && jt(o)) return e.forceBlockIndent = true, Kt(t2, e, n, r); - let m = o.replace(/\n+/g, `$& -${l}`); - if (a2) { - let { tags: y } = e.doc.schema; - if (typeof qn(m, y, y.scalarFallback).value != "string") return we(o, e); - } - let d = c ? m : Wt(m, l, qs, Un(e)); - return s && !f2 && (d.indexOf(` -`) !== -1 || s.indexOf(` -`) !== -1) ? (n && n(), Po(d, l, s)) : d; - } - function Fo(t2, e, n, r) { - let { defaultType: s } = Ne, { implicitKey: i, inFlow: o } = e, { type: a2, value: c } = t2; - typeof c != "string" && (c = String(c), t2 = Object.assign({}, t2, { value: c })); - let l = (m) => { - switch (m) { - case p.Type.BLOCK_FOLDED: - case p.Type.BLOCK_LITERAL: - return Kt(t2, e, n, r); - case p.Type.QUOTE_DOUBLE: - return we(c, e); - case p.Type.QUOTE_SINGLE: - return Us(c, e); - case p.Type.PLAIN: - return Bo(t2, e, n, r); - default: - return null; - } - }; - (a2 !== p.Type.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(c) || (i || o) && (a2 === p.Type.BLOCK_FOLDED || a2 === p.Type.BLOCK_LITERAL)) && (a2 = p.Type.QUOTE_DOUBLE); - let f2 = l(a2); - if (f2 === null && (f2 = l(s), f2 === null)) throw new Error(`Unsupported default string type ${s}`); - return f2; - } - function qo({ format: t2, minFractionDigits: e, tag: n, value: r }) { - if (typeof r == "bigint") return String(r); - if (!isFinite(r)) return isNaN(r) ? ".nan" : r < 0 ? "-.inf" : ".inf"; - let s = JSON.stringify(r); - if (!t2 && e && (!n || n === "tag:yaml.org,2002:float") && /^\d/.test(s)) { - let i = s.indexOf("."); - i < 0 && (i = s.length, s += "."); - let o = e - (s.length - i - 1); - for (; o-- > 0; ) s += "0"; - } - return s; - } - function Ks(t2, e) { - let n, r; - switch (e.type) { - case p.Type.FLOW_MAP: - n = "}", r = "flow map"; - break; - case p.Type.FLOW_SEQ: - n = "]", r = "flow sequence"; - break; - default: - t2.push(new p.YAMLSemanticError(e, "Not a flow collection!?")); - return; - } - let s; - for (let i = e.items.length - 1; i >= 0; --i) { - let o = e.items[i]; - if (!o || o.type !== p.Type.COMMENT) { - s = o; - break; - } - } - if (s && s.char !== n) { - let i = `Expected ${r} to end with ${n}`, o; - typeof s.offset == "number" ? (o = new p.YAMLSemanticError(e, i), o.offset = s.offset + 1) : (o = new p.YAMLSemanticError(s, i), s.range && s.range.end && (o.offset = s.range.end - s.range.start)), t2.push(o); - } - } - function Vs(t2, e) { - let n = e.context.src[e.range.start - 1]; - if (n !== ` -` && n !== " " && n !== " ") { - let r = "Comments must be separated from other tokens by white space characters"; - t2.push(new p.YAMLSemanticError(e, r)); - } - } - function Ws(t2, e) { - let n = String(e), r = n.substr(0, 8) + "..." + n.substr(-8); - return new p.YAMLSemanticError(t2, `The "${r}" key is too long`); - } - function js(t2, e) { - for (let { afterKey: n, before: r, comment: s } of e) { - let i = t2.items[r]; - i ? (n && i.value && (i = i.value), s === void 0 ? (n || !i.commentBefore) && (i.spaceBefore = true) : i.commentBefore ? i.commentBefore += ` -` + s : i.commentBefore = s) : s !== void 0 && (t2.comment ? t2.comment += ` -` + s : t2.comment = s); - } - } - function Kn(t2, e) { - let n = e.strValue; - return n ? typeof n == "string" ? n : (n.errors.forEach((r) => { - r.source || (r.source = e), t2.errors.push(r); - }), n.str) : ""; - } - function Uo(t2, e) { - let { handle: n, suffix: r } = e.tag, s = t2.tagPrefixes.find((i) => i.handle === n); - if (!s) { - let i = t2.getDefaults().tagPrefixes; - if (i && (s = i.find((o) => o.handle === n)), !s) throw new p.YAMLSemanticError(e, `The ${n} tag handle is non-default and was not declared.`); - } - if (!r) throw new p.YAMLSemanticError(e, `The ${n} tag has no suffix.`); - if (n === "!" && (t2.version || t2.options.version) === "1.0") { - if (r[0] === "^") return t2.warnings.push(new p.YAMLWarning(e, "YAML 1.0 ^ tag expansion is not supported")), r; - if (/[:/]/.test(r)) { - let i = r.match(/^([a-z0-9-]+)\/(.*)/i); - return i ? `tag:${i[1]}.yaml.org,2002:${i[2]}` : `tag:${r}`; - } - } - return s.prefix + decodeURIComponent(r); - } - function Ko(t2, e) { - let { tag: n, type: r } = e, s = false; - if (n) { - let { handle: i, suffix: o, verbatim: a2 } = n; - if (a2) { - if (a2 !== "!" && a2 !== "!!") return a2; - let c = `Verbatim tags aren't resolved, so ${a2} is invalid.`; - t2.errors.push(new p.YAMLSemanticError(e, c)); - } else if (i === "!" && !o) s = true; - else try { - return Uo(t2, e); - } catch (c) { - t2.errors.push(c); - } - } - switch (r) { - case p.Type.BLOCK_FOLDED: - case p.Type.BLOCK_LITERAL: - case p.Type.QUOTE_DOUBLE: - case p.Type.QUOTE_SINGLE: - return p.defaultTags.STR; - case p.Type.FLOW_MAP: - case p.Type.MAP: - return p.defaultTags.MAP; - case p.Type.FLOW_SEQ: - case p.Type.SEQ: - return p.defaultTags.SEQ; - case p.Type.PLAIN: - return s ? p.defaultTags.STR : null; - default: - return null; - } - } - function $s(t2, e, n) { - let { tags: r } = t2.schema, s = []; - for (let o of r) if (o.tag === n) if (o.test) s.push(o); - else { - let a2 = o.resolve(t2, e); - return a2 instanceof j ? a2 : new P(a2); - } - let i = Kn(t2, e); - return typeof i == "string" && s.length > 0 ? qn(i, s, r.scalarFallback) : null; - } - function Vo({ type: t2 }) { - switch (t2) { - case p.Type.FLOW_MAP: - case p.Type.MAP: - return p.defaultTags.MAP; - case p.Type.FLOW_SEQ: - case p.Type.SEQ: - return p.defaultTags.SEQ; - default: - return p.defaultTags.STR; - } - } - function Wo(t2, e, n) { - try { - let r = $s(t2, e, n); - if (r) return n && e.tag && (r.tag = n), r; - } catch (r) { - return r.source || (r.source = e), t2.errors.push(r), null; - } - try { - let r = Vo(e); - if (!r) throw new Error(`The tag ${n} is unavailable`); - let s = `The tag ${n} is unavailable, falling back to ${r}`; - t2.warnings.push(new p.YAMLWarning(e, s)); - let i = $s(t2, e, r); - return i.tag = n, i; - } catch (r) { - let s = new p.YAMLReferenceError(e, r.message); - return s.stack = r.stack, t2.errors.push(s), null; - } - } - var jo = (t2) => { - if (!t2) return false; - let { type: e } = t2; - return e === p.Type.MAP_KEY || e === p.Type.MAP_VALUE || e === p.Type.SEQ_ITEM; - }; - function Qo(t2, e) { - let n = { before: [], after: [] }, r = false, s = false, i = jo(e.context.parent) ? e.context.parent.props.concat(e.props) : e.props; - for (let { start: o, end: a2 } of i) switch (e.context.src[o]) { - case p.Char.COMMENT: { - if (!e.commentHasRequiredWhitespace(o)) { - let m = "Comments must be separated from other tokens by white space characters"; - t2.push(new p.YAMLSemanticError(e, m)); - } - let { header: c, valueRange: l } = e; - (l && (o > l.start || c && o > c.start) ? n.after : n.before).push(e.context.src.slice(o + 1, a2)); - break; - } - case p.Char.ANCHOR: - if (r) { - let c = "A node can have at most one anchor"; - t2.push(new p.YAMLSemanticError(e, c)); - } - r = true; - break; - case p.Char.TAG: - if (s) { - let c = "A node can have at most one tag"; - t2.push(new p.YAMLSemanticError(e, c)); - } - s = true; - break; - } - return { comments: n, hasAnchor: r, hasTag: s }; - } - function Jo(t2, e) { - let { anchors: n, errors: r, schema: s } = t2; - if (e.type === p.Type.ALIAS) { - let o = e.rawValue, a2 = n.getNode(o); - if (!a2) { - let l = `Aliased anchor not found: ${o}`; - return r.push(new p.YAMLReferenceError(e, l)), null; - } - let c = new be(a2); - return n._cstAliases.push(c), c; - } - let i = Ko(t2, e); - if (i) return Wo(t2, e, i); - if (e.type !== p.Type.PLAIN) { - let o = `Failed to resolve ${e.type} node here`; - return r.push(new p.YAMLSyntaxError(e, o)), null; - } - try { - let o = Kn(t2, e); - return qn(o, s.tags, s.tags.scalarFallback); - } catch (o) { - return o.source || (o.source = e), r.push(o), null; - } - } - function me(t2, e) { - if (!e) return null; - e.error && t2.errors.push(e.error); - let { comments: n, hasAnchor: r, hasTag: s } = Qo(t2.errors, e); - if (r) { - let { anchors: o } = t2, a2 = e.anchor, c = o.getNode(a2); - c && (o.map[o.newName(a2)] = c), o.map[a2] = e; - } - if (e.type === p.Type.ALIAS && (r || s)) { - let o = "An alias node must not specify any properties"; - t2.errors.push(new p.YAMLSemanticError(e, o)); - } - let i = Jo(t2, e); - if (i) { - i.range = [e.range.start, e.range.end], t2.options.keepCstNodes && (i.cstNode = e), t2.options.keepNodeTypes && (i.type = e.type); - let o = n.before.join(` -`); - o && (i.commentBefore = i.commentBefore ? `${i.commentBefore} -${o}` : o); - let a2 = n.after.join(` -`); - a2 && (i.comment = i.comment ? `${i.comment} -${a2}` : a2); - } - return e.resolved = i; - } - function Go(t2, e) { - if (e.type !== p.Type.MAP && e.type !== p.Type.FLOW_MAP) { - let o = `A ${e.type} node cannot be resolved as a mapping`; - return t2.errors.push(new p.YAMLSyntaxError(e, o)), null; - } - let { comments: n, items: r } = e.type === p.Type.FLOW_MAP ? Zo(t2, e) : zo(t2, e), s = new mt(); - s.items = r, js(s, n); - let i = false; - for (let o = 0; o < r.length; ++o) { - let { key: a2 } = r[o]; - if (a2 instanceof j && (i = true), t2.schema.merge && a2 && a2.value === Fs) { - r[o] = new Vt(r[o]); - let c = r[o].value.items, l = null; - c.some((f2) => { - if (f2 instanceof be) { - let { type: m } = f2.source; - return m === p.Type.MAP || m === p.Type.FLOW_MAP ? false : l = "Merge nodes aliases can only point to maps"; - } - return l = "Merge nodes can only have Alias nodes as values"; - }), l && t2.errors.push(new p.YAMLSemanticError(e, l)); - } else for (let c = o + 1; c < r.length; ++c) { - let { key: l } = r[c]; - if (a2 === l || a2 && l && Object.prototype.hasOwnProperty.call(a2, "value") && a2.value === l.value) { - let f2 = `Map keys must be unique; "${a2}" is repeated`; - t2.errors.push(new p.YAMLSemanticError(e, f2)); - break; - } - } - } - if (i && !t2.options.mapAsMap) { - let o = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this."; - t2.warnings.push(new p.YAMLWarning(e, o)); - } - return e.resolved = s, s; - } - var Ho = ({ context: { lineStart: t2, node: e, src: n }, props: r }) => { - if (r.length === 0) return false; - let { start: s } = r[0]; - if (e && s > e.valueRange.start || n[s] !== p.Char.COMMENT) return false; - for (let i = t2; i < s; ++i) if (n[i] === ` -`) return false; - return true; - }; - function Xo(t2, e) { - if (!Ho(t2)) return; - let n = t2.getPropValue(0, p.Char.COMMENT, true), r = false, s = e.value.commentBefore; - if (s && s.startsWith(n)) e.value.commentBefore = s.substr(n.length + 1), r = true; - else { - let i = e.value.comment; - !t2.node && i && i.startsWith(n) && (e.value.comment = i.substr(n.length + 1), r = true); - } - r && (e.comment = n); - } - function zo(t2, e) { - let n = [], r = [], s, i = null; - for (let o = 0; o < e.items.length; ++o) { - let a2 = e.items[o]; - switch (a2.type) { - case p.Type.BLANK_LINE: - n.push({ afterKey: !!s, before: r.length }); - break; - case p.Type.COMMENT: - n.push({ afterKey: !!s, before: r.length, comment: a2.comment }); - break; - case p.Type.MAP_KEY: - s !== void 0 && r.push(new T(s)), a2.error && t2.errors.push(a2.error), s = me(t2, a2.node), i = null; - break; - case p.Type.MAP_VALUE: - { - if (s === void 0 && (s = null), a2.error && t2.errors.push(a2.error), !a2.context.atLineStart && a2.node && a2.node.type === p.Type.MAP && !a2.node.context.atLineStart) { - let f2 = "Nested mappings are not allowed in compact mappings"; - t2.errors.push(new p.YAMLSemanticError(a2.node, f2)); - } - let c = a2.node; - if (!c && a2.props.length > 0) { - c = new p.PlainValue(p.Type.PLAIN, []), c.context = { parent: a2, src: a2.context.src }; - let f2 = a2.range.start + 1; - if (c.range = { start: f2, end: f2 }, c.valueRange = { start: f2, end: f2 }, typeof a2.range.origStart == "number") { - let m = a2.range.origStart + 1; - c.range.origStart = c.range.origEnd = m, c.valueRange.origStart = c.valueRange.origEnd = m; - } - } - let l = new T(s, me(t2, c)); - Xo(a2, l), r.push(l), s && typeof i == "number" && a2.range.start > i + 1024 && t2.errors.push(Ws(e, s)), s = void 0, i = null; - } - break; - default: - s !== void 0 && r.push(new T(s)), s = me(t2, a2), i = a2.range.start, a2.error && t2.errors.push(a2.error); - e: for (let c = o + 1; ; ++c) { - let l = e.items[c]; - switch (l && l.type) { - case p.Type.BLANK_LINE: - case p.Type.COMMENT: - continue e; - case p.Type.MAP_VALUE: - break e; - default: { - let f2 = "Implicit map keys need to be followed by map values"; - t2.errors.push(new p.YAMLSemanticError(a2, f2)); - break e; - } - } - } - if (a2.valueRangeContainsNewline) { - let c = "Implicit map keys need to be on a single line"; - t2.errors.push(new p.YAMLSemanticError(a2, c)); - } - } - } - return s !== void 0 && r.push(new T(s)), { comments: n, items: r }; - } - function Zo(t2, e) { - let n = [], r = [], s, i = false, o = "{"; - for (let a2 = 0; a2 < e.items.length; ++a2) { - let c = e.items[a2]; - if (typeof c.char == "string") { - let { char: l, offset: f2 } = c; - if (l === "?" && s === void 0 && !i) { - i = true, o = ":"; - continue; - } - if (l === ":") { - if (s === void 0 && (s = null), o === ":") { - o = ","; - continue; - } - } else if (i && (s === void 0 && l !== "," && (s = null), i = false), s !== void 0 && (r.push(new T(s)), s = void 0, l === ",")) { - o = ":"; - continue; - } - if (l === "}") { - if (a2 === e.items.length - 1) continue; - } else if (l === o) { - o = ":"; - continue; - } - let m = `Flow map contains an unexpected ${l}`, d = new p.YAMLSyntaxError(e, m); - d.offset = f2, t2.errors.push(d); - } else c.type === p.Type.BLANK_LINE ? n.push({ afterKey: !!s, before: r.length }) : c.type === p.Type.COMMENT ? (Vs(t2.errors, c), n.push({ afterKey: !!s, before: r.length, comment: c.comment })) : s === void 0 ? (o === "," && t2.errors.push(new p.YAMLSemanticError(c, "Separator , missing in flow map")), s = me(t2, c)) : (o !== "," && t2.errors.push(new p.YAMLSemanticError(c, "Indicator : missing in flow map entry")), r.push(new T(s, me(t2, c))), s = void 0, i = false); - } - return Ks(t2.errors, e), s !== void 0 && r.push(new T(s)), { comments: n, items: r }; - } - function ea(t2, e) { - if (e.type !== p.Type.SEQ && e.type !== p.Type.FLOW_SEQ) { - let i = `A ${e.type} node cannot be resolved as a sequence`; - return t2.errors.push(new p.YAMLSyntaxError(e, i)), null; - } - let { comments: n, items: r } = e.type === p.Type.FLOW_SEQ ? na(t2, e) : ta(t2, e), s = new pe(); - if (s.items = r, js(s, n), !t2.options.mapAsMap && r.some((i) => i instanceof T && i.key instanceof j)) { - let i = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this."; - t2.warnings.push(new p.YAMLWarning(e, i)); - } - return e.resolved = s, s; - } - function ta(t2, e) { - let n = [], r = []; - for (let s = 0; s < e.items.length; ++s) { - let i = e.items[s]; - switch (i.type) { - case p.Type.BLANK_LINE: - n.push({ before: r.length }); - break; - case p.Type.COMMENT: - n.push({ comment: i.comment, before: r.length }); - break; - case p.Type.SEQ_ITEM: - if (i.error && t2.errors.push(i.error), r.push(me(t2, i.node)), i.hasProps) { - let o = "Sequence items cannot have tags or anchors before the - indicator"; - t2.errors.push(new p.YAMLSemanticError(i, o)); - } - break; - default: - i.error && t2.errors.push(i.error), t2.errors.push(new p.YAMLSyntaxError(i, `Unexpected ${i.type} node in sequence`)); - } - } - return { comments: n, items: r }; - } - function na(t2, e) { - let n = [], r = [], s = false, i, o = null, a2 = "[", c = null; - for (let l = 0; l < e.items.length; ++l) { - let f2 = e.items[l]; - if (typeof f2.char == "string") { - let { char: m, offset: d } = f2; - if (m !== ":" && (s || i !== void 0) && (s && i === void 0 && (i = a2 ? r.pop() : null), r.push(new T(i)), s = false, i = void 0, o = null), m === a2) a2 = null; - else if (!a2 && m === "?") s = true; - else if (a2 !== "[" && m === ":" && i === void 0) { - if (a2 === ",") { - if (i = r.pop(), i instanceof T) { - let y = "Chaining flow sequence pairs is invalid", h = new p.YAMLSemanticError(e, y); - h.offset = d, t2.errors.push(h); - } - if (!s && typeof o == "number") { - let y = f2.range ? f2.range.start : f2.offset; - y > o + 1024 && t2.errors.push(Ws(e, i)); - let { src: h } = c.context; - for (let g = o; g < y; ++g) if (h[g] === ` -`) { - let w = "Implicit keys of flow sequence pairs need to be on a single line"; - t2.errors.push(new p.YAMLSemanticError(c, w)); - break; - } - } - } else i = null; - o = null, s = false, a2 = null; - } else if (a2 === "[" || m !== "]" || l < e.items.length - 1) { - let y = `Flow sequence contains an unexpected ${m}`, h = new p.YAMLSyntaxError(e, y); - h.offset = d, t2.errors.push(h); - } - } else if (f2.type === p.Type.BLANK_LINE) n.push({ before: r.length }); - else if (f2.type === p.Type.COMMENT) Vs(t2.errors, f2), n.push({ comment: f2.comment, before: r.length }); - else { - if (a2) { - let d = `Expected a ${a2} in flow sequence`; - t2.errors.push(new p.YAMLSemanticError(f2, d)); - } - let m = me(t2, f2); - i === void 0 ? (r.push(m), c = f2) : (r.push(new T(i, m)), i = void 0), o = f2.range.start, a2 = ","; - } - } - return Ks(t2.errors, e), i !== void 0 && r.push(new T(i)), { comments: n, items: r }; - } - k.Alias = be; - k.Collection = j; - k.Merge = Vt; - k.Node = W; - k.Pair = T; - k.Scalar = P; - k.YAMLMap = mt; - k.YAMLSeq = pe; - k.addComment = Fe; - k.binaryOptions = xo; - k.boolOptions = Ro; - k.findPair = pt; - k.intOptions = Do; - k.isEmptyPath = Bs; - k.nullOptions = Yo; - k.resolveMap = Go; - k.resolveNode = me; - k.resolveSeq = ea; - k.resolveString = Kn; - k.strOptions = Ne; - k.stringifyNumber = qo; - k.stringifyString = Fo; - k.toJSON = ue; - }); - var Qn = te((z) => { - "use strict"; - var Q = le(), O = qe(), ra = { identify: (t2) => t2 instanceof Uint8Array, default: false, tag: "tag:yaml.org,2002:binary", resolve: (t2, e) => { - let n = O.resolveString(t2, e); - if (typeof Buffer == "function") return Buffer.from(n, "base64"); - if (typeof atob == "function") { - let r = atob(n.replace(/[\n\r]/g, "")), s = new Uint8Array(r.length); - for (let i = 0; i < r.length; ++i) s[i] = r.charCodeAt(i); - return s; - } else { - let r = "This environment does not support reading binary tags; either Buffer or atob is required"; - return t2.errors.push(new Q.YAMLReferenceError(e, r)), null; - } - }, options: O.binaryOptions, stringify: ({ comment: t2, type: e, value: n }, r, s, i) => { - let o; - if (typeof Buffer == "function") o = n instanceof Buffer ? n.toString("base64") : Buffer.from(n.buffer).toString("base64"); - else if (typeof btoa == "function") { - let a2 = ""; - for (let c = 0; c < n.length; ++c) a2 += String.fromCharCode(n[c]); - o = btoa(a2); - } else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required"); - if (e || (e = O.binaryOptions.defaultType), e === Q.Type.QUOTE_DOUBLE) n = o; - else { - let { lineWidth: a2 } = O.binaryOptions, c = Math.ceil(o.length / a2), l = new Array(c); - for (let f2 = 0, m = 0; f2 < c; ++f2, m += a2) l[f2] = o.substr(m, a2); - n = l.join(e === Q.Type.BLOCK_LITERAL ? ` -` : " "); - } - return O.stringifyString({ comment: t2, type: e, value: n }, r, s, i); - } }; - function Js(t2, e) { - let n = O.resolveSeq(t2, e); - for (let r = 0; r < n.items.length; ++r) { - let s = n.items[r]; - if (!(s instanceof O.Pair)) { - if (s instanceof O.YAMLMap) { - if (s.items.length > 1) { - let o = "Each pair must have its own sequence indicator"; - throw new Q.YAMLSemanticError(e, o); - } - let i = s.items[0] || new O.Pair(); - s.commentBefore && (i.commentBefore = i.commentBefore ? `${s.commentBefore} -${i.commentBefore}` : s.commentBefore), s.comment && (i.comment = i.comment ? `${s.comment} -${i.comment}` : s.comment), s = i; - } - n.items[r] = s instanceof O.Pair ? s : new O.Pair(s); - } - } - return n; - } - function Gs(t2, e, n) { - let r = new O.YAMLSeq(t2); - r.tag = "tag:yaml.org,2002:pairs"; - for (let s of e) { - let i, o; - if (Array.isArray(s)) if (s.length === 2) i = s[0], o = s[1]; - else throw new TypeError(`Expected [key, value] tuple: ${s}`); - else if (s && s instanceof Object) { - let c = Object.keys(s); - if (c.length === 1) i = c[0], o = s[i]; - else throw new TypeError(`Expected { key: value } tuple: ${s}`); - } else i = s; - let a2 = t2.createPair(i, o, n); - r.items.push(a2); - } - return r; - } - var sa = { default: false, tag: "tag:yaml.org,2002:pairs", resolve: Js, createNode: Gs }, Ue = class t2 extends O.YAMLSeq { - constructor() { - super(), Q._defineProperty(this, "add", O.YAMLMap.prototype.add.bind(this)), Q._defineProperty(this, "delete", O.YAMLMap.prototype.delete.bind(this)), Q._defineProperty(this, "get", O.YAMLMap.prototype.get.bind(this)), Q._defineProperty(this, "has", O.YAMLMap.prototype.has.bind(this)), Q._defineProperty(this, "set", O.YAMLMap.prototype.set.bind(this)), this.tag = t2.tag; - } - toJSON(e, n) { - let r = /* @__PURE__ */ new Map(); - n && n.onCreate && n.onCreate(r); - for (let s of this.items) { - let i, o; - if (s instanceof O.Pair ? (i = O.toJSON(s.key, "", n), o = O.toJSON(s.value, i, n)) : i = O.toJSON(s, "", n), r.has(i)) throw new Error("Ordered maps must not include duplicate keys"); - r.set(i, o); - } - return r; - } - }; - Q._defineProperty(Ue, "tag", "tag:yaml.org,2002:omap"); - function ia(t2, e) { - let n = Js(t2, e), r = []; - for (let { key: s } of n.items) if (s instanceof O.Scalar) if (r.includes(s.value)) { - let i = "Ordered maps must not include duplicate keys"; - throw new Q.YAMLSemanticError(e, i); - } else r.push(s.value); - return Object.assign(new Ue(), n); - } - function oa(t2, e, n) { - let r = Gs(t2, e, n), s = new Ue(); - return s.items = r.items, s; - } - var aa = { identify: (t2) => t2 instanceof Map, nodeClass: Ue, default: false, tag: "tag:yaml.org,2002:omap", resolve: ia, createNode: oa }, Ke = class t2 extends O.YAMLMap { - constructor() { - super(), this.tag = t2.tag; - } - add(e) { - let n = e instanceof O.Pair ? e : new O.Pair(e); - O.findPair(this.items, n.key) || this.items.push(n); - } - get(e, n) { - let r = O.findPair(this.items, e); - return !n && r instanceof O.Pair ? r.key instanceof O.Scalar ? r.key.value : r.key : r; - } - set(e, n) { - if (typeof n != "boolean") throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`); - let r = O.findPair(this.items, e); - r && !n ? this.items.splice(this.items.indexOf(r), 1) : !r && n && this.items.push(new O.Pair(e)); - } - toJSON(e, n) { - return super.toJSON(e, n, Set); - } - toString(e, n, r) { - if (!e) return JSON.stringify(this); - if (this.hasAllNullValues()) return super.toString(e, n, r); - throw new Error("Set items must all have null values"); - } - }; - Q._defineProperty(Ke, "tag", "tag:yaml.org,2002:set"); - function ca(t2, e) { - let n = O.resolveMap(t2, e); - if (!n.hasAllNullValues()) throw new Q.YAMLSemanticError(e, "Set items must all have null values"); - return Object.assign(new Ke(), n); - } - function la(t2, e, n) { - let r = new Ke(); - for (let s of e) r.items.push(t2.createPair(s, null, n)); - return r; - } - var fa = { identify: (t2) => t2 instanceof Set, nodeClass: Ke, default: false, tag: "tag:yaml.org,2002:set", resolve: ca, createNode: la }, Vn = (t2, e) => { - let n = e.split(":").reduce((r, s) => r * 60 + Number(s), 0); - return t2 === "-" ? -n : n; - }, Hs = ({ value: t2 }) => { - if (isNaN(t2) || !isFinite(t2)) return O.stringifyNumber(t2); - let e = ""; - t2 < 0 && (e = "-", t2 = Math.abs(t2)); - let n = [t2 % 60]; - return t2 < 60 ? n.unshift(0) : (t2 = Math.round((t2 - n[0]) / 60), n.unshift(t2 % 60), t2 >= 60 && (t2 = Math.round((t2 - n[0]) / 60), n.unshift(t2))), e + n.map((r) => r < 10 ? "0" + String(r) : String(r)).join(":").replace(/000000\d*$/, ""); - }, ua = { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:int", format: "TIME", test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/, resolve: (t2, e, n) => Vn(e, n.replace(/_/g, "")), stringify: Hs }, pa = { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", format: "TIME", test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/, resolve: (t2, e, n) => Vn(e, n.replace(/_/g, "")), stringify: Hs }, ma = { identify: (t2) => t2 instanceof Date, default: true, tag: "tag:yaml.org,2002:timestamp", test: RegExp("^(?:([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?)$"), resolve: (t2, e, n, r, s, i, o, a2, c) => { - a2 && (a2 = (a2 + "00").substr(1, 3)); - let l = Date.UTC(e, n - 1, r, s || 0, i || 0, o || 0, a2 || 0); - if (c && c !== "Z") { - let f2 = Vn(c[0], c.slice(1)); - Math.abs(f2) < 30 && (f2 *= 60), l -= 6e4 * f2; - } - return new Date(l); - }, stringify: ({ value: t2 }) => t2.toISOString().replace(/((T00:00)?:00)?\.000Z$/, "") }; - function Wn(t2) { - let e = {}; - return t2 ? typeof YAML_SILENCE_DEPRECATION_WARNINGS < "u" ? !YAML_SILENCE_DEPRECATION_WARNINGS : !e.YAML_SILENCE_DEPRECATION_WARNINGS : typeof YAML_SILENCE_WARNINGS < "u" ? !YAML_SILENCE_WARNINGS : !e.YAML_SILENCE_WARNINGS; - } - function jn(t2, e) { - Wn(false) && console.warn(e ? `${e}: ${t2}` : t2); - } - function ha(t2) { - if (Wn(true)) { - let e = t2.replace(/.*yaml[/\\]/i, "").replace(/\.js$/, "").replace(/\\/g, "/"); - jn(`The endpoint 'yaml/${e}' will be removed in a future release.`, "DeprecationWarning"); - } - } - var Qs = {}; - function ga(t2, e) { - if (!Qs[t2] && Wn(true)) { - Qs[t2] = true; - let n = `The option '${t2}' will be removed in a future release`; - n += e ? `, use '${e}' instead.` : ".", jn(n, "DeprecationWarning"); - } - } - z.binary = ra; - z.floatTime = pa; - z.intTime = ua; - z.omap = aa; - z.pairs = sa; - z.set = fa; - z.timestamp = ma; - z.warn = jn; - z.warnFileDeprecation = ha; - z.warnOptionDeprecation = ga; - }); - var Xn = te((li) => { - "use strict"; - var Gt = le(), E = qe(), D = Qn(); - function da(t2, e, n) { - let r = new E.YAMLMap(t2); - if (e instanceof Map) for (let [s, i] of e) r.items.push(t2.createPair(s, i, n)); - else if (e && typeof e == "object") for (let s of Object.keys(e)) r.items.push(t2.createPair(s, e[s], n)); - return typeof t2.sortMapEntries == "function" && r.items.sort(t2.sortMapEntries), r; - } - var gt = { createNode: da, default: true, nodeClass: E.YAMLMap, tag: "tag:yaml.org,2002:map", resolve: E.resolveMap }; - function ya(t2, e, n) { - let r = new E.YAMLSeq(t2); - if (e && e[Symbol.iterator]) for (let s of e) { - let i = t2.createNode(s, n.wrapScalars, null, n); - r.items.push(i); - } - return r; - } - var Ht = { createNode: ya, default: true, nodeClass: E.YAMLSeq, tag: "tag:yaml.org,2002:seq", resolve: E.resolveSeq }, Ea = { identify: (t2) => typeof t2 == "string", default: true, tag: "tag:yaml.org,2002:str", resolve: E.resolveString, stringify(t2, e, n, r) { - return e = Object.assign({ actualString: true }, e), E.stringifyString(t2, e, n, r); - }, options: E.strOptions }, Gn = [gt, Ht, Ea], Xt = (t2) => typeof t2 == "bigint" || Number.isInteger(t2), Hn = (t2, e, n) => E.intOptions.asBigInt ? BigInt(t2) : parseInt(e, n); - function Zs(t2, e, n) { - let { value: r } = t2; - return Xt(r) && r >= 0 ? n + r.toString(e) : E.stringifyNumber(t2); - } - var ei = { identify: (t2) => t2 == null, createNode: (t2, e, n) => n.wrapScalars ? new E.Scalar(null) : null, default: true, tag: "tag:yaml.org,2002:null", test: /^(?:~|[Nn]ull|NULL)?$/, resolve: () => null, options: E.nullOptions, stringify: () => E.nullOptions.nullStr }, ti = { identify: (t2) => typeof t2 == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/, resolve: (t2) => t2[0] === "t" || t2[0] === "T", options: E.boolOptions, stringify: ({ value: t2 }) => t2 ? E.boolOptions.trueStr : E.boolOptions.falseStr }, ni = { identify: (t2) => Xt(t2) && t2 >= 0, default: true, tag: "tag:yaml.org,2002:int", format: "OCT", test: /^0o([0-7]+)$/, resolve: (t2, e) => Hn(t2, e, 8), options: E.intOptions, stringify: (t2) => Zs(t2, 8, "0o") }, ri = { identify: Xt, default: true, tag: "tag:yaml.org,2002:int", test: /^[-+]?[0-9]+$/, resolve: (t2) => Hn(t2, t2, 10), options: E.intOptions, stringify: E.stringifyNumber }, si = { identify: (t2) => Xt(t2) && t2 >= 0, default: true, tag: "tag:yaml.org,2002:int", format: "HEX", test: /^0x([0-9a-fA-F]+)$/, resolve: (t2, e) => Hn(t2, e, 16), options: E.intOptions, stringify: (t2) => Zs(t2, 16, "0x") }, ii = { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^(?:[-+]?\.inf|(\.nan))$/i, resolve: (t2, e) => e ? NaN : t2[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, stringify: E.stringifyNumber }, oi = { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", format: "EXP", test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/, resolve: (t2) => parseFloat(t2), stringify: ({ value: t2 }) => Number(t2).toExponential() }, ai = { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/, resolve(t2, e, n) { - let r = e || n, s = new E.Scalar(parseFloat(t2)); - return r && r[r.length - 1] === "0" && (s.minFractionDigits = r.length), s; - }, stringify: E.stringifyNumber }, Sa = Gn.concat([ei, ti, ni, ri, si, ii, oi, ai]), Xs = (t2) => typeof t2 == "bigint" || Number.isInteger(t2), Qt = ({ value: t2 }) => JSON.stringify(t2), ci = [gt, Ht, { identify: (t2) => typeof t2 == "string", default: true, tag: "tag:yaml.org,2002:str", resolve: E.resolveString, stringify: Qt }, { identify: (t2) => t2 == null, createNode: (t2, e, n) => n.wrapScalars ? new E.Scalar(null) : null, default: true, tag: "tag:yaml.org,2002:null", test: /^null$/, resolve: () => null, stringify: Qt }, { identify: (t2) => typeof t2 == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^true|false$/, resolve: (t2) => t2 === "true", stringify: Qt }, { identify: Xs, default: true, tag: "tag:yaml.org,2002:int", test: /^-?(?:0|[1-9][0-9]*)$/, resolve: (t2) => E.intOptions.asBigInt ? BigInt(t2) : parseInt(t2, 10), stringify: ({ value: t2 }) => Xs(t2) ? t2.toString() : JSON.stringify(t2) }, { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/, resolve: (t2) => parseFloat(t2), stringify: Qt }]; - ci.scalarFallback = (t2) => { - throw new SyntaxError(`Unresolved plain scalar ${JSON.stringify(t2)}`); - }; - var zs = ({ value: t2 }) => t2 ? E.boolOptions.trueStr : E.boolOptions.falseStr, ht = (t2) => typeof t2 == "bigint" || Number.isInteger(t2); - function Jt(t2, e, n) { - let r = e.replace(/_/g, ""); - if (E.intOptions.asBigInt) { - switch (n) { - case 2: - r = `0b${r}`; - break; - case 8: - r = `0o${r}`; - break; - case 16: - r = `0x${r}`; - break; - } - let i = BigInt(r); - return t2 === "-" ? BigInt(-1) * i : i; - } - let s = parseInt(r, n); - return t2 === "-" ? -1 * s : s; - } - function Jn(t2, e, n) { - let { value: r } = t2; - if (ht(r)) { - let s = r.toString(e); - return r < 0 ? "-" + n + s.substr(1) : n + s; - } - return E.stringifyNumber(t2); - } - var wa = Gn.concat([{ identify: (t2) => t2 == null, createNode: (t2, e, n) => n.wrapScalars ? new E.Scalar(null) : null, default: true, tag: "tag:yaml.org,2002:null", test: /^(?:~|[Nn]ull|NULL)?$/, resolve: () => null, options: E.nullOptions, stringify: () => E.nullOptions.nullStr }, { identify: (t2) => typeof t2 == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/, resolve: () => true, options: E.boolOptions, stringify: zs }, { identify: (t2) => typeof t2 == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i, resolve: () => false, options: E.boolOptions, stringify: zs }, { identify: ht, default: true, tag: "tag:yaml.org,2002:int", format: "BIN", test: /^([-+]?)0b([0-1_]+)$/, resolve: (t2, e, n) => Jt(e, n, 2), stringify: (t2) => Jn(t2, 2, "0b") }, { identify: ht, default: true, tag: "tag:yaml.org,2002:int", format: "OCT", test: /^([-+]?)0([0-7_]+)$/, resolve: (t2, e, n) => Jt(e, n, 8), stringify: (t2) => Jn(t2, 8, "0") }, { identify: ht, default: true, tag: "tag:yaml.org,2002:int", test: /^([-+]?)([0-9][0-9_]*)$/, resolve: (t2, e, n) => Jt(e, n, 10), stringify: E.stringifyNumber }, { identify: ht, default: true, tag: "tag:yaml.org,2002:int", format: "HEX", test: /^([-+]?)0x([0-9a-fA-F_]+)$/, resolve: (t2, e, n) => Jt(e, n, 16), stringify: (t2) => Jn(t2, 16, "0x") }, { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^(?:[-+]?\.inf|(\.nan))$/i, resolve: (t2, e) => e ? NaN : t2[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, stringify: E.stringifyNumber }, { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", format: "EXP", test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/, resolve: (t2) => parseFloat(t2.replace(/_/g, "")), stringify: ({ value: t2 }) => Number(t2).toExponential() }, { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/, resolve(t2, e) { - let n = new E.Scalar(parseFloat(t2.replace(/_/g, ""))); - if (e) { - let r = e.replace(/_/g, ""); - r[r.length - 1] === "0" && (n.minFractionDigits = r.length); - } - return n; - }, stringify: E.stringifyNumber }], D.binary, D.omap, D.pairs, D.set, D.intTime, D.floatTime, D.timestamp), ba = { core: Sa, failsafe: Gn, json: ci, yaml11: wa }, Na = { binary: D.binary, bool: ti, float: ai, floatExp: oi, floatNaN: ii, floatTime: D.floatTime, int: ri, intHex: si, intOct: ni, intTime: D.intTime, map: gt, null: ei, omap: D.omap, pairs: D.pairs, seq: Ht, set: D.set, timestamp: D.timestamp }; - function Oa(t2, e, n) { - if (e) { - let r = n.filter((i) => i.tag === e), s = r.find((i) => !i.format) || r[0]; - if (!s) throw new Error(`Tag ${e} not found`); - return s; - } - return n.find((r) => (r.identify && r.identify(t2) || r.class && t2 instanceof r.class) && !r.format); - } - function La(t2, e, n) { - if (t2 instanceof E.Node) return t2; - let { defaultPrefix: r, onTagObj: s, prevObjects: i, schema: o, wrapScalars: a2 } = n; - e && e.startsWith("!!") && (e = r + e.slice(2)); - let c = Oa(t2, e, o.tags); - if (!c) { - if (typeof t2.toJSON == "function" && (t2 = t2.toJSON()), !t2 || typeof t2 != "object") return a2 ? new E.Scalar(t2) : t2; - c = t2 instanceof Map ? gt : t2[Symbol.iterator] ? Ht : gt; - } - s && (s(c), delete n.onTagObj); - let l = { value: void 0, node: void 0 }; - if (t2 && typeof t2 == "object" && i) { - let f2 = i.get(t2); - if (f2) { - let m = new E.Alias(f2); - return n.aliasNodes.push(m), m; - } - l.value = t2, i.set(t2, l); - } - return l.node = c.createNode ? c.createNode(n.schema, t2, n) : a2 ? new E.Scalar(t2) : t2, e && l.node instanceof E.Node && (l.node.tag = e), l.node; - } - function Aa(t2, e, n, r) { - let s = t2[r.replace(/\W/g, "")]; - if (!s) { - let i = Object.keys(t2).map((o) => JSON.stringify(o)).join(", "); - throw new Error(`Unknown schema "${r}"; use one of ${i}`); - } - if (Array.isArray(n)) for (let i of n) s = s.concat(i); - else typeof n == "function" && (s = n(s.slice())); - for (let i = 0; i < s.length; ++i) { - let o = s[i]; - if (typeof o == "string") { - let a2 = e[o]; - if (!a2) { - let c = Object.keys(e).map((l) => JSON.stringify(l)).join(", "); - throw new Error(`Unknown custom tag "${o}"; use one of ${c}`); - } - s[i] = a2; - } - } - return s; - } - var Ta = (t2, e) => t2.key < e.key ? -1 : t2.key > e.key ? 1 : 0, dt = class t2 { - constructor({ customTags: e, merge: n, schema: r, sortMapEntries: s, tags: i }) { - this.merge = !!n, this.name = r, this.sortMapEntries = s === true ? Ta : s || null, !e && i && D.warnOptionDeprecation("tags", "customTags"), this.tags = Aa(ba, Na, e || i, r); - } - createNode(e, n, r, s) { - let i = { defaultPrefix: t2.defaultPrefix, schema: this, wrapScalars: n }, o = s ? Object.assign(s, i) : i; - return La(e, r, o); - } - createPair(e, n, r) { - r || (r = { wrapScalars: true }); - let s = this.createNode(e, r.wrapScalars, null, r), i = this.createNode(n, r.wrapScalars, null, r); - return new E.Pair(s, i); - } - }; - Gt._defineProperty(dt, "defaultPrefix", Gt.defaultTagPrefix); - Gt._defineProperty(dt, "defaultTags", Gt.defaultTags); - li.Schema = dt; - }); - var mi = te((tn) => { - "use strict"; - var Y = le(), S = qe(), fi = Xn(), Ca = { anchorPrefix: "a", customTags: null, indent: 2, indentSeq: true, keepCstNodes: false, keepNodeTypes: true, keepBlobsInJSON: true, mapAsMap: false, maxAliasCount: 100, prettyErrors: false, simpleKeys: false, version: "1.2" }, Ma = { get binary() { - return S.binaryOptions; - }, set binary(t2) { - Object.assign(S.binaryOptions, t2); - }, get bool() { - return S.boolOptions; - }, set bool(t2) { - Object.assign(S.boolOptions, t2); - }, get int() { - return S.intOptions; - }, set int(t2) { - Object.assign(S.intOptions, t2); - }, get null() { - return S.nullOptions; - }, set null(t2) { - Object.assign(S.nullOptions, t2); - }, get str() { - return S.strOptions; - }, set str(t2) { - Object.assign(S.strOptions, t2); - } }, pi = { "1.0": { schema: "yaml-1.1", merge: true, tagPrefixes: [{ handle: "!", prefix: Y.defaultTagPrefix }, { handle: "!!", prefix: "tag:private.yaml.org,2002:" }] }, 1.1: { schema: "yaml-1.1", merge: true, tagPrefixes: [{ handle: "!", prefix: "!" }, { handle: "!!", prefix: Y.defaultTagPrefix }] }, 1.2: { schema: "core", merge: false, tagPrefixes: [{ handle: "!", prefix: "!" }, { handle: "!!", prefix: Y.defaultTagPrefix }] } }; - function ui(t2, e) { - if ((t2.version || t2.options.version) === "1.0") { - let s = e.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/); - if (s) return "!" + s[1]; - let i = e.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/); - return i ? `!${i[1]}/${i[2]}` : `!${e.replace(/^tag:/, "")}`; - } - let n = t2.tagPrefixes.find((s) => e.indexOf(s.prefix) === 0); - if (!n) { - let s = t2.getDefaults().tagPrefixes; - n = s && s.find((i) => e.indexOf(i.prefix) === 0); - } - if (!n) return e[0] === "!" ? e : `!<${e}>`; - let r = e.substr(n.prefix.length).replace(/[!,[\]{}]/g, (s) => ({ "!": "%21", ",": "%2C", "[": "%5B", "]": "%5D", "{": "%7B", "}": "%7D" })[s]); - return n.handle + r; - } - function ka(t2, e) { - if (e instanceof S.Alias) return S.Alias; - if (e.tag) { - let s = t2.filter((i) => i.tag === e.tag); - if (s.length > 0) return s.find((i) => i.format === e.format) || s[0]; - } - let n, r; - if (e instanceof S.Scalar) { - r = e.value; - let s = t2.filter((i) => i.identify && i.identify(r) || i.class && r instanceof i.class); - n = s.find((i) => i.format === e.format) || s.find((i) => !i.format); - } else r = e, n = t2.find((s) => s.nodeClass && r instanceof s.nodeClass); - if (!n) { - let s = r && r.constructor ? r.constructor.name : typeof r; - throw new Error(`Tag not resolved for ${s} value`); - } - return n; - } - function va(t2, e, { anchors: n, doc: r }) { - let s = [], i = r.anchors.getName(t2); - return i && (n[i] = t2, s.push(`&${i}`)), t2.tag ? s.push(ui(r, t2.tag)) : e.default || s.push(ui(r, e.tag)), s.join(" "); - } - function zt(t2, e, n, r) { - let { anchors: s, schema: i } = e.doc, o; - if (!(t2 instanceof S.Node)) { - let l = { aliasNodes: [], onTagObj: (f2) => o = f2, prevObjects: /* @__PURE__ */ new Map() }; - t2 = i.createNode(t2, true, null, l); - for (let f2 of l.aliasNodes) { - f2.source = f2.source.node; - let m = s.getName(f2.source); - m || (m = s.newName(), s.map[m] = f2.source); - } - } - if (t2 instanceof S.Pair) return t2.toString(e, n, r); - o || (o = ka(i.tags, t2)); - let a2 = va(t2, o, e); - a2.length > 0 && (e.indentAtStart = (e.indentAtStart || 0) + a2.length + 1); - let c = typeof o.stringify == "function" ? o.stringify(t2, e, n, r) : t2 instanceof S.Scalar ? S.stringifyString(t2, e, n, r) : t2.toString(e, n, r); - return a2 ? t2 instanceof S.Scalar || c[0] === "{" || c[0] === "[" ? `${a2} ${c}` : `${a2} -${e.indent}${c}` : c; - } - var zn = class t2 { - static validAnchorNode(e) { - return e instanceof S.Scalar || e instanceof S.YAMLSeq || e instanceof S.YAMLMap; - } - constructor(e) { - Y._defineProperty(this, "map", /* @__PURE__ */ Object.create(null)), this.prefix = e; - } - createAlias(e, n) { - return this.setAnchor(e, n), new S.Alias(e); - } - createMergePair(...e) { - let n = new S.Merge(); - return n.value.items = e.map((r) => { - if (r instanceof S.Alias) { - if (r.source instanceof S.YAMLMap) return r; - } else if (r instanceof S.YAMLMap) return this.createAlias(r); - throw new Error("Merge sources must be Map nodes or their Aliases"); - }), n; - } - getName(e) { - let { map: n } = this; - return Object.keys(n).find((r) => n[r] === e); - } - getNames() { - return Object.keys(this.map); - } - getNode(e) { - return this.map[e]; - } - newName(e) { - e || (e = this.prefix); - let n = Object.keys(this.map); - for (let r = 1; ; ++r) { - let s = `${e}${r}`; - if (!n.includes(s)) return s; - } - } - resolveNodes() { - let { map: e, _cstAliases: n } = this; - Object.keys(e).forEach((r) => { - e[r] = e[r].resolved; - }), n.forEach((r) => { - r.source = r.source.resolved; - }), delete this._cstAliases; - } - setAnchor(e, n) { - if (e != null && !t2.validAnchorNode(e)) throw new Error("Anchors may only be set for Scalar, Seq and Map nodes"); - if (n && /[\x00-\x19\s,[\]{}]/.test(n)) throw new Error("Anchor names must not contain whitespace or control characters"); - let { map: r } = this, s = e && Object.keys(r).find((i) => r[i] === e); - if (s) if (n) s !== n && (delete r[s], r[n] = e); - else return s; - else { - if (!n) { - if (!e) return null; - n = this.newName(); - } - r[n] = e; - } - return n; - } - }, Zt = (t2, e) => { - if (t2 && typeof t2 == "object") { - let { tag: n } = t2; - t2 instanceof S.Collection ? (n && (e[n] = true), t2.items.forEach((r) => Zt(r, e))) : t2 instanceof S.Pair ? (Zt(t2.key, e), Zt(t2.value, e)) : t2 instanceof S.Scalar && n && (e[n] = true); - } - return e; - }, Ia = (t2) => Object.keys(Zt(t2, {})); - function Pa(t2, e) { - let n = { before: [], after: [] }, r, s = false; - for (let i of e) if (i.valueRange) { - if (r !== void 0) { - let a2 = "Document contains trailing content not separated by a ... or --- line"; - t2.errors.push(new Y.YAMLSyntaxError(i, a2)); - break; - } - let o = S.resolveNode(t2, i); - s && (o.spaceBefore = true, s = false), r = o; - } else i.comment !== null ? (r === void 0 ? n.before : n.after).push(i.comment) : i.type === Y.Type.BLANK_LINE && (s = true, r === void 0 && n.before.length > 0 && !t2.commentBefore && (t2.commentBefore = n.before.join(` -`), n.before = [])); - if (t2.contents = r || null, !r) t2.comment = n.before.concat(n.after).join(` -`) || null; - else { - let i = n.before.join(` -`); - if (i) { - let o = r instanceof S.Collection && r.items[0] ? r.items[0] : r; - o.commentBefore = o.commentBefore ? `${i} -${o.commentBefore}` : i; - } - t2.comment = n.after.join(` -`) || null; - } - } - function _a({ tagPrefixes: t2 }, e) { - let [n, r] = e.parameters; - if (!n || !r) { - let s = "Insufficient parameters given for %TAG directive"; - throw new Y.YAMLSemanticError(e, s); - } - if (t2.some((s) => s.handle === n)) { - let s = "The %TAG directive must only be given at most once per handle in the same document."; - throw new Y.YAMLSemanticError(e, s); - } - return { handle: n, prefix: r }; - } - function xa(t2, e) { - let [n] = e.parameters; - if (e.name === "YAML:1.0" && (n = "1.0"), !n) { - let r = "Insufficient parameters given for %YAML directive"; - throw new Y.YAMLSemanticError(e, r); - } - if (!pi[n]) { - let s = `Document will be parsed as YAML ${t2.version || t2.options.version} rather than YAML ${n}`; - t2.warnings.push(new Y.YAMLWarning(e, s)); - } - return n; - } - function Ra(t2, e, n) { - let r = [], s = false; - for (let i of e) { - let { comment: o, name: a2 } = i; - switch (a2) { - case "TAG": - try { - t2.tagPrefixes.push(_a(t2, i)); - } catch (c) { - t2.errors.push(c); - } - s = true; - break; - case "YAML": - case "YAML:1.0": - if (t2.version) { - let c = "The %YAML directive must only be given at most once per document."; - t2.errors.push(new Y.YAMLSemanticError(i, c)); - } - try { - t2.version = xa(t2, i); - } catch (c) { - t2.errors.push(c); - } - s = true; - break; - default: - if (a2) { - let c = `YAML only supports %TAG and %YAML directives, and not %${a2}`; - t2.warnings.push(new Y.YAMLWarning(i, c)); - } - } - o && r.push(o); - } - if (n && !s && (t2.version || n.version || t2.options.version) === "1.1") { - let i = ({ handle: o, prefix: a2 }) => ({ handle: o, prefix: a2 }); - t2.tagPrefixes = n.tagPrefixes.map(i), t2.version = n.version; - } - t2.commentBefore = r.join(` -`) || null; - } - function Ve(t2) { - if (t2 instanceof S.Collection) return true; - throw new Error("Expected a YAML collection as document contents"); - } - var en = class t2 { - constructor(e) { - this.anchors = new zn(e.anchorPrefix), this.commentBefore = null, this.comment = null, this.contents = null, this.directivesEndMarker = null, this.errors = [], this.options = e, this.schema = null, this.tagPrefixes = [], this.version = null, this.warnings = []; - } - add(e) { - return Ve(this.contents), this.contents.add(e); - } - addIn(e, n) { - Ve(this.contents), this.contents.addIn(e, n); - } - delete(e) { - return Ve(this.contents), this.contents.delete(e); - } - deleteIn(e) { - return S.isEmptyPath(e) ? this.contents == null ? false : (this.contents = null, true) : (Ve(this.contents), this.contents.deleteIn(e)); - } - getDefaults() { - return t2.defaults[this.version] || t2.defaults[this.options.version] || {}; - } - get(e, n) { - return this.contents instanceof S.Collection ? this.contents.get(e, n) : void 0; - } - getIn(e, n) { - return S.isEmptyPath(e) ? !n && this.contents instanceof S.Scalar ? this.contents.value : this.contents : this.contents instanceof S.Collection ? this.contents.getIn(e, n) : void 0; - } - has(e) { - return this.contents instanceof S.Collection ? this.contents.has(e) : false; - } - hasIn(e) { - return S.isEmptyPath(e) ? this.contents !== void 0 : this.contents instanceof S.Collection ? this.contents.hasIn(e) : false; - } - set(e, n) { - Ve(this.contents), this.contents.set(e, n); - } - setIn(e, n) { - S.isEmptyPath(e) ? this.contents = n : (Ve(this.contents), this.contents.setIn(e, n)); - } - setSchema(e, n) { - if (!e && !n && this.schema) return; - typeof e == "number" && (e = e.toFixed(1)), e === "1.0" || e === "1.1" || e === "1.2" ? (this.version ? this.version = e : this.options.version = e, delete this.options.schema) : e && typeof e == "string" && (this.options.schema = e), Array.isArray(n) && (this.options.customTags = n); - let r = Object.assign({}, this.getDefaults(), this.options); - this.schema = new fi.Schema(r); - } - parse(e, n) { - this.options.keepCstNodes && (this.cstNode = e), this.options.keepNodeTypes && (this.type = "DOCUMENT"); - let { directives: r = [], contents: s = [], directivesEndMarker: i, error: o, valueRange: a2 } = e; - if (o && (o.source || (o.source = this), this.errors.push(o)), Ra(this, r, n), i && (this.directivesEndMarker = true), this.range = a2 ? [a2.start, a2.end] : null, this.setSchema(), this.anchors._cstAliases = [], Pa(this, s), this.anchors.resolveNodes(), this.options.prettyErrors) { - for (let c of this.errors) c instanceof Y.YAMLError && c.makePretty(); - for (let c of this.warnings) c instanceof Y.YAMLError && c.makePretty(); - } - return this; - } - listNonDefaultTags() { - return Ia(this.contents).filter((e) => e.indexOf(fi.Schema.defaultPrefix) !== 0); - } - setTagPrefix(e, n) { - if (e[0] !== "!" || e[e.length - 1] !== "!") throw new Error("Handle must start and end with !"); - if (n) { - let r = this.tagPrefixes.find((s) => s.handle === e); - r ? r.prefix = n : this.tagPrefixes.push({ handle: e, prefix: n }); - } else this.tagPrefixes = this.tagPrefixes.filter((r) => r.handle !== e); - } - toJSON(e, n) { - let { keepBlobsInJSON: r, mapAsMap: s, maxAliasCount: i } = this.options, o = r && (typeof e != "string" || !(this.contents instanceof S.Scalar)), a2 = { doc: this, indentStep: " ", keep: o, mapAsMap: o && !!s, maxAliasCount: i, stringify: zt }, c = Object.keys(this.anchors.map); - c.length > 0 && (a2.anchors = new Map(c.map((f2) => [this.anchors.map[f2], { alias: [], aliasCount: 0, count: 1 }]))); - let l = S.toJSON(this.contents, e, a2); - if (typeof n == "function" && a2.anchors) for (let { count: f2, res: m } of a2.anchors.values()) n(m, f2); - return l; - } - toString() { - if (this.errors.length > 0) throw new Error("Document with errors cannot be stringified"); - let e = this.options.indent; - if (!Number.isInteger(e) || e <= 0) { - let c = JSON.stringify(e); - throw new Error(`"indent" option must be a positive integer, not ${c}`); - } - this.setSchema(); - let n = [], r = false; - if (this.version) { - let c = "%YAML 1.2"; - this.schema.name === "yaml-1.1" && (this.version === "1.0" ? c = "%YAML:1.0" : this.version === "1.1" && (c = "%YAML 1.1")), n.push(c), r = true; - } - let s = this.listNonDefaultTags(); - this.tagPrefixes.forEach(({ handle: c, prefix: l }) => { - s.some((f2) => f2.indexOf(l) === 0) && (n.push(`%TAG ${c} ${l}`), r = true); - }), (r || this.directivesEndMarker) && n.push("---"), this.commentBefore && ((r || !this.directivesEndMarker) && n.unshift(""), n.unshift(this.commentBefore.replace(/^/gm, "#"))); - let i = { anchors: /* @__PURE__ */ Object.create(null), doc: this, indent: "", indentStep: " ".repeat(e), stringify: zt }, o = false, a2 = null; - if (this.contents) { - this.contents instanceof S.Node && (this.contents.spaceBefore && (r || this.directivesEndMarker) && n.push(""), this.contents.commentBefore && n.push(this.contents.commentBefore.replace(/^/gm, "#")), i.forceBlockIndent = !!this.comment, a2 = this.contents.comment); - let c = a2 ? null : () => o = true, l = zt(this.contents, i, () => a2 = null, c); - n.push(S.addComment(l, "", a2)); - } else this.contents !== void 0 && n.push(zt(this.contents, i)); - return this.comment && ((!o || a2) && n[n.length - 1] !== "" && n.push(""), n.push(this.comment.replace(/^/gm, "#"))), n.join(` -`) + ` -`; - } - }; - Y._defineProperty(en, "defaults", pi); - tn.Document = en; - tn.defaultOptions = Ca; - tn.scalarOptions = Ma; - }); - var di = te((gi) => { - "use strict"; - var Zn = Rs(), Oe = mi(), Da = Xn(), Ya = le(), $a = Qn(); - qe(); - function Ba(t2, e = true, n) { - n === void 0 && typeof e == "string" && (n = e, e = true); - let r = Object.assign({}, Oe.Document.defaults[Oe.defaultOptions.version], Oe.defaultOptions); - return new Da.Schema(r).createNode(t2, e, n); - } - var We = class extends Oe.Document { - constructor(e) { - super(Object.assign({}, Oe.defaultOptions, e)); - } - }; - function Fa(t2, e) { - let n = [], r; - for (let s of Zn.parse(t2)) { - let i = new We(e); - i.parse(s, r), n.push(i), r = i; - } - return n; - } - function hi(t2, e) { - let n = Zn.parse(t2), r = new We(e).parse(n[0]); - if (n.length > 1) { - let s = "Source contains multiple documents; please use YAML.parseAllDocuments()"; - r.errors.unshift(new Ya.YAMLSemanticError(n[1], s)); - } - return r; - } - function qa(t2, e) { - let n = hi(t2, e); - if (n.warnings.forEach((r) => $a.warn(r)), n.errors.length > 0) throw n.errors[0]; - return n.toJSON(); - } - function Ua(t2, e) { - let n = new We(e); - return n.contents = t2, String(n); - } - var Ka = { createNode: Ba, defaultOptions: Oe.defaultOptions, Document: We, parse: qa, parseAllDocuments: Fa, parseCST: Zn.parse, parseDocument: hi, scalarOptions: Oe.scalarOptions, stringify: Ua }; - gi.YAML = Ka; - }); - var Ei = te((Um, yi) => { - yi.exports = di().YAML; - }); - var Si = te((J) => { - "use strict"; - var je = qe(), Qe = le(); - J.findPair = je.findPair; - J.parseMap = je.resolveMap; - J.parseSeq = je.resolveSeq; - J.stringifyNumber = je.stringifyNumber; - J.stringifyString = je.stringifyString; - J.toJSON = je.toJSON; - J.Type = Qe.Type; - J.YAMLError = Qe.YAMLError; - J.YAMLReferenceError = Qe.YAMLReferenceError; - J.YAMLSemanticError = Qe.YAMLSemanticError; - J.YAMLSyntaxError = Qe.YAMLSyntaxError; - J.YAMLWarning = Qe.YAMLWarning; - }); - var Xa = {}; - nr(Xa, { languages: () => _r, options: () => xr, parsers: () => tr, printers: () => Ha }); - var Pi = (t2, e, n, r) => { - if (!(t2 && e == null)) return e.replaceAll ? e.replaceAll(n, r) : n.global ? e.replace(n, r) : e.split(n).join(r); - }, Et = Pi; - var Le = "string", Je = "array", Ge = "cursor", He = "indent", Ae = "align", Xe = "trim", Te = "group", Ce = "fill", he = "if-break", ze = "indent-if-break", Me = "line-suffix", Ze = "line-suffix-boundary", Z = "line", et = "label", ke = "break-parent", St = /* @__PURE__ */ new Set([Ge, He, Ae, Xe, Te, Ce, he, ze, Me, Ze, Z, et, ke]); - var _i = (t2, e, n) => { - if (!(t2 && e == null)) return Array.isArray(e) || typeof e == "string" ? e[n < 0 ? e.length + n : n] : e.at(n); - }, x = _i; - function xi(t2) { - if (typeof t2 == "string") return Le; - if (Array.isArray(t2)) return Je; - if (!t2) return; - let { type: e } = t2; - if (St.has(e)) return e; - } - var ve = xi; - var Ri = (t2) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(t2); - function Di(t2) { - let e = t2 === null ? "null" : typeof t2; - if (e !== "string" && e !== "object") return `Unexpected doc '${e}', -Expected it to be 'string' or 'object'.`; - if (ve(t2)) throw new Error("doc is valid."); - let n = Object.prototype.toString.call(t2); - if (n !== "[object Object]") return `Unexpected doc '${n}'.`; - let r = Ri([...St].map((s) => `'${s}'`)); - return `Unexpected doc.type '${t2.type}'. -Expected it to be ${r}.`; - } - var nn = class extends Error { - constructor(e) { - super(Di(e)); - __publicField(this, "name", "InvalidDocError"); - this.doc = e; - } - }, rn = nn; - function $i(t2, e) { - if (typeof t2 == "string") return e(t2); - let n = /* @__PURE__ */ new Map(); - return r(t2); - function r(i) { - if (n.has(i)) return n.get(i); - let o = s(i); - return n.set(i, o), o; - } - function s(i) { - switch (ve(i)) { - case Je: - return e(i.map(r)); - case Ce: - return e({ ...i, parts: i.parts.map(r) }); - case he: - return e({ ...i, breakContents: r(i.breakContents), flatContents: r(i.flatContents) }); - case Te: { - let { expandedStates: o, contents: a2 } = i; - return o ? (o = o.map(r), a2 = o[0]) : a2 = r(a2), e({ ...i, contents: a2, expandedStates: o }); - } - case Ae: - case He: - case ze: - case et: - case Me: - return e({ ...i, contents: r(i.contents) }); - case Le: - case Ge: - case Xe: - case Ze: - case Z: - case ke: - return e(i); - default: - throw new rn(i); - } - } - } - function ir(t2, e = tt) { - return $i(t2, (n) => typeof n == "string" ? v(e, n.split(` -`)) : n); - } - var sn = () => { - }, ge = sn, on = sn, or = sn; - function nt(t2, e) { - return ge(e), { type: Ae, contents: e, n: t2 }; - } - function Ie(t2, e = {}) { - return ge(t2), on(e.expandedStates, true), { type: Te, id: e.id, contents: t2, break: !!e.shouldBreak, expandedStates: e.expandedStates }; - } - function an(t2) { - return nt(Number.NEGATIVE_INFINITY, t2); - } - function ar(t2) { - return nt({ type: "root" }, t2); - } - function cr(t2) { - return nt(-1, t2); - } - function cn(t2, e) { - return Ie(t2[0], { ...e, expandedStates: t2 }); - } - function wt(t2) { - return or(t2), { type: Ce, parts: t2 }; - } - function rt(t2, e = "", n = {}) { - return ge(t2), e !== "" && ge(e), { type: he, breakContents: t2, flatContents: e, groupId: n.groupId }; - } - function lr(t2) { - return ge(t2), { type: Me, contents: t2 }; - } - var bt = { type: ke }; - var Bi = { type: Z, hard: true }, Fi = { type: Z, hard: true, literal: true }, ne = { type: Z }, Nt = { type: Z, soft: true }, N = [Bi, bt], tt = [Fi, bt]; - function v(t2, e) { - ge(t2), on(e); - let n = []; - for (let r = 0; r < e.length; r++) r !== 0 && n.push(t2), n.push(e[r]); - return n; - } - function Ot(t2) { - return (e, n, r) => { - let s = !!(r != null && r.backwards); - if (n === false) return false; - let { length: i } = e, o = n; - for (; o >= 0 && o < i; ) { - let a2 = e.charAt(o); - if (t2 instanceof RegExp) { - if (!t2.test(a2)) return o; - } else if (!t2.includes(a2)) return o; - s ? o-- : o++; - } - return o === -1 || o === i ? o : false; - }; - } - var kc = Ot(/\s/u), ln = Ot(" "), vc = Ot(",; "), Ic = Ot(/[^\n\r]/u); - function qi(t2, e, n) { - let r = !!(n != null && n.backwards); - if (e === false) return false; - let s = t2.charAt(e); - if (r) { - if (t2.charAt(e - 1) === "\r" && s === ` -`) return e - 2; - if (s === ` -` || s === "\r" || s === "\u2028" || s === "\u2029") return e - 1; - } else { - if (s === "\r" && t2.charAt(e + 1) === ` -`) return e + 2; - if (s === ` -` || s === "\r" || s === "\u2028" || s === "\u2029") return e + 1; - } - return e; - } - var fn = qi; - function Ui(t2, e) { - let n = e - 1; - n = ln(t2, n, { backwards: true }), n = fn(t2, n, { backwards: true }), n = ln(t2, n, { backwards: true }); - let r = fn(t2, n, { backwards: true }); - return n !== r; - } - var fr = Ui; - var un = class extends Error { - constructor(e, n, r = "type") { - super(`Unexpected ${n} node ${r}: ${JSON.stringify(e[r])}.`); - __publicField(this, "name", "UnexpectedNodeError"); - this.node = e; - } - }, ur = un; - function pr(t2, e) { - let { node: n } = t2; - if (n.type === "root" && e.filepath && /(?:[/\\]|^)\.(?:prettier|stylelint|lintstaged)rc$/u.test(e.filepath)) return async (r) => { - let s = await r(e.originalText, { parser: "json" }); - return s ? [s, N] : void 0; - }; - } - pr.getVisitorKeys = () => []; - var mr = pr; - var st = null; - function it(t2) { - if (st !== null && typeof st.property) { - let e = st; - return st = it.prototype = null, e; - } - return st = it.prototype = t2 != null ? t2 : /* @__PURE__ */ Object.create(null), new it(); - } - var Ki = 10; - for (let t2 = 0; t2 <= Ki; t2++) it(); - function pn(t2) { - return it(t2); - } - function Vi(t2, e = "type") { - pn(t2); - function n(r) { - let s = r[e], i = t2[s]; - if (!Array.isArray(i)) throw Object.assign(new Error(`Missing visitor keys for '${s}'.`), { node: r }); - return i; - } - return n; - } - var hr = Vi; - var Wi = Object.fromEntries(Object.entries({ root: ["children"], document: ["head", "body", "children"], documentHead: ["children"], documentBody: ["children"], directive: [], alias: [], blockLiteral: [], blockFolded: ["children"], plain: ["children"], quoteSingle: [], quoteDouble: [], mapping: ["children"], mappingItem: ["key", "value", "children"], mappingKey: ["content", "children"], mappingValue: ["content", "children"], sequence: ["children"], sequenceItem: ["content", "children"], flowMapping: ["children"], flowMappingItem: ["key", "value", "children"], flowSequence: ["children"], flowSequenceItem: ["content", "children"], comment: [], tag: [], anchor: [] }).map(([t2, e]) => [t2, [...e, "anchor", "tag", "indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments"]])), gr = Wi; - var ji = hr(gr), dr = ji; - function Pe(t2) { - return t2.position.start.offset; - } - function yr(t2) { - return t2.position.end.offset; - } - function Er(t2) { - return /^\s*@(?:prettier|format)\s*$/u.test(t2); - } - function Sr(t2) { - return /^\s*#[^\S\n]*@(?:prettier|format)\s*?(?:\n|$)/u.test(t2); - } - function wr(t2) { - return `# @format - -${t2}`; - } - function Qi(t2) { - return Array.isArray(t2) && t2.length > 0; - } - var _e = Qi; - function H(t2, e) { - return typeof (t2 == null ? void 0 : t2.type) == "string" && (!e || e.includes(t2.type)); - } - function mn(t2, e, n) { - return e("children" in t2 ? { ...t2, children: t2.children.map((r) => mn(r, e, t2)) } : t2, n); - } - function xe(t2, e, n) { - Object.defineProperty(t2, e, { get: n, enumerable: false }); - } - function Nr(t2, e) { - let n = 0, r = e.length; - for (let s = t2.position.end.offset - 1; s < r; s++) { - let i = e[s]; - if (i === ` -` && n++, n === 1 && /\S/u.test(i)) return false; - if (n === 2) return true; - } - return false; - } - function Lt(t2) { - let { node: e } = t2; - switch (e.type) { - case "tag": - case "anchor": - case "comment": - return false; - } - let n = t2.stack.length; - for (let r = 1; r < n; r++) { - let s = t2.stack[r], i = t2.stack[r - 1]; - if (Array.isArray(i) && typeof s == "number" && s !== i.length - 1) return false; - } - return true; - } - function At(t2) { - return _e(t2.children) ? At(x(false, t2.children, -1)) : t2; - } - function br(t2) { - return t2.value.trim() === "prettier-ignore"; - } - function Or(t2) { - let { node: e } = t2; - if (e.type === "documentBody") { - let n = t2.parent.head; - return R(n) && br(x(false, n.endComments, -1)); - } - return ee(e) && br(x(false, e.leadingComments, -1)); - } - function Re(t2) { - return !_e(t2.children) && !Ji(t2); - } - function Ji(t2) { - return ee(t2) || ie(t2) || hn(t2) || K(t2) || R(t2); - } - function ee(t2) { - return _e(t2 == null ? void 0 : t2.leadingComments); - } - function ie(t2) { - return _e(t2 == null ? void 0 : t2.middleComments); - } - function hn(t2) { - return t2 == null ? void 0 : t2.indicatorComment; - } - function K(t2) { - return t2 == null ? void 0 : t2.trailingComment; - } - function R(t2) { - return _e(t2 == null ? void 0 : t2.endComments); - } - function Lr(t2) { - let e = [], n; - for (let r of t2.split(/( +)/u)) r !== " " ? n === " " ? e.push(r) : e.push((e.pop() || "") + r) : n === void 0 && e.unshift(""), n = r; - return n === " " && e.push((e.pop() || "") + " "), e[0] === "" && (e.shift(), e.unshift(" " + (e.shift() || ""))), e; - } - function Ar(t2, e, n) { - let r = e.split(` -`).map((s, i, o) => i === 0 && i === o.length - 1 ? s : i !== 0 && i !== o.length - 1 ? s.trim() : i === 0 ? s.trimEnd() : s.trimStart()); - return n.proseWrap === "preserve" ? r.map((s) => s.length === 0 ? [] : [s]) : r.map((s) => s.length === 0 ? [] : Lr(s)).reduce((s, i, o) => o !== 0 && r[o - 1].length > 0 && i.length > 0 && !(t2 === "quoteDouble" && x(false, x(false, s, -1), -1).endsWith("\\")) ? [...s.slice(0, -1), [...x(false, s, -1), ...i]] : [...s, i], []).map((s) => n.proseWrap === "never" ? [s.join(" ")] : s); - } - function Tr(t2, { parentIndent: e, isLastDescendant: n, options: r }) { - let s = t2.position.start.line === t2.position.end.line ? "" : r.originalText.slice(t2.position.start.offset, t2.position.end.offset).match(/^[^\n]*\n(.*)$/su)[1], i; - if (t2.indent === null) { - let c = s.match(/^(? *)[^\n\r ]/mu); - i = c ? c.groups.leadingSpace.length : Number.POSITIVE_INFINITY; - } else i = t2.indent - 1 + e; - let o = s.split(` -`).map((c) => c.slice(i)); - if (r.proseWrap === "preserve" || t2.type === "blockLiteral") return a2(o.map((c) => c.length === 0 ? [] : [c])); - return a2(o.map((c) => c.length === 0 ? [] : Lr(c)).reduce((c, l, f2) => f2 !== 0 && o[f2 - 1].length > 0 && l.length > 0 && !/^\s/u.test(l[0]) && !/^\s|\s$/u.test(x(false, c, -1)) ? [...c.slice(0, -1), [...x(false, c, -1), ...l]] : [...c, l], []).map((c) => c.reduce((l, f2) => l.length > 0 && /\s$/u.test(x(false, l, -1)) ? [...l.slice(0, -1), x(false, l, -1) + " " + f2] : [...l, f2], [])).map((c) => r.proseWrap === "never" ? [c.join(" ")] : c)); - function a2(c) { - if (t2.chomping === "keep") return x(false, c, -1).length === 0 ? c.slice(0, -1) : c; - let l = 0; - for (let f2 = c.length - 1; f2 >= 0 && c[f2].length === 0; f2--) l++; - return l === 0 ? c : l >= 2 && !n ? c.slice(0, -(l - 1)) : c.slice(0, -l); - } - } - function ot(t2) { - if (!t2) return true; - switch (t2.type) { - case "plain": - case "quoteDouble": - case "quoteSingle": - case "alias": - case "flowMapping": - case "flowSequence": - return true; - default: - return false; - } - } - var gn = /* @__PURE__ */ new WeakMap(); - function Tt(t2, e) { - let { node: n, root: r } = t2, s; - return gn.has(r) ? s = gn.get(r) : (s = /* @__PURE__ */ new Set(), gn.set(r, s)), !s.has(n.position.end.line) && (s.add(n.position.end.line), Nr(n, e) && !dn(t2.parent)) ? Nt : ""; - } - function dn(t2) { - return R(t2) && !H(t2, ["documentHead", "documentBody", "flowMapping", "flowSequence"]); - } - function I(t2, e) { - return nt(" ".repeat(t2), e); - } - function Gi(t2, e, n) { - let { node: r } = t2, s = t2.ancestors.filter((l) => l.type === "sequence" || l.type === "mapping").length, i = Lt(t2), o = [r.type === "blockFolded" ? ">" : "|"]; - r.indent !== null && o.push(r.indent.toString()), r.chomping !== "clip" && o.push(r.chomping === "keep" ? "+" : "-"), hn(r) && o.push(" ", e("indicatorComment")); - let a2 = Tr(r, { parentIndent: s, isLastDescendant: i, options: n }), c = []; - for (let [l, f2] of a2.entries()) l === 0 && c.push(N), c.push(wt(v(ne, f2))), l !== a2.length - 1 ? c.push(f2.length === 0 ? N : ar(tt)) : r.chomping === "keep" && i && c.push(an(f2.length === 0 ? N : tt)); - return r.indent === null ? o.push(cr(I(n.tabWidth, c))) : o.push(an(I(r.indent - 1 + s, c))), o; - } - var Cr = Gi; - function Ct(t2, e, n) { - let { node: r } = t2, s = r.type === "flowMapping", i = s ? "{" : "[", o = s ? "}" : "]", a2 = Nt; - s && r.children.length > 0 && n.bracketSpacing && (a2 = ne); - let c = x(false, r.children, -1), l = (c == null ? void 0 : c.type) === "flowMappingItem" && Re(c.key) && Re(c.value); - return [i, I(n.tabWidth, [a2, Hi(t2, e, n), n.trailingComma === "none" ? "" : rt(","), R(r) ? [N, v(N, t2.map(e, "endComments"))] : ""]), l ? "" : a2, o]; - } - function Hi(t2, e, n) { - return t2.map(({ isLast: r, node: s, next: i }) => [e(), r ? "" : [",", ne, s.position.start.line !== i.position.start.line ? Tt(t2, n.originalText) : ""]], "children"); - } - function Xi(t2, e, n) { - var C; - let { node: r, parent: s } = t2, { key: i, value: o } = r, a2 = Re(i), c = Re(o); - if (a2 && c) return ": "; - let l = e("key"), f2 = zi(r) ? " " : ""; - if (c) return r.type === "flowMappingItem" && s.type === "flowMapping" ? l : r.type === "mappingItem" && yn(i.content, n) && !K(i.content) && ((C = s.tag) == null ? void 0 : C.value) !== "tag:yaml.org,2002:set" ? [l, f2, ":"] : ["? ", I(2, l)]; - let m = e("value"); - if (a2) return [": ", I(2, m)]; - if (ee(o) || !ot(i.content)) return ["? ", I(2, l), N, ...t2.map(() => [e(), N], "value", "leadingComments"), ": ", I(2, m)]; - if (Zi(i.content) && !ee(i.content) && !ie(i.content) && !K(i.content) && !R(i) && !ee(o.content) && !ie(o.content) && !R(o) && yn(o.content, n)) return [l, f2, ": ", m]; - let d = /* @__PURE__ */ Symbol("mappingKey"), y = Ie([rt("? "), Ie(I(2, l), { id: d })]), h = [N, ": ", I(2, m)], g = [f2, ":"]; - ee(o.content) || R(o) && o.content && !H(o.content, ["mapping", "sequence"]) || s.type === "mapping" && K(i.content) && ot(o.content) || H(o.content, ["mapping", "sequence"]) && o.content.tag === null && o.content.anchor === null ? g.push(N) : o.content ? g.push(ne) : K(o) && g.push(" "), g.push(m); - let w = I(n.tabWidth, g); - return yn(i.content, n) && !ee(i.content) && !ie(i.content) && !R(i) ? cn([[l, w]]) : cn([[y, rt(h, w, { groupId: d })]]); - } - function yn(t2, e) { - if (!t2) return true; - switch (t2.type) { - case "plain": - case "quoteSingle": - case "quoteDouble": - break; - case "alias": - return true; - default: - return false; - } - if (e.proseWrap === "preserve") return t2.position.start.line === t2.position.end.line; - if (/\\$/mu.test(e.originalText.slice(t2.position.start.offset, t2.position.end.offset))) return false; - switch (e.proseWrap) { - case "never": - return !t2.value.includes(` -`); - case "always": - return !/[\n ]/u.test(t2.value); - default: - return false; - } - } - function zi(t2) { - var e; - return ((e = t2.key.content) == null ? void 0 : e.type) === "alias"; - } - function Zi(t2) { - if (!t2) return true; - switch (t2.type) { - case "plain": - case "quoteDouble": - case "quoteSingle": - return t2.position.start.line === t2.position.end.line; - case "alias": - return true; - default: - return false; - } - } - var Mr = Xi; - function eo(t2) { - return mn(t2, to); - } - function to(t2) { - switch (t2.type) { - case "document": - xe(t2, "head", () => t2.children[0]), xe(t2, "body", () => t2.children[1]); - break; - case "documentBody": - case "sequenceItem": - case "flowSequenceItem": - case "mappingKey": - case "mappingValue": - xe(t2, "content", () => t2.children[0]); - break; - case "mappingItem": - case "flowMappingItem": - xe(t2, "key", () => t2.children[0]), xe(t2, "value", () => t2.children[1]); - break; - } - return t2; - } - var kr = eo; - function no(t2, e, n) { - let { node: r } = t2, s = []; - r.type !== "mappingValue" && ee(r) && s.push([v(N, t2.map(n, "leadingComments")), N]); - let { tag: i, anchor: o } = r; - i && s.push(n("tag")), i && o && s.push(" "), o && s.push(n("anchor")); - let a2 = ""; - return H(r, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !Lt(t2) && (a2 = Tt(t2, e.originalText)), (i || o) && (H(r, ["sequence", "mapping"]) && !ie(r) ? s.push(N) : s.push(" ")), ie(r) && s.push([r.middleComments.length === 1 ? "" : N, v(N, t2.map(n, "middleComments")), N]), Or(t2) ? s.push(ir(e.originalText.slice(r.position.start.offset, r.position.end.offset).trimEnd())) : s.push(Ie(ro(t2, e, n))), K(r) && !H(r, ["document", "documentHead"]) && s.push(lr([r.type === "mappingValue" && !r.content ? "" : " ", t2.parent.type === "mappingKey" && t2.getParentNode(2).type === "mapping" && ot(r) ? "" : bt, n("trailingComment")])), dn(r) && s.push(I(r.type === "sequenceItem" ? 2 : 0, [N, v(N, t2.map(({ node: c }) => [fr(e.originalText, Pe(c)) ? N : "", n()], "endComments"))])), s.push(a2), s; - } - function ro(t2, e, n) { - let { node: r } = t2; - switch (r.type) { - case "root": { - let s = []; - t2.each(({ node: o, next: a2, isFirst: c }) => { - c || s.push(N), s.push(n()), vr(o, a2) ? (s.push(N, "..."), K(o) && s.push(" ", n("trailingComment"))) : a2 && !K(a2.head) && s.push(N, "---"); - }, "children"); - let i = At(r); - return (!H(i, ["blockLiteral", "blockFolded"]) || i.chomping !== "keep") && s.push(N), s; - } - case "document": { - let s = []; - return io(t2, e) === "head" && ((r.head.children.length > 0 || r.head.endComments.length > 0) && s.push(n("head")), K(r.head) ? s.push(["---", " ", n(["head", "trailingComment"])]) : s.push("---")), so(r) && s.push(n("body")), v(N, s); - } - case "documentHead": - return v(N, [...t2.map(n, "children"), ...t2.map(n, "endComments")]); - case "documentBody": { - let { children: s, endComments: i } = r, o = ""; - if (s.length > 0 && i.length > 0) { - let a2 = At(r); - H(a2, ["blockFolded", "blockLiteral"]) ? a2.chomping !== "keep" && (o = [N, N]) : o = N; - } - return [v(N, t2.map(n, "children")), o, v(N, t2.map(n, "endComments"))]; - } - case "directive": - return ["%", v(" ", [r.name, ...r.parameters])]; - case "comment": - return ["#", r.value]; - case "alias": - return ["*", r.value]; - case "tag": - return e.originalText.slice(r.position.start.offset, r.position.end.offset); - case "anchor": - return ["&", r.value]; - case "plain": - return at(r.type, e.originalText.slice(r.position.start.offset, r.position.end.offset), e); - case "quoteDouble": - case "quoteSingle": { - let s = "'", i = '"', o = e.originalText.slice(r.position.start.offset + 1, r.position.end.offset - 1); - if (r.type === "quoteSingle" && o.includes("\\") || r.type === "quoteDouble" && /\\[^"]/u.test(o)) { - let c = r.type === "quoteDouble" ? i : s; - return [c, at(r.type, o, e), c]; - } - if (o.includes(i)) return [s, at(r.type, r.type === "quoteDouble" ? Et(false, Et(false, o, String.raw`\"`, i), "'", s.repeat(2)) : o, e), s]; - if (o.includes(s)) return [i, at(r.type, r.type === "quoteSingle" ? Et(false, o, "''", s) : o, e), i]; - let a2 = e.singleQuote ? s : i; - return [a2, at(r.type, o, e), a2]; - } - case "blockFolded": - case "blockLiteral": - return Cr(t2, n, e); - case "mapping": - case "sequence": - return v(N, t2.map(n, "children")); - case "sequenceItem": - return ["- ", I(2, r.content ? n("content") : "")]; - case "mappingKey": - case "mappingValue": - return r.content ? n("content") : ""; - case "mappingItem": - case "flowMappingItem": - return Mr(t2, n, e); - case "flowMapping": - return Ct(t2, n, e); - case "flowSequence": - return Ct(t2, n, e); - case "flowSequenceItem": - return n("content"); - default: - throw new ur(r, "YAML"); - } - } - function so(t2) { - return t2.body.children.length > 0 || R(t2.body); - } - function vr(t2, e) { - return K(t2) || e && (e.head.children.length > 0 || R(e.head)); - } - function io(t2, e) { - let n = t2.node; - if (t2.isFirst && /---(?:\s|$)/u.test(e.originalText.slice(Pe(n), Pe(n) + 4)) || n.head.children.length > 0 || R(n.head) || K(n.head)) return "head"; - let r = t2.next; - return vr(n, r) ? false : r ? "root" : false; - } - function at(t2, e, n) { - let r = Ar(t2, e, n); - return v(N, r.map((s) => wt(v(ne, s)))); - } - function Ir(t2, e) { - if (H(t2)) switch (t2.type) { - case "comment": - if (Er(t2.value)) return null; - break; - case "quoteDouble": - case "quoteSingle": - e.type = "quote"; - break; - } - } - Ir.ignoredProperties = /* @__PURE__ */ new Set(["position"]); - var oo = { preprocess: kr, embed: mr, print: no, massageAstNode: Ir, insertPragma: wr, getVisitorKeys: dr }, Pr = oo; - var _r = [{ linguistLanguageId: 407, name: "YAML", type: "data", color: "#cb171e", tmScope: "source.yaml", aliases: ["yml"], extensions: [".yml", ".mir", ".reek", ".rviz", ".sublime-syntax", ".syntax", ".yaml", ".yaml-tmlanguage", ".yaml.sed", ".yml.mysql"], filenames: [".clang-format", ".clang-tidy", ".gemrc", "CITATION.cff", "glide.lock", ".prettierrc", ".stylelintrc", ".lintstagedrc"], aceMode: "yaml", codemirrorMode: "yaml", codemirrorMimeType: "text/x-yaml", parsers: ["yaml"], vscodeLanguageIds: ["yaml", "ansible", "dockercompose", "github-actions-workflow", "home-assistant"] }]; - var Mt = { bracketSpacing: { category: "Common", type: "boolean", default: true, description: "Print spaces between brackets.", oppositeDescription: "Do not print spaces between brackets." }, objectWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap object literals.", choices: [{ value: "preserve", description: "Keep as multi-line, if there is a newline between the opening brace and first property." }, { value: "collapse", description: "Fit to a single line when possible." }] }, singleQuote: { category: "Common", type: "boolean", default: false, description: "Use single quotes instead of double quotes." }, proseWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap prose.", choices: [{ value: "always", description: "Wrap prose if it exceeds the print width." }, { value: "never", description: "Do not wrap prose." }, { value: "preserve", description: "Wrap prose as-is." }] }, bracketSameLine: { category: "Common", type: "boolean", default: false, description: "Put > of opening tags on the last line instead of on a new line." }, singleAttributePerLine: { category: "Common", type: "boolean", default: false, description: "Enforce single attribute per line in HTML, Vue and JSX." } }; - var ao = { bracketSpacing: Mt.bracketSpacing, singleQuote: Mt.singleQuote, proseWrap: Mt.proseWrap }, xr = ao; - var tr = {}; - nr(tr, { yaml: () => Ga }); - var kt = ` -`, Rr = "\r", Dr = (function() { - function t2(e) { - this.length = e.length; - for (var n = [0], r = 0; r < e.length; ) switch (e[r]) { - case kt: - r += kt.length, n.push(r); - break; - case Rr: - r += Rr.length, e[r] === kt && (r += kt.length), n.push(r); - break; - default: - r++; - break; - } - this.offsets = n; - } - return t2.prototype.locationForIndex = function(e) { - if (e < 0 || e > this.length) return null; - for (var n = 0, r = this.offsets; r[n + 1] <= e; ) n++; - var s = e - r[n]; - return { line: n, column: s }; - }, t2.prototype.indexForLocation = function(e) { - var n = e.line, r = e.column; - return n < 0 || n >= this.offsets.length || r < 0 || r > this.lengthOfLine(n) ? null : this.offsets[n] + r; - }, t2.prototype.lengthOfLine = function(e) { - var n = this.offsets[e], r = e === this.offsets.length - 1 ? this.length : this.offsets[e + 1]; - return r - n; - }, t2; - })(); - function $(t2, e = null) { - "children" in t2 && t2.children.forEach((n) => $(n, t2)), "anchor" in t2 && t2.anchor && $(t2.anchor, t2), "tag" in t2 && t2.tag && $(t2.tag, t2), "leadingComments" in t2 && t2.leadingComments.forEach((n) => $(n, t2)), "middleComments" in t2 && t2.middleComments.forEach((n) => $(n, t2)), "indicatorComment" in t2 && t2.indicatorComment && $(t2.indicatorComment, t2), "trailingComment" in t2 && t2.trailingComment && $(t2.trailingComment, t2), "endComments" in t2 && t2.endComments.forEach((n) => $(n, t2)), Object.defineProperty(t2, "_parent", { value: e, enumerable: false }); - } - function de(t2) { - return `${t2.line}:${t2.column}`; - } - function Yr(t2) { - $(t2); - let e = co(t2), n = t2.children.slice(); - t2.comments.sort((r, s) => r.position.start.offset - s.position.end.offset).filter((r) => !r._parent).forEach((r) => { - for (; n.length > 1 && r.position.start.line > n[0].position.end.line; ) n.shift(); - lo(r, e, n[0]); - }); - } - function co(t2) { - let e = Array.from(new Array(t2.position.end.line), () => ({})); - for (let n of t2.comments) e[n.position.start.line - 1].comment = n; - return $r(e, t2), e; - } - function $r(t2, e) { - if (e.position.start.offset !== e.position.end.offset) { - if ("leadingComments" in e) { - let { start: n } = e.position, { leadingAttachableNode: r } = t2[n.line - 1]; - (!r || n.column < r.position.start.column) && (t2[n.line - 1].leadingAttachableNode = e); - } - if ("trailingComment" in e && e.position.end.column > 1 && e.type !== "document" && e.type !== "documentHead") { - let { end: n } = e.position, { trailingAttachableNode: r } = t2[n.line - 1]; - (!r || n.column >= r.position.end.column) && (t2[n.line - 1].trailingAttachableNode = e); - } - if (e.type !== "root" && e.type !== "document" && e.type !== "documentHead" && e.type !== "documentBody") { - let { start: n, end: r } = e.position, s = [r.line].concat(n.line === r.line ? [] : n.line); - for (let i of s) { - let o = t2[i - 1].trailingNode; - (!o || r.column >= o.position.end.column) && (t2[i - 1].trailingNode = e); - } - } - "children" in e && e.children.forEach((n) => { - $r(t2, n); - }); - } - } - function lo(t2, e, n) { - let r = t2.position.start.line, { trailingAttachableNode: s } = e[r - 1]; - if (s) { - if (s.trailingComment) throw new Error(`Unexpected multiple trailing comment at ${de(t2.position.start)}`); - $(t2, s), s.trailingComment = t2; - return; - } - for (let o = r; o >= n.position.start.line; o--) { - let { trailingNode: a2 } = e[o - 1], c; - if (a2) c = a2; - else if (o !== r && e[o - 1].comment) c = e[o - 1].comment._parent; - else continue; - if ((c.type === "sequence" || c.type === "mapping") && (c = c.children[0]), c.type === "mappingItem") { - let [l, f2] = c.children; - c = Br(l) ? l : f2; - } - for (; ; ) { - if (fo(c, t2)) { - $(t2, c), c.endComments.push(t2); - return; - } - if (!c._parent) break; - c = c._parent; - } - break; - } - for (let o = r + 1; o <= n.position.end.line; o++) { - let { leadingAttachableNode: a2 } = e[o - 1]; - if (a2) { - $(t2, a2), a2.leadingComments.push(t2); - return; - } - } - let i = n.children[1]; - $(t2, i), i.endComments.push(t2); - } - function fo(t2, e) { - if (t2.position.start.offset < e.position.start.offset && t2.position.end.offset > e.position.end.offset) switch (t2.type) { - case "flowMapping": - case "flowSequence": - return t2.children.length === 0 || e.position.start.line > t2.children[t2.children.length - 1].position.end.line; - } - if (e.position.end.offset < t2.position.end.offset) return false; - switch (t2.type) { - case "sequenceItem": - return e.position.start.column > t2.position.start.column; - case "mappingKey": - case "mappingValue": - return e.position.start.column > t2._parent.position.start.column && (t2.children.length === 0 || t2.children.length === 1 && t2.children[0].type !== "blockFolded" && t2.children[0].type !== "blockLiteral") && (t2.type === "mappingValue" || Br(t2)); - default: - return false; - } - } - function Br(t2) { - return t2.position.start !== t2.position.end && (t2.children.length === 0 || t2.position.start.offset !== t2.children[0].position.start.offset); - } - function b(t2, e) { - return { type: t2, position: e }; - } - function Fr(t2, e, n) { - return { ...b("root", t2), children: e, comments: n }; - } - function ct(t2) { - switch (t2.type) { - case "DOCUMENT": - for (let e = t2.contents.length - 1; e >= 0; e--) t2.contents[e].type === "BLANK_LINE" ? t2.contents.splice(e, 1) : ct(t2.contents[e]); - for (let e = t2.directives.length - 1; e >= 0; e--) t2.directives[e].type === "BLANK_LINE" && t2.directives.splice(e, 1); - break; - case "FLOW_MAP": - case "FLOW_SEQ": - case "MAP": - case "SEQ": - for (let e = t2.items.length - 1; e >= 0; e--) { - let n = t2.items[e]; - "char" in n || (n.type === "BLANK_LINE" ? t2.items.splice(e, 1) : ct(n)); - } - break; - case "MAP_KEY": - case "MAP_VALUE": - case "SEQ_ITEM": - t2.node && ct(t2.node); - break; - case "ALIAS": - case "BLANK_LINE": - case "BLOCK_FOLDED": - case "BLOCK_LITERAL": - case "COMMENT": - case "DIRECTIVE": - case "PLAIN": - case "QUOTE_DOUBLE": - case "QUOTE_SINGLE": - break; - default: - throw new Error(`Unexpected node type ${JSON.stringify(t2.type)}`); - } - } - function X() { - return { leadingComments: [] }; - } - function oe(t2 = null) { - return { trailingComment: t2 }; - } - function B() { - return { ...X(), ...oe() }; - } - function qr(t2, e, n) { - return { ...b("alias", t2), ...B(), ...e, value: n }; - } - function Ur(t2, e) { - let n = t2.cstNode; - return qr(e.transformRange({ origStart: n.valueRange.origStart - 1, origEnd: n.valueRange.origEnd }), e.transformContent(t2), n.rawValue); - } - function Kr(t2) { - return { ...t2, type: "blockFolded" }; - } - function Vr(t2, e, n, r, s, i) { - return { ...b("blockValue", t2), ...X(), ...e, chomping: n, indent: r, value: s, indicatorComment: i }; - } - var ae; - (function(t2) { - t2.Tag = "!", t2.Anchor = "&", t2.Comment = "#"; - })(ae || (ae = {})); - function Wr(t2, e) { - return { ...b("anchor", t2), value: e }; - } - function De(t2, e) { - return { ...b("comment", t2), value: e }; - } - function jr(t2, e, n) { - return { anchor: e, tag: t2, middleComments: n }; - } - function Qr(t2, e) { - return { ...b("tag", t2), value: e }; - } - function vt(t2, e, n = () => false) { - let r = t2.cstNode, s = [], i = null, o = null, a2 = null; - for (let c of r.props) { - let l = e.text[c.origStart]; - switch (l) { - case ae.Tag: - i = i || c, o = Qr(e.transformRange(c), t2.tag); - break; - case ae.Anchor: - i = i || c, a2 = Wr(e.transformRange(c), r.anchor); - break; - case ae.Comment: { - let f2 = De(e.transformRange(c), e.text.slice(c.origStart + 1, c.origEnd)); - e.comments.push(f2), !n(f2) && i && i.origEnd <= c.origStart && c.origEnd <= r.valueRange.origStart && s.push(f2); - break; - } - default: - throw new Error(`Unexpected leading character ${JSON.stringify(l)}`); - } - } - return jr(o, a2, s); - } - var En; - (function(t2) { - t2.CLIP = "clip", t2.STRIP = "strip", t2.KEEP = "keep"; - })(En || (En = {})); - function It(t2, e) { - let n = t2.cstNode, r = 1, s = n.chomping === "CLIP" ? 0 : 1, o = n.header.origEnd - n.header.origStart - r - s !== 0, a2 = e.transformRange({ origStart: n.header.origStart, origEnd: n.valueRange.origEnd }), c = null, l = vt(t2, e, (f2) => { - if (!(a2.start.offset < f2.position.start.offset && f2.position.end.offset < a2.end.offset)) return false; - if (c) throw new Error(`Unexpected multiple indicator comments at ${de(f2.position.start)}`); - return c = f2, true; - }); - return Vr(a2, l, En[n.chomping], o ? n.blockIndent : null, n.strValue, c); - } - function Jr(t2, e) { - return Kr(It(t2, e)); - } - function Gr(t2) { - return { ...t2, type: "blockLiteral" }; - } - function Hr(t2, e) { - return Gr(It(t2, e)); - } - function Xr(t2, e) { - return De(e.transformRange(t2.range), t2.comment); - } - function zr(t2, e, n) { - return { ...b("directive", t2), ...B(), name: e, parameters: n }; - } - function Ye(t2, e) { - for (let n of t2.props) { - let r = e.text[n.origStart]; - switch (r) { - case ae.Comment: - e.comments.push(De(e.transformRange(n), e.text.slice(n.origStart + 1, n.origEnd))); - break; - default: - throw new Error(`Unexpected leading character ${JSON.stringify(r)}`); - } - } - } - function Zr(t2, e) { - return Ye(t2, e), zr(e.transformRange(t2.range), t2.name, t2.parameters); - } - function es(t2, e, n, r) { - return { ...b("document", t2), ...oe(r), children: [e, n] }; - } - function V(t2, e) { - return { start: t2, end: e }; - } - function Sn(t2) { - return { start: t2, end: t2 }; - } - function F(t2 = []) { - return { endComments: t2 }; - } - function ts(t2, e, n) { - return { ...b("documentBody", t2), ...F(n), children: e ? [e] : [] }; - } - function q(t2) { - return t2[t2.length - 1]; - } - function Pt(t2, e) { - let n = t2.match(e); - return n ? n.index : -1; - } - function ns(t2, e, n) { - let r = t2.cstNode, { comments: s, endComments: i, documentTrailingComment: o, documentHeadTrailingComment: a2 } = uo(r, e, n), c = e.transformNode(t2.contents), { position: l, documentEndPoint: f2 } = po(r, c, e); - return e.comments.push(...s, ...i), { documentBody: ts(l, c, i), documentEndPoint: f2, documentTrailingComment: o, documentHeadTrailingComment: a2 }; - } - function uo(t2, e, n) { - let r = [], s = [], i = [], o = [], a2 = false; - for (let c = t2.contents.length - 1; c >= 0; c--) { - let l = t2.contents[c]; - if (l.type === "COMMENT") { - let f2 = e.transformNode(l); - n && n.line === f2.position.start.line ? o.unshift(f2) : a2 ? r.unshift(f2) : f2.position.start.offset >= t2.valueRange.origEnd ? i.unshift(f2) : r.unshift(f2); - } else a2 = true; - } - if (i.length > 1) throw new Error(`Unexpected multiple document trailing comments at ${de(i[1].position.start)}`); - if (o.length > 1) throw new Error(`Unexpected multiple documentHead trailing comments at ${de(o[1].position.start)}`); - return { comments: r, endComments: s, documentTrailingComment: q(i) || null, documentHeadTrailingComment: q(o) || null }; - } - function po(t2, e, n) { - let r = Pt(n.text.slice(t2.valueRange.origEnd), /^\.\.\./), s = r === -1 ? t2.valueRange.origEnd : Math.max(0, t2.valueRange.origEnd - 1); - n.text[s - 1] === "\r" && s--; - let i = n.transformRange({ origStart: e !== null ? e.position.start.offset : s, origEnd: s }), o = r === -1 ? i.end : n.transformOffset(t2.valueRange.origEnd + 3); - return { position: i, documentEndPoint: o }; - } - function rs(t2, e, n, r) { - return { ...b("documentHead", t2), ...F(n), ...oe(r), children: e }; - } - function ss(t2, e) { - let n = t2.cstNode, { directives: r, comments: s, endComments: i } = mo(n, e), { position: o, endMarkerPoint: a2 } = ho(n, r, e); - return e.comments.push(...s, ...i), { createDocumentHeadWithTrailingComment: (l) => (l && e.comments.push(l), rs(o, r, i, l)), documentHeadEndMarkerPoint: a2 }; - } - function mo(t2, e) { - let n = [], r = [], s = [], i = false; - for (let o = t2.directives.length - 1; o >= 0; o--) { - let a2 = e.transformNode(t2.directives[o]); - a2.type === "comment" ? i ? r.unshift(a2) : s.unshift(a2) : (i = true, n.unshift(a2)); - } - return { directives: n, comments: r, endComments: s }; - } - function ho(t2, e, n) { - let r = Pt(n.text.slice(0, t2.valueRange.origStart), /---\s*$/); - r > 0 && !/[\r\n]/.test(n.text[r - 1]) && (r = -1); - let s = r === -1 ? { origStart: t2.valueRange.origStart, origEnd: t2.valueRange.origStart } : { origStart: r, origEnd: r + 3 }; - return e.length !== 0 && (s.origStart = e[0].position.start.offset), { position: n.transformRange(s), endMarkerPoint: r === -1 ? null : n.transformOffset(r) }; - } - function is(t2, e) { - let { createDocumentHeadWithTrailingComment: n, documentHeadEndMarkerPoint: r } = ss(t2, e), { documentBody: s, documentEndPoint: i, documentTrailingComment: o, documentHeadTrailingComment: a2 } = ns(t2, e, r), c = n(a2); - return o && e.comments.push(o), es(V(c.position.start, i), c, s, o); - } - function _t(t2, e, n) { - return { ...b("flowCollection", t2), ...B(), ...F(), ...e, children: n }; - } - function os(t2, e, n) { - return { ..._t(t2, e, n), type: "flowMapping" }; - } - function xt(t2, e, n) { - return { ...b("flowMappingItem", t2), ...X(), children: [e, n] }; - } - function ce(t2, e) { - let n = []; - for (let r of t2) r && "type" in r && r.type === "COMMENT" ? e.comments.push(e.transformNode(r)) : n.push(r); - return n; - } - function Rt(t2) { - let [e, n] = ["?", ":"].map((r) => { - let s = t2.find((i) => "char" in i && i.char === r); - return s ? { origStart: s.origOffset, origEnd: s.origOffset + 1 } : null; - }); - return { additionalKeyRange: e, additionalValueRange: n }; - } - function Dt(t2, e) { - let n = e; - return (r) => t2.slice(n, n = r); - } - function Yt(t2) { - let e = [], n = Dt(t2, 1), r = false; - for (let s = 1; s < t2.length - 1; s++) { - let i = t2[s]; - if ("char" in i && i.char === ",") { - e.push(n(s)), n(s + 1), r = false; - continue; - } - r = true; - } - return r && e.push(n(t2.length - 1)), e; - } - function wn(t2, e) { - return { ...b("mappingKey", t2), ...oe(), ...F(), children: e ? [e] : [] }; - } - function bn(t2, e) { - return { ...b("mappingValue", t2), ...B(), ...F(), children: e ? [e] : [] }; - } - function $e(t2, e, n, r, s) { - let i = e.transformNode(t2.key), o = e.transformNode(t2.value), a2 = i || r ? wn(e.transformRange({ origStart: r ? r.origStart : i.position.start.offset, origEnd: i ? i.position.end.offset : r.origStart + 1 }), i) : null, c = o || s ? bn(e.transformRange({ origStart: s ? s.origStart : o.position.start.offset, origEnd: o ? o.position.end.offset : s.origStart + 1 }), o) : null; - return n(V(a2 ? a2.position.start : c.position.start, c ? c.position.end : a2.position.end), a2 || wn(Sn(c.position.start), null), c || bn(Sn(a2.position.end), null)); - } - function as(t2, e) { - let n = ce(t2.cstNode.items, e), r = Yt(n), s = t2.items.map((a2, c) => { - let l = r[c], { additionalKeyRange: f2, additionalValueRange: m } = Rt(l); - return $e(a2, e, xt, f2, m); - }), i = n[0], o = q(n); - return os(e.transformRange({ origStart: i.origOffset, origEnd: o.origOffset + 1 }), e.transformContent(t2), s); - } - function cs(t2, e, n) { - return { ..._t(t2, e, n), type: "flowSequence" }; - } - function ls(t2, e) { - return { ...b("flowSequenceItem", t2), children: [e] }; - } - function fs(t2, e) { - let n = ce(t2.cstNode.items, e), r = Yt(n), s = t2.items.map((a2, c) => { - if (a2.type !== "PAIR") { - let l = e.transformNode(a2); - return ls(V(l.position.start, l.position.end), l); - } else { - let l = r[c], { additionalKeyRange: f2, additionalValueRange: m } = Rt(l); - return $e(a2, e, xt, f2, m); - } - }), i = n[0], o = q(n); - return cs(e.transformRange({ origStart: i.origOffset, origEnd: o.origOffset + 1 }), e.transformContent(t2), s); - } - function us(t2, e, n) { - return { ...b("mapping", t2), ...X(), ...e, children: n }; - } - function ps(t2, e, n) { - return { ...b("mappingItem", t2), ...X(), children: [e, n] }; - } - function ms(t2, e) { - let n = t2.cstNode; - n.items.filter((o) => o.type === "MAP_KEY" || o.type === "MAP_VALUE").forEach((o) => Ye(o, e)); - let r = ce(n.items, e), s = go(r), i = t2.items.map((o, a2) => { - let c = s[a2], [l, f2] = c[0].type === "MAP_VALUE" ? [null, c[0].range] : [c[0].range, c.length === 1 ? null : c[1].range]; - return $e(o, e, ps, l, f2); - }); - return us(V(i[0].position.start, q(i).position.end), e.transformContent(t2), i); - } - function go(t2) { - let e = [], n = Dt(t2, 0), r = false; - for (let s = 0; s < t2.length; s++) { - if (t2[s].type === "MAP_VALUE") { - e.push(n(s + 1)), r = false; - continue; - } - r && e.push(n(s)), r = true; - } - return r && e.push(n(1 / 0)), e; - } - function hs(t2, e, n) { - return { ...b("plain", t2), ...B(), ...e, value: n }; - } - function gs(t2, e, n) { - for (let r = e; r >= 0; r--) if (n.test(t2[r])) return r; - return -1; - } - function ds(t2, e) { - let n = t2.cstNode; - return hs(e.transformRange({ origStart: n.valueRange.origStart, origEnd: gs(e.text, n.valueRange.origEnd - 1, /\S/) + 1 }), e.transformContent(t2), n.strValue); - } - function ys(t2) { - return { ...t2, type: "quoteDouble" }; - } - function Es(t2, e, n) { - return { ...b("quoteValue", t2), ...e, ...B(), value: n }; - } - function $t(t2, e) { - let n = t2.cstNode; - return Es(e.transformRange(n.valueRange), e.transformContent(t2), n.strValue); - } - function Ss(t2, e) { - return ys($t(t2, e)); - } - function ws(t2) { - return { ...t2, type: "quoteSingle" }; - } - function bs(t2, e) { - return ws($t(t2, e)); - } - function Ns(t2, e, n) { - return { ...b("sequence", t2), ...X(), ...F(), ...e, children: n }; - } - function Os(t2, e) { - return { ...b("sequenceItem", t2), ...B(), ...F(), children: e ? [e] : [] }; - } - function Ls(t2, e) { - let r = ce(t2.cstNode.items, e).map((s, i) => { - Ye(s, e); - let o = e.transformNode(t2.items[i]); - return Os(V(e.transformOffset(s.valueRange.origStart), o === null ? e.transformOffset(s.valueRange.origStart + 1) : o.position.end), o); - }); - return Ns(V(r[0].position.start, q(r).position.end), e.transformContent(t2), r); - } - function As(t2, e) { - if (t2 === null || t2.type === void 0 && t2.value === null) return null; - switch (t2.type) { - case "ALIAS": - return Ur(t2, e); - case "BLOCK_FOLDED": - return Jr(t2, e); - case "BLOCK_LITERAL": - return Hr(t2, e); - case "COMMENT": - return Xr(t2, e); - case "DIRECTIVE": - return Zr(t2, e); - case "DOCUMENT": - return is(t2, e); - case "FLOW_MAP": - return as(t2, e); - case "FLOW_SEQ": - return fs(t2, e); - case "MAP": - return ms(t2, e); - case "PLAIN": - return ds(t2, e); - case "QUOTE_DOUBLE": - return Ss(t2, e); - case "QUOTE_SINGLE": - return bs(t2, e); - case "SEQ": - return Ls(t2, e); - default: - throw new Error(`Unexpected node type ${t2.type}`); - } - } - function Ts(t2, e, n) { - let r = new SyntaxError(t2); - return r.name = "YAMLSyntaxError", r.source = e, r.position = n, r; - } - function Cs(t2, e) { - let n = t2.source.range || t2.source.valueRange; - return Ts(t2.message, e.text, e.transformRange(n)); - } - function Ms(t2, e, n) { - return { offset: t2, line: e, column: n }; - } - function ks(t2, e) { - t2 < 0 ? t2 = 0 : t2 > e.text.length && (t2 = e.text.length); - let n = e.locator.locationForIndex(t2); - return Ms(t2, n.line + 1, n.column + 1); - } - function vs(t2, e) { - return V(e.transformOffset(t2.origStart), e.transformOffset(t2.origEnd)); - } - function Is2(t2) { - if (!t2.setOrigRanges()) { - let e = (n) => { - if (yo(n)) return n.origStart = n.start, n.origEnd = n.end, true; - if (Eo(n)) return n.origOffset = n.offset, true; - }; - t2.forEach((n) => Nn(n, e)); - } - } - function Nn(t2, e) { - if (!(!t2 || typeof t2 != "object") && e(t2) !== true) for (let n of Object.keys(t2)) { - if (n === "context" || n === "error") continue; - let r = t2[n]; - Array.isArray(r) ? r.forEach((s) => Nn(s, e)) : Nn(r, e); - } - } - function yo(t2) { - return typeof t2.start == "number"; - } - function Eo(t2) { - return typeof t2.offset == "number"; - } - function On(t2) { - if ("children" in t2) { - if (t2.children.length === 1) { - let e = t2.children[0]; - if (e.type === "plain" && e.tag === null && e.anchor === null && e.value === "") return t2.children.splice(0, 1), t2; - } - t2.children.forEach(On); - } - return t2; - } - function Ln(t2, e, n, r) { - let s = e(t2); - return (i) => { - r(s, i) && n(t2, s = i); - }; - } - function An(t2) { - if (t2 === null || !("children" in t2)) return; - let e = t2.children; - if (e.forEach(An), t2.type === "document") { - let [i, o] = t2.children; - i.position.start.offset === i.position.end.offset ? i.position.start = i.position.end = o.position.start : o.position.start.offset === o.position.end.offset && (o.position.start = o.position.end = i.position.end); - } - let n = Ln(t2.position, So, wo, Oo), r = Ln(t2.position, bo, No, Lo); - "endComments" in t2 && t2.endComments.length !== 0 && (n(t2.endComments[0].position.start), r(q(t2.endComments).position.end)); - let s = e.filter((i) => i !== null); - if (s.length !== 0) { - let i = s[0], o = q(s); - n(i.position.start), r(o.position.end), "leadingComments" in i && i.leadingComments.length !== 0 && n(i.leadingComments[0].position.start), "tag" in i && i.tag && n(i.tag.position.start), "anchor" in i && i.anchor && n(i.anchor.position.start), "trailingComment" in o && o.trailingComment && r(o.trailingComment.position.end); - } - } - function So(t2) { - return t2.start; - } - function wo(t2, e) { - t2.start = e; - } - function bo(t2) { - return t2.end; - } - function No(t2, e) { - t2.end = e; - } - function Oo(t2, e) { - return e.offset < t2.offset; - } - function Lo(t2, e) { - return e.offset > t2.offset; - } - var wi = sr(Ei(), 1); - var G = sr(Si(), 1), Vm = G.default.findPair, Wm = G.default.toJSON, jm = G.default.parseMap, Qm = G.default.parseSeq, Jm = G.default.stringifyNumber, Gm = G.default.stringifyString, Hm = G.default.Type, Va = G.default.YAMLError, Xm = G.default.YAMLReferenceError, er = G.default.YAMLSemanticError, Wa = G.default.YAMLSyntaxError, zm = G.default.YAMLWarning; - var { Document: bi, parseCST: Ni } = wi.default; - function Oi(t2) { - let e = Ni(t2); - Is2(e); - let n = e.map((a2) => new bi({ merge: false, keepCstNodes: true }).parse(a2)), r = new Dr(t2), s = [], i = { text: t2, locator: r, comments: s, transformOffset: (a2) => ks(a2, i), transformRange: (a2) => vs(a2, i), transformNode: (a2) => As(a2, i), transformContent: (a2) => vt(a2, i) }; - for (let a2 of n) for (let c of a2.errors) if (!(c instanceof er && c.message === 'Map keys must be unique; "<<" is repeated')) throw Cs(c, i); - n.forEach((a2) => ct(a2.cstNode)); - let o = Fr(i.transformRange({ origStart: 0, origEnd: i.text.length }), n.map(i.transformNode), s); - return Yr(o), An(o), On(o), o; - } - function Qa(t2, e) { - let n = new SyntaxError(t2 + " (" + e.loc.start.line + ":" + e.loc.start.column + ")"); - return Object.assign(n, e); - } - var Li = Qa; - function Ja(t2) { - try { - let e = Oi(t2); - return delete e.comments, e; - } catch (e) { - throw e != null && e.position ? Li(e.message, { loc: e.position, cause: e }) : e; - } - } - var Ga = { astFormat: "yaml", parse: Ja, hasPragma: Sr, locStart: Pe, locEnd: yr }; - var Ha = { yaml: Pr }; - return Ii(Xa); - }); - } -}); - -// ../../node_modules/prettier/plugins/estree.js -var require_estree = __commonJS({ - "../../node_modules/prettier/plugins/estree.js"(exports, module) { - (function(f2) { - function e() { - var i = f2(); - return i.default || i; - } - if (typeof exports == "object" && typeof module == "object") module.exports = e(); - else if (typeof define == "function" && define.amd) define(e); - else { - var t2 = typeof globalThis < "u" ? globalThis : typeof global < "u" ? global : typeof self < "u" ? self : this || {}; - t2.prettierPlugins = t2.prettierPlugins || {}, t2.prettierPlugins.estree = e(); - } - })(function() { - "use strict"; - var Ln = Object.defineProperty; - var Xa = Object.getOwnPropertyDescriptor; - var Ha = Object.getOwnPropertyNames; - var Va = Object.prototype.hasOwnProperty; - var Ws = (e) => { - throw TypeError(e); - }; - var Tr = (e, t2) => { - for (var r in t2) Ln(e, r, { get: t2[r], enumerable: true }); - }, $a = (e, t2, r, n) => { - if (t2 && typeof t2 == "object" || typeof t2 == "function") for (let s of Ha(t2)) !Va.call(e, s) && s !== r && Ln(e, s, { get: () => t2[s], enumerable: !(n = Xa(t2, s)) || n.enumerable }); - return e; - }; - var Ka = (e) => $a(Ln({}, "__esModule", { value: true }), e); - var Gs = (e, t2, r) => t2.has(e) || Ws("Cannot " + r); - var pt = (e, t2, r) => (Gs(e, t2, "read from private field"), r ? r.call(e) : t2.get(e)), Us = (e, t2, r) => t2.has(e) ? Ws("Cannot add the same private member more than once") : t2 instanceof WeakSet ? t2.add(e) : t2.set(e, r), Ys = (e, t2, r, n) => (Gs(e, t2, "write to private field"), n ? n.call(e, r) : t2.set(e, r), r); - var fm = {}; - Tr(fm, { languages: () => Dm, options: () => Wa, printers: () => ym }); - var Ns = [{ linguistLanguageId: 183, name: "JavaScript", type: "programming", tmScope: "source.js", aceMode: "javascript", codemirrorMode: "javascript", codemirrorMimeType: "text/javascript", color: "#f1e05a", aliases: ["js", "node"], extensions: [".js", "._js", ".bones", ".cjs", ".es", ".es6", ".frag", ".gs", ".jake", ".javascript", ".jsb", ".jscad", ".jsfl", ".jslib", ".jsm", ".jspre", ".jss", ".mjs", ".njs", ".pac", ".sjs", ".ssjs", ".xsjs", ".xsjslib", ".wxs"], filenames: ["Jakefile"], interpreters: ["chakra", "d8", "gjs", "js", "node", "nodejs", "qjs", "rhino", "v8", "v8-shell", "zx"], parsers: ["babel", "acorn", "espree", "meriyah", "babel-flow", "babel-ts", "flow", "typescript"], vscodeLanguageIds: ["javascript", "mongo"] }, { linguistLanguageId: 183, name: "Flow", type: "programming", tmScope: "source.js", aceMode: "javascript", codemirrorMode: "javascript", codemirrorMimeType: "text/javascript", color: "#f1e05a", aliases: [], extensions: [".js.flow"], filenames: [], interpreters: ["chakra", "d8", "gjs", "js", "node", "nodejs", "qjs", "rhino", "v8", "v8-shell"], parsers: ["flow", "babel-flow"], vscodeLanguageIds: ["javascript"] }, { linguistLanguageId: 183, name: "JSX", type: "programming", tmScope: "source.js.jsx", aceMode: "javascript", codemirrorMode: "jsx", codemirrorMimeType: "text/jsx", color: void 0, aliases: void 0, extensions: [".jsx"], filenames: void 0, interpreters: void 0, parsers: ["babel", "babel-flow", "babel-ts", "flow", "typescript", "espree", "meriyah"], vscodeLanguageIds: ["javascriptreact"], group: "JavaScript" }, { linguistLanguageId: 378, name: "TypeScript", type: "programming", color: "#3178c6", aliases: ["ts"], interpreters: ["deno", "ts-node"], extensions: [".ts", ".cts", ".mts"], tmScope: "source.ts", aceMode: "typescript", codemirrorMode: "javascript", codemirrorMimeType: "application/typescript", parsers: ["typescript", "babel-ts"], vscodeLanguageIds: ["typescript"] }, { linguistLanguageId: 94901924, name: "TSX", type: "programming", color: "#3178c6", group: "TypeScript", extensions: [".tsx"], tmScope: "source.tsx", aceMode: "javascript", codemirrorMode: "jsx", codemirrorMimeType: "text/jsx", parsers: ["typescript", "babel-ts"], vscodeLanguageIds: ["typescriptreact"] }]; - var vs = {}; - Tr(vs, { canAttachComment: () => Sp, embed: () => ti, experimentalFeatures: () => am, getCommentChildNodes: () => Bp, getVisitorKeys: () => Sr, handleComments: () => zn, insertPragma: () => mi, isBlockComment: () => ee, isGap: () => bp, massageAstNode: () => du, print: () => va, printComment: () => wu, willPrintOwnComments: () => Zn }); - var Qa = (e, t2, r, n) => { - if (!(e && t2 == null)) return t2.replaceAll ? t2.replaceAll(r, n) : r.global ? t2.replace(r, n) : t2.split(r).join(n); - }, N = Qa; - var za = (e, t2, r) => { - if (!(e && t2 == null)) return Array.isArray(t2) || typeof t2 == "string" ? t2[r < 0 ? t2.length + r : r] : t2.at(r); - }, M = za; - function Za(e) { - return e !== null && typeof e == "object"; - } - var Xs = Za; - function* eo(e, t2) { - let { getVisitorKeys: r, filter: n = () => true } = t2, s = (u) => Xs(u) && n(u); - for (let u of r(e)) { - let i = e[u]; - if (Array.isArray(i)) for (let a2 of i) s(a2) && (yield a2); - else s(i) && (yield i); - } - } - function* to(e, t2) { - let r = [e]; - for (let n = 0; n < r.length; n++) { - let s = r[n]; - for (let u of eo(s, t2)) yield u, r.push(u); - } - } - function Hs(e, { getVisitorKeys: t2, predicate: r }) { - for (let n of to(e, { getVisitorKeys: t2 })) if (r(n)) return true; - return false; - } - var Vs = () => /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g; - function $s(e) { - return e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510; - } - function Ks(e) { - return e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9776 && e <= 9783 || e >= 9800 && e <= 9811 || e === 9855 || e >= 9866 && e <= 9871 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12773 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101631 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e >= 119552 && e <= 119638 || e >= 119648 && e <= 119670 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129673 || e >= 129679 && e <= 129734 || e >= 129742 && e <= 129756 || e >= 129759 && e <= 129769 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141; - } - var Qs = (e) => !($s(e) || Ks(e)); - var ro = /[^\x20-\x7F]/u; - function no(e) { - if (!e) return 0; - if (!ro.test(e)) return e.length; - e = e.replace(Vs(), " "); - let t2 = 0; - for (let r of e) { - let n = r.codePointAt(0); - n <= 31 || n >= 127 && n <= 159 || n >= 768 && n <= 879 || (t2 += Qs(n) ? 1 : 2); - } - return t2; - } - var tt = no; - function dr(e) { - return (t2, r, n) => { - let s = !!(n != null && n.backwards); - if (r === false) return false; - let { length: u } = t2, i = r; - for (; i >= 0 && i < u; ) { - let a2 = t2.charAt(i); - if (e instanceof RegExp) { - if (!e.test(a2)) return i; - } else if (!e.includes(a2)) return i; - s ? i-- : i++; - } - return i === -1 || i === u ? i : false; - }; - } - var Om = dr(/\s/u), Ye = dr(" "), zs = dr(",; "), Zs = dr(/[^\n\r]/u); - function so(e, t2, r) { - let n = !!(r != null && r.backwards); - if (t2 === false) return false; - let s = e.charAt(t2); - if (n) { - if (e.charAt(t2 - 1) === "\r" && s === ` -`) return t2 - 2; - if (s === ` -` || s === "\r" || s === "\u2028" || s === "\u2029") return t2 - 1; - } else { - if (s === "\r" && e.charAt(t2 + 1) === ` -`) return t2 + 2; - if (s === ` -` || s === "\r" || s === "\u2028" || s === "\u2029") return t2 + 1; - } - return t2; - } - var Ne = so; - function uo(e, t2, r = {}) { - let n = Ye(e, r.backwards ? t2 - 1 : t2, r), s = Ne(e, n, r); - return n !== s; - } - var Z = uo; - function io(e, t2) { - if (t2 === false) return false; - if (e.charAt(t2) === "/" && e.charAt(t2 + 1) === "*") { - for (let r = t2 + 2; r < e.length; ++r) if (e.charAt(r) === "*" && e.charAt(r + 1) === "/") return r + 2; - } - return t2; - } - var Ot = io; - function ao(e, t2) { - return t2 === false ? false : e.charAt(t2) === "/" && e.charAt(t2 + 1) === "/" ? Zs(e, t2) : t2; - } - var _t = ao; - function oo(e, t2) { - let r = null, n = t2; - for (; n !== r; ) r = n, n = zs(e, n), n = Ot(e, n), n = Ye(e, n); - return n = _t(e, n), n = Ne(e, n), n !== false && Z(e, n); - } - var vt = oo; - function po(e) { - return Array.isArray(e) && e.length > 0; - } - var O = po; - var eu = new Proxy(() => { - }, { get: () => eu }), jt = eu; - var xr = "'", tu = '"'; - function co(e, t2) { - let r = t2 === true || t2 === xr ? xr : tu, n = r === xr ? tu : xr, s = 0, u = 0; - for (let i of e) i === r ? s++ : i === n && u++; - return s > u ? n : r; - } - var hr = co; - function lo(e, t2, r) { - let n = t2 === '"' ? "'" : '"', u = N(false, e, /\\(.)|(["'])/gsu, (i, a2, o) => a2 === n ? a2 : o === t2 ? "\\" + o : o || (r && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(a2) ? a2 : "\\" + a2)); - return t2 + u + t2; - } - var ru = lo; - function mo(e, t2) { - jt(/^(?["']).*\k$/su.test(e)); - let r = e.slice(1, -1), n = t2.parser === "json" || t2.parser === "jsonc" || t2.parser === "json5" && t2.quoteProps === "preserve" && !t2.singleQuote ? '"' : t2.__isInHtmlAttribute ? "'" : hr(r, t2.singleQuote); - return e.charAt(0) === n ? e : ru(r, n, false); - } - var rt = mo; - function q(e) { - var _a2, _b; - var n, s, u; - let t2 = (_a2 = (n = e.range) == null ? void 0 : n[0]) != null ? _a2 : e.start, r = (u = (_b = (s = e.declaration) == null ? void 0 : s.decorators) != null ? _b : e.decorators) == null ? void 0 : u[0]; - return r ? Math.min(q(r), t2) : t2; - } - function k(e) { - var _a2; - var t2; - return (_a2 = (t2 = e.range) == null ? void 0 : t2[1]) != null ? _a2 : e.end; - } - function bt(e, t2) { - let r = q(e); - return Number.isInteger(r) && r === q(t2); - } - function yo(e, t2) { - let r = k(e); - return Number.isInteger(r) && r === k(t2); - } - function nu(e, t2) { - return bt(e, t2) && yo(e, t2); - } - var er = null; - function tr(e) { - if (er !== null && typeof er.property) { - let t2 = er; - return er = tr.prototype = null, t2; - } - return er = tr.prototype = e != null ? e : /* @__PURE__ */ Object.create(null), new tr(); - } - var Do = 10; - for (let e = 0; e <= Do; e++) tr(); - function wn(e) { - return tr(e); - } - function fo(e, t2 = "type") { - wn(e); - function r(n) { - let s = n[t2], u = e[s]; - if (!Array.isArray(u)) throw Object.assign(new Error(`Missing visitor keys for '${s}'.`), { node: n }); - return u; - } - return r; - } - var gr = fo; - var su = { ArrayExpression: ["elements"], AssignmentExpression: ["left", "right"], BinaryExpression: ["left", "right"], InterpreterDirective: [], Directive: ["value"], DirectiveLiteral: [], BlockStatement: ["directives", "body"], BreakStatement: ["label"], CallExpression: ["callee", "arguments", "typeParameters", "typeArguments"], CatchClause: ["param", "body"], ConditionalExpression: ["test", "consequent", "alternate"], ContinueStatement: ["label"], DebuggerStatement: [], DoWhileStatement: ["body", "test"], EmptyStatement: [], ExpressionStatement: ["expression"], File: ["program"], ForInStatement: ["left", "right", "body"], ForStatement: ["init", "test", "update", "body"], FunctionDeclaration: ["id", "typeParameters", "params", "predicate", "returnType", "body"], FunctionExpression: ["id", "typeParameters", "params", "returnType", "body"], Identifier: ["typeAnnotation", "decorators"], IfStatement: ["test", "consequent", "alternate"], LabeledStatement: ["label", "body"], StringLiteral: [], NumericLiteral: [], NullLiteral: [], BooleanLiteral: [], RegExpLiteral: [], LogicalExpression: ["left", "right"], MemberExpression: ["object", "property"], NewExpression: ["callee", "arguments", "typeParameters", "typeArguments"], Program: ["directives", "body"], ObjectExpression: ["properties"], ObjectMethod: ["decorators", "key", "typeParameters", "params", "returnType", "body"], ObjectProperty: ["key", "value", "decorators"], RestElement: ["argument", "typeAnnotation", "decorators"], ReturnStatement: ["argument"], SequenceExpression: ["expressions"], ParenthesizedExpression: ["expression"], SwitchCase: ["test", "consequent"], SwitchStatement: ["discriminant", "cases"], ThisExpression: [], ThrowStatement: ["argument"], TryStatement: ["block", "handler", "finalizer"], UnaryExpression: ["argument"], UpdateExpression: ["argument"], VariableDeclaration: ["declarations"], VariableDeclarator: ["id", "init"], WhileStatement: ["test", "body"], WithStatement: ["object", "body"], AssignmentPattern: ["left", "right", "decorators", "typeAnnotation"], ArrayPattern: ["elements", "typeAnnotation", "decorators"], ArrowFunctionExpression: ["typeParameters", "params", "predicate", "returnType", "body"], ClassBody: ["body"], ClassExpression: ["decorators", "id", "typeParameters", "superClass", "superTypeParameters", "mixins", "implements", "body", "superTypeArguments"], ClassDeclaration: ["decorators", "id", "typeParameters", "superClass", "superTypeParameters", "mixins", "implements", "body", "superTypeArguments"], ExportAllDeclaration: ["source", "attributes", "exported"], ExportDefaultDeclaration: ["declaration"], ExportNamedDeclaration: ["declaration", "specifiers", "source", "attributes"], ExportSpecifier: ["local", "exported"], ForOfStatement: ["left", "right", "body"], ImportDeclaration: ["specifiers", "source", "attributes"], ImportDefaultSpecifier: ["local"], ImportNamespaceSpecifier: ["local"], ImportSpecifier: ["imported", "local"], ImportExpression: ["source", "options"], MetaProperty: ["meta", "property"], ClassMethod: ["decorators", "key", "typeParameters", "params", "returnType", "body"], ObjectPattern: ["properties", "typeAnnotation", "decorators"], SpreadElement: ["argument"], Super: [], TaggedTemplateExpression: ["tag", "typeParameters", "quasi", "typeArguments"], TemplateElement: [], TemplateLiteral: ["quasis", "expressions"], YieldExpression: ["argument"], AwaitExpression: ["argument"], BigIntLiteral: [], ExportNamespaceSpecifier: ["exported"], OptionalMemberExpression: ["object", "property"], OptionalCallExpression: ["callee", "arguments", "typeParameters", "typeArguments"], ClassProperty: ["decorators", "variance", "key", "typeAnnotation", "value"], ClassAccessorProperty: ["decorators", "key", "typeAnnotation", "value"], ClassPrivateProperty: ["decorators", "variance", "key", "typeAnnotation", "value"], ClassPrivateMethod: ["decorators", "key", "typeParameters", "params", "returnType", "body"], PrivateName: ["id"], StaticBlock: ["body"], AnyTypeAnnotation: [], ArrayTypeAnnotation: ["elementType"], BooleanTypeAnnotation: [], BooleanLiteralTypeAnnotation: [], NullLiteralTypeAnnotation: [], ClassImplements: ["id", "typeParameters"], DeclareClass: ["id", "typeParameters", "extends", "mixins", "implements", "body"], DeclareFunction: ["id", "predicate"], DeclareInterface: ["id", "typeParameters", "extends", "body"], DeclareModule: ["id", "body"], DeclareModuleExports: ["typeAnnotation"], DeclareTypeAlias: ["id", "typeParameters", "right"], DeclareOpaqueType: ["id", "typeParameters", "supertype"], DeclareVariable: ["id"], DeclareExportDeclaration: ["declaration", "specifiers", "source", "attributes"], DeclareExportAllDeclaration: ["source", "attributes"], DeclaredPredicate: ["value"], ExistsTypeAnnotation: [], FunctionTypeAnnotation: ["typeParameters", "this", "params", "rest", "returnType"], FunctionTypeParam: ["name", "typeAnnotation"], GenericTypeAnnotation: ["id", "typeParameters"], InferredPredicate: [], InterfaceExtends: ["id", "typeParameters"], InterfaceDeclaration: ["id", "typeParameters", "extends", "body"], InterfaceTypeAnnotation: ["extends", "body"], IntersectionTypeAnnotation: ["types"], MixedTypeAnnotation: [], EmptyTypeAnnotation: [], NullableTypeAnnotation: ["typeAnnotation"], NumberLiteralTypeAnnotation: [], NumberTypeAnnotation: [], ObjectTypeAnnotation: ["properties", "indexers", "callProperties", "internalSlots"], ObjectTypeInternalSlot: ["id", "value"], ObjectTypeCallProperty: ["value"], ObjectTypeIndexer: ["variance", "id", "key", "value"], ObjectTypeProperty: ["key", "value", "variance"], ObjectTypeSpreadProperty: ["argument"], OpaqueType: ["id", "typeParameters", "supertype", "impltype"], QualifiedTypeIdentifier: ["qualification", "id"], StringLiteralTypeAnnotation: [], StringTypeAnnotation: [], SymbolTypeAnnotation: [], ThisTypeAnnotation: [], TupleTypeAnnotation: ["types", "elementTypes"], TypeofTypeAnnotation: ["argument", "typeArguments"], TypeAlias: ["id", "typeParameters", "right"], TypeAnnotation: ["typeAnnotation"], TypeCastExpression: ["expression", "typeAnnotation"], TypeParameter: ["bound", "default", "variance"], TypeParameterDeclaration: ["params"], TypeParameterInstantiation: ["params"], UnionTypeAnnotation: ["types"], Variance: [], VoidTypeAnnotation: [], EnumDeclaration: ["id", "body"], EnumBooleanBody: ["members"], EnumNumberBody: ["members"], EnumStringBody: ["members"], EnumSymbolBody: ["members"], EnumBooleanMember: ["id", "init"], EnumNumberMember: ["id", "init"], EnumStringMember: ["id", "init"], EnumDefaultedMember: ["id"], IndexedAccessType: ["objectType", "indexType"], OptionalIndexedAccessType: ["objectType", "indexType"], JSXAttribute: ["name", "value"], JSXClosingElement: ["name"], JSXElement: ["openingElement", "children", "closingElement"], JSXEmptyExpression: [], JSXExpressionContainer: ["expression"], JSXSpreadChild: ["expression"], JSXIdentifier: [], JSXMemberExpression: ["object", "property"], JSXNamespacedName: ["namespace", "name"], JSXOpeningElement: ["name", "typeParameters", "typeArguments", "attributes"], JSXSpreadAttribute: ["argument"], JSXText: [], JSXFragment: ["openingFragment", "children", "closingFragment"], JSXOpeningFragment: [], JSXClosingFragment: [], Noop: [], Placeholder: [], V8IntrinsicIdentifier: [], ArgumentPlaceholder: [], BindExpression: ["object", "callee"], ImportAttribute: ["key", "value"], Decorator: ["expression"], DoExpression: ["body"], ExportDefaultSpecifier: ["exported"], RecordExpression: ["properties"], TupleExpression: ["elements"], ModuleExpression: ["body"], TopicReference: [], PipelineTopicExpression: ["expression"], PipelineBareFunction: ["callee"], PipelinePrimaryTopicReference: [], TSParameterProperty: ["parameter", "decorators"], TSDeclareFunction: ["id", "typeParameters", "params", "returnType", "body"], TSDeclareMethod: ["decorators", "key", "typeParameters", "params", "returnType"], TSQualifiedName: ["left", "right"], TSCallSignatureDeclaration: ["typeParameters", "parameters", "typeAnnotation", "params", "returnType"], TSConstructSignatureDeclaration: ["typeParameters", "parameters", "typeAnnotation", "params", "returnType"], TSPropertySignature: ["key", "typeAnnotation"], TSMethodSignature: ["key", "typeParameters", "parameters", "typeAnnotation", "params", "returnType"], TSIndexSignature: ["parameters", "typeAnnotation"], TSAnyKeyword: [], TSBooleanKeyword: [], TSBigIntKeyword: [], TSIntrinsicKeyword: [], TSNeverKeyword: [], TSNullKeyword: [], TSNumberKeyword: [], TSObjectKeyword: [], TSStringKeyword: [], TSSymbolKeyword: [], TSUndefinedKeyword: [], TSUnknownKeyword: [], TSVoidKeyword: [], TSThisType: [], TSFunctionType: ["typeParameters", "parameters", "typeAnnotation", "params", "returnType"], TSConstructorType: ["typeParameters", "parameters", "typeAnnotation", "params", "returnType"], TSTypeReference: ["typeName", "typeParameters", "typeArguments"], TSTypePredicate: ["parameterName", "typeAnnotation"], TSTypeQuery: ["exprName", "typeParameters", "typeArguments"], TSTypeLiteral: ["members"], TSArrayType: ["elementType"], TSTupleType: ["elementTypes"], TSOptionalType: ["typeAnnotation"], TSRestType: ["typeAnnotation"], TSNamedTupleMember: ["label", "elementType"], TSUnionType: ["types"], TSIntersectionType: ["types"], TSConditionalType: ["checkType", "extendsType", "trueType", "falseType"], TSInferType: ["typeParameter"], TSParenthesizedType: ["typeAnnotation"], TSTypeOperator: ["typeAnnotation"], TSIndexedAccessType: ["objectType", "indexType"], TSMappedType: ["typeParameter", "nameType", "typeAnnotation"], TSTemplateLiteralType: ["quasis", "types"], TSLiteralType: ["literal"], TSExpressionWithTypeArguments: ["expression", "typeParameters"], TSInterfaceDeclaration: ["id", "typeParameters", "extends", "body"], TSInterfaceBody: ["body"], TSTypeAliasDeclaration: ["id", "typeParameters", "typeAnnotation"], TSInstantiationExpression: ["expression", "typeParameters", "typeArguments"], TSAsExpression: ["expression", "typeAnnotation"], TSSatisfiesExpression: ["expression", "typeAnnotation"], TSTypeAssertion: ["typeAnnotation", "expression"], TSEnumBody: ["members"], TSEnumDeclaration: ["id", "members"], TSEnumMember: ["id", "initializer"], TSModuleDeclaration: ["id", "body"], TSModuleBlock: ["body"], TSImportType: ["argument", "options", "qualifier", "typeParameters", "typeArguments"], TSImportEqualsDeclaration: ["id", "moduleReference"], TSExternalModuleReference: ["expression"], TSNonNullExpression: ["expression"], TSExportAssignment: ["expression"], TSNamespaceExportDeclaration: ["id"], TSTypeAnnotation: ["typeAnnotation"], TSTypeParameterInstantiation: ["params"], TSTypeParameterDeclaration: ["params"], TSTypeParameter: ["constraint", "default", "name"], ChainExpression: ["expression"], ExperimentalRestProperty: ["argument"], ExperimentalSpreadProperty: ["argument"], Literal: [], MethodDefinition: ["decorators", "key", "value"], PrivateIdentifier: [], Property: ["key", "value"], PropertyDefinition: ["decorators", "key", "typeAnnotation", "value", "variance"], AccessorProperty: ["decorators", "key", "typeAnnotation", "value"], TSAbstractAccessorProperty: ["decorators", "key", "typeAnnotation"], TSAbstractKeyword: [], TSAbstractMethodDefinition: ["key", "value"], TSAbstractPropertyDefinition: ["decorators", "key", "typeAnnotation"], TSAsyncKeyword: [], TSClassImplements: ["expression", "typeArguments", "typeParameters"], TSDeclareKeyword: [], TSEmptyBodyFunctionExpression: ["id", "typeParameters", "params", "returnType"], TSExportKeyword: [], TSInterfaceHeritage: ["expression", "typeArguments", "typeParameters"], TSPrivateKeyword: [], TSProtectedKeyword: [], TSPublicKeyword: [], TSReadonlyKeyword: [], TSStaticKeyword: [], AsConstExpression: ["expression"], AsExpression: ["expression", "typeAnnotation"], BigIntLiteralTypeAnnotation: [], BigIntTypeAnnotation: [], ComponentDeclaration: ["id", "params", "body", "typeParameters", "rendersType"], ComponentParameter: ["name", "local"], ComponentTypeAnnotation: ["params", "rest", "typeParameters", "rendersType"], ComponentTypeParameter: ["name", "typeAnnotation"], ConditionalTypeAnnotation: ["checkType", "extendsType", "trueType", "falseType"], DeclareComponent: ["id", "params", "rest", "typeParameters", "rendersType"], DeclareEnum: ["id", "body"], DeclareHook: ["id"], DeclareNamespace: ["id", "body"], EnumBigIntBody: ["members"], EnumBigIntMember: ["id", "init"], HookDeclaration: ["id", "params", "body", "typeParameters", "returnType"], HookTypeAnnotation: ["params", "returnType", "rest", "typeParameters"], InferTypeAnnotation: ["typeParameter"], KeyofTypeAnnotation: ["argument"], ObjectTypeMappedTypeProperty: ["keyTparam", "propType", "sourceType", "variance"], QualifiedTypeofIdentifier: ["qualification", "id"], TupleTypeLabeledElement: ["label", "elementType", "variance"], TupleTypeSpreadElement: ["label", "typeAnnotation"], TypeOperator: ["typeAnnotation"], TypePredicate: ["parameterName", "typeAnnotation", "asserts"], NGRoot: ["node"], NGPipeExpression: ["left", "right", "arguments"], NGChainedExpression: ["expressions"], NGEmptyExpression: [], NGMicrosyntax: ["body"], NGMicrosyntaxKey: [], NGMicrosyntaxExpression: ["expression", "alias"], NGMicrosyntaxKeyedExpression: ["key", "expression"], NGMicrosyntaxLet: ["key", "value"], NGMicrosyntaxAs: ["key", "alias"], JsExpressionRoot: ["node"], JsonRoot: ["node"], TSJSDocAllType: [], TSJSDocUnknownType: [], TSJSDocNullableType: ["typeAnnotation"], TSJSDocNonNullableType: ["typeAnnotation"], NeverTypeAnnotation: [], UndefinedTypeAnnotation: [], UnknownTypeAnnotation: [], SatisfiesExpression: ["expression", "typeAnnotation"] }; - var Eo = gr(su), Sr = Eo; - function Fo(e) { - let t2 = new Set(e); - return (r) => t2.has(r == null ? void 0 : r.type); - } - var R = Fo; - var Co = R(["Block", "CommentBlock", "MultiLine"]), ee = Co; - var Ao = R(["AnyTypeAnnotation", "ThisTypeAnnotation", "NumberTypeAnnotation", "VoidTypeAnnotation", "BooleanTypeAnnotation", "BigIntTypeAnnotation", "SymbolTypeAnnotation", "StringTypeAnnotation", "NeverTypeAnnotation", "UndefinedTypeAnnotation", "UnknownTypeAnnotation", "EmptyTypeAnnotation", "MixedTypeAnnotation"]), Br = Ao; - function To(e, t2) { - let r = t2.split("."); - for (let n = r.length - 1; n >= 0; n--) { - let s = r[n]; - if (n === 0) return e.type === "Identifier" && e.name === s; - if (e.type !== "MemberExpression" || e.optional || e.computed || e.property.type !== "Identifier" || e.property.name !== s) return false; - e = e.object; - } - } - function xo(e, t2) { - return t2.some((r) => To(e, r)); - } - var uu = xo; - function ho({ type: e }) { - return e.startsWith("TS") && e.endsWith("Keyword"); - } - var br = ho; - function nr(e, t2) { - return t2(e) || Hs(e, { getVisitorKeys: Sr, predicate: t2 }); - } - function Rt(e) { - return e.type === "AssignmentExpression" || e.type === "BinaryExpression" || e.type === "LogicalExpression" || e.type === "NGPipeExpression" || e.type === "ConditionalExpression" || L(e) || W(e) || e.type === "SequenceExpression" || e.type === "TaggedTemplateExpression" || e.type === "BindExpression" || e.type === "UpdateExpression" && !e.prefix || Ae(e) || e.type === "TSNonNullExpression" || e.type === "ChainExpression"; - } - function ou(e) { - var _a2, _b, _c2, _d, _e2, _f; - return e.expressions ? e.expressions[0] : (_f = (_e2 = (_d = (_c2 = (_b = (_a2 = e.left) != null ? _a2 : e.test) != null ? _b : e.callee) != null ? _c2 : e.object) != null ? _d : e.tag) != null ? _e2 : e.argument) != null ? _f : e.expression; - } - function kr(e) { - if (e.expressions) return ["expressions", 0]; - if (e.left) return ["left"]; - if (e.test) return ["test"]; - if (e.object) return ["object"]; - if (e.callee) return ["callee"]; - if (e.tag) return ["tag"]; - if (e.argument) return ["argument"]; - if (e.expression) return ["expression"]; - throw new Error("Unexpected node has no left side."); - } - var Ct = R(["Line", "CommentLine", "SingleLine", "HashbangComment", "HTMLOpen", "HTMLClose", "Hashbang", "InterpreterDirective"]), pu = R(["ExportDefaultDeclaration", "DeclareExportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration", "DeclareExportAllDeclaration"]), Y = R(["ArrayExpression", "TupleExpression"]), se = R(["ObjectExpression", "RecordExpression"]); - function cu(e) { - return e.type === "LogicalExpression" && e.operator === "??"; - } - function Fe(e) { - return e.type === "NumericLiteral" || e.type === "Literal" && typeof e.value == "number"; - } - function Mn(e) { - return e.type === "UnaryExpression" && (e.operator === "+" || e.operator === "-") && Fe(e.argument); - } - function te(e) { - return !!(e && (e.type === "StringLiteral" || e.type === "Literal" && typeof e.value == "string")); - } - function Rn(e) { - return e.type === "RegExpLiteral" || e.type === "Literal" && !!e.regex; - } - var Ir = R(["Literal", "BooleanLiteral", "BigIntLiteral", "DirectiveLiteral", "NullLiteral", "NumericLiteral", "RegExpLiteral", "StringLiteral"]), go = R(["Identifier", "ThisExpression", "Super", "PrivateName", "PrivateIdentifier"]), Me = R(["ObjectTypeAnnotation", "TSTypeLiteral", "TSMappedType"]), Mt = R(["FunctionExpression", "ArrowFunctionExpression"]); - function So(e) { - return e.type === "FunctionExpression" || e.type === "ArrowFunctionExpression" && e.body.type === "BlockStatement"; - } - function On(e) { - return L(e) && e.callee.type === "Identifier" && ["async", "inject", "fakeAsync", "waitForAsync"].includes(e.callee.name); - } - var X = R(["JSXElement", "JSXFragment"]); - function Pt(e) { - return e.method && e.kind === "init" || e.kind === "get" || e.kind === "set"; - } - function Lr(e) { - return (e.type === "ObjectTypeProperty" || e.type === "ObjectTypeInternalSlot") && !e.static && !e.method && e.kind !== "get" && e.kind !== "set" && e.value.type === "FunctionTypeAnnotation"; - } - function lu(e) { - return (e.type === "TypeAnnotation" || e.type === "TSTypeAnnotation") && e.typeAnnotation.type === "FunctionTypeAnnotation" && !e.static && !bt(e, e.typeAnnotation); - } - var De = R(["BinaryExpression", "LogicalExpression", "NGPipeExpression"]); - function At(e) { - return W(e) || e.type === "BindExpression" && !!e.object; - } - var Bo = R(["TSThisType", "NullLiteralTypeAnnotation", "BooleanLiteralTypeAnnotation", "StringLiteralTypeAnnotation", "BigIntLiteralTypeAnnotation", "NumberLiteralTypeAnnotation", "TSLiteralType", "TSTemplateLiteralType"]); - function Jt(e) { - return br(e) || Br(e) || Bo(e) || (e.type === "GenericTypeAnnotation" || e.type === "TSTypeReference") && !e.typeParameters && !e.typeArguments; - } - function bo(e) { - return e.type === "Identifier" && (e.name === "beforeEach" || e.name === "beforeAll" || e.name === "afterEach" || e.name === "afterAll"); - } - var Po = ["it", "it.only", "it.skip", "describe", "describe.only", "describe.skip", "test", "test.only", "test.skip", "test.step", "test.describe", "test.describe.only", "test.describe.parallel", "test.describe.parallel.only", "test.describe.serial", "test.describe.serial.only", "skip", "xit", "xdescribe", "xtest", "fit", "fdescribe", "ftest"]; - function ko(e) { - return uu(e, Po); - } - function kt(e, t2) { - if ((e == null ? void 0 : e.type) !== "CallExpression" || e.optional) return false; - let r = pe(e); - if (r.length === 1) { - if (On(e) && kt(t2)) return Mt(r[0]); - if (bo(e.callee)) return On(r[0]); - } else if ((r.length === 2 || r.length === 3) && (r[0].type === "TemplateLiteral" || te(r[0])) && ko(e.callee)) return r[2] && !Fe(r[2]) ? false : (r.length === 2 ? Mt(r[1]) : So(r[1]) && z(r[1]).length <= 1) || On(r[1]); - return false; - } - var mu = (e) => (t2) => ((t2 == null ? void 0 : t2.type) === "ChainExpression" && (t2 = t2.expression), e(t2)), L = mu(R(["CallExpression", "OptionalCallExpression"])), W = mu(R(["MemberExpression", "OptionalMemberExpression"])); - function Jn(e, t2 = 5) { - return yu(e, t2) <= t2; - } - function yu(e, t2) { - let r = 0; - for (let n in e) { - let s = e[n]; - if (s && typeof s == "object" && typeof s.type == "string" && (r++, r += yu(s, t2 - r)), r > t2) return r; - } - return r; - } - var Io = 0.25; - function sr(e, t2) { - let { printWidth: r } = t2; - if (T(e)) return false; - let n = r * Io; - if (e.type === "ThisExpression" || e.type === "Identifier" && e.name.length <= n || Mn(e) && !T(e.argument)) return true; - let s = e.type === "Literal" && "regex" in e && e.regex.pattern || e.type === "RegExpLiteral" && e.pattern; - return s ? s.length <= n : te(e) ? rt(fe(e), t2).length <= n : e.type === "TemplateLiteral" ? e.expressions.length === 0 && e.quasis[0].value.raw.length <= n && !e.quasis[0].value.raw.includes(` -`) : e.type === "UnaryExpression" ? sr(e.argument, { printWidth: r }) : e.type === "CallExpression" && e.arguments.length === 0 && e.callee.type === "Identifier" ? e.callee.name.length <= n - 2 : Ir(e); - } - function Le(e, t2) { - return X(t2) ? It(t2) : T(t2, h.Leading, (r) => Z(e, k(r))); - } - function iu(e) { - return e.quasis.some((t2) => t2.value.raw.includes(` -`)); - } - function wr(e, t2) { - return (e.type === "TemplateLiteral" && iu(e) || e.type === "TaggedTemplateExpression" && iu(e.quasi)) && !Z(t2, q(e), { backwards: true }); - } - function Or(e) { - if (!T(e)) return false; - let t2 = M(false, ct(e, h.Dangling), -1); - return t2 && !ee(t2); - } - function Du(e) { - if (e.length <= 1) return false; - let t2 = 0; - for (let r of e) if (Mt(r)) { - if (t2 += 1, t2 > 1) return true; - } else if (L(r)) { - for (let n of pe(r)) if (Mt(n)) return true; - } - return false; - } - function _r(e) { - let { node: t2, parent: r, key: n } = e; - return n === "callee" && L(t2) && L(r) && r.arguments.length > 0 && t2.arguments.length > r.arguments.length; - } - var Lo = /* @__PURE__ */ new Set(["!", "-", "+", "~"]); - function Ie(e, t2 = 2) { - var _a2; - if (t2 <= 0) return false; - if (e.type === "ChainExpression" || e.type === "TSNonNullExpression") return Ie(e.expression, t2); - let r = (n) => Ie(n, t2 - 1); - if (Rn(e)) return tt((_a2 = e.pattern) != null ? _a2 : e.regex.pattern) <= 5; - if (Ir(e) || go(e) || e.type === "ArgumentPlaceholder") return true; - if (e.type === "TemplateLiteral") return e.quasis.every((n) => !n.value.raw.includes(` -`)) && e.expressions.every(r); - if (se(e)) return e.properties.every((n) => !n.computed && (n.shorthand || n.value && r(n.value))); - if (Y(e)) return e.elements.every((n) => n === null || r(n)); - if (lt(e)) { - if (e.type === "ImportExpression" || Ie(e.callee, t2)) { - let n = pe(e); - return n.length <= t2 && n.every(r); - } - return false; - } - return W(e) ? Ie(e.object, t2) && Ie(e.property, t2) : e.type === "UnaryExpression" && Lo.has(e.operator) || e.type === "UpdateExpression" ? Ie(e.argument, t2) : false; - } - function fe(e) { - var _a2; - var t2; - return (_a2 = (t2 = e.extra) == null ? void 0 : t2.raw) != null ? _a2 : e.raw; - } - function fu(e) { - return e; - } - function oe(e, t2 = "es5") { - return e.trailingComma === "es5" && t2 === "es5" || e.trailingComma === "all" && (t2 === "all" || t2 === "es5"); - } - function ae(e, t2) { - switch (e.type) { - case "BinaryExpression": - case "LogicalExpression": - case "AssignmentExpression": - case "NGPipeExpression": - return ae(e.left, t2); - case "MemberExpression": - case "OptionalMemberExpression": - return ae(e.object, t2); - case "TaggedTemplateExpression": - return e.tag.type === "FunctionExpression" ? false : ae(e.tag, t2); - case "CallExpression": - case "OptionalCallExpression": - return e.callee.type === "FunctionExpression" ? false : ae(e.callee, t2); - case "ConditionalExpression": - return ae(e.test, t2); - case "UpdateExpression": - return !e.prefix && ae(e.argument, t2); - case "BindExpression": - return e.object && ae(e.object, t2); - case "SequenceExpression": - return ae(e.expressions[0], t2); - case "ChainExpression": - case "TSSatisfiesExpression": - case "TSAsExpression": - case "TSNonNullExpression": - case "AsExpression": - case "AsConstExpression": - case "SatisfiesExpression": - return ae(e.expression, t2); - default: - return t2(e); - } - } - var au = { "==": true, "!=": true, "===": true, "!==": true }, Pr = { "*": true, "/": true, "%": true }, jn = { ">>": true, ">>>": true, "<<": true }; - function ur(e, t2) { - return !(rr(t2) !== rr(e) || e === "**" || au[e] && au[t2] || t2 === "%" && Pr[e] || e === "%" && Pr[t2] || t2 !== e && Pr[t2] && Pr[e] || jn[e] && jn[t2]); - } - var wo = new Map([["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].flatMap((e, t2) => e.map((r) => [r, t2]))); - function rr(e) { - return wo.get(e); - } - function Eu(e) { - return !!jn[e] || e === "|" || e === "^" || e === "&"; - } - function Fu(e) { - var r; - if (e.rest) return true; - let t2 = z(e); - return ((r = M(false, t2, -1)) == null ? void 0 : r.type) === "RestElement"; - } - var _n = /* @__PURE__ */ new WeakMap(); - function z(e) { - if (_n.has(e)) return _n.get(e); - let t2 = []; - return e.this && t2.push(e.this), Array.isArray(e.parameters) ? t2.push(...e.parameters) : Array.isArray(e.params) && t2.push(...e.params), e.rest && t2.push(e.rest), _n.set(e, t2), t2; - } - function Cu(e, t2) { - let { node: r } = e, n = 0, s = (u) => t2(u, n++); - r.this && e.call(s, "this"), Array.isArray(r.parameters) ? e.each(s, "parameters") : Array.isArray(r.params) && e.each(s, "params"), r.rest && e.call(s, "rest"); - } - var vn = /* @__PURE__ */ new WeakMap(); - function pe(e) { - if (vn.has(e)) return vn.get(e); - if (e.type === "ChainExpression") return pe(e.expression); - let t2 = e.arguments; - return e.type === "ImportExpression" && (t2 = [e.source], e.options && t2.push(e.options)), vn.set(e, t2), t2; - } - function qt(e, t2) { - let { node: r } = e; - if (r.type === "ChainExpression") return e.call(() => qt(e, t2), "expression"); - r.type === "ImportExpression" ? (e.call((n) => t2(n, 0), "source"), r.options && e.call((n) => t2(n, 1), "options")) : e.each(t2, "arguments"); - } - function qn(e, t2) { - let r = []; - if (e.type === "ChainExpression" && (e = e.expression, r.push("expression")), e.type === "ImportExpression") { - if (t2 === 0 || t2 === (e.options ? -2 : -1)) return [...r, "source"]; - if (e.options && (t2 === 1 || t2 === -1)) return [...r, "options"]; - throw new RangeError("Invalid argument index"); + for (let i = 1; i < e.length; ++i) e[i] -= i; + let s = 0; + for (let i = 0; i < n.length; ++i) s = n[i].setOrigRanges(e, s); + return e.splice(0, e.length), true; + }, n.toString = () => n.join(`... +`), n; } - if (t2 < 0 && (t2 = e.arguments.length + t2), t2 < 0 || t2 >= e.arguments.length) throw new RangeError("Invalid argument index"); - return [...r, "arguments", t2]; - } - function ir(e) { - return e.value.trim() === "prettier-ignore" && !e.unignore; - } - function It(e) { - return (e == null ? void 0 : e.prettierIgnore) || T(e, h.PrettierIgnore); - } - var h = { Leading: 2, Trailing: 4, Dangling: 8, Block: 16, Line: 32, PrettierIgnore: 64, First: 128, Last: 256 }, Au = (e, t2) => { - if (typeof e == "function" && (t2 = e, e = 0), e || t2) return (r, n, s) => !(e & h.Leading && !r.leading || e & h.Trailing && !r.trailing || e & h.Dangling && (r.leading || r.trailing) || e & h.Block && !ee(r) || e & h.Line && !Ct(r) || e & h.First && n !== 0 || e & h.Last && n !== s.length - 1 || e & h.PrettierIgnore && !ir(r) || t2 && !t2(r)); - }; - function T(e, t2, r) { - if (!O(e == null ? void 0 : e.comments)) return false; - let n = Au(t2, r); - return n ? e.comments.some(n) : true; - } - function ct(e, t2, r) { - if (!Array.isArray(e == null ? void 0 : e.comments)) return []; - let n = Au(t2, r); - return n ? e.comments.filter(n) : e.comments; - } - var ce = (e, { originalText: t2 }) => vt(t2, k(e)); - function lt(e) { - return L(e) || e.type === "NewExpression" || e.type === "ImportExpression"; - } - function Ce(e) { - return e && (e.type === "ObjectProperty" || e.type === "Property" && !Pt(e)); - } - var Ae = R(["TSAsExpression", "TSSatisfiesExpression", "AsExpression", "AsConstExpression", "SatisfiesExpression"]), Xe = R(["UnionTypeAnnotation", "TSUnionType"]), vr = R(["IntersectionTypeAnnotation", "TSIntersectionType"]); - var Oo = /* @__PURE__ */ new Set(["range", "raw", "comments", "leadingComments", "trailingComments", "innerComments", "extra", "start", "end", "loc", "flags", "errors", "tokens"]), Wt = (e) => { - for (let t2 of e.quasis) delete t2.value; - }; - function Tu(e, t2, r) { - var s, u; - if (e.type === "Program" && delete t2.sourceType, (e.type === "BigIntLiteral" || e.type === "BigIntLiteralTypeAnnotation") && e.value && (t2.value = e.value.toLowerCase()), (e.type === "BigIntLiteral" || e.type === "Literal") && e.bigint && (t2.bigint = e.bigint.toLowerCase()), e.type === "EmptyStatement" || e.type === "JSXText" || e.type === "JSXExpressionContainer" && (e.expression.type === "Literal" || e.expression.type === "StringLiteral") && e.expression.value === " ") return null; - if ((e.type === "Property" || e.type === "ObjectProperty" || e.type === "MethodDefinition" || e.type === "ClassProperty" || e.type === "ClassMethod" || e.type === "PropertyDefinition" || e.type === "TSDeclareMethod" || e.type === "TSPropertySignature" || e.type === "ObjectTypeProperty" || e.type === "ImportAttribute") && e.key && !e.computed) { - let { key: i } = e; - te(i) || Fe(i) ? t2.key = String(i.value) : i.type === "Identifier" && (t2.key = i.name); + jr.parse = So; + }); + var De = ne((M) => { + "use strict"; + var p = ce(); + function wo(t2, e, n) { + return n ? `#${n.replace(/[\s\S]^/gm, `$&${e}#`)} +${e}${t2}` : t2; } - if (e.type === "JSXElement" && e.openingElement.name.name === "style" && e.openingElement.attributes.some((i) => i.type === "JSXAttribute" && i.name.name === "jsx")) for (let { type: i, expression: a2 } of t2.children) i === "JSXExpressionContainer" && a2.type === "TemplateLiteral" && Wt(a2); - e.type === "JSXAttribute" && e.name.name === "css" && e.value.type === "JSXExpressionContainer" && e.value.expression.type === "TemplateLiteral" && Wt(t2.value.expression), e.type === "JSXAttribute" && ((s = e.value) == null ? void 0 : s.type) === "Literal" && /["']|"|'/u.test(e.value.value) && (t2.value.value = N(false, e.value.value, /["']|"|'/gu, '"')); - let n = e.expression || e.callee; - if (e.type === "Decorator" && n.type === "CallExpression" && n.callee.name === "Component" && n.arguments.length === 1) { - let i = e.expression.arguments[0].properties; - for (let [a2, o] of t2.expression.arguments[0].properties.entries()) switch (i[a2].key.name) { - case "styles": - Y(o.value) && Wt(o.value.elements[0]); - break; - case "template": - o.value.type === "TemplateLiteral" && Wt(o.value); - break; - } + function Re(t2, e, n) { + return n ? n.indexOf(` +`) === -1 ? `${t2} #${n}` : `${t2} +` + n.replace(/^/gm, `${e || ""}#`) : t2; } - e.type === "TaggedTemplateExpression" && (e.tag.type === "MemberExpression" || e.tag.type === "Identifier" && (e.tag.name === "gql" || e.tag.name === "graphql" || e.tag.name === "css" || e.tag.name === "md" || e.tag.name === "markdown" || e.tag.name === "html") || e.tag.type === "CallExpression") && Wt(t2.quasi), e.type === "TemplateLiteral" && ((u = e.leadingComments) != null && u.some((a2) => ee(a2) && ["GraphQL", "HTML"].some((o) => a2.value === ` ${o} `)) || r.type === "CallExpression" && r.callee.name === "graphql" || !e.leadingComments) && Wt(t2), e.type === "ChainExpression" && e.expression.type === "TSNonNullExpression" && (t2.type = "TSNonNullExpression", t2.expression.type = "ChainExpression"), e.type === "TSMappedType" && (delete t2.key, delete t2.constraint), e.type === "TSEnumDeclaration" && delete t2.body; - } - Tu.ignoredProperties = Oo; - var du = Tu; - var Re = "string", he = "array", nt = "cursor", He = "indent", Ve = "align", $e = "trim", me = "group", we = "fill", Te = "if-break", Ke = "indent-if-break", Qe = "line-suffix", Je = "line-suffix-boundary", ie = "line", ge = "label", Oe = "break-parent", jr = /* @__PURE__ */ new Set([nt, He, Ve, $e, me, we, Te, Ke, Qe, Je, ie, ge, Oe]); - function _o(e) { - if (typeof e == "string") return Re; - if (Array.isArray(e)) return he; - if (!e) return; - let { type: t2 } = e; - if (jr.has(t2)) return t2; - } - var Se = _o; - var vo = (e) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(e); - function jo(e) { - let t2 = e === null ? "null" : typeof e; - if (t2 !== "string" && t2 !== "object") return `Unexpected doc '${t2}', -Expected it to be 'string' or 'object'.`; - if (Se(e)) throw new Error("doc is valid."); - let r = Object.prototype.toString.call(e); - if (r !== "[object Object]") return `Unexpected doc '${r}'.`; - let n = vo([...jr].map((s) => `'${s}'`)); - return `Unexpected doc.type '${e.type}'. -Expected it to be ${n}.`; - } - var Wn = class extends Error { - constructor(t2) { - super(jo(t2)); - __publicField(this, "name", "InvalidDocError"); - this.doc = t2; + var j = class { + }; + function fe(t2, e, n) { + if (Array.isArray(t2)) return t2.map((r, s) => fe(r, String(s), n)); + if (t2 && typeof t2.toJSON == "function") { + let r = n && n.anchors && n.anchors.get(t2); + r && (n.onCreate = (i) => { + r.res = i, delete n.onCreate; + }); + let s = t2.toJSON(e, n); + return r && n.onCreate && n.onCreate(s), s; + } + return (!n || !n.keep) && typeof t2 == "bigint" ? Number(t2) : t2; } - }, Tt = Wn; - var xu = {}; - function Mo(e, t2, r, n) { - let s = [e]; - for (; s.length > 0; ) { - let u = s.pop(); - if (u === xu) { - r(s.pop()); - continue; + var x = class extends j { + constructor(e) { + super(), this.value = e; } - r && s.push(u, xu); - let i = Se(u); - if (!i) throw new Tt(u); - if ((t2 == null ? void 0 : t2(u)) !== false) switch (i) { - case he: - case we: { - let a2 = i === he ? u : u.parts; - for (let o = a2.length, p = o - 1; p >= 0; --p) s.push(a2[p]); - break; + toJSON(e, n) { + return n && n.keep ? this.value : fe(this.value, e, n); + } + toString() { + return String(this.value); + } + }; + function Gr(t2, e, n) { + let r = n; + for (let s = e.length - 1; s >= 0; --s) { + let i = e[s]; + if (Number.isInteger(i) && i >= 0) { + let o = []; + o[i] = r, r = o; + } else { + let o = {}; + Object.defineProperty(o, i, { value: r, writable: true, enumerable: true, configurable: true }), r = o; } - case Te: - s.push(u.flatContents, u.breakContents); - break; - case me: - if (n && u.expandedStates) for (let a2 = u.expandedStates.length, o = a2 - 1; o >= 0; --o) s.push(u.expandedStates[o]); - else s.push(u.contents); - break; - case Ve: - case He: - case Ke: - case ge: - case Qe: - s.push(u.contents); - break; - case Re: - case nt: - case $e: - case Je: - case ie: - case Oe: - break; - default: - throw new Tt(u); } + return t2.createNode(r, false); } - } - var ar = Mo; - function mt(e, t2) { - if (typeof e == "string") return t2(e); - let r = /* @__PURE__ */ new Map(); - return n(e); - function n(u) { - if (r.has(u)) return r.get(u); - let i = s(u); - return r.set(u, i), i; - } - function s(u) { - switch (Se(u)) { - case he: - return t2(u.map(n)); - case we: - return t2({ ...u, parts: u.parts.map(n) }); - case Te: - return t2({ ...u, breakContents: n(u.breakContents), flatContents: n(u.flatContents) }); - case me: { - let { expandedStates: i, contents: a2 } = u; - return i ? (i = i.map(n), a2 = i[0]) : a2 = n(a2), t2({ ...u, contents: a2, expandedStates: i }); + var Xr = (t2) => t2 == null || typeof t2 == "object" && t2[Symbol.iterator]().next().done, Q = class t2 extends j { + constructor(e) { + super(), p._defineProperty(this, "items", []), this.schema = e; + } + addIn(e, n) { + if (Xr(e)) this.add(n); + else { + let [r, ...s] = e, i = this.get(r, true); + if (i instanceof t2) i.addIn(s, n); + else if (i === void 0 && this.schema) this.set(r, Gr(this.schema, s, n)); + else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`); } - case Ve: - case He: - case Ke: - case ge: - case Qe: - return t2({ ...u, contents: n(u.contents) }); - case Re: - case nt: - case $e: - case Je: - case ie: - case Oe: - return t2(u); - default: - throw new Tt(u); } - } - } - function gu(e, t2, r) { - let n = r, s = false; - function u(i) { - if (s) return false; - let a2 = t2(i); - a2 !== void 0 && (s = true, n = a2); - } - return ar(e, u), n; - } - function Ro(e) { - if (e.type === me && e.break || e.type === ie && e.hard || e.type === Oe) return true; - } - function re(e) { - return gu(e, Ro, false); - } - function hu(e) { - if (e.length > 0) { - let t2 = M(false, e, -1); - !t2.expandedStates && !t2.break && (t2.break = "propagated"); - } - return null; - } - function Su(e) { - let t2 = /* @__PURE__ */ new Set(), r = []; - function n(u) { - if (u.type === Oe && hu(r), u.type === me) { - if (r.push(u), t2.has(u)) return false; - t2.add(u); + deleteIn([e, ...n]) { + if (n.length === 0) return this.delete(e); + let r = this.get(e, true); + if (r instanceof t2) return r.deleteIn(n); + throw new Error(`Expected YAML collection at ${e}. Remaining path: ${n}`); } + getIn([e, ...n], r) { + let s = this.get(e, true); + return n.length === 0 ? !r && s instanceof x ? s.value : s : s instanceof t2 ? s.getIn(n, r) : void 0; + } + hasAllNullValues() { + return this.items.every((e) => { + if (!e || e.type !== "PAIR") return false; + let n = e.value; + return n == null || n instanceof x && n.value == null && !n.commentBefore && !n.comment && !n.tag; + }); + } + hasIn([e, ...n]) { + if (n.length === 0) return this.has(e); + let r = this.get(e, true); + return r instanceof t2 ? r.hasIn(n) : false; + } + setIn([e, ...n], r) { + if (n.length === 0) this.set(e, r); + else { + let s = this.get(e, true); + if (s instanceof t2) s.setIn(n, r); + else if (s === void 0 && this.schema) this.set(e, Gr(this.schema, n, r)); + else throw new Error(`Expected YAML collection at ${e}. Remaining path: ${n}`); + } + } + toJSON() { + return null; + } + toString(e, { blockItem: n, flowChars: r, isMap: s, itemIndent: i }, o, a2) { + let { indent: c, indentStep: l, stringify: f2 } = e, m = this.type === p.Type.FLOW_MAP || this.type === p.Type.FLOW_SEQ || e.inFlow; + m && (i += l); + let g = s && this.hasAllNullValues(); + e = Object.assign({}, e, { allNullValues: g, indent: i, inFlow: m, type: null }); + let y = false, h = false, d = this.items.reduce((P, A2, C) => { + let L; + A2 && (!y && A2.spaceBefore && P.push({ type: "comment", str: "" }), A2.commentBefore && A2.commentBefore.match(/^.*$/gm).forEach((Ci) => { + P.push({ type: "comment", str: `#${Ci}` }); + }), A2.comment && (L = A2.comment), m && (!y && A2.spaceBefore || A2.commentBefore || A2.comment || A2.key && (A2.key.commentBefore || A2.key.comment) || A2.value && (A2.value.commentBefore || A2.value.comment)) && (h = true)), y = false; + let R = f2(A2, e, () => L = null, () => y = true); + return m && !h && R.includes(` +`) && (h = true), m && C < this.items.length - 1 && (R += ","), R = Re(R, i, L), y && (L || m) && (y = false), P.push({ type: "item", str: R }), P; + }, []), w; + if (d.length === 0) w = r.start + r.end; + else if (m) { + let { start: P, end: A2 } = r, C = d.map((L) => L.str); + if (h || C.reduce((L, R) => L + R.length + 2, 2) > t2.maxFlowStringSingleLineLength) { + w = P; + for (let L of C) w += L ? ` +${l}${c}${L}` : ` +`; + w += ` +${c}${A2}`; + } else w = `${P} ${C.join(" ")} ${A2}`; + } else { + let P = d.map(n); + w = P.shift(); + for (let A2 of P) w += A2 ? ` +${c}${A2}` : ` +`; + } + return this.comment ? (w += ` +` + this.comment.replace(/^/gm, `${c}#`), o && o()) : y && a2 && a2(), w; + } + }; + p._defineProperty(Q, "maxFlowStringSingleLineLength", 60); + function xt(t2) { + let e = t2 instanceof x ? t2.value : t2; + return e && typeof e == "string" && (e = Number(e)), Number.isInteger(e) && e >= 0 ? e : null; } - function s(u) { - u.type === me && r.pop().break && hu(r); - } - ar(e, n, s, true); - } - function Jo(e) { - return e.type === ie && !e.hard ? e.soft ? "" : " " : e.type === Te ? e.flatContents : e; - } - function or(e) { - return mt(e, Jo); - } - function qo(e) { - switch (Se(e)) { - case we: - if (e.parts.every((t2) => t2 === "")) return ""; - break; - case me: - if (!e.contents && !e.id && !e.break && !e.expandedStates) return ""; - if (e.contents.type === me && e.contents.id === e.id && e.contents.break === e.break && e.contents.expandedStates === e.expandedStates) return e.contents; - break; - case Ve: - case He: - case Ke: - case Qe: - if (!e.contents) return ""; - break; - case Te: - if (!e.flatContents && !e.breakContents) return ""; - break; - case he: { - let t2 = []; - for (let r of e) { - if (!r) continue; - let [n, ...s] = Array.isArray(r) ? r : [r]; - typeof n == "string" && typeof M(false, t2, -1) == "string" ? t2[t2.length - 1] += n : t2.push(n), t2.push(...s); + var ue = class extends Q { + add(e) { + this.items.push(e); + } + delete(e) { + let n = xt(e); + return typeof n != "number" ? false : this.items.splice(n, 1).length > 0; + } + get(e, n) { + let r = xt(e); + if (typeof r != "number") return; + let s = this.items[r]; + return !n && s instanceof x ? s.value : s; + } + has(e) { + let n = xt(e); + return typeof n == "number" && n < this.items.length; + } + set(e, n) { + let r = xt(e); + if (typeof r != "number") throw new Error(`Expected a valid index, not ${e}.`); + this.items[r] = n; + } + toJSON(e, n) { + let r = []; + n && n.onCreate && n.onCreate(r); + let s = 0; + for (let i of this.items) r.push(fe(i, String(s++), n)); + return r; + } + toString(e, n, r) { + return e ? super.toString(e, { blockItem: (s) => s.type === "comment" ? s.str : `- ${s.str}`, flowChars: { start: "[", end: "]" }, isMap: false, itemIndent: (e.indent || "") + " " }, n, r) : JSON.stringify(this); + } + }, bo = (t2, e, n) => e === null ? "" : typeof e != "object" ? String(e) : t2 instanceof j && n && n.doc ? t2.toString({ anchors: /* @__PURE__ */ Object.create(null), doc: n.doc, indent: "", indentStep: n.indentStep, inFlow: true, inStringifyKey: true, stringify: n.stringify }) : JSON.stringify(e), T = class t2 extends j { + constructor(e, n = null) { + super(), this.key = e, this.value = n, this.type = t2.Type.PAIR; + } + get commentBefore() { + return this.key instanceof j ? this.key.commentBefore : void 0; + } + set commentBefore(e) { + if (this.key == null && (this.key = new x(null)), this.key instanceof j) this.key.commentBefore = e; + else { + let n = "Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node."; + throw new Error(n); } - return t2.length === 0 ? "" : t2.length === 1 ? t2[0] : t2; } - case Re: - case nt: - case $e: - case Je: - case ie: - case ge: - case Oe: - break; - default: - throw new Tt(e); + addToJSMap(e, n) { + let r = fe(this.key, "", e); + if (n instanceof Map) { + let s = fe(this.value, r, e); + n.set(r, s); + } else if (n instanceof Set) n.add(r); + else { + let s = bo(this.key, r, e), i = fe(this.value, s, e); + s in n ? Object.defineProperty(n, s, { value: i, writable: true, enumerable: true, configurable: true }) : n[s] = i; + } + return n; + } + toJSON(e, n) { + let r = n && n.mapAsMap ? /* @__PURE__ */ new Map() : {}; + return this.addToJSMap(n, r); + } + toString(e, n, r) { + if (!e || !e.doc) return JSON.stringify(this); + let { indent: s, indentSeq: i, simpleKeys: o } = e.doc.options, { key: a2, value: c } = this, l = a2 instanceof j && a2.comment; + if (o) { + if (l) throw new Error("With simple keys, key nodes cannot have comments"); + if (a2 instanceof Q) { + let R = "With simple keys, collection cannot be used as a key value"; + throw new Error(R); + } + } + let f2 = !o && (!a2 || l || (a2 instanceof j ? a2 instanceof Q || a2.type === p.Type.BLOCK_FOLDED || a2.type === p.Type.BLOCK_LITERAL : typeof a2 == "object")), { doc: m, indent: g, indentStep: y, stringify: h } = e; + e = Object.assign({}, e, { implicitKey: !f2, indent: g + y }); + let d = false, w = h(a2, e, () => l = null, () => d = true); + if (w = Re(w, e.indent, l), !f2 && w.length > 1024) { + if (o) throw new Error("With simple keys, single line scalar must not span more than 1024 characters"); + f2 = true; + } + if (e.allNullValues && !o) return this.comment ? (w = Re(w, e.indent, this.comment), n && n()) : d && !l && r && r(), e.inFlow && !f2 ? w : `? ${w}`; + w = f2 ? `? ${w} +${g}:` : `${w}:`, this.comment && (w = Re(w, e.indent, this.comment), n && n()); + let P = "", A2 = null; + if (c instanceof j) { + if (c.spaceBefore && (P = ` +`), c.commentBefore) { + let R = c.commentBefore.replace(/^/gm, `${e.indent}#`); + P += ` +${R}`; + } + A2 = c.comment; + } else c && typeof c == "object" && (c = m.schema.createNode(c, true)); + e.implicitKey = false, !f2 && !this.comment && c instanceof x && (e.indentAtStart = w.length + 1), d = false, !i && s >= 2 && !e.inFlow && !f2 && c instanceof ue && c.type !== p.Type.FLOW_SEQ && !c.tag && !m.anchors.getName(c) && (e.indent = e.indent.substr(2)); + let C = h(c, e, () => A2 = null, () => d = true), L = " "; + return P || this.comment ? L = `${P} +${e.indent}` : !f2 && c instanceof Q ? (!(C[0] === "[" || C[0] === "{") || C.includes(` +`)) && (L = ` +${e.indent}`) : C[0] === ` +` && (L = ""), d && !A2 && r && r(), Re(w + L + C, e.indent, A2); + } + }; + p._defineProperty(T, "Type", { PAIR: "PAIR", MERGE_PAIR: "MERGE_PAIR" }); + var Rt = (t2, e) => { + if (t2 instanceof we) { + let n = e.get(t2.source); + return n.count * n.aliasCount; + } else if (t2 instanceof Q) { + let n = 0; + for (let r of t2.items) { + let s = Rt(r, e); + s > n && (n = s); + } + return n; + } else if (t2 instanceof T) { + let n = Rt(t2.key, e), r = Rt(t2.value, e); + return Math.max(n, r); + } + return 1; + }, we = class t2 extends j { + static stringify({ range: e, source: n }, { anchors: r, doc: s, implicitKey: i, inStringifyKey: o }) { + let a2 = Object.keys(r).find((l) => r[l] === n); + if (!a2 && o && (a2 = s.anchors.getName(n) || s.anchors.newName()), a2) return `*${a2}${i ? " " : ""}`; + let c = s.anchors.getName(n) ? "Alias node must be after source node" : "Source node not found for alias node"; + throw new Error(`${c} [${e}]`); + } + constructor(e) { + super(), this.source = e, this.type = p.Type.ALIAS; + } + set tag(e) { + throw new Error("Alias nodes cannot have tags"); + } + toJSON(e, n) { + if (!n) return fe(this.source, e, n); + let { anchors: r, maxAliasCount: s } = n, i = r.get(this.source); + if (!i || i.res === void 0) { + let o = "This should not happen: Alias anchor was not resolved?"; + throw this.cstNode ? new p.YAMLReferenceError(this.cstNode, o) : new ReferenceError(o); + } + if (s >= 0 && (i.count += 1, i.aliasCount === 0 && (i.aliasCount = Rt(this.source, r)), i.count * i.aliasCount > s)) { + let o = "Excessive alias count indicates a resource exhaustion attack"; + throw this.cstNode ? new p.YAMLReferenceError(this.cstNode, o) : new ReferenceError(o); + } + return i.res; + } + toString(e) { + return t2.stringify(this, e); + } + }; + p._defineProperty(we, "default", true); + function at(t2, e) { + let n = e instanceof x ? e.value : e; + for (let r of t2) if (r instanceof T && (r.key === e || r.key === n || r.key && r.key.value === n)) return r; } - return e; - } - function Gt(e) { - return mt(e, (t2) => qo(t2)); - } - function _e(e, t2 = Mr) { - return mt(e, (r) => typeof r == "string" ? b(t2, r.split(` -`)) : r); - } - function Wo(e) { - if (e.type === ie) return true; - } - function Bu(e) { - return gu(e, Wo, false); - } - function pr(e, t2) { - return e.type === ge ? { ...e, contents: t2(e.contents) } : t2(e); - } - function bu(e) { - let t2 = true; - return ar(e, (r) => { - switch (Se(r)) { - case Re: - if (r === "") break; - case $e: - case Je: - case ie: - case Oe: - return t2 = false, false; + var ct = class extends Q { + add(e, n) { + e ? e instanceof T || (e = new T(e.key || e, e.value)) : e = new T(e); + let r = at(this.items, e.key), s = this.schema && this.schema.sortMapEntries; + if (r) if (n) r.value = e.value; + else throw new Error(`Key ${e.key} already set`); + else if (s) { + let i = this.items.findIndex((o) => s(e, o) < 0); + i === -1 ? this.items.push(e) : this.items.splice(i, 0, e); + } else this.items.push(e); } - }), t2; - } - var Gn = () => { - }, ze = Gn, Un = Gn, Pu = Gn; - function f2(e) { - return ze(e), { type: He, contents: e }; - } - function Be(e, t2) { - return ze(t2), { type: Ve, contents: t2, n: e }; - } - function l(e, t2 = {}) { - return ze(e), Un(t2.expandedStates, true), { type: me, id: t2.id, contents: e, break: !!t2.shouldBreak, expandedStates: t2.expandedStates }; - } - function ku(e) { - return Be(Number.NEGATIVE_INFINITY, e); - } - function Rr(e) { - return Be(-1, e); - } - function Ze(e, t2) { - return l(e[0], { ...t2, expandedStates: e }); - } - function Jr(e) { - return Pu(e), { type: we, parts: e }; - } - function B(e, t2 = "", r = {}) { - return ze(e), t2 !== "" && ze(t2), { type: Te, breakContents: e, flatContents: t2, groupId: r.groupId }; - } - function dt(e, t2) { - return ze(e), { type: Ke, contents: e, groupId: t2.groupId, negate: t2.negate }; - } - function Yn(e) { - return ze(e), { type: Qe, contents: e }; - } - var ve = { type: Je }, Ee = { type: Oe }; - var Nn = { type: ie, hard: true }, Go = { type: ie, hard: true, literal: true }, x = { type: ie }, E = { type: ie, soft: true }, F = [Nn, Ee], Mr = [Go, Ee], cr = { type: nt }; - function b(e, t2) { - ze(e), Un(t2); - let r = []; - for (let n = 0; n < t2.length; n++) n !== 0 && r.push(e), r.push(t2[n]); - return r; - } - function Iu(e, t2, r) { - ze(e); - let n = e; - if (t2 > 0) { - for (let s = 0; s < Math.floor(t2 / r); ++s) n = f2(n); - n = Be(t2 % r, n), n = Be(Number.NEGATIVE_INFINITY, n); + delete(e) { + let n = at(this.items, e); + return n ? this.items.splice(this.items.indexOf(n), 1).length > 0 : false; + } + get(e, n) { + let r = at(this.items, e), s = r && r.value; + return !n && s instanceof x ? s.value : s; + } + has(e) { + return !!at(this.items, e); + } + set(e, n) { + this.add(new T(e, n), true); + } + toJSON(e, n, r) { + let s = r ? new r() : n && n.mapAsMap ? /* @__PURE__ */ new Map() : {}; + n && n.onCreate && n.onCreate(s); + for (let i of this.items) i.addToJSMap(n, s); + return s; + } + toString(e, n, r) { + if (!e) return JSON.stringify(this); + for (let s of this.items) if (!(s instanceof T)) throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`); + return super.toString(e, { blockItem: (s) => s.str, flowChars: { start: "{", end: "}" }, isMap: true, itemIndent: e.indent || "" }, n, r); + } + }, zr = "<<", Yt = class extends T { + constructor(e) { + if (e instanceof T) { + let n = e.value; + n instanceof ue || (n = new ue(), n.items.push(e.value), n.range = e.value.range), super(e.key, n), this.range = e.range; + } else super(new x(zr), new ue()); + this.type = T.Type.MERGE_PAIR; + } + addToJSMap(e, n) { + for (let { source: r } of this.value.items) { + if (!(r instanceof ct)) throw new Error("Merge sources must be maps"); + let s = r.toJSON(null, e, Map); + for (let [i, o] of s) n instanceof Map ? n.has(i) || n.set(i, o) : n instanceof Set ? n.add(i) : Object.prototype.hasOwnProperty.call(n, i) || Object.defineProperty(n, i, { value: o, writable: true, enumerable: true, configurable: true }); + } + return n; + } + toString(e, n) { + let r = this.value; + if (r.items.length > 1) return super.toString(e, n); + this.value = r.items[0]; + let s = super.toString(e, n); + return this.value = r, s; + } + }, No = { defaultType: p.Type.BLOCK_LITERAL, lineWidth: 76 }, Oo = { trueStr: "true", falseStr: "false" }, Ao = { asBigInt: false }, Lo = { nullStr: "null" }, be = { defaultType: p.Type.PLAIN, doubleQuoted: { jsonEncoding: false, minMultiLineLength: 40 }, fold: { lineWidth: 80, minContentWidth: 20 } }; + function xn(t2, e, n) { + for (let { format: r, test: s, resolve: i } of e) if (s) { + let o = t2.match(s); + if (o) { + let a2 = i.apply(null, o); + return a2 instanceof x || (a2 = new x(a2)), r && (a2.format = r), a2; + } + } + return n && (t2 = n(t2)), new x(t2); } - return n; - } - function st(e, t2) { - return ze(t2), e ? { type: ge, label: e, contents: t2 } : t2; - } - function Uo(e) { - let t2 = `*${e.value}*`.split(` -`); - return t2.length > 1 && t2.every((r) => r.trimStart()[0] === "*"); - } - var Lu = Uo; - function wu(e, t2) { - let r = e.node; - if (Ct(r)) return t2.originalText.slice(q(r), k(r)).trimEnd(); - if (ee(r)) return Lu(r) ? Yo(r) : ["/*", _e(r.value), "*/"]; - throw new Error("Not a comment: " + JSON.stringify(r)); - } - function Yo(e) { - let t2 = e.value.split(` + var Zr = "flow", _n = "block", Dt = "quoted", Hr = (t2, e) => { + let n = t2[e + 1]; + for (; n === " " || n === " "; ) { + do + n = t2[e += 1]; + while (n && n !== ` `); - return ["/*", b(F, t2.map((r, n) => n === 0 ? r.trimEnd() : " " + (n < t2.length - 1 ? r.trim() : r.trimStart()))), "*/"]; - } - var zn = {}; - Tr(zn, { endOfLine: () => Qo, ownLine: () => Ko, remaining: () => zo }); - function No(e) { - let t2 = e.type || e.kind || "(unknown type)", r = String(e.name || e.id && (typeof e.id == "object" ? e.id.name : e.id) || e.key && (typeof e.key == "object" ? e.key.name : e.key) || e.value && (typeof e.value == "object" ? "" : String(e.value)) || e.operator || ""); - return r.length > 20 && (r = r.slice(0, 19) + "\u2026"), t2 + (r ? " " + r : ""); - } - function Xn(e, t2) { - var _a2; - ((_a2 = e.comments) != null ? _a2 : e.comments = []).push(t2), t2.printed = false, t2.nodeDescription = No(e); - } - function le(e, t2) { - t2.leading = true, t2.trailing = false, Xn(e, t2); - } - function je(e, t2, r) { - t2.leading = false, t2.trailing = false, r && (t2.marker = r), Xn(e, t2); - } - function V(e, t2) { - t2.leading = false, t2.trailing = true, Xn(e, t2); - } - function Xo(e, t2) { - let r = null, n = t2; - for (; n !== r; ) r = n, n = Ye(e, n), n = Ot(e, n), n = _t(e, n), n = Ne(e, n); - return n; - } - var ut = Xo; - function Ho(e, t2) { - let r = ut(e, t2); - return r === false ? "" : e.charAt(r); - } - var be = Ho; - function Vo(e, t2, r) { - for (let n = t2; n < r; ++n) if (e.charAt(n) === ` -`) return true; - return false; - } - var de = Vo; - function $o(e) { - return ee(e) && e.value[0] === "*" && /@(?:type|satisfies)\b/u.test(e.value); - } - var qr = $o; - function Ko(e) { - return [qu, _u, Mu, pp, ep, Vn, $n, Ou, vu, yp, lp, Qn, Ju, Dp, ju, Ru, Kn, tp, xp].some((t2) => t2(e)); - } - function Qo(e) { - return [Zo, Mu, _u, Ju, Vn, $n, Ou, vu, Ru, cp, mp, Qn, Fp, Kn, Tp, dp, hp].some((t2) => t2(e)); - } - function zo(e) { - return [qu, Vn, $n, rp, op, ju, Qn, ap, ip, Ap, Kn, Cp].some((t2) => t2(e)); - } - function Lt(e, t2) { - let r = (e.body || e.properties).find(({ type: n }) => n !== "EmptyStatement"); - r ? le(r, t2) : je(e, t2); - } - function Hn(e, t2) { - e.type === "BlockStatement" ? Lt(e, t2) : le(e, t2); - } - function Zo({ comment: e, followingNode: t2 }) { - return t2 && qr(e) ? (le(t2, e), true) : false; - } - function Vn({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n, text: s }) { - if ((r == null ? void 0 : r.type) !== "IfStatement" || !n) return false; - if (be(s, k(e)) === ")") return V(t2, e), true; - if (t2 === r.consequent && n === r.alternate) { - let i = ut(s, k(r.consequent)); - if (q(e) < i || r.alternate.type === "BlockStatement") { - if (t2.type === "BlockStatement") V(t2, e); + n = t2[e + 1]; + } + return e; + }; + function Bt(t2, e, n, { indentAtStart: r, lineWidth: s = 80, minContentWidth: i = 20, onFold: o, onOverflow: a2 }) { + if (!s || s < 0) return t2; + let c = Math.max(1 + i, 1 + s - e.length); + if (t2.length <= c) return t2; + let l = [], f2 = {}, m = s - e.length; + typeof r == "number" && (r > s - Math.max(2, i) ? l.push(0) : m = s - r); + let g, y, h = false, d = -1, w = -1, P = -1; + n === _n && (d = Hr(t2, d), d !== -1 && (m = d + c)); + for (let C; C = t2[d += 1]; ) { + if (n === Dt && C === "\\") { + switch (w = d, t2[d + 1]) { + case "x": + d += 3; + break; + case "u": + d += 5; + break; + case "U": + d += 9; + break; + default: + d += 1; + } + P = d; + } + if (C === ` +`) n === _n && (d = Hr(t2, d)), m = d + c, g = void 0; else { - let a2 = Ct(e) || e.loc.start.line === e.loc.end.line, o = e.loc.start.line === t2.loc.start.line; - a2 && o ? V(t2, e) : je(r, e); + if (C === " " && y && y !== " " && y !== ` +` && y !== " ") { + let L = t2[d + 1]; + L && L !== " " && L !== ` +` && L !== " " && (g = d); + } + if (d >= m) if (g) l.push(g), m = g + c, g = void 0; + else if (n === Dt) { + for (; y === " " || y === " "; ) y = C, C = t2[d += 1], h = true; + let L = d > P + 1 ? d - 2 : w - 1; + if (f2[L]) return t2; + l.push(L), f2[L] = true, m = L + c, g = void 0; + } else h = true; } - return true; + y = C; + } + if (h && a2 && a2(), l.length === 0) return t2; + o && o(); + let A2 = t2.slice(0, l[0]); + for (let C = 0; C < l.length; ++C) { + let L = l[C], R = l[C + 1] || t2.length; + L === 0 ? A2 = ` +${e}${t2.slice(0, R)}` : (n === Dt && f2[L] && (A2 += `${t2[L]}\\`), A2 += ` +${e}${t2.slice(L + 1, R)}`); } + return A2; } - return n.type === "BlockStatement" ? (Lt(n, e), true) : n.type === "IfStatement" ? (Hn(n.consequent, e), true) : r.consequent === n ? (le(n, e), true) : false; - } - function $n({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n, text: s }) { - return (r == null ? void 0 : r.type) !== "WhileStatement" || !n ? false : be(s, k(e)) === ")" ? (V(t2, e), true) : n.type === "BlockStatement" ? (Lt(n, e), true) : r.body === n ? (le(n, e), true) : false; - } - function Ou({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n }) { - return (r == null ? void 0 : r.type) !== "TryStatement" && (r == null ? void 0 : r.type) !== "CatchClause" || !n ? false : r.type === "CatchClause" && t2 ? (V(t2, e), true) : n.type === "BlockStatement" ? (Lt(n, e), true) : n.type === "TryStatement" ? (Hn(n.finalizer, e), true) : n.type === "CatchClause" ? (Hn(n.body, e), true) : false; - } - function ep({ comment: e, enclosingNode: t2, followingNode: r }) { - return W(t2) && (r == null ? void 0 : r.type) === "Identifier" ? (le(t2, e), true) : false; - } - function tp({ comment: e, enclosingNode: t2, followingNode: r, options: n }) { - return !n.experimentalTernaries || !((t2 == null ? void 0 : t2.type) === "ConditionalExpression" || (t2 == null ? void 0 : t2.type) === "ConditionalTypeAnnotation" || (t2 == null ? void 0 : t2.type) === "TSConditionalType") ? false : (r == null ? void 0 : r.type) === "ConditionalExpression" || (r == null ? void 0 : r.type) === "ConditionalTypeAnnotation" || (r == null ? void 0 : r.type) === "TSConditionalType" ? (je(t2, e), true) : false; - } - function _u({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n, text: s, options: u }) { - let i = t2 && !de(s, k(t2), q(e)); - return (!t2 || !i) && ((r == null ? void 0 : r.type) === "ConditionalExpression" || (r == null ? void 0 : r.type) === "ConditionalTypeAnnotation" || (r == null ? void 0 : r.type) === "TSConditionalType") && n ? u.experimentalTernaries && r.alternate === n && !(ee(e) && !de(u.originalText, q(e), k(e))) ? (je(r, e), true) : (le(n, e), true) : false; - } - function rp({ comment: e, precedingNode: t2, enclosingNode: r }) { - return Ce(r) && r.shorthand && r.key === t2 && r.value.type === "AssignmentPattern" ? (V(r.value.left, e), true) : false; - } - var np = /* @__PURE__ */ new Set(["ClassDeclaration", "ClassExpression", "DeclareClass", "DeclareInterface", "InterfaceDeclaration", "TSInterfaceDeclaration"]); - function vu({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n }) { - if (np.has(r == null ? void 0 : r.type)) { - if (O(r.decorators) && (n == null ? void 0 : n.type) !== "Decorator") return V(M(false, r.decorators, -1), e), true; - if (r.body && n === r.body) return Lt(r.body, e), true; - if (n) { - if (r.superClass && n === r.superClass && t2 && (t2 === r.id || t2 === r.typeParameters)) return V(t2, e), true; - for (let s of ["implements", "extends", "mixins"]) if (r[s] && n === r[s][0]) return t2 && (t2 === r.id || t2 === r.typeParameters || t2 === r.superClass) ? V(t2, e) : je(r, e, s), true; + var Rn = ({ indentAtStart: t2 }) => t2 ? Object.assign({ indentAtStart: t2 }, be.fold) : be.fold, Ft = (t2) => /^(%|---|\.\.\.)/m.test(t2); + function To(t2, e, n) { + if (!e || e < 0) return false; + let r = e - n, s = t2.length; + if (s <= r) return false; + for (let i = 0, o = 0; i < s; ++i) if (t2[i] === ` +`) { + if (i - o > r) return true; + if (o = i + 1, s - o <= r) return false; + } + return true; + } + function Se(t2, e) { + let { implicitKey: n } = e, { jsonEncoding: r, minMultiLineLength: s } = be.doubleQuoted, i = JSON.stringify(t2); + if (r) return i; + let o = e.indent || (Ft(t2) ? " " : ""), a2 = "", c = 0; + for (let l = 0, f2 = i[l]; f2; f2 = i[++l]) if (f2 === " " && i[l + 1] === "\\" && i[l + 2] === "n" && (a2 += i.slice(c, l) + "\\ ", l += 1, c = l, f2 = "\\"), f2 === "\\") switch (i[l + 1]) { + case "u": + { + a2 += i.slice(c, l); + let m = i.substr(l + 2, 4); + switch (m) { + case "0000": + a2 += "\\0"; + break; + case "0007": + a2 += "\\a"; + break; + case "000b": + a2 += "\\v"; + break; + case "001b": + a2 += "\\e"; + break; + case "0085": + a2 += "\\N"; + break; + case "00a0": + a2 += "\\_"; + break; + case "2028": + a2 += "\\L"; + break; + case "2029": + a2 += "\\P"; + break; + default: + m.substr(0, 2) === "00" ? a2 += "\\x" + m.substr(2) : a2 += i.substr(l, 6); + } + l += 5, c = l + 1; + } + break; + case "n": + if (n || i[l + 2] === '"' || i.length < s) l += 1; + else { + for (a2 += i.slice(c, l) + ` + +`; i[l + 2] === "\\" && i[l + 3] === "n" && i[l + 4] !== '"'; ) a2 += ` +`, l += 2; + a2 += o, i[l + 2] === " " && (a2 += "\\"), l += 1, c = l + 1; + } + break; + default: + l += 1; } + return a2 = c ? a2 + i.slice(c) : i, n ? a2 : Bt(a2, o, Dt, Rn(e)); } - return false; - } - var sp = /* @__PURE__ */ new Set(["ClassMethod", "ClassProperty", "PropertyDefinition", "TSAbstractPropertyDefinition", "TSAbstractMethodDefinition", "TSDeclareMethod", "MethodDefinition", "ClassAccessorProperty", "AccessorProperty", "TSAbstractAccessorProperty", "TSParameterProperty"]); - function ju({ comment: e, precedingNode: t2, enclosingNode: r, text: n }) { - return r && t2 && be(n, k(e)) === "(" && (r.type === "Property" || r.type === "TSDeclareMethod" || r.type === "TSAbstractMethodDefinition") && t2.type === "Identifier" && r.key === t2 && be(n, k(t2)) !== ":" ? (V(t2, e), true) : (t2 == null ? void 0 : t2.type) === "Decorator" && sp.has(r == null ? void 0 : r.type) && (Ct(e) || e.placement === "ownLine") ? (V(t2, e), true) : false; - } - var up = /* @__PURE__ */ new Set(["FunctionDeclaration", "FunctionExpression", "ClassMethod", "MethodDefinition", "ObjectMethod"]); - function ip({ comment: e, precedingNode: t2, enclosingNode: r, text: n }) { - return be(n, k(e)) !== "(" ? false : t2 && up.has(r == null ? void 0 : r.type) ? (V(t2, e), true) : false; - } - function ap({ comment: e, enclosingNode: t2, text: r }) { - if ((t2 == null ? void 0 : t2.type) !== "ArrowFunctionExpression") return false; - let n = ut(r, k(e)); - return n !== false && r.slice(n, n + 2) === "=>" ? (je(t2, e), true) : false; - } - function op({ comment: e, enclosingNode: t2, text: r }) { - return be(r, k(e)) !== ")" ? false : t2 && (Wu(t2) && z(t2).length === 0 || lt(t2) && pe(t2).length === 0) ? (je(t2, e), true) : ((t2 == null ? void 0 : t2.type) === "MethodDefinition" || (t2 == null ? void 0 : t2.type) === "TSAbstractMethodDefinition") && z(t2.value).length === 0 ? (je(t2.value, e), true) : false; - } - function pp({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n, text: s }) { - return (t2 == null ? void 0 : t2.type) === "ComponentTypeParameter" && ((r == null ? void 0 : r.type) === "DeclareComponent" || (r == null ? void 0 : r.type) === "ComponentTypeAnnotation") && (n == null ? void 0 : n.type) !== "ComponentTypeParameter" ? (V(t2, e), true) : ((t2 == null ? void 0 : t2.type) === "ComponentParameter" || (t2 == null ? void 0 : t2.type) === "RestElement") && (r == null ? void 0 : r.type) === "ComponentDeclaration" && be(s, k(e)) === ")" ? (V(t2, e), true) : false; - } - function Mu({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n, text: s }) { - return (t2 == null ? void 0 : t2.type) === "FunctionTypeParam" && (r == null ? void 0 : r.type) === "FunctionTypeAnnotation" && (n == null ? void 0 : n.type) !== "FunctionTypeParam" ? (V(t2, e), true) : ((t2 == null ? void 0 : t2.type) === "Identifier" || (t2 == null ? void 0 : t2.type) === "AssignmentPattern" || (t2 == null ? void 0 : t2.type) === "ObjectPattern" || (t2 == null ? void 0 : t2.type) === "ArrayPattern" || (t2 == null ? void 0 : t2.type) === "RestElement" || (t2 == null ? void 0 : t2.type) === "TSParameterProperty") && Wu(r) && be(s, k(e)) === ")" ? (V(t2, e), true) : !ee(e) && ((r == null ? void 0 : r.type) === "FunctionDeclaration" || (r == null ? void 0 : r.type) === "FunctionExpression" || (r == null ? void 0 : r.type) === "ObjectMethod") && (n == null ? void 0 : n.type) === "BlockStatement" && r.body === n && ut(s, k(e)) === q(n) ? (Lt(n, e), true) : false; - } - function Ru({ comment: e, enclosingNode: t2 }) { - return (t2 == null ? void 0 : t2.type) === "LabeledStatement" ? (le(t2, e), true) : false; - } - function Kn({ comment: e, enclosingNode: t2 }) { - return ((t2 == null ? void 0 : t2.type) === "ContinueStatement" || (t2 == null ? void 0 : t2.type) === "BreakStatement") && !t2.label ? (V(t2, e), true) : false; - } - function cp({ comment: e, precedingNode: t2, enclosingNode: r }) { - return L(r) && t2 && r.callee === t2 && r.arguments.length > 0 ? (le(r.arguments[0], e), true) : false; - } - function lp({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n }) { - return Xe(r) ? (ir(e) && (n.prettierIgnore = true, e.unignore = true), t2 ? (V(t2, e), true) : false) : (Xe(n) && ir(e) && (n.types[0].prettierIgnore = true, e.unignore = true), false); - } - function mp({ comment: e, enclosingNode: t2 }) { - return Ce(t2) ? (le(t2, e), true) : false; - } - function Qn({ comment: e, enclosingNode: t2, ast: r, isLastComment: n }) { - var s; - return ((s = r == null ? void 0 : r.body) == null ? void 0 : s.length) === 0 ? (n ? je(r, e) : le(r, e), true) : (t2 == null ? void 0 : t2.type) === "Program" && t2.body.length === 0 && !O(t2.directives) ? (n ? je(t2, e) : le(t2, e), true) : false; - } - function yp({ comment: e, enclosingNode: t2 }) { - return (t2 == null ? void 0 : t2.type) === "ForInStatement" || (t2 == null ? void 0 : t2.type) === "ForOfStatement" ? (le(t2, e), true) : false; - } - function Ju({ comment: e, precedingNode: t2, enclosingNode: r, text: n }) { - if ((r == null ? void 0 : r.type) === "ImportSpecifier" || (r == null ? void 0 : r.type) === "ExportSpecifier") return le(r, e), true; - let s = (t2 == null ? void 0 : t2.type) === "ImportSpecifier" && (r == null ? void 0 : r.type) === "ImportDeclaration", u = (t2 == null ? void 0 : t2.type) === "ExportSpecifier" && (r == null ? void 0 : r.type) === "ExportNamedDeclaration"; - return (s || u) && Z(n, k(e)) ? (V(t2, e), true) : false; - } - function Dp({ comment: e, enclosingNode: t2 }) { - return (t2 == null ? void 0 : t2.type) === "AssignmentPattern" ? (le(t2, e), true) : false; - } - var fp = /* @__PURE__ */ new Set(["VariableDeclarator", "AssignmentExpression", "TypeAlias", "TSTypeAliasDeclaration"]), Ep = /* @__PURE__ */ new Set(["ObjectExpression", "RecordExpression", "ArrayExpression", "TupleExpression", "TemplateLiteral", "TaggedTemplateExpression", "ObjectTypeAnnotation", "TSTypeLiteral"]); - function Fp({ comment: e, enclosingNode: t2, followingNode: r }) { - return fp.has(t2 == null ? void 0 : t2.type) && r && (Ep.has(r.type) || ee(e)) ? (le(r, e), true) : false; - } - function Cp({ comment: e, enclosingNode: t2, followingNode: r, text: n }) { - return !r && ((t2 == null ? void 0 : t2.type) === "TSMethodSignature" || (t2 == null ? void 0 : t2.type) === "TSDeclareFunction" || (t2 == null ? void 0 : t2.type) === "TSAbstractMethodDefinition") && be(n, k(e)) === ";" ? (V(t2, e), true) : false; - } - function qu({ comment: e, enclosingNode: t2, followingNode: r }) { - if (ir(e) && (t2 == null ? void 0 : t2.type) === "TSMappedType" && (r == null ? void 0 : r.type) === "TSTypeParameter" && r.constraint) return t2.prettierIgnore = true, e.unignore = true, true; - } - function Ap({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n }) { - return (r == null ? void 0 : r.type) !== "TSMappedType" ? false : (n == null ? void 0 : n.type) === "TSTypeParameter" && n.name ? (le(n.name, e), true) : (t2 == null ? void 0 : t2.type) === "TSTypeParameter" && t2.constraint ? (V(t2.constraint, e), true) : false; - } - function Tp({ comment: e, enclosingNode: t2, followingNode: r }) { - return !t2 || t2.type !== "SwitchCase" || t2.test || !r || r !== t2.consequent[0] ? false : (r.type === "BlockStatement" && Ct(e) ? Lt(r, e) : je(t2, e), true); - } - function dp({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n }) { - return Xe(t2) && ((r.type === "TSArrayType" || r.type === "ArrayTypeAnnotation") && !n || vr(r)) ? (V(M(false, t2.types, -1), e), true) : false; - } - function xp({ comment: e, enclosingNode: t2, precedingNode: r, followingNode: n }) { - if (((t2 == null ? void 0 : t2.type) === "ObjectPattern" || (t2 == null ? void 0 : t2.type) === "ArrayPattern") && (n == null ? void 0 : n.type) === "TSTypeAnnotation") return r ? V(r, e) : je(t2, e), true; - } - function hp({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n }) { - var s; - if (!n && (r == null ? void 0 : r.type) === "UnaryExpression" && ((t2 == null ? void 0 : t2.type) === "LogicalExpression" || (t2 == null ? void 0 : t2.type) === "BinaryExpression")) { - let u = ((s = r.argument.loc) == null ? void 0 : s.start.line) !== t2.right.loc.start.line, i = Ct(e) || e.loc.start.line === e.loc.end.line, a2 = e.loc.start.line === t2.right.loc.start.line; - if (u && i && a2) return V(t2.right, e), true; + function es(t2, e) { + if (e.implicitKey) { + if (/\n/.test(t2)) return Se(t2, e); + } else if (/[ \t]\n|\n[ \t]/.test(t2)) return Se(t2, e); + let n = e.indent || (Ft(t2) ? " " : ""), r = "'" + t2.replace(/'/g, "''").replace(/\n+/g, `$& +${n}`) + "'"; + return e.implicitKey ? r : Bt(r, n, Zr, Rn(e)); } - return false; - } - var Wu = R(["ArrowFunctionExpression", "FunctionExpression", "FunctionDeclaration", "ObjectMethod", "ClassMethod", "TSDeclareFunction", "TSCallSignatureDeclaration", "TSConstructSignatureDeclaration", "TSMethodSignature", "TSConstructorType", "TSFunctionType", "TSDeclareMethod"]); - var gp = /* @__PURE__ */ new Set(["EmptyStatement", "TemplateElement", "TSEmptyBodyFunctionExpression", "ChainExpression"]); - function Sp(e) { - return !gp.has(e.type); - } - function Bp(e, t2) { - var r; - if ((t2.parser === "typescript" || t2.parser === "flow" || t2.parser === "acorn" || t2.parser === "espree" || t2.parser === "meriyah" || t2.parser === "__babel_estree") && e.type === "MethodDefinition" && ((r = e.value) == null ? void 0 : r.type) === "FunctionExpression" && z(e.value).length === 0 && !e.value.returnType && !O(e.value.typeParameters) && e.value.body) return [...e.decorators || [], e.key, e.value.body]; - } - function Zn(e) { - let { node: t2, parent: r } = e; - return (X(t2) || r && (r.type === "JSXSpreadAttribute" || r.type === "JSXSpreadChild" || Xe(r) || (r.type === "ClassDeclaration" || r.type === "ClassExpression") && r.superClass === t2)) && (!It(t2) || Xe(r)); - } - function bp(e, { parser: t2 }) { - if (t2 === "flow" || t2 === "babel-flow") return e = N(false, e, /[\s(]/gu, ""), e === "" || e === "/*" || e === "/*::"; - } - function Gu(e) { - switch (e) { - case "cr": - return "\r"; - case "crlf": - return `\r -`; - default: - return ` + function $t({ comment: t2, type: e, value: n }, r, s, i) { + if (/\n[\t ]+$/.test(n) || /^\s*$/.test(n)) return Se(n, r); + let o = r.indent || (r.forceBlockIndent || Ft(n) ? " " : ""), a2 = o ? "2" : "1", c = e === p.Type.BLOCK_FOLDED ? false : e === p.Type.BLOCK_LITERAL ? true : !To(n, be.fold.lineWidth, o.length), l = c ? "|" : ">"; + if (!n) return l + ` `; + let f2 = "", m = ""; + if (n = n.replace(/[\n\t ]*$/, (y) => { + let h = y.indexOf(` +`); + return h === -1 ? l += "-" : (n === y || h !== y.length - 1) && (l += "+", i && i()), m = y.replace(/\n$/, ""), ""; + }).replace(/^[\n ]*/, (y) => { + y.indexOf(" ") !== -1 && (l += a2); + let h = y.match(/ +$/); + return h ? (f2 = y.slice(0, -h[0].length), h[0]) : (f2 = y, ""); + }), m && (m = m.replace(/\n+(?!\n|$)/g, `$&${o}`)), f2 && (f2 = f2.replace(/\n+/g, `$&${o}`)), t2 && (l += " #" + t2.replace(/ ?[\r\n]+/g, " "), s && s()), !n) return `${l}${a2} +${o}${m}`; + if (c) return n = n.replace(/\n+/g, `$&${o}`), `${l} +${o}${f2}${n}${m}`; + n = n.replace(/\n+/g, ` +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${o}`); + let g = Bt(`${f2}${n}${m}`, o, _n, be.fold); + return `${l} +${o}${g}`; } - } - var Pe = /* @__PURE__ */ Symbol("MODE_BREAK"), it = /* @__PURE__ */ Symbol("MODE_FLAT"), Ut = /* @__PURE__ */ Symbol("cursor"), es = /* @__PURE__ */ Symbol("DOC_FILL_PRINTED_LENGTH"); - function Uu() { - return { value: "", length: 0, queue: [] }; - } - function Pp(e, t2) { - return ts(e, { type: "indent" }, t2); - } - function kp(e, t2, r) { - return t2 === Number.NEGATIVE_INFINITY ? e.root || Uu() : t2 < 0 ? ts(e, { type: "dedent" }, r) : t2 ? t2.type === "root" ? { ...e, root: e } : ts(e, { type: typeof t2 == "string" ? "stringAlign" : "numberAlign", n: t2 }, r) : e; - } - function ts(e, t2, r) { - let n = t2.type === "dedent" ? e.queue.slice(0, -1) : [...e.queue, t2], s = "", u = 0, i = 0, a2 = 0; - for (let c of n) switch (c.type) { - case "indent": - y(), r.useTabs ? o(1) : p(r.tabWidth); - break; - case "stringAlign": - y(), s += c.n, u += c.n.length; - break; - case "numberAlign": - i += 1, a2 += c.n; - break; - default: - throw new Error(`Unexpected type '${c.type}'`); + function Co(t2, e, n, r) { + let { comment: s, type: i, value: o } = t2, { actualString: a2, implicitKey: c, indent: l, inFlow: f2 } = e; + if (c && /[\n[\]{},]/.test(o) || f2 && /[[\]{},]/.test(o)) return Se(o, e); + if (!o || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o)) return c || f2 || o.indexOf(` +`) === -1 ? o.indexOf('"') !== -1 && o.indexOf("'") === -1 ? es(o, e) : Se(o, e) : $t(t2, e, n, r); + if (!c && !f2 && i !== p.Type.PLAIN && o.indexOf(` +`) !== -1) return $t(t2, e, n, r); + if (l === "" && Ft(o)) return e.forceBlockIndent = true, $t(t2, e, n, r); + let m = o.replace(/\n+/g, `$& +${l}`); + if (a2) { + let { tags: y } = e.doc.schema; + if (typeof xn(m, y, y.scalarFallback).value != "string") return Se(o, e); + } + let g = c ? m : Bt(m, l, Zr, Rn(e)); + return s && !f2 && (g.indexOf(` +`) !== -1 || s.indexOf(` +`) !== -1) ? (n && n(), wo(g, l, s)) : g; } - return m(), { ...e, value: s, length: u, queue: n }; - function o(c) { - s += " ".repeat(c), u += r.tabWidth * c; + function Mo(t2, e, n, r) { + let { defaultType: s } = be, { implicitKey: i, inFlow: o } = e, { type: a2, value: c } = t2; + typeof c != "string" && (c = String(c), t2 = Object.assign({}, t2, { value: c })); + let l = (m) => { + switch (m) { + case p.Type.BLOCK_FOLDED: + case p.Type.BLOCK_LITERAL: + return $t(t2, e, n, r); + case p.Type.QUOTE_DOUBLE: + return Se(c, e); + case p.Type.QUOTE_SINGLE: + return es(c, e); + case p.Type.PLAIN: + return Co(t2, e, n, r); + default: + return null; + } + }; + (a2 !== p.Type.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(c) || (i || o) && (a2 === p.Type.BLOCK_FOLDED || a2 === p.Type.BLOCK_LITERAL)) && (a2 = p.Type.QUOTE_DOUBLE); + let f2 = l(a2); + if (f2 === null && (f2 = l(s), f2 === null)) throw new Error(`Unsupported default string type ${s}`); + return f2; } - function p(c) { - s += " ".repeat(c), u += c; + function ko({ format: t2, minFractionDigits: e, tag: n, value: r }) { + if (typeof r == "bigint") return String(r); + if (!isFinite(r)) return isNaN(r) ? ".nan" : r < 0 ? "-.inf" : ".inf"; + let s = JSON.stringify(r); + if (!t2 && e && (!n || n === "tag:yaml.org,2002:float") && /^\d/.test(s)) { + let i = s.indexOf("."); + i < 0 && (i = s.length, s += "."); + let o = e - (s.length - i - 1); + for (; o-- > 0; ) s += "0"; + } + return s; } - function y() { - r.useTabs ? D() : m(); + function ts(t2, e) { + let n, r; + switch (e.type) { + case p.Type.FLOW_MAP: + n = "}", r = "flow map"; + break; + case p.Type.FLOW_SEQ: + n = "]", r = "flow sequence"; + break; + default: + t2.push(new p.YAMLSemanticError(e, "Not a flow collection!?")); + return; + } + let s; + for (let i = e.items.length - 1; i >= 0; --i) { + let o = e.items[i]; + if (!o || o.type !== p.Type.COMMENT) { + s = o; + break; + } + } + if (s && s.char !== n) { + let i = `Expected ${r} to end with ${n}`, o; + typeof s.offset == "number" ? (o = new p.YAMLSemanticError(e, i), o.offset = s.offset + 1) : (o = new p.YAMLSemanticError(s, i), s.range && s.range.end && (o.offset = s.range.end - s.range.start)), t2.push(o); + } } - function D() { - i > 0 && o(i), C(); + function ns(t2, e) { + let n = e.context.src[e.range.start - 1]; + if (n !== ` +` && n !== " " && n !== " ") { + let r = "Comments must be separated from other tokens by white space characters"; + t2.push(new p.YAMLSemanticError(e, r)); + } } - function m() { - a2 > 0 && p(a2), C(); + function rs(t2, e) { + let n = String(e), r = n.substr(0, 8) + "..." + n.substr(-8); + return new p.YAMLSemanticError(t2, `The "${r}" key is too long`); } - function C() { - i = 0, a2 = 0; + function ss(t2, e) { + for (let { afterKey: n, before: r, comment: s } of e) { + let i = t2.items[r]; + i ? (n && i.value && (i = i.value), s === void 0 ? (n || !i.commentBefore) && (i.spaceBefore = true) : i.commentBefore ? i.commentBefore += ` +` + s : i.commentBefore = s) : s !== void 0 && (t2.comment ? t2.comment += ` +` + s : t2.comment = s); + } } - } - function rs(e) { - let t2 = 0, r = 0, n = e.length; - e: for (; n--; ) { - let s = e[n]; - if (s === Ut) { - r++; - continue; + function Dn(t2, e) { + let n = e.strValue; + return n ? typeof n == "string" ? n : (n.errors.forEach((r) => { + r.source || (r.source = e), t2.errors.push(r); + }), n.str) : ""; + } + function Po(t2, e) { + let { handle: n, suffix: r } = e.tag, s = t2.tagPrefixes.find((i) => i.handle === n); + if (!s) { + let i = t2.getDefaults().tagPrefixes; + if (i && (s = i.find((o) => o.handle === n)), !s) throw new p.YAMLSemanticError(e, `The ${n} tag handle is non-default and was not declared.`); } - for (let u = s.length - 1; u >= 0; u--) { - let i = s[u]; - if (i === " " || i === " ") t2++; - else { - e[n] = s.slice(0, u + 1); - break e; + if (!r) throw new p.YAMLSemanticError(e, `The ${n} tag has no suffix.`); + if (n === "!" && (t2.version || t2.options.version) === "1.0") { + if (r[0] === "^") return t2.warnings.push(new p.YAMLWarning(e, "YAML 1.0 ^ tag expansion is not supported")), r; + if (/[:/]/.test(r)) { + let i = r.match(/^([a-z0-9-]+)\/(.*)/i); + return i ? `tag:${i[1]}.yaml.org,2002:${i[2]}` : `tag:${r}`; } } + return s.prefix + decodeURIComponent(r); } - if (t2 > 0 || r > 0) for (e.length = n + 1; r-- > 0; ) e.push(Ut); - return t2; - } - function Wr(e, t2, r, n, s, u) { - var _a2; - if (r === Number.POSITIVE_INFINITY) return true; - let i = t2.length, a2 = [e], o = []; - for (; r >= 0; ) { - if (a2.length === 0) { - if (i === 0) return true; - a2.push(t2[--i]); - continue; - } - let { mode: p, doc: y } = a2.pop(), D = Se(y); - switch (D) { - case Re: - o.push(y), r -= tt(y); - break; - case he: - case we: { - let m = D === he ? y : y.parts, C = (_a2 = y[es]) != null ? _a2 : 0; - for (let c = m.length - 1; c >= C; c--) a2.push({ mode: p, doc: m[c] }); - break; - } - case He: - case Ve: - case Ke: - case ge: - a2.push({ mode: p, doc: y.contents }); - break; - case $e: - r += rs(o); - break; - case me: { - if (u && y.break) return false; - let m = y.break ? Pe : p, C = y.expandedStates && m === Pe ? M(false, y.expandedStates, -1) : y.contents; - a2.push({ mode: m, doc: C }); - break; - } - case Te: { - let C = (y.groupId ? s[y.groupId] || it : p) === Pe ? y.breakContents : y.flatContents; - C && a2.push({ mode: p, doc: C }); - break; + function vo(t2, e) { + let { tag: n, type: r } = e, s = false; + if (n) { + let { handle: i, suffix: o, verbatim: a2 } = n; + if (a2) { + if (a2 !== "!" && a2 !== "!!") return a2; + let c = `Verbatim tags aren't resolved, so ${a2} is invalid.`; + t2.errors.push(new p.YAMLSemanticError(e, c)); + } else if (i === "!" && !o) s = true; + else try { + return Po(t2, e); + } catch (c) { + t2.errors.push(c); } - case ie: - if (p === Pe || y.hard) return true; - y.soft || (o.push(" "), r--); - break; - case Qe: - n = true; - break; - case Je: - if (n) return false; - break; + } + switch (r) { + case p.Type.BLOCK_FOLDED: + case p.Type.BLOCK_LITERAL: + case p.Type.QUOTE_DOUBLE: + case p.Type.QUOTE_SINGLE: + return p.defaultTags.STR; + case p.Type.FLOW_MAP: + case p.Type.MAP: + return p.defaultTags.MAP; + case p.Type.FLOW_SEQ: + case p.Type.SEQ: + return p.defaultTags.SEQ; + case p.Type.PLAIN: + return s ? p.defaultTags.STR : null; + default: + return null; } } - return false; - } - function ns(e, t2) { - var _a2; - let r = {}, n = t2.printWidth, s = Gu(t2.endOfLine), u = 0, i = [{ ind: Uu(), mode: Pe, doc: e }], a2 = [], o = false, p = [], y = 0; - for (Su(e); i.length > 0; ) { - let { ind: m, mode: C, doc: c } = i.pop(); - switch (Se(c)) { - case Re: { - let A2 = s !== ` -` ? N(false, c, ` -`, s) : c; - a2.push(A2), i.length > 0 && (u += tt(A2)); - break; - } - case he: - for (let A2 = c.length - 1; A2 >= 0; A2--) i.push({ ind: m, mode: C, doc: c[A2] }); - break; - case nt: - if (y >= 2) throw new Error("There are too many 'cursor' in doc."); - a2.push(Ut), y++; - break; - case He: - i.push({ ind: Pp(m, t2), mode: C, doc: c.contents }); - break; - case Ve: - i.push({ ind: kp(m, c.n, t2), mode: C, doc: c.contents }); - break; - case $e: - u -= rs(a2); - break; - case me: - switch (C) { - case it: - if (!o) { - i.push({ ind: m, mode: c.break ? Pe : it, doc: c.contents }); - break; - } - case Pe: { - o = false; - let A2 = { ind: m, mode: it, doc: c.contents }, d = n - u, S = p.length > 0; - if (!c.break && Wr(A2, i, d, S, r)) i.push(A2); - else if (c.expandedStates) { - let g = M(false, c.expandedStates, -1); - if (c.break) { - i.push({ ind: m, mode: Pe, doc: g }); - break; - } else for (let _2 = 1; _2 < c.expandedStates.length + 1; _2++) if (_2 >= c.expandedStates.length) { - i.push({ ind: m, mode: Pe, doc: g }); - break; - } else { - let v = c.expandedStates[_2], j = { ind: m, mode: it, doc: v }; - if (Wr(j, i, d, S, r)) { - i.push(j); - break; - } - } - } else i.push({ ind: m, mode: Pe, doc: c.contents }); - break; - } - } - c.id && (r[c.id] = M(false, i, -1).mode); - break; - case we: { - let A2 = n - u, d = (_a2 = c[es]) != null ? _a2 : 0, { parts: S } = c, g = S.length - d; - if (g === 0) break; - let _2 = S[d + 0], v = S[d + 1], j = { ind: m, mode: it, doc: _2 }, I = { ind: m, mode: Pe, doc: _2 }, U = Wr(j, [], A2, p.length > 0, r, true); - if (g === 1) { - U ? i.push(j) : i.push(I); - break; - } - let P = { ind: m, mode: it, doc: v }, G = { ind: m, mode: Pe, doc: v }; - if (g === 2) { - U ? i.push(P, j) : i.push(G, I); - break; + function Jr(t2, e, n) { + let { tags: r } = t2.schema, s = []; + for (let o of r) if (o.tag === n) if (o.test) s.push(o); + else { + let a2 = o.resolve(t2, e); + return a2 instanceof Q ? a2 : new x(a2); + } + let i = Dn(t2, e); + return typeof i == "string" && s.length > 0 ? xn(i, s, r.scalarFallback) : null; + } + function Io({ type: t2 }) { + switch (t2) { + case p.Type.FLOW_MAP: + case p.Type.MAP: + return p.defaultTags.MAP; + case p.Type.FLOW_SEQ: + case p.Type.SEQ: + return p.defaultTags.SEQ; + default: + return p.defaultTags.STR; + } + } + function _o(t2, e, n) { + try { + let r = Jr(t2, e, n); + if (r) return n && e.tag && (r.tag = n), r; + } catch (r) { + return r.source || (r.source = e), t2.errors.push(r), null; + } + try { + let r = Io(e); + if (!r) throw new Error(`The tag ${n} is unavailable`); + let s = `The tag ${n} is unavailable, falling back to ${r}`; + t2.warnings.push(new p.YAMLWarning(e, s)); + let i = Jr(t2, e, r); + return i.tag = n, i; + } catch (r) { + let s = new p.YAMLReferenceError(e, r.message); + return s.stack = r.stack, t2.errors.push(s), null; + } + } + var xo = (t2) => { + if (!t2) return false; + let { type: e } = t2; + return e === p.Type.MAP_KEY || e === p.Type.MAP_VALUE || e === p.Type.SEQ_ITEM; + }; + function Ro(t2, e) { + let n = { before: [], after: [] }, r = false, s = false, i = xo(e.context.parent) ? e.context.parent.props.concat(e.props) : e.props; + for (let { start: o, end: a2 } of i) switch (e.context.src[o]) { + case p.Char.COMMENT: { + if (!e.commentHasRequiredWhitespace(o)) { + let m = "Comments must be separated from other tokens by white space characters"; + t2.push(new p.YAMLSemanticError(e, m)); } - let ue = S[d + 2], Q = { ind: m, mode: C, doc: { ...c, [es]: d + 2 } }; - Wr({ ind: m, mode: it, doc: [_2, v, ue] }, [], A2, p.length > 0, r, true) ? i.push(Q, P, j) : U ? i.push(Q, G, j) : i.push(Q, G, I); + let { header: c, valueRange: l } = e; + (l && (o > l.start || c && o > c.start) ? n.after : n.before).push(e.context.src.slice(o + 1, a2)); break; } - case Te: - case Ke: { - let A2 = c.groupId ? r[c.groupId] : C; - if (A2 === Pe) { - let d = c.type === Te ? c.breakContents : c.negate ? c.contents : f2(c.contents); - d && i.push({ ind: m, mode: C, doc: d }); - } - if (A2 === it) { - let d = c.type === Te ? c.flatContents : c.negate ? f2(c.contents) : c.contents; - d && i.push({ ind: m, mode: C, doc: d }); + case p.Char.ANCHOR: + if (r) { + let c = "A node can have at most one anchor"; + t2.push(new p.YAMLSemanticError(e, c)); } + r = true; break; - } - case Qe: - p.push({ ind: m, mode: C, doc: c.contents }); - break; - case Je: - p.length > 0 && i.push({ ind: m, mode: C, doc: Nn }); - break; - case ie: - switch (C) { - case it: - if (c.hard) o = true; - else { - c.soft || (a2.push(" "), u += 1); - break; - } - case Pe: - if (p.length > 0) { - i.push({ ind: m, mode: C, doc: c }, ...p.reverse()), p.length = 0; - break; - } - c.literal ? m.root ? (a2.push(s, m.root.value), u = m.root.length) : (a2.push(s), u = 0) : (u -= rs(a2), a2.push(s + m.value), u = m.length); - break; + case p.Char.TAG: + if (s) { + let c = "A node can have at most one tag"; + t2.push(new p.YAMLSemanticError(e, c)); } + s = true; break; - case ge: - i.push({ ind: m, mode: C, doc: c.contents }); - break; - case Oe: - break; - default: - throw new Tt(c); } - i.length === 0 && p.length > 0 && (i.push(...p.reverse()), p.length = 0); + return { comments: n, hasAnchor: r, hasTag: s }; } - let D = a2.indexOf(Ut); - if (D !== -1) { - let m = a2.indexOf(Ut, D + 1); - if (m === -1) return { formatted: a2.filter((d) => d !== Ut).join("") }; - let C = a2.slice(0, D).join(""), c = a2.slice(D + 1, m).join(""), A2 = a2.slice(m + 1).join(""); - return { formatted: C + c + A2, cursorNodeStart: C.length, cursorNodeText: c }; + function Do(t2, e) { + let { anchors: n, errors: r, schema: s } = t2; + if (e.type === p.Type.ALIAS) { + let o = e.rawValue, a2 = n.getNode(o); + if (!a2) { + let l = `Aliased anchor not found: ${o}`; + return r.push(new p.YAMLReferenceError(e, l)), null; + } + let c = new we(a2); + return n._cstAliases.push(c), c; + } + let i = vo(t2, e); + if (i) return _o(t2, e, i); + if (e.type !== p.Type.PLAIN) { + let o = `Failed to resolve ${e.type} node here`; + return r.push(new p.YAMLSyntaxError(e, o)), null; + } + try { + let o = Dn(t2, e); + return xn(o, s.tags, s.tags.scalarFallback); + } catch (o) { + return o.source || (o.source = e), r.push(o), null; + } } - return { formatted: a2.join("") }; - } - function Ip(e, t2, r = 0) { - let n = 0; - for (let s = r; s < e.length; ++s) e[s] === " " ? n = n + t2 - n % t2 : n++; - return n; - } - var Yu = Ip; - function Lp(e, t2) { - let r = e.lastIndexOf(` + function pe(t2, e) { + if (!e) return null; + e.error && t2.errors.push(e.error); + let { comments: n, hasAnchor: r, hasTag: s } = Ro(t2.errors, e); + if (r) { + let { anchors: o } = t2, a2 = e.anchor, c = o.getNode(a2); + c && (o.map[o.newName(a2)] = c), o.map[a2] = e; + } + if (e.type === p.Type.ALIAS && (r || s)) { + let o = "An alias node must not specify any properties"; + t2.errors.push(new p.YAMLSemanticError(e, o)); + } + let i = Do(t2, e); + if (i) { + i.range = [e.range.start, e.range.end], t2.options.keepCstNodes && (i.cstNode = e), t2.options.keepNodeTypes && (i.type = e.type); + let o = n.before.join(` `); - return r === -1 ? 0 : Yu(e.slice(r + 1).match(/^[\t ]*/u)[0], t2); - } - var Nu = Lp; - function Gr(e, t2, r) { - let { node: n } = e; - if (n.type === "TemplateLiteral" && _p(e)) { - let p = wp(e, r, t2); - if (p) return p; - } - let u = "expressions"; - n.type === "TSTemplateLiteralType" && (u = "types"); - let i = [], a2 = e.map(t2, u); - i.push(ve, "`"); - let o = 0; - return e.each(({ index: p, node: y }) => { - if (i.push(t2()), y.tail) return; - let { tabWidth: D } = r, m = y.value.raw, C = m.includes(` -`) ? Nu(m, D) : o; - o = C; - let c = a2[p], A2 = n[u][p], d = de(r.originalText, k(y), q(n.quasis[p + 1])); - if (!d) { - let g = ns(c, { ...r, printWidth: Number.POSITIVE_INFINITY }).formatted; - g.includes(` -`) ? d = true : c = g; - } - d && (T(A2) || A2.type === "Identifier" || W(A2) || A2.type === "ConditionalExpression" || A2.type === "SequenceExpression" || Ae(A2) || De(A2)) && (c = [f2([E, c]), E]); - let S = C === 0 && m.endsWith(` -`) ? Be(Number.NEGATIVE_INFINITY, c) : Iu(c, C, D); - i.push(l(["${", S, ve, "}"])); - }, "quasis"), i.push("`"), i; - } - function Xu(e, t2) { - let r = t2("quasi"); - return st(r.label && { tagged: true, ...r.label }, [t2("tag"), t2(e.node.typeArguments ? "typeArguments" : "typeParameters"), ve, r]); - } - function wp(e, t2, r) { - let { node: n } = e, s = n.quasis[0].value.raw.trim().split(/\s*\|\s*/u); - if (s.length > 1 || s.some((u) => u.length > 0)) { - t2.__inJestEach = true; - let u = e.map(r, "expressions"); - t2.__inJestEach = false; - let i = [], a2 = u.map((m) => "${" + ns(m, { ...t2, printWidth: Number.POSITIVE_INFINITY, endOfLine: "lf" }).formatted + "}"), o = [{ hasLineBreak: false, cells: [] }]; - for (let m = 1; m < n.quasis.length; m++) { - let C = M(false, o, -1), c = a2[m - 1]; - C.cells.push(c), c.includes(` -`) && (C.hasLineBreak = true), n.quasis[m].value.raw.includes(` -`) && o.push({ hasLineBreak: false, cells: [] }); + o && (i.commentBefore = i.commentBefore ? `${i.commentBefore} +${o}` : o); + let a2 = n.after.join(` +`); + a2 && (i.comment = i.comment ? `${i.comment} +${a2}` : a2); } - let p = Math.max(s.length, ...o.map((m) => m.cells.length)), y = Array.from({ length: p }).fill(0), D = [{ cells: s }, ...o.filter((m) => m.cells.length > 0)]; - for (let { cells: m } of D.filter((C) => !C.hasLineBreak)) for (let [C, c] of m.entries()) y[C] = Math.max(y[C], tt(c)); - return i.push(ve, "`", f2([F, b(F, D.map((m) => b(" | ", m.cells.map((C, c) => m.hasLineBreak ? C : C + " ".repeat(y[c] - tt(C))))))]), F, "`"), i; + return e.resolved = i; } - } - function Op(e, t2) { - let { node: r } = e, n = t2(); - return T(r) && (n = l([f2([E, n]), E])), ["${", n, ve, "}"]; - } - function Yt(e, t2) { - return e.map((r) => Op(r, t2), "expressions"); - } - function Ur(e, t2) { - return mt(e, (r) => typeof r == "string" ? t2 ? N(false, r, /(\\*)`/gu, "$1$1\\`") : ss(r) : r); - } - function ss(e) { - return N(false, e, /([\\`]|\$\{)/gu, String.raw`\$1`); - } - function _p({ node: e, parent: t2 }) { - let r = /^[fx]?(?:describe|it|test)$/u; - return t2.type === "TaggedTemplateExpression" && t2.quasi === e && t2.tag.type === "MemberExpression" && t2.tag.property.type === "Identifier" && t2.tag.property.name === "each" && (t2.tag.object.type === "Identifier" && r.test(t2.tag.object.name) || t2.tag.object.type === "MemberExpression" && t2.tag.object.property.type === "Identifier" && (t2.tag.object.property.name === "only" || t2.tag.object.property.name === "skip") && t2.tag.object.object.type === "Identifier" && r.test(t2.tag.object.object.name)); - } - var is = [(e, t2) => e.type === "ObjectExpression" && t2 === "properties", (e, t2) => e.type === "CallExpression" && e.callee.type === "Identifier" && e.callee.name === "Component" && t2 === "arguments", (e, t2) => e.type === "Decorator" && t2 === "expression"]; - function Hu(e) { - let t2 = (n) => n.type === "TemplateLiteral", r = (n, s) => Ce(n) && !n.computed && n.key.type === "Identifier" && n.key.name === "styles" && s === "value"; - return e.match(t2, (n, s) => Y(n) && s === "elements", r, ...is) || e.match(t2, r, ...is); - } - function Vu(e) { - return e.match((t2) => t2.type === "TemplateLiteral", (t2, r) => Ce(t2) && !t2.computed && t2.key.type === "Identifier" && t2.key.name === "template" && r === "value", ...is); - } - function us(e, t2) { - return T(e, h.Block | h.Leading, ({ value: r }) => r === ` ${t2} `); - } - function Yr({ node: e, parent: t2 }, r) { - return us(e, r) || vp(t2) && us(t2, r) || t2.type === "ExpressionStatement" && us(t2, r); - } - function vp(e) { - return e.type === "AsConstExpression" || e.type === "TSAsExpression" && e.typeAnnotation.type === "TSTypeReference" && e.typeAnnotation.typeName.type === "Identifier" && e.typeAnnotation.typeName.name === "const"; - } - async function jp(e, t2, r) { - let { node: n } = r, s = n.quasis.map((y) => y.value.raw), u = 0, i = s.reduce((y, D, m) => m === 0 ? D : y + "@prettier-placeholder-" + u++ + "-id" + D, ""), a2 = await e(i, { parser: "scss" }), o = Yt(r, t2), p = Mp(a2, o); - if (!p) throw new Error("Couldn't insert all the expressions"); - return ["`", f2([F, p]), E, "`"]; - } - function Mp(e, t2) { - if (!O(t2)) return e; - let r = 0, n = mt(Gt(e), (s) => typeof s != "string" || !s.includes("@prettier-placeholder") ? s : s.split(/@prettier-placeholder-(\d+)-id/u).map((u, i) => i % 2 === 0 ? _e(u) : (r++, t2[u]))); - return t2.length === r ? n : null; - } - function Rp({ node: e, parent: t2, grandparent: r }) { - return r && e.quasis && t2.type === "JSXExpressionContainer" && r.type === "JSXElement" && r.openingElement.name.name === "style" && r.openingElement.attributes.some((n) => n.type === "JSXAttribute" && n.name.name === "jsx") || (t2 == null ? void 0 : t2.type) === "TaggedTemplateExpression" && t2.tag.type === "Identifier" && t2.tag.name === "css" || (t2 == null ? void 0 : t2.type) === "TaggedTemplateExpression" && t2.tag.type === "MemberExpression" && t2.tag.object.name === "css" && (t2.tag.property.name === "global" || t2.tag.property.name === "resolve"); - } - function Nr(e) { - return e.type === "Identifier" && e.name === "styled"; - } - function $u(e) { - return /^[A-Z]/u.test(e.object.name) && e.property.name === "extend"; - } - function Jp({ parent: e }) { - if (!e || e.type !== "TaggedTemplateExpression") return false; - let t2 = e.tag.type === "ParenthesizedExpression" ? e.tag.expression : e.tag; - switch (t2.type) { - case "MemberExpression": - return Nr(t2.object) || $u(t2); - case "CallExpression": - return Nr(t2.callee) || t2.callee.type === "MemberExpression" && (t2.callee.object.type === "MemberExpression" && (Nr(t2.callee.object.object) || $u(t2.callee.object)) || t2.callee.object.type === "CallExpression" && Nr(t2.callee.object.callee)); - case "Identifier": - return t2.name === "css"; - default: - return false; + function $o(t2, e) { + if (e.type !== p.Type.MAP && e.type !== p.Type.FLOW_MAP) { + let o = `A ${e.type} node cannot be resolved as a mapping`; + return t2.errors.push(new p.YAMLSyntaxError(e, o)), null; + } + let { comments: n, items: r } = e.type === p.Type.FLOW_MAP ? qo(t2, e) : Fo(t2, e), s = new ct(); + s.items = r, ss(s, n); + let i = false; + for (let o = 0; o < r.length; ++o) { + let { key: a2 } = r[o]; + if (a2 instanceof Q && (i = true), t2.schema.merge && a2 && a2.value === zr) { + r[o] = new Yt(r[o]); + let c = r[o].value.items, l = null; + c.some((f2) => { + if (f2 instanceof we) { + let { type: m } = f2.source; + return m === p.Type.MAP || m === p.Type.FLOW_MAP ? false : l = "Merge nodes aliases can only point to maps"; + } + return l = "Merge nodes can only have Alias nodes as values"; + }), l && t2.errors.push(new p.YAMLSemanticError(e, l)); + } else for (let c = o + 1; c < r.length; ++c) { + let { key: l } = r[c]; + if (a2 === l || a2 && l && Object.prototype.hasOwnProperty.call(a2, "value") && a2.value === l.value) { + let f2 = `Map keys must be unique; "${a2}" is repeated`; + t2.errors.push(new p.YAMLSemanticError(e, f2)); + break; + } + } + } + if (i && !t2.options.mapAsMap) { + let o = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this."; + t2.warnings.push(new p.YAMLWarning(e, o)); + } + return e.resolved = s, s; } - } - function qp({ parent: e, grandparent: t2 }) { - return (t2 == null ? void 0 : t2.type) === "JSXAttribute" && e.type === "JSXExpressionContainer" && t2.name.type === "JSXIdentifier" && t2.name.name === "css"; - } - function Wp(e) { - if (Rp(e) || Jp(e) || qp(e) || Hu(e)) return jp; - } - var Ku = Wp; - async function Gp(e, t2, r) { - let { node: n } = r, s = n.quasis.length, u = Yt(r, t2), i = []; - for (let a2 = 0; a2 < s; a2++) { - let o = n.quasis[a2], p = a2 === 0, y = a2 === s - 1, D = o.value.cooked, m = D.split(` -`), C = m.length, c = u[a2], A2 = C > 2 && m[0].trim() === "" && m[1].trim() === "", d = C > 2 && m[C - 1].trim() === "" && m[C - 2].trim() === "", S = m.every((_2) => /^\s*(?:#[^\n\r]*)?$/u.test(_2)); - if (!y && /#[^\n\r]*$/u.test(m[C - 1])) return null; - let g = null; - S ? g = Up(m) : g = await e(D, { parser: "graphql" }), g ? (g = Ur(g, false), !p && A2 && i.push(""), i.push(g), !y && d && i.push("")) : !p && !y && A2 && i.push(""), c && i.push(c); + var Yo = ({ context: { lineStart: t2, node: e, src: n }, props: r }) => { + if (r.length === 0) return false; + let { start: s } = r[0]; + if (e && s > e.valueRange.start || n[s] !== p.Char.COMMENT) return false; + for (let i = t2; i < s; ++i) if (n[i] === ` +`) return false; + return true; + }; + function Bo(t2, e) { + if (!Yo(t2)) return; + let n = t2.getPropValue(0, p.Char.COMMENT, true), r = false, s = e.value.commentBefore; + if (s && s.startsWith(n)) e.value.commentBefore = s.substr(n.length + 1), r = true; + else { + let i = e.value.comment; + !t2.node && i && i.startsWith(n) && (e.value.comment = i.substr(n.length + 1), r = true); + } + r && (e.comment = n); } - return ["`", f2([F, b(F, i)]), F, "`"]; - } - function Up(e) { - let t2 = [], r = false, n = e.map((s) => s.trim()); - for (let [s, u] of n.entries()) u !== "" && (n[s - 1] === "" && r ? t2.push([F, u]) : t2.push(u), r = true); - return t2.length === 0 ? null : b(F, t2); - } - function Yp({ node: e, parent: t2 }) { - return Yr({ node: e, parent: t2 }, "GraphQL") || t2 && (t2.type === "TaggedTemplateExpression" && (t2.tag.type === "MemberExpression" && t2.tag.object.name === "graphql" && t2.tag.property.name === "experimental" || t2.tag.type === "Identifier" && (t2.tag.name === "gql" || t2.tag.name === "graphql")) || t2.type === "CallExpression" && t2.callee.type === "Identifier" && t2.callee.name === "graphql"); - } - function Np(e) { - if (Yp(e)) return Gp; - } - var Qu = Np; - var as = 0; - async function zu(e, t2, r, n, s) { - let { node: u } = n, i = as; - as = as + 1 >>> 0; - let a2 = (S) => `PRETTIER_HTML_PLACEHOLDER_${S}_${i}_IN_JS`, o = u.quasis.map((S, g, _2) => g === _2.length - 1 ? S.value.cooked : S.value.cooked + a2(g)).join(""), p = Yt(n, r), y = new RegExp(a2(String.raw`(\d+)`), "gu"), D = 0, m = await t2(o, { parser: e, __onHtmlRoot(S) { - D = S.children.length; - } }), C = mt(m, (S) => { - if (typeof S != "string") return S; - let g = [], _2 = S.split(y); - for (let v = 0; v < _2.length; v++) { - let j = _2[v]; - if (v % 2 === 0) { - j && (j = ss(j), s.__embeddedInHtml && (j = N(false, j, /<\/(?=script\b)/giu, String.raw`<\/`)), g.push(j)); - continue; + function Fo(t2, e) { + let n = [], r = [], s, i = null; + for (let o = 0; o < e.items.length; ++o) { + let a2 = e.items[o]; + switch (a2.type) { + case p.Type.BLANK_LINE: + n.push({ afterKey: !!s, before: r.length }); + break; + case p.Type.COMMENT: + n.push({ afterKey: !!s, before: r.length, comment: a2.comment }); + break; + case p.Type.MAP_KEY: + s !== void 0 && r.push(new T(s)), a2.error && t2.errors.push(a2.error), s = pe(t2, a2.node), i = null; + break; + case p.Type.MAP_VALUE: + { + if (s === void 0 && (s = null), a2.error && t2.errors.push(a2.error), !a2.context.atLineStart && a2.node && a2.node.type === p.Type.MAP && !a2.node.context.atLineStart) { + let f2 = "Nested mappings are not allowed in compact mappings"; + t2.errors.push(new p.YAMLSemanticError(a2.node, f2)); + } + let c = a2.node; + if (!c && a2.props.length > 0) { + c = new p.PlainValue(p.Type.PLAIN, []), c.context = { parent: a2, src: a2.context.src }; + let f2 = a2.range.start + 1; + if (c.range = { start: f2, end: f2 }, c.valueRange = { start: f2, end: f2 }, typeof a2.range.origStart == "number") { + let m = a2.range.origStart + 1; + c.range.origStart = c.range.origEnd = m, c.valueRange.origStart = c.valueRange.origEnd = m; + } + } + let l = new T(s, pe(t2, c)); + Bo(a2, l), r.push(l), s && typeof i == "number" && a2.range.start > i + 1024 && t2.errors.push(rs(e, s)), s = void 0, i = null; + } + break; + default: + s !== void 0 && r.push(new T(s)), s = pe(t2, a2), i = a2.range.start, a2.error && t2.errors.push(a2.error); + e: for (let c = o + 1; ; ++c) { + let l = e.items[c]; + switch (l && l.type) { + case p.Type.BLANK_LINE: + case p.Type.COMMENT: + continue e; + case p.Type.MAP_VALUE: + break e; + default: { + let f2 = "Implicit map keys need to be followed by map values"; + t2.errors.push(new p.YAMLSemanticError(a2, f2)); + break e; + } + } + } + if (a2.valueRangeContainsNewline) { + let c = "Implicit map keys need to be on a single line"; + t2.errors.push(new p.YAMLSemanticError(a2, c)); + } } - let I = Number(j); - g.push(p[I]); } - return g; - }), c = /^\s/u.test(o) ? " " : "", A2 = /\s$/u.test(o) ? " " : "", d = s.htmlWhitespaceSensitivity === "ignore" ? F : c && A2 ? x : null; - return d ? l(["`", f2([d, l(C)]), d, "`"]) : st({ hug: false }, l(["`", c, D > 1 ? f2(l(C)) : l(C), A2, "`"])); - } - function Xp(e) { - return Yr(e, "HTML") || e.match((t2) => t2.type === "TemplateLiteral", (t2, r) => t2.type === "TaggedTemplateExpression" && t2.tag.type === "Identifier" && t2.tag.name === "html" && r === "quasi"); - } - var Hp = zu.bind(void 0, "html"), Vp = zu.bind(void 0, "angular"); - function $p(e) { - if (Xp(e)) return Hp; - if (Vu(e)) return Vp; - } - var Zu = $p; - async function Kp(e, t2, r) { - let { node: n } = r, s = N(false, n.quasis[0].value.raw, /((?:\\\\)*)\\`/gu, (o, p) => "\\".repeat(p.length / 2) + "`"), u = Qp(s), i = u !== ""; - i && (s = N(false, s, new RegExp(`^${u}`, "gmu"), "")); - let a2 = Ur(await e(s, { parser: "markdown", __inJsTemplate: true }), true); - return ["`", i ? f2([E, a2]) : [Mr, ku(a2)], E, "`"]; - } - function Qp(e) { - let t2 = e.match(/^([^\S\n]*)\S/mu); - return t2 === null ? "" : t2[1]; - } - function zp(e) { - if (Zp(e)) return Kp; - } - function Zp({ node: e, parent: t2 }) { - return (t2 == null ? void 0 : t2.type) === "TaggedTemplateExpression" && e.quasis.length === 1 && t2.tag.type === "Identifier" && (t2.tag.name === "md" || t2.tag.name === "markdown"); - } - var ei = zp; - function ec(e) { - let { node: t2 } = e; - if (t2.type !== "TemplateLiteral" || tc(t2)) return; - let r; - for (let n of [Ku, Qu, Zu, ei]) if (r = n(e), !!r) return t2.quasis.length === 1 && t2.quasis[0].value.raw.trim() === "" ? "``" : async (...s) => { - let u = await r(...s); - return u && st({ embed: true, ...u.label }, u); - }; - } - function tc({ quasis: e }) { - return e.some(({ value: { cooked: t2 } }) => t2 === null); - } - var ti = ec; - var rc = /\*\/$/, nc = /^\/\*\*?/, ui = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/, sc = /(^|\s+)\/\/([^\n\r]*)/g, ri = /^(\r?\n)+/, uc = /(?:^|\r?\n) *(@[^\n\r]*?) *\r?\n *(?![^\n\r@]*\/\/[^]*)([^\s@][^\n\r@]+?) *\r?\n/g, ni = /(?:^|\r?\n) *@(\S+) *([^\n\r]*)/g, ic = /(\r?\n|^) *\* ?/g, ii = []; - function ai(e) { - let t2 = e.match(ui); - return t2 ? t2[0].trimStart() : ""; - } - function oi(e) { - let t2 = e.match(ui), r = t2 == null ? void 0 : t2[0]; - return r == null ? e : e.slice(r.length); - } - function pi(e) { - let t2 = ` -`; - e = N(false, e.replace(nc, "").replace(rc, ""), ic, "$1"); - let r = ""; - for (; r !== e; ) r = e, e = N(false, e, uc, `${t2}$1 $2${t2}`); - e = e.replace(ri, "").trimEnd(); - let n = /* @__PURE__ */ Object.create(null), s = N(false, e, ni, "").replace(ri, "").trimEnd(), u; - for (; u = ni.exec(e); ) { - let i = N(false, u[2], sc, ""); - if (typeof n[u[1]] == "string" || Array.isArray(n[u[1]])) { - let a2 = n[u[1]]; - n[u[1]] = [...ii, ...Array.isArray(a2) ? a2 : [a2], i]; - } else n[u[1]] = i; + return s !== void 0 && r.push(new T(s)), { comments: n, items: r }; } - return { comments: s, pragmas: n }; - } - function ci({ comments: e = "", pragmas: t2 = {} }) { - let r = ` -`, n = "/**", s = " *", u = " */", i = Object.keys(t2), a2 = i.flatMap((p) => si(p, t2[p])).map((p) => `${s} ${p}${r}`).join(""); - if (!e) { - if (i.length === 0) return ""; - if (i.length === 1 && !Array.isArray(t2[i[0]])) { - let p = t2[i[0]]; - return `${n} ${si(i[0], p)[0]}${u}`; + function qo(t2, e) { + let n = [], r = [], s, i = false, o = "{"; + for (let a2 = 0; a2 < e.items.length; ++a2) { + let c = e.items[a2]; + if (typeof c.char == "string") { + let { char: l, offset: f2 } = c; + if (l === "?" && s === void 0 && !i) { + i = true, o = ":"; + continue; + } + if (l === ":") { + if (s === void 0 && (s = null), o === ":") { + o = ","; + continue; + } + } else if (i && (s === void 0 && l !== "," && (s = null), i = false), s !== void 0 && (r.push(new T(s)), s = void 0, l === ",")) { + o = ":"; + continue; + } + if (l === "}") { + if (a2 === e.items.length - 1) continue; + } else if (l === o) { + o = ":"; + continue; + } + let m = `Flow map contains an unexpected ${l}`, g = new p.YAMLSyntaxError(e, m); + g.offset = f2, t2.errors.push(g); + } else c.type === p.Type.BLANK_LINE ? n.push({ afterKey: !!s, before: r.length }) : c.type === p.Type.COMMENT ? (ns(t2.errors, c), n.push({ afterKey: !!s, before: r.length, comment: c.comment })) : s === void 0 ? (o === "," && t2.errors.push(new p.YAMLSemanticError(c, "Separator , missing in flow map")), s = pe(t2, c)) : (o !== "," && t2.errors.push(new p.YAMLSemanticError(c, "Indicator : missing in flow map entry")), r.push(new T(s, pe(t2, c))), s = void 0, i = false); } + return ts(t2.errors, e), s !== void 0 && r.push(new T(s)), { comments: n, items: r }; } - let o = e.split(r).map((p) => `${s} ${p}`).join(r) + r; - return n + r + (e ? o : "") + (e && i.length > 0 ? s + r : "") + a2 + u; - } - function si(e, t2) { - return [...ii, ...Array.isArray(t2) ? t2 : [t2]].map((r) => `@${e} ${r}`.trim()); - } - function ac(e) { - if (!e.startsWith("#!")) return ""; - let t2 = e.indexOf(` -`); - return t2 === -1 ? e : e.slice(0, t2); - } - var li = ac; - function oc(e) { - let t2 = li(e); - t2 && (e = e.slice(t2.length + 1)); - let r = ai(e), { pragmas: n, comments: s } = pi(r); - return { shebang: t2, text: e, pragmas: n, comments: s }; - } - function mi(e) { - let { shebang: t2, text: r, pragmas: n, comments: s } = oc(e), u = oi(r), i = ci({ pragmas: { format: "", ...n }, comments: s.trimStart() }); - return (t2 ? `${t2} -` : "") + i + (u.startsWith(` -`) ? ` -` : ` - -`) + u; - } - function pc(e, t2) { - let { originalText: r, [/* @__PURE__ */ Symbol.for("comments")]: n, locStart: s, locEnd: u, [/* @__PURE__ */ Symbol.for("printedComments")]: i } = t2, { node: a2 } = e, o = s(a2), p = u(a2); - for (let y of n) s(y) >= o && u(y) <= p && i.add(y); - return r.slice(o, p); - } - var yi = pc; - function os(e, t2) { - var u, i, a2, o, p, y, D, m, C; - if (e.isRoot) return false; - let { node: r, key: n, parent: s } = e; - if (t2.__isInHtmlInterpolation && !t2.bracketSpacing && yc(r) && lr(e)) return true; - if (cc(r)) return false; - if (r.type === "Identifier") { - if ((u = r.extra) != null && u.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/u.test(r.name) || n === "left" && (r.name === "async" && !s.await || r.name === "let") && s.type === "ForOfStatement") return true; - if (r.name === "let") { - let c = (i = e.findAncestor((A2) => A2.type === "ForOfStatement")) == null ? void 0 : i.left; - if (c && ae(c, (A2) => A2 === r)) return true; - } - if (n === "object" && r.name === "let" && s.type === "MemberExpression" && s.computed && !s.optional) { - let c = e.findAncestor((d) => d.type === "ExpressionStatement" || d.type === "ForStatement" || d.type === "ForInStatement"), A2 = c ? c.type === "ExpressionStatement" ? c.expression : c.type === "ForStatement" ? c.init : c.left : void 0; - if (A2 && ae(A2, (d) => d === r)) return true; + function Uo(t2, e) { + if (e.type !== p.Type.SEQ && e.type !== p.Type.FLOW_SEQ) { + let i = `A ${e.type} node cannot be resolved as a sequence`; + return t2.errors.push(new p.YAMLSyntaxError(e, i)), null; } - if (n === "expression") switch (r.name) { - case "await": - case "interface": - case "module": - case "using": - case "yield": - case "let": - case "component": - case "hook": - case "type": { - let c = e.findAncestor((A2) => !Ae(A2)); - if (c !== s && c.type === "ExpressionStatement") return true; - } + let { comments: n, items: r } = e.type === p.Type.FLOW_SEQ ? Wo(t2, e) : Vo(t2, e), s = new ue(); + if (s.items = r, ss(s, n), !t2.options.mapAsMap && r.some((i) => i instanceof T && i.key instanceof Q)) { + let i = "Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this."; + t2.warnings.push(new p.YAMLWarning(e, i)); } - return false; - } - if (r.type === "ObjectExpression" || r.type === "FunctionExpression" || r.type === "ClassExpression" || r.type === "DoExpression") { - let c = (a2 = e.findAncestor((A2) => A2.type === "ExpressionStatement")) == null ? void 0 : a2.expression; - if (c && ae(c, (A2) => A2 === r)) return true; - } - if (r.type === "ObjectExpression") { - let c = (o = e.findAncestor((A2) => A2.type === "ArrowFunctionExpression")) == null ? void 0 : o.body; - if (c && c.type !== "SequenceExpression" && c.type !== "AssignmentExpression" && ae(c, (A2) => A2 === r)) return true; - } - switch (s.type) { - case "ParenthesizedExpression": - return false; - case "ClassDeclaration": - case "ClassExpression": - if (n === "superClass" && (r.type === "ArrowFunctionExpression" || r.type === "AssignmentExpression" || r.type === "AwaitExpression" || r.type === "BinaryExpression" || r.type === "ConditionalExpression" || r.type === "LogicalExpression" || r.type === "NewExpression" || r.type === "ObjectExpression" || r.type === "SequenceExpression" || r.type === "TaggedTemplateExpression" || r.type === "UnaryExpression" || r.type === "UpdateExpression" || r.type === "YieldExpression" || r.type === "TSNonNullExpression" || r.type === "ClassExpression" && O(r.decorators))) return true; - break; - case "ExportDefaultDeclaration": - return Di(e, t2) || r.type === "SequenceExpression"; - case "Decorator": - if (n === "expression" && !fc(r)) return true; - break; - case "TypeAnnotation": - if (e.match(void 0, void 0, (c, A2) => A2 === "returnType" && c.type === "ArrowFunctionExpression") && mc(r)) return true; - break; - case "BinaryExpression": - if (n === "left" && (s.operator === "in" || s.operator === "instanceof") && r.type === "UnaryExpression") return true; - break; - case "VariableDeclarator": - if (n === "init" && e.match(void 0, void 0, (c, A2) => A2 === "declarations" && c.type === "VariableDeclaration", (c, A2) => A2 === "left" && c.type === "ForInStatement")) return true; - break; + return e.resolved = s, s; } - switch (r.type) { - case "UpdateExpression": - if (s.type === "UnaryExpression") return r.prefix && (r.operator === "++" && s.operator === "+" || r.operator === "--" && s.operator === "-"); - case "UnaryExpression": - switch (s.type) { - case "UnaryExpression": - return r.operator === s.operator && (r.operator === "+" || r.operator === "-"); - case "BindExpression": - return true; - case "MemberExpression": - case "OptionalMemberExpression": - return n === "object"; - case "TaggedTemplateExpression": - return true; - case "NewExpression": - case "CallExpression": - case "OptionalCallExpression": - return n === "callee"; - case "BinaryExpression": - return n === "left" && s.operator === "**"; - case "TSNonNullExpression": - return true; + function Vo(t2, e) { + let n = [], r = []; + for (let s = 0; s < e.items.length; ++s) { + let i = e.items[s]; + switch (i.type) { + case p.Type.BLANK_LINE: + n.push({ before: r.length }); + break; + case p.Type.COMMENT: + n.push({ comment: i.comment, before: r.length }); + break; + case p.Type.SEQ_ITEM: + if (i.error && t2.errors.push(i.error), r.push(pe(t2, i.node)), i.hasProps) { + let o = "Sequence items cannot have tags or anchors before the - indicator"; + t2.errors.push(new p.YAMLSemanticError(i, o)); + } + break; default: - return false; - } - case "BinaryExpression": - if (s.type === "UpdateExpression" || r.operator === "in" && lc(e)) return true; - if (r.operator === "|>" && ((p = r.extra) != null && p.parenthesized)) { - let c = e.grandparent; - if (c.type === "BinaryExpression" && c.operator === "|>") return true; + i.error && t2.errors.push(i.error), t2.errors.push(new p.YAMLSyntaxError(i, `Unexpected ${i.type} node in sequence`)); } - case "TSTypeAssertion": - case "TSAsExpression": - case "TSSatisfiesExpression": - case "AsExpression": - case "AsConstExpression": - case "SatisfiesExpression": - case "LogicalExpression": - switch (s.type) { - case "TSAsExpression": - case "TSSatisfiesExpression": - case "AsExpression": - case "AsConstExpression": - case "SatisfiesExpression": - return !Ae(r); - case "ConditionalExpression": - return Ae(r) || cu(r); - case "CallExpression": - case "NewExpression": - case "OptionalCallExpression": - return n === "callee"; - case "ClassExpression": - case "ClassDeclaration": - return n === "superClass"; - case "TSTypeAssertion": - case "TaggedTemplateExpression": - case "UnaryExpression": - case "JSXSpreadAttribute": - case "SpreadElement": - case "BindExpression": - case "AwaitExpression": - case "TSNonNullExpression": - case "UpdateExpression": - return true; - case "MemberExpression": - case "OptionalMemberExpression": - return n === "object"; - case "AssignmentExpression": - case "AssignmentPattern": - return n === "left" && (r.type === "TSTypeAssertion" || Ae(r)); - case "LogicalExpression": - if (r.type === "LogicalExpression") return s.operator !== r.operator; - case "BinaryExpression": { - let { operator: c, type: A2 } = r; - if (!c && A2 !== "TSTypeAssertion") return true; - let d = rr(c), S = s.operator, g = rr(S); - return g > d || n === "right" && g === d || g === d && !ur(S, c) ? true : g < d && c === "%" ? S === "+" || S === "-" : !!Eu(S); + } + return { comments: n, items: r }; + } + function Wo(t2, e) { + let n = [], r = [], s = false, i, o = null, a2 = "[", c = null; + for (let l = 0; l < e.items.length; ++l) { + let f2 = e.items[l]; + if (typeof f2.char == "string") { + let { char: m, offset: g } = f2; + if (m !== ":" && (s || i !== void 0) && (s && i === void 0 && (i = a2 ? r.pop() : null), r.push(new T(i)), s = false, i = void 0, o = null), m === a2) a2 = null; + else if (!a2 && m === "?") s = true; + else if (a2 !== "[" && m === ":" && i === void 0) { + if (a2 === ",") { + if (i = r.pop(), i instanceof T) { + let y = "Chaining flow sequence pairs is invalid", h = new p.YAMLSemanticError(e, y); + h.offset = g, t2.errors.push(h); + } + if (!s && typeof o == "number") { + let y = f2.range ? f2.range.start : f2.offset; + y > o + 1024 && t2.errors.push(rs(e, i)); + let { src: h } = c.context; + for (let d = o; d < y; ++d) if (h[d] === ` +`) { + let w = "Implicit keys of flow sequence pairs need to be on a single line"; + t2.errors.push(new p.YAMLSemanticError(c, w)); + break; + } + } + } else i = null; + o = null, s = false, a2 = null; + } else if (a2 === "[" || m !== "]" || l < e.items.length - 1) { + let y = `Flow sequence contains an unexpected ${m}`, h = new p.YAMLSyntaxError(e, y); + h.offset = g, t2.errors.push(h); } - default: - return false; - } - case "SequenceExpression": - switch (s.type) { - case "ReturnStatement": - return false; - case "ForStatement": - return false; - case "ExpressionStatement": - return n !== "expression"; - case "ArrowFunctionExpression": - return n !== "body"; - default: - return true; - } - case "YieldExpression": - if (s.type === "AwaitExpression" || s.type === "TSTypeAssertion") return true; - case "AwaitExpression": - switch (s.type) { - case "TaggedTemplateExpression": - case "UnaryExpression": - case "LogicalExpression": - case "SpreadElement": - case "TSAsExpression": - case "TSSatisfiesExpression": - case "TSNonNullExpression": - case "AsExpression": - case "AsConstExpression": - case "SatisfiesExpression": - case "BindExpression": - return true; - case "MemberExpression": - case "OptionalMemberExpression": - return n === "object"; - case "NewExpression": - case "CallExpression": - case "OptionalCallExpression": - return n === "callee"; - case "ConditionalExpression": - return n === "test"; - case "BinaryExpression": - return !(!r.argument && s.operator === "|>"); - default: - return false; - } - case "TSFunctionType": - if (e.match((c) => c.type === "TSFunctionType", (c, A2) => A2 === "typeAnnotation" && c.type === "TSTypeAnnotation", (c, A2) => A2 === "returnType" && c.type === "ArrowFunctionExpression")) return true; - case "TSConditionalType": - case "TSConstructorType": - if (n === "extendsType" && s.type === "TSConditionalType") { - if (r.type === "TSConditionalType") return true; - let { typeAnnotation: c } = r.returnType || r.typeAnnotation; - if (c.type === "TSTypePredicate" && c.typeAnnotation && (c = c.typeAnnotation.typeAnnotation), c.type === "TSInferType" && c.typeParameter.constraint) return true; - } - if (n === "checkType" && s.type === "TSConditionalType") return true; - case "TSUnionType": - case "TSIntersectionType": - if ((s.type === "TSUnionType" || s.type === "TSIntersectionType") && s.types.length > 1 && (!r.types || r.types.length > 1)) return true; - case "TSInferType": - if (r.type === "TSInferType") { - if (s.type === "TSRestType") return false; - if (n === "types" && (s.type === "TSUnionType" || s.type === "TSIntersectionType") && r.typeParameter.type === "TSTypeParameter" && r.typeParameter.constraint) return true; + } else if (f2.type === p.Type.BLANK_LINE) n.push({ before: r.length }); + else if (f2.type === p.Type.COMMENT) ns(t2.errors, f2), n.push({ comment: f2.comment, before: r.length }); + else { + if (a2) { + let g = `Expected a ${a2} in flow sequence`; + t2.errors.push(new p.YAMLSemanticError(f2, g)); + } + let m = pe(t2, f2); + i === void 0 ? (r.push(m), c = f2) : (r.push(new T(i, m)), i = void 0), o = f2.range.start, a2 = ","; } - case "TSTypeOperator": - return s.type === "TSArrayType" || s.type === "TSOptionalType" || s.type === "TSRestType" || n === "objectType" && s.type === "TSIndexedAccessType" || s.type === "TSTypeOperator" || s.type === "TSTypeAnnotation" && e.grandparent.type.startsWith("TSJSDoc"); - case "TSTypeQuery": - return n === "objectType" && s.type === "TSIndexedAccessType" || n === "elementType" && s.type === "TSArrayType"; - case "TypeOperator": - return s.type === "ArrayTypeAnnotation" || s.type === "NullableTypeAnnotation" || n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType") || s.type === "TypeOperator"; - case "TypeofTypeAnnotation": - return n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType") || n === "elementType" && s.type === "ArrayTypeAnnotation"; - case "ArrayTypeAnnotation": - return s.type === "NullableTypeAnnotation"; - case "IntersectionTypeAnnotation": - case "UnionTypeAnnotation": - return s.type === "TypeOperator" || s.type === "ArrayTypeAnnotation" || s.type === "NullableTypeAnnotation" || s.type === "IntersectionTypeAnnotation" || s.type === "UnionTypeAnnotation" || n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType"); - case "InferTypeAnnotation": - case "NullableTypeAnnotation": - return s.type === "ArrayTypeAnnotation" || n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType"); - case "ComponentTypeAnnotation": - case "FunctionTypeAnnotation": { - if (r.type === "ComponentTypeAnnotation" && (r.rendersType === null || r.rendersType === void 0)) return false; - if (e.match(void 0, (A2, d) => d === "typeAnnotation" && A2.type === "TypeAnnotation", (A2, d) => d === "returnType" && A2.type === "ArrowFunctionExpression") || e.match(void 0, (A2, d) => d === "typeAnnotation" && A2.type === "TypePredicate", (A2, d) => d === "typeAnnotation" && A2.type === "TypeAnnotation", (A2, d) => d === "returnType" && A2.type === "ArrowFunctionExpression")) return true; - let c = s.type === "NullableTypeAnnotation" ? e.grandparent : s; - return c.type === "UnionTypeAnnotation" || c.type === "IntersectionTypeAnnotation" || c.type === "ArrayTypeAnnotation" || n === "objectType" && (c.type === "IndexedAccessType" || c.type === "OptionalIndexedAccessType") || n === "checkType" && s.type === "ConditionalTypeAnnotation" || n === "extendsType" && s.type === "ConditionalTypeAnnotation" && ((y = r.returnType) == null ? void 0 : y.type) === "InferTypeAnnotation" && ((D = r.returnType) == null ? void 0 : D.typeParameter.bound) || c.type === "NullableTypeAnnotation" || s.type === "FunctionTypeParam" && s.name === null && z(r).some((A2) => { - var d; - return ((d = A2.typeAnnotation) == null ? void 0 : d.type) === "NullableTypeAnnotation"; - }); } - case "ConditionalTypeAnnotation": - if (n === "extendsType" && s.type === "ConditionalTypeAnnotation" && r.type === "ConditionalTypeAnnotation" || n === "checkType" && s.type === "ConditionalTypeAnnotation") return true; - case "OptionalIndexedAccessType": - return n === "objectType" && s.type === "IndexedAccessType"; - case "StringLiteral": - case "NumericLiteral": - case "Literal": - if (typeof r.value == "string" && s.type === "ExpressionStatement" && !s.directive) { - let c = e.grandparent; - return c.type === "Program" || c.type === "BlockStatement"; - } - return n === "object" && s.type === "MemberExpression" && typeof r.value == "number"; - case "AssignmentExpression": { - let c = e.grandparent; - return n === "body" && s.type === "ArrowFunctionExpression" ? true : n === "key" && (s.type === "ClassProperty" || s.type === "PropertyDefinition") && s.computed || (n === "init" || n === "update") && s.type === "ForStatement" ? false : s.type === "ExpressionStatement" ? r.left.type === "ObjectPattern" : !(n === "key" && s.type === "TSPropertySignature" || s.type === "AssignmentExpression" || s.type === "SequenceExpression" && c.type === "ForStatement" && (c.init === s || c.update === s) || n === "value" && s.type === "Property" && c.type === "ObjectPattern" && c.properties.includes(s) || s.type === "NGChainedExpression" || n === "node" && s.type === "JsExpressionRoot"); + return ts(t2.errors, e), i !== void 0 && r.push(new T(i)), { comments: n, items: r }; + } + M.Alias = we; + M.Collection = Q; + M.Merge = Yt; + M.Node = j; + M.Pair = T; + M.Scalar = x; + M.YAMLMap = ct; + M.YAMLSeq = ue; + M.addComment = Re; + M.binaryOptions = No; + M.boolOptions = Oo; + M.findPair = at; + M.intOptions = Ao; + M.isEmptyPath = Xr; + M.nullOptions = Lo; + M.resolveMap = $o; + M.resolveNode = pe; + M.resolveSeq = Uo; + M.resolveString = Dn; + M.strOptions = be; + M.stringifyNumber = ko; + M.stringifyString = Mo; + M.toJSON = fe; + }); + var Fn = ne((ee) => { + "use strict"; + var G = ce(), O = De(), Ko = { identify: (t2) => t2 instanceof Uint8Array, default: false, tag: "tag:yaml.org,2002:binary", resolve: (t2, e) => { + let n = O.resolveString(t2, e); + if (typeof Buffer == "function") return Buffer.from(n, "base64"); + if (typeof atob == "function") { + let r = atob(n.replace(/[\n\r]/g, "")), s = new Uint8Array(r.length); + for (let i = 0; i < r.length; ++i) s[i] = r.charCodeAt(i); + return s; + } else { + let r = "This environment does not support reading binary tags; either Buffer or atob is required"; + return t2.errors.push(new G.YAMLReferenceError(e, r)), null; } - case "ConditionalExpression": - switch (s.type) { - case "TaggedTemplateExpression": - case "UnaryExpression": - case "SpreadElement": - case "BinaryExpression": - case "LogicalExpression": - case "NGPipeExpression": - case "ExportDefaultDeclaration": - case "AwaitExpression": - case "JSXSpreadAttribute": - case "TSTypeAssertion": - case "TypeCastExpression": - case "TSAsExpression": - case "TSSatisfiesExpression": - case "AsExpression": - case "AsConstExpression": - case "SatisfiesExpression": - case "TSNonNullExpression": - return true; - case "NewExpression": - case "CallExpression": - case "OptionalCallExpression": - return n === "callee"; - case "ConditionalExpression": - return t2.experimentalTernaries ? false : n === "test"; - case "MemberExpression": - case "OptionalMemberExpression": - return n === "object"; - default: - return false; - } - case "FunctionExpression": - switch (s.type) { - case "NewExpression": - case "CallExpression": - case "OptionalCallExpression": - return n === "callee"; - case "TaggedTemplateExpression": - return true; - default: - return false; - } - case "ArrowFunctionExpression": - switch (s.type) { - case "BinaryExpression": - return s.operator !== "|>" || ((m = r.extra) == null ? void 0 : m.parenthesized); - case "NewExpression": - case "CallExpression": - case "OptionalCallExpression": - return n === "callee"; - case "MemberExpression": - case "OptionalMemberExpression": - return n === "object"; - case "TSAsExpression": - case "TSSatisfiesExpression": - case "AsExpression": - case "AsConstExpression": - case "SatisfiesExpression": - case "TSNonNullExpression": - case "BindExpression": - case "TaggedTemplateExpression": - case "UnaryExpression": - case "LogicalExpression": - case "AwaitExpression": - case "TSTypeAssertion": - return true; - case "ConditionalExpression": - return n === "test"; - default: - return false; - } - case "ClassExpression": - switch (s.type) { - case "NewExpression": - return n === "callee"; - default: - return false; - } - case "OptionalMemberExpression": - case "OptionalCallExpression": - case "CallExpression": - case "MemberExpression": - if (Dc(e)) return true; - case "TaggedTemplateExpression": - case "TSNonNullExpression": - if (n === "callee" && (s.type === "BindExpression" || s.type === "NewExpression")) { - let c = r; - for (; c; ) switch (c.type) { - case "CallExpression": - case "OptionalCallExpression": - return true; - case "MemberExpression": - case "OptionalMemberExpression": - case "BindExpression": - c = c.object; - break; - case "TaggedTemplateExpression": - c = c.tag; - break; - case "TSNonNullExpression": - c = c.expression; - break; - default: - return false; + }, options: O.binaryOptions, stringify: ({ comment: t2, type: e, value: n }, r, s, i) => { + let o; + if (typeof Buffer == "function") o = n instanceof Buffer ? n.toString("base64") : Buffer.from(n.buffer).toString("base64"); + else if (typeof btoa == "function") { + let a2 = ""; + for (let c = 0; c < n.length; ++c) a2 += String.fromCharCode(n[c]); + o = btoa(a2); + } else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required"); + if (e || (e = O.binaryOptions.defaultType), e === G.Type.QUOTE_DOUBLE) n = o; + else { + let { lineWidth: a2 } = O.binaryOptions, c = Math.ceil(o.length / a2), l = new Array(c); + for (let f2 = 0, m = 0; f2 < c; ++f2, m += a2) l[f2] = o.substr(m, a2); + n = l.join(e === G.Type.BLOCK_LITERAL ? ` +` : " "); + } + return O.stringifyString({ comment: t2, type: e, value: n }, r, s, i); + } }; + function os(t2, e) { + let n = O.resolveSeq(t2, e); + for (let r = 0; r < n.items.length; ++r) { + let s = n.items[r]; + if (!(s instanceof O.Pair)) { + if (s instanceof O.YAMLMap) { + if (s.items.length > 1) { + let o = "Each pair must have its own sequence indicator"; + throw new G.YAMLSemanticError(e, o); + } + let i = s.items[0] || new O.Pair(); + s.commentBefore && (i.commentBefore = i.commentBefore ? `${s.commentBefore} +${i.commentBefore}` : s.commentBefore), s.comment && (i.comment = i.comment ? `${s.comment} +${i.comment}` : s.comment), s = i; } + n.items[r] = s instanceof O.Pair ? s : new O.Pair(s); } - return false; - case "BindExpression": - return n === "callee" && (s.type === "BindExpression" || s.type === "NewExpression") || n === "object" && W(s); - case "NGPipeExpression": - return !(s.type === "NGRoot" || s.type === "NGMicrosyntaxExpression" || s.type === "ObjectProperty" && !((C = r.extra) != null && C.parenthesized) || Y(s) || n === "arguments" && L(s) || n === "right" && s.type === "NGPipeExpression" || n === "property" && s.type === "MemberExpression" || s.type === "AssignmentExpression"); - case "JSXFragment": - case "JSXElement": - return n === "callee" || n === "left" && s.type === "BinaryExpression" && s.operator === "<" || !Y(s) && s.type !== "ArrowFunctionExpression" && s.type !== "AssignmentExpression" && s.type !== "AssignmentPattern" && s.type !== "BinaryExpression" && s.type !== "NewExpression" && s.type !== "ConditionalExpression" && s.type !== "ExpressionStatement" && s.type !== "JsExpressionRoot" && s.type !== "JSXAttribute" && s.type !== "JSXElement" && s.type !== "JSXExpressionContainer" && s.type !== "JSXFragment" && s.type !== "LogicalExpression" && !L(s) && !Ce(s) && s.type !== "ReturnStatement" && s.type !== "ThrowStatement" && s.type !== "TypeCastExpression" && s.type !== "VariableDeclarator" && s.type !== "YieldExpression"; - case "TSInstantiationExpression": - return n === "object" && W(s); - } - return false; - } - var cc = R(["BlockStatement", "BreakStatement", "ComponentDeclaration", "ClassBody", "ClassDeclaration", "ClassMethod", "ClassProperty", "PropertyDefinition", "ClassPrivateProperty", "ContinueStatement", "DebuggerStatement", "DeclareComponent", "DeclareClass", "DeclareExportAllDeclaration", "DeclareExportDeclaration", "DeclareFunction", "DeclareHook", "DeclareInterface", "DeclareModule", "DeclareModuleExports", "DeclareNamespace", "DeclareVariable", "DeclareEnum", "DoWhileStatement", "EnumDeclaration", "ExportAllDeclaration", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ExpressionStatement", "ForInStatement", "ForOfStatement", "ForStatement", "FunctionDeclaration", "HookDeclaration", "IfStatement", "ImportDeclaration", "InterfaceDeclaration", "LabeledStatement", "MethodDefinition", "ReturnStatement", "SwitchStatement", "ThrowStatement", "TryStatement", "TSDeclareFunction", "TSEnumDeclaration", "TSImportEqualsDeclaration", "TSInterfaceDeclaration", "TSModuleDeclaration", "TSNamespaceExportDeclaration", "TypeAlias", "VariableDeclaration", "WhileStatement", "WithStatement"]); - function lc(e) { - let t2 = 0, { node: r } = e; - for (; r; ) { - let n = e.getParentNode(t2++); - if ((n == null ? void 0 : n.type) === "ForStatement" && n.init === r) return true; - r = n; - } - return false; - } - function mc(e) { - return nr(e, (t2) => t2.type === "ObjectTypeAnnotation" && nr(t2, (r) => r.type === "FunctionTypeAnnotation")); - } - function yc(e) { - return se(e); - } - function lr(e) { - let { parent: t2, key: r } = e; - switch (t2.type) { - case "NGPipeExpression": - if (r === "arguments" && e.isLast) return e.callParent(lr); - break; - case "ObjectProperty": - if (r === "value") return e.callParent(() => e.key === "properties" && e.isLast); - break; - case "BinaryExpression": - case "LogicalExpression": - if (r === "right") return e.callParent(lr); - break; - case "ConditionalExpression": - if (r === "alternate") return e.callParent(lr); - break; - case "UnaryExpression": - if (t2.prefix) return e.callParent(lr); - break; + } + return n; } - return false; - } - function Di(e, t2) { - let { node: r, parent: n } = e; - return r.type === "FunctionExpression" || r.type === "ClassExpression" ? n.type === "ExportDefaultDeclaration" || !os(e, t2) : !Rt(r) || n.type !== "ExportDefaultDeclaration" && os(e, t2) ? false : e.call(() => Di(e, t2), ...kr(r)); - } - function Dc(e) { - return !!(e.match(void 0, (t2, r) => r === "expression" && t2.type === "ChainExpression", (t2, r) => r === "tag" && t2.type === "TaggedTemplateExpression") || e.match((t2) => t2.type === "OptionalCallExpression" || t2.type === "OptionalMemberExpression", (t2, r) => r === "tag" && t2.type === "TaggedTemplateExpression") || e.match((t2) => t2.type === "OptionalCallExpression" || t2.type === "OptionalMemberExpression", (t2, r) => r === "expression" && t2.type === "TSNonNullExpression", (t2, r) => r === "tag" && t2.type === "TaggedTemplateExpression") || e.match(void 0, (t2, r) => r === "expression" && t2.type === "ChainExpression", (t2, r) => r === "expression" && t2.type === "TSNonNullExpression", (t2, r) => r === "tag" && t2.type === "TaggedTemplateExpression") || e.match(void 0, (t2, r) => r === "expression" && t2.type === "TSNonNullExpression", (t2, r) => r === "expression" && t2.type === "ChainExpression", (t2, r) => r === "tag" && t2.type === "TaggedTemplateExpression") || e.match((t2) => t2.type === "OptionalMemberExpression" || t2.type === "OptionalCallExpression", (t2, r) => r === "object" && t2.type === "MemberExpression" || r === "callee" && (t2.type === "CallExpression" || t2.type === "NewExpression")) || e.match((t2) => t2.type === "OptionalMemberExpression" || t2.type === "OptionalCallExpression", (t2, r) => r === "expression" && t2.type === "TSNonNullExpression", (t2, r) => r === "object" && t2.type === "MemberExpression" || r === "callee" && t2.type === "CallExpression") || e.match((t2) => t2.type === "CallExpression" || t2.type === "MemberExpression", (t2, r) => r === "expression" && t2.type === "ChainExpression") && (e.match(void 0, void 0, (t2, r) => r === "callee" && (t2.type === "CallExpression" && !t2.optional || t2.type === "NewExpression") || r === "object" && t2.type === "MemberExpression" && !t2.optional) || e.match(void 0, void 0, (t2, r) => r === "expression" && t2.type === "TSNonNullExpression", (t2, r) => r === "object" && t2.type === "MemberExpression" || r === "callee" && t2.type === "CallExpression")) || e.match((t2) => t2.type === "CallExpression" || t2.type === "MemberExpression", (t2, r) => r === "expression" && t2.type === "TSNonNullExpression", (t2, r) => r === "expression" && t2.type === "ChainExpression", (t2, r) => r === "object" && t2.type === "MemberExpression" || r === "callee" && t2.type === "CallExpression")); - } - function ps(e) { - return e.type === "Identifier" ? true : W(e) ? !e.computed && !e.optional && e.property.type === "Identifier" && ps(e.object) : false; - } - function fc(e) { - return e.type === "ChainExpression" && (e = e.expression), ps(e) || L(e) && !e.optional && ps(e.callee); - } - var ke = os; - function Ec(e, t2) { - let r = t2 - 1; - r = Ye(e, r, { backwards: true }), r = Ne(e, r, { backwards: true }), r = Ye(e, r, { backwards: true }); - let n = Ne(e, r, { backwards: true }); - return r !== n; - } - var fi = Ec; - var Fc = () => true; - function cs(e, t2) { - let r = e.node; - return r.printed = true, t2.printer.printComment(e, t2); - } - function Cc(e, t2) { - var y; - let r = e.node, n = [cs(e, t2)], { printer: s, originalText: u, locStart: i, locEnd: a2 } = t2; - if ((y = s.isBlockComment) == null ? void 0 : y.call(s, r)) { - let D = Z(u, a2(r)) ? Z(u, i(r), { backwards: true }) ? F : x : " "; - n.push(D); - } else n.push(F); - let p = Ne(u, Ye(u, a2(r))); - return p !== false && Z(u, p) && n.push(F), n; - } - function Ac(e, t2, r) { - var p; - let n = e.node, s = cs(e, t2), { printer: u, originalText: i, locStart: a2 } = t2, o = (p = u.isBlockComment) == null ? void 0 : p.call(u, n); - if (r != null && r.hasLineSuffix && !(r != null && r.isBlock) || Z(i, a2(n), { backwards: true })) { - let y = fi(i, a2(n)); - return { doc: Yn([F, y ? F : "", s]), isBlock: o, hasLineSuffix: true }; - } - return !o || r != null && r.hasLineSuffix ? { doc: [Yn([" ", s]), Ee], isBlock: o, hasLineSuffix: true } : { doc: [" ", s], isBlock: o, hasLineSuffix: false }; - } - function J(e, t2, r = {}) { - let { node: n } = e; - if (!O(n == null ? void 0 : n.comments)) return ""; - let { indent: s = false, marker: u, filter: i = Fc } = r, a2 = []; - if (e.each(({ node: p }) => { - p.leading || p.trailing || p.marker !== u || !i(p) || a2.push(cs(e, t2)); - }, "comments"), a2.length === 0) return ""; - let o = b(F, a2); - return s ? f2([F, o]) : o; - } - function ls(e, t2) { - let r = e.node; - if (!r) return {}; - let n = t2[/* @__PURE__ */ Symbol.for("printedComments")]; - if ((r.comments || []).filter((o) => !n.has(o)).length === 0) return { leading: "", trailing: "" }; - let u = [], i = [], a2; - return e.each(() => { - let o = e.node; - if (n != null && n.has(o)) return; - let { leading: p, trailing: y } = o; - p ? u.push(Cc(e, t2)) : y && (a2 = Ac(e, t2, a2), i.push(a2.doc)); - }, "comments"), { leading: u, trailing: i }; - } - function ye(e, t2, r) { - let { leading: n, trailing: s } = ls(e, r); - return !n && !s ? t2 : pr(t2, (u) => [n, u, s]); - } - var ms = class extends Error { - constructor(t2, r, n = "type") { - super(`Unexpected ${r} node ${n}: ${JSON.stringify(t2[n])}.`); - __publicField(this, "name", "UnexpectedNodeError"); - this.node = t2; + function as(t2, e, n) { + let r = new O.YAMLSeq(t2); + r.tag = "tag:yaml.org,2002:pairs"; + for (let s of e) { + let i, o; + if (Array.isArray(s)) if (s.length === 2) i = s[0], o = s[1]; + else throw new TypeError(`Expected [key, value] tuple: ${s}`); + else if (s && s instanceof Object) { + let c = Object.keys(s); + if (c.length === 1) i = c[0], o = s[i]; + else throw new TypeError(`Expected { key: value } tuple: ${s}`); + } else i = s; + let a2 = t2.createPair(i, o, n); + r.items.push(a2); + } + return r; } - }, qe = ms; - function ys(e) { - if (typeof e != "string") throw new TypeError("Expected a string"); - return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"); - } - var We, Ds = class { - constructor(t2) { - Us(this, We); - Ys(this, We, new Set(t2)); + var jo = { default: false, tag: "tag:yaml.org,2002:pairs", resolve: os, createNode: as }, $e = class t2 extends O.YAMLSeq { + constructor() { + super(), G._defineProperty(this, "add", O.YAMLMap.prototype.add.bind(this)), G._defineProperty(this, "delete", O.YAMLMap.prototype.delete.bind(this)), G._defineProperty(this, "get", O.YAMLMap.prototype.get.bind(this)), G._defineProperty(this, "has", O.YAMLMap.prototype.has.bind(this)), G._defineProperty(this, "set", O.YAMLMap.prototype.set.bind(this)), this.tag = t2.tag; + } + toJSON(e, n) { + let r = /* @__PURE__ */ new Map(); + n && n.onCreate && n.onCreate(r); + for (let s of this.items) { + let i, o; + if (s instanceof O.Pair ? (i = O.toJSON(s.key, "", n), o = O.toJSON(s.value, i, n)) : i = O.toJSON(s, "", n), r.has(i)) throw new Error("Ordered maps must not include duplicate keys"); + r.set(i, o); + } + return r; + } + }; + G._defineProperty($e, "tag", "tag:yaml.org,2002:omap"); + function Qo(t2, e) { + let n = os(t2, e), r = []; + for (let { key: s } of n.items) if (s instanceof O.Scalar) if (r.includes(s.value)) { + let i = "Ordered maps must not include duplicate keys"; + throw new G.YAMLSemanticError(e, i); + } else r.push(s.value); + return Object.assign(new $e(), n); } - getLeadingWhitespaceCount(t2) { - let r = pt(this, We), n = 0; - for (let s = 0; s < t2.length && r.has(t2.charAt(s)); s++) n++; - return n; + function Go(t2, e, n) { + let r = as(t2, e, n), s = new $e(); + return s.items = r.items, s; } - getTrailingWhitespaceCount(t2) { - let r = pt(this, We), n = 0; - for (let s = t2.length - 1; s >= 0 && r.has(t2.charAt(s)); s--) n++; - return n; + var Ho = { identify: (t2) => t2 instanceof Map, nodeClass: $e, default: false, tag: "tag:yaml.org,2002:omap", resolve: Qo, createNode: Go }, Ye = class t2 extends O.YAMLMap { + constructor() { + super(), this.tag = t2.tag; + } + add(e) { + let n = e instanceof O.Pair ? e : new O.Pair(e); + O.findPair(this.items, n.key) || this.items.push(n); + } + get(e, n) { + let r = O.findPair(this.items, e); + return !n && r instanceof O.Pair ? r.key instanceof O.Scalar ? r.key.value : r.key : r; + } + set(e, n) { + if (typeof n != "boolean") throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`); + let r = O.findPair(this.items, e); + r && !n ? this.items.splice(this.items.indexOf(r), 1) : !r && n && this.items.push(new O.Pair(e)); + } + toJSON(e, n) { + return super.toJSON(e, n, Set); + } + toString(e, n, r) { + if (!e) return JSON.stringify(this); + if (this.hasAllNullValues()) return super.toString(e, n, r); + throw new Error("Set items must all have null values"); + } + }; + G._defineProperty(Ye, "tag", "tag:yaml.org,2002:set"); + function Jo(t2, e) { + let n = O.resolveMap(t2, e); + if (!n.hasAllNullValues()) throw new G.YAMLSemanticError(e, "Set items must all have null values"); + return Object.assign(new Ye(), n); } - getLeadingWhitespace(t2) { - let r = this.getLeadingWhitespaceCount(t2); - return t2.slice(0, r); + function Xo(t2, e, n) { + let r = new Ye(); + for (let s of e) r.items.push(t2.createPair(s, null, n)); + return r; } - getTrailingWhitespace(t2) { - let r = this.getTrailingWhitespaceCount(t2); - return t2.slice(t2.length - r); + var zo = { identify: (t2) => t2 instanceof Set, nodeClass: Ye, default: false, tag: "tag:yaml.org,2002:set", resolve: Jo, createNode: Xo }, $n = (t2, e) => { + let n = e.split(":").reduce((r, s) => r * 60 + Number(s), 0); + return t2 === "-" ? -n : n; + }, cs = ({ value: t2 }) => { + if (isNaN(t2) || !isFinite(t2)) return O.stringifyNumber(t2); + let e = ""; + t2 < 0 && (e = "-", t2 = Math.abs(t2)); + let n = [t2 % 60]; + return t2 < 60 ? n.unshift(0) : (t2 = Math.round((t2 - n[0]) / 60), n.unshift(t2 % 60), t2 >= 60 && (t2 = Math.round((t2 - n[0]) / 60), n.unshift(t2))), e + n.map((r) => r < 10 ? "0" + String(r) : String(r)).join(":").replace(/000000\d*$/, ""); + }, Zo = { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:int", format: "TIME", test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/, resolve: (t2, e, n) => $n(e, n.replace(/_/g, "")), stringify: cs }, ea = { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", format: "TIME", test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/, resolve: (t2, e, n) => $n(e, n.replace(/_/g, "")), stringify: cs }, ta = { identify: (t2) => t2 instanceof Date, default: true, tag: "tag:yaml.org,2002:timestamp", test: RegExp("^(?:([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?)$"), resolve: (t2, e, n, r, s, i, o, a2, c) => { + a2 && (a2 = (a2 + "00").substr(1, 3)); + let l = Date.UTC(e, n - 1, r, s || 0, i || 0, o || 0, a2 || 0); + if (c && c !== "Z") { + let f2 = $n(c[0], c.slice(1)); + Math.abs(f2) < 30 && (f2 *= 60), l -= 6e4 * f2; + } + return new Date(l); + }, stringify: ({ value: t2 }) => t2.toISOString().replace(/((T00:00)?:00)?\.000Z$/, "") }; + function Yn(t2) { + let e = {}; + return t2 ? typeof YAML_SILENCE_DEPRECATION_WARNINGS < "u" ? !YAML_SILENCE_DEPRECATION_WARNINGS : !e.YAML_SILENCE_DEPRECATION_WARNINGS : typeof YAML_SILENCE_WARNINGS < "u" ? !YAML_SILENCE_WARNINGS : !e.YAML_SILENCE_WARNINGS; } - hasLeadingWhitespace(t2) { - return pt(this, We).has(t2.charAt(0)); + function Bn(t2, e) { + Yn(false) && console.warn(e ? `${e}: ${t2}` : t2); } - hasTrailingWhitespace(t2) { - return pt(this, We).has(M(false, t2, -1)); + function na(t2) { + if (Yn(true)) { + let e = t2.replace(/.*yaml[/\\]/i, "").replace(/\.js$/, "").replace(/\\/g, "/"); + Bn(`The endpoint 'yaml/${e}' will be removed in a future release.`, "DeprecationWarning"); + } } - trimStart(t2) { - let r = this.getLeadingWhitespaceCount(t2); - return t2.slice(r); + var is = {}; + function ra(t2, e) { + if (!is[t2] && Yn(true)) { + is[t2] = true; + let n = `The option '${t2}' will be removed in a future release`; + n += e ? `, use '${e}' instead.` : ".", Bn(n, "DeprecationWarning"); + } + } + ee.binary = Ko; + ee.floatTime = ea; + ee.intTime = Zo; + ee.omap = Ho; + ee.pairs = jo; + ee.set = zo; + ee.timestamp = ta; + ee.warn = Bn; + ee.warnFileDeprecation = na; + ee.warnOptionDeprecation = ra; + }); + var Wn = ne((bs) => { + "use strict"; + var Vt = ce(), E = De(), $ = Fn(); + function sa(t2, e, n) { + let r = new E.YAMLMap(t2); + if (e instanceof Map) for (let [s, i] of e) r.items.push(t2.createPair(s, i, n)); + else if (e && typeof e == "object") for (let s of Object.keys(e)) r.items.push(t2.createPair(s, e[s], n)); + return typeof t2.sortMapEntries == "function" && r.items.sort(t2.sortMapEntries), r; } - trimEnd(t2) { - let r = this.getTrailingWhitespaceCount(t2); - return t2.slice(0, t2.length - r); + var ft = { createNode: sa, default: true, nodeClass: E.YAMLMap, tag: "tag:yaml.org,2002:map", resolve: E.resolveMap }; + function ia(t2, e, n) { + let r = new E.YAMLSeq(t2); + if (e && e[Symbol.iterator]) for (let s of e) { + let i = t2.createNode(s, n.wrapScalars, null, n); + r.items.push(i); + } + return r; } - trim(t2) { - return this.trimEnd(this.trimStart(t2)); + var Wt = { createNode: ia, default: true, nodeClass: E.YAMLSeq, tag: "tag:yaml.org,2002:seq", resolve: E.resolveSeq }, oa = { identify: (t2) => typeof t2 == "string", default: true, tag: "tag:yaml.org,2002:str", resolve: E.resolveString, stringify(t2, e, n, r) { + return e = Object.assign({ actualString: true }, e), E.stringifyString(t2, e, n, r); + }, options: E.strOptions }, Un = [ft, Wt, oa], Kt = (t2) => typeof t2 == "bigint" || Number.isInteger(t2), Vn = (t2, e, n) => E.intOptions.asBigInt ? BigInt(t2) : parseInt(e, n); + function us(t2, e, n) { + let { value: r } = t2; + return Kt(r) && r >= 0 ? n + r.toString(e) : E.stringifyNumber(t2); } - split(t2, r = false) { - let n = `[${ys([...pt(this, We)].join(""))}]+`, s = new RegExp(r ? `(${n})` : n, "u"); - return t2.split(s); + var ps = { identify: (t2) => t2 == null, createNode: (t2, e, n) => n.wrapScalars ? new E.Scalar(null) : null, default: true, tag: "tag:yaml.org,2002:null", test: /^(?:~|[Nn]ull|NULL)?$/, resolve: () => null, options: E.nullOptions, stringify: () => E.nullOptions.nullStr }, ms = { identify: (t2) => typeof t2 == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/, resolve: (t2) => t2[0] === "t" || t2[0] === "T", options: E.boolOptions, stringify: ({ value: t2 }) => t2 ? E.boolOptions.trueStr : E.boolOptions.falseStr }, hs = { identify: (t2) => Kt(t2) && t2 >= 0, default: true, tag: "tag:yaml.org,2002:int", format: "OCT", test: /^0o([0-7]+)$/, resolve: (t2, e) => Vn(t2, e, 8), options: E.intOptions, stringify: (t2) => us(t2, 8, "0o") }, ds = { identify: Kt, default: true, tag: "tag:yaml.org,2002:int", test: /^[-+]?[0-9]+$/, resolve: (t2) => Vn(t2, t2, 10), options: E.intOptions, stringify: E.stringifyNumber }, gs = { identify: (t2) => Kt(t2) && t2 >= 0, default: true, tag: "tag:yaml.org,2002:int", format: "HEX", test: /^0x([0-9a-fA-F]+)$/, resolve: (t2, e) => Vn(t2, e, 16), options: E.intOptions, stringify: (t2) => us(t2, 16, "0x") }, ys = { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^(?:[-+]?\.inf|(\.nan))$/i, resolve: (t2, e) => e ? NaN : t2[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, stringify: E.stringifyNumber }, Es = { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", format: "EXP", test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/, resolve: (t2) => parseFloat(t2), stringify: ({ value: t2 }) => Number(t2).toExponential() }, Ss = { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/, resolve(t2, e, n) { + let r = e || n, s = new E.Scalar(parseFloat(t2)); + return r && r[r.length - 1] === "0" && (s.minFractionDigits = r.length), s; + }, stringify: E.stringifyNumber }, aa = Un.concat([ps, ms, hs, ds, gs, ys, Es, Ss]), ls = (t2) => typeof t2 == "bigint" || Number.isInteger(t2), qt = ({ value: t2 }) => JSON.stringify(t2), ws = [ft, Wt, { identify: (t2) => typeof t2 == "string", default: true, tag: "tag:yaml.org,2002:str", resolve: E.resolveString, stringify: qt }, { identify: (t2) => t2 == null, createNode: (t2, e, n) => n.wrapScalars ? new E.Scalar(null) : null, default: true, tag: "tag:yaml.org,2002:null", test: /^null$/, resolve: () => null, stringify: qt }, { identify: (t2) => typeof t2 == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^true|false$/, resolve: (t2) => t2 === "true", stringify: qt }, { identify: ls, default: true, tag: "tag:yaml.org,2002:int", test: /^-?(?:0|[1-9][0-9]*)$/, resolve: (t2) => E.intOptions.asBigInt ? BigInt(t2) : parseInt(t2, 10), stringify: ({ value: t2 }) => ls(t2) ? t2.toString() : JSON.stringify(t2) }, { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/, resolve: (t2) => parseFloat(t2), stringify: qt }]; + ws.scalarFallback = (t2) => { + throw new SyntaxError(`Unresolved plain scalar ${JSON.stringify(t2)}`); + }; + var fs = ({ value: t2 }) => t2 ? E.boolOptions.trueStr : E.boolOptions.falseStr, lt = (t2) => typeof t2 == "bigint" || Number.isInteger(t2); + function Ut(t2, e, n) { + let r = e.replace(/_/g, ""); + if (E.intOptions.asBigInt) { + switch (n) { + case 2: + r = `0b${r}`; + break; + case 8: + r = `0o${r}`; + break; + case 16: + r = `0x${r}`; + break; + } + let i = BigInt(r); + return t2 === "-" ? BigInt(-1) * i : i; + } + let s = parseInt(r, n); + return t2 === "-" ? -1 * s : s; } - hasWhitespaceCharacter(t2) { - let r = pt(this, We); - return Array.prototype.some.call(t2, (n) => r.has(n)); + function qn(t2, e, n) { + let { value: r } = t2; + if (lt(r)) { + let s = r.toString(e); + return r < 0 ? "-" + n + s.substr(1) : n + s; + } + return E.stringifyNumber(t2); } - hasNonWhitespaceCharacter(t2) { - let r = pt(this, We); - return Array.prototype.some.call(t2, (n) => !r.has(n)); + var ca = Un.concat([{ identify: (t2) => t2 == null, createNode: (t2, e, n) => n.wrapScalars ? new E.Scalar(null) : null, default: true, tag: "tag:yaml.org,2002:null", test: /^(?:~|[Nn]ull|NULL)?$/, resolve: () => null, options: E.nullOptions, stringify: () => E.nullOptions.nullStr }, { identify: (t2) => typeof t2 == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/, resolve: () => true, options: E.boolOptions, stringify: fs }, { identify: (t2) => typeof t2 == "boolean", default: true, tag: "tag:yaml.org,2002:bool", test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i, resolve: () => false, options: E.boolOptions, stringify: fs }, { identify: lt, default: true, tag: "tag:yaml.org,2002:int", format: "BIN", test: /^([-+]?)0b([0-1_]+)$/, resolve: (t2, e, n) => Ut(e, n, 2), stringify: (t2) => qn(t2, 2, "0b") }, { identify: lt, default: true, tag: "tag:yaml.org,2002:int", format: "OCT", test: /^([-+]?)0([0-7_]+)$/, resolve: (t2, e, n) => Ut(e, n, 8), stringify: (t2) => qn(t2, 8, "0") }, { identify: lt, default: true, tag: "tag:yaml.org,2002:int", test: /^([-+]?)([0-9][0-9_]*)$/, resolve: (t2, e, n) => Ut(e, n, 10), stringify: E.stringifyNumber }, { identify: lt, default: true, tag: "tag:yaml.org,2002:int", format: "HEX", test: /^([-+]?)0x([0-9a-fA-F_]+)$/, resolve: (t2, e, n) => Ut(e, n, 16), stringify: (t2) => qn(t2, 16, "0x") }, { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^(?:[-+]?\.inf|(\.nan))$/i, resolve: (t2, e) => e ? NaN : t2[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, stringify: E.stringifyNumber }, { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", format: "EXP", test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/, resolve: (t2) => parseFloat(t2.replace(/_/g, "")), stringify: ({ value: t2 }) => Number(t2).toExponential() }, { identify: (t2) => typeof t2 == "number", default: true, tag: "tag:yaml.org,2002:float", test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/, resolve(t2, e) { + let n = new E.Scalar(parseFloat(t2.replace(/_/g, ""))); + if (e) { + let r = e.replace(/_/g, ""); + r[r.length - 1] === "0" && (n.minFractionDigits = r.length); + } + return n; + }, stringify: E.stringifyNumber }], $.binary, $.omap, $.pairs, $.set, $.intTime, $.floatTime, $.timestamp), la = { core: aa, failsafe: Un, json: ws, yaml11: ca }, fa = { binary: $.binary, bool: ms, float: Ss, floatExp: Es, floatNaN: ys, floatTime: $.floatTime, int: ds, intHex: gs, intOct: hs, intTime: $.intTime, map: ft, null: ps, omap: $.omap, pairs: $.pairs, seq: Wt, set: $.set, timestamp: $.timestamp }; + function ua(t2, e, n) { + if (e) { + let r = n.filter((i) => i.tag === e), s = r.find((i) => !i.format) || r[0]; + if (!s) throw new Error(`Tag ${e} not found`); + return s; + } + return n.find((r) => (r.identify && r.identify(t2) || r.class && t2 instanceof r.class) && !r.format); } - isWhitespaceOnly(t2) { - let r = pt(this, We); - return Array.prototype.every.call(t2, (n) => r.has(n)); + function pa(t2, e, n) { + if (t2 instanceof E.Node) return t2; + let { defaultPrefix: r, onTagObj: s, prevObjects: i, schema: o, wrapScalars: a2 } = n; + e && e.startsWith("!!") && (e = r + e.slice(2)); + let c = ua(t2, e, o.tags); + if (!c) { + if (typeof t2.toJSON == "function" && (t2 = t2.toJSON()), !t2 || typeof t2 != "object") return a2 ? new E.Scalar(t2) : t2; + c = t2 instanceof Map ? ft : t2[Symbol.iterator] ? Wt : ft; + } + s && (s(c), delete n.onTagObj); + let l = { value: void 0, node: void 0 }; + if (t2 && typeof t2 == "object" && i) { + let f2 = i.get(t2); + if (f2) { + let m = new E.Alias(f2); + return n.aliasNodes.push(m), m; + } + l.value = t2, i.set(t2, l); + } + return l.node = c.createNode ? c.createNode(n.schema, t2, n) : a2 ? new E.Scalar(t2) : t2, e && l.node instanceof E.Node && (l.node.tag = e), l.node; } - }; - We = /* @__PURE__ */ new WeakMap(); - var Ei = Ds; - var Xr = new Ei(` -\r `), fs = (e) => e === "" || e === x || e === F || e === E; - function Tc(e, t2, r) { - var _2, v, j, I, U; - let { node: n } = e; - if (n.type === "JSXElement" && _c(n)) return [r("openingElement"), r("closingElement")]; - let s = n.type === "JSXElement" ? r("openingElement") : r("openingFragment"), u = n.type === "JSXElement" ? r("closingElement") : r("closingFragment"); - if (n.children.length === 1 && n.children[0].type === "JSXExpressionContainer" && (n.children[0].expression.type === "TemplateLiteral" || n.children[0].expression.type === "TaggedTemplateExpression")) return [s, ...e.map(r, "children"), u]; - n.children = n.children.map((P) => vc(P) ? { type: "JSXText", value: " ", raw: " " } : P); - let i = n.children.some(X), a2 = n.children.filter((P) => P.type === "JSXExpressionContainer").length > 1, o = n.type === "JSXElement" && n.openingElement.attributes.length > 1, p = re(s) || i || o || a2, y = e.parent.rootMarker === "mdx", D = t2.singleQuote ? "{' '}" : '{" "}', m = y ? x : B([D, E], " "), C = ((v = (_2 = n.openingElement) == null ? void 0 : _2.name) == null ? void 0 : v.name) === "fbt", c = dc(e, t2, r, m, C), A2 = n.children.some((P) => mr(P)); - for (let P = c.length - 2; P >= 0; P--) { - let G = c[P] === "" && c[P + 1] === "", ue = c[P] === F && c[P + 1] === "" && c[P + 2] === F, Q = (c[P] === E || c[P] === F) && c[P + 1] === "" && c[P + 2] === m, St = c[P] === m && c[P + 1] === "" && (c[P + 2] === E || c[P + 2] === F), Ft = c[P] === m && c[P + 1] === "" && c[P + 2] === m, w = c[P] === E && c[P + 1] === "" && c[P + 2] === F || c[P] === F && c[P + 1] === "" && c[P + 2] === E; - ue && A2 || G || Q || Ft || w ? c.splice(P, 2) : St && c.splice(P + 1, 2); - } - for (; c.length > 0 && fs(M(false, c, -1)); ) c.pop(); - for (; c.length > 1 && fs(c[0]) && fs(c[1]); ) c.shift(), c.shift(); - let d = [""]; - for (let [P, G] of c.entries()) { - if (G === m) { - if (P === 1 && bu(c[P - 1])) { - if (c.length === 2) { - d.push([d.pop(), D]); - continue; + function ma(t2, e, n, r) { + let s = t2[r.replace(/\W/g, "")]; + if (!s) { + let i = Object.keys(t2).map((o) => JSON.stringify(o)).join(", "); + throw new Error(`Unknown schema "${r}"; use one of ${i}`); + } + if (Array.isArray(n)) for (let i of n) s = s.concat(i); + else typeof n == "function" && (s = n(s.slice())); + for (let i = 0; i < s.length; ++i) { + let o = s[i]; + if (typeof o == "string") { + let a2 = e[o]; + if (!a2) { + let c = Object.keys(e).map((l) => JSON.stringify(l)).join(", "); + throw new Error(`Unknown custom tag "${o}"; use one of ${c}`); } - d.push([D, F], ""); - continue; - } else if (P === c.length - 1) { - d.push([d.pop(), D]); - continue; - } else if (c[P - 1] === "" && c[P - 2] === F) { - d.push([d.pop(), D]); - continue; + s[i] = a2; } } - P % 2 === 0 ? d.push([d.pop(), G]) : d.push(G, ""), re(G) && (p = true); - } - let S = A2 ? Jr(d) : l(d, { shouldBreak: true }); - if (((j = t2.cursorNode) == null ? void 0 : j.type) === "JSXText" && n.children.includes(t2.cursorNode) ? S = [cr, S, cr] : ((I = t2.nodeBeforeCursor) == null ? void 0 : I.type) === "JSXText" && n.children.includes(t2.nodeBeforeCursor) ? S = [cr, S] : ((U = t2.nodeAfterCursor) == null ? void 0 : U.type) === "JSXText" && n.children.includes(t2.nodeAfterCursor) && (S = [S, cr]), y) return S; - let g = l([s, f2([F, S]), F, u]); - return p ? g : Ze([l([s, ...c, u]), g]); - } - function dc(e, t2, r, n, s) { - let u = "", i = [u]; - function a2(p) { - u = p, i.push([i.pop(), p]); + return s; } - function o(p) { - p !== "" && (u = p, i.push(p, "")); + var ha = (t2, e) => t2.key < e.key ? -1 : t2.key > e.key ? 1 : 0, ut = class t2 { + constructor({ customTags: e, merge: n, schema: r, sortMapEntries: s, tags: i }) { + this.merge = !!n, this.name = r, this.sortMapEntries = s === true ? ha : s || null, !e && i && $.warnOptionDeprecation("tags", "customTags"), this.tags = ma(la, fa, e || i, r); + } + createNode(e, n, r, s) { + let i = { defaultPrefix: t2.defaultPrefix, schema: this, wrapScalars: n }, o = s ? Object.assign(s, i) : i; + return pa(e, r, o); + } + createPair(e, n, r) { + r || (r = { wrapScalars: true }); + let s = this.createNode(e, r.wrapScalars, null, r), i = this.createNode(n, r.wrapScalars, null, r); + return new E.Pair(s, i); + } + }; + Vt._defineProperty(ut, "defaultPrefix", Vt.defaultTagPrefix); + Vt._defineProperty(ut, "defaultTags", Vt.defaultTags); + bs.Schema = ut; + }); + var Ls = ne((Ht) => { + "use strict"; + var Y = ce(), S = De(), Ns = Wn(), da = { anchorPrefix: "a", customTags: null, indent: 2, indentSeq: true, keepCstNodes: false, keepNodeTypes: true, keepBlobsInJSON: true, mapAsMap: false, maxAliasCount: 100, prettyErrors: false, simpleKeys: false, version: "1.2" }, ga = { get binary() { + return S.binaryOptions; + }, set binary(t2) { + Object.assign(S.binaryOptions, t2); + }, get bool() { + return S.boolOptions; + }, set bool(t2) { + Object.assign(S.boolOptions, t2); + }, get int() { + return S.intOptions; + }, set int(t2) { + Object.assign(S.intOptions, t2); + }, get null() { + return S.nullOptions; + }, set null(t2) { + Object.assign(S.nullOptions, t2); + }, get str() { + return S.strOptions; + }, set str(t2) { + Object.assign(S.strOptions, t2); + } }, As = { "1.0": { schema: "yaml-1.1", merge: true, tagPrefixes: [{ handle: "!", prefix: Y.defaultTagPrefix }, { handle: "!!", prefix: "tag:private.yaml.org,2002:" }] }, 1.1: { schema: "yaml-1.1", merge: true, tagPrefixes: [{ handle: "!", prefix: "!" }, { handle: "!!", prefix: Y.defaultTagPrefix }] }, 1.2: { schema: "core", merge: false, tagPrefixes: [{ handle: "!", prefix: "!" }, { handle: "!!", prefix: Y.defaultTagPrefix }] } }; + function Os(t2, e) { + if ((t2.version || t2.options.version) === "1.0") { + let s = e.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/); + if (s) return "!" + s[1]; + let i = e.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/); + return i ? `!${i[1]}/${i[2]}` : `!${e.replace(/^tag:/, "")}`; + } + let n = t2.tagPrefixes.find((s) => e.indexOf(s.prefix) === 0); + if (!n) { + let s = t2.getDefaults().tagPrefixes; + n = s && s.find((i) => e.indexOf(i.prefix) === 0); + } + if (!n) return e[0] === "!" ? e : `!<${e}>`; + let r = e.substr(n.prefix.length).replace(/[!,[\]{}]/g, (s) => ({ "!": "%21", ",": "%2C", "[": "%5B", "]": "%5D", "{": "%7B", "}": "%7D" })[s]); + return n.handle + r; } - return e.each(({ node: p, next: y }) => { - if (p.type === "JSXText") { - let D = fe(p); - if (mr(p)) { - let m = Xr.split(D, true); - m[0] === "" && (m.shift(), /\n/u.test(m[0]) ? o(Ci(s, m[1], p, y)) : o(n), m.shift()); - let C; - if (M(false, m, -1) === "" && (m.pop(), C = m.pop()), m.length === 0) return; - for (let [c, A2] of m.entries()) c % 2 === 1 ? o(x) : a2(A2); - C !== void 0 ? /\n/u.test(C) ? o(Ci(s, u, p, y)) : o(n) : o(Fi(s, u, p, y)); - } else /\n/u.test(D) ? D.match(/\n/gu).length > 1 && o(F) : o(n); - } else { - let D = r(); - if (a2(D), y && mr(y)) { - let C = Xr.trim(fe(y)), [c] = Xr.split(C); - o(Fi(s, c, p, y)); - } else o(F); + function ya(t2, e) { + if (e instanceof S.Alias) return S.Alias; + if (e.tag) { + let s = t2.filter((i) => i.tag === e.tag); + if (s.length > 0) return s.find((i) => i.format === e.format) || s[0]; } - }, "children"), i; - } - function Fi(e, t2, r, n) { - return e ? "" : r.type === "JSXElement" && !r.closingElement || (n == null ? void 0 : n.type) === "JSXElement" && !n.closingElement ? t2.length === 1 ? E : F : E; - } - function Ci(e, t2, r, n) { - return e ? F : t2.length === 1 ? r.type === "JSXElement" && !r.closingElement || (n == null ? void 0 : n.type) === "JSXElement" && !n.closingElement ? F : E : F; - } - var xc = /* @__PURE__ */ new Set(["ArrayExpression", "TupleExpression", "JSXAttribute", "JSXElement", "JSXExpressionContainer", "JSXFragment", "ExpressionStatement", "CallExpression", "OptionalCallExpression", "ConditionalExpression", "JsExpressionRoot"]); - function hc(e, t2, r) { - let { parent: n } = e; - if (xc.has(n.type)) return t2; - let s = e.match(void 0, (i) => i.type === "ArrowFunctionExpression", L, (i) => i.type === "JSXExpressionContainer"), u = ke(e, r); - return l([u ? "" : B("("), f2([E, t2]), E, u ? "" : B(")")], { shouldBreak: s }); - } - function gc(e, t2, r) { - let { node: n } = e, s = []; - if (s.push(r("name")), n.value) { - let u; - if (te(n.value)) { - let i = fe(n.value), a2 = N(false, N(false, i.slice(1, -1), "'", "'"), """, '"'), o = hr(a2, t2.jsxSingleQuote); - a2 = o === '"' ? N(false, a2, '"', """) : N(false, a2, "'", "'"), u = e.call(() => ye(e, _e(o + a2 + o), t2), "value"); - } else u = r("value"); - s.push("=", u); + let n, r; + if (e instanceof S.Scalar) { + r = e.value; + let s = t2.filter((i) => i.identify && i.identify(r) || i.class && r instanceof i.class); + n = s.find((i) => i.format === e.format) || s.find((i) => !i.format); + } else r = e, n = t2.find((s) => s.nodeClass && r instanceof s.nodeClass); + if (!n) { + let s = r && r.constructor ? r.constructor.name : typeof r; + throw new Error(`Tag not resolved for ${s} value`); + } + return n; } - return s; - } - function Sc(e, t2, r) { - let { node: n } = e, s = (u, i) => u.type === "JSXEmptyExpression" || !T(u) && (Y(u) || se(u) || u.type === "ArrowFunctionExpression" || u.type === "AwaitExpression" && (s(u.argument, u) || u.argument.type === "JSXElement") || L(u) || u.type === "ChainExpression" && L(u.expression) || u.type === "FunctionExpression" || u.type === "TemplateLiteral" || u.type === "TaggedTemplateExpression" || u.type === "DoExpression" || X(i) && (u.type === "ConditionalExpression" || De(u))); - return s(n.expression, e.parent) ? l(["{", r("expression"), ve, "}"]) : l(["{", f2([E, r("expression")]), E, ve, "}"]); - } - function Bc(e, t2, r) { - var a2, o; - let { node: n } = e, s = T(n.name) || T(n.typeParameters) || T(n.typeArguments); - if (n.selfClosing && n.attributes.length === 0 && !s) return ["<", r("name"), n.typeArguments ? r("typeArguments") : r("typeParameters"), " />"]; - if (((a2 = n.attributes) == null ? void 0 : a2.length) === 1 && te(n.attributes[0].value) && !n.attributes[0].value.value.includes(` -`) && !s && !T(n.attributes[0])) return l(["<", r("name"), n.typeArguments ? r("typeArguments") : r("typeParameters"), " ", ...e.map(r, "attributes"), n.selfClosing ? " />" : ">"]); - let u = (o = n.attributes) == null ? void 0 : o.some((p) => te(p.value) && p.value.value.includes(` -`)), i = t2.singleAttributePerLine && n.attributes.length > 1 ? F : x; - return l(["<", r("name"), n.typeArguments ? r("typeArguments") : r("typeParameters"), f2(e.map(() => [i, r()], "attributes")), ...bc(n, t2, s)], { shouldBreak: u }); - } - function bc(e, t2, r) { - return e.selfClosing ? [x, "/>"] : Pc(e, t2, r) ? [">"] : [E, ">"]; - } - function Pc(e, t2, r) { - let n = e.attributes.length > 0 && T(M(false, e.attributes, -1), h.Trailing); - return e.attributes.length === 0 && !r || (t2.bracketSameLine || t2.jsxBracketSameLine) && (!r || e.attributes.length > 0) && !n; - } - function kc(e, t2, r) { - let { node: n } = e, s = []; - s.push(""), s; - } - function Ic(e, t2) { - let { node: r } = e, n = T(r), s = T(r, h.Line), u = r.type === "JSXOpeningFragment"; - return [u ? "<" : ""]; - } - function Lc(e, t2, r) { - let n = ye(e, Tc(e, t2, r), t2); - return hc(e, n, t2); - } - function wc(e, t2) { - let { node: r } = e, n = T(r, h.Line); - return [J(e, t2, { indent: n }), n ? F : ""]; - } - function Oc(e, t2, r) { - let { node: n } = e; - return ["{", e.call(({ node: s }) => { - let u = ["...", r()]; - return !T(s) || !Zn(e) ? u : [f2([E, ye(e, u, t2)]), E]; - }, n.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"]; - } - function Ai(e, t2, r) { - let { node: n } = e; - if (n.type.startsWith("JSX")) switch (n.type) { - case "JSXAttribute": - return gc(e, t2, r); - case "JSXIdentifier": - return n.name; - case "JSXNamespacedName": - return b(":", [r("namespace"), r("name")]); - case "JSXMemberExpression": - return b(".", [r("object"), r("property")]); - case "JSXSpreadAttribute": - case "JSXSpreadChild": - return Oc(e, t2, r); - case "JSXExpressionContainer": - return Sc(e, t2, r); - case "JSXFragment": - case "JSXElement": - return Lc(e, t2, r); - case "JSXOpeningElement": - return Bc(e, t2, r); - case "JSXClosingElement": - return kc(e, t2, r); - case "JSXOpeningFragment": - case "JSXClosingFragment": - return Ic(e, t2); - case "JSXEmptyExpression": - return wc(e, t2); - case "JSXText": - throw new Error("JSXText should be handled by JSXElement"); - default: - throw new qe(n, "JSX"); + function Ea(t2, e, { anchors: n, doc: r }) { + let s = [], i = r.anchors.getName(t2); + return i && (n[i] = t2, s.push(`&${i}`)), t2.tag ? s.push(Os(r, t2.tag)) : e.default || s.push(Os(r, e.tag)), s.join(" "); } - } - function _c(e) { - if (e.children.length === 0) return true; - if (e.children.length > 1) return false; - let t2 = e.children[0]; - return t2.type === "JSXText" && !mr(t2); - } - function mr(e) { - return e.type === "JSXText" && (Xr.hasNonWhitespaceCharacter(fe(e)) || !/\n/u.test(fe(e))); - } - function vc(e) { - return e.type === "JSXExpressionContainer" && te(e.expression) && e.expression.value === " " && !T(e.expression); - } - function Ti(e) { - let { node: t2, parent: r } = e; - if (!X(t2) || !X(r)) return false; - let { index: n, siblings: s } = e, u; - for (let i = n; i > 0; i--) { - let a2 = s[i - 1]; - if (!(a2.type === "JSXText" && !mr(a2))) { - u = a2; - break; + function jt(t2, e, n, r) { + let { anchors: s, schema: i } = e.doc, o; + if (!(t2 instanceof S.Node)) { + let l = { aliasNodes: [], onTagObj: (f2) => o = f2, prevObjects: /* @__PURE__ */ new Map() }; + t2 = i.createNode(t2, true, null, l); + for (let f2 of l.aliasNodes) { + f2.source = f2.source.node; + let m = s.getName(f2.source); + m || (m = s.newName(), s.map[m] = f2.source); + } } + if (t2 instanceof S.Pair) return t2.toString(e, n, r); + o || (o = ya(i.tags, t2)); + let a2 = Ea(t2, o, e); + a2.length > 0 && (e.indentAtStart = (e.indentAtStart || 0) + a2.length + 1); + let c = typeof o.stringify == "function" ? o.stringify(t2, e, n, r) : t2 instanceof S.Scalar ? S.stringifyString(t2, e, n, r) : t2.toString(e, n, r); + return a2 ? t2 instanceof S.Scalar || c[0] === "{" || c[0] === "[" ? `${a2} ${c}` : `${a2} +${e.indent}${c}` : c; } - return (u == null ? void 0 : u.type) === "JSXExpressionContainer" && u.expression.type === "JSXEmptyExpression" && It(u.expression); - } - function jc(e) { - return It(e.node) || Ti(e); - } - var Hr = jc; - var Mc = 0; - function Vr(e, t2, r) { - var v; - let { node: n, parent: s, grandparent: u, key: i } = e, a2 = i !== "body" && (s.type === "IfStatement" || s.type === "WhileStatement" || s.type === "SwitchStatement" || s.type === "DoWhileStatement"), o = n.operator === "|>" && ((v = e.root.extra) == null ? void 0 : v.__isUsingHackPipeline), p = Es(e, r, t2, false, a2); - if (a2) return p; - if (o) return l(p); - if (L(s) && s.callee === n || s.type === "UnaryExpression" || W(s) && !s.computed) return l([f2([E, ...p]), E]); - let y = s.type === "ReturnStatement" || s.type === "ThrowStatement" || s.type === "JSXExpressionContainer" && u.type === "JSXAttribute" || n.operator !== "|" && s.type === "JsExpressionRoot" || n.type !== "NGPipeExpression" && (s.type === "NGRoot" && t2.parser === "__ng_binding" || s.type === "NGMicrosyntaxExpression" && u.type === "NGMicrosyntax" && u.body.length === 1) || n === s.body && s.type === "ArrowFunctionExpression" || n !== s.body && s.type === "ForStatement" || s.type === "ConditionalExpression" && u.type !== "ReturnStatement" && u.type !== "ThrowStatement" && !L(u) || s.type === "TemplateLiteral", D = s.type === "AssignmentExpression" || s.type === "VariableDeclarator" || s.type === "ClassProperty" || s.type === "PropertyDefinition" || s.type === "TSAbstractPropertyDefinition" || s.type === "ClassPrivateProperty" || Ce(s), m = De(n.left) && ur(n.operator, n.left.operator); - if (y || Nt(n) && !m || !Nt(n) && D) return l(p); - if (p.length === 0) return ""; - let C = X(n.right), c = p.findIndex((j) => typeof j != "string" && !Array.isArray(j) && j.type === me), A2 = p.slice(0, c === -1 ? 1 : c + 1), d = p.slice(A2.length, C ? -1 : void 0), S = /* @__PURE__ */ Symbol("logicalChain-" + ++Mc), g = l([...A2, f2(d)], { id: S }); - if (!C) return g; - let _2 = M(false, p, -1); - return l([g, dt(_2, { groupId: S })]); - } - function Es(e, t2, r, n, s) { - var S; - let { node: u } = e; - if (!De(u)) return [l(t2())]; - let i = []; - ur(u.operator, u.left.operator) ? i = e.call((g) => Es(g, t2, r, true, s), "left") : i.push(l(t2("left"))); - let a2 = Nt(u), o = (u.operator === "|>" || u.type === "NGPipeExpression" || Rc(e, r)) && !Le(r.originalText, u.right), y = !T(u.right, h.Leading, qr) && Le(r.originalText, u.right), D = u.type === "NGPipeExpression" ? "|" : u.operator, m = u.type === "NGPipeExpression" && u.arguments.length > 0 ? l(f2([E, ": ", b([x, ": "], e.map(() => Be(2, l(t2())), "arguments"))])) : "", C; - if (a2) C = [D, " ", t2("right"), m]; - else { - let _2 = D === "|>" && ((S = e.root.extra) == null ? void 0 : S.__isUsingHackPipeline) ? e.call((v) => Es(v, t2, r, true, s), "right") : t2("right"); - if (r.experimentalOperatorPosition === "start") { - let v = ""; - if (y) switch (Se(_2)) { - case he: - v = _2.splice(0, 1)[0]; - break; - case ge: - v = _2.contents.splice(0, 1)[0]; - break; + var Kn = class t2 { + static validAnchorNode(e) { + return e instanceof S.Scalar || e instanceof S.YAMLSeq || e instanceof S.YAMLMap; + } + constructor(e) { + Y._defineProperty(this, "map", /* @__PURE__ */ Object.create(null)), this.prefix = e; + } + createAlias(e, n) { + return this.setAnchor(e, n), new S.Alias(e); + } + createMergePair(...e) { + let n = new S.Merge(); + return n.value.items = e.map((r) => { + if (r instanceof S.Alias) { + if (r.source instanceof S.YAMLMap) return r; + } else if (r instanceof S.YAMLMap) return this.createAlias(r); + throw new Error("Merge sources must be Map nodes or their Aliases"); + }), n; + } + getName(e) { + let { map: n } = this; + return Object.keys(n).find((r) => n[r] === e); + } + getNames() { + return Object.keys(this.map); + } + getNode(e) { + return this.map[e]; + } + newName(e) { + e || (e = this.prefix); + let n = Object.keys(this.map); + for (let r = 1; ; ++r) { + let s = `${e}${r}`; + if (!n.includes(s)) return s; } - C = [x, v, D, " ", _2, m]; - } else C = [o ? x : "", D, o ? " " : x, _2, m]; - } - let { parent: c } = e, A2 = T(u.left, h.Trailing | h.Line); - if ((A2 || !(s && u.type === "LogicalExpression") && c.type !== u.type && u.left.type !== u.type && u.right.type !== u.type) && (C = l(C, { shouldBreak: A2 })), r.experimentalOperatorPosition === "start" ? i.push(a2 || y ? " " : "", C) : i.push(o ? "" : " ", C), n && T(u)) { - let g = Gt(ye(e, i, r)); - return g.type === we ? g.parts : Array.isArray(g) ? g : [g]; - } - return i; - } - function Nt(e) { - return e.type !== "LogicalExpression" ? false : !!(se(e.right) && e.right.properties.length > 0 || Y(e.right) && e.right.elements.length > 0 || X(e.right)); - } - var di = (e) => e.type === "BinaryExpression" && e.operator === "|"; - function Rc(e, t2) { - return (t2.parser === "__vue_expression" || t2.parser === "__vue_ts_expression") && di(e.node) && !e.hasAncestor((r) => !di(r) && r.type !== "JsExpressionRoot"); - } - function hi(e, t2, r) { - let { node: n } = e; - if (n.type.startsWith("NG")) switch (n.type) { - case "NGRoot": - return [r("node"), T(n.node) ? " //" + ct(n.node)[0].value.trimEnd() : ""]; - case "NGPipeExpression": - return Vr(e, t2, r); - case "NGChainedExpression": - return l(b([";", x], e.map(() => qc(e) ? r() : ["(", r(), ")"], "expressions"))); - case "NGEmptyExpression": - return ""; - case "NGMicrosyntax": - return e.map(() => [e.isFirst ? "" : xi(e) ? " " : [";", x], r()], "body"); - case "NGMicrosyntaxKey": - return /^[$_a-z][\w$]*(?:-[$_a-z][\w$])*$/iu.test(n.name) ? n.name : JSON.stringify(n.name); - case "NGMicrosyntaxExpression": - return [r("expression"), n.alias === null ? "" : [" as ", r("alias")]]; - case "NGMicrosyntaxKeyedExpression": { - let { index: s, parent: u } = e, i = xi(e) || (s === 1 && (n.key.name === "then" || n.key.name === "else" || n.key.name === "as") || (s === 2 || s === 3) && (n.key.name === "else" && u.body[s - 1].type === "NGMicrosyntaxKeyedExpression" && u.body[s - 1].key.name === "then" || n.key.name === "track")) && u.body[0].type === "NGMicrosyntaxExpression"; - return [r("key"), i ? " " : ": ", r("expression")]; } - case "NGMicrosyntaxLet": - return ["let ", r("key"), n.value === null ? "" : [" = ", r("value")]]; - case "NGMicrosyntaxAs": - return [r("key"), " as ", r("alias")]; - default: - throw new qe(n, "Angular"); + resolveNodes() { + let { map: e, _cstAliases: n } = this; + Object.keys(e).forEach((r) => { + e[r] = e[r].resolved; + }), n.forEach((r) => { + r.source = r.source.resolved; + }), delete this._cstAliases; + } + setAnchor(e, n) { + if (e != null && !t2.validAnchorNode(e)) throw new Error("Anchors may only be set for Scalar, Seq and Map nodes"); + if (n && /[\x00-\x19\s,[\]{}]/.test(n)) throw new Error("Anchor names must not contain whitespace or control characters"); + let { map: r } = this, s = e && Object.keys(r).find((i) => r[i] === e); + if (s) if (n) s !== n && (delete r[s], r[n] = e); + else return s; + else { + if (!n) { + if (!e) return null; + n = this.newName(); + } + r[n] = e; + } + return n; + } + }, Qt = (t2, e) => { + if (t2 && typeof t2 == "object") { + let { tag: n } = t2; + t2 instanceof S.Collection ? (n && (e[n] = true), t2.items.forEach((r) => Qt(r, e))) : t2 instanceof S.Pair ? (Qt(t2.key, e), Qt(t2.value, e)) : t2 instanceof S.Scalar && n && (e[n] = true); + } + return e; + }, Sa = (t2) => Object.keys(Qt(t2, {})); + function wa(t2, e) { + let n = { before: [], after: [] }, r, s = false; + for (let i of e) if (i.valueRange) { + if (r !== void 0) { + let a2 = "Document contains trailing content not separated by a ... or --- line"; + t2.errors.push(new Y.YAMLSyntaxError(i, a2)); + break; + } + let o = S.resolveNode(t2, i); + s && (o.spaceBefore = true, s = false), r = o; + } else i.comment !== null ? (r === void 0 ? n.before : n.after).push(i.comment) : i.type === Y.Type.BLANK_LINE && (s = true, r === void 0 && n.before.length > 0 && !t2.commentBefore && (t2.commentBefore = n.before.join(` +`), n.before = [])); + if (t2.contents = r || null, !r) t2.comment = n.before.concat(n.after).join(` +`) || null; + else { + let i = n.before.join(` +`); + if (i) { + let o = r instanceof S.Collection && r.items[0] ? r.items[0] : r; + o.commentBefore = o.commentBefore ? `${i} +${o.commentBefore}` : i; + } + t2.comment = n.after.join(` +`) || null; + } } - } - function xi({ node: e, index: t2 }) { - return e.type === "NGMicrosyntaxKeyedExpression" && e.key.name === "of" && t2 === 1; - } - var Jc = R(["CallExpression", "OptionalCallExpression", "AssignmentExpression"]); - function qc({ node: e }) { - return nr(e, Jc); - } - function Fs(e, t2, r) { - let { node: n } = e; - return l([b(x, e.map(r, "decorators")), Bi(n, t2) ? F : x]); - } - function gi(e, t2, r) { - return bi(e.node) ? [b(F, e.map(r, "declaration", "decorators")), F] : ""; - } - function Si(e, t2, r) { - let { node: n, parent: s } = e, { decorators: u } = n; - if (!O(u) || bi(s) || Hr(e)) return ""; - let i = n.type === "ClassExpression" || n.type === "ClassDeclaration" || Bi(n, t2); - return [e.key === "declaration" && pu(s) ? F : i ? Ee : "", b(x, e.map(r, "decorators")), x]; - } - function Bi(e, t2) { - return e.decorators.some((r) => Z(t2.originalText, k(r))); - } - function bi(e) { - var r; - if (e.type !== "ExportDefaultDeclaration" && e.type !== "ExportNamedDeclaration" && e.type !== "DeclareExportDeclaration") return false; - let t2 = (r = e.declaration) == null ? void 0 : r.decorators; - return O(t2) && bt(e, t2[0]); - } - var yt = class extends Error { - constructor() { - super(...arguments); - __publicField(this, "name", "ArgExpansionBailout"); + function ba({ tagPrefixes: t2 }, e) { + let [n, r] = e.parameters; + if (!n || !r) { + let s = "Insufficient parameters given for %TAG directive"; + throw new Y.YAMLSemanticError(e, s); + } + if (t2.some((s) => s.handle === n)) { + let s = "The %TAG directive must only be given at most once per handle in the same document."; + throw new Y.YAMLSemanticError(e, s); + } + return { handle: n, prefix: r }; } - }; - function Wc(e, t2, r) { - let { node: n } = e, s = pe(n); - if (s.length === 0) return ["(", J(e, t2), ")"]; - let u = s.length - 1; - if (Yc(s)) { - let D = ["("]; - return qt(e, (m, C) => { - D.push(r()), C !== u && D.push(", "); - }), D.push(")"), D; + function Na(t2, e) { + let [n] = e.parameters; + if (e.name === "YAML:1.0" && (n = "1.0"), !n) { + let r = "Insufficient parameters given for %YAML directive"; + throw new Y.YAMLSemanticError(e, r); + } + if (!As[n]) { + let s = `Document will be parsed as YAML ${t2.version || t2.options.version} rather than YAML ${n}`; + t2.warnings.push(new Y.YAMLWarning(e, s)); + } + return n; } - let i = false, a2 = []; - qt(e, ({ node: D }, m) => { - let C = r(); - m === u || (ce(D, t2) ? (i = true, C = [C, ",", F, F]) : C = [C, ",", x]), a2.push(C); - }); - let o = !t2.parser.startsWith("__ng_") && n.type !== "ImportExpression" && oe(t2, "all") ? "," : ""; - function p() { - return l(["(", f2([x, ...a2]), o, x, ")"], { shouldBreak: true }); - } - if (i || e.parent.type !== "Decorator" && Du(s)) return p(); - if (Uc(s)) { - let D = a2.slice(1); - if (D.some(re)) return p(); - let m; - try { - m = r(qn(n, 0), { expandFirstArg: true }); - } catch (C) { - if (C instanceof yt) return p(); - throw C; + function Oa(t2, e, n) { + let r = [], s = false; + for (let i of e) { + let { comment: o, name: a2 } = i; + switch (a2) { + case "TAG": + try { + t2.tagPrefixes.push(ba(t2, i)); + } catch (c) { + t2.errors.push(c); + } + s = true; + break; + case "YAML": + case "YAML:1.0": + if (t2.version) { + let c = "The %YAML directive must only be given at most once per document."; + t2.errors.push(new Y.YAMLSemanticError(i, c)); + } + try { + t2.version = Na(t2, i); + } catch (c) { + t2.errors.push(c); + } + s = true; + break; + default: + if (a2) { + let c = `YAML only supports %TAG and %YAML directives, and not %${a2}`; + t2.warnings.push(new Y.YAMLWarning(i, c)); + } + } + o && r.push(o); } - return re(m) ? [Ee, Ze([["(", l(m, { shouldBreak: true }), ", ", ...D, ")"], p()])] : Ze([["(", m, ", ", ...D, ")"], ["(", l(m, { shouldBreak: true }), ", ", ...D, ")"], p()]); - } - if (Gc(s, a2, t2)) { - let D = a2.slice(0, -1); - if (D.some(re)) return p(); - let m; - try { - m = r(qn(n, -1), { expandLastArg: true }); - } catch (C) { - if (C instanceof yt) return p(); - throw C; + if (n && !s && (t2.version || n.version || t2.options.version) === "1.1") { + let i = ({ handle: o, prefix: a2 }) => ({ handle: o, prefix: a2 }); + t2.tagPrefixes = n.tagPrefixes.map(i), t2.version = n.version; } - return re(m) ? [Ee, Ze([["(", ...D, l(m, { shouldBreak: true }), ")"], p()])] : Ze([["(", ...D, m, ")"], ["(", ...D, l(m, { shouldBreak: true }), ")"], p()]); + t2.commentBefore = r.join(` +`) || null; } - let y = ["(", f2([E, ...a2]), B(o), E, ")"]; - return _r(e) ? y : l(y, { shouldBreak: a2.some(re) || i }); - } - function yr(e, t2 = false) { - return se(e) && (e.properties.length > 0 || T(e)) || Y(e) && (e.elements.length > 0 || T(e)) || e.type === "TSTypeAssertion" && yr(e.expression) || Ae(e) && yr(e.expression) || e.type === "FunctionExpression" || e.type === "ArrowFunctionExpression" && (!e.returnType || !e.returnType.typeAnnotation || e.returnType.typeAnnotation.type !== "TSTypeReference" || Nc(e.body)) && (e.body.type === "BlockStatement" || e.body.type === "ArrowFunctionExpression" && yr(e.body, true) || se(e.body) || Y(e.body) || !t2 && (L(e.body) || e.body.type === "ConditionalExpression") || X(e.body)) || e.type === "DoExpression" || e.type === "ModuleExpression"; - } - function Gc(e, t2, r) { - var u, i; - let n = M(false, e, -1); - if (e.length === 1) { - let a2 = M(false, t2, -1); - if ((u = a2.label) != null && u.embed && ((i = a2.label) == null ? void 0 : i.hug) !== false) return true; + function Be(t2) { + if (t2 instanceof S.Collection) return true; + throw new Error("Expected a YAML collection as document contents"); } - let s = M(false, e, -2); - return !T(n, h.Leading) && !T(n, h.Trailing) && yr(n) && (!s || s.type !== n.type) && (e.length !== 2 || s.type !== "ArrowFunctionExpression" || !Y(n)) && !(e.length > 1 && Cs(n, r)); - } - function Uc(e) { - if (e.length !== 2) return false; - let [t2, r] = e; - return t2.type === "ModuleExpression" && Xc(r) ? true : !T(t2) && (t2.type === "FunctionExpression" || t2.type === "ArrowFunctionExpression" && t2.body.type === "BlockStatement") && r.type !== "FunctionExpression" && r.type !== "ArrowFunctionExpression" && r.type !== "ConditionalExpression" && ki(r) && !yr(r); - } - function ki(e) { - var _a2; - if (e.type === "ParenthesizedExpression") return ki(e.expression); - if (Ae(e) || e.type === "TypeCastExpression") { - let { typeAnnotation: t2 } = e; - if (t2.type === "TypeAnnotation" && (t2 = t2.typeAnnotation), t2.type === "TSArrayType" && (t2 = t2.elementType, t2.type === "TSArrayType" && (t2 = t2.elementType)), t2.type === "GenericTypeAnnotation" || t2.type === "TSTypeReference") { - let r = (_a2 = t2.typeArguments) != null ? _a2 : t2.typeParameters; - (r == null ? void 0 : r.params.length) === 1 && (t2 = r.params[0]); + var Gt = class t2 { + constructor(e) { + this.anchors = new Kn(e.anchorPrefix), this.commentBefore = null, this.comment = null, this.contents = null, this.directivesEndMarker = null, this.errors = [], this.options = e, this.schema = null, this.tagPrefixes = [], this.version = null, this.warnings = []; } - return Jt(t2) && Ie(e.expression, 1); - } - return lt(e) && pe(e).length > 1 ? false : De(e) ? Ie(e.left, 1) && Ie(e.right, 1) : Rn(e) || Ie(e); - } - function Yc(e) { - return e.length === 2 ? Pi(e, 0) : e.length === 3 ? e[0].type === "Identifier" && Pi(e, 1) : false; - } - function Pi(e, t2) { - let r = e[t2], n = e[t2 + 1]; - return r.type === "ArrowFunctionExpression" && z(r).length === 0 && r.body.type === "BlockStatement" && n.type === "ArrayExpression" && !e.some((s) => T(s)); - } - function Nc(e) { - return e.type === "BlockStatement" && (e.body.some((t2) => t2.type !== "EmptyStatement") || T(e, h.Dangling)); - } - function Xc(e) { - return e.type === "ObjectExpression" && e.properties.length === 1 && Ce(e.properties[0]) && e.properties[0].key.type === "Identifier" && e.properties[0].key.name === "type" && te(e.properties[0].value) && e.properties[0].value.value === "module"; - } - var Dr = Wc; - var Hc = (e) => ((e.type === "ChainExpression" || e.type === "TSNonNullExpression") && (e = e.expression), L(e) && pe(e).length > 0); - function Ii(e, t2, r) { - var p; - let n = r("object"), s = As(e, t2, r), { node: u } = e, i = e.findAncestor((y) => !(W(y) || y.type === "TSNonNullExpression")), a2 = e.findAncestor((y) => !(y.type === "ChainExpression" || y.type === "TSNonNullExpression")), o = i && (i.type === "NewExpression" || i.type === "BindExpression" || i.type === "AssignmentExpression" && i.left.type !== "Identifier") || u.computed || u.object.type === "Identifier" && u.property.type === "Identifier" && !W(a2) || (a2.type === "AssignmentExpression" || a2.type === "VariableDeclarator") && (Hc(u.object) || ((p = n.label) == null ? void 0 : p.memberChain)); - return st(n.label, [n, o ? s : l(f2([E, s]))]); - } - function As(e, t2, r) { - let n = r("property"), { node: s } = e, u = $(e); - return s.computed ? !s.property || Fe(s.property) ? [u, "[", n, "]"] : l([u, "[", f2([E, n]), E, "]"]) : [u, ".", n]; - } - function Li(e, t2, r) { - if (e.node.type === "ChainExpression") return e.call(() => Li(e, t2, r), "expression"); - let { parent: n } = e, s = !n || n.type === "ExpressionStatement", u = []; - function i(w) { - let { originalText: ne } = t2, xe = ut(ne, k(w)); - return ne.charAt(xe) === ")" ? xe !== false && vt(ne, xe + 1) : ce(w, t2); - } - function a2() { - let { node: w } = e; - if (w.type === "ChainExpression") return e.call(a2, "expression"); - if (L(w) && (At(w.callee) || L(w.callee))) { - let ne = i(w); - u.unshift({ node: w, hasTrailingEmptyLine: ne, printed: [ye(e, [$(e), et(e, t2, r), Dr(e, t2, r)], t2), ne ? F : ""] }), e.call(a2, "callee"); - } else At(w) ? (u.unshift({ node: w, needsParens: ke(e, t2), printed: ye(e, W(w) ? As(e, t2, r) : $r(e, t2, r), t2) }), e.call(a2, "object")) : w.type === "TSNonNullExpression" ? (u.unshift({ node: w, printed: ye(e, "!", t2) }), e.call(a2, "expression")) : u.unshift({ node: w, printed: r() }); - } - let { node: o } = e; - u.unshift({ node: o, printed: [$(e), et(e, t2, r), Dr(e, t2, r)] }), o.callee && e.call(a2, "callee"); - let p = [], y = [u[0]], D = 1; - for (; D < u.length && (u[D].node.type === "TSNonNullExpression" || L(u[D].node) || W(u[D].node) && u[D].node.computed && Fe(u[D].node.property)); ++D) y.push(u[D]); - if (!L(u[0].node)) for (; D + 1 < u.length && (At(u[D].node) && At(u[D + 1].node)); ++D) y.push(u[D]); - p.push(y), y = []; - let m = false; - for (; D < u.length; ++D) { - if (m && At(u[D].node)) { - if (u[D].node.computed && Fe(u[D].node.property)) { - y.push(u[D]); - continue; + add(e) { + return Be(this.contents), this.contents.add(e); + } + addIn(e, n) { + Be(this.contents), this.contents.addIn(e, n); + } + delete(e) { + return Be(this.contents), this.contents.delete(e); + } + deleteIn(e) { + return S.isEmptyPath(e) ? this.contents == null ? false : (this.contents = null, true) : (Be(this.contents), this.contents.deleteIn(e)); + } + getDefaults() { + return t2.defaults[this.version] || t2.defaults[this.options.version] || {}; + } + get(e, n) { + return this.contents instanceof S.Collection ? this.contents.get(e, n) : void 0; + } + getIn(e, n) { + return S.isEmptyPath(e) ? !n && this.contents instanceof S.Scalar ? this.contents.value : this.contents : this.contents instanceof S.Collection ? this.contents.getIn(e, n) : void 0; + } + has(e) { + return this.contents instanceof S.Collection ? this.contents.has(e) : false; + } + hasIn(e) { + return S.isEmptyPath(e) ? this.contents !== void 0 : this.contents instanceof S.Collection ? this.contents.hasIn(e) : false; + } + set(e, n) { + Be(this.contents), this.contents.set(e, n); + } + setIn(e, n) { + S.isEmptyPath(e) ? this.contents = n : (Be(this.contents), this.contents.setIn(e, n)); + } + setSchema(e, n) { + if (!e && !n && this.schema) return; + typeof e == "number" && (e = e.toFixed(1)), e === "1.0" || e === "1.1" || e === "1.2" ? (this.version ? this.version = e : this.options.version = e, delete this.options.schema) : e && typeof e == "string" && (this.options.schema = e), Array.isArray(n) && (this.options.customTags = n); + let r = Object.assign({}, this.getDefaults(), this.options); + this.schema = new Ns.Schema(r); + } + parse(e, n) { + this.options.keepCstNodes && (this.cstNode = e), this.options.keepNodeTypes && (this.type = "DOCUMENT"); + let { directives: r = [], contents: s = [], directivesEndMarker: i, error: o, valueRange: a2 } = e; + if (o && (o.source || (o.source = this), this.errors.push(o)), Oa(this, r, n), i && (this.directivesEndMarker = true), this.range = a2 ? [a2.start, a2.end] : null, this.setSchema(), this.anchors._cstAliases = [], wa(this, s), this.anchors.resolveNodes(), this.options.prettyErrors) { + for (let c of this.errors) c instanceof Y.YAMLError && c.makePretty(); + for (let c of this.warnings) c instanceof Y.YAMLError && c.makePretty(); } - p.push(y), y = [], m = false; + return this; } - (L(u[D].node) || u[D].node.type === "ImportExpression") && (m = true), y.push(u[D]), T(u[D].node, h.Trailing) && (p.push(y), y = [], m = false); - } - y.length > 0 && p.push(y); - function C(w) { - return /^[A-Z]|^[$_]+$/u.test(w); - } - function c(w) { - return w.length <= t2.tabWidth; - } - function A2(w) { - var ot; - let ne = (ot = w[1][0]) == null ? void 0 : ot.node.computed; - if (w[0].length === 1) { - let Bt = w[0][0].node; - return Bt.type === "ThisExpression" || Bt.type === "Identifier" && (C(Bt.name) || s && c(Bt.name) || ne); + listNonDefaultTags() { + return Sa(this.contents).filter((e) => e.indexOf(Ns.Schema.defaultPrefix) !== 0); } - let xe = M(false, w[0], -1).node; - return W(xe) && xe.property.type === "Identifier" && (C(xe.property.name) || ne); - } - let d = p.length >= 2 && !T(p[1][0].node) && A2(p); - function S(w) { - let ne = w.map((xe) => xe.printed); - return w.length > 0 && M(false, w, -1).needsParens ? ["(", ...ne, ")"] : ne; - } - function g(w) { - return w.length === 0 ? "" : f2([F, b(F, w.map(S))]); - } - let _2 = p.map(S), v = _2, j = d ? 3 : 2, I = p.flat(), U = I.slice(1, -1).some((w) => T(w.node, h.Leading)) || I.slice(0, -1).some((w) => T(w.node, h.Trailing)) || p[j] && T(p[j][0].node, h.Leading); - if (p.length <= j && !U && !p.some((w) => M(false, w, -1).hasTrailingEmptyLine)) return _r(e) ? v : l(v); - let P = M(false, p[d ? 1 : 0], -1).node, G = !L(P) && i(P), ue = [S(p[0]), d ? p.slice(1, 2).map(S) : "", G ? F : "", g(p.slice(d ? 2 : 1))], Q = u.map(({ node: w }) => w).filter(L); - function St() { - let w = M(false, M(false, p, -1), -1).node, ne = M(false, _2, -1); - return L(w) && re(ne) && Q.slice(0, -1).some((xe) => xe.arguments.some(Mt)); - } - let Ft; - return U || Q.length > 2 && Q.some((w) => !w.arguments.every((ne) => Ie(ne))) || _2.slice(0, -1).some(re) || St() ? Ft = l(ue) : Ft = [re(v) || G ? Ee : "", Ze([v, ue])], st({ memberChain: true }, Ft); - } - var wi = Li; - function Kr(e, t2, r) { - var y; - let { node: n } = e, s = n.type === "NewExpression", u = n.type === "ImportExpression", i = $(e), a2 = pe(n), o = a2.length === 1 && wr(a2[0], t2.originalText); - if (o || Vc(e) || kt(n, e.parent)) { - let D = []; - if (qt(e, () => { - D.push(r()); - }), !(o && ((y = D[0].label) != null && y.embed))) return [s ? "new " : "", Oi(e, r), i, et(e, t2, r), "(", b(", ", D), ")"]; + setTagPrefix(e, n) { + if (e[0] !== "!" || e[e.length - 1] !== "!") throw new Error("Handle must start and end with !"); + if (n) { + let r = this.tagPrefixes.find((s) => s.handle === e); + r ? r.prefix = n : this.tagPrefixes.push({ handle: e, prefix: n }); + } else this.tagPrefixes = this.tagPrefixes.filter((r) => r.handle !== e); + } + toJSON(e, n) { + let { keepBlobsInJSON: r, mapAsMap: s, maxAliasCount: i } = this.options, o = r && (typeof e != "string" || !(this.contents instanceof S.Scalar)), a2 = { doc: this, indentStep: " ", keep: o, mapAsMap: o && !!s, maxAliasCount: i, stringify: jt }, c = Object.keys(this.anchors.map); + c.length > 0 && (a2.anchors = new Map(c.map((f2) => [this.anchors.map[f2], { alias: [], aliasCount: 0, count: 1 }]))); + let l = S.toJSON(this.contents, e, a2); + if (typeof n == "function" && a2.anchors) for (let { count: f2, res: m } of a2.anchors.values()) n(m, f2); + return l; + } + toString() { + if (this.errors.length > 0) throw new Error("Document with errors cannot be stringified"); + let e = this.options.indent; + if (!Number.isInteger(e) || e <= 0) { + let c = JSON.stringify(e); + throw new Error(`"indent" option must be a positive integer, not ${c}`); + } + this.setSchema(); + let n = [], r = false; + if (this.version) { + let c = "%YAML 1.2"; + this.schema.name === "yaml-1.1" && (this.version === "1.0" ? c = "%YAML:1.0" : this.version === "1.1" && (c = "%YAML 1.1")), n.push(c), r = true; + } + let s = this.listNonDefaultTags(); + this.tagPrefixes.forEach(({ handle: c, prefix: l }) => { + s.some((f2) => f2.indexOf(l) === 0) && (n.push(`%TAG ${c} ${l}`), r = true); + }), (r || this.directivesEndMarker) && n.push("---"), this.commentBefore && ((r || !this.directivesEndMarker) && n.unshift(""), n.unshift(this.commentBefore.replace(/^/gm, "#"))); + let i = { anchors: /* @__PURE__ */ Object.create(null), doc: this, indent: "", indentStep: " ".repeat(e), stringify: jt }, o = false, a2 = null; + if (this.contents) { + this.contents instanceof S.Node && (this.contents.spaceBefore && (r || this.directivesEndMarker) && n.push(""), this.contents.commentBefore && n.push(this.contents.commentBefore.replace(/^/gm, "#")), i.forceBlockIndent = !!this.comment, a2 = this.contents.comment); + let c = a2 ? null : () => o = true, l = jt(this.contents, i, () => a2 = null, c); + n.push(S.addComment(l, "", a2)); + } else this.contents !== void 0 && n.push(jt(this.contents, i)); + return this.comment && ((!o || a2) && n[n.length - 1] !== "" && n.push(""), n.push(this.comment.replace(/^/gm, "#"))), n.join(` +`) + ` +`; + } + }; + Y._defineProperty(Gt, "defaults", As); + Ht.Document = Gt; + Ht.defaultOptions = da; + Ht.scalarOptions = ga; + }); + var Ms = ne((Cs) => { + "use strict"; + var jn = Qr(), Ne = Ls(), Aa = Wn(), La = ce(), Ta = Fn(); + De(); + function Ca(t2, e = true, n) { + n === void 0 && typeof e == "string" && (n = e, e = true); + let r = Object.assign({}, Ne.Document.defaults[Ne.defaultOptions.version], Ne.defaultOptions); + return new Aa.Schema(r).createNode(t2, e, n); } - if (!u && !s && At(n.callee) && !e.call((D) => ke(D, t2), "callee", ...n.callee.type === "ChainExpression" ? ["expression"] : [])) return wi(e, t2, r); - let p = [s ? "new " : "", Oi(e, r), i, et(e, t2, r), Dr(e, t2, r)]; - return u || L(n.callee) ? l(p) : p; - } - function Oi(e, t2) { - let { node: r } = e; - return r.type === "ImportExpression" ? `import${r.phase ? `.${r.phase}` : ""}` : t2("callee"); - } - function Vc(e) { - let { node: t2 } = e; - if (t2.type !== "CallExpression" || t2.optional || t2.callee.type !== "Identifier") return false; - let r = pe(t2); - return t2.callee.name === "require" ? r.length === 1 && te(r[0]) || r.length > 1 : t2.callee.name === "define" && e.parent.type === "ExpressionStatement" ? r.length === 1 || r.length === 2 && r[0].type === "ArrayExpression" || r.length === 3 && te(r[0]) && r[1].type === "ArrayExpression" : false; - } - function xt(e, t2, r, n, s, u) { - let i = $c(e, t2, r, n, u), a2 = u ? r(u, { assignmentLayout: i }) : ""; - switch (i) { - case "break-after-operator": - return l([l(n), s, l(f2([x, a2]))]); - case "never-break-after-operator": - return l([l(n), s, " ", a2]); - case "fluid": { - let o = /* @__PURE__ */ Symbol("assignment"); - return l([l(n), s, l(f2(x), { id: o }), ve, dt(a2, { groupId: o })]); + var Fe = class extends Ne.Document { + constructor(e) { + super(Object.assign({}, Ne.defaultOptions, e)); } - case "break-lhs": - return l([n, s, " ", l(a2)]); - case "chain": - return [l(n), s, x, a2]; - case "chain-tail": - return [l(n), s, f2([x, a2])]; - case "chain-tail-arrow-chain": - return [l(n), s, a2]; - case "only-left": - return n; + }; + function Ma(t2, e) { + let n = [], r; + for (let s of jn.parse(t2)) { + let i = new Fe(e); + i.parse(s, r), n.push(i), r = i; + } + return n; } - } - function vi(e, t2, r) { - let { node: n } = e; - return xt(e, t2, r, r("left"), [" ", n.operator], "right"); - } - function ji(e, t2, r) { - return xt(e, t2, r, r("id"), " =", "init"); - } - function $c(e, t2, r, n, s) { - let { node: u } = e, i = u[s]; - if (!i) return "only-left"; - let a2 = !Qr(i); - if (e.match(Qr, Mi, (m) => !a2 || m.type !== "ExpressionStatement" && m.type !== "VariableDeclaration")) return a2 ? i.type === "ArrowFunctionExpression" && i.body.type === "ArrowFunctionExpression" ? "chain-tail-arrow-chain" : "chain-tail" : "chain"; - if (!a2 && Qr(i.right) || Le(t2.originalText, i)) return "break-after-operator"; - if (u.type === "ImportAttribute" || i.type === "CallExpression" && i.callee.name === "require" || t2.parser === "json5" || t2.parser === "jsonc" || t2.parser === "json") return "never-break-after-operator"; - let y = Bu(n); - if (Qc(u) || tl(u) || Ts(u) && y) return "break-lhs"; - let D = nl(u, n, t2); - return e.call(() => Kc(e, t2, r, D), s) ? "break-after-operator" : zc(u) ? "break-lhs" : !y && (D || i.type === "TemplateLiteral" || i.type === "TaggedTemplateExpression" || i.type === "BooleanLiteral" || Fe(i) || i.type === "ClassExpression") ? "never-break-after-operator" : "fluid"; - } - function Kc(e, t2, r, n) { - let s = e.node; - if (De(s) && !Nt(s)) return true; - switch (s.type) { - case "StringLiteralTypeAnnotation": - case "SequenceExpression": - return true; - case "TSConditionalType": - case "ConditionalTypeAnnotation": - if (!t2.experimentalTernaries && !il(s)) break; - return true; - case "ConditionalExpression": { - if (!t2.experimentalTernaries) { - let { test: p } = s; - return De(p) && !Nt(p); - } - let { consequent: a2, alternate: o } = s; - return a2.type === "ConditionalExpression" || o.type === "ConditionalExpression"; + function Ts(t2, e) { + let n = jn.parse(t2), r = new Fe(e).parse(n[0]); + if (n.length > 1) { + let s = "Source contains multiple documents; please use YAML.parseAllDocuments()"; + r.errors.unshift(new La.YAMLSemanticError(n[1], s)); } - case "ClassExpression": - return O(s.decorators); + return r; } - if (n) return false; - let u = s, i = []; - for (; ; ) if (u.type === "UnaryExpression" || u.type === "AwaitExpression" || u.type === "YieldExpression" && u.argument !== null) u = u.argument, i.push("argument"); - else if (u.type === "TSNonNullExpression") u = u.expression, i.push("expression"); - else break; - return !!(te(u) || e.call(() => Ri(e, t2, r), ...i)); - } - function Qc(e) { - if (Mi(e)) { - let t2 = e.left || e.id; - return t2.type === "ObjectPattern" && t2.properties.length > 2 && t2.properties.some((r) => { - var n; - return Ce(r) && (!r.shorthand || ((n = r.value) == null ? void 0 : n.type) === "AssignmentPattern"); - }); + function ka(t2, e) { + let n = Ts(t2, e); + if (n.warnings.forEach((r) => Ta.warn(r)), n.errors.length > 0) throw n.errors[0]; + return n.toJSON(); } - return false; - } - function Qr(e) { - return e.type === "AssignmentExpression"; - } - function Mi(e) { - return Qr(e) || e.type === "VariableDeclarator"; - } - function zc(e) { - let t2 = el(e); - if (O(t2)) { - let r = e.type === "TSTypeAliasDeclaration" ? "constraint" : "bound"; - if (t2.length > 1 && t2.some((n) => n[r] || n.default)) return true; + function Pa(t2, e) { + let n = new Fe(e); + return n.contents = t2, String(n); } - return false; - } - var Zc = R(["TSTypeAliasDeclaration", "TypeAlias"]); - function el(e) { - var t2; - if (Zc(e)) return (t2 = e.typeParameters) == null ? void 0 : t2.params; - } - function tl(e) { - if (e.type !== "VariableDeclarator") return false; - let { typeAnnotation: t2 } = e.id; - if (!t2 || !t2.typeAnnotation) return false; - let r = _i(t2.typeAnnotation); - return O(r) && r.length > 1 && r.some((n) => O(_i(n)) || n.type === "TSConditionalType"); - } - function Ts(e) { - var t2; - return e.type === "VariableDeclarator" && ((t2 = e.init) == null ? void 0 : t2.type) === "ArrowFunctionExpression"; + var va = { createNode: Ca, defaultOptions: Ne.defaultOptions, Document: Fe, parse: ka, parseAllDocuments: Ma, parseCST: jn.parse, parseDocument: Ts, scalarOptions: Ne.scalarOptions, stringify: Pa }; + Cs.YAML = va; + }); + var Ps = ne((Af, ks) => { + ks.exports = Ms().YAML; + }); + var vs = ne((H) => { + "use strict"; + var qe = De(), Ue = ce(); + H.findPair = qe.findPair; + H.parseMap = qe.resolveMap; + H.parseSeq = qe.resolveSeq; + H.stringifyNumber = qe.stringifyNumber; + H.stringifyString = qe.stringifyString; + H.toJSON = qe.toJSON; + H.Type = Ue.Type; + H.YAMLError = Ue.YAMLError; + H.YAMLReferenceError = Ue.YAMLReferenceError; + H.YAMLSemanticError = Ue.YAMLSemanticError; + H.YAMLSyntaxError = Ue.YAMLSyntaxError; + H.YAMLWarning = Ue.YAMLWarning; + }); + var Ja = {}; + sr(Ja, { languages: () => Ur, options: () => Vr, parsers: () => rr, printers: () => Ha }); + var ht = (t2, e) => (n, r, ...s) => { + var _a3; + return n | 1 && r == null ? void 0 : ((_a3 = e.call(r)) != null ? _a3 : r[t2]).apply(r, s); + }; + function xi(t2) { + return this[t2 < 0 ? this.length + t2 : t2]; + } + var Ri = ht("at", function() { + if (Array.isArray(this) || typeof this == "string") return xi; + }), D = Ri; + var Di = (_a2 = String.prototype.replaceAll) != null ? _a2 : function(t2, e) { + return t2.global ? this.replace(t2, e) : this.split(t2).join(e); + }, $i = ht("replaceAll", function() { + if (typeof this == "string") return Di; + }), dt = $i; + var Yi = () => { + }, je = Yi; + var Qe = "string", Ge = "array", gt = "cursor", yt = "indent", Ae = "align", Et = "trim", Le = "group", Te = "fill", Ce = "if-break", St = "indent-if-break", Me = "line-suffix", wt = "line-suffix-boundary", re = "line", bt = "label", ke = "break-parent", Nt = /* @__PURE__ */ new Set([gt, yt, Ae, Et, Le, Te, Ce, St, Me, wt, re, bt, ke]); + function Bi(t2) { + if (typeof t2 == "string") return Qe; + if (Array.isArray(t2)) return Ge; + if (!t2) return; + let { type: e } = t2; + if (Nt.has(e)) return e; } - var rl = R(["TSTypeReference", "GenericTypeAnnotation"]); - function _i(e) { - var _a2; - var t2; - if (rl(e)) return (t2 = (_a2 = e.typeArguments) != null ? _a2 : e.typeParameters) == null ? void 0 : t2.params; + var Ot = Bi; + var Fi = (t2) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(t2); + function qi(t2) { + let e = t2 === null ? "null" : typeof t2; + if (e !== "string" && e !== "object") return `Unexpected doc '${e}', +Expected it to be 'string' or 'object'.`; + if (Ot(t2)) throw new Error("doc is valid."); + let n = Object.prototype.toString.call(t2); + if (n !== "[object Object]") return `Unexpected doc '${n}'.`; + let r = Fi([...Nt].map((s) => `'${s}'`)); + return `Unexpected doc.type '${t2.type}'. +Expected it to be ${r}.`; } - function Ri(e, t2, r, n = false) { - var i; - let { node: s } = e, u = () => Ri(e, t2, r, true); - if (s.type === "ChainExpression" || s.type === "TSNonNullExpression") return e.call(u, "expression"); - if (L(s)) { - if ((i = Kr(e, t2, r).label) != null && i.memberChain) return false; - let o = pe(s); - return !(o.length === 0 || o.length === 1 && sr(o[0], t2)) || sl(s, r) ? false : e.call(u, "callee"); + var on = class extends Error { + constructor(e) { + super(qi(e)); + __publicField(this, "name", "InvalidDocError"); + this.doc = e; } - return W(s) ? e.call(u, "object") : n && (s.type === "Identifier" || s.type === "ThisExpression"); - } - function nl(e, t2, r) { - return Ce(e) ? (t2 = Gt(t2), typeof t2 == "string" && tt(t2) < r.tabWidth + 3) : false; - } - function sl(e, t2) { - let r = ul(e); - if (O(r)) { - if (r.length > 1) return true; - if (r.length === 1) { - let s = r[0]; - if (Xe(s) || vr(s) || s.type === "TSTypeLiteral" || s.type === "ObjectTypeAnnotation") return true; - } - let n = e.typeParameters ? "typeParameters" : "typeArguments"; - if (re(t2(n))) return true; + }, ar = on; + function Ui(t2, e) { + if (typeof t2 == "string") return e(t2); + let n = /* @__PURE__ */ new Map(); + return r(t2); + function r(i) { + if (n.has(i)) return n.get(i); + let o = s(i); + return n.set(i, o), o; } - return false; - } - function ul(e) { - var _a2; - var t2; - return (t2 = (_a2 = e.typeParameters) != null ? _a2 : e.typeArguments) == null ? void 0 : t2.params; - } - function il(e) { - function t2(r) { - var _a2; - switch (r.type) { - case "FunctionTypeAnnotation": - case "GenericTypeAnnotation": - case "TSFunctionType": - return !!r.typeParameters; - case "TSTypeReference": - return !!((_a2 = r.typeArguments) != null ? _a2 : r.typeParameters); + function s(i) { + switch (Ot(i)) { + case Ge: + return e(i.map(r)); + case Te: + return e({ ...i, parts: i.parts.map(r) }); + case Ce: + return e({ ...i, breakContents: r(i.breakContents), flatContents: r(i.flatContents) }); + case Le: { + let { expandedStates: o, contents: a2 } = i; + return o ? (o = o.map(r), a2 = o[0]) : a2 = r(a2), e({ ...i, contents: a2, expandedStates: o }); + } + case Ae: + case yt: + case St: + case bt: + case Me: + return e({ ...i, contents: r(i.contents) }); + case Qe: + case gt: + case Et: + case wt: + case re: + case ke: + return e(i); default: - return false; + throw new ar(i); } } - return t2(e.checkType) || t2(e.extendsType); - } - function Ge(e, t2, r, n, s) { - let u = e.node, i = z(u), a2 = s ? et(e, r, t2) : ""; - if (i.length === 0) return [a2, "(", J(e, r, { filter: (c) => be(r.originalText, k(c)) === ")" }), ")"]; - let { parent: o } = e, p = kt(o), y = ds(u), D = []; - if (Cu(e, (c, A2) => { - let d = A2 === i.length - 1; - d && u.rest && D.push("..."), D.push(t2()), !d && (D.push(","), p || y ? D.push(" ") : ce(i[A2], r) ? D.push(F, F) : D.push(x)); - }), n && !ol(e)) { - if (re(a2) || re(D)) throw new yt(); - return l([or(a2), "(", or(D), ")"]); - } - let m = i.every((c) => !O(c.decorators)); - return y && m ? [a2, "(", ...D, ")"] : p ? [a2, "(", ...D, ")"] : (Lr(o) || lu(o) || o.type === "TypeAlias" || o.type === "UnionTypeAnnotation" || o.type === "IntersectionTypeAnnotation" || o.type === "FunctionTypeAnnotation" && o.returnType === u) && i.length === 1 && i[0].name === null && u.this !== i[0] && i[0].typeAnnotation && u.typeParameters === null && Jt(i[0].typeAnnotation) && !u.rest ? r.arrowParens === "always" || u.type === "HookTypeAnnotation" ? ["(", ...D, ")"] : D : [a2, "(", f2([E, ...D]), B(!Fu(u) && oe(r, "all") ? "," : ""), E, ")"]; } - function ds(e) { - if (!e) return false; - let t2 = z(e); - if (t2.length !== 1) return false; - let [r] = t2; - return !T(r) && (r.type === "ObjectPattern" || r.type === "ArrayPattern" || r.type === "Identifier" && r.typeAnnotation && (r.typeAnnotation.type === "TypeAnnotation" || r.typeAnnotation.type === "TSTypeAnnotation") && Me(r.typeAnnotation.typeAnnotation) || r.type === "FunctionTypeParam" && Me(r.typeAnnotation) && r !== e.rest || r.type === "AssignmentPattern" && (r.left.type === "ObjectPattern" || r.left.type === "ArrayPattern") && (r.right.type === "Identifier" || se(r.right) && r.right.properties.length === 0 || Y(r.right) && r.right.elements.length === 0)); + function cr(t2, e = He) { + return Ui(t2, (n) => typeof n == "string" ? v(e, n.split(` +`)) : n); } - function al(e) { - let t2; - return e.returnType ? (t2 = e.returnType, t2.typeAnnotation && (t2 = t2.typeAnnotation)) : e.typeAnnotation && (t2 = e.typeAnnotation), t2; + var Z = je, At = je, lr = je, fr = je; + function Je(t2, e) { + return fr(t2), Z(e), { type: Ae, contents: e, n: t2 }; } - function at(e, t2) { - var s; - let r = al(e); - if (!r) return false; - let n = (s = e.typeParameters) == null ? void 0 : s.params; - if (n) { - if (n.length > 1) return false; - if (n.length === 1) { - let u = n[0]; - if (u.constraint || u.default) return false; - } - } - return z(e).length === 1 && (Me(r) || re(t2)); + function an(t2) { + return Je(Number.NEGATIVE_INFINITY, t2); } - function ol(e) { - return e.match((t2) => t2.type === "ArrowFunctionExpression" && t2.body.type === "BlockStatement", (t2, r) => { - if (t2.type === "CallExpression" && r === "arguments" && t2.arguments.length === 1 && t2.callee.type === "CallExpression") { - let n = t2.callee.callee; - return n.type === "Identifier" || n.type === "MemberExpression" && !n.computed && n.object.type === "Identifier" && n.property.type === "Identifier"; - } - return false; - }, (t2, r) => t2.type === "VariableDeclarator" && r === "init" || t2.type === "ExportDefaultDeclaration" && r === "declaration" || t2.type === "TSExportAssignment" && r === "expression" || t2.type === "AssignmentExpression" && r === "right" && t2.left.type === "MemberExpression" && t2.left.object.type === "Identifier" && t2.left.object.name === "module" && t2.left.property.type === "Identifier" && t2.left.property.name === "exports", (t2) => t2.type !== "VariableDeclaration" || t2.kind === "const" && t2.declarations.length === 1); + function ur(t2) { + return Je({ type: "root" }, t2); } - function Ji(e) { - let t2 = z(e); - return t2.length > 1 && t2.some((r) => r.type === "TSParameterProperty"); + function pr(t2) { + return Je(-1, t2); } - var pl = R(["VoidTypeAnnotation", "TSVoidKeyword", "NullLiteralTypeAnnotation", "TSNullKeyword"]), cl = R(["ObjectTypeAnnotation", "TSTypeLiteral", "GenericTypeAnnotation", "TSTypeReference"]); - function ll(e) { - let { types: t2 } = e; - if (t2.some((n) => T(n))) return false; - let r = t2.find((n) => cl(n)); - return r ? t2.every((n) => n === r || pl(n)) : false; + var Xe = { type: ke }; + function Lt(t2) { + return lr(t2), { type: Te, parts: t2 }; } - function xs(e) { - return Jt(e) || Me(e) ? true : Xe(e) ? ll(e) : false; + function Pe(t2, e = {}) { + return Z(t2), At(e.expandedStates, true), { type: Le, id: e.id, contents: t2, break: !!e.shouldBreak, expandedStates: e.expandedStates }; } - function qi(e, t2, r) { - let n = t2.semi ? ";" : "", { node: s } = e, u = [K(e), "opaque type ", r("id"), r("typeParameters")]; - return s.supertype && u.push(": ", r("supertype")), s.impltype && u.push(" = ", r("impltype")), u.push(n), u; + function cn(t2, e) { + return Pe(t2[0], { ...e, expandedStates: t2 }); } - function zr(e, t2, r) { - let n = t2.semi ? ";" : "", { node: s } = e, u = [K(e)]; - u.push("type ", r("id"), r("typeParameters")); - let i = s.type === "TSTypeAliasDeclaration" ? "typeAnnotation" : "right"; - return [xt(e, t2, r, u, " =", i), n]; + function ze(t2, e = "", n = {}) { + return Z(t2), e !== "" && Z(e), { type: Ce, breakContents: t2, flatContents: e, groupId: n.groupId }; } - function Zr(e, t2, r) { - let n = false; - return l(e.map(({ isFirst: s, previous: u, node: i, index: a2 }) => { - let o = r(); - if (s) return o; - let p = Me(i), y = Me(u); - return y && p ? [" & ", n ? f2(o) : o] : !y && !p ? t2.experimentalOperatorPosition === "start" ? f2([x, "& ", o]) : f2([" &", x, o]) : (a2 > 1 && (n = true), [" & ", a2 > 1 ? f2(o) : o]); - }, "types")); + function v(t2, e) { + Z(t2), At(e); + let n = []; + for (let r = 0; r < e.length; r++) r !== 0 && n.push(t2), n.push(e[r]); + return n; } - function en(e, t2, r) { - let { node: n } = e, { parent: s } = e, u = s.type !== "TypeParameterInstantiation" && (s.type !== "TSConditionalType" || !t2.experimentalTernaries) && (s.type !== "ConditionalTypeAnnotation" || !t2.experimentalTernaries) && s.type !== "TSTypeParameterInstantiation" && s.type !== "GenericTypeAnnotation" && s.type !== "TSTypeReference" && s.type !== "TSTypeAssertion" && s.type !== "TupleTypeAnnotation" && s.type !== "TSTupleType" && !(s.type === "FunctionTypeParam" && !s.name && e.grandparent.this !== s) && !((s.type === "TypeAlias" || s.type === "VariableDeclarator" || s.type === "TSTypeAliasDeclaration") && Le(t2.originalText, n)), i = xs(n), a2 = e.map((y) => { - let D = r(); - return i || (D = Be(2, D)), ye(y, D, t2); - }, "types"); - if (i) return b(" | ", a2); - let o = u && !Le(t2.originalText, n), p = [B([o ? x : "", "| "]), b([x, "| "], a2)]; - return ke(e, t2) ? l([f2(p), E]) : (s.type === "TupleTypeAnnotation" || s.type === "TSTupleType") && s[s.type === "TupleTypeAnnotation" && s.types ? "types" : "elementTypes"].length > 1 ? l([f2([B(["(", E]), p]), E, B(")")]) : l(u ? f2(p) : p); + var se = { type: re }, Tt = { type: re, soft: true }, Vi = { type: re, hard: true }, N = [Vi, Xe], Wi = { type: re, hard: true, literal: true }, He = [Wi, Xe]; + function mr(t2) { + return Z(t2), { type: Me, contents: t2 }; } - function ml(e) { - var n; - let { node: t2, parent: r } = e; - return t2.type === "FunctionTypeAnnotation" && (Lr(r) || !((r.type === "ObjectTypeProperty" || r.type === "ObjectTypeInternalSlot") && !r.variance && !r.optional && bt(r, t2) || r.type === "ObjectTypeCallProperty" || ((n = e.getParentNode(2)) == null ? void 0 : n.type) === "DeclareFunction")); + function Ct(t2) { + return (e, n, r) => { + let s = !!(r == null ? void 0 : r.backwards); + if (n === false) return false; + let { length: i } = e, o = n; + for (; o >= 0 && o < i; ) { + let a2 = e.charAt(o); + if (t2 instanceof RegExp) { + if (!t2.test(a2)) return o; + } else if (!t2.includes(a2)) return o; + s ? o-- : o++; + } + return o === -1 || o === i ? o : false; + }; } - function tn(e, t2, r) { - let { node: n } = e, s = [Xt(e)]; - (n.type === "TSConstructorType" || n.type === "TSConstructSignatureDeclaration") && s.push("new "); - let u = Ge(e, r, t2, false, true), i = []; - return n.type === "FunctionTypeAnnotation" ? i.push(ml(e) ? " => " : ": ", r("returnType")) : i.push(H(e, r, n.returnType ? "returnType" : "typeAnnotation")), at(n, i) && (u = l(u)), s.push(u, i), l(s); + var rl = Ct(/\s/u), ln = Ct(" "), sl = Ct(",; "), il = Ct(/[^\n\r]/u); + var hr = (t2) => t2 === ` +` || t2 === "\r" || t2 === "\u2028" || t2 === "\u2029"; + function Ki(t2, e, n) { + let r = !!(n == null ? void 0 : n.backwards); + if (e === false) return false; + let s = t2.charAt(e); + if (r) { + if (t2.charAt(e - 1) === "\r" && s === ` +`) return e - 2; + if (hr(s)) return e - 1; + } else { + if (s === "\r" && t2.charAt(e + 1) === ` +`) return e + 2; + if (hr(s)) return e + 1; + } + return e; } - function rn(e, t2, r) { - return [r("objectType"), $(e), "[", r("indexType"), "]"]; + var fn = Ki; + function ji(t2, e) { + let n = e - 1; + n = ln(t2, n, { backwards: true }), n = fn(t2, n, { backwards: true }), n = ln(t2, n, { backwards: true }); + let r = fn(t2, n, { backwards: true }); + return n !== r; } - function nn(e, t2, r) { - return ["infer ", r("typeParameter")]; + var un = ji; + var pn = class extends Error { + constructor(e, n, r = "type") { + super(`Unexpected ${n} node ${r}: ${JSON.stringify(e[r])}.`); + __publicField(this, "name", "UnexpectedNodeError"); + this.node = e; + } + }, dr = pn; + var gr = "format"; + var yr = /^\s*#[^\S\n]*@(?:noformat|noprettier)\s*?(?:\n|$)/u, Er = /^\s*#[^\S\n]*@(?:format|prettier)\s*?(?:\n|$)/u, Sr = /^\s*@(?:format|prettier)\s*$/u; + var wr = (t2) => Sr.test(t2), br = (t2) => Er.test(t2), Nr = (t2) => yr.test(t2), Or = (t2) => `# @${gr} + +${t2}`; + function Ar(t2, e) { + switch (t2.type) { + case "comment": + if (wr(t2.value)) return null; + break; + case "quoteDouble": + case "quoteSingle": + e.type = "quote"; + break; + case "document": + e.directivesEndMarker || delete e.directivesEndMarker, e.documentEndMarker || delete e.documentEndMarker; + break; + } } - function hs(e, t2, r) { - let { node: n } = e; - return [n.postfix ? "" : r, H(e, t2), n.postfix ? r : ""]; + Ar.ignoredProperties = /* @__PURE__ */ new Set(["position"]); + var Lr = Ar; + function Tr(t2, e) { + let { node: n } = t2; + if (n.type === "root" && e.filepath && /(?:[/\\]|^)\.(?:prettier|stylelint|lintstaged)rc$/u.test(e.filepath)) return async (r) => { + let s = await r(e.originalText, { parser: "json" }); + return s ? [s, N] : void 0; + }; } - function sn(e, t2, r) { - let { node: n } = e; - return ["...", ...n.type === "TupleTypeSpreadElement" && n.label ? [r("label"), ": "] : [], r("typeAnnotation")]; + Tr.getVisitorKeys = () => []; + var Cr = Tr; + var Ze = null; + function et(t2) { + if (Ze !== null && typeof Ze.property) { + let e = Ze; + return Ze = et.prototype = null, e; + } + return Ze = et.prototype = t2 != null ? t2 : /* @__PURE__ */ Object.create(null), new et(); } - function un(e, t2, r) { - let { node: n } = e; - return [n.variance ? r("variance") : "", r("label"), n.optional ? "?" : "", ": ", r("elementType")]; + var Qi = 10; + for (let t2 = 0; t2 <= Qi; t2++) et(); + function mn(t2) { + return et(t2); } - var yl = /* @__PURE__ */ new WeakSet(); - function H(e, t2, r = "typeAnnotation") { - let { node: { [r]: n } } = e; - if (!n) return ""; - let s = false; - if (n.type === "TSTypeAnnotation" || n.type === "TypeAnnotation") { - let u = e.call(Wi, r); - (u === "=>" || u === ":" && T(n, h.Leading)) && (s = true), yl.add(n); + function Gi(t2, e = "type") { + mn(t2); + function n(r) { + let s = r[e], i = t2[s]; + if (!Array.isArray(i)) throw Object.assign(new Error(`Missing visitor keys for '${s}'.`), { node: r }); + return i; } - return s ? [" ", t2(r)] : t2(r); - } - var Wi = (e) => e.match((t2) => t2.type === "TSTypeAnnotation", (t2, r) => (r === "returnType" || r === "typeAnnotation") && (t2.type === "TSFunctionType" || t2.type === "TSConstructorType")) ? "=>" : e.match((t2) => t2.type === "TSTypeAnnotation", (t2, r) => r === "typeAnnotation" && (t2.type === "TSJSDocNullableType" || t2.type === "TSJSDocNonNullableType" || t2.type === "TSTypePredicate")) || e.match((t2) => t2.type === "TypeAnnotation", (t2, r) => r === "typeAnnotation" && t2.type === "Identifier", (t2, r) => r === "id" && t2.type === "DeclareFunction") || e.match((t2) => t2.type === "TypeAnnotation", (t2, r) => r === "typeAnnotation" && t2.type === "Identifier", (t2, r) => r === "id" && t2.type === "DeclareHook") || e.match((t2) => t2.type === "TypeAnnotation", (t2, r) => r === "bound" && t2.type === "TypeParameter" && t2.usesExtendsBound) ? "" : ":"; - function an(e, t2, r) { - let n = Wi(e); - return n ? [n, " ", r("typeAnnotation")] : r("typeAnnotation"); + return n; } - function on(e) { - return [e("elementType"), "[]"]; + var Mr = Gi; + var k = [["children", "anchor", "tag", "indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments"], ["anchor", "tag", "indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments"], ["key", "value", "children", "anchor", "tag", "indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments"], ["content", "children", "anchor", "tag", "indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments"], ["indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments"]], kr = { root: k[0], document: ["head", "body", "children", "anchor", "tag", "indicatorComment", "leadingComments", "middleComments", "trailingComment", "endComments"], documentHead: k[0], documentBody: k[0], directive: k[1], alias: k[1], blockLiteral: k[1], blockFolded: k[0], plain: k[0], quoteSingle: k[1], quoteDouble: k[1], mapping: k[0], mappingItem: k[2], mappingKey: k[3], mappingValue: k[3], sequence: k[0], sequenceItem: k[3], flowMapping: k[0], flowMappingItem: k[2], flowSequence: k[0], flowSequenceItem: k[3], comment: k[1], tag: k[4], anchor: k[4] }; + var Hi = Mr(kr), Pr = Hi; + var tt = (t2) => t2.position.start.offset, vr = (t2) => t2.position.end.offset; + function Ji(t2) { + return Array.isArray(t2) && t2.length > 0; } - function pn({ node: e }, t2) { - let r = e.type === "TSTypeQuery" ? "exprName" : "argument", n = e.type === "TypeofTypeAnnotation" || e.typeArguments ? "typeArguments" : "typeParameters"; - return ["typeof ", t2(r), t2(n)]; + var ve = Ji; + function W(t2, e) { + return typeof (t2 == null ? void 0 : t2.type) == "string" && e.includes(t2.type); } - function cn(e, t2) { - let { node: r } = e; - return [r.type === "TSTypePredicate" && r.asserts ? "asserts " : r.type === "TypePredicate" && r.kind ? `${r.kind} ` : "", t2("parameterName"), r.typeAnnotation ? [" is ", H(e, t2)] : ""]; + function hn(t2, e, n) { + return e("children" in t2 ? { ...t2, children: t2.children.map((r) => hn(r, e, t2)) } : t2, n); } - function $(e) { - let { node: t2 } = e; - return !t2.optional || t2.type === "Identifier" && t2 === e.parent.key ? "" : L(t2) || W(t2) && t2.computed || t2.type === "OptionalIndexedAccessType" ? "?." : "?"; + function Ie(t2, e, n) { + Object.defineProperty(t2, e, { get: n, enumerable: false }); } - function ln(e) { - return e.node.definite || e.match(void 0, (t2, r) => r === "id" && t2.type === "VariableDeclarator" && t2.definite) ? "!" : ""; + function _r(t2, e) { + let n = 0, r = e.length; + for (let s = t2.position.end.offset - 1; s < r; s++) { + let i = e[s]; + if (i === ` +` && n++, n === 1 && /\S/u.test(i)) return false; + if (n === 2) return true; + } + return false; } - var Dl = /* @__PURE__ */ new Set(["DeclareClass", "DeclareComponent", "DeclareFunction", "DeclareHook", "DeclareVariable", "DeclareExportDeclaration", "DeclareExportAllDeclaration", "DeclareOpaqueType", "DeclareTypeAlias", "DeclareEnum", "DeclareInterface"]); - function K(e) { - let { node: t2 } = e; - return t2.declare || Dl.has(t2.type) && e.parent.type !== "DeclareExportDeclaration" ? "declare " : ""; + function Mt(t2) { + let { node: e } = t2; + switch (e.type) { + case "tag": + case "anchor": + case "comment": + return false; + } + let n = t2.stack.length; + for (let r = 1; r < n; r++) { + let s = t2.stack[r], i = t2.stack[r - 1]; + if (Array.isArray(i) && typeof s == "number" && s !== i.length - 1) return false; + } + return true; } - var fl = /* @__PURE__ */ new Set(["TSAbstractMethodDefinition", "TSAbstractPropertyDefinition", "TSAbstractAccessorProperty"]); - function Xt({ node: e }) { - return e.abstract || fl.has(e.type) ? "abstract " : ""; + function kt(t2) { + return ve(t2.children) ? kt(D(0, t2.children, -1)) : t2; } - function et(e, t2, r) { - let n = e.node; - return n.typeArguments ? r("typeArguments") : n.typeParameters ? r("typeParameters") : ""; + function Ir(t2) { + return t2.value.trim() === "prettier-ignore"; } - function $r(e, t2, r) { - return ["::", r("callee")]; + function xr(t2) { + let { node: e } = t2; + if (e.type === "documentBody") { + let n = t2.parent.head; + return I(n) && Ir(D(0, n.endComments, -1)); + } + return te(e) && Ir(D(0, e.leadingComments, -1)); } - function Dt(e, t2, r) { - return e.type === "EmptyStatement" ? ";" : e.type === "BlockStatement" || r ? [" ", t2] : f2([x, t2]); + function _e(t2) { + return !ve(t2.children) && !Xi(t2); } - function mn(e, t2) { - return ["...", t2("argument"), H(e, t2)]; + function Xi(t2) { + return te(t2) || ae(t2) || dn(t2) || K(t2) || I(t2); } - function Ht(e) { - return e.accessibility ? e.accessibility + " " : ""; + function te(t2) { + return ve(t2 == null ? void 0 : t2.leadingComments); } - function El(e, t2, r, n) { - let { node: s } = e, u = s.inexact ? "..." : ""; - return T(s, h.Dangling) ? l([r, u, J(e, t2, { indent: true }), E, n]) : [r, u, n]; + function ae(t2) { + return ve(t2 == null ? void 0 : t2.middleComments); } - function Vt(e, t2, r) { - let { node: n } = e, s = [], u = n.type === "TupleExpression" ? "#[" : "[", i = "]", a2 = n.type === "TupleTypeAnnotation" && n.types ? "types" : n.type === "TSTupleType" || n.type === "TupleTypeAnnotation" ? "elementTypes" : "elements", o = n[a2]; - if (o.length === 0) s.push(El(e, t2, u, i)); - else { - let p = M(false, o, -1), y = (p == null ? void 0 : p.type) !== "RestElement" && !n.inexact, D = p === null, m = /* @__PURE__ */ Symbol("array"), C = !t2.__inJestEach && o.length > 1 && o.every((d, S, g) => { - let _2 = d == null ? void 0 : d.type; - if (!Y(d) && !se(d)) return false; - let v = g[S + 1]; - if (v && _2 !== v.type) return false; - let j = Y(d) ? "elements" : "properties"; - return d[j] && d[j].length > 1; - }), c = Cs(n, t2), A2 = y ? D ? "," : oe(t2) ? c ? B(",", "", { groupId: m }) : B(",") : "" : ""; - s.push(l([u, f2([E, c ? Cl(e, t2, r, A2) : [Fl(e, t2, a2, n.inexact, r), A2], J(e, t2)]), E, i], { shouldBreak: C, id: m })); - } - return s.push($(e), H(e, r)), s; + function dn(t2) { + return t2 == null ? void 0 : t2.indicatorComment; } - function Cs(e, t2) { - return Y(e) && e.elements.length > 1 && e.elements.every((r) => r && (Fe(r) || Mn(r) && !T(r.argument)) && !T(r, h.Trailing | h.Line, (n) => !Z(t2.originalText, q(n), { backwards: true }))); + function K(t2) { + return t2 == null ? void 0 : t2.trailingComment; } - function Gi({ node: e }, { originalText: t2 }) { - let r = (s) => Ot(t2, _t(t2, s)), n = (s) => t2[s] === "," ? s : n(r(s + 1)); - return vt(t2, n(k(e))); + function I(t2) { + return ve(t2 == null ? void 0 : t2.endComments); } - function Fl(e, t2, r, n, s) { - let u = []; - return e.each(({ node: i, isLast: a2 }) => { - u.push(i ? l(s()) : ""), (!a2 || n) && u.push([",", x, i && Gi(e, t2) ? E : ""]); - }, r), n && u.push("..."), u; + function Rr(t2) { + return t2 ? t2.split(/(? o === 0 && o === a2.length - 1 ? i : o !== 0 && o !== a2.length - 1 ? i.trim() : o === 0 ? i.trimEnd() : i.trimStart()); + if (n.proseWrap === "preserve") return r.map((i) => i ? [i] : []); let s = []; - return e.each(({ isLast: u, next: i }) => { - s.push([r(), u ? n : ","]), u || s.push(Gi(e, t2) ? [F, F] : T(i, h.Leading | h.Line) ? F : x); - }, "elements"), Jr(s); - } - var Al = /^[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC][\$0-9A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]*$/, Tl = (e) => Al.test(e), Ui = Tl; - function dl(e) { - return e.length === 1 ? e : e.toLowerCase().replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(?=\d)/u, "$1$2").replace(/^([+-]?[\d.]+)e[+-]?0+$/u, "$1").replace(/^([+-])?\./u, "$10.").replace(/(\.\d+?)0+(?=e|$)/u, "$1").replace(/\.(?=e|$)/u, ""); - } - var ft = dl; - var yn = /* @__PURE__ */ new WeakMap(); - function Ni(e) { - return /^(?:\d+|\d+\.\d+)$/u.test(e); - } - function Yi(e, t2) { - return t2.parser === "json" || t2.parser === "jsonc" || !te(e.key) || rt(fe(e.key), t2).slice(1, -1) !== e.key.value ? false : !!(Ui(e.key.value) && !(t2.parser === "babel-ts" && e.type === "ClassProperty" || t2.parser === "typescript" && e.type === "PropertyDefinition") || Ni(e.key.value) && String(Number(e.key.value)) === e.key.value && e.type !== "ImportAttribute" && (t2.parser === "babel" || t2.parser === "acorn" || t2.parser === "espree" || t2.parser === "meriyah" || t2.parser === "__babel_estree")); - } - function xl(e, t2) { - let { key: r } = e.node; - return (r.type === "Identifier" || Fe(r) && Ni(ft(fe(r))) && String(r.value) === ft(fe(r)) && !(t2.parser === "typescript" || t2.parser === "babel-ts")) && (t2.parser === "json" || t2.parser === "jsonc" || t2.quoteProps === "consistent" && yn.get(e.parent)); - } - function Et(e, t2, r) { - let { node: n } = e; - if (n.computed) return ["[", r("key"), "]"]; - let { parent: s } = e, { key: u } = n; - if (t2.quoteProps === "consistent" && !yn.has(s)) { - let i = e.siblings.some((a2) => !a2.computed && te(a2.key) && !Yi(a2, t2)); - yn.set(s, i); - } - if (xl(e, t2)) { - let i = rt(JSON.stringify(u.type === "Identifier" ? u.name : u.value.toString()), t2); - return e.call((a2) => ye(a2, i, t2), "key"); - } - return Yi(n, t2) && (t2.quoteProps === "as-needed" || t2.quoteProps === "consistent" && !yn.get(s)) ? e.call((i) => ye(i, /^\d/u.test(u.value) ? ft(u.value) : u.value, t2), "key") : r("key"); - } - function Dn(e, t2, r) { - let { node: n } = e; - return n.shorthand ? r("value") : xt(e, t2, r, Et(e, t2, r), ":", "value"); - } - var hl = ({ node: e, key: t2, parent: r }) => t2 === "value" && e.type === "FunctionExpression" && (r.type === "ObjectMethod" || r.type === "ClassMethod" || r.type === "ClassPrivateMethod" || r.type === "MethodDefinition" || r.type === "TSAbstractMethodDefinition" || r.type === "TSDeclareMethod" || r.type === "Property" && Pt(r)); - function fn(e, t2, r, n) { - if (hl(e)) return En(e, r, t2); - let { node: s } = e, u = false; - if ((s.type === "FunctionDeclaration" || s.type === "FunctionExpression") && (n != null && n.expandLastArg)) { - let { parent: y } = e; - L(y) && (pe(y).length > 1 || z(s).every((D) => D.type === "Identifier" && !D.typeAnnotation)) && (u = true); - } - let i = [K(e), s.async ? "async " : "", `function${s.generator ? "*" : ""} `, s.id ? t2("id") : ""], a2 = Ge(e, t2, r, u), o = $t(e, t2), p = at(s, o); - return i.push(et(e, r, t2), l([p ? l(a2) : a2, o]), s.body ? " " : "", t2("body")), r.semi && (s.declare || !s.body) && i.push(";"), i; - } - function fr(e, t2, r) { - let { node: n } = e, { kind: s } = n, u = n.value || n, i = []; - return !s || s === "init" || s === "method" || s === "constructor" ? u.async && i.push("async ") : (jt.ok(s === "get" || s === "set"), i.push(s, " ")), u.generator && i.push("*"), i.push(Et(e, t2, r), n.optional || n.key.optional ? "?" : "", n === u ? En(e, t2, r) : r("value")), i; - } - function En(e, t2, r) { - let { node: n } = e, s = Ge(e, r, t2), u = $t(e, r), i = Ji(n), a2 = at(n, u), o = [et(e, t2, r), l([i ? l(s, { shouldBreak: true }) : a2 ? l(s) : s, u])]; - return n.body ? o.push(" ", r("body")) : o.push(t2.semi ? ";" : ""), o; - } - function gl(e) { - let t2 = z(e); - return t2.length === 1 && !e.typeParameters && !T(e, h.Dangling) && t2[0].type === "Identifier" && !t2[0].typeAnnotation && !T(t2[0]) && !t2[0].optional && !e.predicate && !e.returnType; - } - function Fn(e, t2) { - if (t2.arrowParens === "always") return false; - if (t2.arrowParens === "avoid") { - let { node: r } = e; - return gl(r); + for (let [i, o] of r.entries()) { + let a2 = Rr(o); + i > 0 && r[i - 1].length > 0 && a2.length > 0 && !(t2 === "quoteDouble" && D(0, D(0, s, -1), -1).endsWith("\\")) ? s[s.length - 1] = [...D(0, s, -1), ...a2] : s.push(a2); } - return false; - } - function $t(e, t2) { - let { node: r } = e, s = [H(e, t2, "returnType")]; - return r.predicate && s.push(t2("predicate")), s; + return n.proseWrap === "never" ? s.map((i) => [i.join(" ")]) : s; } - function Xi(e, t2, r) { - let { node: n } = e, s = t2.semi ? ";" : "", u = []; - if (n.argument) { - let o = r("argument"); - Sl(t2, n.argument) ? o = ["(", f2([F, o]), F, ")"] : (De(n.argument) || n.argument.type === "SequenceExpression" || t2.experimentalTernaries && n.argument.type === "ConditionalExpression" && (n.argument.consequent.type === "ConditionalExpression" || n.argument.alternate.type === "ConditionalExpression")) && (o = l([B("("), f2([E, o]), E, B(")")])), u.push(" ", o); + function $r(t2, { parentIndent: e, isLastDescendant: n, options: r }) { + let s = t2.position.start.line === t2.position.end.line ? "" : r.originalText.slice(t2.position.start.offset, t2.position.end.offset).match(/^[^\n]*\n(.*)$/su)[1], i; + if (t2.indent === null) { + let l = s.match(/^(? *)[^\n\r ]/mu); + i = l ? l.groups.leadingSpace.length : Number.POSITIVE_INFINITY; + } else i = t2.indent - 1 + e; + let o = s.split(` +`).map((l) => l.slice(i)); + if (r.proseWrap === "preserve" || t2.type === "blockLiteral") return c(o.map((l) => l ? [l] : [])); + let a2 = []; + for (let [l, f2] of o.entries()) { + let m = Rr(f2); + l > 0 && m.length > 0 && o[l - 1].length > 0 && !/^\s/u.test(m[0]) && !/^\s|\s$/u.test(D(0, a2, -1)) ? a2[a2.length - 1] = [...D(0, a2, -1), ...m] : a2.push(m); } - let i = T(n, h.Dangling), a2 = s && i && T(n, h.Last | h.Line); - return a2 && u.push(s), i && u.push(" ", J(e, t2)), a2 || u.push(s), u; - } - function Hi(e, t2, r) { - return ["return", Xi(e, t2, r)]; - } - function Vi(e, t2, r) { - return ["throw", Xi(e, t2, r)]; - } - function Sl(e, t2) { - if (Le(e.originalText, t2) || T(t2, h.Leading, (r) => de(e.originalText, q(r), k(r))) && !X(t2)) return true; - if (Rt(t2)) { - let r = t2, n; - for (; n = ou(r); ) if (r = n, Le(e.originalText, r)) return true; + return a2 = a2.map((l) => { + let f2 = []; + for (let m of l) f2.length > 0 && /\s$/u.test(D(0, f2, -1)) ? f2[f2.length - 1] += " " + m : f2.push(m); + return f2; + }), r.proseWrap === "never" && (a2 = a2.map((l) => [l.join(" ")])), c(a2); + function c(l) { + if (t2.chomping === "keep") return D(0, l, -1).length === 0 ? l.slice(0, -1) : l; + let f2 = 0; + for (let m = l.length - 1; m >= 0 && l[m].length === 0; m--) f2++; + return f2 === 0 ? l : f2 >= 2 && !n ? l.slice(0, -(f2 - 1)) : l.slice(0, -f2); } - return false; - } - var gs = /* @__PURE__ */ new WeakMap(); - function $i(e) { - return gs.has(e) || gs.set(e, e.type === "ConditionalExpression" && !ae(e, (t2) => t2.type === "ObjectExpression")), gs.get(e); - } - var Ki = (e) => e.type === "SequenceExpression"; - function Qi(e, t2, r, n = {}) { - let s = [], u, i = [], a2 = false, o = !n.expandLastArg && e.node.body.type === "ArrowFunctionExpression", p; - (function S() { - let { node: g } = e, _2 = Bl(e, t2, r, n); - if (s.length === 0) s.push(_2); - else { - let { leading: v, trailing: j } = ls(e, t2); - s.push([v, _2]), i.unshift(j); - } - o && (a2 || (a2 = g.returnType && z(g).length > 0 || g.typeParameters || z(g).some((v) => v.type !== "Identifier"))), !o || g.body.type !== "ArrowFunctionExpression" ? (u = r("body", n), p = g.body) : e.call(S, "body"); - })(); - let y = !Le(t2.originalText, p) && (Ki(p) || bl(p, u, t2) || !a2 && $i(p)), D = e.key === "callee" && lt(e.parent), m = /* @__PURE__ */ Symbol("arrow-chain"), C = Pl(e, n, { signatureDocs: s, shouldBreak: a2 }), c = false, A2 = false, d = false; - return o && (D || n.assignmentLayout) && (A2 = true, d = !T(e.node, h.Leading & h.Line), c = n.assignmentLayout === "chain-tail-arrow-chain" || D && !y), u = kl(e, t2, n, { bodyDoc: u, bodyComments: i, functionBody: p, shouldPutBodyOnSameLine: y }), l([l(A2 ? f2([d ? E : "", C]) : C, { shouldBreak: c, id: m }), " =>", o ? dt(u, { groupId: m }) : l(u), o && D ? B(E, "", { groupId: m }) : ""]); } - function Bl(e, t2, r, n) { - let { node: s } = e, u = []; - if (s.async && u.push("async "), Fn(e, t2)) u.push(r(["params", 0])); - else { - let a2 = n.expandLastArg || n.expandFirstArg, o = $t(e, r); - if (a2) { - if (re(o)) throw new yt(); - o = l(or(o)); - } - u.push(l([Ge(e, r, t2, a2, true), o])); + function nt(t2) { + if (!t2) return true; + switch (t2.type) { + case "plain": + case "quoteDouble": + case "quoteSingle": + case "alias": + case "flowMapping": + case "flowSequence": + return true; + default: + return false; } - let i = J(e, t2, { filter(a2) { - let o = ut(t2.originalText, k(a2)); - return o !== false && t2.originalText.slice(o, o + 2) === "=>"; - } }); - return i && u.push(" ", i), u; } - function bl(e, t2, r) { - var n, s; - return Y(e) || se(e) || e.type === "ArrowFunctionExpression" || e.type === "DoExpression" || e.type === "BlockStatement" || X(e) || ((n = t2.label) == null ? void 0 : n.hug) !== false && (((s = t2.label) == null ? void 0 : s.embed) || wr(e, r.originalText)); - } - function Pl(e, t2, { signatureDocs: r, shouldBreak: n }) { - if (r.length === 1) return r[0]; - let { parent: s, key: u } = e; - return u !== "callee" && lt(s) || De(s) ? l([r[0], " =>", f2([x, b([" =>", x], r.slice(1))])], { shouldBreak: n }) : u === "callee" && lt(s) || t2.assignmentLayout ? l(b([" =>", x], r), { shouldBreak: n }) : l(f2(b([" =>", x], r)), { shouldBreak: n }); - } - function kl(e, t2, r, { bodyDoc: n, bodyComments: s, functionBody: u, shouldPutBodyOnSameLine: i }) { - let { node: a2, parent: o } = e, p = r.expandLastArg && oe(t2, "all") ? B(",") : "", y = (r.expandLastArg || o.type === "JSXExpressionContainer") && !T(a2) ? E : ""; - return i && $i(u) ? [" ", l([B("", "("), f2([E, n]), B("", ")"), p, y]), s] : (Ki(u) && (n = l(["(", f2([E, n]), E, ")"])), i ? [" ", n, s] : [f2([x, n, s]), p, y]); - } - var Il = (e, t2, r) => { - if (!(e && t2 == null)) { - if (t2.findLast) return t2.findLast(r); - for (let n = t2.length - 1; n >= 0; n--) { - let s = t2[n]; - if (r(s, n, t2)) return s; - } - } - }, zi = Il; - function Er(e, t2, r, n) { - let { node: s } = e, u = [], i = zi(false, s[n], (a2) => a2.type !== "EmptyStatement"); - return e.each(({ node: a2 }) => { - a2.type !== "EmptyStatement" && (u.push(r()), a2 !== i && (u.push(F), ce(a2, t2) && u.push(F))); - }, n), u; - } - function Cn(e, t2, r) { - let n = Ll(e, t2, r), { node: s, parent: u } = e; - if (s.type === "Program" && (u == null ? void 0 : u.type) !== "ModuleExpression") return n ? [n, F] : ""; - let i = []; - if (s.type === "StaticBlock" && i.push("static "), i.push("{"), n) i.push(f2([F, n]), F); - else { - let a2 = e.grandparent; - u.type === "ArrowFunctionExpression" || u.type === "FunctionExpression" || u.type === "FunctionDeclaration" || u.type === "ComponentDeclaration" || u.type === "HookDeclaration" || u.type === "ObjectMethod" || u.type === "ClassMethod" || u.type === "ClassPrivateMethod" || u.type === "ForStatement" || u.type === "WhileStatement" || u.type === "DoWhileStatement" || u.type === "DoExpression" || u.type === "ModuleExpression" || u.type === "CatchClause" && !a2.finalizer || u.type === "TSModuleDeclaration" || s.type === "StaticBlock" || i.push(F); + var gn = /* @__PURE__ */ new WeakMap(); + function Pt(t2, e) { + let { node: n, root: r } = t2, s; + return gn.has(r) ? s = gn.get(r) : (s = /* @__PURE__ */ new Set(), gn.set(r, s)), !s.has(n.position.end.line) && (s.add(n.position.end.line), _r(n, e) && !yn(t2.parent)) ? Tt : ""; + } + function yn(t2) { + return I(t2) && !W(t2, ["documentHead", "documentBody", "flowMapping", "flowSequence"]); + } + function _(t2, e) { + return Je(" ".repeat(t2), e); + } + function zi(t2, e, n) { + let { node: r } = t2, s = t2.ancestors.filter((l) => l.type === "sequence" || l.type === "mapping").length, i = Mt(t2), o = [r.type === "blockFolded" ? ">" : "|"]; + r.indent !== null && o.push(r.indent.toString()), r.chomping !== "clip" && o.push(r.chomping === "keep" ? "+" : "-"), dn(r) && o.push(" ", n("indicatorComment")); + let a2 = $r(r, { parentIndent: s, isLastDescendant: i, options: e }), c = []; + for (let [l, f2] of a2.entries()) l === 0 && c.push(N), c.push(Lt(v(se, f2))), l !== a2.length - 1 ? c.push(f2.length === 0 ? N : ur(He)) : r.chomping === "keep" && i && c.push(an(f2.length === 0 ? N : He)); + return r.indent === null ? o.push(pr(_(e.tabWidth, c))) : o.push(an(_(r.indent - 1 + s, c))), o; + } + var Yr = zi; + function vt(t2, e, n) { + let { node: r } = t2, s = r.type === "flowMapping", i = s ? "{" : "[", o = s ? "}" : "]", a2 = Tt; + s && r.children.length > 0 && e.bracketSpacing && (a2 = se); + let c = D(0, r.children, -1), l = (c == null ? void 0 : c.type) === "flowMappingItem" && _e(c.key) && _e(c.value); + return [i, _(e.tabWidth, [a2, Zi(t2, e, n), e.trailingComma === "none" ? "" : ze(","), I(r) ? [N, v(N, t2.map(n, "endComments"))] : ""]), l ? "" : a2, o]; + } + function Zi(t2, e, n) { + return t2.map(({ isLast: r, node: s, next: i }) => [n(), r ? "" : [",", se, s.position.start.line !== i.position.start.line ? Pt(t2, e.originalText) : ""]], "children"); + } + function eo(t2, e, n) { + var _a3; + let { node: r, parent: s } = t2, { key: i, value: o } = r, a2 = _e(i), c = _e(o); + if (a2 && c) return ": "; + let l = n("key"), f2 = to(r) ? " " : ""; + if (c) return r.type === "flowMappingItem" && s.type === "flowMapping" ? l : r.type === "mappingItem" && En(i.content, e) && !K(i.content) && ((_a3 = s.tag) == null ? void 0 : _a3.value) !== "tag:yaml.org,2002:set" ? [l, f2, ":"] : ["? ", _(2, l)]; + let m = n("value"); + if (a2) return [": ", _(2, m)]; + if (te(o) || !nt(i.content)) return ["? ", _(2, l), N, ...t2.map(() => [n(), N], "value", "leadingComments"), ": ", _(2, m)]; + if (no(i.content) && !te(i.content) && !ae(i.content) && !K(i.content) && !I(i) && !te(o.content) && !ae(o.content) && !I(o) && En(o.content, e)) return [l, f2, ": ", m]; + let g = /* @__PURE__ */ Symbol("mappingKey"), y = Pe([ze("? "), Pe(_(2, l), { id: g })]), h = [N, ": ", _(2, m)], d = [f2, ":"]; + I(o) && o.content && W(o.content, ["flowMapping", "flowSequence"]) && o.content.children.length === 0 ? d.push(" ") : te(o.content) || I(o) && o.content && !W(o.content, ["mapping", "sequence"]) || s.type === "mapping" && K(i.content) && nt(o.content) || W(o.content, ["mapping", "sequence"]) && o.content.tag === null && o.content.anchor === null ? d.push(N) : o.content ? d.push(se) : K(o) && d.push(" "), d.push(m); + let w = _(e.tabWidth, d); + return En(i.content, e) && !te(i.content) && !ae(i.content) && !K(i.content) && !I(i) ? cn([[l, w]]) : cn([[y, ze(h, w, { groupId: g })]]); + } + function En(t2, e) { + if (!t2) return true; + switch (t2.type) { + case "plain": + case "quoteSingle": + case "quoteDouble": + break; + case "alias": + return true; + default: + return false; } - return i.push("}"), i; - } - function Ll(e, t2, r) { - let { node: n } = e, s = O(n.directives), u = n.body.some((o) => o.type !== "EmptyStatement"), i = T(n, h.Dangling); - if (!s && !u && !i) return ""; - let a2 = []; - return s && (a2.push(Er(e, t2, r, "directives")), (u || i) && (a2.push(F), ce(M(false, n.directives, -1), t2) && a2.push(F))), u && a2.push(Er(e, t2, r, "body")), i && a2.push(J(e, t2)), a2; - } - function wl(e) { - let t2 = /* @__PURE__ */ new WeakMap(); - return function(r) { - return t2.has(r) || t2.set(r, Symbol(e)), t2.get(r); - }; - } - var An = wl; - function Ol(e) { - switch (e) { - case null: - return ""; - case "PlusOptional": - return "+?"; - case "MinusOptional": - return "-?"; - case "Optional": - return "?"; + if (e.proseWrap === "preserve") return t2.position.start.line === t2.position.end.line; + if (/\\$/mu.test(e.originalText.slice(t2.position.start.offset, t2.position.end.offset))) return false; + switch (e.proseWrap) { + case "never": + return !t2.value.includes(` +`); + case "always": + return !/[\n ]/u.test(t2.value); + default: + return false; } } - function Zi(e, t2, r) { - let { node: n } = e; - return l([n.variance ? r("variance") : "", "[", f2([r("keyTparam"), " in ", r("sourceType")]), "]", Ol(n.optional), ": ", r("propType")]); - } - function Ss(e, t2) { - return e === "+" || e === "-" ? e + t2 : t2; - } - function ea(e, t2, r) { - let { node: n } = e, s = t2.objectWrap === "preserve" && de(t2.originalText, q(n), q(n.typeParameter)); - return l(["{", f2([t2.bracketSpacing ? x : E, l([r("typeParameter"), n.optional ? Ss(n.optional, "?") : "", n.typeAnnotation ? ": " : "", r("typeAnnotation")]), t2.semi ? B(";") : ""]), J(e, t2), t2.bracketSpacing ? x : E, "}"], { shouldBreak: s }); - } - var Fr = An("typeParameters"); - function _l(e, t2, r) { - let { node: n } = e; - return z(n).length === 1 && n.type.startsWith("TS") && !n[r][0].constraint && e.parent.type === "ArrowFunctionExpression" && !(t2.filepath && /\.ts$/u.test(t2.filepath)); + function to(t2) { + var _a3; + return ((_a3 = t2.key.content) == null ? void 0 : _a3.type) === "alias"; } - function wt(e, t2, r, n) { - let { node: s } = e; - if (!s[n]) return ""; - if (!Array.isArray(s[n])) return r(n); - let u = kt(e.grandparent), i = e.match((p) => !(p[n].length === 1 && Me(p[n][0])), void 0, (p, y) => y === "typeAnnotation", (p) => p.type === "Identifier", Ts); - if (s[n].length === 0 || !i && (u || s[n].length === 1 && (s[n][0].type === "NullableTypeAnnotation" || xs(s[n][0])))) return ["<", b(", ", e.map(r, n)), vl(e, t2), ">"]; - let o = s.type === "TSTypeParameterInstantiation" ? "" : _l(e, t2, n) ? "," : oe(t2) ? B(",") : ""; - return l(["<", f2([E, b([",", x], e.map(r, n))]), o, E, ">"], { id: Fr(s) }); + function no(t2) { + if (!t2) return true; + switch (t2.type) { + case "plain": + case "quoteDouble": + case "quoteSingle": + return t2.position.start.line === t2.position.end.line; + case "alias": + return true; + default: + return false; + } } - function vl(e, t2) { - let { node: r } = e; - if (!T(r, h.Dangling)) return ""; - let n = !T(r, h.Line), s = J(e, t2, { indent: !n }); - return n ? s : [s, F]; + var Br = eo; + function ro(t2) { + return hn(t2, so); } - function Tn(e, t2, r) { - let { node: n, parent: s } = e, u = [n.const ? "const " : ""], i = n.type === "TSTypeParameter" ? r("name") : n.name; - if (s.type === "TSMappedType") return s.readonly && u.push(Ss(s.readonly, "readonly"), " "), u.push("[", i), n.constraint && u.push(" in ", r("constraint")), s.nameType && u.push(" as ", e.callParent(() => r("nameType"))), u.push("]"), u; - if (n.variance && u.push(r("variance")), n.in && u.push("in "), n.out && u.push("out "), u.push(i), n.bound && (n.usesExtendsBound && u.push(" extends "), u.push(H(e, r, "bound"))), n.constraint) { - let a2 = /* @__PURE__ */ Symbol("constraint"); - u.push(" extends", l(f2(x), { id: a2 }), ve, dt(r("constraint"), { groupId: a2 })); + function so(t2) { + switch (t2.type) { + case "document": + Ie(t2, "head", () => t2.children[0]), Ie(t2, "body", () => t2.children[1]); + break; + case "documentBody": + case "sequenceItem": + case "flowSequenceItem": + case "mappingKey": + case "mappingValue": + Ie(t2, "content", () => t2.children[0]); + break; + case "mappingItem": + case "flowMappingItem": + Ie(t2, "key", () => t2.children[0]), Ie(t2, "value", () => t2.children[1]); + break; } - return n.default && u.push(" = ", r("default")), l(u); + return t2; } - var ta = R(["ClassProperty", "PropertyDefinition", "ClassPrivateProperty", "ClassAccessorProperty", "AccessorProperty", "TSAbstractPropertyDefinition", "TSAbstractAccessorProperty"]); - function dn(e, t2, r) { - let { node: n } = e, s = [K(e), Xt(e), "class"], u = T(n.id, h.Trailing) || T(n.typeParameters, h.Trailing) || T(n.superClass) || O(n.extends) || O(n.mixins) || O(n.implements), i = [], a2 = []; - if (n.id && i.push(" ", r("id")), i.push(r("typeParameters")), n.superClass) { - let y = [Ml(e, t2, r), r(n.superTypeArguments ? "superTypeArguments" : "superTypeParameters")], D = e.call((m) => ["extends ", ye(m, y, t2)], "superClass"); - u ? a2.push(x, l(D)) : a2.push(" ", D); - } else a2.push(Bs(e, t2, r, "extends")); - a2.push(Bs(e, t2, r, "mixins"), Bs(e, t2, r, "implements")); - let o; - if (u) { - let y; - sa(n) ? y = [...i, f2(a2)] : y = f2([...i, a2]), o = ra(n), s.push(l(y, { id: o })); - } else s.push(...i, ...a2); - let p = n.body; - return u && O(p.body) ? s.push(B(F, " ", { groupId: o })) : s.push(" "), s.push(r("body")), s; + var Fr = ro; + function io(t2, e, n) { + let { node: r } = t2, s = []; + r.type !== "mappingValue" && te(r) && s.push([v(N, t2.map(n, "leadingComments")), N]); + let { tag: i, anchor: o } = r; + i && s.push(n("tag")), i && o && s.push(" "), o && s.push(n("anchor")); + let a2 = ""; + return W(r, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !Mt(t2) && (a2 = Pt(t2, e.originalText)), (i || o) && (W(r, ["sequence", "mapping"]) && !ae(r) ? s.push(N) : s.push(" ")), ae(r) && s.push([r.middleComments.length === 1 ? "" : N, v(N, t2.map(n, "middleComments")), N]), xr(t2) ? s.push(cr(e.originalText.slice(r.position.start.offset, r.position.end.offset).trimEnd())) : s.push(Pe(oo(t2, e, n))), K(r) && !W(r, ["document", "documentHead"]) && s.push(mr([r.type === "mappingValue" && !r.content ? "" : " ", t2.parent.type === "mappingKey" && t2.getParentNode(2).type === "mapping" && nt(r) ? "" : Xe, n("trailingComment")])), yn(r) && s.push(_(r.type === "sequenceItem" ? 2 : 0, [N, v(N, t2.map(({ node: c }) => [un(e.originalText, tt(c)) ? N : "", n()], "endComments"))])), s.push(a2), s; } - var ra = An("heritageGroup"); - function na(e) { - return B(F, "", { groupId: ra(e) }); + function oo(t2, e, n) { + let { node: r } = t2; + switch (r.type) { + case "root": { + let s = kt(r), i = !(W(s, ["blockLiteral", "blockFolded"]) && s.chomping === "keep"), o = []; + return t2.each(({ node: a2, isFirst: c }) => { + c || o.push(N), o.push(n()), co(t2) && (i && o.push(N), o.push("..."), K(a2) && o.push(" ", n("trailingComment"))); + }, "children"), i && o.push(N), o; + } + case "document": { + let s = []; + return lo(t2) && ((r.head.children.length > 0 || r.head.endComments.length > 0) && s.push(n("head")), K(r.head) ? s.push(["---", " ", n(["head", "trailingComment"])]) : s.push("---")), ao(r) && s.push(n("body")), v(N, s); + } + case "documentHead": + return v(N, [...t2.map(n, "children"), ...t2.map(n, "endComments")]); + case "documentBody": { + let { children: s, endComments: i } = r, o = ""; + if (s.length > 0 && i.length > 0) { + let a2 = kt(r); + if (W(a2, ["blockFolded", "blockLiteral"])) a2.chomping !== "keep" && (o = [N, N]); + else { + let c = D(0, s, -1); + o = W(c, ["mapping"]) && un(e.originalText, tt(i[0])) ? [N, N] : N; + } + } + return [v(N, t2.map(n, "children")), o, v(N, t2.map(n, "endComments"))]; + } + case "directive": + return ["%", v(" ", [r.name, ...r.parameters])]; + case "comment": + return ["#", r.value]; + case "alias": + return ["*", r.value]; + case "tag": + return e.originalText.slice(r.position.start.offset, r.position.end.offset); + case "anchor": + return ["&", r.value]; + case "plain": + return rt(r.type, e.originalText.slice(r.position.start.offset, r.position.end.offset), e); + case "quoteDouble": + case "quoteSingle": { + let o = e.originalText.slice(r.position.start.offset + 1, r.position.end.offset - 1); + if (r.type === "quoteSingle" && o.includes("\\") || r.type === "quoteDouble" && /\\[^"]/u.test(o)) { + let c = r.type === "quoteDouble" ? '"' : "'"; + return [c, rt(r.type, o, e), c]; + } + if (o.includes('"')) return ["'", rt(r.type, r.type === "quoteDouble" ? dt(0, dt(0, o, '\\"', '"'), "'", "'".repeat(2)) : o, e), "'"]; + if (o.includes("'")) return ['"', rt(r.type, r.type === "quoteSingle" ? dt(0, o, "''", "'") : o, e), '"']; + let a2 = e.singleQuote ? "'" : '"'; + return [a2, rt(r.type, o, e), a2]; + } + case "blockFolded": + case "blockLiteral": + return Yr(t2, e, n); + case "mapping": + case "sequence": + return v(N, t2.map(n, "children")); + case "sequenceItem": + return ["- ", _(2, r.content ? n("content") : "")]; + case "mappingKey": + case "mappingValue": + return r.content ? n("content") : ""; + case "mappingItem": + case "flowMappingItem": + return Br(t2, e, n); + case "flowMapping": + return vt(t2, e, n); + case "flowSequence": + return vt(t2, e, n); + case "flowSequenceItem": + return n("content"); + default: + throw new dr(r, "YAML"); + } } - function jl(e) { - return ["extends", "mixins", "implements"].reduce((t2, r) => t2 + (Array.isArray(e[r]) ? e[r].length : 0), e.superClass ? 1 : 0) > 1; + function ao(t2) { + return t2.body.children.length > 0 || I(t2.body); } - function sa(e) { - return e.typeParameters && !T(e.typeParameters, h.Trailing | h.Line) && !jl(e); + function co(t2) { + let e = t2.node; + if (e.documentEndMarker || K(e)) return true; + if (t2.isLast) return false; + let n = t2.next; + return n.head.children.length > 0 || I(n.head); + } + function lo(t2) { + let e = t2.node; + return e.directivesEndMarker || e.head.children.length > 0 || I(e.head) || K(e.head); + } + function rt(t2, e, n) { + let r = Dr(t2, e, n); + return v(N, r.map((s) => Lt(v(se, s)))); + } + var fo = { preprocess: Fr, embed: Cr, print: io, massageAstNode: Lr, insertPragma: Or, getVisitorKeys: Pr }, qr = fo; + var Ur = [{ name: "YAML", type: "data", aceMode: "yaml", extensions: [".yml", ".mir", ".reek", ".rviz", ".sublime-syntax", ".syntax", ".yaml", ".yaml-tmlanguage", ".yaml.sed", ".yml.mysql"], filenames: [".clang-format", ".clang-tidy", ".clangd", ".gemrc", "CITATION.cff", "glide.lock", "pixi.lock", ".prettierrc", ".stylelintrc", ".lintstagedrc"], tmScope: "source.yaml", aliases: ["yml"], codemirrorMode: "yaml", codemirrorMimeType: "text/x-yaml", parsers: ["yaml"], vscodeLanguageIds: ["yaml", "ansible", "dockercompose", "github-actions-workflow", "home-assistant"], linguistLanguageId: 407 }]; + var It = { bracketSpacing: { category: "Common", type: "boolean", default: true, description: "Print spaces between brackets.", oppositeDescription: "Do not print spaces between brackets." }, objectWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap object literals.", choices: [{ value: "preserve", description: "Keep as multi-line, if there is a newline between the opening brace and first property." }, { value: "collapse", description: "Fit to a single line when possible." }] }, singleQuote: { category: "Common", type: "boolean", default: false, description: "Use single quotes instead of double quotes." }, proseWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap prose.", choices: [{ value: "always", description: "Wrap prose if it exceeds the print width." }, { value: "never", description: "Do not wrap prose." }, { value: "preserve", description: "Wrap prose as-is." }] }, bracketSameLine: { category: "Common", type: "boolean", default: false, description: "Put > of opening tags on the last line instead of on a new line." }, singleAttributePerLine: { category: "Common", type: "boolean", default: false, description: "Enforce single attribute per line in HTML, Vue and JSX." } }; + var uo = { bracketSpacing: It.bracketSpacing, singleQuote: It.singleQuote, proseWrap: It.proseWrap }, Vr = uo; + var rr = {}; + sr(rr, { yaml: () => Ga }); + var nr = or(Ps(), 1); + var J = or(vs(), 1), Tf = J.default.findPair, Cf = J.default.toJSON, Mf = J.default.parseMap, kf = J.default.parseSeq, Pf = J.default.stringifyNumber, vf = J.default.stringifyString, If = J.default.Type, _f = J.default.YAMLError, xf = J.default.YAMLReferenceError, Is2 = J.default.YAMLSemanticError, Rf = J.default.YAMLSyntaxError, Df = J.default.YAMLWarning; + function F(t2, e = null) { + "children" in t2 && t2.children.forEach((n) => F(n, t2)), "anchor" in t2 && t2.anchor && F(t2.anchor, t2), "tag" in t2 && t2.tag && F(t2.tag, t2), "leadingComments" in t2 && t2.leadingComments.forEach((n) => F(n, t2)), "middleComments" in t2 && t2.middleComments.forEach((n) => F(n, t2)), "indicatorComment" in t2 && t2.indicatorComment && F(t2.indicatorComment, t2), "trailingComment" in t2 && t2.trailingComment && F(t2.trailingComment, t2), "endComments" in t2 && t2.endComments.forEach((n) => F(n, t2)), Object.defineProperty(t2, "_parent", { value: e, enumerable: false }); + } + function Oe(t2) { + return `${t2.line}:${t2.column}`; } - function Bs(e, t2, r, n) { - let { node: s } = e; - if (!O(s[n])) return ""; - let u = J(e, t2, { marker: n }); - return [sa(s) ? B(" ", x, { groupId: Fr(s.typeParameters) }) : x, u, u && F, n, l(f2([x, b([",", x], e.map(r, n))]))]; + function _s(t2) { + F(t2); + let e = Ia(t2), n = t2.children.slice(); + t2.comments.sort((r, s) => r.position.start.offset - s.position.end.offset).filter((r) => !r._parent).forEach((r) => { + for (; n.length > 1 && r.position.start.line > n[0].position.end.line; ) n.shift(); + _a(r, e, n[0]); + }); } - function Ml(e, t2, r) { - let n = r("superClass"), { parent: s } = e; - return s.type === "AssignmentExpression" ? l(B(["(", f2([E, n]), E, ")"], n)) : n; + function Ia(t2) { + let e = Array.from(new Array(t2.position.end.line), () => ({})); + for (let n of t2.comments) e[n.position.start.line - 1].comment = n; + return xs(e, t2), e; } - function xn(e, t2, r) { - let { node: n } = e, s = []; - return O(n.decorators) && s.push(Fs(e, t2, r)), s.push(Ht(n)), n.static && s.push("static "), s.push(Xt(e)), n.override && s.push("override "), s.push(fr(e, t2, r)), s; + function xs(t2, e) { + if (e.position.start.offset !== e.position.end.offset) { + if ("leadingComments" in e) { + let { start: n } = e.position, { leadingAttachableNode: r } = t2[n.line - 1]; + (!r || n.column < r.position.start.column) && (t2[n.line - 1].leadingAttachableNode = e); + } + if ("trailingComment" in e && e.position.end.column > 1 && e.type !== "document" && e.type !== "documentHead") { + let { end: n } = e.position, { trailingAttachableNode: r } = t2[n.line - 1]; + (!r || n.column >= r.position.end.column) && (t2[n.line - 1].trailingAttachableNode = e); + } + if (e.type !== "root" && e.type !== "document" && e.type !== "documentHead" && e.type !== "documentBody") { + let { start: n, end: r } = e.position, s = [r.line].concat(n.line === r.line ? [] : n.line); + for (let i of s) { + let o = t2[i - 1].trailingNode; + (!o || r.column >= o.position.end.column) && (t2[i - 1].trailingNode = e); + } + } + "children" in e && e.children.forEach((n) => { + xs(t2, n); + }); + } } - function hn(e, t2, r) { - let { node: n } = e, s = [], u = t2.semi ? ";" : ""; - O(n.decorators) && s.push(Fs(e, t2, r)), s.push(K(e), Ht(n)), n.static && s.push("static "), s.push(Xt(e)), n.override && s.push("override "), n.readonly && s.push("readonly "), n.variance && s.push(r("variance")), (n.type === "ClassAccessorProperty" || n.type === "AccessorProperty" || n.type === "TSAbstractAccessorProperty") && s.push("accessor "), s.push(Et(e, t2, r), $(e), ln(e), H(e, r)); - let i = n.type === "TSAbstractPropertyDefinition" || n.type === "TSAbstractAccessorProperty"; - return [xt(e, t2, r, s, " =", i ? void 0 : "value"), u]; + function _a(t2, e, n) { + let r = t2.position.start.line, { trailingAttachableNode: s } = e[r - 1]; + if (s) { + if (s.trailingComment) throw new Error(`Unexpected multiple trailing comment at ${Oe(t2.position.start)}`); + F(t2, s), s.trailingComment = t2; + return; + } + for (let o = r; o >= n.position.start.line; o--) { + let { trailingNode: a2 } = e[o - 1], c; + if (a2) c = a2; + else if (o !== r && e[o - 1].comment) c = e[o - 1].comment._parent; + else continue; + if ((c.type === "sequence" || c.type === "mapping") && (c = c.children[0]), c.type === "mappingItem") { + let [l, f2] = c.children; + c = Rs(l) ? l : f2; + } + for (; ; ) { + if (xa(c, t2)) { + F(t2, c), c.endComments.push(t2); + return; + } + if (!c._parent) break; + c = c._parent; + } + break; + } + for (let o = r + 1; o <= n.position.end.line; o++) { + let { leadingAttachableNode: a2 } = e[o - 1]; + if (a2) { + F(t2, a2), a2.leadingComments.push(t2); + return; + } + } + let i = n.children[1]; + F(t2, i), i.endComments.push(t2); } - function ua(e, t2, r) { - let { node: n } = e, s = []; - return e.each(({ node: u, next: i, isLast: a2 }) => { - s.push(r()), !t2.semi && ta(u) && Rl(u, i) && s.push(";"), a2 || (s.push(F), ce(u, t2) && s.push(F)); - }, "body"), T(n, h.Dangling) && s.push(J(e, t2)), ["{", s.length > 0 ? [f2([F, s]), F] : "", "}"]; - } - function Rl(e, t2) { - var s; - let { type: r, name: n } = e.key; - if (!e.computed && r === "Identifier" && (n === "static" || n === "get" || n === "set") && !e.value && !e.typeAnnotation) return true; - if (!t2 || t2.static || t2.accessibility || t2.readonly) return false; - if (!t2.computed) { - let u = (s = t2.key) == null ? void 0 : s.name; - if (u === "in" || u === "instanceof") return true; + function xa(t2, e) { + if (t2.position.start.offset < e.position.start.offset && t2.position.end.offset > e.position.end.offset) switch (t2.type) { + case "flowMapping": + case "flowSequence": + return t2.children.length === 0 || e.position.start.line > t2.children[t2.children.length - 1].position.end.line; } - if (ta(t2) && t2.variance && !t2.static && !t2.declare) return true; + if (e.position.end.offset < t2.position.end.offset) return false; switch (t2.type) { - case "ClassProperty": - case "PropertyDefinition": - case "TSAbstractPropertyDefinition": - return t2.computed; - case "MethodDefinition": - case "TSAbstractMethodDefinition": - case "ClassMethod": - case "ClassPrivateMethod": { - if ((t2.value ? t2.value.async : t2.async) || t2.kind === "get" || t2.kind === "set") return false; - let i = t2.value ? t2.value.generator : t2.generator; - return !!(t2.computed || i); - } - case "TSIndexSignature": - return true; + case "sequenceItem": + return e.position.start.column > t2.position.start.column; + case "mappingKey": + case "mappingValue": + return e.position.start.column > t2._parent.position.start.column && (t2.children.length === 0 || t2.children.length === 1 && t2.children[0].type !== "blockFolded" && t2.children[0].type !== "blockLiteral") && (t2.type === "mappingValue" || Rs(t2)); + default: + return false; } - return false; } - var Jl = R(["TSAsExpression", "TSTypeAssertion", "TSNonNullExpression", "TSInstantiationExpression", "TSSatisfiesExpression"]); - function bs(e) { - return Jl(e) ? bs(e.expression) : e; + function Rs(t2) { + return t2.position.start !== t2.position.end && (t2.children.length === 0 || t2.position.start.offset !== t2.children[0].position.start.offset); } - var ia = R(["FunctionExpression", "ArrowFunctionExpression"]); - function aa(e) { - return e.type === "MemberExpression" || e.type === "OptionalMemberExpression" || e.type === "Identifier" && e.name !== "undefined"; + function b(t2, e) { + return { type: t2, position: e }; } - function oa(e, t2) { - if (t2.semi || Ps(e, t2) || ks(e, t2)) return false; - let { node: r, key: n, parent: s } = e; - return !!(r.type === "ExpressionStatement" && (n === "body" && (s.type === "Program" || s.type === "BlockStatement" || s.type === "StaticBlock" || s.type === "TSModuleBlock") || n === "consequent" && s.type === "SwitchCase") && e.call(() => pa(e, t2), "expression")); + function Ds(t2, e, n) { + return { ...b("root", t2), children: e, comments: n }; } - function pa(e, t2) { - let { node: r } = e; - switch (r.type) { - case "ParenthesizedExpression": - case "TypeCastExpression": - case "ArrayExpression": - case "ArrayPattern": - case "TemplateLiteral": - case "TemplateElement": - case "RegExpLiteral": - return true; - case "ArrowFunctionExpression": - if (!Fn(e, t2)) return true; + function pt(t2) { + switch (t2.type) { + case "DOCUMENT": + for (let e = t2.contents.length - 1; e >= 0; e--) t2.contents[e].type === "BLANK_LINE" ? t2.contents.splice(e, 1) : pt(t2.contents[e]); + for (let e = t2.directives.length - 1; e >= 0; e--) t2.directives[e].type === "BLANK_LINE" && t2.directives.splice(e, 1); break; - case "UnaryExpression": { - let { prefix: n, operator: s } = r; - if (n && (s === "+" || s === "-")) return true; + case "FLOW_MAP": + case "FLOW_SEQ": + case "MAP": + case "SEQ": + for (let e = t2.items.length - 1; e >= 0; e--) { + let n = t2.items[e]; + "char" in n || (n.type === "BLANK_LINE" ? t2.items.splice(e, 1) : pt(n)); + } break; - } - case "BindExpression": - if (!r.object) return true; + case "MAP_KEY": + case "MAP_VALUE": + case "SEQ_ITEM": + t2.node && pt(t2.node); break; - case "Literal": - if (r.regex) return true; + case "ALIAS": + case "BLANK_LINE": + case "BLOCK_FOLDED": + case "BLOCK_LITERAL": + case "COMMENT": + case "DIRECTIVE": + case "PLAIN": + case "QUOTE_DOUBLE": + case "QUOTE_SINGLE": break; default: - if (X(r)) return true; + throw new Error(`Unexpected node type ${JSON.stringify(t2.type)}`); } - return ke(e, t2) ? true : Rt(r) ? e.call(() => pa(e, t2), ...kr(r)) : false; - } - function Ps({ node: e, parent: t2 }, r) { - return (r.parentParser === "markdown" || r.parentParser === "mdx") && e.type === "ExpressionStatement" && X(e.expression) && t2.type === "Program" && t2.body.length === 1; } - function ks({ node: e, parent: t2 }, r) { - return (r.parser === "__vue_event_binding" || r.parser === "__vue_ts_event_binding") && e.type === "ExpressionStatement" && t2.type === "Program" && t2.body.length === 1; - } - function ca(e, t2, r) { - let n = [r("expression")]; - if (ks(e, t2)) { - let s = bs(e.node.expression); - (ia(s) || aa(s)) && n.push(";"); - } else Ps(e, t2) || t2.semi && n.push(";"); - return n; - } - function la(e, t2, r) { - if (t2.__isVueBindings || t2.__isVueForBindingLeft) { - let n = e.map(r, "program", "body", 0, "params"); - if (n.length === 1) return n[0]; - let s = b([",", x], n); - return t2.__isVueForBindingLeft ? ["(", f2([E, l(s)]), E, ")"] : s; - } - if (t2.__isEmbeddedTypescriptGenericParameters) { - let n = e.map(r, "program", "body", 0, "typeParameters", "params"); - return b([",", x], n); - } + function X(t2, e) { + return { start: t2, end: e }; } - function Da(e, t2) { - let { node: r } = e; - switch (r.type) { - case "RegExpLiteral": - return ma(r); - case "BigIntLiteral": - return gn(r.extra.raw); - case "NumericLiteral": - return ft(r.extra.raw); - case "StringLiteral": - return _e(rt(r.extra.raw, t2)); - case "NullLiteral": - return "null"; - case "BooleanLiteral": - return String(r.value); - case "DirectiveLiteral": - return ya(r.extra.raw, t2); - case "Literal": { - if (r.regex) return ma(r.regex); - if (r.bigint) return gn(r.raw); - let { value: n } = r; - return typeof n == "number" ? ft(r.raw) : typeof n == "string" ? ql(e) ? ya(r.raw, t2) : _e(rt(r.raw, t2)) : String(n); - } - } + function Qn(t2) { + return { start: t2, end: t2 }; } - function ql(e) { - if (e.key !== "expression") return; - let { parent: t2 } = e; - return t2.type === "ExpressionStatement" && t2.directive; + var me; + (function(t2) { + t2.Tag = "!", t2.Anchor = "&", t2.Comment = "#"; + })(me || (me = {})); + function $s(t2, e) { + return { ...b("anchor", t2), value: e }; } - function gn(e) { - return e.toLowerCase(); + function Ve(t2, e) { + return { ...b("comment", t2), value: e }; } - function ma({ pattern: e, flags: t2 }) { - return t2 = [...t2].sort().join(""), `/${e}/${t2}`; + function Ys(t2, e, n) { + return { anchor: e, tag: t2, middleComments: n }; } - function ya(e, t2) { - let r = e.slice(1, -1); - if (r.includes('"') || r.includes("'")) return e; - let n = t2.singleQuote ? "'" : '"'; - return n + r + n; + function Bs(t2, e) { + return { ...b("tag", t2), value: e }; } - function Wl(e, t2, r) { - let n = e.originalText.slice(t2, r); - for (let s of e[/* @__PURE__ */ Symbol.for("comments")]) { - let u = q(s); - if (u > r) break; - let i = k(s); - if (i < t2) continue; - let a2 = i - u; - n = n.slice(0, u - t2) + " ".repeat(a2) + n.slice(i - t2); + function Jt(t2, e, n = () => false) { + let r = t2.cstNode, s = [], i = null, o = null, a2 = null; + for (let c of r.props) { + let l = e.text[c.origStart]; + switch (l) { + case me.Tag: + i = i || c, o = Bs(e.transformRange(c), t2.tag); + break; + case me.Anchor: + i = i || c, a2 = $s(e.transformRange(c), r.anchor); + break; + case me.Comment: { + let f2 = Ve(e.transformRange(c), e.text.slice(c.origStart + 1, c.origEnd)); + e.comments.push(f2), !n(f2) && i && i.origEnd <= c.origStart && c.origEnd <= r.valueRange.origStart && s.push(f2); + break; + } + default: + throw new Error(`Unexpected leading character ${JSON.stringify(l)}`); + } } - return n; - } - var Is2 = Wl; - function fa(e, t2, r) { - let { node: n } = e; - return ["import", n.phase ? ` ${n.phase}` : "", ws(n), Ca(e, t2, r), Fa(e, t2, r), Ta(e, t2, r), t2.semi ? ";" : ""]; - } - var Ea = (e) => e.type === "ExportDefaultDeclaration" || e.type === "DeclareExportDeclaration" && e.default; - function Sn(e, t2, r) { - let { node: n } = e, s = [gi(e, t2, r), K(e), "export", Ea(n) ? " default" : ""], { declaration: u, exported: i } = n; - return T(n, h.Dangling) && (s.push(" ", J(e, t2)), Or(n) && s.push(F)), u ? s.push(" ", r("declaration")) : (s.push(Yl(n)), n.type === "ExportAllDeclaration" || n.type === "DeclareExportAllDeclaration" ? (s.push(" *"), i && s.push(" as ", r("exported"))) : s.push(Ca(e, t2, r)), s.push(Fa(e, t2, r), Ta(e, t2, r))), s.push(Ul(n, t2)), s; - } - var Gl = R(["ClassDeclaration", "ComponentDeclaration", "FunctionDeclaration", "TSInterfaceDeclaration", "DeclareClass", "DeclareComponent", "DeclareFunction", "DeclareHook", "HookDeclaration", "TSDeclareFunction", "EnumDeclaration"]); - function Ul(e, t2) { - return t2.semi && (!e.declaration || Ea(e) && !Gl(e.declaration)) ? ";" : ""; - } - function Ls(e, t2 = true) { - return e && e !== "value" ? `${t2 ? " " : ""}${e}${t2 ? "" : " "}` : ""; + return Ys(o, a2, s); } - function ws(e, t2) { - return Ls(e.importKind, t2); - } - function Yl(e) { - return Ls(e.exportKind); - } - function Fa(e, t2, r) { - let { node: n } = e; - if (!n.source) return ""; - let s = []; - return Aa(n, t2) && s.push(" from"), s.push(" ", r("source")), s; + function z() { + return { leadingComments: [] }; } - function Ca(e, t2, r) { - let { node: n } = e; - if (!Aa(n, t2)) return ""; - let s = [" "]; - if (O(n.specifiers)) { - let u = [], i = []; - e.each(() => { - let a2 = e.node.type; - if (a2 === "ExportNamespaceSpecifier" || a2 === "ExportDefaultSpecifier" || a2 === "ImportNamespaceSpecifier" || a2 === "ImportDefaultSpecifier") u.push(r()); - else if (a2 === "ExportSpecifier" || a2 === "ImportSpecifier") i.push(r()); - else throw new qe(n, "specifier"); - }, "specifiers"), s.push(b(", ", u)), i.length > 0 && (u.length > 0 && s.push(", "), i.length > 1 || u.length > 0 || n.specifiers.some((o) => T(o)) ? s.push(l(["{", f2([t2.bracketSpacing ? x : E, b([",", x], i)]), B(oe(t2) ? "," : ""), t2.bracketSpacing ? x : E, "}"])) : s.push(["{", t2.bracketSpacing ? " " : "", ...i, t2.bracketSpacing ? " " : "", "}"])); - } else s.push("{}"); - return s; + function he(t2 = null) { + return { trailingComment: t2 }; } - function Aa(e, t2) { - return e.type !== "ImportDeclaration" || O(e.specifiers) || e.importKind === "type" ? true : Is2(t2, q(e), q(e.source)).trimEnd().endsWith("from"); + function q() { + return { ...z(), ...he() }; } - function Nl(e, t2) { - var n, s; - if ((n = e.extra) != null && n.deprecatedAssertSyntax) return "assert"; - let r = Is2(t2, k(e.source), (s = e.attributes) != null && s[0] ? q(e.attributes[0]) : k(e)).trimStart(); - return r.startsWith("assert") ? "assert" : r.startsWith("with") || O(e.attributes) ? "with" : void 0; + function Fs(t2, e, n) { + return { ...b("alias", t2), ...q(), ...e, value: n }; } - function Ta(e, t2, r) { - let { node: n } = e; - if (!n.source) return ""; - let s = Nl(n, t2); - if (!s) return ""; - let u = [` ${s} {`]; - return O(n.attributes) && (t2.bracketSpacing && u.push(" "), u.push(b(", ", e.map(r, "attributes"))), t2.bracketSpacing && u.push(" ")), u.push("}"), u; + function qs(t2, e) { + let n = t2.cstNode; + return Fs(e.transformRange({ origStart: n.valueRange.origStart - 1, origEnd: n.valueRange.origEnd }), e.transformContent(t2), n.rawValue); } - function da(e, t2, r) { - let { node: n } = e, { type: s } = n, u = s.startsWith("Import"), i = u ? "imported" : "local", a2 = u ? "local" : "exported", o = n[i], p = n[a2], y = "", D = ""; - return s === "ExportNamespaceSpecifier" || s === "ImportNamespaceSpecifier" ? y = "*" : o && (y = r(i)), p && !Xl(n) && (D = r(a2)), [Ls(s === "ImportSpecifier" ? n.importKind : n.exportKind, false), y, y && D ? " as " : "", D]; + function Us(t2) { + return { ...t2, type: "blockFolded" }; } - function Xl(e) { - if (e.type !== "ImportSpecifier" && e.type !== "ExportSpecifier") return false; - let { local: t2, [e.type === "ImportSpecifier" ? "imported" : "exported"]: r } = e; - if (t2.type !== r.type || !nu(t2, r)) return false; - if (te(t2)) return t2.value === r.value && fe(t2) === fe(r); - switch (t2.type) { - case "Identifier": - return t2.name === r.name; - default: - return false; - } + function Vs(t2, e, n, r, s, i) { + return { ...b("blockValue", t2), ...z(), ...e, chomping: n, indent: r, value: s, indicatorComment: i }; } - function ht(e, t2, r) { - var j; - let n = t2.semi ? ";" : "", { node: s } = e, u = s.type === "ObjectTypeAnnotation", i = s.type === "TSEnumDeclaration" || s.type === "EnumBooleanBody" || s.type === "EnumNumberBody" || s.type === "EnumBigIntBody" || s.type === "EnumStringBody" || s.type === "EnumSymbolBody", a2 = [s.type === "TSTypeLiteral" || i ? "members" : s.type === "TSInterfaceBody" ? "body" : "properties"]; - u && a2.push("indexers", "callProperties", "internalSlots"); - let o = a2.flatMap((I) => e.map(({ node: U }) => ({ node: U, printed: r(), loc: q(U) }), I)); - a2.length > 1 && o.sort((I, U) => I.loc - U.loc); - let { parent: p, key: y } = e, D = u && y === "body" && (p.type === "InterfaceDeclaration" || p.type === "DeclareInterface" || p.type === "DeclareClass"), m = s.type === "TSInterfaceBody" || i || D || s.type === "ObjectPattern" && p.type !== "FunctionDeclaration" && p.type !== "FunctionExpression" && p.type !== "ArrowFunctionExpression" && p.type !== "ObjectMethod" && p.type !== "ClassMethod" && p.type !== "ClassPrivateMethod" && p.type !== "AssignmentPattern" && p.type !== "CatchClause" && s.properties.some((I) => I.value && (I.value.type === "ObjectPattern" || I.value.type === "ArrayPattern")) || s.type !== "ObjectPattern" && t2.objectWrap === "preserve" && o.length > 0 && de(t2.originalText, q(s), o[0].loc), C = D ? ";" : s.type === "TSInterfaceBody" || s.type === "TSTypeLiteral" ? B(n, ";") : ",", c = s.type === "RecordExpression" ? "#{" : s.exact ? "{|" : "{", A2 = s.exact ? "|}" : "}", d = [], S = o.map((I) => { - let U = [...d, l(I.printed)]; - return d = [C, x], (I.node.type === "TSPropertySignature" || I.node.type === "TSMethodSignature" || I.node.type === "TSConstructSignatureDeclaration" || I.node.type === "TSCallSignatureDeclaration") && T(I.node, h.PrettierIgnore) && d.shift(), ce(I.node, t2) && d.push(F), U; + var Gn; + (function(t2) { + t2.CLIP = "clip", t2.STRIP = "strip", t2.KEEP = "keep"; + })(Gn || (Gn = {})); + function Xt(t2, e) { + let n = t2.cstNode, r = 1, s = n.chomping === "CLIP" ? 0 : 1, o = n.header.origEnd - n.header.origStart - r - s !== 0, a2 = e.transformRange({ origStart: n.header.origStart, origEnd: n.valueRange.origEnd }), c = null, l = Jt(t2, e, (f2) => { + if (!(a2.start.offset < f2.position.start.offset && f2.position.end.offset < a2.end.offset)) return false; + if (c) throw new Error(`Unexpected multiple indicator comments at ${Oe(f2.position.start)}`); + return c = f2, true; }); - if (s.inexact || s.hasUnknownMembers) { - let I; - if (T(s, h.Dangling)) { - let U = T(s, h.Line); - I = [J(e, t2), U || Z(t2.originalText, k(M(false, ct(s), -1))) ? F : x, "..."]; - } else I = ["..."]; - S.push([...d, ...I]); - } - let g = (j = M(false, o, -1)) == null ? void 0 : j.node, _2 = !(s.inexact || s.hasUnknownMembers || g && (g.type === "RestElement" || (g.type === "TSPropertySignature" || g.type === "TSCallSignatureDeclaration" || g.type === "TSMethodSignature" || g.type === "TSConstructSignatureDeclaration") && T(g, h.PrettierIgnore))), v; - if (S.length === 0) { - if (!T(s, h.Dangling)) return [c, A2, H(e, r)]; - v = l([c, J(e, t2, { indent: true }), E, A2, $(e), H(e, r)]); - } else v = [D && O(s.properties) ? na(p) : "", c, f2([t2.bracketSpacing ? x : E, ...S]), B(_2 && (C !== "," || oe(t2)) ? C : ""), t2.bracketSpacing ? x : E, A2, $(e), H(e, r)]; - return e.match((I) => I.type === "ObjectPattern" && !O(I.decorators), Os) || Me(s) && (e.match(void 0, (I, U) => U === "typeAnnotation", (I, U) => U === "typeAnnotation", Os) || e.match(void 0, (I, U) => I.type === "FunctionTypeParam" && U === "typeAnnotation", Os)) || !m && e.match((I) => I.type === "ObjectPattern", (I) => I.type === "AssignmentExpression" || I.type === "VariableDeclarator") ? v : l(v, { shouldBreak: m }); - } - function Os(e, t2) { - return (t2 === "params" || t2 === "parameters" || t2 === "this" || t2 === "rest") && ds(e); - } - function Hl(e) { - let t2 = [e]; - for (let r = 0; r < t2.length; r++) { - let n = t2[r]; - for (let s of ["test", "consequent", "alternate"]) { - let u = n[s]; - if (X(u)) return true; - u.type === "ConditionalExpression" && t2.push(u); - } - } - return false; + return Vs(a2, l, Gn[n.chomping], o ? n.blockIndent : null, n.strValue, c); } - function Vl(e, t2, r) { - let { node: n } = e, s = n.type === "ConditionalExpression", u = s ? "alternate" : "falseType", { parent: i } = e, a2 = s ? r("test") : [r("checkType"), " ", "extends", " ", r("extendsType")]; - return i.type === n.type && i[u] === n ? Be(2, a2) : a2; + function Ws(t2, e) { + return Us(Xt(t2, e)); } - var $l = /* @__PURE__ */ new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"], ["AwaitExpression", "argument"]]); - function Kl(e) { - let { node: t2 } = e; - if (t2.type !== "ConditionalExpression") return false; - let r, n = t2; - for (let s = 0; !r; s++) { - let u = e.getParentNode(s); - if (u.type === "ChainExpression" && u.expression === n || L(u) && u.callee === n || W(u) && u.object === n || u.type === "TSNonNullExpression" && u.expression === n) { - n = u; - continue; - } - u.type === "NewExpression" && u.callee === n || Ae(u) && u.expression === n ? (r = e.getParentNode(s + 1), n = u) : r = u; - } - return n === t2 ? false : r[$l.get(r.type)] === n; + function Ks(t2) { + return { ...t2, type: "blockLiteral" }; } - function xa(e, t2, r) { - let { node: n } = e, s = n.type === "ConditionalExpression", u = s ? "consequent" : "trueType", i = s ? "alternate" : "falseType", a2 = s ? ["test"] : ["checkType", "extendsType"], o = n[u], p = n[i], y = [], D = false, { parent: m } = e, C = m.type === n.type && a2.some((G) => m[G] === n), c = m.type === n.type && !C, A2, d, S = 0; - do - d = A2 || n, A2 = e.getParentNode(S), S++; - while (A2 && A2.type === n.type && a2.every((G) => A2[G] !== d)); - let g = A2 || m, _2 = d; - if (s && (X(n[a2[0]]) || X(o) || X(p) || Hl(_2))) { - D = true, c = true; - let G = (Q) => [B("("), f2([E, Q]), E, B(")")], ue = (Q) => Q.type === "NullLiteral" || Q.type === "Literal" && Q.value === null || Q.type === "Identifier" && Q.name === "undefined"; - y.push(" ? ", ue(o) ? r(u) : G(r(u)), " : ", p.type === n.type || ue(p) ? r(i) : G(r(i))); - } else { - let G = (Q) => t2.useTabs ? f2(r(Q)) : Be(2, r(Q)), ue = [x, "? ", o.type === n.type ? B("", "(") : "", G(u), o.type === n.type ? B("", ")") : "", x, ": ", G(i)]; - y.push(m.type !== n.type || m[i] === n || C ? ue : t2.useTabs ? Rr(f2(ue)) : Be(Math.max(0, t2.tabWidth - 2), ue)); - } - let v = [u, i, ...a2].some((G) => T(n[G], (ue) => ee(ue) && de(t2.originalText, q(ue), k(ue)))), j = (G) => m === g ? l(G, { shouldBreak: v }) : v ? [G, Ee] : G, I = !D && (W(m) || m.type === "NGPipeExpression" && m.left === n) && !m.computed, U = Kl(e), P = j([Vl(e, t2, r), c ? y : f2(y), s && I && !U ? E : ""]); - return C || U ? l([f2([E, P]), E]) : P; + function js(t2, e) { + return Ks(Xt(t2, e)); } - function Ql(e, t2) { - return (W(t2) || t2.type === "NGPipeExpression" && t2.left === e) && !t2.computed; + function Qs(t2, e) { + return Ve(e.transformRange(t2.range), t2.comment); } - function zl(e, t2, r, n) { - return [...e.map((u) => ct(u)), ct(t2), ct(r)].flat().some((u) => ee(u) && de(n.originalText, q(u), k(u))); + function Gs(t2, e, n) { + return { ...b("directive", t2), ...q(), name: e, parameters: n }; } - var Zl = /* @__PURE__ */ new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"], ["AwaitExpression", "argument"]]); - function em(e) { - let { node: t2 } = e; - if (t2.type !== "ConditionalExpression") return false; - let r, n = t2; - for (let s = 0; !r; s++) { - let u = e.getParentNode(s); - if (u.type === "ChainExpression" && u.expression === n || L(u) && u.callee === n || W(u) && u.object === n || u.type === "TSNonNullExpression" && u.expression === n) { - n = u; - continue; + function We(t2, e) { + for (let n of t2.props) { + let r = e.text[n.origStart]; + switch (r) { + case me.Comment: + e.comments.push(Ve(e.transformRange(n), e.text.slice(n.origStart + 1, n.origEnd))); + break; + default: + throw new Error(`Unexpected leading character ${JSON.stringify(r)}`); } - u.type === "NewExpression" && u.callee === n || Ae(u) && u.expression === n ? (r = e.getParentNode(s + 1), n = u) : r = u; } - return n === t2 ? false : r[Zl.get(r.type)] === n; } - var _s = (e) => [B("("), f2([E, e]), E, B(")")]; - function Kt(e, t2, r, n) { - if (!t2.experimentalTernaries) return xa(e, t2, r); - let { node: s } = e, u = s.type === "ConditionalExpression", i = s.type === "TSConditionalType" || s.type === "ConditionalTypeAnnotation", a2 = u ? "consequent" : "trueType", o = u ? "alternate" : "falseType", p = u ? ["test"] : ["checkType", "extendsType"], y = s[a2], D = s[o], m = p.map((Ue) => s[Ue]), { parent: C } = e, c = C.type === s.type, A2 = c && p.some((Ue) => C[Ue] === s), d = c && C[o] === s, S = y.type === s.type, g = D.type === s.type, _2 = g || d, v = t2.tabWidth > 2 || t2.useTabs, j, I, U = 0; - do - I = j || s, j = e.getParentNode(U), U++; - while (j && j.type === s.type && p.every((Ue) => j[Ue] !== I)); - let P = j || C, G = n && n.assignmentLayout && n.assignmentLayout !== "break-after-operator" && (C.type === "AssignmentExpression" || C.type === "VariableDeclarator" || C.type === "ClassProperty" || C.type === "PropertyDefinition" || C.type === "ClassPrivateProperty" || C.type === "ObjectProperty" || C.type === "Property"), ue = (C.type === "ReturnStatement" || C.type === "ThrowStatement") && !(S || g), Q = u && P.type === "JSXExpressionContainer" && e.grandparent.type !== "JSXAttribute", St = em(e), Ft = Ql(s, C), w = i && ke(e, t2), ne = v ? t2.useTabs ? " " : " ".repeat(t2.tabWidth - 1) : "", xe = zl(m, y, D, t2) || S || g, ot = !_2 && !c && !i && (Q ? y.type === "NullLiteral" || y.type === "Literal" && y.value === null : sr(y, t2) && Jn(s.test, 3)), Bt = _2 || d || i && !c || c && u && Jn(s.test, 1) || ot, Ms = []; - !S && T(y, h.Dangling) && e.call((Ue) => { - Ms.push(J(Ue, t2), F); - }, "consequent"); - let zt = []; - T(s.test, h.Dangling) && e.call((Ue) => { - zt.push(J(Ue, t2)); - }, "test"), !g && T(D, h.Dangling) && e.call((Ue) => { - zt.push(J(Ue, t2)); - }, "alternate"), T(s, h.Dangling) && zt.push(J(e, t2)); - let Rs = /* @__PURE__ */ Symbol("test"), Ga = /* @__PURE__ */ Symbol("consequent"), Cr = /* @__PURE__ */ Symbol("test-and-consequent"), Ua = u ? [_s(r("test")), s.test.type === "ConditionalExpression" ? Ee : ""] : [r("checkType"), " ", "extends", " ", s.extendsType.type === "TSConditionalType" || s.extendsType.type === "ConditionalTypeAnnotation" || s.extendsType.type === "TSMappedType" ? r("extendsType") : l(_s(r("extendsType")))], Js = l([Ua, " ?"], { id: Rs }), Ya = r(a2), Ar = f2([S || Q && (X(y) || c || _2) ? F : x, Ms, Ya]), Na = Bt ? l([Js, _2 ? Ar : B(Ar, l(Ar, { id: Ga }), { groupId: Rs })], { id: Cr }) : [Js, Ar], In = r(o), qs = ot ? B(In, Rr(_s(In)), { groupId: Cr }) : In, Zt = [Na, zt.length > 0 ? [f2([F, zt]), F] : g ? F : ot ? B(x, " ", { groupId: Cr }) : x, ":", g ? " " : v ? Bt ? B(ne, B(_2 || ot ? " " : ne, " "), { groupId: Cr }) : B(ne, " ") : " ", g ? qs : l([f2(qs), Q && !ot ? E : ""]), Ft && !St ? E : "", xe ? Ee : ""]; - return G && !xe ? l(f2([E, l(Zt)])) : G || ue ? l(f2(Zt)) : St || i && A2 ? l([f2([E, Zt]), w ? E : ""]) : C === P ? l(Zt) : Zt; - } - function ha(e, t2, r, n) { - var _a2; - let { node: s } = e; - if (Ir(s)) return Da(e, t2); - let u = t2.semi ? ";" : "", i = []; - switch (s.type) { - case "JsExpressionRoot": - return r("node"); - case "JsonRoot": - return [r("node"), F]; - case "File": - return (_a2 = la(e, t2, r)) != null ? _a2 : r("program"); - case "EmptyStatement": - return ""; - case "ExpressionStatement": - return ca(e, t2, r); - case "ChainExpression": - return r("expression"); - case "ParenthesizedExpression": - return !T(s.expression) && (se(s.expression) || Y(s.expression)) ? ["(", r("expression"), ")"] : l(["(", f2([E, r("expression")]), E, ")"]); - case "AssignmentExpression": - return vi(e, t2, r); - case "VariableDeclarator": - return ji(e, t2, r); - case "BinaryExpression": - case "LogicalExpression": - return Vr(e, t2, r); - case "AssignmentPattern": - return [r("left"), " = ", r("right")]; - case "OptionalMemberExpression": - case "MemberExpression": - return Ii(e, t2, r); - case "MetaProperty": - return [r("meta"), ".", r("property")]; - case "BindExpression": - return s.object && i.push(r("object")), i.push(l(f2([E, $r(e, t2, r)]))), i; - case "Identifier": - return [s.name, $(e), ln(e), H(e, r)]; - case "V8IntrinsicIdentifier": - return ["%", s.name]; - case "SpreadElement": - case "SpreadElementPattern": - case "SpreadPropertyPattern": - case "RestElement": - return mn(e, r); - case "FunctionDeclaration": - case "FunctionExpression": - return fn(e, r, t2, n); - case "ArrowFunctionExpression": - return Qi(e, t2, r, n); - case "YieldExpression": - return i.push("yield"), s.delegate && i.push("*"), s.argument && i.push(" ", r("argument")), i; - case "AwaitExpression": - if (i.push("await"), s.argument) { - i.push(" ", r("argument")); - let { parent: a2 } = e; - if (L(a2) && a2.callee === s || W(a2) && a2.object === s) { - i = [f2([E, ...i]), E]; - let o = e.findAncestor((p) => p.type === "AwaitExpression" || p.type === "BlockStatement"); - if ((o == null ? void 0 : o.type) !== "AwaitExpression" || !ae(o.argument, (p) => p === s)) return l(i); - } - } - return i; - case "ExportDefaultDeclaration": - case "ExportNamedDeclaration": - case "ExportAllDeclaration": - return Sn(e, t2, r); - case "ImportDeclaration": - return fa(e, t2, r); - case "ImportSpecifier": - case "ExportSpecifier": - case "ImportNamespaceSpecifier": - case "ExportNamespaceSpecifier": - case "ImportDefaultSpecifier": - case "ExportDefaultSpecifier": - return da(e, t2, r); - case "ImportAttribute": - return Dn(e, t2, r); - case "Program": - case "BlockStatement": - case "StaticBlock": - return Cn(e, t2, r); - case "ClassBody": - return ua(e, t2, r); - case "ThrowStatement": - return Vi(e, t2, r); - case "ReturnStatement": - return Hi(e, t2, r); - case "NewExpression": - case "ImportExpression": - case "OptionalCallExpression": - case "CallExpression": - return Kr(e, t2, r); - case "ObjectExpression": - case "ObjectPattern": - case "RecordExpression": - return ht(e, t2, r); - case "Property": - return Pt(s) ? fr(e, t2, r) : Dn(e, t2, r); - case "ObjectProperty": - return Dn(e, t2, r); - case "ObjectMethod": - return fr(e, t2, r); - case "Decorator": - return ["@", r("expression")]; - case "ArrayExpression": - case "ArrayPattern": - case "TupleExpression": - return Vt(e, t2, r); - case "SequenceExpression": { - let { parent: a2 } = e; - if (a2.type === "ExpressionStatement" || a2.type === "ForStatement") { - let o = []; - return e.each(({ isFirst: p }) => { - p ? o.push(r()) : o.push(",", f2([x, r()])); - }, "expressions"), l(o); - } - return l(b([",", x], e.map(r, "expressions"))); - } - case "ThisExpression": - return "this"; - case "Super": - return "super"; - case "Directive": - return [r("value"), u]; - case "UnaryExpression": - return i.push(s.operator), /[a-z]$/u.test(s.operator) && i.push(" "), T(s.argument) ? i.push(l(["(", f2([E, r("argument")]), E, ")"])) : i.push(r("argument")), i; - case "UpdateExpression": - return [s.prefix ? s.operator : "", r("argument"), s.prefix ? "" : s.operator]; - case "ConditionalExpression": - return Kt(e, t2, r, n); - case "VariableDeclaration": { - let a2 = e.map(r, "declarations"), o = e.parent, p = o.type === "ForStatement" || o.type === "ForInStatement" || o.type === "ForOfStatement", y = s.declarations.some((m) => m.init), D; - return a2.length === 1 && !T(s.declarations[0]) ? D = a2[0] : a2.length > 0 && (D = f2(a2[0])), i = [K(e), s.kind, D ? [" ", D] : "", f2(a2.slice(1).map((m) => [",", y && !p ? F : x, m]))], p && o.body !== s || i.push(u), l(i); - } - case "WithStatement": - return l(["with (", r("object"), ")", Dt(s.body, r("body"))]); - case "IfStatement": { - let a2 = Dt(s.consequent, r("consequent")), o = l(["if (", l([f2([E, r("test")]), E]), ")", a2]); - if (i.push(o), s.alternate) { - let p = T(s.consequent, h.Trailing | h.Line) || Or(s), y = s.consequent.type === "BlockStatement" && !p; - i.push(y ? " " : F), T(s, h.Dangling) && i.push(J(e, t2), p ? F : " "), i.push("else", l(Dt(s.alternate, r("alternate"), s.alternate.type === "IfStatement"))); - } - return i; - } - case "ForStatement": { - let a2 = Dt(s.body, r("body")), o = J(e, t2), p = o ? [o, E] : ""; - return !s.init && !s.test && !s.update ? [p, l(["for (;;)", a2])] : [p, l(["for (", l([f2([E, r("init"), ";", x, r("test"), ";", x, r("update")]), E]), ")", a2])]; - } - case "WhileStatement": - return l(["while (", l([f2([E, r("test")]), E]), ")", Dt(s.body, r("body"))]); - case "ForInStatement": - return l(["for (", r("left"), " in ", r("right"), ")", Dt(s.body, r("body"))]); - case "ForOfStatement": - return l(["for", s.await ? " await" : "", " (", r("left"), " of ", r("right"), ")", Dt(s.body, r("body"))]); - case "DoWhileStatement": { - let a2 = Dt(s.body, r("body")); - return i = [l(["do", a2])], s.body.type === "BlockStatement" ? i.push(" ") : i.push(F), i.push("while (", l([f2([E, r("test")]), E]), ")", u), i; - } - case "DoExpression": - return [s.async ? "async " : "", "do ", r("body")]; - case "BreakStatement": - case "ContinueStatement": - return i.push(s.type === "BreakStatement" ? "break" : "continue"), s.label && i.push(" ", r("label")), i.push(u), i; - case "LabeledStatement": - return s.body.type === "EmptyStatement" ? [r("label"), ":;"] : [r("label"), ": ", r("body")]; - case "TryStatement": - return ["try ", r("block"), s.handler ? [" ", r("handler")] : "", s.finalizer ? [" finally ", r("finalizer")] : ""]; - case "CatchClause": - if (s.param) { - let a2 = T(s.param, (p) => !ee(p) || p.leading && Z(t2.originalText, k(p)) || p.trailing && Z(t2.originalText, q(p), { backwards: true })), o = r("param"); - return ["catch ", a2 ? ["(", f2([E, o]), E, ") "] : ["(", o, ") "], r("body")]; - } - return ["catch ", r("body")]; - case "SwitchStatement": - return [l(["switch (", f2([E, r("discriminant")]), E, ")"]), " {", s.cases.length > 0 ? f2([F, b(F, e.map(({ node: a2, isLast: o }) => [r(), !o && ce(a2, t2) ? F : ""], "cases"))]) : "", F, "}"]; - case "SwitchCase": { - s.test ? i.push("case ", r("test"), ":") : i.push("default:"), T(s, h.Dangling) && i.push(" ", J(e, t2)); - let a2 = s.consequent.filter((o) => o.type !== "EmptyStatement"); - if (a2.length > 0) { - let o = Er(e, t2, r, "consequent"); - i.push(a2.length === 1 && a2[0].type === "BlockStatement" ? [" ", o] : f2([F, o])); - } - return i; - } - case "DebuggerStatement": - return ["debugger", u]; - case "ClassDeclaration": - case "ClassExpression": - return dn(e, t2, r); - case "ClassMethod": - case "ClassPrivateMethod": - case "MethodDefinition": - return xn(e, t2, r); - case "ClassProperty": - case "PropertyDefinition": - case "ClassPrivateProperty": - case "ClassAccessorProperty": - case "AccessorProperty": - return hn(e, t2, r); - case "TemplateElement": - return _e(s.value.raw); - case "TemplateLiteral": - return Gr(e, r, t2); - case "TaggedTemplateExpression": - return Xu(e, r); - case "PrivateIdentifier": - return ["#", s.name]; - case "PrivateName": - return ["#", r("id")]; - case "TopicReference": - return "%"; - case "ArgumentPlaceholder": - return "?"; - case "ModuleExpression": - return ["module ", r("body")]; - case "InterpreterDirective": - default: - throw new qe(s, "ESTree"); + function Hs(t2, e) { + return We(t2, e), Gs(e.transformRange(t2.range), t2.name, t2.parameters); + } + function Js(t2, e, n, r, s, i) { + return { ...b("document", t2), ...he(i), directivesEndMarker: e, documentEndMarker: n, children: [r, s] }; + } + function U(t2 = []) { + return { endComments: t2 }; + } + function Xs(t2, e, n) { + return { ...b("documentBody", t2), ...U(n), children: e ? [e] : [] }; + } + function V(t2) { + return t2[t2.length - 1]; + } + function zt(t2, e) { + let n = t2.match(e); + return n ? n.index : -1; + } + function zs(t2, e, n) { + let r = t2.cstNode, { comments: s, endComments: i, documentTrailingComment: o, documentHeadTrailingComment: a2 } = Ra(r, e, n), c = e.transformNode(t2.contents), { position: l, documentEndPoint: f2 } = Da(r, c, e); + return e.comments.push(...s, ...i), { documentBody: Xs(l, c, i), documentEndPoint: f2, documentTrailingComment: o, documentHeadTrailingComment: a2 }; + } + function Ra(t2, e, n) { + let r = [], s = [], i = [], o = [], a2 = false; + for (let c = t2.contents.length - 1; c >= 0; c--) { + let l = t2.contents[c]; + if (l.type === "COMMENT") { + let f2 = e.transformNode(l); + n && n.line === f2.position.start.line ? o.unshift(f2) : a2 ? r.unshift(f2) : f2.position.start.offset >= t2.valueRange.origEnd ? i.unshift(f2) : r.unshift(f2); + } else a2 = true; } + if (i.length > 1) throw new Error(`Unexpected multiple document trailing comments at ${Oe(i[1].position.start)}`); + if (o.length > 1) throw new Error(`Unexpected multiple documentHead trailing comments at ${Oe(o[1].position.start)}`); + return { comments: r, endComments: s, documentTrailingComment: V(i) || null, documentHeadTrailingComment: V(o) || null }; } - function Bn(e, t2, r) { - let { parent: n, node: s, key: u } = e, i = [r("expression")]; - switch (s.type) { - case "AsConstExpression": - i.push(" as const"); - break; - case "AsExpression": - case "TSAsExpression": - i.push(" as ", r("typeAnnotation")); - break; - case "SatisfiesExpression": - case "TSSatisfiesExpression": - i.push(" satisfies ", r("typeAnnotation")); - break; + function Da(t2, e, n) { + let r = zt(n.text.slice(t2.valueRange.origEnd), /^\.\.\./), s = r === -1 ? t2.valueRange.origEnd : Math.max(0, t2.valueRange.origEnd - 1); + n.text[s - 1] === "\r" && s--; + let i = n.transformRange({ origStart: e !== null ? e.position.start.offset : s, origEnd: s }), o = r === -1 ? i.end : n.transformOffset(t2.valueRange.origEnd + 3); + return { position: i, documentEndPoint: o }; + } + function Zs(t2, e, n, r) { + return { ...b("documentHead", t2), ...U(n), ...he(r), children: e }; + } + function ei(t2, e) { + let n = t2.cstNode, { directives: r, comments: s, endComments: i } = $a(n, e), { position: o, documentEndMarkererPoint: a2 } = Ya(n, r, e); + return e.comments.push(...s, ...i), { createDocumentHeadWithTrailingComment: (l) => (l && e.comments.push(l), Zs(o, r, i, l)), documentHeadEndMarkerPoint: a2 }; + } + function $a(t2, e) { + let n = [], r = [], s = [], i = false; + for (let o = t2.directives.length - 1; o >= 0; o--) { + let a2 = e.transformNode(t2.directives[o]); + a2.type === "comment" ? i ? r.unshift(a2) : s.unshift(a2) : (i = true, n.unshift(a2)); } - return u === "callee" && L(n) || u === "object" && W(n) ? l([f2([E, ...i]), E]) : i; + return { directives: n, comments: r, endComments: s }; } - function ga(e, t2, r) { - let { node: n } = e, s = [K(e), "component"]; - n.id && s.push(" ", r("id")), s.push(r("typeParameters")); - let u = tm(e, r, t2); - return n.rendersType ? s.push(l([u, " ", r("rendersType")])) : s.push(l([u])), n.body && s.push(" ", r("body")), t2.semi && n.type === "DeclareComponent" && s.push(";"), s; + function Ya(t2, e, n) { + let r = zt(n.text.slice(0, t2.valueRange.origStart), /---\s*$/); + r > 0 && !/[\r\n]/.test(n.text[r - 1]) && (r = -1); + let s = r === -1 ? { origStart: t2.valueRange.origStart, origEnd: t2.valueRange.origStart } : { origStart: r, origEnd: r + 3 }; + return e.length !== 0 && (s.origStart = e[0].position.start.offset), { position: n.transformRange(s), documentEndMarkererPoint: r === -1 ? null : n.transformOffset(r) }; } - function tm(e, t2, r) { - let { node: n } = e, s = n.params; - if (n.rest && (s = [...s, n.rest]), s.length === 0) return ["(", J(e, r, { filter: (i) => be(r.originalText, k(i)) === ")" }), ")"]; - let u = []; - return nm(e, (i, a2) => { - let o = a2 === s.length - 1; - o && n.rest && u.push("..."), u.push(t2()), !o && (u.push(","), ce(s[a2], r) ? u.push(F, F) : u.push(x)); - }), ["(", f2([E, ...u]), B(oe(r, "all") && !rm(n, s) ? "," : ""), E, ")"]; + function ti(t2, e) { + let { createDocumentHeadWithTrailingComment: n, documentHeadEndMarkerPoint: r } = ei(t2, e), { documentBody: s, documentEndPoint: i, documentTrailingComment: o, documentHeadTrailingComment: a2 } = zs(t2, e, r), c = n(a2); + o && e.comments.push(o); + let l = t2.cstNode; + return Js(X(c.position.start, i), !!l.directivesEndMarker, !!l.documentEndMarker, c, s, o); } - function rm(e, t2) { - var r; - return e.rest || ((r = M(false, t2, -1)) == null ? void 0 : r.type) === "RestElement"; + function Zt(t2, e, n) { + return { ...b("flowCollection", t2), ...q(), ...U(), ...e, children: n }; } - function nm(e, t2) { - let { node: r } = e, n = 0, s = (u) => t2(u, n++); - e.each(s, "params"), r.rest && e.call(s, "rest"); + function ni(t2, e, n) { + return { ...Zt(t2, e, n), type: "flowMapping" }; } - function Sa(e, t2, r) { - let { node: n } = e; - return n.shorthand ? r("local") : [r("name"), " as ", r("local")]; + function en(t2, e, n) { + return { ...b("flowMappingItem", t2), ...z(), children: [e, n] }; } - function Ba(e, t2, r) { - let { node: n } = e, s = []; - return n.name && s.push(r("name"), n.optional ? "?: " : ": "), s.push(r("typeAnnotation")), s; + function de(t2, e) { + let n = []; + for (let r of t2) r && "type" in r && r.type === "COMMENT" ? e.comments.push(e.transformNode(r)) : n.push(r); + return n; } - function ba(e, t2, r) { - return ht(e, r, t2); + function tn(t2) { + let [e, n] = ["?", ":"].map((r) => { + let s = t2.find((i) => "char" in i && i.char === r); + return s ? { origStart: s.origOffset, origEnd: s.origOffset + 1 } : null; + }); + return { additionalKeyRange: e, additionalValueRange: n }; } - function bn(e, t2) { - let { node: r } = e, n = t2("id"); - r.computed && (n = ["[", n, "]"]); - let s = ""; - return r.initializer && (s = t2("initializer")), r.init && (s = t2("init")), s ? [n, " = ", s] : n; + function nn(t2, e) { + let n = e; + return (r) => t2.slice(n, n = r); } - function Pa(e, t2, r) { - let { node: n } = e, s; - if (n.type === "EnumSymbolBody" || n.explicitType) switch (n.type) { - case "EnumBooleanBody": - s = "boolean"; - break; - case "EnumNumberBody": - s = "number"; - break; - case "EnumBigIntBody": - s = "bigint"; - break; - case "EnumStringBody": - s = "string"; - break; - case "EnumSymbolBody": - s = "symbol"; - break; + function rn(t2) { + let e = [], n = nn(t2, 1), r = false; + for (let s = 1; s < t2.length - 1; s++) { + let i = t2[s]; + if ("char" in i && i.char === ",") { + e.push(n(s)), n(s + 1), r = false; + continue; + } + r = true; } - return [s ? `of ${s} ` : "", ba(e, t2, r)]; + return r && e.push(n(t2.length - 1)), e; } - function Pn(e, t2, r) { - let { node: n } = e; - return [K(e), n.const ? "const " : "", "enum ", t2("id"), " ", n.type === "TSEnumDeclaration" ? ba(e, t2, r) : t2("body")]; + function Hn(t2, e) { + return { ...b("mappingKey", t2), ...he(), ...U(), children: e ? [e] : [] }; } - function Ia(e, t2, r) { - let { node: n } = e, s = ["hook"]; - n.id && s.push(" ", r("id")); - let u = Ge(e, r, t2, false, true), i = $t(e, r), a2 = at(n, i); - return s.push(l([a2 ? l(u) : u, i]), n.body ? " " : "", r("body")), s; + function Jn(t2, e) { + return { ...b("mappingValue", t2), ...q(), ...U(), children: e ? [e] : [] }; } - function La(e, t2, r) { - let { node: n } = e, s = [K(e), "hook"]; - return n.id && s.push(" ", r("id")), t2.semi && s.push(";"), s; + function Ke(t2, e, n, r, s) { + let i = e.transformNode(t2.key), o = e.transformNode(t2.value), a2 = i || r ? Hn(e.transformRange({ origStart: r ? r.origStart : i.position.start.offset, origEnd: i ? i.position.end.offset : r.origStart + 1 }), i) : null, c = o || s ? Jn(e.transformRange({ origStart: s ? s.origStart : o.position.start.offset, origEnd: o ? o.position.end.offset : s.origStart + 1 }), o) : null; + return n(X(a2 ? a2.position.start : c.position.start, c ? c.position.end : a2.position.end), a2 || Hn(Qn(c.position.start), null), c || Jn(Qn(a2.position.end), null)); } - function ka(e) { - var r; - let { node: t2 } = e; - return t2.type === "HookTypeAnnotation" && ((r = e.getParentNode(2)) == null ? void 0 : r.type) === "DeclareHook"; + function ri(t2, e) { + let n = de(t2.cstNode.items, e), r = rn(n), s = t2.items.map((a2, c) => { + let l = r[c], { additionalKeyRange: f2, additionalValueRange: m } = tn(l); + return Ke(a2, e, en, f2, m); + }), i = n[0], o = V(n); + return ni(e.transformRange({ origStart: i.origOffset, origEnd: o.origOffset + 1 }), e.transformContent(t2), s); } - function wa(e, t2, r) { - let { node: n } = e, s = []; - s.push(ka(e) ? "" : "hook "); - let u = Ge(e, r, t2, false, true), i = []; - return i.push(ka(e) ? ": " : " => ", r("returnType")), at(n, i) && (u = l(u)), s.push(u, i), l(s); + function si(t2, e, n) { + return { ...Zt(t2, e, n), type: "flowSequence" }; } - function kn(e, t2, r) { - let { node: n } = e, s = [K(e), "interface"], u = [], i = []; - n.type !== "InterfaceTypeAnnotation" && u.push(" ", r("id"), r("typeParameters")); - let a2 = n.typeParameters && !T(n.typeParameters, h.Trailing | h.Line); - return O(n.extends) && i.push(a2 ? B(" ", x, { groupId: Fr(n.typeParameters) }) : x, "extends ", (n.extends.length === 1 ? fu : f2)(b([",", x], e.map(r, "extends")))), T(n.id, h.Trailing) || O(n.extends) ? a2 ? s.push(l([...u, f2(i)])) : s.push(l(f2([...u, ...i]))) : s.push(...u, ...i), s.push(" ", r("body")), l(s); + function ii(t2, e) { + return { ...b("flowSequenceItem", t2), children: [e] }; } - function Oa(e, t2, r) { - var _a2, _b, _c2; - let { node: n } = e; - if (Br(n)) return n.type.slice(0, -14).toLowerCase(); - let s = t2.semi ? ";" : ""; - switch (n.type) { - case "ComponentDeclaration": - case "DeclareComponent": - case "ComponentTypeAnnotation": - return ga(e, t2, r); - case "ComponentParameter": - return Sa(e, t2, r); - case "ComponentTypeParameter": - return Ba(e, t2, r); - case "HookDeclaration": - return Ia(e, t2, r); - case "DeclareHook": - return La(e, t2, r); - case "HookTypeAnnotation": - return wa(e, t2, r); - case "DeclareClass": - return dn(e, t2, r); - case "DeclareFunction": - return [K(e), "function ", r("id"), r("predicate"), s]; - case "DeclareModule": - return ["declare module ", r("id"), " ", r("body")]; - case "DeclareModuleExports": - return ["declare module.exports", H(e, r), s]; - case "DeclareNamespace": - return ["declare namespace ", r("id"), " ", r("body")]; - case "DeclareVariable": - return [K(e), (_a2 = n.kind) != null ? _a2 : "var", " ", r("id"), s]; - case "DeclareExportDeclaration": - case "DeclareExportAllDeclaration": - return Sn(e, t2, r); - case "DeclareOpaqueType": - case "OpaqueType": - return qi(e, t2, r); - case "DeclareTypeAlias": - case "TypeAlias": - return zr(e, t2, r); - case "IntersectionTypeAnnotation": - return Zr(e, t2, r); - case "UnionTypeAnnotation": - return en(e, t2, r); - case "ConditionalTypeAnnotation": - return Kt(e, t2, r); - case "InferTypeAnnotation": - return nn(e, t2, r); - case "FunctionTypeAnnotation": - return tn(e, t2, r); - case "TupleTypeAnnotation": - return Vt(e, t2, r); - case "TupleTypeLabeledElement": - return un(e, t2, r); - case "TupleTypeSpreadElement": - return sn(e, t2, r); - case "GenericTypeAnnotation": - return [r("id"), wt(e, t2, r, "typeParameters")]; - case "IndexedAccessType": - case "OptionalIndexedAccessType": - return rn(e, t2, r); - case "TypeAnnotation": - return an(e, t2, r); - case "TypeParameter": - return Tn(e, t2, r); - case "TypeofTypeAnnotation": - return pn(e, r); - case "ExistsTypeAnnotation": - return "*"; - case "ArrayTypeAnnotation": - return on(r); - case "DeclareEnum": - case "EnumDeclaration": - return Pn(e, r, t2); - case "EnumBooleanBody": - case "EnumNumberBody": - case "EnumBigIntBody": - case "EnumStringBody": - case "EnumSymbolBody": - return Pa(e, r, t2); - case "EnumBooleanMember": - case "EnumNumberMember": - case "EnumBigIntMember": - case "EnumStringMember": - case "EnumDefaultedMember": - return bn(e, r); - case "FunctionTypeParam": { - let u = n.name ? r("name") : e.parent.this === n ? "this" : ""; - return [u, $(e), u ? ": " : "", r("typeAnnotation")]; - } - case "DeclareInterface": - case "InterfaceDeclaration": - case "InterfaceTypeAnnotation": - return kn(e, t2, r); - case "ClassImplements": - case "InterfaceExtends": - return [r("id"), r("typeParameters")]; - case "NullableTypeAnnotation": - return ["?", r("typeAnnotation")]; - case "Variance": { - let { kind: u } = n; - return jt.ok(u === "plus" || u === "minus"), u === "plus" ? "+" : "-"; + function oi(t2, e) { + let n = de(t2.cstNode.items, e), r = rn(n), s = t2.items.map((a2, c) => { + if (a2.type !== "PAIR") { + let l = e.transformNode(a2); + return ii(X(l.position.start, l.position.end), l); + } else { + let l = r[c], { additionalKeyRange: f2, additionalValueRange: m } = tn(l); + return Ke(a2, e, en, f2, m); } - case "KeyofTypeAnnotation": - return ["keyof ", r("argument")]; - case "ObjectTypeCallProperty": - return [n.static ? "static " : "", r("value")]; - case "ObjectTypeMappedTypeProperty": - return Zi(e, t2, r); - case "ObjectTypeIndexer": - return [n.static ? "static " : "", n.variance ? r("variance") : "", "[", r("id"), n.id ? ": " : "", r("key"), "]: ", r("value")]; - case "ObjectTypeProperty": { - let u = ""; - return n.proto ? u = "proto " : n.static && (u = "static "), [u, n.kind !== "init" ? n.kind + " " : "", n.variance ? r("variance") : "", Et(e, t2, r), $(e), Pt(n) ? "" : ": ", r("value")]; + }), i = n[0], o = V(n); + return si(e.transformRange({ origStart: i.origOffset, origEnd: o.origOffset + 1 }), e.transformContent(t2), s); + } + function ai(t2, e, n) { + return { ...b("mapping", t2), ...z(), ...e, children: n }; + } + function ci(t2, e, n) { + return { ...b("mappingItem", t2), ...z(), children: [e, n] }; + } + function li(t2, e) { + let n = t2.cstNode; + n.items.filter((o) => o.type === "MAP_KEY" || o.type === "MAP_VALUE").forEach((o) => We(o, e)); + let r = de(n.items, e), s = Ba(r), i = t2.items.map((o, a2) => { + let c = s[a2], [l, f2] = c[0].type === "MAP_VALUE" ? [null, c[0].range] : [c[0].range, c.length === 1 ? null : c[1].range]; + return Ke(o, e, ci, l, f2); + }); + return ai(X(i[0].position.start, V(i).position.end), e.transformContent(t2), i); + } + function Ba(t2) { + let e = [], n = nn(t2, 0), r = false; + for (let s = 0; s < t2.length; s++) { + if (t2[s].type === "MAP_VALUE") { + e.push(n(s + 1)), r = false; + continue; } - case "ObjectTypeAnnotation": - return ht(e, t2, r); - case "ObjectTypeInternalSlot": - return [n.static ? "static " : "", "[[", r("id"), "]]", $(e), n.method ? "" : ": ", r("value")]; - case "ObjectTypeSpreadProperty": - return mn(e, r); - case "QualifiedTypeofIdentifier": - case "QualifiedTypeIdentifier": - return [r("qualification"), ".", r("id")]; - case "NullLiteralTypeAnnotation": - return "null"; - case "BooleanLiteralTypeAnnotation": - return String(n.value); - case "StringLiteralTypeAnnotation": - return _e(rt(fe(n), t2)); - case "NumberLiteralTypeAnnotation": - return ft((_b = n.raw) != null ? _b : n.extra.raw); - case "BigIntLiteralTypeAnnotation": - return gn((_c2 = n.raw) != null ? _c2 : n.extra.raw); - case "TypeCastExpression": - return ["(", r("expression"), H(e, r), ")"]; - case "TypePredicate": - return cn(e, r); - case "TypeOperator": - return [n.operator, " ", r("typeAnnotation")]; - case "TypeParameterDeclaration": - case "TypeParameterInstantiation": - return wt(e, t2, r, "params"); - case "InferredPredicate": - case "DeclaredPredicate": - return [e.key === "predicate" && e.parent.type !== "DeclareFunction" && !e.parent.returnType ? ": " : " ", "%checks", ...n.type === "DeclaredPredicate" ? ["(", r("value"), ")"] : []]; - case "AsExpression": - case "AsConstExpression": - case "SatisfiesExpression": - return Bn(e, t2, r); + r && e.push(n(s)), r = true; } + return r && e.push(n(1 / 0)), e; } - function _a(e, t2, r) { - var i; - let { node: n } = e; - if (!n.type.startsWith("TS")) return; - if (br(n)) return n.type.slice(2, -7).toLowerCase(); - let s = t2.semi ? ";" : "", u = []; - switch (n.type) { - case "TSThisType": - return "this"; - case "TSTypeAssertion": { - let a2 = !(Y(n.expression) || se(n.expression)), o = l(["<", f2([E, r("typeAnnotation")]), E, ">"]), p = [B("("), f2([E, r("expression")]), E, B(")")]; - return a2 ? Ze([[o, r("expression")], [o, l(p, { shouldBreak: true })], [o, r("expression")]]) : l([o, r("expression")]); - } - case "TSDeclareFunction": - return fn(e, r, t2); - case "TSExportAssignment": - return ["export = ", r("expression"), s]; - case "TSModuleBlock": - return Cn(e, t2, r); - case "TSInterfaceBody": - case "TSTypeLiteral": - return ht(e, t2, r); - case "TSTypeAliasDeclaration": - return zr(e, t2, r); - case "TSQualifiedName": - return [r("left"), ".", r("right")]; - case "TSAbstractMethodDefinition": - case "TSDeclareMethod": - return xn(e, t2, r); - case "TSAbstractAccessorProperty": - case "TSAbstractPropertyDefinition": - return hn(e, t2, r); - case "TSInterfaceHeritage": - case "TSClassImplements": - case "TSExpressionWithTypeArguments": - case "TSInstantiationExpression": - return [r("expression"), r(n.typeArguments ? "typeArguments" : "typeParameters")]; - case "TSTemplateLiteralType": - return Gr(e, r, t2); - case "TSNamedTupleMember": - return un(e, t2, r); - case "TSRestType": - return sn(e, t2, r); - case "TSOptionalType": - return [r("typeAnnotation"), "?"]; - case "TSInterfaceDeclaration": - return kn(e, t2, r); - case "TSTypeParameterDeclaration": - case "TSTypeParameterInstantiation": - return wt(e, t2, r, "params"); - case "TSTypeParameter": - return Tn(e, t2, r); - case "TSAsExpression": - case "TSSatisfiesExpression": - return Bn(e, t2, r); - case "TSArrayType": - return on(r); - case "TSPropertySignature": - return [n.readonly ? "readonly " : "", Et(e, t2, r), $(e), H(e, r)]; - case "TSParameterProperty": - return [Ht(n), n.static ? "static " : "", n.override ? "override " : "", n.readonly ? "readonly " : "", r("parameter")]; - case "TSTypeQuery": - return pn(e, r); - case "TSIndexSignature": { - let a2 = n.parameters.length > 1 ? B(oe(t2) ? "," : "") : "", o = l([f2([E, b([", ", E], e.map(r, "parameters"))]), a2, E]), p = e.parent.type === "ClassBody" && e.key === "body"; - return [p && n.static ? "static " : "", n.readonly ? "readonly " : "", "[", n.parameters ? o : "", "]", H(e, r), p ? s : ""]; - } - case "TSTypePredicate": - return cn(e, r); - case "TSNonNullExpression": - return [r("expression"), "!"]; - case "TSImportType": - return ["import(", r("argument"), ")", n.qualifier ? [".", r("qualifier")] : "", wt(e, t2, r, n.typeArguments ? "typeArguments" : "typeParameters")]; - case "TSLiteralType": - return r("literal"); - case "TSIndexedAccessType": - return rn(e, t2, r); - case "TSTypeOperator": - return [n.operator, " ", r("typeAnnotation")]; - case "TSMappedType": - return ea(e, t2, r); - case "TSMethodSignature": { - let a2 = n.kind && n.kind !== "method" ? `${n.kind} ` : ""; - u.push(Ht(n), a2, n.computed ? "[" : "", r("key"), n.computed ? "]" : "", $(e)); - let o = Ge(e, r, t2, false, true), p = n.returnType ? "returnType" : "typeAnnotation", y = n[p], D = y ? H(e, r, p) : "", m = at(n, D); - return u.push(m ? l(o) : o), y && u.push(l(D)), l(u); - } - case "TSNamespaceExportDeclaration": - return ["export as namespace ", r("id"), t2.semi ? ";" : ""]; - case "TSEnumDeclaration": - return Pn(e, r, t2); - case "TSEnumMember": - return bn(e, r); - case "TSImportEqualsDeclaration": - return [n.isExport ? "export " : "", "import ", ws(n, false), r("id"), " = ", r("moduleReference"), t2.semi ? ";" : ""]; - case "TSExternalModuleReference": - return ["require(", r("expression"), ")"]; - case "TSModuleDeclaration": { - let { parent: a2 } = e, o = a2.type === "TSModuleDeclaration", p = ((i = n.body) == null ? void 0 : i.type) === "TSModuleDeclaration"; - return o ? u.push(".") : (u.push(K(e)), n.kind !== "global" && u.push(n.kind, " ")), u.push(r("id")), p ? u.push(r("body")) : n.body ? u.push(" ", l(r("body"))) : u.push(s), u; - } - case "TSConditionalType": - return Kt(e, t2, r); - case "TSInferType": - return nn(e, t2, r); - case "TSIntersectionType": - return Zr(e, t2, r); - case "TSUnionType": - return en(e, t2, r); - case "TSFunctionType": - case "TSCallSignatureDeclaration": - case "TSConstructorType": - case "TSConstructSignatureDeclaration": - return tn(e, t2, r); - case "TSTupleType": - return Vt(e, t2, r); - case "TSTypeReference": - return [r("typeName"), wt(e, t2, r, n.typeArguments ? "typeArguments" : "typeParameters")]; - case "TSTypeAnnotation": - return an(e, t2, r); - case "TSEmptyBodyFunctionExpression": - return En(e, t2, r); - case "TSJSDocAllType": - return "*"; - case "TSJSDocUnknownType": - return "?"; - case "TSJSDocNullableType": - return hs(e, r, "?"); - case "TSJSDocNonNullableType": - return hs(e, r, "!"); - case "TSParenthesizedType": + function fi(t2, e, n) { + return { ...b("plain", t2), ...q(), ...e, value: n }; + } + function ui(t2, e, n) { + for (let r = e; r >= 0; r--) if (n.test(t2[r])) return r; + return -1; + } + function pi(t2, e) { + let n = t2.cstNode; + return fi(e.transformRange({ origStart: n.valueRange.origStart, origEnd: ui(e.text, n.valueRange.origEnd - 1, /\S/) + 1 }), e.transformContent(t2), n.strValue); + } + function mi(t2) { + return { ...t2, type: "quoteDouble" }; + } + function hi(t2, e, n) { + return { ...b("quoteValue", t2), ...e, ...q(), value: n }; + } + function sn(t2, e) { + let n = t2.cstNode; + return hi(e.transformRange(n.valueRange), e.transformContent(t2), n.strValue); + } + function di(t2, e) { + return mi(sn(t2, e)); + } + function gi(t2) { + return { ...t2, type: "quoteSingle" }; + } + function yi(t2, e) { + return gi(sn(t2, e)); + } + function Ei(t2, e, n) { + return { ...b("sequence", t2), ...z(), ...U(), ...e, children: n }; + } + function Si(t2, e) { + return { ...b("sequenceItem", t2), ...q(), ...U(), children: e ? [e] : [] }; + } + function wi(t2, e) { + let r = de(t2.cstNode.items, e).map((s, i) => { + We(s, e); + let o = e.transformNode(t2.items[i]); + return Si(X(e.transformOffset(s.valueRange.origStart), o === null ? e.transformOffset(s.valueRange.origStart + 1) : o.position.end), o); + }); + return Ei(X(r[0].position.start, V(r).position.end), e.transformContent(t2), r); + } + function bi(t2, e) { + if (t2 === null || t2.type === void 0 && t2.value === null) return null; + switch (t2.type) { + case "ALIAS": + return qs(t2, e); + case "BLOCK_FOLDED": + return Ws(t2, e); + case "BLOCK_LITERAL": + return js(t2, e); + case "COMMENT": + return Qs(t2, e); + case "DIRECTIVE": + return Hs(t2, e); + case "DOCUMENT": + return ti(t2, e); + case "FLOW_MAP": + return ri(t2, e); + case "FLOW_SEQ": + return oi(t2, e); + case "MAP": + return li(t2, e); + case "PLAIN": + return pi(t2, e); + case "QUOTE_DOUBLE": + return di(t2, e); + case "QUOTE_SINGLE": + return yi(t2, e); + case "SEQ": + return wi(t2, e); default: - throw new qe(n, "TypeScript"); + throw new Error(`Unexpected node type ${t2.type}`); } } - function sm(e, t2, r, n) { - if (Hr(e)) return yi(e, t2); - for (let s of [hi, Ai, Oa, _a, ha]) { - let u = s(e, t2, r, n); - if (u !== void 0) return u; - } + var Xn, zn = (_b = class { + constructor(e, n) { + __privateAdd(this, _zn_instances); + __publicField(this, "text"); + __publicField(this, "comments", []); + __privateAdd(this, _e2); + __privateAdd(this, _t); + this.text = n, __privateSet(this, _e2, e); + } + setOrigRanges() { + if (!__privateGet(this, _e2).setOrigRanges()) for (let e of __privateGet(this, _e2)) e.setOrigRanges([], 0); + } + transformOffset(e) { + return __privateMethod(this, _zn_instances, n_fn).call(this, { origStart: e, origEnd: e }).start; + } + transformRange(e) { + let { start: n, end: r } = __privateMethod(this, _zn_instances, n_fn).call(this, e); + return X(n, r); + } + transformNode(e) { + return bi(e, this); + } + transformContent(e) { + return Jt(e, this); + } + }, _e2 = new WeakMap(), _t = new WeakMap(), _zn_instances = new WeakSet(), n_fn = function(e) { + var _a3; + if (!Xn) { + let [o] = __privateGet(this, _e2), a2 = Object.getPrototypeOf(Object.getPrototypeOf(o)); + Xn = Object.getOwnPropertyDescriptor(a2, "rangeAsLinePos").get; + } + if ((_a3 = __privateGet(this, _t)) != null ? _a3 : __privateSet(this, _t, { root: { context: { src: this.text } } }), this.text === "" && e.origStart === 0 && e.origEnd === 0) return { start: { offset: 0, line: 1, column: 1 }, end: { offset: 0, line: 1, column: 1 } }; + let { start: { line: n, col: r }, end: { line: s, col: i } } = Xn.call({ range: { start: __privateMethod(this, _zn_instances, r_fn).call(this, e.origStart), end: __privateMethod(this, _zn_instances, r_fn).call(this, e.origEnd) }, context: __privateGet(this, _t) }); + return { start: { offset: e.origStart, line: n, column: r }, end: { offset: e.origEnd, line: s, column: i } }; + }, r_fn = function(e) { + return e < 0 ? 0 : e > this.text.length ? this.text.length : e; + }, _b), Ni = zn; + function Oi(t2, e, n) { + let r = new SyntaxError(t2); + return r.name = "YAMLSyntaxError", r.source = e, r.position = n, r; } - var um = R(["ClassMethod", "ClassPrivateMethod", "ClassProperty", "ClassAccessorProperty", "AccessorProperty", "TSAbstractAccessorProperty", "PropertyDefinition", "TSAbstractPropertyDefinition", "ClassPrivateProperty", "MethodDefinition", "TSAbstractMethodDefinition", "TSDeclareMethod"]); - function im(e, t2, r, n) { - var D; - e.isRoot && ((D = t2.__onHtmlBindingRoot) == null || D.call(t2, e.node, t2)); - let s = sm(e, t2, r, n); - if (!s) return ""; - let { node: u } = e; - if (um(u)) return s; - let i = O(u.decorators), a2 = Si(e, t2, r), o = u.type === "ClassExpression"; - if (i && !o) return pr(s, (m) => l([a2, m])); - let p = ke(e, t2), y = oa(e, t2); - return !a2 && !p && !y ? s : pr(s, (m) => [y ? ";" : "", p ? "(" : "", p && o && i ? [f2([x, a2, m]), x] : [a2, m], p ? ")" : ""]); - } - var va = im; - var am = { avoidAstMutation: true }; - var ja = [{ linguistLanguageId: 174, name: "JSON.stringify", type: "data", color: "#292929", tmScope: "source.json", aceMode: "json", codemirrorMode: "javascript", codemirrorMimeType: "application/json", aliases: ["geojson", "jsonl", "topojson"], extensions: [".importmap"], filenames: ["package.json", "package-lock.json", "composer.json"], parsers: ["json-stringify"], vscodeLanguageIds: ["json"] }, { linguistLanguageId: 174, name: "JSON", type: "data", color: "#292929", tmScope: "source.json", aceMode: "json", codemirrorMode: "javascript", codemirrorMimeType: "application/json", aliases: ["geojson", "jsonl", "topojson"], extensions: [".json", ".4DForm", ".4DProject", ".avsc", ".geojson", ".gltf", ".har", ".ice", ".JSON-tmLanguage", ".mcmeta", ".tfstate", ".tfstate.backup", ".topojson", ".webapp", ".webmanifest", ".yy", ".yyp"], filenames: [".all-contributorsrc", ".arcconfig", ".auto-changelog", ".c8rc", ".htmlhintrc", ".imgbotconfig", ".nycrc", ".tern-config", ".tern-project", ".watchmanconfig", "Pipfile.lock", "composer.lock", "flake.lock", "mcmod.info", ".babelrc", ".jscsrc", ".jshintrc", ".jslintrc", ".swcrc"], parsers: ["json"], vscodeLanguageIds: ["json"] }, { linguistLanguageId: 423, name: "JSON with Comments", type: "data", color: "#292929", group: "JSON", tmScope: "source.js", aceMode: "javascript", codemirrorMode: "javascript", codemirrorMimeType: "text/javascript", aliases: ["jsonc"], extensions: [".jsonc", ".code-snippets", ".code-workspace", ".sublime-build", ".sublime-commands", ".sublime-completions", ".sublime-keymap", ".sublime-macro", ".sublime-menu", ".sublime-mousemap", ".sublime-project", ".sublime-settings", ".sublime-theme", ".sublime-workspace", ".sublime_metrics", ".sublime_session"], filenames: [], parsers: ["jsonc"], vscodeLanguageIds: ["jsonc"] }, { linguistLanguageId: 175, name: "JSON5", type: "data", color: "#267CB9", extensions: [".json5"], tmScope: "source.js", aceMode: "javascript", codemirrorMode: "javascript", codemirrorMimeType: "application/json", parsers: ["json5"], vscodeLanguageIds: ["json5"] }]; - var js = {}; - Tr(js, { getVisitorKeys: () => Ra, massageAstNode: () => qa, print: () => cm }); - var om = { JsonRoot: ["node"], ArrayExpression: ["elements"], ObjectExpression: ["properties"], ObjectProperty: ["key", "value"], UnaryExpression: ["argument"], NullLiteral: [], BooleanLiteral: [], StringLiteral: [], NumericLiteral: [], Identifier: [], TemplateLiteral: ["quasis"], TemplateElement: [] }, Ma = om; - var pm = gr(Ma), Ra = pm; - function cm(e, t2, r) { - let { node: n } = e; - switch (n.type) { - case "JsonRoot": - return [r("node"), F]; - case "ArrayExpression": { - if (n.elements.length === 0) return "[]"; - let s = e.map(() => e.node === null ? "null" : r(), "elements"); - return ["[", f2([F, b([",", F], s)]), F, "]"]; + function Ai(t2, e) { + let n = t2.source.range || t2.source.valueRange; + return Oi(t2.message, e.text, e.transformRange(n)); + } + function Zn(t2) { + if ("children" in t2) { + if (t2.children.length === 1) { + let e = t2.children[0]; + if (e.type === "plain" && e.tag === null && e.anchor === null && e.value === "") return t2.children.splice(0, 1), t2; } - case "ObjectExpression": - return n.properties.length === 0 ? "{}" : ["{", f2([F, b([",", F], e.map(r, "properties"))]), F, "}"]; - case "ObjectProperty": - return [r("key"), ": ", r("value")]; - case "UnaryExpression": - return [n.operator === "+" ? "" : n.operator, r("argument")]; - case "NullLiteral": - return "null"; - case "BooleanLiteral": - return n.value ? "true" : "false"; - case "StringLiteral": - return JSON.stringify(n.value); - case "NumericLiteral": - return Ja(e) ? JSON.stringify(String(n.value)) : JSON.stringify(n.value); - case "Identifier": - return Ja(e) ? JSON.stringify(n.name) : n.name; - case "TemplateLiteral": - return r(["quasis", 0]); - case "TemplateElement": - return JSON.stringify(n.value.cooked); - default: - throw new qe(n, "JSON"); + t2.children.forEach(Zn); } + return t2; } - function Ja(e) { - return e.key === "key" && e.parent.type === "ObjectProperty"; + function er(t2, e, n, r) { + let s = e(t2); + return (i) => { + r(s, i) && n(t2, s = i); + }; } - var lm = /* @__PURE__ */ new Set(["start", "end", "extra", "loc", "comments", "leadingComments", "trailingComments", "innerComments", "errors", "range", "tokens"]); - function qa(e, t2) { - let { type: r } = e; - if (r === "ObjectProperty") { - let { key: n } = e; - n.type === "Identifier" ? t2.key = { type: "StringLiteral", value: n.name } : n.type === "NumericLiteral" && (t2.key = { type: "StringLiteral", value: String(n.value) }); - return; + function tr(t2) { + if (t2 === null || !("children" in t2)) return; + let e = t2.children; + if (e.forEach(tr), t2.type === "document") { + let [i, o] = t2.children; + i.position.start.offset === i.position.end.offset ? i.position.start = i.position.end = o.position.start : o.position.start.offset === o.position.end.offset && (o.position.start = o.position.end = i.position.end); } - if (r === "UnaryExpression" && e.operator === "+") return t2.argument; - if (r === "ArrayExpression") { - for (let [n, s] of e.elements.entries()) s === null && t2.elements.splice(n, 0, { type: "NullLiteral" }); - return; + let n = er(t2.position, Fa, qa, Wa), r = er(t2.position, Ua, Va, Ka); + "endComments" in t2 && t2.endComments.length !== 0 && (n(t2.endComments[0].position.start), r(V(t2.endComments).position.end)); + let s = e.filter((i) => i !== null); + if (s.length !== 0) { + let i = s[0], o = V(s); + n(i.position.start), r(o.position.end), "leadingComments" in i && i.leadingComments.length !== 0 && n(i.leadingComments[0].position.start), "tag" in i && i.tag && n(i.tag.position.start), "anchor" in i && i.anchor && n(i.anchor.position.start), "trailingComment" in o && o.trailingComment && r(o.trailingComment.position.end); } - if (r === "TemplateLiteral") return { type: "StringLiteral", value: e.quasis[0].value.cooked }; } - qa.ignoredProperties = lm; - var Qt = { bracketSpacing: { category: "Common", type: "boolean", default: true, description: "Print spaces between brackets.", oppositeDescription: "Do not print spaces between brackets." }, objectWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap object literals.", choices: [{ value: "preserve", description: "Keep as multi-line, if there is a newline between the opening brace and first property." }, { value: "collapse", description: "Fit to a single line when possible." }] }, singleQuote: { category: "Common", type: "boolean", default: false, description: "Use single quotes instead of double quotes." }, proseWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap prose.", choices: [{ value: "always", description: "Wrap prose if it exceeds the print width." }, { value: "never", description: "Do not wrap prose." }, { value: "preserve", description: "Wrap prose as-is." }] }, bracketSameLine: { category: "Common", type: "boolean", default: false, description: "Put > of opening tags on the last line instead of on a new line." }, singleAttributePerLine: { category: "Common", type: "boolean", default: false, description: "Enforce single attribute per line in HTML, Vue and JSX." } }; - var gt = "JavaScript", mm = { arrowParens: { category: gt, type: "choice", default: "always", description: "Include parentheses around a sole arrow function parameter.", choices: [{ value: "always", description: "Always include parens. Example: `(x) => x`" }, { value: "avoid", description: "Omit parens when possible. Example: `x => x`" }] }, bracketSameLine: Qt.bracketSameLine, objectWrap: Qt.objectWrap, bracketSpacing: Qt.bracketSpacing, jsxBracketSameLine: { category: gt, type: "boolean", description: "Put > on the last line instead of at a new line.", deprecated: "2.4.0" }, semi: { category: gt, type: "boolean", default: true, description: "Print semicolons.", oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them." }, experimentalOperatorPosition: { category: gt, type: "choice", default: "end", description: "Where to print operators when binary expressions wrap lines.", choices: [{ value: "start", description: "Print operators at the start of new lines." }, { value: "end", description: "Print operators at the end of previous lines." }] }, experimentalTernaries: { category: gt, type: "boolean", default: false, description: "Use curious ternaries, with the question mark after the condition.", oppositeDescription: "Default behavior of ternaries; keep question marks on the same line as the consequent." }, singleQuote: Qt.singleQuote, jsxSingleQuote: { category: gt, type: "boolean", default: false, description: "Use single quotes in JSX." }, quoteProps: { category: gt, type: "choice", default: "as-needed", description: "Change when properties in objects are quoted.", choices: [{ value: "as-needed", description: "Only add quotes around object properties where required." }, { value: "consistent", description: "If at least one property in an object requires quotes, quote all properties." }, { value: "preserve", description: "Respect the input use of quotes in object properties." }] }, trailingComma: { category: gt, type: "choice", default: "all", description: "Print trailing commas wherever possible when multi-line.", choices: [{ value: "all", description: "Trailing commas wherever possible (including function arguments)." }, { value: "es5", description: "Trailing commas where valid in ES5 (objects, arrays, etc.)" }, { value: "none", description: "No trailing commas." }] }, singleAttributePerLine: Qt.singleAttributePerLine }, Wa = mm; - var ym = { estree: vs, "estree-json": js }, Dm = [...Ns, ...ja]; - return Ka(fm); + function Fa(t2) { + return t2.start; + } + function qa(t2, e) { + t2.start = e; + } + function Ua(t2) { + return t2.end; + } + function Va(t2, e) { + t2.end = e; + } + function Wa(t2, e) { + return e.offset < t2.offset; + } + function Ka(t2, e) { + return e.offset > t2.offset; + } + function Li(t2) { + let e = nr.default.parseCST(t2), n = new Ni(e, t2); + n.setOrigRanges(); + let r = e.map((i) => new nr.default.Document({ merge: false, keepCstNodes: true }).parse(i)); + for (let i of r) for (let o of i.errors) if (!(o instanceof Is2 && o.message === 'Map keys must be unique; "<<" is repeated')) throw Ai(o, n); + r.forEach((i) => pt(i.cstNode)); + let s = Ds(n.transformRange({ origStart: 0, origEnd: t2.length }), r.map((i) => n.transformNode(i)), n.comments); + return _s(s), tr(s), Zn(s), s; + } + function ja(t2, e) { + let n = new SyntaxError(t2 + " (" + e.loc.start.line + ":" + e.loc.start.column + ")"); + return Object.assign(n, e); + } + var Ti = ja; + function Qa(t2) { + try { + let e = Li(t2); + return delete e.comments, e; + } catch (e) { + throw (e == null ? void 0 : e.position) ? Ti(e.message, { loc: e.position, cause: e }) : e; + } + } + var Ga = { astFormat: "yaml", parse: Qa, hasPragma: br, hasIgnorePragma: Nr, locStart: tt, locEnd: vr }; + var Ha = { yaml: qr }; + return _i(Ja); }); } }); -// ../../node_modules/prettier/standalone.js -var require_standalone = __commonJS({ - "../../node_modules/prettier/standalone.js"(exports, module) { - (function(t2) { +// ../../node_modules/prettier/plugins/estree.js +var require_estree = __commonJS({ + "../../node_modules/prettier/plugins/estree.js"(exports, module) { + (function(f2) { function e() { - var o = t2(); - return o.default || o; + var i = f2(); + return i.default || i; } if (typeof exports == "object" && typeof module == "object") module.exports = e(); else if (typeof define == "function" && define.amd) define(e); else { - var f2 = typeof globalThis < "u" ? globalThis : typeof global < "u" ? global : typeof self < "u" ? self : this || {}; - f2.prettier = e(); + var t2 = typeof globalThis < "u" ? globalThis : typeof global < "u" ? global : typeof self < "u" ? self : this || {}; + t2.prettierPlugins = t2.prettierPlugins || {}, t2.prettierPlugins.estree = e(); } })(function() { "use strict"; - var Au = Object.create; - var Me = Object.defineProperty; - var vu = Object.getOwnPropertyDescriptor; - var Bu = Object.getOwnPropertyNames; - var wu = Object.getPrototypeOf, _u = Object.prototype.hasOwnProperty; - var fr = (e) => { - throw TypeError(e); - }; - var dr = (e, t2) => () => (t2 || e((t2 = { exports: {} }).exports, t2), t2.exports), vt = (e, t2) => { - for (var r in t2) Me(e, r, { get: t2[r], enumerable: true }); - }, pr = (e, t2, r, n) => { - if (t2 && typeof t2 == "object" || typeof t2 == "function") for (let u of Bu(t2)) !_u.call(e, u) && u !== r && Me(e, u, { get: () => t2[u], enumerable: !(n = vu(t2, u)) || n.enumerable }); + var _a2, _e2, __s_instances, t_fn, _b, _c2; + var jn = Object.defineProperty; + var Ba = Object.getOwnPropertyDescriptor; + var ba = Object.getOwnPropertyNames; + var Pa = Object.prototype.hasOwnProperty; + var vn = (e, t2) => { + for (var r in t2) jn(e, r, { get: t2[r], enumerable: true }); + }, ka = (e, t2, r, n) => { + if (t2 && typeof t2 == "object" || typeof t2 == "function") for (let s of ba(t2)) !Pa.call(e, s) && s !== r && jn(e, s, { get: () => t2[s], enumerable: !(n = Ba(t2, s)) || n.enumerable }); return e; }; - var Ve = (e, t2, r) => (r = e != null ? Au(wu(e)) : {}, pr(t2 || !e || !e.__esModule ? Me(r, "default", { value: e, enumerable: true }) : r, e)), xu = (e) => pr(Me({}, "__esModule", { value: true }), e); - var bu = (e, t2, r) => t2.has(e) || fr("Cannot " + r); - var Fr = (e, t2, r) => t2.has(e) ? fr("Cannot add the same private member more than once") : t2 instanceof WeakSet ? t2.add(e) : t2.set(e, r); - var pe = (e, t2, r) => (bu(e, t2, "access private method"), r); - var st = dr((la, mn) => { - "use strict"; - var Fn = new Proxy(String, { get: () => Fn }); - mn.exports = Fn; - }); - var $n = dr((ur) => { - "use strict"; - Object.defineProperty(ur, "__esModule", { value: true }); - function wi() { - return new Proxy({}, { get: () => (e) => e }); - } - var Wn = /\r\n|[\n\r\u2028\u2029]/; - function _i(e, t2, r) { - let n = Object.assign({ column: 0, line: -1 }, e.start), u = Object.assign({}, n, e.end), { linesAbove: i = 2, linesBelow: o = 3 } = r || {}, s = n.line, a2 = n.column, D = u.line, l = u.column, p = Math.max(s - (i + 1), 0), f2 = Math.min(t2.length, D + o); - s === -1 && (p = 0), D === -1 && (f2 = t2.length); - let d = D - s, c = {}; - if (d) for (let F = 0; F <= d; F++) { - let m = F + s; - if (!a2) c[m] = true; - else if (F === 0) { - let h = t2[m - 1].length; - c[m] = [a2, h - a2 + 1]; - } else if (F === d) c[m] = [0, l]; - else { - let h = t2[m - F].length; - c[m] = [0, h]; - } - } - else a2 === l ? a2 ? c[s] = [a2, 0] : c[s] = true : c[s] = [a2, l - a2]; - return { start: p, end: f2, markerLines: c }; - } - function xi(e, t2, r = {}) { - let u = wi(false), i = e.split(Wn), { start: o, end: s, markerLines: a2 } = _i(t2, i, r), D = t2.start && typeof t2.start.column == "number", l = String(s).length, f2 = e.split(Wn, s).slice(o, s).map((d, c) => { - let F = o + 1 + c, h = ` ${` ${F}`.slice(-l)} |`, C = a2[F], v = !a2[F + 1]; - if (C) { - let E = ""; - if (Array.isArray(C)) { - let g = d.slice(0, Math.max(C[0] - 1, 0)).replace(/[^\t]/g, " "), j = C[1] || 1; - E = [` - `, u.gutter(h.replace(/\d/g, " ")), " ", g, u.marker("^").repeat(j)].join(""), v && r.message && (E += " " + u.message(r.message)); - } - return [u.marker(">"), u.gutter(h), d.length > 0 ? ` ${d}` : "", E].join(""); - } else return ` ${u.gutter(h)}${d.length > 0 ? ` ${d}` : ""}`; - }).join(` -`); - return r.message && !D && (f2 = `${" ".repeat(l + 1)}${r.message} -${f2}`), f2; - } - ur.codeFrameColumns = xi; - }); - var co = {}; - vt(co, { __debug: () => lo, check: () => ao, doc: () => Dr, format: () => yu, formatWithCursor: () => gu, getSupportInfo: () => Do, util: () => cr, version: () => cu }); - var Nu = (e, t2, r, n) => { - if (!(e && t2 == null)) return t2.replaceAll ? t2.replaceAll(r, n) : r.global ? t2.replace(r, n) : t2.split(r).join(n); - }, ne = Nu; - function U() { - } - U.prototype = { diff: function(t2, r) { - var n, u = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i = u.callback; - typeof u == "function" && (i = u, u = {}); - var o = this; - function s(E) { - return E = o.postProcess(E, u), i ? (setTimeout(function() { - i(E); - }, 0), true) : E; - } - t2 = this.castInput(t2, u), r = this.castInput(r, u), t2 = this.removeEmpty(this.tokenize(t2, u)), r = this.removeEmpty(this.tokenize(r, u)); - var a2 = r.length, D = t2.length, l = 1, p = a2 + D; - u.maxEditLength != null && (p = Math.min(p, u.maxEditLength)); - var f2 = (n = u.timeout) !== null && n !== void 0 ? n : 1 / 0, d = Date.now() + f2, c = [{ oldPos: -1, lastComponent: void 0 }], F = this.extractCommon(c[0], r, t2, 0, u); - if (c[0].oldPos + 1 >= D && F + 1 >= a2) return s(mr(o, c[0].lastComponent, r, t2, o.useLongestToken)); - var m = -1 / 0, h = 1 / 0; - function C() { - for (var E = Math.max(m, -l); E <= Math.min(h, l); E += 2) { - var g = void 0, j = c[E - 1], b = c[E + 1]; - j && (c[E - 1] = void 0); - var X = false; - if (b) { - var ae = b.oldPos - E; - X = b && 0 <= ae && ae < a2; - } - var $e = j && j.oldPos + 1 < D; - if (!X && !$e) { - c[E] = void 0; - continue; - } - if (!$e || X && j.oldPos < b.oldPos ? g = o.addToPath(b, true, false, 0, u) : g = o.addToPath(j, false, true, 1, u), F = o.extractCommon(g, r, t2, E, u), g.oldPos + 1 >= D && F + 1 >= a2) return s(mr(o, g.lastComponent, r, t2, o.useLongestToken)); - c[E] = g, g.oldPos + 1 >= D && (h = Math.min(h, E - 1)), F + 1 >= a2 && (m = Math.max(m, E + 1)); - } - l++; - } - if (i) (function E() { - setTimeout(function() { - if (l > p || Date.now() > d) return i(); - C() || E(); - }, 0); - })(); - else for (; l <= p && Date.now() <= d; ) { - var v = C(); - if (v) return v; - } - }, addToPath: function(t2, r, n, u, i) { - var o = t2.lastComponent; - return o && !i.oneChangePerToken && o.added === r && o.removed === n ? { oldPos: t2.oldPos + u, lastComponent: { count: o.count + 1, added: r, removed: n, previousComponent: o.previousComponent } } : { oldPos: t2.oldPos + u, lastComponent: { count: 1, added: r, removed: n, previousComponent: o } }; - }, extractCommon: function(t2, r, n, u, i) { - for (var o = r.length, s = n.length, a2 = t2.oldPos, D = a2 - u, l = 0; D + 1 < o && a2 + 1 < s && this.equals(n[a2 + 1], r[D + 1], i); ) D++, a2++, l++, i.oneChangePerToken && (t2.lastComponent = { count: 1, previousComponent: t2.lastComponent, added: false, removed: false }); - return l && !i.oneChangePerToken && (t2.lastComponent = { count: l, previousComponent: t2.lastComponent, added: false, removed: false }), t2.oldPos = a2, D; - }, equals: function(t2, r, n) { - return n.comparator ? n.comparator(t2, r) : t2 === r || n.ignoreCase && t2.toLowerCase() === r.toLowerCase(); - }, removeEmpty: function(t2) { - for (var r = [], n = 0; n < t2.length; n++) t2[n] && r.push(t2[n]); - return r; - }, castInput: function(t2) { - return t2; - }, tokenize: function(t2) { - return Array.from(t2); - }, join: function(t2) { - return t2.join(""); - }, postProcess: function(t2) { - return t2; - } }; - function mr(e, t2, r, n, u) { - for (var i = [], o; t2; ) i.push(t2), o = t2.previousComponent, delete t2.previousComponent, t2 = o; - i.reverse(); - for (var s = 0, a2 = i.length, D = 0, l = 0; s < a2; s++) { - var p = i[s]; - if (p.removed) p.value = e.join(n.slice(l, l + p.count)), l += p.count; - else { - if (!p.added && u) { - var f2 = r.slice(D, D + p.count); - f2 = f2.map(function(d, c) { - var F = n[l + c]; - return F.length > d.length ? F : d; - }), p.value = e.join(f2); - } else p.value = e.join(r.slice(D, D + p.count)); - D += p.count, p.added || (l += p.count); - } - } - return i; - } - var ho = new U(); - function hr(e, t2) { - var r; - for (r = 0; r < e.length && r < t2.length; r++) if (e[r] != t2[r]) return e.slice(0, r); - return e.slice(0, r); - } - function Er(e, t2) { - var r; - if (!e || !t2 || e[e.length - 1] != t2[t2.length - 1]) return ""; - for (r = 0; r < e.length && r < t2.length; r++) if (e[e.length - (r + 1)] != t2[t2.length - (r + 1)]) return e.slice(-r); - return e.slice(-r); - } - function Bt(e, t2, r) { - if (e.slice(0, t2.length) != t2) throw Error("string ".concat(JSON.stringify(e), " doesn't start with prefix ").concat(JSON.stringify(t2), "; this is a bug")); - return r + e.slice(t2.length); - } - function wt(e, t2, r) { - if (!t2) return e + r; - if (e.slice(-t2.length) != t2) throw Error("string ".concat(JSON.stringify(e), " doesn't end with suffix ").concat(JSON.stringify(t2), "; this is a bug")); - return e.slice(0, -t2.length) + r; - } - function _e(e, t2) { - return Bt(e, t2, ""); - } - function Ue(e, t2) { - return wt(e, t2, ""); - } - function Cr(e, t2) { - return t2.slice(0, Ou(e, t2)); - } - function Ou(e, t2) { - var r = 0; - e.length > t2.length && (r = e.length - t2.length); - var n = t2.length; - e.length < t2.length && (n = e.length); - var u = Array(n), i = 0; - u[0] = 0; - for (var o = 1; o < n; o++) { - for (t2[o] == t2[i] ? u[o] = u[i] : u[o] = i; i > 0 && t2[o] != t2[i]; ) i = u[i]; - t2[o] == t2[i] && i++; - } - i = 0; - for (var s = r; s < e.length; s++) { - for (; i > 0 && e[s] != t2[i]; ) i = u[i]; - e[s] == t2[i] && i++; - } - return i; - } - var ze = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}", Su = new RegExp("[".concat(ze, "]+|\\s+|[^").concat(ze, "]"), "ug"), Ke = new U(); - Ke.equals = function(e, t2, r) { - return r.ignoreCase && (e = e.toLowerCase(), t2 = t2.toLowerCase()), e.trim() === t2.trim(); - }; - Ke.tokenize = function(e) { - var t2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r; - if (t2.intlSegmenter) { - if (t2.intlSegmenter.resolvedOptions().granularity != "word") throw new Error('The segmenter passed must have a granularity of "word"'); - r = Array.from(t2.intlSegmenter.segment(e), function(i) { - return i.segment; - }); - } else r = e.match(Su) || []; - var n = [], u = null; - return r.forEach(function(i) { - /\s/.test(i) ? u == null ? n.push(i) : n.push(n.pop() + i) : /\s/.test(u) ? n[n.length - 1] == u ? n.push(n.pop() + i) : n.push(u + i) : n.push(i), u = i; - }), n; - }; - Ke.join = function(e) { - return e.map(function(t2, r) { - return r == 0 ? t2 : t2.replace(/^\s+/, ""); - }).join(""); - }; - Ke.postProcess = function(e, t2) { - if (!e || t2.oneChangePerToken) return e; - var r = null, n = null, u = null; - return e.forEach(function(i) { - i.added ? n = i : i.removed ? u = i : ((n || u) && gr(r, u, n, i), r = i, n = null, u = null); - }), (n || u) && gr(r, u, n, null), e; - }; - function gr(e, t2, r, n) { - if (t2 && r) { - var u = t2.value.match(/^\s*/)[0], i = t2.value.match(/\s*$/)[0], o = r.value.match(/^\s*/)[0], s = r.value.match(/\s*$/)[0]; - if (e) { - var a2 = hr(u, o); - e.value = wt(e.value, o, a2), t2.value = _e(t2.value, a2), r.value = _e(r.value, a2); - } - if (n) { - var D = Er(i, s); - n.value = Bt(n.value, s, D), t2.value = Ue(t2.value, D), r.value = Ue(r.value, D); - } - } else if (r) e && (r.value = r.value.replace(/^\s*/, "")), n && (n.value = n.value.replace(/^\s*/, "")); - else if (e && n) { - var l = n.value.match(/^\s*/)[0], p = t2.value.match(/^\s*/)[0], f2 = t2.value.match(/\s*$/)[0], d = hr(l, p); - t2.value = _e(t2.value, d); - var c = Er(_e(l, d), f2); - t2.value = Ue(t2.value, c), n.value = Bt(n.value, l, c), e.value = wt(e.value, l, l.slice(0, l.length - c.length)); - } else if (n) { - var F = n.value.match(/^\s*/)[0], m = t2.value.match(/\s*$/)[0], h = Cr(m, F); - t2.value = Ue(t2.value, h); - } else if (e) { - var C = e.value.match(/\s*$/)[0], v = t2.value.match(/^\s*/)[0], E = Cr(C, v); - t2.value = _e(t2.value, E); - } - } - var Tu = new U(); - Tu.tokenize = function(e) { - var t2 = new RegExp("(\\r?\\n)|[".concat(ze, "]+|[^\\S\\n\\r]+|[^").concat(ze, "]"), "ug"); - return e.match(t2) || []; - }; - var bt = new U(); - bt.tokenize = function(e, t2) { - t2.stripTrailingCr && (e = e.replace(/\r\n/g, ` -`)); - var r = [], n = e.split(/(\n|\r\n)/); - n[n.length - 1] || n.pop(); - for (var u = 0; u < n.length; u++) { - var i = n[u]; - u % 2 && !t2.newlineIsToken ? r[r.length - 1] += i : r.push(i); - } - return r; - }; - bt.equals = function(e, t2, r) { - return r.ignoreWhitespace ? ((!r.newlineIsToken || !e.includes(` -`)) && (e = e.trim()), (!r.newlineIsToken || !t2.includes(` -`)) && (t2 = t2.trim())) : r.ignoreNewlineAtEof && !r.newlineIsToken && (e.endsWith(` -`) && (e = e.slice(0, -1)), t2.endsWith(` -`) && (t2 = t2.slice(0, -1))), U.prototype.equals.call(this, e, t2, r); - }; - var ku = new U(); - ku.tokenize = function(e) { - return e.split(/(\S.+?[.!?])(?=\s+|$)/); - }; - var Lu = new U(); - Lu.tokenize = function(e) { - return e.split(/([{}:;,]|\s+)/); - }; - function _t(e) { - "@babel/helpers - typeof"; - return _t = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t2) { - return typeof t2; - } : function(t2) { - return t2 && typeof Symbol == "function" && t2.constructor === Symbol && t2 !== Symbol.prototype ? "symbol" : typeof t2; - }, _t(e); - } - var xe = new U(); - xe.useLongestToken = true; - xe.tokenize = bt.tokenize; - xe.castInput = function(e, t2) { - var r = t2.undefinedReplacement, n = t2.stringifyReplacer, u = n === void 0 ? function(i, o) { - return typeof o > "u" ? r : o; - } : n; - return typeof e == "string" ? e : JSON.stringify(xt(e, null, null, u), u, " "); - }; - xe.equals = function(e, t2, r) { - return U.prototype.equals.call(xe, e.replace(/,([\r\n])/g, "$1"), t2.replace(/,([\r\n])/g, "$1"), r); + var Ia = (e) => ka(jn({}, "__esModule", { value: true }), e); + var hD = {}; + vn(hD, { languages: () => gD, options: () => Ta, printers: () => xD }); + var zs = [{ name: "JavaScript", type: "programming", aceMode: "javascript", extensions: [".js", "._js", ".bones", ".cjs", ".es", ".es6", ".gs", ".jake", ".javascript", ".jsb", ".jscad", ".jsfl", ".jslib", ".jsm", ".jspre", ".jss", ".mjs", ".njs", ".pac", ".sjs", ".ssjs", ".xsjs", ".xsjslib", ".start.frag", ".end.frag", ".wxs"], filenames: ["Jakefile", "start.frag", "end.frag"], tmScope: "source.js", aliases: ["js", "node"], codemirrorMode: "javascript", codemirrorMimeType: "text/javascript", interpreters: ["chakra", "d8", "gjs", "js", "node", "nodejs", "qjs", "rhino", "v8", "v8-shell", "zx"], parsers: ["babel", "acorn", "espree", "meriyah", "babel-flow", "babel-ts", "flow", "typescript"], vscodeLanguageIds: ["javascript", "mongo"], linguistLanguageId: 183 }, { name: "Flow", type: "programming", aceMode: "javascript", extensions: [".js.flow"], filenames: [], tmScope: "source.js", aliases: [], codemirrorMode: "javascript", codemirrorMimeType: "text/javascript", interpreters: ["chakra", "d8", "gjs", "js", "node", "nodejs", "qjs", "rhino", "v8", "v8-shell"], parsers: ["flow", "babel-flow"], vscodeLanguageIds: ["javascript"], linguistLanguageId: 183 }, { name: "JSX", type: "programming", aceMode: "javascript", extensions: [".jsx"], filenames: void 0, tmScope: "source.js.jsx", aliases: void 0, codemirrorMode: "jsx", codemirrorMimeType: "text/jsx", interpreters: void 0, parsers: ["babel", "babel-flow", "babel-ts", "flow", "typescript", "espree", "meriyah"], vscodeLanguageIds: ["javascriptreact"], group: "JavaScript", linguistLanguageId: 183 }, { name: "TypeScript", type: "programming", aceMode: "typescript", extensions: [".ts", ".cts", ".mts"], tmScope: "source.ts", aliases: ["ts"], codemirrorMode: "javascript", codemirrorMimeType: "application/typescript", interpreters: ["bun", "deno", "ts-node", "tsx"], parsers: ["typescript", "babel-ts"], vscodeLanguageIds: ["typescript"], linguistLanguageId: 378 }, { name: "TSX", type: "programming", aceMode: "tsx", extensions: [".tsx"], tmScope: "source.tsx", codemirrorMode: "jsx", codemirrorMimeType: "text/typescript-jsx", group: "TypeScript", parsers: ["typescript", "babel-ts"], vscodeLanguageIds: ["typescriptreact"], linguistLanguageId: 94901924 }]; + var Xs = {}; + vn(Xs, { canAttachComment: () => ki, embed: () => Ao, features: () => FD, getVisitorKeys: () => Mr, handleComments: () => Gi, hasPrettierIgnore: () => nr, insertPragma: () => Oo, isBlockComment: () => ce, isGap: () => Wi, massageAstNode: () => bi, print: () => Hs, printComment: () => _o, printPrettierIgnored: () => Hs, willPrintOwnComments: () => qi }); + var Wt = (e, t2) => (r, n, ...s) => { + var _a3; + return r | 1 && n == null ? void 0 : ((_a3 = t2.call(n)) != null ? _a3 : n[e]).apply(n, s); }; - function xt(e, t2, r, n, u) { - t2 = t2 || [], r = r || [], n && (e = n(u, e)); - var i; - for (i = 0; i < t2.length; i += 1) if (t2[i] === e) return r[i]; - var o; - if (Object.prototype.toString.call(e) === "[object Array]") { - for (t2.push(e), o = new Array(e.length), r.push(o), i = 0; i < e.length; i += 1) o[i] = xt(e[i], t2, r, n, u); - return t2.pop(), r.pop(), o; - } - if (e && e.toJSON && (e = e.toJSON()), _t(e) === "object" && e !== null) { - t2.push(e), o = {}, r.push(o); - var s = [], a2; - for (a2 in e) Object.prototype.hasOwnProperty.call(e, a2) && s.push(a2); - for (s.sort(), i = 0; i < s.length; i += 1) a2 = s[i], o[a2] = xt(e[a2], t2, r, n, a2); - t2.pop(), r.pop(); - } else o = e; - return o; - } - var Ge = new U(); - Ge.tokenize = function(e) { - return e.slice(); - }; - Ge.join = Ge.removeEmpty = function(e) { - return e; - }; - function yr(e, t2, r) { - return Ge.diff(e, t2, r); - } - function Ar(e) { - let t2 = e.indexOf("\r"); - return t2 !== -1 ? e.charAt(t2 + 1) === ` -` ? "crlf" : "cr" : "lf"; - } - function be(e) { - switch (e) { - case "cr": - return "\r"; - case "crlf": - return `\r -`; - default: - return ` -`; - } - } - function Nt(e, t2) { - let r; - switch (t2) { - case ` -`: - r = /\n/gu; - break; - case "\r": - r = /\r/gu; - break; - case `\r -`: - r = /\r\n/gu; - break; - default: - throw new Error(`Unexpected "eol" ${JSON.stringify(t2)}.`); - } - let n = e.match(r); - return n ? n.length : 0; - } - function vr(e) { - return ne(false, e, /\r\n?/gu, ` -`); - } - var $ = "string", H = "array", z = "cursor", T = "indent", k = "align", L = "trim", B = "group", N = "fill", w = "if-break", P = "indent-if-break", I = "line-suffix", R = "line-suffix-boundary", y = "line", O = "label", _2 = "break-parent", Je = /* @__PURE__ */ new Set([z, T, k, L, B, N, w, P, I, R, y, O, _2]); - var Pu = (e, t2, r) => { - if (!(e && t2 == null)) return Array.isArray(t2) || typeof t2 == "string" ? t2[r < 0 ? t2.length + r : r] : t2.at(r); - }, A2 = Pu; - function Iu(e) { - if (typeof e == "string") return $; - if (Array.isArray(e)) return H; - if (!e) return; - let { type: t2 } = e; - if (Je.has(t2)) return t2; - } - var M = Iu; - var Ru = (e) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(e); - function Yu(e) { - let t2 = e === null ? "null" : typeof e; - if (t2 !== "string" && t2 !== "object") return `Unexpected doc '${t2}', -Expected it to be 'string' or 'object'.`; - if (M(e)) throw new Error("doc is valid."); - let r = Object.prototype.toString.call(e); - if (r !== "[object Object]") return `Unexpected doc '${r}'.`; - let n = Ru([...Je].map((u) => `'${u}'`)); - return `Unexpected doc.type '${e.type}'. -Expected it to be ${n}.`; - } - var Ot = class extends Error { - constructor(t2) { - super(Yu(t2)); - __publicField(this, "name", "InvalidDocError"); - this.doc = t2; - } - }, Q = Ot; - var Br = {}; - function ju(e, t2, r, n) { - let u = [e]; - for (; u.length > 0; ) { - let i = u.pop(); - if (i === Br) { - r(u.pop()); - continue; - } - r && u.push(i, Br); - let o = M(i); - if (!o) throw new Q(i); - if ((t2 == null ? void 0 : t2(i)) !== false) switch (o) { - case H: - case N: { - let s = o === H ? i : i.parts; - for (let a2 = s.length, D = a2 - 1; D >= 0; --D) u.push(s[D]); - break; - } - case w: - u.push(i.flatContents, i.breakContents); - break; - case B: - if (n && i.expandedStates) for (let s = i.expandedStates.length, a2 = s - 1; a2 >= 0; --a2) u.push(i.expandedStates[a2]); - else u.push(i.contents); - break; - case k: - case T: - case P: - case O: - case I: - u.push(i.contents); - break; - case $: - case z: - case L: - case R: - case y: - case _2: - break; - default: - throw new Q(i); - } - } + var La = (_a2 = String.prototype.replaceAll) != null ? _a2 : function(e, t2) { + return e.global ? this.replace(e, t2) : this.split(e).join(t2); + }, Oa = Wt("replaceAll", function() { + if (typeof this == "string") return La; + }), W = Oa; + function wa(e) { + return this[e < 0 ? this.length + e : e]; + } + var _a = Wt("at", function() { + if (Array.isArray(this) || typeof this == "string") return wa; + }), N = _a; + function Ma(e) { + return e !== null && typeof e == "object"; } - var Fe = ju; - function Oe(e, t2) { - if (typeof e == "string") return t2(e); - let r = /* @__PURE__ */ new Map(); - return n(e); - function n(i) { - if (r.has(i)) return r.get(i); - let o = u(i); - return r.set(i, o), o; - } - function u(i) { - switch (M(i)) { - case H: - return t2(i.map(n)); - case N: - return t2({ ...i, parts: i.parts.map(n) }); - case w: - return t2({ ...i, breakContents: n(i.breakContents), flatContents: n(i.flatContents) }); - case B: { - let { expandedStates: o, contents: s } = i; - return o ? (o = o.map(n), s = o[0]) : s = n(s), t2({ ...i, contents: s, expandedStates: o }); - } - case k: - case T: - case P: - case O: - case I: - return t2({ ...i, contents: n(i.contents) }); - case $: - case z: - case L: - case R: - case y: - case _2: - return t2(i); - default: - throw new Q(i); - } + var Lr = Ma; + function* Na(e, t2) { + let { getVisitorKeys: r, filter: n = () => true } = t2, s = (i) => Lr(i) && n(i); + for (let i of r(e)) { + let o = e[i]; + if (Array.isArray(o)) for (let u of o) s(u) && (yield u); + else s(o) && (yield o); } } - function qe(e, t2, r) { - let n = r, u = false; - function i(o) { - if (u) return false; - let s = t2(o); - s !== void 0 && (u = true, n = s); + function* ja(e, t2) { + let r = [e]; + for (let n = 0; n < r.length; n++) { + let s = r[n]; + for (let i of Na(s, t2)) yield i, r.push(i); } - return Fe(e, i), n; } - function Hu(e) { - if (e.type === B && e.break || e.type === y && e.hard || e.type === _2) return true; + function Zs(e, { getVisitorKeys: t2, predicate: r }) { + for (let n of ja(e, { getVisitorKeys: t2 })) if (r(n)) return true; + return false; } - function xr(e) { - return qe(e, Hu, false); + var ei = () => /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g; + function Rn(e) { + return e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510; } - function wr(e) { - if (e.length > 0) { - let t2 = A2(false, e, -1); - !t2.expandedStates && !t2.break && (t2.break = "propagated"); + function Jn(e) { + return e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9776 && e <= 9783 || e >= 9800 && e <= 9811 || e === 9855 || e >= 9866 && e <= 9871 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12773 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e >= 94192 && e <= 94198 || e >= 94208 && e <= 101589 || e >= 101631 && e <= 101662 || e >= 101760 && e <= 101874 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e >= 119552 && e <= 119638 || e >= 119648 && e <= 119670 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128728 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129674 || e >= 129678 && e <= 129734 || e === 129736 || e >= 129741 && e <= 129756 || e >= 129759 && e <= 129770 || e >= 129775 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141; + } + var ti = "\xA9\xAE\u203C\u2049\u2122\u2139\u2194\u2195\u2196\u2197\u2198\u2199\u21A9\u21AA\u2328\u23CF\u23F1\u23F2\u23F8\u23F9\u23FA\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600\u2601\u2602\u2603\u2604\u260E\u2611\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638\u2639\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694\u2695\u2696\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F1\u26F7\u26F8\u26F9\u2702\u2708\u2709\u270C\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u2764\u27A1\u2934\u2935\u2B05\u2B06\u2B07"; + var va = /[^\x20-\x7F]/u, Ra = new Set(ti); + function Ja(e) { + if (!e) return 0; + if (!va.test(e)) return e.length; + e = e.replace(ei(), (r) => Ra.has(r) ? " " : " "); + let t2 = 0; + for (let r of e) { + let n = r.codePointAt(0); + n <= 31 || n >= 127 && n <= 159 || n >= 768 && n <= 879 || n >= 65024 && n <= 65039 || (t2 += Rn(n) || Jn(n) ? 2 : 1); } - return null; + return t2; } - function br(e) { - let t2 = /* @__PURE__ */ new Set(), r = []; - function n(i) { - if (i.type === _2 && wr(r), i.type === B) { - if (r.push(i), t2.has(i)) return false; - t2.add(i); + var ot = Ja; + function Or(e) { + return (t2, r, n) => { + let s = !!(n == null ? void 0 : n.backwards); + if (r === false) return false; + let { length: i } = t2, o = r; + for (; o >= 0 && o < i; ) { + let u = t2.charAt(o); + if (e instanceof RegExp) { + if (!e.test(u)) return o; + } else if (!e.includes(u)) return o; + s ? o-- : o++; } + return o === -1 || o === i ? o : false; + }; + } + var YD = Or(/\s/u), ze = Or(" "), ri = Or(",; "), ni = Or(/[^\n\r]/u); + var si = (e) => e === ` +` || e === "\r" || e === "\u2028" || e === "\u2029"; + function Ga(e, t2, r) { + let n = !!(r == null ? void 0 : r.backwards); + if (t2 === false) return false; + let s = e.charAt(t2); + if (n) { + if (e.charAt(t2 - 1) === "\r" && s === ` +`) return t2 - 2; + if (si(s)) return t2 - 1; + } else { + if (s === "\r" && e.charAt(t2 + 1) === ` +`) return t2 + 2; + if (si(s)) return t2 + 1; } - function u(i) { - i.type === B && r.pop().break && wr(r); + return t2; + } + var Ze = Ga; + function Wa(e, t2, r = {}) { + let n = ze(e, r.backwards ? t2 - 1 : t2, r), s = Ze(e, n, r); + return n !== s; + } + var Z = Wa; + function qa(e, t2) { + if (t2 === false) return false; + if (e.charAt(t2) === "/" && e.charAt(t2 + 1) === "*") { + for (let r = t2 + 2; r < e.length; ++r) if (e.charAt(r) === "*" && e.charAt(r + 1) === "/") return r + 2; } - Fe(e, n, u, true); + return t2; } - function Wu(e) { - return e.type === y && !e.hard ? e.soft ? "" : " " : e.type === w ? e.flatContents : e; + var qt = qa; + function Ua(e, t2) { + return t2 === false ? false : e.charAt(t2) === "/" && e.charAt(t2 + 1) === "/" ? ni(e, t2) : t2; } - function Nr(e) { - return Oe(e, Wu); + var Ut = Ua; + function Ya(e, t2) { + let r = null, n = t2; + for (; n !== r; ) r = n, n = ri(e, n), n = qt(e, n), n = ze(e, n); + return n = Ut(e, n), n = Ze(e, n), n !== false && Z(e, n); } - function _r(e) { - for (e = [...e]; e.length >= 2 && A2(false, e, -2).type === y && A2(false, e, -1).type === _2; ) e.length -= 2; - if (e.length > 0) { - let t2 = Ne(A2(false, e, -1)); - e[e.length - 1] = t2; + var Yt = Ya; + function Ha(e) { + return Array.isArray(e) && e.length > 0; + } + var R = Ha; + var Xa = () => { + }, Le = Xa; + var ii = Object.freeze({ character: "'", codePoint: 39 }), oi = Object.freeze({ character: '"', codePoint: 34 }), Va = Object.freeze({ preferred: ii, alternate: oi }), $a = Object.freeze({ preferred: oi, alternate: ii }); + function Ka(e, t2) { + let { preferred: r, alternate: n } = t2 === true || t2 === "'" ? Va : $a, { length: s } = e, i = 0, o = 0; + for (let u = 0; u < s; u++) { + let p = e.charCodeAt(u); + p === r.codePoint ? i++ : p === n.codePoint && o++; + } + return (i > o ? n : r).character; + } + var wr = Ka; + var Qa = /\\(["'\\])|(["'])/gu; + function za(e, t2) { + let r = t2 === '"' ? "'" : '"', n = W(0, e, Qa, (s, i, o) => i ? i === r ? r : s : o === t2 ? "\\" + o : o); + return t2 + n + t2; + } + var ui = za; + function Za(e, t2) { + Le(/^(?["']).*\k$/su.test(e)); + let r = e.slice(1, -1), n = t2.parser === "json" || t2.parser === "jsonc" || t2.parser === "json5" && t2.quoteProps === "preserve" && !t2.singleQuote ? '"' : t2.__isInHtmlAttribute ? "'" : wr(r, t2.singleQuote); + return e.charAt(0) === n ? e : ui(r, n); + } + var ut = Za; + var ai = (e) => Number.isInteger(e) && e >= 0; + function w(e) { + var _a3, _b2, _c3, _d, _e3; + let t2 = (_b2 = (_a3 = e.range) == null ? void 0 : _a3[0]) != null ? _b2 : e.start, r = (_e3 = (_d = (_c3 = e.declaration) == null ? void 0 : _c3.decorators) != null ? _d : e.decorators) == null ? void 0 : _e3[0]; + return r ? Math.min(w(r), t2) : t2; + } + function I(e) { + var _a3, _b2; + return (_b2 = (_a3 = e.range) == null ? void 0 : _a3[1]) != null ? _b2 : e.end; + } + function bt(e, t2) { + let r = w(e); + return ai(r) && r === w(t2); + } + function ep(e, t2) { + let r = I(e); + return ai(r) && r === I(t2); + } + function pi(e, t2) { + return bt(e, t2) && ep(e, t2); + } + var Dr = null; + function fr(e) { + if (Dr !== null && typeof Dr.property) { + let t2 = Dr; + return Dr = fr.prototype = null, t2; } - return e; + return Dr = fr.prototype = e != null ? e : /* @__PURE__ */ Object.create(null), new fr(); } - function Ne(e) { - switch (M(e)) { - case T: - case P: - case B: - case I: - case O: { - let t2 = Ne(e.contents); - return { ...e, contents: t2 }; - } - case w: - return { ...e, breakContents: Ne(e.breakContents), flatContents: Ne(e.flatContents) }; - case N: - return { ...e, parts: _r(e.parts) }; - case H: - return _r(e); - case $: - return e.replace(/[\n\r]*$/u, ""); - case k: - case z: - case L: - case R: - case y: - case _2: - break; - default: - throw new Q(e); + var tp = 10; + for (let e = 0; e <= tp; e++) fr(); + function Wn(e) { + return fr(e); + } + function rp(e, t2 = "type") { + Wn(e); + function r(n) { + let s = n[t2], i = e[s]; + if (!Array.isArray(i)) throw Object.assign(new Error(`Missing visitor keys for '${s}'.`), { node: n }); + return i; } - return e; + return r; } - function Xe(e) { - return Ne(Mu(e)); + var _r = rp; + var a2 = [["decorators", "key", "typeAnnotation", "value"], [], ["elementType"], ["expression"], ["expression", "typeAnnotation"], ["left", "right"], ["argument"], ["directives", "body"], ["label"], ["callee", "typeArguments", "arguments"], ["body"], ["decorators", "id", "typeParameters", "superClass", "superTypeArguments", "mixins", "implements", "body", "superTypeParameters"], ["id", "typeParameters"], ["decorators", "key", "typeParameters", "params", "returnType", "body"], ["decorators", "variance", "key", "typeAnnotation", "value"], ["name", "typeAnnotation"], ["test", "consequent", "alternate"], ["checkType", "extendsType", "trueType", "falseType"], ["value"], ["id", "body"], ["declaration", "specifiers", "source", "attributes"], ["id"], ["id", "typeParameters", "extends", "body"], ["typeAnnotation"], ["id", "typeParameters", "right"], ["body", "test"], ["members"], ["id", "init"], ["exported"], ["left", "right", "body"], ["id", "typeParameters", "params", "predicate", "returnType", "body"], ["id", "params", "body", "typeParameters", "returnType"], ["key", "value"], ["local"], ["objectType", "indexType"], ["typeParameter"], ["types"], ["node"], ["object", "property"], ["argument", "cases"], ["pattern", "body", "guard"], ["literal"], ["decorators", "key", "value"], ["expressions"], ["qualification", "id"], ["decorators", "key", "typeAnnotation"], ["typeParameters", "params", "returnType"], ["expression", "typeArguments"], ["params"], ["parameterName", "typeAnnotation"]], ci = { AccessorProperty: a2[0], AnyTypeAnnotation: a2[1], ArgumentPlaceholder: a2[1], ArrayExpression: ["elements"], ArrayPattern: ["elements", "typeAnnotation", "decorators"], ArrayTypeAnnotation: a2[2], ArrowFunctionExpression: ["typeParameters", "params", "predicate", "returnType", "body"], AsConstExpression: a2[3], AsExpression: a2[4], AssignmentExpression: a2[5], AssignmentPattern: ["left", "right", "decorators", "typeAnnotation"], AwaitExpression: a2[6], BigIntLiteral: a2[1], BigIntLiteralTypeAnnotation: a2[1], BigIntTypeAnnotation: a2[1], BinaryExpression: a2[5], BindExpression: ["object", "callee"], BlockStatement: a2[7], BooleanLiteral: a2[1], BooleanLiteralTypeAnnotation: a2[1], BooleanTypeAnnotation: a2[1], BreakStatement: a2[8], CallExpression: a2[9], CatchClause: ["param", "body"], ChainExpression: a2[3], ClassAccessorProperty: a2[0], ClassBody: a2[10], ClassDeclaration: a2[11], ClassExpression: a2[11], ClassImplements: a2[12], ClassMethod: a2[13], ClassPrivateMethod: a2[13], ClassPrivateProperty: a2[14], ClassProperty: a2[14], ComponentDeclaration: ["id", "params", "body", "typeParameters", "rendersType"], ComponentParameter: ["name", "local"], ComponentTypeAnnotation: ["params", "rest", "typeParameters", "rendersType"], ComponentTypeParameter: a2[15], ConditionalExpression: a2[16], ConditionalTypeAnnotation: a2[17], ContinueStatement: a2[8], DebuggerStatement: a2[1], DeclareClass: ["id", "typeParameters", "extends", "mixins", "implements", "body"], DeclareComponent: ["id", "params", "rest", "typeParameters", "rendersType"], DeclaredPredicate: a2[18], DeclareEnum: a2[19], DeclareExportAllDeclaration: ["source", "attributes"], DeclareExportDeclaration: a2[20], DeclareFunction: ["id", "predicate"], DeclareHook: a2[21], DeclareInterface: a2[22], DeclareModule: a2[19], DeclareModuleExports: a2[23], DeclareNamespace: a2[19], DeclareOpaqueType: ["id", "typeParameters", "supertype", "lowerBound", "upperBound"], DeclareTypeAlias: a2[24], DeclareVariable: a2[21], Decorator: a2[3], Directive: a2[18], DirectiveLiteral: a2[1], DoExpression: a2[10], DoWhileStatement: a2[25], EmptyStatement: a2[1], EmptyTypeAnnotation: a2[1], EnumBigIntBody: a2[26], EnumBigIntMember: a2[27], EnumBooleanBody: a2[26], EnumBooleanMember: a2[27], EnumDeclaration: a2[19], EnumDefaultedMember: a2[21], EnumNumberBody: a2[26], EnumNumberMember: a2[27], EnumStringBody: a2[26], EnumStringMember: a2[27], EnumSymbolBody: a2[26], ExistsTypeAnnotation: a2[1], ExperimentalRestProperty: a2[6], ExperimentalSpreadProperty: a2[6], ExportAllDeclaration: ["source", "attributes", "exported"], ExportDefaultDeclaration: ["declaration"], ExportDefaultSpecifier: a2[28], ExportNamedDeclaration: a2[20], ExportNamespaceSpecifier: a2[28], ExportSpecifier: ["local", "exported"], ExpressionStatement: a2[3], File: ["program"], ForInStatement: a2[29], ForOfStatement: a2[29], ForStatement: ["init", "test", "update", "body"], FunctionDeclaration: a2[30], FunctionExpression: a2[30], FunctionTypeAnnotation: ["typeParameters", "this", "params", "rest", "returnType"], FunctionTypeParam: a2[15], GenericTypeAnnotation: a2[12], HookDeclaration: a2[31], HookTypeAnnotation: ["params", "returnType", "rest", "typeParameters"], Identifier: ["typeAnnotation", "decorators"], IfStatement: a2[16], ImportAttribute: a2[32], ImportDeclaration: ["specifiers", "source", "attributes"], ImportDefaultSpecifier: a2[33], ImportExpression: ["source", "options"], ImportNamespaceSpecifier: a2[33], ImportSpecifier: ["imported", "local"], IndexedAccessType: a2[34], InferredPredicate: a2[1], InferTypeAnnotation: a2[35], InterfaceDeclaration: a2[22], InterfaceExtends: a2[12], InterfaceTypeAnnotation: ["extends", "body"], InterpreterDirective: a2[1], IntersectionTypeAnnotation: a2[36], JsExpressionRoot: a2[37], JsonRoot: a2[37], JSXAttribute: ["name", "value"], JSXClosingElement: ["name"], JSXClosingFragment: a2[1], JSXElement: ["openingElement", "children", "closingElement"], JSXEmptyExpression: a2[1], JSXExpressionContainer: a2[3], JSXFragment: ["openingFragment", "children", "closingFragment"], JSXIdentifier: a2[1], JSXMemberExpression: a2[38], JSXNamespacedName: ["namespace", "name"], JSXOpeningElement: ["name", "typeArguments", "attributes"], JSXOpeningFragment: a2[1], JSXSpreadAttribute: a2[6], JSXSpreadChild: a2[3], JSXText: a2[1], KeyofTypeAnnotation: a2[6], LabeledStatement: ["label", "body"], Literal: a2[1], LogicalExpression: a2[5], MatchArrayPattern: ["elements", "rest"], MatchAsPattern: ["pattern", "target"], MatchBindingPattern: a2[21], MatchExpression: a2[39], MatchExpressionCase: a2[40], MatchIdentifierPattern: a2[21], MatchLiteralPattern: a2[41], MatchMemberPattern: ["base", "property"], MatchObjectPattern: ["properties", "rest"], MatchObjectPatternProperty: ["key", "pattern"], MatchOrPattern: ["patterns"], MatchRestPattern: a2[6], MatchStatement: a2[39], MatchStatementCase: a2[40], MatchUnaryPattern: a2[6], MatchWildcardPattern: a2[1], MemberExpression: a2[38], MetaProperty: ["meta", "property"], MethodDefinition: a2[42], MixedTypeAnnotation: a2[1], ModuleExpression: a2[10], NeverTypeAnnotation: a2[1], NewExpression: a2[9], NGChainedExpression: a2[43], NGEmptyExpression: a2[1], NGMicrosyntax: a2[10], NGMicrosyntaxAs: ["key", "alias"], NGMicrosyntaxExpression: ["expression", "alias"], NGMicrosyntaxKey: a2[1], NGMicrosyntaxKeyedExpression: ["key", "expression"], NGMicrosyntaxLet: a2[32], NGPipeExpression: ["left", "right", "arguments"], NGRoot: a2[37], NullableTypeAnnotation: a2[23], NullLiteral: a2[1], NullLiteralTypeAnnotation: a2[1], NumberLiteralTypeAnnotation: a2[1], NumberTypeAnnotation: a2[1], NumericLiteral: a2[1], ObjectExpression: ["properties"], ObjectMethod: a2[13], ObjectPattern: ["decorators", "properties", "typeAnnotation"], ObjectProperty: a2[42], ObjectTypeAnnotation: ["properties", "indexers", "callProperties", "internalSlots"], ObjectTypeCallProperty: a2[18], ObjectTypeIndexer: ["variance", "id", "key", "value"], ObjectTypeInternalSlot: ["id", "value"], ObjectTypeMappedTypeProperty: ["keyTparam", "propType", "sourceType", "variance"], ObjectTypeProperty: ["key", "value", "variance"], ObjectTypeSpreadProperty: a2[6], OpaqueType: ["id", "typeParameters", "supertype", "impltype", "lowerBound", "upperBound"], OptionalCallExpression: a2[9], OptionalIndexedAccessType: a2[34], OptionalMemberExpression: a2[38], ParenthesizedExpression: a2[3], PipelineBareFunction: ["callee"], PipelinePrimaryTopicReference: a2[1], PipelineTopicExpression: a2[3], Placeholder: a2[1], PrivateIdentifier: a2[1], PrivateName: a2[21], Program: a2[7], Property: a2[32], PropertyDefinition: a2[14], QualifiedTypeIdentifier: a2[44], QualifiedTypeofIdentifier: a2[44], RegExpLiteral: a2[1], RestElement: ["argument", "typeAnnotation", "decorators"], ReturnStatement: a2[6], SatisfiesExpression: a2[4], SequenceExpression: a2[43], SpreadElement: a2[6], StaticBlock: a2[10], StringLiteral: a2[1], StringLiteralTypeAnnotation: a2[1], StringTypeAnnotation: a2[1], Super: a2[1], SwitchCase: ["test", "consequent"], SwitchStatement: ["discriminant", "cases"], SymbolTypeAnnotation: a2[1], TaggedTemplateExpression: ["tag", "typeArguments", "quasi"], TemplateElement: a2[1], TemplateLiteral: ["quasis", "expressions"], ThisExpression: a2[1], ThisTypeAnnotation: a2[1], ThrowStatement: a2[6], TopicReference: a2[1], TryStatement: ["block", "handler", "finalizer"], TSAbstractAccessorProperty: a2[45], TSAbstractKeyword: a2[1], TSAbstractMethodDefinition: a2[32], TSAbstractPropertyDefinition: a2[45], TSAnyKeyword: a2[1], TSArrayType: a2[2], TSAsExpression: a2[4], TSAsyncKeyword: a2[1], TSBigIntKeyword: a2[1], TSBooleanKeyword: a2[1], TSCallSignatureDeclaration: a2[46], TSClassImplements: a2[47], TSConditionalType: a2[17], TSConstructorType: a2[46], TSConstructSignatureDeclaration: a2[46], TSDeclareFunction: a2[31], TSDeclareKeyword: a2[1], TSDeclareMethod: ["decorators", "key", "typeParameters", "params", "returnType"], TSEmptyBodyFunctionExpression: ["id", "typeParameters", "params", "returnType"], TSEnumBody: a2[26], TSEnumDeclaration: a2[19], TSEnumMember: ["id", "initializer"], TSExportAssignment: a2[3], TSExportKeyword: a2[1], TSExternalModuleReference: a2[3], TSFunctionType: a2[46], TSImportEqualsDeclaration: ["id", "moduleReference"], TSImportType: ["options", "qualifier", "typeArguments", "source"], TSIndexedAccessType: a2[34], TSIndexSignature: ["parameters", "typeAnnotation"], TSInferType: a2[35], TSInstantiationExpression: a2[47], TSInterfaceBody: a2[10], TSInterfaceDeclaration: a2[22], TSInterfaceHeritage: a2[47], TSIntersectionType: a2[36], TSIntrinsicKeyword: a2[1], TSJSDocAllType: a2[1], TSJSDocNonNullableType: a2[23], TSJSDocNullableType: a2[23], TSJSDocUnknownType: a2[1], TSLiteralType: a2[41], TSMappedType: ["key", "constraint", "nameType", "typeAnnotation"], TSMethodSignature: ["key", "typeParameters", "params", "returnType"], TSModuleBlock: a2[10], TSModuleDeclaration: a2[19], TSNamedTupleMember: ["label", "elementType"], TSNamespaceExportDeclaration: a2[21], TSNeverKeyword: a2[1], TSNonNullExpression: a2[3], TSNullKeyword: a2[1], TSNumberKeyword: a2[1], TSObjectKeyword: a2[1], TSOptionalType: a2[23], TSParameterProperty: ["parameter", "decorators"], TSParenthesizedType: a2[23], TSPrivateKeyword: a2[1], TSPropertySignature: ["key", "typeAnnotation"], TSProtectedKeyword: a2[1], TSPublicKeyword: a2[1], TSQualifiedName: a2[5], TSReadonlyKeyword: a2[1], TSRestType: a2[23], TSSatisfiesExpression: a2[4], TSStaticKeyword: a2[1], TSStringKeyword: a2[1], TSSymbolKeyword: a2[1], TSTemplateLiteralType: ["quasis", "types"], TSThisType: a2[1], TSTupleType: ["elementTypes"], TSTypeAliasDeclaration: ["id", "typeParameters", "typeAnnotation"], TSTypeAnnotation: a2[23], TSTypeAssertion: a2[4], TSTypeLiteral: a2[26], TSTypeOperator: a2[23], TSTypeParameter: ["name", "constraint", "default"], TSTypeParameterDeclaration: a2[48], TSTypeParameterInstantiation: a2[48], TSTypePredicate: a2[49], TSTypeQuery: ["exprName", "typeArguments"], TSTypeReference: ["typeName", "typeArguments"], TSUndefinedKeyword: a2[1], TSUnionType: a2[36], TSUnknownKeyword: a2[1], TSVoidKeyword: a2[1], TupleTypeAnnotation: ["types", "elementTypes"], TupleTypeLabeledElement: ["label", "elementType", "variance"], TupleTypeSpreadElement: ["label", "typeAnnotation"], TypeAlias: a2[24], TypeAnnotation: a2[23], TypeCastExpression: a2[4], TypeofTypeAnnotation: ["argument", "typeArguments"], TypeOperator: a2[23], TypeParameter: ["bound", "default", "variance"], TypeParameterDeclaration: a2[48], TypeParameterInstantiation: a2[48], TypePredicate: a2[49], UnaryExpression: a2[6], UndefinedTypeAnnotation: a2[1], UnionTypeAnnotation: a2[36], UnknownTypeAnnotation: a2[1], UpdateExpression: a2[6], V8IntrinsicIdentifier: a2[1], VariableDeclaration: ["declarations"], VariableDeclarator: a2[27], Variance: a2[1], VoidPattern: a2[1], VoidTypeAnnotation: a2[1], WhileStatement: a2[25], WithStatement: ["object", "body"], YieldExpression: a2[6] }; + var np = _r(ci), Mr = np; + function sp(e) { + let t2 = new Set(e); + return (r) => t2.has(r == null ? void 0 : r.type); } - function $u(e) { - switch (M(e)) { - case N: - if (e.parts.every((t2) => t2 === "")) return ""; - break; - case B: - if (!e.contents && !e.id && !e.break && !e.expandedStates) return ""; - if (e.contents.type === B && e.contents.id === e.id && e.contents.break === e.break && e.contents.expandedStates === e.expandedStates) return e.contents; - break; - case k: - case T: - case P: - case I: - if (!e.contents) return ""; - break; - case w: - if (!e.flatContents && !e.breakContents) return ""; - break; - case H: { - let t2 = []; - for (let r of e) { - if (!r) continue; - let [n, ...u] = Array.isArray(r) ? r : [r]; - typeof n == "string" && typeof A2(false, t2, -1) == "string" ? t2[t2.length - 1] += n : t2.push(n), t2.push(...u); - } - return t2.length === 0 ? "" : t2.length === 1 ? t2[0] : t2; + var k = sp; + function ip(e) { + var _a3, _b2; + return (_b2 = (_a3 = e.extra) == null ? void 0 : _a3.raw) != null ? _b2 : e.raw; + } + var pe = ip; + var op = k(["Block", "CommentBlock", "MultiLine"]), ce = op; + var up = k(["AnyTypeAnnotation", "ThisTypeAnnotation", "NumberTypeAnnotation", "VoidTypeAnnotation", "BooleanTypeAnnotation", "BigIntTypeAnnotation", "SymbolTypeAnnotation", "StringTypeAnnotation", "NeverTypeAnnotation", "UndefinedTypeAnnotation", "UnknownTypeAnnotation", "EmptyTypeAnnotation", "MixedTypeAnnotation"]), Nr = up; + var ap = k(["Line", "CommentLine", "SingleLine", "HashbangComment", "HTMLOpen", "HTMLClose", "Hashbang", "InterpreterDirective"]), At = ap; + function pp(e, t2) { + let r = t2.split("."); + for (let n = r.length - 1; n >= 0; n--) { + let s = r[n]; + if (n === 0) return e.type === "Identifier" && e.name === s; + if (n === 1 && e.type === "MetaProperty" && e.property.type === "Identifier" && e.property.name === s) { + e = e.meta; + continue; } - case $: - case z: - case L: - case R: - case y: - case O: - case _2: - break; - default: - throw new Q(e); + if (e.type === "MemberExpression" && !e.optional && !e.computed && e.property.type === "Identifier" && e.property.name === s) { + e = e.object; + continue; + } + return false; } - return e; } - function Mu(e) { - return Oe(e, (t2) => $u(t2)); + function cp(e, t2) { + return t2.some((r) => pp(e, r)); } - function Or(e, t2 = Qe) { - return Oe(e, (r) => typeof r == "string" ? Se(t2, r.split(` -`)) : r); + var Pt = cp; + function lp({ type: e }) { + return e.startsWith("TS") && e.endsWith("Keyword"); } - function Vu(e) { - if (e.type === y) return true; + var jr = lp; + function mp({ node: e, parent: t2 }) { + return (e == null ? void 0 : e.type) !== "EmptyStatement" ? false : t2.type === "IfStatement" ? t2.consequent === e || t2.alternate === e : t2.type === "DoWhileStatement" || t2.type === "ForInStatement" || t2.type === "ForOfStatement" || t2.type === "ForStatement" || t2.type === "LabeledStatement" || t2.type === "WithStatement" || t2.type === "WhileStatement" ? t2.body === e : false; } - function Sr(e) { - return qe(e, Vu, false); + var kt = mp; + function Er(e, t2) { + return t2(e) || Zs(e, { getVisitorKeys: Mr, predicate: t2 }); } - function me(e, t2) { - return e.type === O ? { ...e, contents: t2(e.contents) } : t2(e); + function Xt(e) { + return e.type === "AssignmentExpression" || e.type === "BinaryExpression" || e.type === "LogicalExpression" || e.type === "NGPipeExpression" || e.type === "ConditionalExpression" || M(e) || J(e) || e.type === "SequenceExpression" || e.type === "TaggedTemplateExpression" || e.type === "BindExpression" || e.type === "UpdateExpression" && !e.prefix || Ae(e) || e.type === "TSNonNullExpression" || e.type === "ChainExpression"; } - var St = () => { - }, G = St, Tt = St, Tr = St; - function le(e) { - return G(e), { type: T, contents: e }; + function Di(e) { + var _a3, _b2, _c3, _d, _e3, _f; + return e.expressions ? e.expressions[0] : (_f = (_e3 = (_d = (_c3 = (_b2 = (_a3 = e.left) != null ? _a3 : e.test) != null ? _b2 : e.callee) != null ? _c3 : e.object) != null ? _d : e.tag) != null ? _e3 : e.argument) != null ? _f : e.expression; } - function De(e, t2) { - return G(t2), { type: k, contents: t2, n: e }; + function Rr(e) { + if (e.expressions) return ["expressions", 0]; + if (e.left) return ["left"]; + if (e.test) return ["test"]; + if (e.object) return ["object"]; + if (e.callee) return ["callee"]; + if (e.tag) return ["tag"]; + if (e.argument) return ["argument"]; + if (e.expression) return ["expression"]; + throw new Error("Unexpected node has no left side."); } - function kt(e, t2 = {}) { - return G(e), Tt(t2.expandedStates, true), { type: B, id: t2.id, contents: e, break: !!t2.shouldBreak, expandedStates: t2.expandedStates }; + var fi = k(["ExportDefaultDeclaration", "DeclareExportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration", "DeclareExportAllDeclaration"]), q = k(["ArrayExpression"]), se = k(["ObjectExpression"]); + function yi(e) { + return e.type === "LogicalExpression" && e.operator === "??"; } - function kr(e) { - return De(Number.NEGATIVE_INFINITY, e); + function Ce(e) { + return e.type === "NumericLiteral" || e.type === "Literal" && typeof e.value == "number"; } - function Lr(e) { - return De({ type: "root" }, e); + function Ei(e) { + return e.type === "BooleanLiteral" || e.type === "Literal" && typeof e.value == "boolean"; } - function Pr(e) { - return De(-1, e); + function Xn(e) { + return e.type === "UnaryExpression" && (e.operator === "+" || e.operator === "-") && Ce(e.argument); } - function Ir(e, t2) { - return kt(e[0], { ...t2, expandedStates: e }); + function V(e) { + return !!(e && (e.type === "StringLiteral" || e.type === "Literal" && typeof e.value == "string")); } - function Rr(e) { - return Tr(e), { type: N, parts: e }; + function Vn(e) { + return e.type === "RegExpLiteral" || e.type === "Literal" && !!e.regex; } - function Yr(e, t2 = "", r = {}) { - return G(e), t2 !== "" && G(t2), { type: w, breakContents: e, flatContents: t2, groupId: r.groupId }; + var Jr = k(["Literal", "BooleanLiteral", "BigIntLiteral", "DirectiveLiteral", "NullLiteral", "NumericLiteral", "RegExpLiteral", "StringLiteral"]), Dp = k(["Identifier", "ThisExpression", "Super", "PrivateName", "PrivateIdentifier"]), Je = k(["ObjectTypeAnnotation", "TSTypeLiteral", "TSMappedType"]), Ht = k(["FunctionExpression", "ArrowFunctionExpression"]); + function fp(e) { + return e.type === "FunctionExpression" || e.type === "ArrowFunctionExpression" && e.body.type === "BlockStatement"; } - function jr(e, t2) { - return G(e), { type: P, contents: e, groupId: t2.groupId, negate: t2.negate }; + function qn(e) { + return M(e) && e.callee.type === "Identifier" && ["async", "inject", "fakeAsync", "waitForAsync"].includes(e.callee.name); } - function Te(e) { - return G(e), { type: I, contents: e }; + var H = k(["JSXElement", "JSXFragment"]); + function mt(e) { + return e.method && e.kind === "init" || e.kind === "get" || e.kind === "set"; } - var Hr = { type: R }, he = { type: _2 }, Wr = { type: L }, ke = { type: y, hard: true }, Lt = { type: y, hard: true, literal: true }, Ze = { type: y }, $r = { type: y, soft: true }, K = [ke, he], Qe = [Lt, he], Z = { type: z }; - function Se(e, t2) { - G(e), Tt(t2); - let r = []; - for (let n = 0; n < t2.length; n++) n !== 0 && r.push(e), r.push(t2[n]); - return r; + function Gr(e) { + return (e.type === "ObjectTypeProperty" || e.type === "ObjectTypeInternalSlot") && !e.static && !e.method && e.kind !== "get" && e.kind !== "set" && e.value.type === "FunctionTypeAnnotation"; } - function et(e, t2, r) { - G(e); - let n = e; - if (t2 > 0) { - for (let u = 0; u < Math.floor(t2 / r); ++u) n = le(n); - n = De(t2 % r, n), n = De(Number.NEGATIVE_INFINITY, n); - } - return n; + function Fi(e) { + return (e.type === "TypeAnnotation" || e.type === "TSTypeAnnotation") && e.typeAnnotation.type === "FunctionTypeAnnotation" && !e.static && !bt(e, e.typeAnnotation); } - function Mr(e, t2) { - return G(t2), e ? { type: O, label: e, contents: t2 } : t2; + var Te = k(["BinaryExpression", "LogicalExpression", "NGPipeExpression"]); + function Tt(e) { + return J(e) || e.type === "BindExpression" && !!e.object; } - function ee(e) { - var t2; - if (!e) return ""; - if (Array.isArray(e)) { - let r = []; - for (let n of e) if (Array.isArray(n)) r.push(...ee(n)); - else { - let u = ee(n); - u !== "" && r.push(u); - } - return r; - } - return e.type === w ? { ...e, breakContents: ee(e.breakContents), flatContents: ee(e.flatContents) } : e.type === B ? { ...e, contents: ee(e.contents), expandedStates: (t2 = e.expandedStates) == null ? void 0 : t2.map(ee) } : e.type === N ? { type: "fill", parts: e.parts.map(ee) } : e.contents ? { ...e, contents: ee(e.contents) } : e; - } - function Vr(e) { - let t2 = /* @__PURE__ */ Object.create(null), r = /* @__PURE__ */ new Set(); - return n(ee(e)); - function n(i, o, s) { - var a2, D; - if (typeof i == "string") return JSON.stringify(i); - if (Array.isArray(i)) { - let l = i.map(n).filter(Boolean); - return l.length === 1 ? l[0] : `[${l.join(", ")}]`; - } - if (i.type === y) { - let l = ((a2 = s == null ? void 0 : s[o + 1]) == null ? void 0 : a2.type) === _2; - return i.literal ? l ? "literalline" : "literallineWithoutBreakParent" : i.hard ? l ? "hardline" : "hardlineWithoutBreakParent" : i.soft ? "softline" : "line"; - } - if (i.type === _2) return ((D = s == null ? void 0 : s[o - 1]) == null ? void 0 : D.type) === y && s[o - 1].hard ? void 0 : "breakParent"; - if (i.type === L) return "trim"; - if (i.type === T) return "indent(" + n(i.contents) + ")"; - if (i.type === k) return i.n === Number.NEGATIVE_INFINITY ? "dedentToRoot(" + n(i.contents) + ")" : i.n < 0 ? "dedent(" + n(i.contents) + ")" : i.n.type === "root" ? "markAsRoot(" + n(i.contents) + ")" : "align(" + JSON.stringify(i.n) + ", " + n(i.contents) + ")"; - if (i.type === w) return "ifBreak(" + n(i.breakContents) + (i.flatContents ? ", " + n(i.flatContents) : "") + (i.groupId ? (i.flatContents ? "" : ', ""') + `, { groupId: ${u(i.groupId)} }` : "") + ")"; - if (i.type === P) { - let l = []; - i.negate && l.push("negate: true"), i.groupId && l.push(`groupId: ${u(i.groupId)}`); - let p = l.length > 0 ? `, { ${l.join(", ")} }` : ""; - return `indentIfBreak(${n(i.contents)}${p})`; - } - if (i.type === B) { - let l = []; - i.break && i.break !== "propagated" && l.push("shouldBreak: true"), i.id && l.push(`id: ${u(i.id)}`); - let p = l.length > 0 ? `, { ${l.join(", ")} }` : ""; - return i.expandedStates ? `conditionalGroup([${i.expandedStates.map((f2) => n(f2)).join(",")}]${p})` : `group(${n(i.contents)}${p})`; - } - if (i.type === N) return `fill([${i.parts.map((l) => n(l)).join(", ")}])`; - if (i.type === I) return "lineSuffix(" + n(i.contents) + ")"; - if (i.type === R) return "lineSuffixBoundary"; - if (i.type === O) return `label(${JSON.stringify(i.label)}, ${n(i.contents)})`; - throw new Error("Unknown doc type " + i.type); - } - function u(i) { - if (typeof i != "symbol") return JSON.stringify(String(i)); - if (i in t2) return t2[i]; - let o = i.description || "symbol"; - for (let s = 0; ; s++) { - let a2 = o + (s > 0 ? ` #${s}` : ""); - if (!r.has(a2)) return r.add(a2), t2[i] = `Symbol.for(${JSON.stringify(a2)})`; - } - } + var yp = k(["TSThisType", "NullLiteralTypeAnnotation", "BooleanLiteralTypeAnnotation", "StringLiteralTypeAnnotation", "BigIntLiteralTypeAnnotation", "NumberLiteralTypeAnnotation", "TSLiteralType", "TSTemplateLiteralType"]); + function Vt(e) { + return jr(e) || Nr(e) || yp(e) || e.type === "GenericTypeAnnotation" && !e.typeParameters || e.type === "TSTypeReference" && !e.typeArguments; } - var Ur = () => /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g; - function zr(e) { - return e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510; + function Ep(e) { + return e.type === "Identifier" && (e.name === "beforeEach" || e.name === "beforeAll" || e.name === "afterEach" || e.name === "afterAll"); } - function Gr(e) { - return e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9776 && e <= 9783 || e >= 9800 && e <= 9811 || e === 9855 || e >= 9866 && e <= 9871 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12773 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101631 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e >= 119552 && e <= 119638 || e >= 119648 && e <= 119670 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129673 || e >= 129679 && e <= 129734 || e >= 129742 && e <= 129756 || e >= 129759 && e <= 129769 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141; + var Fp = ["it", "it.only", "it.skip", "describe", "describe.only", "describe.skip", "test", "test.only", "test.skip", "test.fixme", "test.step", "test.describe", "test.describe.only", "test.describe.skip", "test.describe.fixme", "test.describe.parallel", "test.describe.parallel.only", "test.describe.serial", "test.describe.serial.only", "skip", "xit", "xdescribe", "xtest", "fit", "fdescribe", "ftest"]; + function dp(e) { + return Pt(e, Fp); } - var Kr = (e) => !(zr(e) || Gr(e)); - var Uu = /[^\x20-\x7F]/u; - function zu(e) { - if (!e) return 0; - if (!Uu.test(e)) return e.length; - e = e.replace(Ur(), " "); - let t2 = 0; - for (let r of e) { - let n = r.codePointAt(0); - n <= 31 || n >= 127 && n <= 159 || n >= 768 && n <= 879 || (t2 += Kr(n) ? 1 : 2); + function It(e, t2) { + if ((e == null ? void 0 : e.type) !== "CallExpression" || e.optional) return false; + let r = le(e); + if (r.length === 1) { + if (qn(e) && It(t2)) return Ht(r[0]); + if (Ep(e.callee)) return qn(r[0]); + } else if ((r.length === 2 || r.length === 3) && (r[0].type === "TemplateLiteral" || V(r[0])) && dp(e.callee)) return r[2] && !Ce(r[2]) ? false : (r.length === 2 ? Ht(r[1]) : fp(r[1]) && K(r[1]).length <= 1) || qn(r[1]); + return false; + } + var di = (e) => (t2) => ((t2 == null ? void 0 : t2.type) === "ChainExpression" && (t2 = t2.expression), e(t2)), M = di(k(["CallExpression", "OptionalCallExpression"])), J = di(k(["MemberExpression", "OptionalMemberExpression"])); + function $n(e, t2 = 5) { + return Ci(e, t2) <= t2; + } + function Ci(e, t2) { + let r = 0; + for (let n in e) { + let s = e[n]; + if (Lr(s) && typeof s.type == "string" && (r++, r += Ci(s, t2 - r)), r > t2) return r; } - return t2; + return r; } - var Le = zu; - var Y = /* @__PURE__ */ Symbol("MODE_BREAK"), J = /* @__PURE__ */ Symbol("MODE_FLAT"), Ee = /* @__PURE__ */ Symbol("cursor"), Pt = /* @__PURE__ */ Symbol("DOC_FILL_PRINTED_LENGTH"); - function Jr() { - return { value: "", length: 0, queue: [] }; + var Cp = 0.25; + function Fr(e, t2) { + let { printWidth: r } = t2; + if (T(e)) return false; + let n = r * Cp; + if (e.type === "ThisExpression" || e.type === "Identifier" && e.name.length <= n || Xn(e) && !T(e.argument)) return true; + let s = e.type === "Literal" && "regex" in e && e.regex.pattern || e.type === "RegExpLiteral" && e.pattern; + return s ? s.length <= n : V(e) ? ut(pe(e), t2).length <= n : e.type === "TemplateLiteral" ? e.expressions.length === 0 && e.quasis[0].value.raw.length <= n && !e.quasis[0].value.raw.includes(` +`) : e.type === "UnaryExpression" ? Fr(e.argument, { printWidth: r }) : e.type === "CallExpression" && e.arguments.length === 0 && e.callee.type === "Identifier" ? e.callee.name.length <= n - 2 : Jr(e); } - function Gu(e, t2) { - return It(e, { type: "indent" }, t2); + function Ee(e, t2) { + return H(t2) ? Ot(t2) : T(t2, x.Leading, (r) => Z(e, I(r))); } - function Ku(e, t2, r) { - return t2 === Number.NEGATIVE_INFINITY ? e.root || Jr() : t2 < 0 ? It(e, { type: "dedent" }, r) : t2 ? t2.type === "root" ? { ...e, root: e } : It(e, { type: typeof t2 == "string" ? "stringAlign" : "numberAlign", n: t2 }, r) : e; + function li(e) { + return e.quasis.some((t2) => t2.value.raw.includes(` +`)); } - function It(e, t2, r) { - let n = t2.type === "dedent" ? e.queue.slice(0, -1) : [...e.queue, t2], u = "", i = 0, o = 0, s = 0; - for (let c of n) switch (c.type) { - case "indent": - l(), r.useTabs ? a2(1) : D(r.tabWidth); - break; - case "stringAlign": - l(), u += c.n, i += c.n.length; - break; - case "numberAlign": - o += 1, s += c.n; - break; - default: - throw new Error(`Unexpected type '${c.type}'`); - } - return f2(), { ...e, value: u, length: i, queue: n }; - function a2(c) { - u += " ".repeat(c), i += r.tabWidth * c; - } - function D(c) { - u += " ".repeat(c), i += c; - } - function l() { - r.useTabs ? p() : f2(); - } - function p() { - o > 0 && a2(o), d(); - } - function f2() { - s > 0 && D(s), d(); - } - function d() { - o = 0, s = 0; - } + function Wr(e, t2) { + return (e.type === "TemplateLiteral" && li(e) || e.type === "TaggedTemplateExpression" && li(e.quasi)) && !Z(t2, w(e), { backwards: true }); } - function Rt(e) { - let t2 = 0, r = 0, n = e.length; - e: for (; n--; ) { - let u = e[n]; - if (u === Ee) { - r++; - continue; - } - for (let i = u.length - 1; i >= 0; i--) { - let o = u[i]; - if (o === " " || o === " ") t2++; - else { - e[n] = u.slice(0, i + 1); - break e; - } - } - } - if (t2 > 0 || r > 0) for (e.length = n + 1; r-- > 0; ) e.push(Ee); - return t2; + function qr(e) { + if (!T(e)) return false; + let t2 = N(0, et(e, x.Dangling), -1); + return t2 && !ce(t2); } - function tt(e, t2, r, n, u, i) { - var _a; - if (r === Number.POSITIVE_INFINITY) return true; - let o = t2.length, s = [e], a2 = []; - for (; r >= 0; ) { - if (s.length === 0) { - if (o === 0) return true; - s.push(t2[--o]); - continue; - } - let { mode: D, doc: l } = s.pop(), p = M(l); - switch (p) { - case $: - a2.push(l), r -= Le(l); - break; - case H: - case N: { - let f2 = p === H ? l : l.parts, d = (_a = l[Pt]) != null ? _a : 0; - for (let c = f2.length - 1; c >= d; c--) s.push({ mode: D, doc: f2[c] }); - break; - } - case T: - case k: - case P: - case O: - s.push({ mode: D, doc: l.contents }); - break; - case L: - r += Rt(a2); - break; - case B: { - if (i && l.break) return false; - let f2 = l.break ? Y : D, d = l.expandedStates && f2 === Y ? A2(false, l.expandedStates, -1) : l.contents; - s.push({ mode: f2, doc: d }); - break; - } - case w: { - let d = (l.groupId ? u[l.groupId] || J : D) === Y ? l.breakContents : l.flatContents; - d && s.push({ mode: D, doc: d }); - break; - } - case y: - if (D === Y || l.hard) return true; - l.soft || (a2.push(" "), r--); - break; - case I: - n = true; - break; - case R: - if (n) return false; - break; - } + function Ai(e) { + if (e.length <= 1) return false; + let t2 = 0; + for (let r of e) if (Ht(r)) { + if (t2 += 1, t2 > 1) return true; + } else if (M(r)) { + for (let n of le(r)) if (Ht(n)) return true; } return false; } - function Ce(e, t2) { - var _a; - let r = {}, n = t2.printWidth, u = be(t2.endOfLine), i = 0, o = [{ ind: Jr(), mode: Y, doc: e }], s = [], a2 = false, D = [], l = 0; - for (br(e); o.length > 0; ) { - let { ind: f2, mode: d, doc: c } = o.pop(); - switch (M(c)) { - case $: { - let F = u !== ` -` ? ne(false, c, ` -`, u) : c; - s.push(F), o.length > 0 && (i += Le(F)); - break; - } - case H: - for (let F = c.length - 1; F >= 0; F--) o.push({ ind: f2, mode: d, doc: c[F] }); - break; - case z: - if (l >= 2) throw new Error("There are too many 'cursor' in doc."); - s.push(Ee), l++; - break; - case T: - o.push({ ind: Gu(f2, t2), mode: d, doc: c.contents }); - break; - case k: - o.push({ ind: Ku(f2, c.n, t2), mode: d, doc: c.contents }); - break; - case L: - i -= Rt(s); - break; - case B: - switch (d) { - case J: - if (!a2) { - o.push({ ind: f2, mode: c.break ? Y : J, doc: c.contents }); - break; - } - case Y: { - a2 = false; - let F = { ind: f2, mode: J, doc: c.contents }, m = n - i, h = D.length > 0; - if (!c.break && tt(F, o, m, h, r)) o.push(F); - else if (c.expandedStates) { - let C = A2(false, c.expandedStates, -1); - if (c.break) { - o.push({ ind: f2, mode: Y, doc: C }); - break; - } else for (let v = 1; v < c.expandedStates.length + 1; v++) if (v >= c.expandedStates.length) { - o.push({ ind: f2, mode: Y, doc: C }); - break; - } else { - let E = c.expandedStates[v], g = { ind: f2, mode: J, doc: E }; - if (tt(g, o, m, h, r)) { - o.push(g); - break; - } - } - } else o.push({ ind: f2, mode: Y, doc: c.contents }); - break; - } - } - c.id && (r[c.id] = A2(false, o, -1).mode); - break; - case N: { - let F = n - i, m = (_a = c[Pt]) != null ? _a : 0, { parts: h } = c, C = h.length - m; - if (C === 0) break; - let v = h[m + 0], E = h[m + 1], g = { ind: f2, mode: J, doc: v }, j = { ind: f2, mode: Y, doc: v }, b = tt(g, [], F, D.length > 0, r, true); - if (C === 1) { - b ? o.push(g) : o.push(j); - break; - } - let X = { ind: f2, mode: J, doc: E }, ae = { ind: f2, mode: Y, doc: E }; - if (C === 2) { - b ? o.push(X, g) : o.push(ae, j); - break; - } - let $e = h[m + 2], At = { ind: f2, mode: d, doc: { ...c, [Pt]: m + 2 } }; - tt({ ind: f2, mode: J, doc: [v, E, $e] }, [], F, D.length > 0, r, true) ? o.push(At, X, g) : b ? o.push(At, ae, g) : o.push(At, ae, j); - break; - } - case w: - case P: { - let F = c.groupId ? r[c.groupId] : d; - if (F === Y) { - let m = c.type === w ? c.breakContents : c.negate ? c.contents : le(c.contents); - m && o.push({ ind: f2, mode: d, doc: m }); - } - if (F === J) { - let m = c.type === w ? c.flatContents : c.negate ? le(c.contents) : c.contents; - m && o.push({ ind: f2, mode: d, doc: m }); - } - break; - } - case I: - D.push({ ind: f2, mode: d, doc: c.contents }); - break; - case R: - D.length > 0 && o.push({ ind: f2, mode: d, doc: ke }); - break; - case y: - switch (d) { - case J: - if (c.hard) a2 = true; - else { - c.soft || (s.push(" "), i += 1); - break; - } - case Y: - if (D.length > 0) { - o.push({ ind: f2, mode: d, doc: c }, ...D.reverse()), D.length = 0; - break; - } - c.literal ? f2.root ? (s.push(u, f2.root.value), i = f2.root.length) : (s.push(u), i = 0) : (i -= Rt(s), s.push(u + f2.value), i = f2.length); - break; - } - break; - case O: - o.push({ ind: f2, mode: d, doc: c.contents }); - break; - case _2: - break; - default: - throw new Q(c); - } - o.length === 0 && D.length > 0 && (o.push(...D.reverse()), D.length = 0); - } - let p = s.indexOf(Ee); - if (p !== -1) { - let f2 = s.indexOf(Ee, p + 1); - if (f2 === -1) return { formatted: s.filter((m) => m !== Ee).join("") }; - let d = s.slice(0, p).join(""), c = s.slice(p + 1, f2).join(""), F = s.slice(f2 + 1).join(""); - return { formatted: d + c + F, cursorNodeStart: d.length, cursorNodeText: c }; - } - return { formatted: s.join("") }; - } - function Ju(e, t2, r = 0) { - let n = 0; - for (let u = r; u < e.length; ++u) e[u] === " " ? n = n + t2 - n % t2 : n++; - return n; + function Ur(e) { + let { node: t2, parent: r, key: n } = e; + return n === "callee" && M(t2) && M(r) && r.arguments.length > 0 && t2.arguments.length > r.arguments.length; } - var ge = Ju; - var te, jt, rt, Yt = class { - constructor(t2) { - Fr(this, te); - this.stack = [t2]; - } - get key() { - var _a; - let { stack: t2, siblings: r } = this; - return (_a = A2(false, t2, r === null ? -2 : -4)) != null ? _a : null; - } - get index() { - return this.siblings === null ? null : A2(false, this.stack, -2); - } - get node() { - return A2(false, this.stack, -1); - } - get parent() { - return this.getNode(1); - } - get grandparent() { - return this.getNode(2); - } - get isInArray() { - return this.siblings !== null; - } - get siblings() { - let { stack: t2 } = this, r = A2(false, t2, -3); - return Array.isArray(r) ? r : null; - } - get next() { - let { siblings: t2 } = this; - return t2 === null ? null : t2[this.index + 1]; - } - get previous() { - let { siblings: t2 } = this; - return t2 === null ? null : t2[this.index - 1]; - } - get isFirst() { - return this.index === 0; - } - get isLast() { - let { siblings: t2, index: r } = this; - return t2 !== null && r === t2.length - 1; - } - get isRoot() { - return this.stack.length === 1; - } - get root() { - return this.stack[0]; - } - get ancestors() { - return [...pe(this, te, rt).call(this)]; - } - getName() { - let { stack: t2 } = this, { length: r } = t2; - return r > 1 ? A2(false, t2, -2) : null; - } - getValue() { - return A2(false, this.stack, -1); - } - getNode(t2 = 0) { - let r = pe(this, te, jt).call(this, t2); - return r === -1 ? null : this.stack[r]; - } - getParentNode(t2 = 0) { - return this.getNode(t2 + 1); - } - call(t2, ...r) { - let { stack: n } = this, { length: u } = n, i = A2(false, n, -1); - for (let o of r) i = i[o], n.push(o, i); - try { - return t2(this); - } finally { - n.length = u; - } - } - callParent(t2, r = 0) { - let n = pe(this, te, jt).call(this, r + 1), u = this.stack.splice(n + 1); - try { - return t2(this); - } finally { - this.stack.push(...u); - } - } - each(t2, ...r) { - let { stack: n } = this, { length: u } = n, i = A2(false, n, -1); - for (let o of r) i = i[o], n.push(o, i); - try { - for (let o = 0; o < i.length; ++o) n.push(o, i[o]), t2(this, o, i), n.length -= 2; - } finally { - n.length = u; - } - } - map(t2, ...r) { - let n = []; - return this.each((u, i, o) => { - n[i] = t2(u, i, o); - }, ...r), n; - } - match(...t2) { - let r = this.stack.length - 1, n = null, u = this.stack[r--]; - for (let i of t2) { - if (u === void 0) return false; - let o = null; - if (typeof n == "number" && (o = n, n = this.stack[r--], u = this.stack[r--]), i && !i(u, n, o)) return false; - n = this.stack[r--], u = this.stack[r--]; + var Ap = /* @__PURE__ */ new Set(["!", "-", "+", "~"]); + function Re(e, t2 = 2) { + var _a3; + if (t2 <= 0) return false; + if (e.type === "ChainExpression" || e.type === "TSNonNullExpression") return Re(e.expression, t2); + let r = (n) => Re(n, t2 - 1); + if (Vn(e)) return ot((_a3 = e.pattern) != null ? _a3 : e.regex.pattern) <= 5; + if (Jr(e) || Dp(e) || e.type === "ArgumentPlaceholder") return true; + if (e.type === "TemplateLiteral") return e.quasis.every((n) => !n.value.raw.includes(` +`)) && e.expressions.every(r); + if (se(e)) return e.properties.every((n) => !n.computed && (n.shorthand || n.value && r(n.value))); + if (q(e)) return e.elements.every((n) => n === null || r(n)); + if (Dt(e)) { + if (e.type === "ImportExpression" || Re(e.callee, t2)) { + let n = le(e); + return n.length <= t2 && n.every(r); } - return true; - } - findAncestor(t2) { - for (let r of pe(this, te, rt).call(this)) if (t2(r)) return r; - } - hasAncestor(t2) { - for (let r of pe(this, te, rt).call(this)) if (t2(r)) return true; return false; } - }; - te = /* @__PURE__ */ new WeakSet(), jt = function(t2) { - let { stack: r } = this; - for (let n = r.length - 1; n >= 0; n -= 2) if (!Array.isArray(r[n]) && --t2 < 0) return n; - return -1; - }, rt = function* () { - let { stack: t2 } = this; - for (let r = t2.length - 3; r >= 0; r -= 2) { - let n = t2[r]; - Array.isArray(n) || (yield n); - } - }; - var qr = Yt; - var Xr = new Proxy(() => { - }, { get: () => Xr }), Pe = Xr; - function qu(e) { - return e !== null && typeof e == "object"; + return J(e) ? Re(e.object, t2) && Re(e.property, t2) : e.type === "UnaryExpression" && Ap.has(e.operator) || e.type === "UpdateExpression" ? Re(e.argument, t2) : false; } - var Qr = qu; - function* ye(e, t2) { - let { getVisitorKeys: r, filter: n = () => true } = t2, u = (i) => Qr(i) && n(i); - for (let i of r(e)) { - let o = e[i]; - if (Array.isArray(o)) for (let s of o) u(s) && (yield s); - else u(o) && (yield o); - } + function ie(e, t2 = "es5") { + return e.trailingComma === "es5" && t2 === "es5" || e.trailingComma === "all" && (t2 === "all" || t2 === "es5"); } - function* Zr(e, t2) { - let r = [e]; - for (let n = 0; n < r.length; n++) { - let u = r[n]; - for (let i of ye(u, t2)) yield i, r.push(i); + function ye(e, t2) { + switch (e.type) { + case "BinaryExpression": + case "LogicalExpression": + case "AssignmentExpression": + case "NGPipeExpression": + return ye(e.left, t2); + case "MemberExpression": + case "OptionalMemberExpression": + return ye(e.object, t2); + case "TaggedTemplateExpression": + return e.tag.type === "FunctionExpression" ? false : ye(e.tag, t2); + case "CallExpression": + case "OptionalCallExpression": + return e.callee.type === "FunctionExpression" ? false : ye(e.callee, t2); + case "ConditionalExpression": + return ye(e.test, t2); + case "UpdateExpression": + return !e.prefix && ye(e.argument, t2); + case "BindExpression": + return e.object && ye(e.object, t2); + case "SequenceExpression": + return ye(e.expressions[0], t2); + case "ChainExpression": + case "TSSatisfiesExpression": + case "TSAsExpression": + case "TSNonNullExpression": + case "AsExpression": + case "AsConstExpression": + case "SatisfiesExpression": + return ye(e.expression, t2); + default: + return t2(e); } } - function en(e, t2) { - return ye(e, t2).next().done; + var mi = { "==": true, "!=": true, "===": true, "!==": true }, vr = { "*": true, "/": true, "%": true }, Hn = { ">>": true, ">>>": true, "<<": true }; + function dr(e, t2) { + return !(yr(t2) !== yr(e) || e === "**" || mi[e] && mi[t2] || t2 === "%" && vr[e] || e === "%" && vr[t2] || t2 !== e && vr[t2] && vr[e] || Hn[e] && Hn[t2]); } - function Ae(e) { - return (t2, r, n) => { - let u = !!(n != null && n.backwards); - if (r === false) return false; - let { length: i } = t2, o = r; - for (; o >= 0 && o < i; ) { - let s = t2.charAt(o); - if (e instanceof RegExp) { - if (!e.test(s)) return o; - } else if (!e.includes(s)) return o; - u ? o-- : o++; - } - return o === -1 || o === i ? o : false; - }; + var Tp = new Map([["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].flatMap((e, t2) => e.map((r) => [r, t2]))); + function yr(e) { + return Tp.get(e); } - var tn = Ae(/\s/u), S = Ae(" "), nt = Ae(",; "), ut = Ae(/[^\n\r]/u); - function Xu(e, t2, r) { - let n = !!(r != null && r.backwards); - if (t2 === false) return false; - let u = e.charAt(t2); - if (n) { - if (e.charAt(t2 - 1) === "\r" && u === ` -`) return t2 - 2; - if (u === ` -` || u === "\r" || u === "\u2028" || u === "\u2029") return t2 - 1; - } else { - if (u === "\r" && e.charAt(t2 + 1) === ` -`) return t2 + 2; - if (u === ` -` || u === "\r" || u === "\u2028" || u === "\u2029") return t2 + 1; - } - return t2; + function Ti(e) { + return !!Hn[e] || e === "|" || e === "^" || e === "&"; } - var W = Xu; - function Qu(e, t2, r = {}) { - let n = S(e, r.backwards ? t2 - 1 : t2, r), u = W(e, n, r); - return n !== u; + function xi(e) { + var _a3; + if (e.rest) return true; + let t2 = K(e); + return ((_a3 = N(0, t2, -1)) == null ? void 0 : _a3.type) === "RestElement"; } - var V = Qu; - function Zu(e) { - return Array.isArray(e) && e.length > 0; + var Un = /* @__PURE__ */ new WeakMap(); + function K(e) { + if (Un.has(e)) return Un.get(e); + let t2 = []; + return e.this && t2.push(e.this), t2.push(...e.params), e.rest && t2.push(e.rest), Un.set(e, t2), t2; } - var Ht = Zu; - var rn = /* @__PURE__ */ new Set(["tokens", "comments", "parent", "enclosingNode", "precedingNode", "followingNode"]), ei = (e) => Object.keys(e).filter((t2) => !rn.has(t2)); - function ti(e) { - return e ? (t2) => e(t2, rn) : ei; + function gi(e, t2) { + let { node: r } = e, n = 0, s = () => t2(e, n++); + r.this && e.call(s, "this"), e.each(s, "params"), r.rest && e.call(s, "rest"); } - var q = ti; - function ri(e) { - let t2 = e.type || e.kind || "(unknown type)", r = String(e.name || e.id && (typeof e.id == "object" ? e.id.name : e.id) || e.key && (typeof e.key == "object" ? e.key.name : e.key) || e.value && (typeof e.value == "object" ? "" : String(e.value)) || e.operator || ""); - return r.length > 20 && (r = r.slice(0, 19) + "\u2026"), t2 + (r ? " " + r : ""); + var Yn = /* @__PURE__ */ new WeakMap(); + function le(e) { + if (Yn.has(e)) return Yn.get(e); + if (e.type === "ChainExpression") return le(e.expression); + let t2; + return e.type === "ImportExpression" || e.type === "TSImportType" ? (t2 = [e.source], e.options && t2.push(e.options)) : e.type === "TSExternalModuleReference" ? t2 = [e.expression] : t2 = e.arguments, Yn.set(e, t2), t2; } - function Wt(e, t2) { - var _a; - ((_a = e.comments) != null ? _a : e.comments = []).push(t2), t2.printed = false, t2.nodeDescription = ri(e); + function $t(e, t2) { + let { node: r } = e; + if (r.type === "ChainExpression") return e.call(() => $t(e, t2), "expression"); + r.type === "ImportExpression" || r.type === "TSImportType" ? (e.call(() => t2(e, 0), "source"), r.options && e.call(() => t2(e, 1), "options")) : r.type === "TSExternalModuleReference" ? e.call(() => t2(e, 0), "expression") : e.each(t2, "arguments"); } - function ue(e, t2) { - t2.leading = true, t2.trailing = false, Wt(e, t2); + function Kn(e, t2) { + let r = []; + if (e.type === "ChainExpression" && (e = e.expression, r.push("expression")), e.type === "ImportExpression" || e.type === "TSImportType") { + if (t2 === 0 || t2 === (e.options ? -2 : -1)) return [...r, "source"]; + if (e.options && (t2 === 1 || t2 === -1)) return [...r, "options"]; + throw new RangeError("Invalid argument index"); + } else if (e.type === "TSExternalModuleReference") { + if (t2 === 0 || t2 === -1) return [...r, "expression"]; + } else if (t2 < 0 && (t2 = e.arguments.length + t2), t2 >= 0 && t2 < e.arguments.length) return [...r, "arguments", t2]; + throw new RangeError("Invalid argument index"); } - function re(e, t2, r) { - t2.leading = false, t2.trailing = false, r && (t2.marker = r), Wt(e, t2); + function Lt(e) { + return e.value.trim() === "prettier-ignore" && !e.unignore; } - function ie(e, t2) { - t2.leading = false, t2.trailing = true, Wt(e, t2); + function Ot(e) { + return (e == null ? void 0 : e.prettierIgnore) || T(e, x.PrettierIgnore); } - var $t = /* @__PURE__ */ new WeakMap(); - function it(e, t2) { - var _a; - if ($t.has(e)) return $t.get(e); - let { printer: { getCommentChildNodes: r, canAttachComment: n, getVisitorKeys: u }, locStart: i, locEnd: o } = t2; - if (!n) return []; - let s = ((_a = r == null ? void 0 : r(e, t2)) != null ? _a : [...ye(e, { getVisitorKeys: q(u) })]).flatMap((a2) => n(a2) ? [a2] : it(a2, t2)); - return s.sort((a2, D) => i(a2) - i(D) || o(a2) - o(D)), $t.set(e, s), s; - } - function un(e, t2, r, n) { - let { locStart: u, locEnd: i } = r, o = u(t2), s = i(t2), a2 = it(e, r), D, l, p = 0, f2 = a2.length; - for (; p < f2; ) { - let d = p + f2 >> 1, c = a2[d], F = u(c), m = i(c); - if (F <= o && s <= m) return un(c, t2, r, c); - if (m <= o) { - D = c, p = d + 1; - continue; - } - if (s <= F) { - l = c, f2 = d; - continue; - } - throw new Error("Comment location overlaps with node location"); + var x = { Leading: 2, Trailing: 4, Dangling: 8, Block: 16, Line: 32, PrettierIgnore: 64, First: 128, Last: 256 }, hi = (e, t2) => { + if (typeof e == "function" && (t2 = e, e = 0), e || t2) return (r, n, s) => !(e & x.Leading && !r.leading || e & x.Trailing && !r.trailing || e & x.Dangling && (r.leading || r.trailing) || e & x.Block && !ce(r) || e & x.Line && !At(r) || e & x.First && n !== 0 || e & x.Last && n !== s.length - 1 || e & x.PrettierIgnore && !Lt(r) || t2 && !t2(r)); + }; + function T(e, t2, r) { + if (!R(e == null ? void 0 : e.comments)) return false; + let n = hi(t2, r); + return n ? e.comments.some(n) : true; + } + function et(e, t2, r) { + if (!Array.isArray(e == null ? void 0 : e.comments)) return []; + let n = hi(t2, r); + return n ? e.comments.filter(n) : e.comments; + } + var oe = (e, { originalText: t2 }) => Yt(t2, I(e)); + function Dt(e) { + return M(e) || e.type === "NewExpression" || e.type === "ImportExpression"; + } + function Oe(e) { + return e && (e.type === "ObjectProperty" || e.type === "Property" && !mt(e)); + } + var Ae = k(["TSAsExpression", "TSSatisfiesExpression", "AsExpression", "AsConstExpression", "SatisfiesExpression"]), Se = k(["TSUnionType", "UnionTypeAnnotation"]), xt = k(["TSIntersectionType", "IntersectionTypeAnnotation"]), Ue = k(["TSConditionalType", "ConditionalTypeAnnotation"]), Si = (e) => (e == null ? void 0 : e.type) === "TSAsExpression" && e.typeAnnotation.type === "TSTypeReference" && e.typeAnnotation.typeName.type === "Identifier" && e.typeAnnotation.typeName.name === "const", Cr = k(["TSTypeAliasDeclaration", "TypeAlias"]); + function Yr({ key: e, parent: t2 }) { + return !(e === "types" && Se(t2) || e === "types" && xt(t2)); + } + var xp = /* @__PURE__ */ new Set(["range", "raw", "comments", "leadingComments", "trailingComments", "innerComments", "extra", "start", "end", "loc", "flags", "errors", "tokens"]), Kt = (e) => { + for (let t2 of e.quasis) delete t2.value; + }; + function Bi(e, t2, r) { + var _a3; + if (e.type === "Program" && delete t2.sourceType, (e.type === "BigIntLiteral" || e.type === "Literal") && e.bigint && (t2.bigint = e.bigint.toLowerCase()), e.type === "EmptyStatement" && !kt({ node: e, parent: r }) || e.type === "JSXText" || e.type === "JSXExpressionContainer" && (e.expression.type === "Literal" || e.expression.type === "StringLiteral") && e.expression.value === " ") return null; + if ((e.type === "Property" || e.type === "ObjectProperty" || e.type === "MethodDefinition" || e.type === "ClassProperty" || e.type === "ClassMethod" || e.type === "PropertyDefinition" || e.type === "TSDeclareMethod" || e.type === "TSPropertySignature" || e.type === "ObjectTypeProperty" || e.type === "ImportAttribute") && e.key && !e.computed) { + let { key: s } = e; + V(s) || Ce(s) ? t2.key = String(s.value) : s.type === "Identifier" && (t2.key = s.name); } - if ((n == null ? void 0 : n.type) === "TemplateLiteral") { - let { quasis: d } = n, c = Vt(d, t2, r); - D && Vt(d, D, r) !== c && (D = null), l && Vt(d, l, r) !== c && (l = null); - } - return { enclosingNode: n, precedingNode: D, followingNode: l }; - } - var Mt = () => false; - function on(e, t2) { - let { comments: r } = e; - if (delete e.comments, !Ht(r) || !t2.printer.canAttachComment) return; - let n = [], { locStart: u, locEnd: i, printer: { experimentalFeatures: { avoidAstMutation: o = false } = {}, handleComments: s = {} }, originalText: a2 } = t2, { ownLine: D = Mt, endOfLine: l = Mt, remaining: p = Mt } = s, f2 = r.map((d, c) => ({ ...un(e, d, t2), comment: d, text: a2, options: t2, ast: e, isLastComment: r.length - 1 === c })); - for (let [d, c] of f2.entries()) { - let { comment: F, precedingNode: m, enclosingNode: h, followingNode: C, text: v, options: E, ast: g, isLastComment: j } = c; - if (E.parser === "json" || E.parser === "json5" || E.parser === "jsonc" || E.parser === "__js_expression" || E.parser === "__ts_expression" || E.parser === "__vue_expression" || E.parser === "__vue_ts_expression") { - if (u(F) - u(g) <= 0) { - ue(g, F); - continue; - } - if (i(F) - i(g) >= 0) { - ie(g, F); - continue; - } + if (e.type === "JSXElement" && e.openingElement.name.name === "style" && e.openingElement.attributes.some((s) => s.type === "JSXAttribute" && s.name.name === "jsx")) for (let { type: s, expression: i } of t2.children) s === "JSXExpressionContainer" && i.type === "TemplateLiteral" && Kt(i); + e.type === "JSXAttribute" && e.name.name === "css" && e.value.type === "JSXExpressionContainer" && e.value.expression.type === "TemplateLiteral" && Kt(t2.value.expression), e.type === "JSXAttribute" && ((_a3 = e.value) == null ? void 0 : _a3.type) === "Literal" && /["']|"|'/u.test(e.value.value) && (t2.value.value = W(0, e.value.value, /["']|"|'/gu, '"')); + let n = e.expression || e.callee; + if (e.type === "Decorator" && n.type === "CallExpression" && n.callee.name === "Component" && n.arguments.length === 1) { + let s = e.expression.arguments[0].properties; + for (let [i, o] of t2.expression.arguments[0].properties.entries()) switch (s[i].key.name) { + case "styles": + q(o.value) && Kt(o.value.elements[0]); + break; + case "template": + o.value.type === "TemplateLiteral" && Kt(o.value); + break; } - let b; - if (o ? b = [c] : (F.enclosingNode = h, F.precedingNode = m, F.followingNode = C, b = [F, v, E, g, j]), ni(v, E, f2, d)) F.placement = "ownLine", D(...b) || (C ? ue(C, F) : m ? ie(m, F) : h ? re(h, F) : re(g, F)); - else if (ui(v, E, f2, d)) F.placement = "endOfLine", l(...b) || (m ? ie(m, F) : C ? ue(C, F) : h ? re(h, F) : re(g, F)); - else if (F.placement = "remaining", !p(...b)) if (m && C) { - let X = n.length; - X > 0 && n[X - 1].followingNode !== C && nn(n, E), n.push(c); - } else m ? ie(m, F) : C ? ue(C, F) : h ? re(h, F) : re(g, F); } - if (nn(n, t2), !o) for (let d of r) delete d.precedingNode, delete d.enclosingNode, delete d.followingNode; + e.type === "TaggedTemplateExpression" && (e.tag.type === "MemberExpression" || e.tag.type === "Identifier" && (e.tag.name === "gql" || e.tag.name === "graphql" || e.tag.name === "css" || e.tag.name === "md" || e.tag.name === "markdown" || e.tag.name === "html") || e.tag.type === "CallExpression") && Kt(t2.quasi), e.type === "TemplateLiteral" && Kt(t2), e.type === "ChainExpression" && e.expression.type === "TSNonNullExpression" && (t2.type = "TSNonNullExpression", t2.expression.type = "ChainExpression"); } - var sn = (e) => !/[\S\n\u2028\u2029]/u.test(e); - function ni(e, t2, r, n) { - let { comment: u, precedingNode: i } = r[n], { locStart: o, locEnd: s } = t2, a2 = o(u); - if (i) for (let D = n - 1; D >= 0; D--) { - let { comment: l, precedingNode: p } = r[D]; - if (p !== i || !sn(e.slice(s(l), a2))) break; - a2 = o(l); - } - return V(e, a2, { backwards: true }); + Bi.ignoredProperties = xp; + var bi = Bi; + var gp = k(["File", "TemplateElement", "TSEmptyBodyFunctionExpression", "ChainExpression"]), hp = (e, [t2]) => (t2 == null ? void 0 : t2.type) === "ComponentParameter" && t2.shorthand && t2.name === e && t2.local !== t2.name || (t2 == null ? void 0 : t2.type) === "MatchObjectPatternProperty" && t2.shorthand && t2.key === e && t2.value !== t2.key || (t2 == null ? void 0 : t2.type) === "ObjectProperty" && t2.shorthand && t2.key === e && t2.value !== t2.key || (t2 == null ? void 0 : t2.type) === "Property" && t2.shorthand && t2.key === e && !mt(t2) && t2.value !== t2.key, Sp = (e, [t2]) => !!(e.type === "FunctionExpression" && t2.type === "MethodDefinition" && t2.value === e && K(e).length === 0 && !e.returnType && !R(e.typeParameters) && e.body), Pi = (e, [t2]) => (t2 == null ? void 0 : t2.typeAnnotation) === e && Si(t2), Bp = (e, [t2, ...r]) => Pi(e, [t2]) || (t2 == null ? void 0 : t2.typeName) === e && Pi(t2, r); + function bp(e, t2) { + return gp(e) || hp(e, t2) || Sp(e, t2) ? false : e.type === "EmptyStatement" ? kt({ node: e, parent: t2[0] }) : !(Bp(e, t2) || e.type === "TSTypeAnnotation" && t2[0].type === "TSPropertySignature"); } - function ui(e, t2, r, n) { - let { comment: u, followingNode: i } = r[n], { locStart: o, locEnd: s } = t2, a2 = s(u); - if (i) for (let D = n + 1; D < r.length; D++) { - let { comment: l, followingNode: p } = r[D]; - if (p !== i || !sn(e.slice(a2, o(l)))) break; - a2 = s(l); - } - return V(e, a2); + var ki = bp; + function Pp(e) { + let t2 = e.type || e.kind || "(unknown type)", r = String(e.name || e.id && (typeof e.id == "object" ? e.id.name : e.id) || e.key && (typeof e.key == "object" ? e.key.name : e.key) || e.value && (typeof e.value == "object" ? "" : String(e.value)) || e.operator || ""); + return r.length > 20 && (r = r.slice(0, 19) + "\u2026"), t2 + (r ? " " + r : ""); } - function nn(e, t2) { - var _a; - var s, a2; - let r = e.length; - if (r === 0) return; - let { precedingNode: n, followingNode: u } = e[0], i = t2.locStart(u), o; - for (o = r; o > 0; --o) { - let { comment: D, precedingNode: l, followingNode: p } = e[o - 1]; - Pe.strictEqual(l, n), Pe.strictEqual(p, u); - let f2 = t2.originalText.slice(t2.locEnd(D), i); - if ((_a = (a2 = (s = t2.printer).isGap) == null ? void 0 : a2.call(s, f2, t2)) != null ? _a : /^[\s(]*$/u.test(f2)) i = t2.locStart(D); - else break; - } - for (let [D, { comment: l }] of e.entries()) D < o ? ie(n, l) : ue(u, l); - for (let D of [n, u]) D.comments && D.comments.length > 1 && D.comments.sort((l, p) => t2.locStart(l) - t2.locStart(p)); - e.length = 0; + function Qn(e, t2) { + var _a3; + ((_a3 = e.comments) != null ? _a3 : e.comments = []).push(t2), t2.printed = false, t2.nodeDescription = Pp(e); } - function Vt(e, t2, r) { - let n = r.locStart(t2) - 1; - for (let u = 1; u < e.length; ++u) if (n < r.locStart(e[u])) return u - 1; - return 0; + function te(e, t2) { + t2.leading = true, t2.trailing = false, Qn(e, t2); } - function ii(e, t2) { - let r = t2 - 1; - r = S(e, r, { backwards: true }), r = W(e, r, { backwards: true }), r = S(e, r, { backwards: true }); - let n = W(e, r, { backwards: true }); - return r !== n; + function we(e, t2, r) { + t2.leading = false, t2.trailing = false, r && (t2.marker = r), Qn(e, t2); } - var Ie = ii; - function an(e, t2) { - let r = e.node; - return r.printed = true, t2.printer.printComment(e, t2); + function $(e, t2) { + t2.leading = false, t2.trailing = true, Qn(e, t2); + } + function kp(e, t2) { + let r = null, n = t2; + for (; n !== r; ) r = n, n = ze(e, n), n = qt(e, n), n = Ut(e, n), n = Ze(e, n); + return n; + } + var at = kp; + function Ip(e, t2) { + let r = at(e, t2); + return r === false ? "" : e.charAt(r); + } + var _e = Ip; + function Lp(e, t2, r) { + for (let n = t2; n < r; ++n) if (e.charAt(n) === ` +`) return true; + return false; + } + var ue = Lp; + var zn = /* @__PURE__ */ new WeakMap(); + function Op(e) { + return zn.has(e) || zn.set(e, ce(e) && e.value[0] === "*" && /@(?:type|satisfies)\b/u.test(e.value)), zn.get(e); + } + var Hr = Op; + var es = (e, t2) => At(e) || !ue(t2, w(e), I(e)); + function wp(e) { + return [vi, Li, Mi, Up, jp, ts, rs, Ii, Oi, $p, Hp, Xp, ss, ji, Kp, wi, Ni, ns, vp, nc, Ri, is].some((t2) => t2(e)); + } + function _p(e) { + return [Np, Mi, Li, ji, ts, rs, Ii, Oi, Ni, Yp, Vp, ss, Zp, ns, tc, rc, sc, Ri, oc, ic, is].some((t2) => t2(e)); + } + function Mp(e) { + return [vi, ts, rs, qp, wi, ss, Wp, Gp, ns, ec, is].some((t2) => t2(e)); } - function oi(e, t2) { - var l; - let r = e.node, n = [an(e, t2)], { printer: u, originalText: i, locStart: o, locEnd: s } = t2; - if ((l = u.isBlockComment) == null ? void 0 : l.call(u, r)) { - let p = V(i, s(r)) ? V(i, o(r), { backwards: true }) ? K : Ze : " "; - n.push(p); - } else n.push(K); - let D = W(i, S(i, s(r))); - return D !== false && V(i, D) && n.push(K), n; - } - function si(e, t2, r) { - var D; - let n = e.node, u = an(e, t2), { printer: i, originalText: o, locStart: s } = t2, a2 = (D = i.isBlockComment) == null ? void 0 : D.call(i, n); - if (r != null && r.hasLineSuffix && !(r != null && r.isBlock) || V(o, s(n), { backwards: true })) { - let l = Ie(o, s(n)); - return { doc: Te([K, l ? K : "", u]), isBlock: a2, hasLineSuffix: true }; - } - return !a2 || r != null && r.hasLineSuffix ? { doc: [Te([" ", u]), he], isBlock: a2, hasLineSuffix: true } : { doc: [" ", u], isBlock: a2, hasLineSuffix: false }; + function wt(e, t2) { + let r = (e.body || e.properties).find(({ type: n }) => n !== "EmptyStatement"); + r ? te(r, t2) : we(e, t2); } - function ai(e, t2) { - let r = e.node; - if (!r) return {}; - let n = t2[/* @__PURE__ */ Symbol.for("printedComments")]; - if ((r.comments || []).filter((a2) => !n.has(a2)).length === 0) return { leading: "", trailing: "" }; - let i = [], o = [], s; - return e.each(() => { - let a2 = e.node; - if (n != null && n.has(a2)) return; - let { leading: D, trailing: l } = a2; - D ? i.push(oi(e, t2)) : l && (s = si(e, t2, s), o.push(s.doc)); - }, "comments"), { leading: i, trailing: o }; + function Zn(e, t2) { + e.type === "BlockStatement" ? wt(e, t2) : te(e, t2); } - function Dn(e, t2, r) { - let { leading: n, trailing: u } = ai(e, r); - return !n && !u ? t2 : me(t2, (i) => [n, i, u]); + function Np({ comment: e, followingNode: t2 }) { + return t2 && Hr(e) ? (te(t2, e), true) : false; } - function ln(e) { - let { [/* @__PURE__ */ Symbol.for("comments")]: t2, [/* @__PURE__ */ Symbol.for("printedComments")]: r } = e; - for (let n of t2) { - if (!n.printed && !r.has(n)) throw new Error('Comment "' + n.value.trim() + '" was not printed. Please report this error!'); - delete n.printed; + function ts({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n, text: s }) { + if ((r == null ? void 0 : r.type) !== "IfStatement" || !n) return false; + if (_e(s, I(e)) === ")") return $(t2, e), true; + if (n.type === "BlockStatement" && n === r.consequent && w(e) >= I(t2) && I(e) <= w(n)) return te(n, e), true; + if (t2 === r.consequent && n === r.alternate) { + let o = at(s, I(r.consequent)); + if (n.type === "BlockStatement" && w(e) >= o && I(e) <= w(n)) return te(n, e), true; + if (w(e) < o || r.alternate.type === "BlockStatement") return t2.type === "BlockStatement" ? ($(t2, e), true) : es(e, s) && !ue(s, w(t2), w(e)) ? ($(t2, e), true) : (we(r, e), true); } + return n.type === "BlockStatement" ? (wt(n, e), true) : n.type === "IfStatement" ? (Zn(n.consequent, e), true) : r.consequent === n ? (te(n, e), true) : false; } - function Di(e) { - return () => { - }; + function rs({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n, text: s }) { + return (r == null ? void 0 : r.type) !== "WhileStatement" || !n ? false : _e(s, I(e)) === ")" ? ($(t2, e), true) : n.type === "BlockStatement" ? (wt(n, e), true) : r.body === n ? (te(n, e), true) : false; } - var cn = Di; - var Re = class extends Error { - constructor() { - super(...arguments); - __publicField(this, "name", "ConfigError"); - } - }, Ye = class extends Error { - constructor() { - super(...arguments); - __publicField(this, "name", "UndefinedParserError"); - } - }; - var fn = { cursorOffset: { category: "Special", type: "int", default: -1, range: { start: -1, end: 1 / 0, step: 1 }, description: "Print (to stderr) where a cursor at the given position would move to after formatting.", cliCategory: "Editor" }, endOfLine: { category: "Global", type: "choice", default: "lf", description: "Which end of line characters to apply.", choices: [{ value: "lf", description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos" }, { value: "crlf", description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows" }, { value: "cr", description: "Carriage Return character only (\\r), used very rarely" }, { value: "auto", description: `Maintain existing -(mixed values within one file are normalised by looking at what's used after the first line)` }] }, filepath: { category: "Special", type: "path", description: "Specify the input filepath. This will be used to do parser inference.", cliName: "stdin-filepath", cliCategory: "Other", cliDescription: "Path to the file to pretend that stdin comes from." }, insertPragma: { category: "Special", type: "boolean", default: false, description: "Insert @format pragma into file's first docblock comment.", cliCategory: "Other" }, parser: { category: "Global", type: "choice", default: void 0, description: "Which parser to use.", exception: (e) => typeof e == "string" || typeof e == "function", choices: [{ value: "flow", description: "Flow" }, { value: "babel", description: "JavaScript" }, { value: "babel-flow", description: "Flow" }, { value: "babel-ts", description: "TypeScript" }, { value: "typescript", description: "TypeScript" }, { value: "acorn", description: "JavaScript" }, { value: "espree", description: "JavaScript" }, { value: "meriyah", description: "JavaScript" }, { value: "css", description: "CSS" }, { value: "less", description: "Less" }, { value: "scss", description: "SCSS" }, { value: "json", description: "JSON" }, { value: "json5", description: "JSON5" }, { value: "jsonc", description: "JSON with Comments" }, { value: "json-stringify", description: "JSON.stringify" }, { value: "graphql", description: "GraphQL" }, { value: "markdown", description: "Markdown" }, { value: "mdx", description: "MDX" }, { value: "vue", description: "Vue" }, { value: "yaml", description: "YAML" }, { value: "glimmer", description: "Ember / Handlebars" }, { value: "html", description: "HTML" }, { value: "angular", description: "Angular" }, { value: "lwc", description: "Lightning Web Components" }] }, plugins: { type: "path", array: true, default: [{ value: [] }], category: "Global", description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.", exception: (e) => typeof e == "string" || typeof e == "object", cliName: "plugin", cliCategory: "Config" }, printWidth: { category: "Global", type: "int", default: 80, description: "The line length where Prettier will try wrap.", range: { start: 0, end: 1 / 0, step: 1 } }, rangeEnd: { category: "Special", type: "int", default: 1 / 0, range: { start: 0, end: 1 / 0, step: 1 }, description: `Format code ending at a given character offset (exclusive). -The range will extend forwards to the end of the selected statement.`, cliCategory: "Editor" }, rangeStart: { category: "Special", type: "int", default: 0, range: { start: 0, end: 1 / 0, step: 1 }, description: `Format code starting at a given character offset. -The range will extend backwards to the start of the first line containing the selected statement.`, cliCategory: "Editor" }, requirePragma: { category: "Special", type: "boolean", default: false, description: `Require either '@prettier' or '@format' to be present in the file's first docblock comment -in order for it to be formatted.`, cliCategory: "Other" }, tabWidth: { type: "int", category: "Global", default: 2, description: "Number of spaces per indentation level.", range: { start: 0, end: 1 / 0, step: 1 } }, useTabs: { category: "Global", type: "boolean", default: false, description: "Indent with tabs instead of spaces." }, embeddedLanguageFormatting: { category: "Global", type: "choice", default: "auto", description: "Control how Prettier formats quoted code embedded in the file.", choices: [{ value: "auto", description: "Format embedded code if Prettier can automatically identify it." }, { value: "off", description: "Never automatically format embedded code." }] } }; - function ot({ plugins: e = [], showDeprecated: t2 = false } = {}) { - let r = e.flatMap((u) => { - var _a; - return (_a = u.languages) != null ? _a : []; - }), n = []; - for (let u of ci(Object.assign({}, ...e.map(({ options: i }) => i), fn))) !t2 && u.deprecated || (Array.isArray(u.choices) && (t2 || (u.choices = u.choices.filter((i) => !i.deprecated)), u.name === "parser" && (u.choices = [...u.choices, ...li(u.choices, r, e)])), u.pluginDefaults = Object.fromEntries(e.filter((i) => { - var o; - return ((o = i.defaultOptions) == null ? void 0 : o[u.name]) !== void 0; - }).map((i) => [i.name, i.defaultOptions[u.name]])), n.push(u)); - return { languages: r, options: n }; + function Ii({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n }) { + return (r == null ? void 0 : r.type) !== "TryStatement" && (r == null ? void 0 : r.type) !== "CatchClause" || !n ? false : r.type === "CatchClause" && t2 ? ($(t2, e), true) : n.type === "BlockStatement" ? (wt(n, e), true) : n.type === "TryStatement" ? (Zn(n.finalizer, e), true) : n.type === "CatchClause" ? (Zn(n.body, e), true) : false; } - function* li(e, t2, r) { - let n = new Set(e.map((u) => u.value)); - for (let u of t2) if (u.parsers) { - for (let i of u.parsers) if (!n.has(i)) { - n.add(i); - let o = r.find((a2) => a2.parsers && Object.prototype.hasOwnProperty.call(a2.parsers, i)), s = u.name; - o != null && o.name && (s += ` (plugin: ${o.name})`), yield { value: i, description: s }; + function jp({ comment: e, enclosingNode: t2, followingNode: r }) { + return J(t2) && (r == null ? void 0 : r.type) === "Identifier" ? (te(t2, e), true) : false; + } + function vp({ comment: e, enclosingNode: t2, followingNode: r, options: n }) { + return !n.experimentalTernaries || !((t2 == null ? void 0 : t2.type) === "ConditionalExpression" || Ue(t2)) ? false : (r == null ? void 0 : r.type) === "ConditionalExpression" || Ue(r) ? (we(t2, e), true) : false; + } + function Li({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n, text: s, options: i }) { + let o = t2 && !ue(s, I(t2), w(e)); + return (!t2 || !o) && ((r == null ? void 0 : r.type) === "ConditionalExpression" || Ue(r)) && n ? i.experimentalTernaries && r.alternate === n && !(ce(e) && !ue(i.originalText, w(e), I(e))) ? (we(r, e), true) : (te(n, e), true) : false; + } + var Rp = k(["ClassDeclaration", "ClassExpression", "DeclareClass", "DeclareInterface", "InterfaceDeclaration", "TSInterfaceDeclaration"]); + function Oi({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n }) { + if (Rp(r)) { + if (R(r.decorators) && (n == null ? void 0 : n.type) !== "Decorator") return $(N(0, r.decorators, -1), e), true; + if (r.body && n === r.body) return wt(r.body, e), true; + if (n) { + if (r.superClass && n === r.superClass && t2 && (t2 === r.id || t2 === r.typeParameters)) return $(t2, e), true; + for (let s of ["implements", "extends", "mixins"]) if (r[s] && n === r[s][0]) return t2 && (t2 === r.id || t2 === r.typeParameters || t2 === r.superClass) ? $(t2, e) : we(r, e, s), true; } } + return false; } - function ci(e) { - let t2 = []; - for (let [r, n] of Object.entries(e)) { - let u = { name: r, ...n }; - Array.isArray(u.default) && (u.default = A2(false, u.default, -1).value), t2.push(u); - } - return t2; + var Jp = k(["ClassMethod", "ClassProperty", "PropertyDefinition", "TSAbstractPropertyDefinition", "TSAbstractMethodDefinition", "TSDeclareMethod", "MethodDefinition", "ClassAccessorProperty", "AccessorProperty", "TSAbstractAccessorProperty", "TSParameterProperty"]); + function wi({ comment: e, precedingNode: t2, enclosingNode: r, text: n }) { + return r && t2 && _e(n, I(e)) === "(" && (r.type === "Property" || r.type === "TSDeclareMethod" || r.type === "TSAbstractMethodDefinition") && t2.type === "Identifier" && r.key === t2 && _e(n, I(t2)) !== ":" ? ($(t2, e), true) : (t2 == null ? void 0 : t2.type) === "Decorator" && Jp(r) && (At(e) || e.placement === "ownLine") ? ($(t2, e), true) : false; } - var fi = (e) => String(e).split(/[/\\]/u).pop(); - function dn(e, t2) { - var _a; - if (!t2) return; - let r = fi(t2).toLowerCase(); - return (_a = e.find(({ filenames: n }) => n == null ? void 0 : n.some((u) => u.toLowerCase() === r))) != null ? _a : e.find(({ extensions: n }) => n == null ? void 0 : n.some((u) => r.endsWith(u))); + var _i = k(["FunctionDeclaration", "FunctionExpression", "ClassMethod", "MethodDefinition", "ObjectMethod"]); + function Gp({ comment: e, precedingNode: t2, enclosingNode: r, text: n }) { + return _e(n, I(e)) !== "(" ? false : t2 && _i(r) ? ($(t2, e), true) : false; } - function di(e, t2) { - var _a, _b; - if (t2) return (_b = (_a = e.find(({ name: r }) => r.toLowerCase() === t2)) != null ? _a : e.find(({ aliases: r }) => r == null ? void 0 : r.includes(t2))) != null ? _b : e.find(({ extensions: r }) => r == null ? void 0 : r.includes(`.${t2}`)); + function Wp({ comment: e, enclosingNode: t2, text: r }) { + if ((t2 == null ? void 0 : t2.type) !== "ArrowFunctionExpression") return false; + let n = at(r, I(e)); + return n !== false && r.slice(n, n + 2) === "=>" ? (we(t2, e), true) : false; } - function pi(e, t2) { - var _a, _b, _c; - let r = e.plugins.flatMap((u) => { - var _a2; - return (_a2 = u.languages) != null ? _a2 : []; - }), n = (_c = (_b = (_a = di(r, t2.language)) != null ? _a : dn(r, t2.physicalFile)) != null ? _b : dn(r, t2.file)) != null ? _c : (t2.physicalFile, void 0); - return n == null ? void 0 : n.parsers[0]; + function qp({ comment: e, enclosingNode: t2, text: r }) { + return _e(r, I(e)) !== ")" ? false : t2 && (Ji(t2) && K(t2).length === 0 || Dt(t2) && le(t2).length === 0) ? (we(t2, e), true) : ((t2 == null ? void 0 : t2.type) === "MethodDefinition" || (t2 == null ? void 0 : t2.type) === "TSAbstractMethodDefinition") && K(t2.value).length === 0 ? (we(t2.value, e), true) : false; } - var pn = pi; - var oe = { key: (e) => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(e) ? e : JSON.stringify(e), value(e) { - if (e === null || typeof e != "object") return JSON.stringify(e); - if (Array.isArray(e)) return `[${e.map((r) => oe.value(r)).join(", ")}]`; - let t2 = Object.keys(e); - return t2.length === 0 ? "{}" : `{ ${t2.map((r) => `${oe.key(r)}: ${oe.value(e[r])}`).join(", ")} }`; - }, pair: ({ key: e, value: t2 }) => oe.value({ [e]: t2 }) }; - var Ut = Ve(st(), 1), hn = (e, t2, { descriptor: r }) => { - let n = [`${Ut.default.yellow(typeof e == "string" ? r.key(e) : r.pair(e))} is deprecated`]; - return t2 && n.push(`we now treat it as ${Ut.default.blue(typeof t2 == "string" ? r.key(t2) : r.pair(t2))}`), n.join("; ") + "."; - }; - var ce = Ve(st(), 1); - var at = /* @__PURE__ */ Symbol.for("vnopts.VALUE_NOT_EXIST"), ve = /* @__PURE__ */ Symbol.for("vnopts.VALUE_UNCHANGED"); - var En = " ".repeat(2), gn = (e, t2, r) => { - let { text: n, list: u } = r.normalizeExpectedResult(r.schemas[e].expected(r)), i = []; - return n && i.push(Cn(e, t2, n, r.descriptor)), u && i.push([Cn(e, t2, u.title, r.descriptor)].concat(u.values.map((o) => yn(o, r.loggerPrintWidth))).join(` -`)), An(i, r.loggerPrintWidth); - }; - function Cn(e, t2, r, n) { - return [`Invalid ${ce.default.red(n.key(e))} value.`, `Expected ${ce.default.blue(r)},`, `but received ${t2 === at ? ce.default.gray("nothing") : ce.default.red(n.value(t2))}.`].join(" "); + function Up({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n, text: s }) { + return (t2 == null ? void 0 : t2.type) === "ComponentTypeParameter" && ((r == null ? void 0 : r.type) === "DeclareComponent" || (r == null ? void 0 : r.type) === "ComponentTypeAnnotation") && (n == null ? void 0 : n.type) !== "ComponentTypeParameter" ? ($(t2, e), true) : ((t2 == null ? void 0 : t2.type) === "ComponentParameter" || (t2 == null ? void 0 : t2.type) === "RestElement") && (r == null ? void 0 : r.type) === "ComponentDeclaration" && _e(s, I(e)) === ")" ? ($(t2, e), true) : false; } - function yn({ text: e, list: t2 }, r) { - let n = []; - return e && n.push(`- ${ce.default.blue(e)}`), t2 && n.push([`- ${ce.default.blue(t2.title)}:`].concat(t2.values.map((u) => yn(u, r - En.length).replace(/^|\n/g, `$&${En}`))).join(` -`)), An(n, r); + function Mi({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n, text: s }) { + return (t2 == null ? void 0 : t2.type) === "FunctionTypeParam" && (r == null ? void 0 : r.type) === "FunctionTypeAnnotation" && (n == null ? void 0 : n.type) !== "FunctionTypeParam" ? ($(t2, e), true) : ((t2 == null ? void 0 : t2.type) === "Identifier" || (t2 == null ? void 0 : t2.type) === "AssignmentPattern" || (t2 == null ? void 0 : t2.type) === "ObjectPattern" || (t2 == null ? void 0 : t2.type) === "ArrayPattern" || (t2 == null ? void 0 : t2.type) === "RestElement" || (t2 == null ? void 0 : t2.type) === "TSParameterProperty") && Ji(r) && _e(s, I(e)) === ")" ? ($(t2, e), true) : !ce(e) && (n == null ? void 0 : n.type) === "BlockStatement" && _i(r) && (r.type === "MethodDefinition" ? r.value.body : r.body) === n && at(s, I(e)) === w(n) ? (wt(n, e), true) : false; } - function An(e, t2) { - if (e.length === 1) return e[0]; - let [r, n] = e, [u, i] = e.map((o) => o.split(` -`, 1)[0].length); - return u > t2 && u > i ? n : r; + function Ni({ comment: e, enclosingNode: t2 }) { + return (t2 == null ? void 0 : t2.type) === "LabeledStatement" ? (te(t2, e), true) : false; } - var Kt = Ve(st(), 1); - var zt = [], vn = []; - function Gt(e, t2) { - if (e === t2) return 0; - let r = e; - e.length > t2.length && (e = t2, t2 = r); - let n = e.length, u = t2.length; - for (; n > 0 && e.charCodeAt(~-n) === t2.charCodeAt(~-u); ) n--, u--; - let i = 0; - for (; i < n && e.charCodeAt(i) === t2.charCodeAt(i); ) i++; - if (n -= i, u -= i, n === 0) return u; - let o, s, a2, D, l = 0, p = 0; - for (; l < n; ) vn[l] = e.charCodeAt(i + l), zt[l] = ++l; - for (; p < u; ) for (o = t2.charCodeAt(i + p), a2 = p++, s = p, l = 0; l < n; l++) D = o === vn[l] ? a2 : a2 + 1, a2 = zt[l], s = zt[l] = a2 > s ? D > s ? s + 1 : D : D > a2 ? a2 + 1 : D; - return s; + function ns({ comment: e, enclosingNode: t2 }) { + return ((t2 == null ? void 0 : t2.type) === "ContinueStatement" || (t2 == null ? void 0 : t2.type) === "BreakStatement") && !t2.label ? ($(t2, e), true) : false; } - var Dt = (e, t2, { descriptor: r, logger: n, schemas: u }) => { - let i = [`Ignored unknown option ${Kt.default.yellow(r.pair({ key: e, value: t2 }))}.`], o = Object.keys(u).sort().find((s) => Gt(e, s) < 3); - o && i.push(`Did you mean ${Kt.default.blue(r.key(o))}?`), n.warn(i.join(" ")); - }; - var Fi = ["default", "expected", "validate", "deprecated", "forward", "redirect", "overlap", "preprocess", "postprocess"]; - function mi(e, t2) { - let r = new e(t2), n = Object.create(r); - for (let u of Fi) u in t2 && (n[u] = hi(t2[u], r, x.prototype[u].length)); - return n; + function Yp({ comment: e, precedingNode: t2, enclosingNode: r }) { + return M(r) && t2 && r.callee === t2 && r.arguments.length > 0 ? (te(r.arguments[0], e), true) : false; } - var x = class { - static create(t2) { - return mi(this, t2); - } - constructor(t2) { - this.name = t2.name; - } - default(t2) { - } - expected(t2) { - return "nothing"; - } - validate(t2, r) { - return false; - } - deprecated(t2, r) { - return false; - } - forward(t2, r) { - } - redirect(t2, r) { - } - overlap(t2, r, n) { - return t2; - } - preprocess(t2, r) { - return t2; - } - postprocess(t2, r) { - return ve; - } - }; - function hi(e, t2, r) { - return typeof e == "function" ? (...n) => e(...n.slice(0, r - 1), t2, ...n.slice(r - 1)) : () => e; + function Hp({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n }) { + return Se(r) ? (Lt(e) && (n.prettierIgnore = true, e.unignore = true), t2 ? ($(t2, e), true) : false) : (Se(n) && Lt(e) && (n.types[0].prettierIgnore = true, e.unignore = true), false); } - var lt = class extends x { - constructor(t2) { - super(t2), this._sourceName = t2.sourceName; - } - expected(t2) { - return t2.schemas[this._sourceName].expected(t2); - } - validate(t2, r) { - return r.schemas[this._sourceName].validate(t2, r); - } - redirect(t2, r) { - return this._sourceName; - } - }; - var ct = class extends x { - expected() { - return "anything"; - } - validate() { - return true; - } - }; - var ft = class extends x { - constructor({ valueSchema: t2, name: r = t2.name, ...n }) { - super({ ...n, name: r }), this._valueSchema = t2; - } - expected(t2) { - let { text: r, list: n } = t2.normalizeExpectedResult(this._valueSchema.expected(t2)); - return { text: r && `an array of ${r}`, list: n && { title: "an array of the following values", values: [{ list: n }] } }; - } - validate(t2, r) { - if (!Array.isArray(t2)) return false; - let n = []; - for (let u of t2) { - let i = r.normalizeValidateResult(this._valueSchema.validate(u, r), u); - i !== true && n.push(i.value); - } - return n.length === 0 ? true : { value: n }; - } - deprecated(t2, r) { - let n = []; - for (let u of t2) { - let i = r.normalizeDeprecatedResult(this._valueSchema.deprecated(u, r), u); - i !== false && n.push(...i.map(({ value: o }) => ({ value: [o] }))); - } - return n; - } - forward(t2, r) { - let n = []; - for (let u of t2) { - let i = r.normalizeForwardResult(this._valueSchema.forward(u, r), u); - n.push(...i.map(Bn)); - } - return n; - } - redirect(t2, r) { - let n = [], u = []; - for (let i of t2) { - let o = r.normalizeRedirectResult(this._valueSchema.redirect(i, r), i); - "remain" in o && n.push(o.remain), u.push(...o.redirect.map(Bn)); - } - return n.length === 0 ? { redirect: u } : { redirect: u, remain: n }; - } - overlap(t2, r) { - return t2.concat(r); - } - }; - function Bn({ from: e, to: t2 }) { - return { from: [e], to: t2 }; + function Xp({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n }) { + return r && r.type === "MatchOrPattern" ? (Lt(e) && (n.prettierIgnore = true, e.unignore = true), t2 ? ($(t2, e), true) : false) : (n && n.type === "MatchOrPattern" && Lt(e) && (n.types[0].prettierIgnore = true, e.unignore = true), false); } - var dt = class extends x { - expected() { - return "true or false"; - } - validate(t2) { - return typeof t2 == "boolean"; - } - }; - function _n(e, t2) { - let r = /* @__PURE__ */ Object.create(null); - for (let n of e) { - let u = n[t2]; - if (r[u]) throw new Error(`Duplicate ${t2} ${JSON.stringify(u)}`); - r[u] = n; - } - return r; + function Vp({ comment: e, enclosingNode: t2 }) { + return Oe(t2) ? (te(t2, e), true) : false; } - function xn(e, t2) { - let r = /* @__PURE__ */ new Map(); - for (let n of e) { - let u = n[t2]; - if (r.has(u)) throw new Error(`Duplicate ${t2} ${JSON.stringify(u)}`); - r.set(u, n); - } - return r; + function ss({ comment: e, enclosingNode: t2, ast: r, isLastComment: n }) { + var _a3; + return ((_a3 = r == null ? void 0 : r.body) == null ? void 0 : _a3.length) === 0 ? (n ? we(r, e) : te(r, e), true) : (t2 == null ? void 0 : t2.type) === "Program" && t2.body.length === 0 && !R(t2.directives) ? (n ? we(t2, e) : te(t2, e), true) : false; } - function bn() { - let e = /* @__PURE__ */ Object.create(null); - return (t2) => { - let r = JSON.stringify(t2); - return e[r] ? true : (e[r] = true, false); - }; + function $p({ comment: e, enclosingNode: t2, followingNode: r }) { + return ((t2 == null ? void 0 : t2.type) === "ForInStatement" || (t2 == null ? void 0 : t2.type) === "ForOfStatement") && r !== t2.body ? (te(t2, e), true) : false; } - function Nn(e, t2) { - let r = [], n = []; - for (let u of e) t2(u) ? r.push(u) : n.push(u); - return [r, n]; + function ji({ comment: e, precedingNode: t2, enclosingNode: r, text: n }) { + if ((r == null ? void 0 : r.type) === "ImportSpecifier" || (r == null ? void 0 : r.type) === "ExportSpecifier") return te(r, e), true; + let s = (t2 == null ? void 0 : t2.type) === "ImportSpecifier" && (r == null ? void 0 : r.type) === "ImportDeclaration", i = (t2 == null ? void 0 : t2.type) === "ExportSpecifier" && (r == null ? void 0 : r.type) === "ExportNamedDeclaration"; + return (s || i) && Z(n, I(e)) ? ($(t2, e), true) : false; } - function On(e) { - return e === Math.floor(e); + function Kp({ comment: e, enclosingNode: t2 }) { + return (t2 == null ? void 0 : t2.type) === "AssignmentPattern" ? (te(t2, e), true) : false; } - function Sn(e, t2) { - if (e === t2) return 0; - let r = typeof e, n = typeof t2, u = ["undefined", "object", "boolean", "number", "string"]; - return r !== n ? u.indexOf(r) - u.indexOf(n) : r !== "string" ? Number(e) - Number(t2) : e.localeCompare(t2); + var Qp = k(["VariableDeclarator", "AssignmentExpression", "TypeAlias", "TSTypeAliasDeclaration"]), zp = k(["ObjectExpression", "ArrayExpression", "TemplateLiteral", "TaggedTemplateExpression", "ObjectTypeAnnotation", "TSTypeLiteral"]); + function Zp({ comment: e, enclosingNode: t2, followingNode: r }) { + return Qp(t2) && r && (zp(r) || ce(e)) ? (te(r, e), true) : false; } - function Tn(e) { - return (...t2) => { - let r = e(...t2); - return typeof r == "string" ? new Error(r) : r; - }; + function ec({ comment: e, enclosingNode: t2, precedingNode: r, followingNode: n, text: s }) { + return !n && ((t2 == null ? void 0 : t2.type) === "TSMethodSignature" || (t2 == null ? void 0 : t2.type) === "TSDeclareFunction" || (t2 == null ? void 0 : t2.type) === "TSAbstractMethodDefinition") && (!r || r !== t2.returnType) && _e(s, I(e)) === ";" ? ($(t2, e), true) : false; } - function Jt(e) { - return e === void 0 ? {} : e; + function vi({ comment: e, enclosingNode: t2, followingNode: r }) { + if (Lt(e) && (t2 == null ? void 0 : t2.type) === "TSMappedType" && r === t2.key) return t2.prettierIgnore = true, e.unignore = true, true; } - function qt(e) { - if (typeof e == "string") return { text: e }; - let { text: t2, list: r } = e; - return Ei((t2 || r) !== void 0, "Unexpected `expected` result, there should be at least one field."), r ? { text: t2, list: { title: r.title, values: r.values.map(qt) } } : { text: t2 }; + function Ri({ comment: e, precedingNode: t2, enclosingNode: r }) { + if ((r == null ? void 0 : r.type) === "TSMappedType" && !t2) return we(r, e), true; } - function Xt(e, t2) { - return e === true ? true : e === false ? { value: t2 } : e; + function tc({ comment: e, enclosingNode: t2, followingNode: r }) { + return !t2 || t2.type !== "SwitchCase" || t2.test || !r || r !== t2.consequent[0] ? false : (r.type === "BlockStatement" && At(e) ? wt(r, e) : we(t2, e), true); } - function Qt(e, t2, r = false) { - return e === false ? false : e === true ? r ? true : [{ value: t2 }] : "value" in e ? [e] : e.length === 0 ? false : e; + function rc({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n }) { + return Se(t2) && ((r.type === "TSArrayType" || r.type === "ArrayTypeAnnotation") && !n || xt(r)) ? ($(N(0, t2.types, -1), e), true) : false; } - function wn(e, t2) { - return typeof e == "string" || "key" in e ? { from: t2, to: e } : "from" in e ? { from: e.from, to: e.to } : { from: t2, to: e.to }; + function nc({ comment: e, enclosingNode: t2, precedingNode: r, followingNode: n }) { + if (((t2 == null ? void 0 : t2.type) === "ObjectPattern" || (t2 == null ? void 0 : t2.type) === "ArrayPattern") && (n == null ? void 0 : n.type) === "TSTypeAnnotation") return r ? $(r, e) : we(t2, e), true; } - function pt(e, t2) { - return e === void 0 ? [] : Array.isArray(e) ? e.map((r) => wn(r, t2)) : [wn(e, t2)]; + function sc({ comment: e, precedingNode: t2, enclosingNode: r, followingNode: n, text: s }) { + return !n && (r == null ? void 0 : r.type) === "UnaryExpression" && ((t2 == null ? void 0 : t2.type) === "LogicalExpression" || (t2 == null ? void 0 : t2.type) === "BinaryExpression") && ue(s, w(r.argument), w(t2.right)) && es(e, s) && !ue(s, w(t2.right), w(e)) ? ($(t2.right, e), true) : false; } - function Zt(e, t2) { - let r = pt(typeof e == "object" && "redirect" in e ? e.redirect : e, t2); - return r.length === 0 ? { remain: t2, redirect: r } : typeof e == "object" && "remain" in e ? { remain: e.remain, redirect: r } : { redirect: r }; + function ic({ enclosingNode: e, followingNode: t2, comment: r }) { + if (e && (e.type === "TSPropertySignature" || e.type === "ObjectTypeProperty") && (Se(t2) || xt(t2))) return te(t2, r), true; } - function Ei(e, t2) { - if (!e) throw new Error(t2); + function is({ enclosingNode: e, precedingNode: t2, followingNode: r, comment: n, text: s }) { + if (Ae(e) && t2 === e.expression && !es(n, s)) return r ? te(r, n) : $(e, n), true; + } + function oc({ comment: e, enclosingNode: t2, followingNode: r, precedingNode: n }) { + return t2 && r && n && t2.type === "ArrowFunctionExpression" && t2.returnType === n && (n.type === "TSTypeAnnotation" || n.type === "TypeAnnotation") ? (te(r, e), true) : false; + } + var Ji = k(["ArrowFunctionExpression", "FunctionExpression", "FunctionDeclaration", "ObjectMethod", "ClassMethod", "TSDeclareFunction", "TSCallSignatureDeclaration", "TSConstructSignatureDeclaration", "TSMethodSignature", "TSConstructorType", "TSFunctionType", "TSDeclareMethod"]), uc = { endOfLine: _p, ownLine: wp, remaining: Mp }, Gi = uc; + function ac(e, { parser: t2 }) { + if (t2 === "flow" || t2 === "hermes" || t2 === "babel-flow") return e = W(0, e, /[\s(]/gu, ""), e === "" || e === "/*" || e === "/*::"; + } + var Wi = ac; + var pc = k(["ClassDeclaration", "ClassExpression", "DeclareClass", "DeclareInterface", "InterfaceDeclaration", "TSInterfaceDeclaration"]); + function cc(e) { + let { key: t2, parent: r } = e; + if (t2 === "types" && Se(r) || t2 === "argument" && r.type === "JSXSpreadAttribute" || t2 === "expression" && r.type === "JSXSpreadChild" || t2 === "superClass" && (r.type === "ClassDeclaration" || r.type === "ClassExpression") || (t2 === "id" || t2 === "typeParameters") && pc(r) || t2 === "patterns" && r.type === "MatchOrPattern") return true; + let { node: n } = e; + return Ot(n) ? false : Se(n) ? Yr(e) : !!H(n); + } + var qi = cc; + var Ye = "string", Be = "array", tt = "cursor", He = "indent", Xe = "align", rt = "trim", Fe = "group", Me = "fill", be = "if-break", Ve = "indent-if-break", $e = "line-suffix", Ge = "line-suffix-boundary", me = "line", Pe = "label", Ne = "break-parent", Xr = /* @__PURE__ */ new Set([tt, He, Xe, rt, Fe, Me, be, Ve, $e, Ge, me, Pe, Ne]); + function lc(e) { + if (typeof e == "string") return Ye; + if (Array.isArray(e)) return Be; + if (!e) return; + let { type: t2 } = e; + if (Xr.has(t2)) return t2; + } + var We = lc; + var mc = (e) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(e); + function Dc(e) { + let t2 = e === null ? "null" : typeof e; + if (t2 !== "string" && t2 !== "object") return `Unexpected doc '${t2}', +Expected it to be 'string' or 'object'.`; + if (We(e)) throw new Error("doc is valid."); + let r = Object.prototype.toString.call(e); + if (r !== "[object Object]") return `Unexpected doc '${r}'.`; + let n = mc([...Xr].map((s) => `'${s}'`)); + return `Unexpected doc.type '${e.type}'. +Expected it to be ${n}.`; } - var Ft = class extends x { + var os = class extends Error { constructor(t2) { - super(t2), this._choices = xn(t2.choices.map((r) => r && typeof r == "object" ? r : { value: r }), "value"); - } - expected({ descriptor: t2 }) { - let r = Array.from(this._choices.keys()).map((o) => this._choices.get(o)).filter(({ hidden: o }) => !o).map((o) => o.value).sort(Sn).map(t2.value), n = r.slice(0, -2), u = r.slice(-2); - return { text: n.concat(u.join(" or ")).join(", "), list: { title: "one of the following values", values: r } }; - } - validate(t2) { - return this._choices.has(t2); - } - deprecated(t2) { - let r = this._choices.get(t2); - return r && r.deprecated ? { value: t2 } : false; - } - forward(t2) { - let r = this._choices.get(t2); - return r ? r.forward : void 0; - } - redirect(t2) { - let r = this._choices.get(t2); - return r ? r.redirect : void 0; - } - }; - var mt = class extends x { - expected() { - return "a number"; - } - validate(t2, r) { - return typeof t2 == "number"; - } - }; - var ht = class extends mt { - expected() { - return "an integer"; - } - validate(t2, r) { - return r.normalizeValidateResult(super.validate(t2, r), t2) === true && On(t2); - } - }; - var je = class extends x { - expected() { - return "a string"; - } - validate(t2) { - return typeof t2 == "string"; - } - }; - var kn = oe, Ln = Dt, Pn = gn, In = hn; - var Et = class { - constructor(t2, r) { - let { logger: n = console, loggerPrintWidth: u = 80, descriptor: i = kn, unknown: o = Ln, invalid: s = Pn, deprecated: a2 = In, missing: D = () => false, required: l = () => false, preprocess: p = (d) => d, postprocess: f2 = () => ve } = r || {}; - this._utils = { descriptor: i, logger: n || { warn: () => { - } }, loggerPrintWidth: u, schemas: _n(t2, "name"), normalizeDefaultResult: Jt, normalizeExpectedResult: qt, normalizeDeprecatedResult: Qt, normalizeForwardResult: pt, normalizeRedirectResult: Zt, normalizeValidateResult: Xt }, this._unknownHandler = o, this._invalidHandler = Tn(s), this._deprecatedHandler = a2, this._identifyMissing = (d, c) => !(d in c) || D(d, c), this._identifyRequired = l, this._preprocess = p, this._postprocess = f2, this.cleanHistory(); - } - cleanHistory() { - this._hasDeprecationWarned = bn(); - } - normalize(t2) { - let r = {}, u = [this._preprocess(t2, this._utils)], i = () => { - for (; u.length !== 0; ) { - let o = u.shift(), s = this._applyNormalization(o, r); - u.push(...s); - } - }; - i(); - for (let o of Object.keys(this._utils.schemas)) { - let s = this._utils.schemas[o]; - if (!(o in r)) { - let a2 = Jt(s.default(this._utils)); - "value" in a2 && u.push({ [o]: a2.value }); - } - } - i(); - for (let o of Object.keys(this._utils.schemas)) { - if (!(o in r)) continue; - let s = this._utils.schemas[o], a2 = r[o], D = s.postprocess(a2, this._utils); - D !== ve && (this._applyValidation(D, o, s), r[o] = D); - } - return this._applyPostprocess(r), this._applyRequiredCheck(r), r; - } - _applyNormalization(t2, r) { - let n = [], { knownKeys: u, unknownKeys: i } = this._partitionOptionKeys(t2); - for (let o of u) { - let s = this._utils.schemas[o], a2 = s.preprocess(t2[o], this._utils); - this._applyValidation(a2, o, s); - let D = ({ from: d, to: c }) => { - n.push(typeof c == "string" ? { [c]: d } : { [c.key]: c.value }); - }, l = ({ value: d, redirectTo: c }) => { - let F = Qt(s.deprecated(d, this._utils), a2, true); - if (F !== false) if (F === true) this._hasDeprecationWarned(o) || this._utils.logger.warn(this._deprecatedHandler(o, c, this._utils)); - else for (let { value: m } of F) { - let h = { key: o, value: m }; - if (!this._hasDeprecationWarned(h)) { - let C = typeof c == "string" ? { key: c, value: m } : c; - this._utils.logger.warn(this._deprecatedHandler(h, C, this._utils)); - } - } - }; - pt(s.forward(a2, this._utils), a2).forEach(D); - let f2 = Zt(s.redirect(a2, this._utils), a2); - if (f2.redirect.forEach(D), "remain" in f2) { - let d = f2.remain; - r[o] = o in r ? s.overlap(r[o], d, this._utils) : d, l({ value: d }); - } - for (let { from: d, to: c } of f2.redirect) l({ value: d, redirectTo: c }); - } - for (let o of i) { - let s = t2[o]; - this._applyUnknownHandler(o, s, r, (a2, D) => { - n.push({ [a2]: D }); - }); - } - return n; - } - _applyRequiredCheck(t2) { - for (let r of Object.keys(this._utils.schemas)) if (this._identifyMissing(r, t2) && this._identifyRequired(r)) throw this._invalidHandler(r, at, this._utils); - } - _partitionOptionKeys(t2) { - let [r, n] = Nn(Object.keys(t2).filter((u) => !this._identifyMissing(u, t2)), (u) => u in this._utils.schemas); - return { knownKeys: r, unknownKeys: n }; - } - _applyValidation(t2, r, n) { - let u = Xt(n.validate(t2, this._utils), t2); - if (u !== true) throw this._invalidHandler(r, u.value, this._utils); + super(Dc(t2)); + __publicField(this, "name", "InvalidDocError"); + this.doc = t2; } - _applyUnknownHandler(t2, r, n, u) { - let i = this._unknownHandler(t2, r, this._utils); - if (i) for (let o of Object.keys(i)) { - if (this._identifyMissing(o, i)) continue; - let s = i[o]; - o in this._utils.schemas ? u(o, s) : n[o] = s; + }, gt = os; + var Ui = {}; + function fc(e, t2, r, n) { + let s = [e]; + for (; s.length > 0; ) { + let i = s.pop(); + if (i === Ui) { + r(s.pop()); + continue; } - } - _applyPostprocess(t2) { - let r = this._postprocess(t2, this._utils); - if (r !== ve) { - if (r.delete) for (let n of r.delete) delete t2[n]; - if (r.override) { - let { knownKeys: n, unknownKeys: u } = this._partitionOptionKeys(r.override); - for (let i of n) { - let o = r.override[i]; - this._applyValidation(o, i, this._utils.schemas[i]), t2[i] = o; - } - for (let i of u) { - let o = r.override[i]; - this._applyUnknownHandler(i, o, t2, (s, a2) => { - let D = this._utils.schemas[s]; - this._applyValidation(a2, s, D), t2[s] = a2; - }); - } + r && s.push(i, Ui); + let o = We(i); + if (!o) throw new gt(i); + if ((t2 == null ? void 0 : t2(i)) !== false) switch (o) { + case Be: + case Me: { + let u = o === Be ? i : i.parts; + for (let p = u.length, c = p - 1; c >= 0; --c) s.push(u[c]); + break; } + case be: + s.push(i.flatContents, i.breakContents); + break; + case Fe: + if (n && i.expandedStates) for (let u = i.expandedStates.length, p = u - 1; p >= 0; --p) s.push(i.expandedStates[p]); + else s.push(i.contents); + break; + case Xe: + case He: + case Ve: + case Pe: + case $e: + s.push(i.contents); + break; + case Ye: + case tt: + case rt: + case Ge: + case me: + case Ne: + break; + default: + throw new gt(i); } } - }; - var er; - function gi(e, t2, { logger: r = false, isCLI: n = false, passThrough: u = false, FlagSchema: i, descriptor: o } = {}) { - if (n) { - if (!i) throw new Error("'FlagSchema' option is required."); - if (!o) throw new Error("'descriptor' option is required."); - } else o = oe; - let s = u ? Array.isArray(u) ? (f2, d) => u.includes(f2) ? { [f2]: d } : void 0 : (f2, d) => ({ [f2]: d }) : (f2, d, c) => { - let { _: F, ...m } = c.schemas; - return Dt(f2, d, { ...c, schemas: m }); - }, a2 = yi(t2, { isCLI: n, FlagSchema: i }), D = new Et(a2, { logger: r, unknown: s, descriptor: o }), l = r !== false; - l && er && (D._hasDeprecationWarned = er); - let p = D.normalize(e); - return l && (er = D._hasDeprecationWarned), p; - } - function yi(e, { isCLI: t2, FlagSchema: r }) { - let n = []; - t2 && n.push(ct.create({ name: "_" })); - for (let u of e) n.push(Ai(u, { isCLI: t2, optionInfos: e, FlagSchema: r })), u.alias && t2 && n.push(lt.create({ name: u.alias, sourceName: u.name })); - return n; } - function Ai(e, { isCLI: t2, optionInfos: r, FlagSchema: n }) { - let { name: u } = e, i = { name: u }, o, s = {}; - switch (e.type) { - case "int": - o = ht, t2 && (i.preprocess = Number); - break; - case "string": - o = je; - break; - case "choice": - o = Ft, i.choices = e.choices.map((a2) => a2 != null && a2.redirect ? { ...a2, redirect: { to: { key: e.name, value: a2.redirect } } } : a2); - break; - case "boolean": - o = dt; - break; - case "flag": - o = n, i.flags = r.flatMap((a2) => [a2.alias, a2.description && a2.name, a2.oppositeDescription && `no-${a2.name}`].filter(Boolean)); - break; - case "path": - o = je; - break; - default: - throw new Error(`Unexpected type ${e.type}`); - } - if (e.exception ? i.validate = (a2, D, l) => e.exception(a2) || D.validate(a2, l) : i.validate = (a2, D, l) => a2 === void 0 || D.validate(a2, l), e.redirect && (s.redirect = (a2) => a2 ? { to: typeof e.redirect == "string" ? e.redirect : { key: e.redirect.option, value: e.redirect.value } } : void 0), e.deprecated && (s.deprecated = true), t2 && !e.array) { - let a2 = i.preprocess || ((D) => D); - i.preprocess = (D, l, p) => l.preprocess(a2(Array.isArray(D) ? A2(false, D, -1) : D), p); + var Vr = fc; + function ft(e, t2) { + if (typeof e == "string") return t2(e); + let r = /* @__PURE__ */ new Map(); + return n(e); + function n(i) { + if (r.has(i)) return r.get(i); + let o = s(i); + return r.set(i, o), o; } - return e.array ? ft.create({ ...t2 ? { preprocess: (a2) => Array.isArray(a2) ? a2 : [a2] } : {}, ...s, valueSchema: o.create(i) }) : o.create({ ...i, ...s }); - } - var Rn = gi; - var vi = (e, t2, r) => { - if (!(e && t2 == null)) { - if (t2.findLast) return t2.findLast(r); - for (let n = t2.length - 1; n >= 0; n--) { - let u = t2[n]; - if (r(u, n, t2)) return u; + function s(i) { + switch (We(i)) { + case Be: + return t2(i.map(n)); + case Me: + return t2({ ...i, parts: i.parts.map(n) }); + case be: + return t2({ ...i, breakContents: n(i.breakContents), flatContents: n(i.flatContents) }); + case Fe: { + let { expandedStates: o, contents: u } = i; + return o ? (o = o.map(n), u = o[0]) : u = n(u), t2({ ...i, contents: u, expandedStates: o }); + } + case Xe: + case He: + case Ve: + case Pe: + case $e: + return t2({ ...i, contents: n(i.contents) }); + case Ye: + case tt: + case rt: + case Ge: + case me: + case Ne: + return t2(i); + default: + throw new gt(i); } } - }, tr = vi; - function rr(e, t2) { - if (!t2) throw new Error("parserName is required."); - let r = tr(false, e, (u) => u.parsers && Object.prototype.hasOwnProperty.call(u.parsers, t2)); - if (r) return r; - let n = `Couldn't resolve parser "${t2}".`; - throw n += " Plugins must be explicitly added to the standalone bundle.", new Re(n); } - function Yn(e, t2) { - if (!t2) throw new Error("astFormat is required."); - let r = tr(false, e, (u) => u.printers && Object.prototype.hasOwnProperty.call(u.printers, t2)); - if (r) return r; - let n = `Couldn't find plugin for AST format "${t2}".`; - throw n += " Plugins must be explicitly added to the standalone bundle.", new Re(n); + function Hi(e, t2, r) { + let n = r, s = false; + function i(o) { + if (s) return false; + let u = t2(o); + u !== void 0 && (s = true, n = u); + } + return Vr(e, i), n; } - function Ct({ plugins: e, parser: t2 }) { - let r = rr(e, t2); - return nr(r, t2); + function yc(e) { + if (e.type === Fe && e.break || e.type === me && e.hard || e.type === Ne) return true; } - function nr(e, t2) { - let r = e.parsers[t2]; - return typeof r == "function" ? r() : r; - } - function jn(e, t2) { - let r = e.printers[t2]; - return typeof r == "function" ? r() : r; - } - var Hn = { astFormat: "estree", printer: {}, originalText: void 0, locStart: null, locEnd: null }; - async function Bi(e, t2 = {}) { - var p; - let r = { ...e }; - if (!r.parser) if (r.filepath) { - if (r.parser = pn(r, { physicalFile: r.filepath }), !r.parser) throw new Ye(`No parser could be inferred for file "${r.filepath}".`); - } else throw new Ye("No parser and no file path given, couldn't infer a parser."); - let n = ot({ plugins: e.plugins, showDeprecated: true }).options, u = { ...Hn, ...Object.fromEntries(n.filter((f2) => f2.default !== void 0).map((f2) => [f2.name, f2.default])) }, i = rr(r.plugins, r.parser), o = await nr(i, r.parser); - r.astFormat = o.astFormat, r.locEnd = o.locEnd, r.locStart = o.locStart; - let s = (p = i.printers) != null && p[o.astFormat] ? i : Yn(r.plugins, o.astFormat), a2 = await jn(s, o.astFormat); - r.printer = a2; - let D = s.defaultOptions ? Object.fromEntries(Object.entries(s.defaultOptions).filter(([, f2]) => f2 !== void 0)) : {}, l = { ...u, ...D }; - for (let [f2, d] of Object.entries(l)) (r[f2] === null || r[f2] === void 0) && (r[f2] = d); - return r.parser === "json" && (r.trailingComma = "none"), Rn(r, n, { passThrough: Object.keys(Hn), ...t2 }); - } - var se = Bi; - var Mn = Ve($n(), 1); - async function bi(e, t2) { - let r = await Ct(t2), n = r.preprocess ? r.preprocess(e, t2) : e; - t2.originalText = n; - let u; - try { - u = await r.parse(n, t2, t2); - } catch (i) { - Ni(i, e); - } - return { text: n, ast: u }; + function ne(e) { + return Hi(e, yc, false); } - function Ni(e, t2) { - let { loc: r } = e; - if (r) { - let n = (0, Mn.codeFrameColumns)(t2, r, { highlightCode: true }); - throw e.message += ` -` + n, e.codeFrame = n, e; + function Yi(e) { + if (e.length > 0) { + let t2 = N(0, e, -1); + !t2.expandedStates && !t2.break && (t2.break = "propagated"); } - throw e; + return null; } - var fe = bi; - async function Vn(e, t2, r, n, u) { - var _a; - let { embeddedLanguageFormatting: i, printer: { embed: o, hasPrettierIgnore: s = () => false, getVisitorKeys: a2 } } = r; - if (!o || i !== "auto") return; - if (o.length > 2) throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/en/plugins.html#optional-embed"); - let D = q((_a = o.getVisitorKeys) != null ? _a : a2), l = []; - d(); - let p = e.stack; - for (let { print: c, node: F, pathStack: m } of l) try { - e.stack = m; - let h = await c(f2, t2, e, r); - h && u.set(F, h); - } catch (h) { - if (globalThis.PRETTIER_DEBUG) throw h; - } - e.stack = p; - function f2(c, F) { - return Oi(c, F, r, n); - } - function d() { - let { node: c } = e; - if (c === null || typeof c != "object" || s(e)) return; - for (let m of D(c)) Array.isArray(c[m]) ? e.each(d, m) : e.call(d, m); - let F = o(e, r); - if (F) { - if (typeof F == "function") { - l.push({ print: F, node: c, pathStack: [...e.stack] }); - return; - } - u.set(c, F); + function Xi(e) { + let t2 = /* @__PURE__ */ new Set(), r = []; + function n(i) { + if (i.type === Ne && Yi(r), i.type === Fe) { + if (r.push(i), t2.has(i)) return false; + t2.add(i); } } + function s(i) { + i.type === Fe && r.pop().break && Yi(r); + } + Vr(e, n, s, true); } - async function Oi(e, t2, r, n) { - let u = await se({ ...r, ...t2, parentParser: r.parser, originalText: e }, { passThrough: true }), { ast: i } = await fe(e, u), o = await n(i, u); - return Xe(o); + function Ec(e) { + return e.type === me && !e.hard ? e.soft ? "" : " " : e.type === be ? e.flatContents : e; } - function Si(e, t2) { - let { originalText: r, [/* @__PURE__ */ Symbol.for("comments")]: n, locStart: u, locEnd: i, [/* @__PURE__ */ Symbol.for("printedComments")]: o } = t2, { node: s } = e, a2 = u(s), D = i(s); - for (let l of n) u(l) >= a2 && i(l) <= D && o.add(l); - return r.slice(a2, D); + function _t(e) { + return ft(e, Ec); } - var Un = Si; - async function He(e, t2) { - ({ ast: e } = await ir(e, t2)); - let r = /* @__PURE__ */ new Map(), n = new qr(e), u = cn(t2), i = /* @__PURE__ */ new Map(); - await Vn(n, s, t2, He, i); - let o = await zn(n, t2, s, void 0, i); - if (ln(t2), t2.nodeAfterCursor && !t2.nodeBeforeCursor) return [Z, o]; - if (t2.nodeBeforeCursor && !t2.nodeAfterCursor) return [o, Z]; - return o; - function s(D, l) { - return D === void 0 || D === n ? a2(l) : Array.isArray(D) ? n.call(() => a2(l), ...D) : n.call(() => a2(l), D); - } - function a2(D) { - u(n); - let l = n.node; - if (l == null) return ""; - let p = l && typeof l == "object" && D === void 0; - if (p && r.has(l)) return r.get(l); - let f2 = zn(n, t2, s, D, i); - return p && r.set(l, f2), f2; - } - } - function zn(e, t2, r, n, u) { - var a2; - let { node: i } = e, { printer: o } = t2, s; - switch ((a2 = o.hasPrettierIgnore) != null && a2.call(o, e) ? s = Un(e, t2) : u.has(i) ? s = u.get(i) : s = o.print(e, t2, r, n), i) { - case t2.cursorNode: - s = me(s, (D) => [Z, D, Z]); + function Fc(e) { + switch (We(e)) { + case Me: + if (e.parts.every((t2) => t2 === "")) return ""; break; - case t2.nodeBeforeCursor: - s = me(s, (D) => [D, Z]); + case Fe: + if (!e.contents && !e.id && !e.break && !e.expandedStates) return ""; + if (e.contents.type === Fe && e.contents.id === e.id && e.contents.break === e.break && e.contents.expandedStates === e.expandedStates) return e.contents; break; - case t2.nodeAfterCursor: - s = me(s, (D) => [Z, D]); + case Xe: + case He: + case Ve: + case $e: + if (!e.contents) return ""; break; - } - return o.printComment && (!o.willPrintOwnComments || !o.willPrintOwnComments(e, t2)) && (s = Dn(e, s, t2)), s; - } - async function ir(e, t2) { - var _a, _b; - let r = (_a = e.comments) != null ? _a : []; - t2[/* @__PURE__ */ Symbol.for("comments")] = r, t2[/* @__PURE__ */ Symbol.for("tokens")] = (_b = e.tokens) != null ? _b : [], t2[/* @__PURE__ */ Symbol.for("printedComments")] = /* @__PURE__ */ new Set(), on(e, t2); - let { printer: { preprocess: n } } = t2; - return e = n ? await n(e, t2) : e, { ast: e, comments: r }; - } - function Ti(e, t2) { - let { cursorOffset: r, locStart: n, locEnd: u } = t2, i = q(t2.printer.getVisitorKeys), o = (d) => n(d) <= r && u(d) >= r, s = e, a2 = [e]; - for (let d of Zr(e, { getVisitorKeys: i, filter: o })) a2.push(d), s = d; - if (en(s, { getVisitorKeys: i })) return { cursorNode: s }; - let D, l, p = -1, f2 = Number.POSITIVE_INFINITY; - for (; a2.length > 0 && (D === void 0 || l === void 0); ) { - s = a2.pop(); - let d = D !== void 0, c = l !== void 0; - for (let F of ye(s, { getVisitorKeys: i })) { - if (!d) { - let m = u(F); - m <= r && m > p && (D = F, p = m); - } - if (!c) { - let m = n(F); - m >= r && m < f2 && (l = F, f2 = m); + case be: + if (!e.flatContents && !e.breakContents) return ""; + break; + case Be: { + let t2 = []; + for (let r of e) { + if (!r) continue; + let [n, ...s] = Array.isArray(r) ? r : [r]; + typeof n == "string" && typeof N(0, t2, -1) == "string" ? t2[t2.length - 1] += n : t2.push(n), t2.push(...s); } + return t2.length === 0 ? "" : t2.length === 1 ? t2[0] : t2; } + case Ye: + case tt: + case rt: + case Ge: + case me: + case Pe: + case Ne: + break; + default: + throw new gt(e); } - return { nodeBeforeCursor: D, nodeAfterCursor: l }; - } - var Gn = Ti; - function ki(e, t2) { - var _a; - let { printer: { massageAstNode: r, getVisitorKeys: n } } = t2; - if (!r) return e; - let u = q(n), i = (_a = r.ignoredProperties) != null ? _a : /* @__PURE__ */ new Set(); - return o(e); - function o(s, a2) { - if (!(s !== null && typeof s == "object")) return s; - if (Array.isArray(s)) return s.map((f2) => o(f2, a2)).filter(Boolean); - let D = {}, l = new Set(u(s)); - for (let f2 in s) !Object.prototype.hasOwnProperty.call(s, f2) || i.has(f2) || (l.has(f2) ? D[f2] = o(s[f2], s) : D[f2] = s[f2]); - let p = r(s, D, a2); - if (p !== null) return p != null ? p : D; - } - } - var Kn = ki; - var Li = (e, t2, r) => { - if (!(e && t2 == null)) { - if (t2.findLastIndex) return t2.findLastIndex(r); - for (let n = t2.length - 1; n >= 0; n--) { - let u = t2[n]; - if (r(u, n, t2)) return n; - } - return -1; - } - }, Jn = Li; - var Pi = ({ parser: e }) => e === "json" || e === "json5" || e === "jsonc" || e === "json-stringify"; - function Ii(e, t2) { - let r = [e.node, ...e.parentNodes], n = /* @__PURE__ */ new Set([t2.node, ...t2.parentNodes]); - return r.find((u) => Qn.has(u.type) && n.has(u)); - } - function qn(e) { - let t2 = Jn(false, e, (r) => r.type !== "Program" && r.type !== "File"); - return t2 === -1 ? e : e.slice(0, t2 + 1); - } - function Ri(e, t2, { locStart: r, locEnd: n }) { - let u = e.node, i = t2.node; - if (u === i) return { startNode: u, endNode: i }; - let o = r(e.node); - for (let a2 of qn(t2.parentNodes)) if (r(a2) >= o) i = a2; - else break; - let s = n(t2.node); - for (let a2 of qn(e.parentNodes)) { - if (n(a2) <= s) u = a2; - else break; - if (u === i) break; - } - return { startNode: u, endNode: i }; - } - function or(e, t2, r, n, u = [], i) { - let { locStart: o, locEnd: s } = r, a2 = o(e), D = s(e); - if (!(t2 > D || t2 < a2 || i === "rangeEnd" && t2 === a2 || i === "rangeStart" && t2 === D)) { - for (let l of it(e, r)) { - let p = or(l, t2, r, n, [e, ...u], i); - if (p) return p; - } - if (!n || n(e, u[0])) return { node: e, parentNodes: u }; - } - } - function Yi(e, t2) { - return t2 !== "DeclareExportDeclaration" && e !== "TypeParameterDeclaration" && (e === "Directive" || e === "TypeAlias" || e === "TSExportAssignment" || e.startsWith("Declare") || e.startsWith("TSDeclare") || e.endsWith("Statement") || e.endsWith("Declaration")); - } - var Qn = /* @__PURE__ */ new Set(["JsonRoot", "ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral", "UnaryExpression", "TemplateLiteral"]), ji = /* @__PURE__ */ new Set(["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"]); - function Xn(e, t2, r) { - if (!t2) return false; - switch (e.parser) { - case "flow": - case "babel": - case "babel-flow": - case "babel-ts": - case "typescript": - case "acorn": - case "espree": - case "meriyah": - case "__babel_estree": - return Yi(t2.type, r == null ? void 0 : r.type); - case "json": - case "json5": - case "jsonc": - case "json-stringify": - return Qn.has(t2.type); - case "graphql": - return ji.has(t2.kind); - case "vue": - return t2.tag !== "root"; - } - return false; - } - function Zn(e, t2, r) { - let { rangeStart: n, rangeEnd: u, locStart: i, locEnd: o } = t2; - Pe.ok(u > n); - let s = e.slice(n, u).search(/\S/u), a2 = s === -1; - if (!a2) for (n += s; u > n && !/\S/u.test(e[u - 1]); --u) ; - let D = or(r, n, t2, (d, c) => Xn(t2, d, c), [], "rangeStart"), l = a2 ? D : or(r, u, t2, (d) => Xn(t2, d), [], "rangeEnd"); - if (!D || !l) return { rangeStart: 0, rangeEnd: 0 }; - let p, f2; - if (Pi(t2)) { - let d = Ii(D, l); - p = d, f2 = d; - } else ({ startNode: p, endNode: f2 } = Ri(D, l, t2)); - return { rangeStart: Math.min(i(p), i(f2)), rangeEnd: Math.max(o(p), o(f2)) }; - } - var nu = "\uFEFF", eu = /* @__PURE__ */ Symbol("cursor"); - async function uu(e, t2, r = 0) { - if (!e || e.trim().length === 0) return { formatted: "", cursorOffset: -1, comments: [] }; - let { ast: n, text: u } = await fe(e, t2); - t2.cursorOffset >= 0 && (t2 = { ...t2, ...Gn(n, t2) }); - let i = await He(n, t2, r); - r > 0 && (i = et([K, i], r, t2.tabWidth)); - let o = Ce(i, t2); - if (r > 0) { - let a2 = o.formatted.trim(); - o.cursorNodeStart !== void 0 && (o.cursorNodeStart -= o.formatted.indexOf(a2), o.cursorNodeStart < 0 && (o.cursorNodeStart = 0, o.cursorNodeText = o.cursorNodeText.trimStart()), o.cursorNodeStart + o.cursorNodeText.length > a2.length && (o.cursorNodeText = o.cursorNodeText.trimEnd())), o.formatted = a2 + be(t2.endOfLine); - } - let s = t2[/* @__PURE__ */ Symbol.for("comments")]; - if (t2.cursorOffset >= 0) { - let a2, D, l, p; - if ((t2.cursorNode || t2.nodeBeforeCursor || t2.nodeAfterCursor) && o.cursorNodeText) if (l = o.cursorNodeStart, p = o.cursorNodeText, t2.cursorNode) a2 = t2.locStart(t2.cursorNode), D = u.slice(a2, t2.locEnd(t2.cursorNode)); - else { - if (!t2.nodeBeforeCursor && !t2.nodeAfterCursor) throw new Error("Cursor location must contain at least one of cursorNode, nodeBeforeCursor, nodeAfterCursor"); - a2 = t2.nodeBeforeCursor ? t2.locEnd(t2.nodeBeforeCursor) : 0; - let h = t2.nodeAfterCursor ? t2.locStart(t2.nodeAfterCursor) : u.length; - D = u.slice(a2, h); - } - else a2 = 0, D = u, l = 0, p = o.formatted; - let f2 = t2.cursorOffset - a2; - if (D === p) return { formatted: o.formatted, cursorOffset: l + f2, comments: s }; - let d = D.split(""); - d.splice(f2, 0, eu); - let c = p.split(""), F = yr(d, c), m = l; - for (let h of F) if (h.removed) { - if (h.value.includes(eu)) break; - } else m += h.count; - return { formatted: o.formatted, cursorOffset: m, comments: s }; - } - return { formatted: o.formatted, cursorOffset: -1, comments: s }; - } - async function Hi(e, t2) { - let { ast: r, text: n } = await fe(e, t2), { rangeStart: u, rangeEnd: i } = Zn(n, t2, r), o = n.slice(u, i), s = Math.min(u, n.lastIndexOf(` -`, u) + 1), a2 = n.slice(s, u).match(/^\s*/u)[0], D = ge(a2, t2.tabWidth), l = await uu(o, { ...t2, rangeStart: 0, rangeEnd: Number.POSITIVE_INFINITY, cursorOffset: t2.cursorOffset > u && t2.cursorOffset <= i ? t2.cursorOffset - u : -1, endOfLine: "lf" }, D), p = l.formatted.trimEnd(), { cursorOffset: f2 } = t2; - f2 > i ? f2 += p.length - o.length : l.cursorOffset >= 0 && (f2 = l.cursorOffset + u); - let d = n.slice(0, u) + p + n.slice(i); - if (t2.endOfLine !== "lf") { - let c = be(t2.endOfLine); - f2 >= 0 && c === `\r -` && (f2 += Nt(d.slice(0, f2), ` -`)), d = ne(false, d, ` -`, c); - } - return { formatted: d, cursorOffset: f2, comments: l.comments }; + return e; } - function sr(e, t2, r) { - return typeof t2 != "number" || Number.isNaN(t2) || t2 < 0 || t2 > e.length ? r : t2; + function Qt(e) { + return ft(e, (t2) => Fc(t2)); } - function tu(e, t2) { - let { cursorOffset: r, rangeStart: n, rangeEnd: u } = t2; - return r = sr(e, r, -1), n = sr(e, n, 0), u = sr(e, u, e.length), { ...t2, cursorOffset: r, rangeStart: n, rangeEnd: u }; + function qe(e, t2 = $r) { + return ft(e, (r) => typeof r == "string" ? L(t2, r.split(` +`)) : r); } - function iu(e, t2) { - let { cursorOffset: r, rangeStart: n, rangeEnd: u, endOfLine: i } = tu(e, t2), o = e.charAt(0) === nu; - if (o && (e = e.slice(1), r--, n--, u--), i === "auto" && (i = Ar(e)), e.includes("\r")) { - let s = (a2) => Nt(e.slice(0, Math.max(a2, 0)), `\r -`); - r -= s(r), n -= s(n), u -= s(u), e = vr(e); - } - return { hasBOM: o, text: e, options: tu(e, { ...t2, cursorOffset: r, rangeStart: n, rangeEnd: u, endOfLine: i }) }; + function dc(e) { + if (e.type === me) return true; } - async function ru(e, t2) { - let r = await Ct(t2); - return !r.hasPragma || r.hasPragma(e); + function Vi(e) { + return Hi(e, dc, false); } - async function ar(e, t2) { - let { hasBOM: r, text: n, options: u } = iu(e, await se(t2)); - if (u.rangeStart >= u.rangeEnd && n !== "" || u.requirePragma && !await ru(n, u)) return { formatted: e, cursorOffset: t2.cursorOffset, comments: [] }; - let i; - return u.rangeStart > 0 || u.rangeEnd < n.length ? i = await Hi(n, u) : (!u.requirePragma && u.insertPragma && u.printer.insertPragma && !await ru(n, u) && (n = u.printer.insertPragma(n)), i = await uu(n, u)), r && (i.formatted = nu + i.formatted, i.cursorOffset >= 0 && i.cursorOffset++), i; + function Ar(e, t2) { + return e.type === Pe ? { ...e, contents: t2(e.contents) } : t2(e); } - async function ou(e, t2, r) { - let { text: n, options: u } = iu(e, await se(t2)), i = await fe(n, u); - return r && (r.preprocessForPrint && (i.ast = await ir(i.ast, u)), r.massage && (i.ast = Kn(i.ast, u))), i; + function $i(e) { + let t2 = true; + return Vr(e, (r) => { + switch (We(r)) { + case Ye: + if (r === "") break; + case rt: + case Ge: + case me: + case Ne: + return t2 = false, false; + } + }), t2; } - async function su(e, t2) { - t2 = await se(t2); - let r = await He(e, t2); - return Ce(r, t2); + var de = Le, Kr = Le, Ki = Le, Qi = Le; + function m(e) { + return de(e), { type: He, contents: e }; } - async function au(e, t2) { - let r = Vr(e), { formatted: n } = await ar(r, { ...t2, parser: "__js_expression" }); - return n; + function xe(e, t2) { + return Qi(e), de(t2), { type: Xe, contents: t2, n: e }; } - async function Du(e, t2) { - t2 = await se(t2); - let { ast: r } = await fe(e, t2); - return He(r, t2); + function zi(e) { + return xe(Number.NEGATIVE_INFINITY, e); } - async function lu(e, t2) { - return Ce(e, await se(t2)); + function Qr(e) { + return xe(-1, e); } - var Dr = {}; - vt(Dr, { builders: () => $i, printer: () => Mi, utils: () => Vi }); - var $i = { join: Se, line: Ze, softline: $r, hardline: K, literalline: Qe, group: kt, conditionalGroup: Ir, fill: Rr, lineSuffix: Te, lineSuffixBoundary: Hr, cursor: Z, breakParent: he, ifBreak: Yr, trim: Wr, indent: le, indentIfBreak: jr, align: De, addAlignmentToDoc: et, markAsRoot: Lr, dedentToRoot: kr, dedent: Pr, hardlineWithoutBreakParent: ke, literallineWithoutBreakParent: Lt, label: Mr, concat: (e) => e }, Mi = { printDocToString: Ce }, Vi = { willBreak: xr, traverseDoc: Fe, findInDoc: qe, mapDoc: Oe, removeLines: Nr, stripTrailingHardline: Xe, replaceEndOfLine: Or, canBreak: Sr }; - var cu = "3.5.1"; - var cr = {}; - vt(cr, { addDanglingComment: () => re, addLeadingComment: () => ue, addTrailingComment: () => ie, getAlignmentSize: () => ge, getIndentSize: () => fu, getMaxContinuousCount: () => du, getNextNonSpaceNonCommentCharacter: () => pu, getNextNonSpaceNonCommentCharacterIndex: () => no, getPreferredQuote: () => mu, getStringWidth: () => Le, hasNewline: () => V, hasNewlineInRange: () => hu, hasSpaces: () => Eu, isNextLineEmpty: () => so, isNextLineEmptyAfterIndex: () => gt, isPreviousLineEmpty: () => io, makeString: () => Cu, skip: () => Ae, skipEverythingButNewLine: () => ut, skipInlineComment: () => Be, skipNewline: () => W, skipSpaces: () => S, skipToLineEnd: () => nt, skipTrailingComment: () => we, skipWhitespace: () => tn }); - function Ui(e, t2) { - if (t2 === false) return false; - if (e.charAt(t2) === "/" && e.charAt(t2 + 1) === "*") { - for (let r = t2 + 2; r < e.length; ++r) if (e.charAt(r) === "*" && e.charAt(r + 1) === "/") return r + 2; + function Zi(e, t2, r) { + de(e); + let n = e; + if (t2 > 0) { + for (let s = 0; s < Math.floor(t2 / r); ++s) n = m(n); + n = xe(t2 % r, n), n = xe(Number.NEGATIVE_INFINITY, n); } - return t2; - } - var Be = Ui; - function zi(e, t2) { - return t2 === false ? false : e.charAt(t2) === "/" && e.charAt(t2 + 1) === "/" ? ut(e, t2) : t2; - } - var we = zi; - function Gi(e, t2) { - let r = null, n = t2; - for (; n !== r; ) r = n, n = S(e, n), n = Be(e, n), n = we(e, n), n = W(e, n); return n; } - var We = Gi; - function Ki(e, t2) { - let r = null, n = t2; - for (; n !== r; ) r = n, n = nt(e, n), n = Be(e, n), n = S(e, n); - return n = we(e, n), n = W(e, n), n !== false && V(e, n); - } - var gt = Ki; - function Ji(e, t2) { - let r = e.lastIndexOf(` -`); - return r === -1 ? 0 : ge(e.slice(r + 1).match(/^[\t ]*/u)[0], t2); - } - var fu = Ji; - function lr(e) { - if (typeof e != "string") throw new TypeError("Expected a string"); - return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"); + var ke = { type: Ne }; + var Tr = { type: tt }; + function zr(e) { + return Ki(e), { type: Me, parts: e }; } - function qi(e, t2) { - let r = e.match(new RegExp(`(${lr(t2)})+`, "gu")); - return r === null ? 0 : r.reduce((n, u) => Math.max(n, u.length / t2.length), 0); + function l(e, t2 = {}) { + return de(e), Kr(t2.expandedStates, true), { type: Fe, id: t2.id, contents: e, break: !!t2.shouldBreak, expandedStates: t2.expandedStates }; } - var du = qi; - function Xi(e, t2) { - let r = We(e, t2); - return r === false ? "" : e.charAt(r); + function nt(e, t2) { + return l(e[0], { ...t2, expandedStates: e }); } - var pu = Xi; - var yt = "'", Fu = '"'; - function Qi(e, t2) { - let r = t2 === true || t2 === yt ? yt : Fu, n = r === yt ? Fu : yt, u = 0, i = 0; - for (let o of e) o === r ? u++ : o === n && i++; - return u > i ? n : r; + function P(e, t2 = "", r = {}) { + return de(e), t2 !== "" && de(t2), { type: be, breakContents: e, flatContents: t2, groupId: r.groupId }; } - var mu = Qi; - function Zi(e, t2, r) { - for (let n = t2; n < r; ++n) if (e.charAt(n) === ` -`) return true; - return false; + function yt(e, t2) { + return de(e), { type: Ve, contents: e, groupId: t2.groupId, negate: t2.negate }; } - var hu = Zi; - function eo(e, t2, r = {}) { - return S(e, r.backwards ? t2 - 1 : t2, r) !== t2; + function L(e, t2) { + de(e), Kr(t2); + let r = []; + for (let n = 0; n < t2.length; n++) n !== 0 && r.push(e), r.push(t2[n]); + return r; } - var Eu = eo; + function pt(e, t2) { + return de(t2), e ? { type: Pe, label: e, contents: t2 } : t2; + } + var A2 = { type: me }, f2 = { type: me, soft: true }, us = { type: me, hard: true }, E = [us, ke], Cc = { type: me, hard: true, literal: true }, $r = [Cc, ke]; + function as(e) { + return de(e), { type: $e, contents: e }; + } + var je = { type: Ge }; + var Ac = "cr", Tc = "crlf"; + var xc = "\r", gc = `\r +`, hc = ` +`, Sc = hc; + function eo(e) { + return e === Ac ? xc : e === Tc ? gc : Sc; + } + var Bc = { type: 0 }, bc = { type: 1 }, ps = { value: "", length: 0, queue: [], get root() { + return ps; + } }; function to(e, t2, r) { - let n = t2 === '"' ? "'" : '"', i = ne(false, e, /\\(.)|(["'])/gsu, (o, s, a2) => s === n ? s : a2 === t2 ? "\\" + a2 : a2 || (r && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(s) ? s : "\\" + s)); - return t2 + i + t2; + let n = t2.type === 1 ? e.queue.slice(0, -1) : [...e.queue, t2], s = "", i = 0, o = 0, u = 0; + for (let d of n) switch (d.type) { + case 0: + y(), r.useTabs ? p(1) : c(r.tabWidth); + break; + case 3: { + let { string: b } = d; + y(), s += b, i += b.length; + break; + } + case 2: { + let { width: b } = d; + o += 1, u += b; + break; + } + default: + throw new Error(`Unexpected indent comment '${d.type}'.`); + } + return F(), { ...e, value: s, length: i, queue: n }; + function p(d) { + s += " ".repeat(d), i += r.tabWidth * d; + } + function c(d) { + s += " ".repeat(d), i += d; + } + function y() { + r.useTabs ? D() : F(); + } + function D() { + o > 0 && p(o), C(); + } + function F() { + u > 0 && c(u), C(); + } + function C() { + o = 0, u = 0; + } } - var Cu = to; function ro(e, t2, r) { - return We(e, r(t2)); + if (!t2) return e; + if (t2.type === "root") return { ...e, root: e }; + if (t2 === Number.NEGATIVE_INFINITY) return e.root; + let n; + return typeof t2 == "number" ? t2 < 0 ? n = bc : n = { type: 2, width: t2 } : n = { type: 3, string: t2 }, to(e, n, r); } function no(e, t2) { - return arguments.length === 2 || typeof t2 == "number" ? We(e, t2) : ro(...arguments); - } - function uo(e, t2, r) { - return Ie(e, r(t2)); - } - function io(e, t2) { - return arguments.length === 2 || typeof t2 == "number" ? Ie(e, t2) : uo(...arguments); + return to(e, Bc, t2); } - function oo(e, t2, r) { - return gt(e, r(t2)); - } - function so(e, t2) { - return arguments.length === 2 || typeof t2 == "number" ? gt(e, t2) : oo(...arguments); - } - function de(e, t2 = 1) { - return async (...r) => { - var _a, _b; - let n = (_a = r[t2]) != null ? _a : {}, u = (_b = n.plugins) != null ? _b : []; - return r[t2] = { ...n, plugins: Array.isArray(u) ? u : Object.values(u) }, e(...r); - }; + function Pc(e) { + let t2 = 0; + for (let r = e.length - 1; r >= 0; r--) { + let n = e[r]; + if (n === " " || n === " ") t2++; + else break; + } + return t2; } - var gu = de(ar); - async function yu(e, t2) { - let { formatted: r } = await gu(e, { ...t2, cursorOffset: -1 }); - return r; + function cs(e) { + let t2 = Pc(e); + return { text: t2 === 0 ? e : e.slice(0, e.length - t2), count: t2 }; } - async function ao(e, t2) { - return await yu(e, t2) === e; + var ve = /* @__PURE__ */ Symbol("MODE_BREAK"), ct = /* @__PURE__ */ Symbol("MODE_FLAT"), ls = /* @__PURE__ */ Symbol("DOC_FILL_PRINTED_LENGTH"); + function Zr(e, t2, r, n, s, i) { + var _a3; + if (r === Number.POSITIVE_INFINITY) return true; + let o = t2.length, u = false, p = [e], c = ""; + for (; r >= 0; ) { + if (p.length === 0) { + if (o === 0) return true; + p.push(t2[--o]); + continue; + } + let { mode: y, doc: D } = p.pop(), F = We(D); + switch (F) { + case Ye: + D && (u && (c += " ", r -= 1, u = false), c += D, r -= ot(D)); + break; + case Be: + case Me: { + let C = F === Be ? D : D.parts, d = (_a3 = D[ls]) != null ? _a3 : 0; + for (let b = C.length - 1; b >= d; b--) p.push({ mode: y, doc: C[b] }); + break; + } + case He: + case Xe: + case Ve: + case Pe: + p.push({ mode: y, doc: D.contents }); + break; + case rt: { + let { text: C, count: d } = cs(c); + c = C, r += d; + break; + } + case Fe: { + if (i && D.break) return false; + let C = D.break ? ve : y, d = D.expandedStates && C === ve ? N(0, D.expandedStates, -1) : D.contents; + p.push({ mode: C, doc: d }); + break; + } + case be: { + let d = (D.groupId ? s[D.groupId] || ct : y) === ve ? D.breakContents : D.flatContents; + d && p.push({ mode: y, doc: d }); + break; + } + case me: + if (y === ve || D.hard) return true; + D.soft || (u = true); + break; + case $e: + n = true; + break; + case Ge: + if (n) return false; + break; + } + } + return false; } - var Do = de(ot, 0), lo = { parse: de(ou), formatAST: de(su), formatDoc: de(au), printToDoc: de(Du), printDocToString: de(lu) }; - return xu(co); - }); - } -}); - -// ../../node_modules/lodash/lodash.js -var require_lodash = __commonJS({ - "../../node_modules/lodash/lodash.js"(exports, module) { - (function() { - var undefined2; - var VERSION = "4.17.21"; - var LARGE_ARRAY_SIZE = 200; - var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`"; - var HASH_UNDEFINED = "__lodash_hash_undefined__"; - var MAX_MEMOIZE_SIZE = 500; - var PLACEHOLDER = "__lodash_placeholder__"; - var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4; - var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; - 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; - var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "..."; - var HOT_COUNT = 800, HOT_SPAN = 16; - var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3; - var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0; - var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; - 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] - ]; - var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag2 = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag2 = "[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]"; - var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; - var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source); - var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; - var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); - var reTrimStart = /^\s+/; - var reWhitespace = /\s/; - var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /; - var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; - var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; - var reEscapeChar = /\\(\\)?/g; - var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - var reFlags = /\w*$/; - var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; - var reIsBinary = /^0b[01]+$/i; - var reIsHostCtor = /^\[object .+?Constructor\]$/; - var reIsOctal = /^0o[0-7]+$/i; - var reIsUint = /^(?:0|[1-9]\d*)$/; - var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; - var reNoMatch = /($^)/; - var reUnescapedString = /['\n\r\u2028\u2029\\]/g; - 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; - 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"; - 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("|") + ")"; - var reApos = RegExp(rsApos, "g"); - var reComboMark = RegExp(rsCombo, "g"); - var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g"); - 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"); - var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]"); - 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 ]/; - 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" - ]; - var templateCounter = -1; - 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[boolTag2] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; - var cloneableTags = {}; - cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag2] = 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; - 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" - }; - var htmlEscapes = { - "&": "&", - "<": "<", - ">": ">", - '"': """, - "'": "'" - }; - var htmlUnescapes = { - "&": "&", - "<": "<", - ">": ">", - """: '"', - "'": "'" - }; - var stringEscapes = { - "\\": "\\", - "'": "'", - "\n": "n", - "\r": "r", - "\u2028": "u2028", - "\u2029": "u2029" - }; - var freeParseFloat = parseFloat, freeParseInt = parseInt; - var freeGlobal = typeof global == "object" && global && global.Object === Object && global; - var freeSelf = typeof self == "object" && self && self.Object === Object && self; - var root = freeGlobal || freeSelf || Function("return this")(); - var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports; - var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module; - var moduleExports = freeModule && freeModule.exports === freeExports; - var freeProcess = moduleExports && freeGlobal.process; - var nodeUtil = (function() { - try { - var types = freeModule && freeModule.require && freeModule.require("util").types; - if (types) { - return types; + function ms(e, t2) { + var _a3; + let r = /* @__PURE__ */ Object.create(null), n = t2.printWidth, s = eo(t2.endOfLine), i = 0, o = [{ indent: ps, mode: ve, doc: e }], u = "", p = false, c = [], y = [], D = [], F = [], C = 0; + for (Xi(e); o.length > 0; ) { + let { indent: h, mode: g, doc: S } = o.pop(); + switch (We(S)) { + case Ye: { + let j = s !== ` +` ? W(0, S, ` +`, s) : S; + j && (u += j, o.length > 0 && (i += ot(j))); + break; + } + case Be: + for (let j = S.length - 1; j >= 0; j--) o.push({ indent: h, mode: g, doc: S[j] }); + break; + case tt: + if (y.length >= 2) throw new Error("There are too many 'cursor' in doc."); + y.push(C + u.length); + break; + case He: + o.push({ indent: no(h, t2), mode: g, doc: S.contents }); + break; + case Xe: + o.push({ indent: ro(h, S.n, t2), mode: g, doc: S.contents }); + break; + case rt: + O(); + break; + case Fe: + switch (g) { + case ct: + if (!p) { + o.push({ indent: h, mode: S.break ? ve : ct, doc: S.contents }); + break; + } + case ve: { + p = false; + let j = { indent: h, mode: ct, doc: S.contents }, U = n - i, fe = c.length > 0; + if (!S.break && Zr(j, o, U, fe, r)) o.push(j); + else if (S.expandedStates) { + let Y = N(0, S.expandedStates, -1); + if (S.break) { + o.push({ indent: h, mode: ve, doc: Y }); + break; + } else for (let z = 1; z < S.expandedStates.length + 1; z++) if (z >= S.expandedStates.length) { + o.push({ indent: h, mode: ve, doc: Y }); + break; + } else { + let ee = S.expandedStates[z], Ie = { indent: h, mode: ct, doc: ee }; + if (Zr(Ie, o, U, fe, r)) { + o.push(Ie); + break; + } + } + } else o.push({ indent: h, mode: ve, doc: S.contents }); + break; + } + } + S.id && (r[S.id] = N(0, o, -1).mode); + break; + case Me: { + let j = n - i, U = (_a3 = S[ls]) != null ? _a3 : 0, { parts: fe } = S, Y = fe.length - U; + if (Y === 0) break; + let z = fe[U + 0], ee = fe[U + 1], Ie = { indent: h, mode: ct, doc: z }, st = { indent: h, mode: ve, doc: z }, _ = Zr(Ie, [], j, c.length > 0, r, true); + if (Y === 1) { + _ ? o.push(Ie) : o.push(st); + break; + } + let re = { indent: h, mode: ct, doc: ee }, ae = { indent: h, mode: ve, doc: ee }; + if (Y === 2) { + _ ? o.push(re, Ie) : o.push(ae, st); + break; + } + let it = fe[U + 2], Bt = { indent: h, mode: g, doc: { ...S, [ls]: U + 2 } }, Pr = Zr({ indent: h, mode: ct, doc: [z, ee, it] }, [], j, c.length > 0, r, true); + o.push(Bt), Pr ? o.push(re, Ie) : _ ? o.push(ae, Ie) : o.push(ae, st); + break; + } + case be: + case Ve: { + let j = S.groupId ? r[S.groupId] : g; + if (j === ve) { + let U = S.type === be ? S.breakContents : S.negate ? S.contents : m(S.contents); + U && o.push({ indent: h, mode: g, doc: U }); + } + if (j === ct) { + let U = S.type === be ? S.flatContents : S.negate ? m(S.contents) : S.contents; + U && o.push({ indent: h, mode: g, doc: U }); + } + break; + } + case $e: + c.push({ indent: h, mode: g, doc: S.contents }); + break; + case Ge: + c.length > 0 && o.push({ indent: h, mode: g, doc: us }); + break; + case me: + switch (g) { + case ct: + if (S.hard) p = true; + else { + S.soft || (u += " ", i += 1); + break; + } + case ve: + if (c.length > 0) { + o.push({ indent: h, mode: g, doc: S }, ...c.reverse()), c.length = 0; + break; + } + S.literal ? (u += s, i = 0, h.root && (h.root.value && (u += h.root.value), i = h.root.length)) : (O(), u += s + h.value, i = h.length); + break; + } + break; + case Pe: + o.push({ indent: h, mode: g, doc: S.contents }); + break; + case Ne: + break; + default: + throw new gt(S); } - return freeProcess && freeProcess.binding && freeProcess.binding("util"); - } catch (e) { + o.length === 0 && c.length > 0 && (o.push(...c.reverse()), c.length = 0); } - })(); - 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; - 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); - } - 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; - } - function arrayEach(array, iteratee) { - var index = -1, length = array == null ? 0 : array.length; - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } + let d = D.join("") + u, b = [...F, ...y]; + if (b.length !== 2) return { formatted: d }; + let B = b[0]; + return { formatted: d, cursorNodeStart: B, cursorNodeText: d.slice(B, N(0, b, -1)) }; + function O() { + let { text: h, count: g } = cs(u); + h && (D.push(h), C += h.length), u = "", i -= g, y.length > 0 && (F.push(...y.map((S) => Math.min(S, C))), y.length = 0); } - return array; } - function arrayEachRight(array, iteratee) { - var length = array == null ? 0 : array.length; - while (length--) { - if (iteratee(array[length], length, array) === false) { - break; - } - } - return array; + function kc(e, t2, r = 0) { + let n = 0; + for (let s = r; s < e.length; ++s) e[s] === " " ? n = n + t2 - n % t2 : n++; + return n; } - 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; + var so = kc; + function Ic(e, t2) { + let r = e.lastIndexOf(` +`); + return r === -1 ? 0 : so(e.slice(r + 1).match(/^[\t ]*/u)[0], t2); } - 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; + var io = Ic; + function en(e, t2, r) { + let { node: n } = e; + if (n.type === "TemplateLiteral" && wc(e)) { + let c = Lc(e, t2, r); + if (c) return c; + } + let i = "expressions"; + n.type === "TSTemplateLiteralType" && (i = "types"); + let o = [], u = e.map(r, i); + o.push(je, "`"); + let p = 0; + return e.each(({ index: c, node: y }) => { + if (o.push(r()), y.tail) return; + let { tabWidth: D } = t2, F = y.value.raw, C = F.includes(` +`) ? io(F, D) : p; + p = C; + let d = u[c], b = n[i][c], B = ue(t2.originalText, I(y), w(n.quasis[c + 1])); + if (!B) { + let h = ms(d, { ...t2, printWidth: Number.POSITIVE_INFINITY }).formatted; + h.includes(` +`) ? B = true : d = h; + } + B && (T(b) || b.type === "Identifier" || J(b) || b.type === "ConditionalExpression" || b.type === "SequenceExpression" || Ae(b) || Te(b)) && (d = [m([f2, d]), f2]); + let O = C === 0 && F.endsWith(` +`) ? xe(Number.NEGATIVE_INFINITY, d) : Zi(d, C, D); + o.push(l(["${", O, je, "}"])); + }, "quasis"), o.push("`"), o; } - function arrayIncludes(array, value) { - var length = array == null ? 0 : array.length; - return !!length && baseIndexOf(array, value, 0) > -1; + function oo(e, t2, r) { + var _a3; + let n = r("quasi"), { node: s } = e, i = "", o = et(s.quasi, x.Leading)[0]; + return o && (ue(t2.originalText, I((_a3 = s.typeArguments) != null ? _a3 : s.tag), w(o)) ? i = f2 : i = " "), pt(n.label && { tagged: true, ...n.label }, [r("tag"), r("typeArguments"), i, je, n]); } - function arrayIncludesWith(array, value, comparator) { - var index = -1, length = array == null ? 0 : array.length; - while (++index < length) { - if (comparator(value, array[index])) { - return true; + function Lc(e, t2, r) { + let { node: n } = e, s = n.quasis[0].value.raw.trim().split(/\s*\|\s*/u); + if (s.length > 1 || s.some((i) => i.length > 0)) { + t2.__inJestEach = true; + let i = e.map(r, "expressions"); + t2.__inJestEach = false; + let o = i.map((D) => "${" + ms(D, { ...t2, printWidth: Number.POSITIVE_INFINITY, endOfLine: "lf" }).formatted + "}"), u = [{ hasLineBreak: false, cells: [] }]; + for (let D = 1; D < n.quasis.length; D++) { + let F = N(0, u, -1), C = o[D - 1]; + F.cells.push(C), C.includes(` +`) && (F.hasLineBreak = true), n.quasis[D].value.raw.includes(` +`) && u.push({ hasLineBreak: false, cells: [] }); } + let p = Math.max(s.length, ...u.map((D) => D.cells.length)), c = Array.from({ length: p }).fill(0), y = [{ cells: s }, ...u.filter((D) => D.cells.length > 0)]; + for (let { cells: D } of y.filter((F) => !F.hasLineBreak)) for (let [F, C] of D.entries()) c[F] = Math.max(c[F], ot(C)); + return [je, "`", m([E, L(E, y.map((D) => L(" | ", D.cells.map((F, C) => D.hasLineBreak ? F : F + " ".repeat(c[C] - ot(F))))))]), E, "`"]; } - return false; } - 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; + function Oc(e, t2) { + let { node: r } = e, n = t2(); + return T(r) && (n = l([m([f2, n]), f2])), ["${", n, je, "}"]; } - function arrayPush(array, values) { - var index = -1, length = values.length, offset = array.length; - while (++index < length) { - array[offset + index] = values[index]; - } - return array; + function zt(e, t2) { + return e.map(() => Oc(e, t2), "expressions"); } - 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; + function tn(e, t2) { + return ft(e, (r) => typeof r == "string" ? t2 ? W(0, r, /(\\*)`/gu, "$1$1\\`") : Ds(r) : r); } - 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; + function Ds(e) { + return W(0, e, /([\\`]|\$\{)/gu, "\\$1"); } - 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; + function wc({ node: e, parent: t2 }) { + let r = /^[fx]?(?:describe|it|test)$/u; + return t2.type === "TaggedTemplateExpression" && t2.quasi === e && t2.tag.type === "MemberExpression" && t2.tag.property.type === "Identifier" && t2.tag.property.name === "each" && (t2.tag.object.type === "Identifier" && r.test(t2.tag.object.name) || t2.tag.object.type === "MemberExpression" && t2.tag.object.property.type === "Identifier" && (t2.tag.object.property.name === "only" || t2.tag.object.property.name === "skip") && t2.tag.object.object.type === "Identifier" && r.test(t2.tag.object.object.name)); } - var asciiSize = baseProperty("length"); - function asciiToArray(string2) { - return string2.split(""); + var ys = [(e, t2) => e.type === "ObjectExpression" && t2 === "properties", (e, t2) => e.type === "CallExpression" && e.callee.type === "Identifier" && e.callee.name === "Component" && t2 === "arguments", (e, t2) => e.type === "Decorator" && t2 === "expression"]; + function uo(e) { + let t2 = (n) => n.type === "TemplateLiteral", r = (n, s) => Oe(n) && !n.computed && n.key.type === "Identifier" && n.key.name === "styles" && s === "value"; + return e.match(t2, (n, s) => q(n) && s === "elements", r, ...ys) || e.match(t2, r, ...ys); } - function asciiWords(string2) { - return string2.match(reAsciiWord) || []; + function Es(e) { + return e.match((t2) => t2.type === "TemplateLiteral", (t2, r) => Oe(t2) && !t2.computed && t2.key.type === "Identifier" && t2.key.name === "template" && r === "value", ...ys); } - function baseFindKey(collection, predicate, eachFunc) { - var result; - eachFunc(collection, function(value, key, collection2) { - if (predicate(value, key, collection2)) { - result = key; - return false; - } - }); - return result; + function fs(e, t2) { + return T(e, x.Block | x.Leading, ({ value: r }) => r === ` ${t2} `); } - 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; + function rn({ node: e, parent: t2 }, r) { + return fs(e, r) || _c(t2) && fs(t2, r) || t2.type === "ExpressionStatement" && fs(t2, r); } - function baseIndexOf(array, value, fromIndex) { - return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); + function _c(e) { + return e.type === "AsConstExpression" || e.type === "TSAsExpression" && e.typeAnnotation.type === "TSTypeReference" && e.typeAnnotation.typeName.type === "Identifier" && e.typeAnnotation.typeName.name === "const"; } - function baseIndexOfWith(array, value, fromIndex, comparator) { - var index = fromIndex - 1, length = array.length; - while (++index < length) { - if (comparator(array[index], value)) { - return index; - } + async function po(e, t2, r) { + let { node: n } = r, s = ""; + for (let [p, c] of n.quasis.entries()) { + let { raw: y } = c.value; + p > 0 && (s += "@prettier-placeholder-" + (p - 1) + "-id"), s += y; } - return -1; + let i = await e(s, { parser: "scss" }), o = zt(r, t2), u = Mc(i, o); + if (!u) throw new Error("Couldn't insert all the expressions"); + return ["`", m([E, u]), f2, "`"]; } - function baseIsNaN(value) { - return value !== value; - } - function baseMean(array, iteratee) { - var length = array == null ? 0 : array.length; - return length ? baseSum(array, iteratee) / length : NAN; + function Mc(e, t2) { + if (!R(t2)) return e; + let r = 0, n = ft(Qt(e), (s) => typeof s != "string" || !s.includes("@prettier-placeholder") ? s : s.split(/@prettier-placeholder-(\d+)-id/u).map((i, o) => o % 2 === 0 ? qe(i) : (r++, t2[i]))); + return t2.length === r ? n : null; } - function baseProperty(key) { - return function(object) { - return object == null ? undefined2 : object[key]; - }; + function Nc(e) { + return e.match(void 0, (t2, r) => r === "quasi" && t2.type === "TaggedTemplateExpression" && Pt(t2.tag, ["css", "css.global", "css.resolve"])) || e.match(void 0, (t2, r) => r === "expression" && t2.type === "JSXExpressionContainer", (t2, r) => r === "children" && t2.type === "JSXElement" && t2.openingElement.name.type === "JSXIdentifier" && t2.openingElement.name.name === "style" && t2.openingElement.attributes.some((n) => n.type === "JSXAttribute" && n.name.type === "JSXIdentifier" && n.name.name === "jsx")); } - function basePropertyOf(object) { - return function(key) { - return object == null ? undefined2 : object[key]; - }; + function nn(e) { + return e.type === "Identifier" && e.name === "styled"; } - function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { - eachFunc(collection, function(value, index, collection2) { - accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2); - }); - return accumulator; + function ao(e) { + return /^[A-Z]/u.test(e.object.name) && e.property.name === "extend"; } - function baseSortBy(array, comparer) { - var length = array.length; - array.sort(comparer); - while (length--) { - array[length] = array[length].value; + function jc({ parent: e }) { + if (!e || e.type !== "TaggedTemplateExpression") return false; + let t2 = e.tag.type === "ParenthesizedExpression" ? e.tag.expression : e.tag; + switch (t2.type) { + case "MemberExpression": + return nn(t2.object) || ao(t2); + case "CallExpression": + return nn(t2.callee) || t2.callee.type === "MemberExpression" && (t2.callee.object.type === "MemberExpression" && (nn(t2.callee.object.object) || ao(t2.callee.object)) || t2.callee.object.type === "CallExpression" && nn(t2.callee.object.callee)); + case "Identifier": + return t2.name === "css"; + default: + return false; } - return array; } - function baseSum(array, iteratee) { - var result, index = -1, length = array.length; - while (++index < length) { - var current = iteratee(array[index]); - if (current !== undefined2) { - result = result === undefined2 ? current : result + current; - } - } - return result; + function vc({ parent: e, grandparent: t2 }) { + return (t2 == null ? void 0 : t2.type) === "JSXAttribute" && e.type === "JSXExpressionContainer" && t2.name.type === "JSXIdentifier" && t2.name.name === "css"; } - function baseTimes(n, iteratee) { - var index = -1, result = Array(n); - while (++index < n) { - result[index] = iteratee(index); + var co = (e) => Nc(e) || jc(e) || vc(e) || uo(e); + async function lo(e, t2, r) { + let { node: n } = r, s = n.quasis.length, i = zt(r, t2), o = []; + for (let u = 0; u < s; u++) { + let p = n.quasis[u], c = u === 0, y = u === s - 1, D = p.value.cooked, F = D.split(` +`), C = F.length, d = i[u], b = C > 2 && F[0].trim() === "" && F[1].trim() === "", B = C > 2 && F[C - 1].trim() === "" && F[C - 2].trim() === "", O = F.every((g) => /^\s*(?:#[^\n\r]*)?$/u.test(g)); + if (!y && /#[^\n\r]*$/u.test(F[C - 1])) return null; + let h = null; + O ? h = Rc(F) : h = await e(D, { parser: "graphql" }), h ? (h = tn(h, false), !c && b && o.push(""), o.push(h), !y && B && o.push("")) : !c && !y && b && o.push(""), d && o.push(d); } - return result; - } - function baseToPairs(object, props) { - return arrayMap(props, function(key) { - return [key, object[key]]; - }); + return ["`", m([E, L(E, o)]), E, "`"]; } - function baseTrim(string2) { - return string2 ? string2.slice(0, trimmedEndIndex(string2) + 1).replace(reTrimStart, "") : string2; - } - function baseUnary(func) { - return function(value) { - return func(value); - }; - } - function baseValues(object, props) { - return arrayMap(props, function(key) { - return object[key]; - }); + function Rc(e) { + let t2 = [], r = false, n = e.map((s) => s.trim()); + for (let [s, i] of n.entries()) i !== "" && (n[s - 1] === "" && r ? t2.push([E, i]) : t2.push(i), r = true); + return t2.length === 0 ? null : L(E, t2); + } + function mo({ node: e, parent: t2 }) { + return rn({ node: e, parent: t2 }, "GraphQL") || t2 && (t2.type === "TaggedTemplateExpression" && (t2.tag.type === "MemberExpression" && t2.tag.object.name === "graphql" && t2.tag.property.name === "experimental" || t2.tag.type === "Identifier" && (t2.tag.name === "gql" || t2.tag.name === "graphql")) || t2.type === "CallExpression" && t2.callee.type === "Identifier" && t2.callee.name === "graphql"); + } + var Fs = 0; + async function Do(e, t2, r, n, s) { + let { node: i } = n, o = Fs; + Fs = Fs + 1 >>> 0; + let u = (O) => `PRETTIER_HTML_PLACEHOLDER_${O}_${o}_IN_JS`, p = i.quasis.map((O, h, g) => h === g.length - 1 ? O.value.cooked : O.value.cooked + u(h)).join(""), c = zt(n, r), y = new RegExp(u("(\\d+)"), "gu"), D = 0, F = await t2(p, { parser: e, __onHtmlRoot(O) { + D = O.children.length; + } }), C = ft(F, (O) => { + if (typeof O != "string") return O; + let h = [], g = O.split(y); + for (let S = 0; S < g.length; S++) { + let j = g[S]; + if (S % 2 === 0) { + j && (j = Ds(j), s.__embeddedInHtml && (j = W(0, j, /<\/(?=script\b)/giu, "<\\/")), h.push(j)); + continue; + } + let U = Number(j); + h.push(c[U]); + } + return h; + }), d = /^\s/u.test(p) ? " " : "", b = /\s$/u.test(p) ? " " : "", B = s.htmlWhitespaceSensitivity === "ignore" ? E : d && b ? A2 : null; + return B ? l(["`", m([B, l(C)]), B, "`"]) : pt({ hug: false }, l(["`", d, D > 1 ? m(l(C)) : l(C), b, "`"])); } - function cacheHas(cache, key) { - return cache.has(key); + function fo(e) { + return rn(e, "HTML") || e.match((t2) => t2.type === "TemplateLiteral", (t2, r) => t2.type === "TaggedTemplateExpression" && t2.tag.type === "Identifier" && t2.tag.name === "html" && r === "quasi"); } - function charsStartIndex(strSymbols, chrSymbols) { - var index = -1, length = strSymbols.length; - while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { - } - return index; + var yo = Do.bind(void 0, "html"), Eo = Do.bind(void 0, "angular"); + async function Fo(e, t2, r) { + let { node: n } = r, s = W(0, n.quasis[0].value.raw, /((?:\\\\)*)\\`/gu, (p, c) => "\\".repeat(c.length / 2) + "`"), i = Jc(s), o = i !== ""; + o && (s = W(0, s, new RegExp(`^${i}`, "gmu"), "")); + let u = tn(await e(s, { parser: "markdown", __inJsTemplate: true }), true); + return ["`", o ? m([f2, u]) : [$r, zi(u)], f2, "`"]; } - function charsEndIndex(strSymbols, chrSymbols) { - var index = strSymbols.length; - while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { - } - return index; + function Jc(e) { + let t2 = e.match(/^([^\S\n]*)\S/mu); + return t2 === null ? "" : t2[1]; } - function countHolders(array, placeholder) { - var length = array.length, result = 0; - while (length--) { - if (array[length] === placeholder) { - ++result; - } - } - return result; + function Co({ node: e, parent: t2 }) { + return (t2 == null ? void 0 : t2.type) === "TaggedTemplateExpression" && e.quasis.length === 1 && t2.tag.type === "Identifier" && (t2.tag.name === "md" || t2.tag.name === "markdown"); } - var deburrLetter = basePropertyOf(deburredLetters); - var escapeHtmlChar = basePropertyOf(htmlEscapes); - function escapeStringChar(chr) { - return "\\" + stringEscapes[chr]; + var Gc = [{ test: co, print: po }, { test: mo, print: lo }, { test: fo, print: yo }, { test: Es, print: Eo }, { test: Co, print: Fo }].map(({ test: e, print: t2 }) => ({ test: e, print: qc(t2) })); + function Wc(e) { + let { node: t2 } = e; + if (t2.type !== "TemplateLiteral" || Uc(t2)) return; + let r = Gc.find(({ test: n }) => n(e)); + if (r) return t2.quasis.length === 1 && t2.quasis[0].value.raw.trim() === "" ? "``" : r.print; + } + function qc(e) { + return async (...t2) => { + let r = await e(...t2); + return r && pt({ embed: true, ...r.label }, r); + }; } - function getValue(object, key) { - return object == null ? undefined2 : object[key]; + function Uc({ quasis: e }) { + return e.some(({ value: { cooked: t2 } }) => t2 === null); } - function hasUnicode(string2) { - return reHasUnicode.test(string2); + var Ao = Wc; + var Yc = /\*\/$/, Hc = /^\/\*\*?/, ho = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/, Xc = /(^|\s+)\/\/([^\n\r]*)/g, To = /^(\r?\n)+/, Vc = /(?:^|\r?\n) *(@[^\n\r]*?) *\r?\n *(?![^\n\r@]*\/\/[^]*)([^\s@][^\n\r@]+?) *\r?\n/g, xo = /(?:^|\r?\n) *@(\S+) *([^\n\r]*)/g, $c = /(\r?\n|^) *\* ?/g, So = []; + function Bo(e) { + let t2 = e.match(ho); + return t2 ? t2[0].trimStart() : ""; } - function hasUnicodeWord(string2) { - return reHasUnicodeWord.test(string2); + function bo(e) { + var _a3; + let r = (_a3 = e.match(ho)) == null ? void 0 : _a3[0]; + return r == null ? e : e.slice(r.length); } - function iteratorToArray(iterator) { - var data, result = []; - while (!(data = iterator.next()).done) { - result.push(data.value); + function Po(e) { + e = W(0, e.replace(Hc, "").replace(Yc, ""), $c, "$1"); + let r = ""; + for (; r !== e; ) r = e, e = W(0, e, Vc, ` +$1 $2 +`); + e = e.replace(To, "").trimEnd(); + let n = /* @__PURE__ */ Object.create(null), s = W(0, e, xo, "").replace(To, "").trimEnd(), i; + for (; i = xo.exec(e); ) { + let o = W(0, i[2], Xc, ""); + if (typeof n[i[1]] == "string" || Array.isArray(n[i[1]])) { + let u = n[i[1]]; + n[i[1]] = [...So, ...Array.isArray(u) ? u : [u], o]; + } else n[i[1]] = o; } - return result; - } - function mapToArray(map2) { - var index = -1, result = Array(map2.size); - map2.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; - } - function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; + return { comments: s, pragmas: n }; } - 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; + function ko({ comments: e = "", pragmas: t2 = {} }) { + let o = Object.keys(t2), u = o.flatMap((c) => go(c, t2[c])).map((c) => ` * ${c} +`).join(""); + if (!e) { + if (o.length === 0) return ""; + if (o.length === 1 && !Array.isArray(t2[o[0]])) { + let c = t2[o[0]]; + return `/** ${go(o[0], c)[0]} */`; } } - return result; + let p = e.split(` +`).map((c) => ` * ${c}`).join(` +`) + ` +`; + return `/** +` + (e ? p : "") + (e && o.length > 0 ? ` * +` : "") + u + " */"; } - function setToArray(set2) { - var index = -1, result = Array(set2.size); - set2.forEach(function(value) { - result[++index] = value; - }); - return result; + function go(e, t2) { + return [...So, ...Array.isArray(t2) ? t2 : [t2]].map((r) => `@${e} ${r}`.trim()); } - function setToPairs(set2) { - var index = -1, result = Array(set2.size); - set2.forEach(function(value) { - result[++index] = [value, value]; - }); - return result; + var Io = "format"; + function Kc(e) { + if (!e.startsWith("#!")) return ""; + let t2 = e.indexOf(` +`); + return t2 === -1 ? e : e.slice(0, t2); } - function strictIndexOf(array, value, fromIndex) { - var index = fromIndex - 1, length = array.length; - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; + var Lo = Kc; + function Qc(e) { + let t2 = Lo(e); + t2 && (e = e.slice(t2.length + 1)); + let r = Bo(e), { pragmas: n, comments: s } = Po(r); + return { shebang: t2, text: e, pragmas: n, comments: s }; } - function strictLastIndexOf(array, value, fromIndex) { - var index = fromIndex + 1; - while (index--) { - if (array[index] === value) { - return index; - } - } - return index; + function Oo(e) { + let { shebang: t2, text: r, pragmas: n, comments: s } = Qc(e), i = bo(r), o = ko({ pragmas: { [Io]: "", ...n }, comments: s.trimStart() }); + return (t2 ? `${t2} +` : "") + o + (i.startsWith(` +`) ? ` +` : ` + +`) + i; } - function stringSize(string2) { - return hasUnicode(string2) ? unicodeSize(string2) : asciiSize(string2); + function zc(e) { + if (!ce(e)) return false; + let t2 = `*${e.value}*`.split(` +`); + return t2.length > 1 && t2.every((r) => r.trimStart()[0] === "*"); } - function stringToArray(string2) { - return hasUnicode(string2) ? unicodeToArray(string2) : asciiToArray(string2); + var ds = /* @__PURE__ */ new WeakMap(); + function Zc(e) { + return ds.has(e) || ds.set(e, zc(e)), ds.get(e); } - function trimmedEndIndex(string2) { - var index = string2.length; - while (index-- && reWhitespace.test(string2.charAt(index))) { - } - return index; + var wo = Zc; + function _o(e, t2) { + let r = e.node; + if (At(r)) return t2.originalText.slice(w(r), I(r)).trimEnd(); + if (wo(r)) return el(r); + if (ce(r)) return ["/*", qe(r.value), "*/"]; + throw new Error("Not a comment: " + JSON.stringify(r)); } - var unescapeHtmlChar = basePropertyOf(htmlUnescapes); - function unicodeSize(string2) { - var result = reUnicode.lastIndex = 0; - while (reUnicode.test(string2)) { - ++result; - } - return result; + function el(e) { + let t2 = e.value.split(` +`); + return ["/*", L(E, t2.map((r, n) => n === 0 ? r.trimEnd() : " " + (n < t2.length - 1 ? r.trim() : r.trimStart()))), "*/"]; } - function unicodeToArray(string2) { - return string2.match(reUnicode) || []; - } - function unicodeWords(string2) { - return string2.match(reUnicodeWord) || []; - } - var runInContext = (function runInContext2(context) { - context = context == null ? root : _2.defaults(root.Object(), context, _2.pick(root, contextProps)); - var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError; - var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype; - var coreJsData = context["__core-js_shared__"]; - var funcToString = funcProto.toString; - var hasOwnProperty = objectProto.hasOwnProperty; - var idCounter3 = 0; - var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); - return uid ? "Symbol(src)_1." + uid : ""; - })(); - var nativeObjectToString = objectProto.toString; - var objectCtorString = funcToString.call(Object2); - var oldDash = root._; - var reIsNative = RegExp2( - "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" - ); - var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2; - var defineProperty = (function() { - try { - var func = getNative(Object2, "defineProperty"); - func({}, "", {}); - return func; - } catch (e) { - } - })(); - var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; - var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse; - var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create"); - var metaMap = WeakMap2 && new WeakMap2(); - var realNames = {}; - var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2); - var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2; - 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); - } - var baseCreate = /* @__PURE__ */ (function() { - function object() { - } - return function(proto) { - if (!isObject(proto)) { - return {}; - } - if (objectCreate) { - return objectCreate(proto); - } - object.prototype = proto; - var result2 = new object(); - object.prototype = undefined2; - return result2; - }; - })(); - function baseLodash() { - } - function LodashWrapper(value, chainAll) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__chain__ = !!chainAll; - this.__index__ = 0; - this.__values__ = undefined2; - } - 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 + function Cs(e, t2) { + var _a3, _b2, _c3, _d, _e3, _f, _g, _h, _i2; + if (e.isRoot) return false; + let { node: r, key: n, parent: s } = e; + if (t2.__isInHtmlInterpolation && !t2.bracketSpacing && sl(r) && xr(e)) return true; + if (tl(r)) return false; + if (r.type === "Identifier") { + if (((_a3 = r.extra) == null ? void 0 : _a3.parenthesized) && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/u.test(r.name) || n === "left" && (r.name === "async" && !s.await || r.name === "let") && s.type === "ForOfStatement") return true; + if (r.name === "let") { + let i = (_b2 = e.findAncestor((o) => o.type === "ForOfStatement")) == null ? void 0 : _b2.left; + if (i && ye(i, (o) => o === r)) return true; } - }; - lodash.prototype = baseLodash.prototype; - lodash.prototype.constructor = lodash; - LodashWrapper.prototype = baseCreate(baseLodash.prototype); - LodashWrapper.prototype.constructor = LodashWrapper; - function LazyWrapper(value) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__dir__ = 1; - this.__filtered__ = false; - this.__iteratees__ = []; - this.__takeCount__ = MAX_ARRAY_LENGTH; - this.__views__ = []; - } - function lazyClone() { - var result2 = new LazyWrapper(this.__wrapped__); - result2.__actions__ = copyArray(this.__actions__); - result2.__dir__ = this.__dir__; - result2.__filtered__ = this.__filtered__; - result2.__iteratees__ = copyArray(this.__iteratees__); - result2.__takeCount__ = this.__takeCount__; - result2.__views__ = copyArray(this.__views__); - return result2; - } - function lazyReverse() { - if (this.__filtered__) { - var result2 = new LazyWrapper(this); - result2.__dir__ = -1; - result2.__filtered__ = true; - } else { - result2 = this.clone(); - result2.__dir__ *= -1; + if (n === "object" && r.name === "let" && s.type === "MemberExpression" && s.computed && !s.optional) { + let i = e.findAncestor((u) => u.type === "ExpressionStatement" || u.type === "ForStatement" || u.type === "ForInStatement"), o = i ? i.type === "ExpressionStatement" ? i.expression : i.type === "ForStatement" ? i.init : i.left : void 0; + if (o && ye(o, (u) => u === r)) return true; } - return result2; - } - 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 result2 = []; - outer: - while (length-- && resIndex < takeCount) { - index += dir; - var iterIndex = -1, value = array[index]; - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], iteratee2 = data.iteratee, type = data.type, computed = iteratee2(value); - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } - } - result2[resIndex++] = value; + if (n === "expression") switch (r.name) { + case "await": + case "interface": + case "module": + case "using": + case "yield": + case "let": + case "component": + case "hook": + case "type": { + let i = e.findAncestor((o) => !Ae(o)); + if (i !== s && i.type === "ExpressionStatement") return true; } - return result2; - } - LazyWrapper.prototype = baseCreate(baseLodash.prototype); - LazyWrapper.prototype.constructor = LazyWrapper; - 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]); - } - } - function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; - this.size = 0; - } - function hashDelete(key) { - var result2 = this.has(key) && delete this.__data__[key]; - this.size -= result2 ? 1 : 0; - return result2; - } - function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result2 = data[key]; - return result2 === HASH_UNDEFINED ? undefined2 : result2; } - return hasOwnProperty.call(data, key) ? data[key] : undefined2; - } - function hashHas(key) { - var data = this.__data__; - return nativeCreate ? data[key] !== undefined2 : hasOwnProperty.call(data, key); - } - function hashSet(key, value) { - var data = this.__data__; - this.size += this.has(key) ? 0 : 1; - data[key] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value; - return this; + return false; } - Hash.prototype.clear = hashClear; - Hash.prototype["delete"] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - 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]); - } + if (r.type === "ObjectExpression" || r.type === "FunctionExpression" || r.type === "ClassExpression" || r.type === "DoExpression") { + let i = (_c3 = e.findAncestor((o) => o.type === "ExpressionStatement")) == null ? void 0 : _c3.expression; + if (i && ye(i, (o) => o === r)) return true; } - function listCacheClear() { - this.__data__ = []; - this.size = 0; + if (r.type === "ObjectExpression") { + let i = (_d = e.findAncestor((o) => o.type === "ArrowFunctionExpression")) == null ? void 0 : _d.body; + if (i && i.type !== "SequenceExpression" && i.type !== "AssignmentExpression" && ye(i, (o) => o === r)) return true; } - function listCacheDelete(key) { - var data = this.__data__, index = assocIndexOf(data, key); - if (index < 0) { + switch (s.type) { + case "ParenthesizedExpression": return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - --this.size; - return true; - } - function listCacheGet(key) { - var data = this.__data__, index = assocIndexOf(data, key); - return index < 0 ? undefined2 : data[index][1]; - } - function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; - } - 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; - } - ListCache.prototype.clear = listCacheClear; - ListCache.prototype["delete"] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; - 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]); - } - } - function mapCacheClear() { - this.size = 0; - this.__data__ = { - "hash": new Hash(), - "map": new (Map2 || ListCache)(), - "string": new Hash() - }; - } - function mapCacheDelete(key) { - var result2 = getMapData(this, key)["delete"](key); - this.size -= result2 ? 1 : 0; - return result2; - } - function mapCacheGet(key) { - return getMapData(this, key).get(key); - } - function mapCacheHas(key) { - return getMapData(this, key).has(key); - } - function mapCacheSet(key, value) { - var data = getMapData(this, key), size2 = data.size; - data.set(key, value); - this.size += data.size == size2 ? 0 : 1; - return this; - } - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype["delete"] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; - function SetCache(values2) { - var index = -1, length = values2 == null ? 0 : values2.length; - this.__data__ = new MapCache(); - while (++index < length) { - this.add(values2[index]); - } - } - function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; - } - function setCacheHas(value) { - return this.__data__.has(value); - } - SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; - SetCache.prototype.has = setCacheHas; - function Stack(entries) { - var data = this.__data__ = new ListCache(entries); - this.size = data.size; - } - function stackClear() { - this.__data__ = new ListCache(); - this.size = 0; - } - function stackDelete(key) { - var data = this.__data__, result2 = data["delete"](key); - this.size = data.size; - return result2; - } - function stackGet(key) { - return this.__data__.get(key); - } - function stackHas(key) { - return this.__data__.has(key); - } - function stackSet(key, value) { - var data = this.__data__; - if (data instanceof ListCache) { - var pairs2 = data.__data__; - if (!Map2 || pairs2.length < LARGE_ARRAY_SIZE - 1) { - pairs2.push([key, value]); - this.size = ++data.size; - return this; - } - data = this.__data__ = new MapCache(pairs2); - } - data.set(key, value); - this.size = data.size; - return this; - } - Stack.prototype.clear = stackClear; - Stack.prototype["delete"] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; - 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, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.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)))) { - result2.push(key); - } - } - return result2; - } - function arraySample(array) { - var length = array.length; - return length ? array[baseRandom(0, length - 1)] : undefined2; - } - function arraySampleSize(array, n) { - return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); - } - function arrayShuffle(array) { - return shuffleSelf(copyArray(array)); - } - function assignMergeValue(object, key, value) { - if (value !== undefined2 && !eq(object[key], value) || value === undefined2 && !(key in object)) { - baseAssignValue(object, key, value); - } - } - function assignValue(object, key, value) { - var objValue = object[key]; - if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined2 && !(key in object)) { - baseAssignValue(object, key, value); - } - } - function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; - } - function baseAggregator(collection, setter, iteratee2, accumulator) { - baseEach(collection, function(value, key, collection2) { - setter(accumulator, value, iteratee2(value), collection2); - }); - return accumulator; - } - function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); - } - function baseAssignIn(object, source) { - return object && copyObject(source, keysIn(source), object); - } - function baseAssignValue(object, key, value) { - if (key == "__proto__" && defineProperty) { - defineProperty(object, key, { - "configurable": true, - "enumerable": true, - "value": value, - "writable": true - }); - } else { - object[key] = value; - } - } - function baseAt(object, paths) { - var index = -1, length = paths.length, result2 = Array2(length), skip = object == null; - while (++index < length) { - result2[index] = skip ? undefined2 : get(object, paths[index]); - } - return result2; - } - function baseClamp(number, lower, upper) { - if (number === number) { - if (upper !== undefined2) { - number = number <= upper ? number : upper; - } - if (lower !== undefined2) { - number = number >= lower ? number : lower; - } - } - return number; - } - function baseClone(value, bitmask, customizer, key, object, stack) { - var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; - if (customizer) { - result2 = object ? customizer(value, key, object, stack) : customizer(value); - } - if (result2 !== undefined2) { - return result2; - } - if (!isObject(value)) { - return value; - } - var isArr = isArray(value); - if (isArr) { - result2 = initCloneArray(value); - if (!isDeep) { - return copyArray(value, result2); - } - } else { - var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; - if (isBuffer(value)) { - return cloneBuffer(value, isDeep); - } - if (tag == objectTag || tag == argsTag || isFunc && !object) { - result2 = isFlat || isFunc ? {} : initCloneObject(value); - if (!isDeep) { - return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value)); - } - } else { - if (!cloneableTags[tag]) { - return object ? value : {}; - } - result2 = initCloneByTag(value, tag, isDeep); - } - } - stack || (stack = new Stack()); - var stacked = stack.get(value); - if (stacked) { - return stacked; - } - stack.set(value, result2); - if (isSet(value)) { - value.forEach(function(subValue) { - result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); - }); - } else if (isMap2(value)) { - value.forEach(function(subValue, key2) { - result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); - }); - } - var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys; - var props = isArr ? undefined2 : keysFunc(value); - arrayEach(props || value, function(subValue, key2) { - if (props) { - key2 = subValue; - subValue = value[key2]; - } - assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); - }); - return result2; - } - function baseConforms(source) { - var props = keys(source); - return function(object) { - return baseConformsTo(object, source, props); - }; - } - function baseConformsTo(object, source, props) { - var length = props.length; - if (object == null) { - return !length; - } - object = Object2(object); - while (length--) { - var key = props[length], predicate = source[key], value = object[key]; - if (value === undefined2 && !(key in object) || !predicate(value)) { - return false; - } - } - return true; - } - function baseDelay(func, wait, args) { - if (typeof func != "function") { - throw new TypeError2(FUNC_ERROR_TEXT); - } - return setTimeout2(function() { - func.apply(undefined2, args); - }, wait); - } - function baseDifference(array, values2, iteratee2, comparator) { - var index = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values2.length; - if (!length) { - return result2; - } - if (iteratee2) { - values2 = arrayMap(values2, baseUnary(iteratee2)); - } - if (comparator) { - includes2 = arrayIncludesWith; - isCommon = false; - } else if (values2.length >= LARGE_ARRAY_SIZE) { - includes2 = cacheHas; - isCommon = false; - values2 = new SetCache(values2); - } - outer: - while (++index < length) { - var value = array[index], computed = iteratee2 == null ? value : iteratee2(value); - value = comparator || value !== 0 ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values2[valuesIndex] === computed) { - continue outer; - } - } - result2.push(value); - } else if (!includes2(values2, computed, comparator)) { - result2.push(value); - } - } - return result2; - } - var baseEach = createBaseEach(baseForOwn); - var baseEachRight = createBaseEach(baseForOwnRight, true); - function baseEvery(collection, predicate) { - var result2 = true; - baseEach(collection, function(value, index, collection2) { - result2 = !!predicate(value, index, collection2); - return result2; - }); - return result2; + case "ClassDeclaration": + case "ClassExpression": + if (n === "superClass" && (r.type === "ArrowFunctionExpression" || r.type === "AssignmentExpression" || r.type === "AwaitExpression" || r.type === "BinaryExpression" || r.type === "ConditionalExpression" || r.type === "LogicalExpression" || r.type === "NewExpression" || r.type === "ObjectExpression" || r.type === "SequenceExpression" || r.type === "TaggedTemplateExpression" || r.type === "UnaryExpression" || r.type === "UpdateExpression" || r.type === "YieldExpression" || r.type === "TSNonNullExpression" || r.type === "ClassExpression" && R(r.decorators))) return true; + break; + case "ExportDefaultDeclaration": + return Mo(e, t2) || r.type === "SequenceExpression"; + case "Decorator": + if (n === "expression" && !ol(r)) return true; + break; + case "TypeAnnotation": + if (e.match(void 0, void 0, (i, o) => o === "returnType" && i.type === "ArrowFunctionExpression") && nl(r)) return true; + break; + case "BinaryExpression": + if (n === "left" && (s.operator === "in" || s.operator === "instanceof") && r.type === "UnaryExpression") return true; + break; + case "VariableDeclarator": + if (n === "init" && e.match(void 0, void 0, (i, o) => o === "declarations" && i.type === "VariableDeclaration", (i, o) => o === "left" && i.type === "ForInStatement")) return true; + break; } - function baseExtremum(array, iteratee2, comparator) { - var index = -1, length = array.length; - while (++index < length) { - var value = array[index], current = iteratee2(value); - if (current != null && (computed === undefined2 ? current === current && !isSymbol(current) : comparator(current, computed))) { - var computed = current, result2 = value; + switch (r.type) { + case "UpdateExpression": + if (s.type === "UnaryExpression") return r.prefix && (r.operator === "++" && s.operator === "+" || r.operator === "--" && s.operator === "-"); + case "UnaryExpression": + switch (s.type) { + case "UnaryExpression": + return r.operator === s.operator && (r.operator === "+" || r.operator === "-"); + case "BindExpression": + return true; + case "MemberExpression": + case "OptionalMemberExpression": + return n === "object"; + case "TaggedTemplateExpression": + return true; + case "NewExpression": + case "CallExpression": + case "OptionalCallExpression": + return n === "callee"; + case "BinaryExpression": + return n === "left" && s.operator === "**"; + case "TSNonNullExpression": + return true; + default: + return false; } - } - return result2; - } - function baseFill(array, value, start, end) { - var length = array.length; - start = toInteger(start); - if (start < 0) { - start = -start > length ? 0 : length + start; - } - end = end === undefined2 || end > length ? length : toInteger(end); - if (end < 0) { - end += length; - } - end = start > end ? 0 : toLength(end); - while (start < end) { - array[start++] = value; - } - return array; - } - function baseFilter(collection, predicate) { - var result2 = []; - baseEach(collection, function(value, index, collection2) { - if (predicate(value, index, collection2)) { - result2.push(value); + case "BinaryExpression": + if (s.type === "UpdateExpression" || r.operator === "in" && rl(e)) return true; + if (r.operator === "|>" && ((_e3 = r.extra) == null ? void 0 : _e3.parenthesized)) { + let i = e.grandparent; + if (i.type === "BinaryExpression" && i.operator === "|>") return true; } - }); - return result2; - } - function baseFlatten(array, depth, predicate, isStrict, result2) { - var index = -1, length = array.length; - predicate || (predicate = isFlattenable); - result2 || (result2 = []); - while (++index < length) { - var value = array[index]; - if (depth > 0 && predicate(value)) { - if (depth > 1) { - baseFlatten(value, depth - 1, predicate, isStrict, result2); - } else { - arrayPush(result2, value); + case "TSTypeAssertion": + case "TSAsExpression": + case "TSSatisfiesExpression": + case "AsExpression": + case "AsConstExpression": + case "SatisfiesExpression": + case "LogicalExpression": + switch (s.type) { + case "TSAsExpression": + case "TSSatisfiesExpression": + case "AsExpression": + case "AsConstExpression": + case "SatisfiesExpression": + return !Ae(r); + case "ConditionalExpression": + return Ae(r) || yi(r); + case "CallExpression": + case "NewExpression": + case "OptionalCallExpression": + return n === "callee"; + case "ClassExpression": + case "ClassDeclaration": + return n === "superClass"; + case "TSTypeAssertion": + case "TaggedTemplateExpression": + case "UnaryExpression": + case "JSXSpreadAttribute": + case "SpreadElement": + case "BindExpression": + case "AwaitExpression": + case "TSNonNullExpression": + case "UpdateExpression": + return true; + case "MemberExpression": + case "OptionalMemberExpression": + return n === "object"; + case "AssignmentExpression": + case "AssignmentPattern": + return n === "left" && (r.type === "TSTypeAssertion" || Ae(r)); + case "LogicalExpression": + if (r.type === "LogicalExpression") return s.operator !== r.operator; + case "BinaryExpression": { + let { operator: i, type: o } = r; + if (!i && o !== "TSTypeAssertion") return true; + let u = yr(i), p = s.operator, c = yr(p); + return !!(c > u || n === "right" && c === u || c === u && !dr(p, i) || c < u && i === "%" && (p === "+" || p === "-") || Ti(p)); } - } else if (!isStrict) { - result2[result2.length] = value; + default: + return false; } - } - return result2; - } - var baseFor = createBaseFor(); - var baseForRight = createBaseFor(true); - function baseForOwn(object, iteratee2) { - return object && baseFor(object, iteratee2, keys); - } - function baseForOwnRight(object, iteratee2) { - return object && baseForRight(object, iteratee2, keys); - } - function baseFunctions(object, props) { - return arrayFilter(props, function(key) { - return isFunction(object[key]); - }); - } - function baseGet(object, path5) { - path5 = castPath(path5, object); - var index = 0, length = path5.length; - while (object != null && index < length) { - object = object[toKey(path5[index++])]; - } - return index && index == length ? object : undefined2; - } - function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result2 = keysFunc(object); - return isArray(object) ? result2 : arrayPush(result2, symbolsFunc(object)); - } - function baseGetTag(value) { - if (value == null) { - return value === undefined2 ? undefinedTag : nullTag2; - } - return symToStringTag && symToStringTag in Object2(value) ? getRawTag(value) : objectToString(value); - } - function baseGt(value, other) { - return value > other; - } - function baseHas(object, key) { - return object != null && hasOwnProperty.call(object, key); - } - function baseHasIn(object, key) { - return object != null && key in Object2(object); - } - function baseInRange(number, start, end) { - return number >= nativeMin(start, end) && number < nativeMax(start, end); - } - function baseIntersection(arrays, iteratee2, comparator) { - var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = []; - while (othIndex--) { - var array = arrays[othIndex]; - if (othIndex && iteratee2) { - array = arrayMap(array, baseUnary(iteratee2)); - } - maxLength = nativeMin(array.length, maxLength); - caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined2; - } - array = arrays[0]; - var index = -1, seen = caches[0]; - outer: - while (++index < length && result2.length < maxLength) { - var value = array[index], computed = iteratee2 ? iteratee2(value) : value; - value = comparator || value !== 0 ? value : 0; - if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache ? cacheHas(cache, computed) : includes2(arrays[othIndex], computed, comparator))) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result2.push(value); - } + case "SequenceExpression": + return s.type !== "ForStatement"; + case "YieldExpression": + if (s.type === "AwaitExpression" || s.type === "TSTypeAssertion") return true; + case "AwaitExpression": + switch (s.type) { + case "TaggedTemplateExpression": + case "UnaryExpression": + case "LogicalExpression": + case "SpreadElement": + case "TSAsExpression": + case "TSSatisfiesExpression": + case "TSNonNullExpression": + case "AsExpression": + case "AsConstExpression": + case "SatisfiesExpression": + case "BindExpression": + return true; + case "MemberExpression": + case "OptionalMemberExpression": + return n === "object"; + case "NewExpression": + case "CallExpression": + case "OptionalCallExpression": + return n === "callee"; + case "ConditionalExpression": + return n === "test"; + case "BinaryExpression": + return !(!r.argument && s.operator === "|>"); + default: + return false; } - return result2; - } - function baseInverter(object, setter, iteratee2, accumulator) { - baseForOwn(object, function(value, key, object2) { - setter(accumulator, iteratee2(value), key, object2); - }); - return accumulator; - } - function baseInvoke(object, path5, args) { - path5 = castPath(path5, object); - object = parent(object, path5); - var func = object == null ? object : object[toKey(last(path5))]; - return func == null ? undefined2 : apply(func, object, args); - } - function baseIsArguments(value) { - return isObjectLike(value) && baseGetTag(value) == argsTag; - } - function baseIsArrayBuffer(value) { - return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; - } - function baseIsDate(value) { - return isObjectLike(value) && baseGetTag(value) == dateTag; - } - 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); - } - 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; + case "TSFunctionType": + if (e.match((i) => i.type === "TSFunctionType", (i, o) => o === "typeAnnotation" && i.type === "TSTypeAnnotation", (i, o) => o === "returnType" && i.type === "ArrowFunctionExpression")) return true; + case "TSConditionalType": + case "TSConstructorType": + case "ConditionalTypeAnnotation": + if (n === "extendsType" && Ue(r) && s.type === r.type || n === "checkType" && Ue(s)) return true; + if (n === "extendsType" && s.type === "TSConditionalType") { + let { typeAnnotation: i } = r.returnType || r.typeAnnotation; + if (i.type === "TSTypePredicate" && i.typeAnnotation && (i = i.typeAnnotation.typeAnnotation), i.type === "TSInferType" && i.typeParameter.constraint) return true; } - 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); + case "TSUnionType": + case "TSIntersectionType": + if (Se(s) || xt(s)) return true; + case "TSInferType": + if (r.type === "TSInferType") { + if (s.type === "TSRestType") return false; + if (n === "types" && (s.type === "TSUnionType" || s.type === "TSIntersectionType") && r.typeParameter.type === "TSTypeParameter" && r.typeParameter.constraint) return true; } + case "TSTypeOperator": + return s.type === "TSArrayType" || s.type === "TSOptionalType" || s.type === "TSRestType" || n === "objectType" && s.type === "TSIndexedAccessType" || s.type === "TSTypeOperator" || s.type === "TSTypeAnnotation" && e.grandparent.type.startsWith("TSJSDoc"); + case "TSTypeQuery": + return n === "objectType" && s.type === "TSIndexedAccessType" || n === "elementType" && s.type === "TSArrayType"; + case "TypeOperator": + return s.type === "ArrayTypeAnnotation" || s.type === "NullableTypeAnnotation" || n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType") || s.type === "TypeOperator"; + case "TypeofTypeAnnotation": + return n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType") || n === "elementType" && s.type === "ArrayTypeAnnotation"; + case "ArrayTypeAnnotation": + return s.type === "NullableTypeAnnotation"; + case "IntersectionTypeAnnotation": + case "UnionTypeAnnotation": + return s.type === "TypeOperator" || s.type === "KeyofTypeAnnotation" || s.type === "ArrayTypeAnnotation" || s.type === "NullableTypeAnnotation" || s.type === "IntersectionTypeAnnotation" || s.type === "UnionTypeAnnotation" || n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType"); + case "InferTypeAnnotation": + case "NullableTypeAnnotation": + return s.type === "ArrayTypeAnnotation" || n === "objectType" && (s.type === "IndexedAccessType" || s.type === "OptionalIndexedAccessType"); + case "ComponentTypeAnnotation": + case "FunctionTypeAnnotation": { + if (r.type === "ComponentTypeAnnotation" && (r.rendersType === null || r.rendersType === void 0)) return false; + if (e.match(void 0, (o, u) => u === "typeAnnotation" && o.type === "TypeAnnotation", (o, u) => u === "returnType" && o.type === "ArrowFunctionExpression") || e.match(void 0, (o, u) => u === "typeAnnotation" && o.type === "TypePredicate", (o, u) => u === "typeAnnotation" && o.type === "TypeAnnotation", (o, u) => u === "returnType" && o.type === "ArrowFunctionExpression")) return true; + let i = s.type === "NullableTypeAnnotation" ? e.grandparent : s; + return i.type === "UnionTypeAnnotation" || i.type === "IntersectionTypeAnnotation" || i.type === "ArrayTypeAnnotation" || n === "objectType" && (i.type === "IndexedAccessType" || i.type === "OptionalIndexedAccessType") || n === "checkType" && s.type === "ConditionalTypeAnnotation" || n === "extendsType" && s.type === "ConditionalTypeAnnotation" && ((_f = r.returnType) == null ? void 0 : _f.type) === "InferTypeAnnotation" && ((_g = r.returnType) == null ? void 0 : _g.typeParameter.bound) || i.type === "NullableTypeAnnotation" || s.type === "FunctionTypeParam" && s.name === null && K(r).some((o) => { + var _a4; + return ((_a4 = o.typeAnnotation) == null ? void 0 : _a4.type) === "NullableTypeAnnotation"; + }); } - if (!isSameTag) { - return false; - } - stack || (stack = new Stack()); - return equalObjects(object, other, bitmask, customizer, equalFunc, stack); - } - function baseIsMap(value) { - return isObjectLike(value) && getTag(value) == mapTag; - } - function baseIsMatch(object, source, matchData, customizer) { - var index = matchData.length, length = index, noCustomizer = !customizer; - if (object == null) { - return !length; - } - object = Object2(object); - while (index--) { - var data = matchData[index]; - if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) { - return false; + case "OptionalIndexedAccessType": + return n === "objectType" && s.type === "IndexedAccessType"; + case "StringLiteral": + case "NumericLiteral": + case "Literal": + if (typeof r.value == "string" && s.type === "ExpressionStatement" && typeof s.directive != "string") { + let i = e.grandparent; + return i.type === "Program" || i.type === "BlockStatement"; } - } - while (++index < length) { - data = matchData[index]; - var key = data[0], objValue = object[key], srcValue = data[1]; - if (noCustomizer && data[2]) { - if (objValue === undefined2 && !(key in object)) { - return false; - } - } else { - var stack = new Stack(); - if (customizer) { - var result2 = customizer(objValue, srcValue, key, object, source, stack); - } - if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) { + return n === "object" && J(s) && Ce(r); + case "AssignmentExpression": + return !((n === "init" || n === "update") && s.type === "ForStatement" || n === "expression" && r.left.type !== "ObjectPattern" && s.type === "ExpressionStatement" || n === "key" && s.type === "TSPropertySignature" || s.type === "AssignmentExpression" || n === "expressions" && s.type === "SequenceExpression" && e.match(void 0, void 0, (i, o) => (o === "init" || o === "update") && i.type === "ForStatement") || n === "value" && s.type === "Property" && e.match(void 0, void 0, (i, o) => o === "properties" && i.type === "ObjectPattern") || s.type === "NGChainedExpression" || n === "node" && s.type === "JsExpressionRoot"); + case "ConditionalExpression": + switch (s.type) { + case "TaggedTemplateExpression": + case "UnaryExpression": + case "SpreadElement": + case "BinaryExpression": + case "LogicalExpression": + case "NGPipeExpression": + case "ExportDefaultDeclaration": + case "AwaitExpression": + case "JSXSpreadAttribute": + case "TSTypeAssertion": + case "TypeCastExpression": + case "TSAsExpression": + case "TSSatisfiesExpression": + case "AsExpression": + case "AsConstExpression": + case "SatisfiesExpression": + case "TSNonNullExpression": + return true; + case "NewExpression": + case "CallExpression": + case "OptionalCallExpression": + return n === "callee"; + case "ConditionalExpression": + return t2.experimentalTernaries ? false : n === "test"; + case "MemberExpression": + case "OptionalMemberExpression": + return n === "object"; + default: return false; - } - } - } - return true; - } - function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); - } - function baseIsRegExp(value) { - return isObjectLike(value) && baseGetTag(value) == regexpTag; - } - function baseIsSet(value) { - return isObjectLike(value) && getTag(value) == setTag; - } - function baseIsTypedArray(value) { - return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; - } - function baseIteratee(value) { - 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); - } - function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result2 = []; - for (var key in Object2(object)) { - if (hasOwnProperty.call(object, key) && key != "constructor") { - result2.push(key); } - } - return result2; - } - function baseKeysIn(object) { - if (!isObject(object)) { - return nativeKeysIn(object); - } - var isProto = isPrototype(object), result2 = []; - for (var key in object) { - if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) { - result2.push(key); + case "FunctionExpression": + switch (s.type) { + case "NewExpression": + case "CallExpression": + case "OptionalCallExpression": + return n === "callee"; + case "TaggedTemplateExpression": + return true; + default: + return false; } - } - return result2; - } - function baseLt(value, other) { - return value < other; - } - function baseMap(collection, iteratee2) { - var index = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : []; - baseEach(collection, function(value, key, collection2) { - result2[++index] = iteratee2(value, key, collection2); - }); - return result2; - } - 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); - }; - } - function baseMatchesProperty(path5, srcValue) { - if (isKey(path5) && isStrictComparable(srcValue)) { - return matchesStrictComparable(toKey(path5), srcValue); - } - return function(object) { - var objValue = get(object, path5); - return objValue === undefined2 && objValue === srcValue ? hasIn(object, path5) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); - }; - } - function baseMerge(object, source, srcIndex, customizer, stack) { - if (object === source) { - return; - } - baseFor(source, function(srcValue, key) { - stack || (stack = new Stack()); - if (isObject(srcValue)) { - baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); - } else { - var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2; - if (newValue === undefined2) { - newValue = srcValue; - } - assignMergeValue(object, key, newValue); + case "ArrowFunctionExpression": + switch (s.type) { + case "BinaryExpression": + return s.operator !== "|>" || ((_h = r.extra) == null ? void 0 : _h.parenthesized); + case "NewExpression": + case "CallExpression": + case "OptionalCallExpression": + return n === "callee"; + case "MemberExpression": + case "OptionalMemberExpression": + return n === "object"; + case "TSAsExpression": + case "TSSatisfiesExpression": + case "AsExpression": + case "AsConstExpression": + case "SatisfiesExpression": + case "TSNonNullExpression": + case "BindExpression": + case "TaggedTemplateExpression": + case "UnaryExpression": + case "LogicalExpression": + case "AwaitExpression": + case "TSTypeAssertion": + case "MatchExpressionCase": + return true; + case "TSInstantiationExpression": + return n === "expression"; + case "ConditionalExpression": + return n === "test"; + default: + return false; } - }, keysIn); - } - 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) : undefined2; - var isCommon = newValue === undefined2; - 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) || isFunction(objValue)) { - newValue = initCloneObject(srcValue); - } - } else { - isCommon = false; + case "ClassExpression": + switch (s.type) { + case "NewExpression": + return n === "callee"; + default: + return false; } - } - if (isCommon) { - stack.set(srcValue, newValue); - mergeFunc(newValue, srcValue, srcIndex, customizer, stack); - stack["delete"](srcValue); - } - assignMergeValue(object, key, newValue); - } - function baseNth(array, n) { - var length = array.length; - if (!length) { - return; - } - n += n < 0 ? length : 0; - return isIndex(n, length) ? array[n] : undefined2; - } - function baseOrderBy(collection, iteratees, orders) { - if (iteratees.length) { - iteratees = arrayMap(iteratees, function(iteratee2) { - if (isArray(iteratee2)) { - return function(value) { - return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2); - }; + case "OptionalMemberExpression": + case "OptionalCallExpression": + case "CallExpression": + case "MemberExpression": + if (il(e)) return true; + case "TaggedTemplateExpression": + case "TSNonNullExpression": + if (n === "callee" && (s.type === "BindExpression" || s.type === "NewExpression")) { + let i = r; + for (; i; ) switch (i.type) { + case "CallExpression": + case "OptionalCallExpression": + return true; + case "MemberExpression": + case "OptionalMemberExpression": + case "BindExpression": + i = i.object; + break; + case "TaggedTemplateExpression": + i = i.tag; + break; + case "TSNonNullExpression": + i = i.expression; + break; + default: + return false; } - return iteratee2; - }); - } else { - iteratees = [identity]; - } - var index = -1; - iteratees = arrayMap(iteratees, baseUnary(getIteratee())); - var result2 = baseMap(collection, function(value, key, collection2) { - var criteria = arrayMap(iteratees, function(iteratee2) { - return iteratee2(value); - }); - return { "criteria": criteria, "index": ++index, "value": value }; - }); - return baseSortBy(result2, function(object, other) { - return compareMultiple(object, other, orders); - }); - } - function basePick(object, paths) { - return basePickBy(object, paths, function(value, path5) { - return hasIn(object, path5); - }); - } - function basePickBy(object, paths, predicate) { - var index = -1, length = paths.length, result2 = {}; - while (++index < length) { - var path5 = paths[index], value = baseGet(object, path5); - if (predicate(value, path5)) { - baseSet(result2, castPath(path5, object), value); } - } - return result2; - } - function basePropertyDeep(path5) { - return function(object) { - return baseGet(object, path5); - }; + return false; + case "BindExpression": + return n === "callee" && (s.type === "BindExpression" || s.type === "NewExpression") || n === "object" && J(s); + case "NGPipeExpression": + return !(s.type === "NGRoot" || s.type === "NGMicrosyntaxExpression" || s.type === "ObjectProperty" && !((_i2 = r.extra) == null ? void 0 : _i2.parenthesized) || q(s) || n === "arguments" && M(s) || n === "right" && s.type === "NGPipeExpression" || n === "property" && s.type === "MemberExpression" || s.type === "AssignmentExpression"); + case "JSXFragment": + case "JSXElement": + return n === "callee" || n === "left" && s.type === "BinaryExpression" && s.operator === "<" || !q(s) && s.type !== "ArrowFunctionExpression" && s.type !== "AssignmentExpression" && s.type !== "AssignmentPattern" && s.type !== "BinaryExpression" && s.type !== "NewExpression" && s.type !== "ConditionalExpression" && s.type !== "ExpressionStatement" && s.type !== "JsExpressionRoot" && s.type !== "JSXAttribute" && s.type !== "JSXElement" && s.type !== "JSXExpressionContainer" && s.type !== "JSXFragment" && s.type !== "LogicalExpression" && !M(s) && !Oe(s) && s.type !== "ReturnStatement" && s.type !== "ThrowStatement" && s.type !== "TypeCastExpression" && s.type !== "VariableDeclarator" && s.type !== "YieldExpression" && s.type !== "MatchExpressionCase"; + case "TSInstantiationExpression": + return n === "object" && J(s); + case "MatchOrPattern": + return s.type === "MatchAsPattern"; } - function basePullAll(array, values2, iteratee2, comparator) { - var indexOf3 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array; - if (array === values2) { - values2 = copyArray(values2); - } - if (iteratee2) { - seen = arrayMap(array, baseUnary(iteratee2)); - } - while (++index < length) { - var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value; - while ((fromIndex = indexOf3(seen, computed, fromIndex, comparator)) > -1) { - if (seen !== array) { - splice.call(seen, fromIndex, 1); - } - splice.call(array, fromIndex, 1); - } - } - return array; + return false; + } + var tl = k(["BlockStatement", "BreakStatement", "ComponentDeclaration", "ClassBody", "ClassDeclaration", "ClassMethod", "ClassProperty", "PropertyDefinition", "ClassPrivateProperty", "ContinueStatement", "DebuggerStatement", "DeclareComponent", "DeclareClass", "DeclareExportAllDeclaration", "DeclareExportDeclaration", "DeclareFunction", "DeclareHook", "DeclareInterface", "DeclareModule", "DeclareModuleExports", "DeclareNamespace", "DeclareVariable", "DeclareEnum", "DoWhileStatement", "EnumDeclaration", "ExportAllDeclaration", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ExpressionStatement", "ForInStatement", "ForOfStatement", "ForStatement", "FunctionDeclaration", "HookDeclaration", "IfStatement", "ImportDeclaration", "InterfaceDeclaration", "LabeledStatement", "MethodDefinition", "ReturnStatement", "SwitchStatement", "ThrowStatement", "TryStatement", "TSDeclareFunction", "TSEnumDeclaration", "TSImportEqualsDeclaration", "TSInterfaceDeclaration", "TSModuleDeclaration", "TSNamespaceExportDeclaration", "TypeAlias", "VariableDeclaration", "WhileStatement", "WithStatement"]); + function rl(e) { + let t2 = 0, { node: r } = e; + for (; r; ) { + let n = e.getParentNode(t2++); + if ((n == null ? void 0 : n.type) === "ForStatement" && n.init === r) return true; + r = n; } - 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; + return false; + } + function nl(e) { + return Er(e, (t2) => t2.type === "ObjectTypeAnnotation" && Er(t2, (r) => r.type === "FunctionTypeAnnotation")); + } + function sl(e) { + return se(e); + } + function xr(e) { + let { parent: t2, key: r } = e; + switch (t2.type) { + case "NGPipeExpression": + if (r === "arguments" && e.isLast) return e.callParent(xr); + break; + case "ObjectProperty": + if (r === "value") return e.callParent(() => e.key === "properties" && e.isLast); + break; + case "BinaryExpression": + case "LogicalExpression": + if (r === "right") return e.callParent(xr); + break; + case "ConditionalExpression": + if (r === "alternate") return e.callParent(xr); + break; + case "UnaryExpression": + if (t2.prefix) return e.callParent(xr); + break; } - function baseRandom(lower, upper) { - return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); + return false; + } + function Mo(e, t2) { + let { node: r, parent: n } = e; + return r.type === "FunctionExpression" || r.type === "ClassExpression" ? n.type === "ExportDefaultDeclaration" || !Cs(e, t2) : !Xt(r) || n.type !== "ExportDefaultDeclaration" && Cs(e, t2) ? false : e.call(() => Mo(e, t2), ...Rr(r)); + } + function il(e) { + return !!(e.match(void 0, (t2, r) => r === "expression" && t2.type === "ChainExpression", (t2, r) => r === "tag" && t2.type === "TaggedTemplateExpression") || e.match((t2) => t2.type === "OptionalCallExpression" || t2.type === "OptionalMemberExpression", (t2, r) => r === "tag" && t2.type === "TaggedTemplateExpression") || e.match((t2) => t2.type === "OptionalCallExpression" || t2.type === "OptionalMemberExpression", (t2, r) => r === "expression" && t2.type === "TSNonNullExpression", (t2, r) => r === "tag" && t2.type === "TaggedTemplateExpression") || e.match(void 0, (t2, r) => r === "expression" && t2.type === "ChainExpression", (t2, r) => r === "expression" && t2.type === "TSNonNullExpression", (t2, r) => r === "tag" && t2.type === "TaggedTemplateExpression") || e.match(void 0, (t2, r) => r === "expression" && t2.type === "TSNonNullExpression", (t2, r) => r === "expression" && t2.type === "ChainExpression", (t2, r) => r === "tag" && t2.type === "TaggedTemplateExpression") || e.match((t2) => t2.type === "OptionalMemberExpression" || t2.type === "OptionalCallExpression", (t2, r) => r === "object" && t2.type === "MemberExpression" || r === "callee" && (t2.type === "CallExpression" || t2.type === "NewExpression")) || e.match((t2) => t2.type === "OptionalMemberExpression" || t2.type === "OptionalCallExpression", (t2, r) => r === "expression" && t2.type === "TSNonNullExpression", (t2, r) => r === "object" && t2.type === "MemberExpression" || r === "callee" && t2.type === "CallExpression") || e.match((t2) => t2.type === "CallExpression" || t2.type === "MemberExpression", (t2, r) => r === "expression" && t2.type === "ChainExpression") && (e.match(void 0, void 0, (t2, r) => r === "callee" && (t2.type === "CallExpression" && !t2.optional || t2.type === "NewExpression") || r === "object" && t2.type === "MemberExpression" && !t2.optional) || e.match(void 0, void 0, (t2, r) => r === "expression" && t2.type === "TSNonNullExpression", (t2, r) => r === "object" && t2.type === "MemberExpression" || r === "callee" && t2.type === "CallExpression")) || e.match((t2) => t2.type === "CallExpression" || t2.type === "MemberExpression", (t2, r) => r === "expression" && t2.type === "TSNonNullExpression", (t2, r) => r === "expression" && t2.type === "ChainExpression", (t2, r) => r === "object" && t2.type === "MemberExpression" || r === "callee" && t2.type === "CallExpression")); + } + function As(e) { + return e.type === "Identifier" ? true : J(e) ? !e.computed && !e.optional && e.property.type === "Identifier" && As(e.object) : false; + } + function ol(e) { + return e.type === "ChainExpression" && (e = e.expression), As(e) || M(e) && !e.optional && As(e.callee); + } + var ge = Cs; + function ul(e, t2) { + let r = t2 - 1; + r = ze(e, r, { backwards: true }), r = Ze(e, r, { backwards: true }), r = ze(e, r, { backwards: true }); + let n = Ze(e, r, { backwards: true }); + return r !== n; + } + var No = ul; + var al = () => true; + function Ts(e, t2) { + let r = e.node; + return r.printed = true, t2.printer.printComment(e, t2); + } + function pl(e, t2) { + var _a3; + let r = e.node, n = [Ts(e, t2)], { printer: s, originalText: i, locStart: o, locEnd: u } = t2; + if ((_a3 = s.isBlockComment) == null ? void 0 : _a3.call(s, r)) { + let y = Z(i, u(r)) ? Z(i, o(r), { backwards: true }) ? E : A2 : " "; + n.push(y); + } else n.push(E); + let c = Ze(i, ze(i, u(r))); + return c !== false && Z(i, c) && n.push(E), n; + } + function cl(e, t2, r) { + var _a3; + let n = e.node, s = Ts(e, t2), { printer: i, originalText: o, locStart: u } = t2, p = (_a3 = i.isBlockComment) == null ? void 0 : _a3.call(i, n); + if ((r == null ? void 0 : r.hasLineSuffix) && !(r == null ? void 0 : r.isBlock) || Z(o, u(n), { backwards: true })) { + let c = No(o, u(n)); + return { doc: as([E, c ? E : "", s]), isBlock: p, hasLineSuffix: true }; + } + return !p || (r == null ? void 0 : r.hasLineSuffix) ? { doc: [as([" ", s]), ke], isBlock: p, hasLineSuffix: true } : { doc: [" ", s], isBlock: p, hasLineSuffix: false }; + } + function v(e, t2, r = {}) { + let { node: n } = e; + if (!R(n == null ? void 0 : n.comments)) return ""; + let { indent: s = false, marker: i, filter: o = al } = r, u = []; + if (e.each(({ node: c }) => { + c.leading || c.trailing || c.marker !== i || !o(c) || u.push(Ts(e, t2)); + }, "comments"), u.length === 0) return ""; + let p = L(E, u); + return s ? m([E, p]) : p; + } + function Mt(e, t2) { + let r = e.node; + if (!r) return {}; + let n = t2[/* @__PURE__ */ Symbol.for("printedComments")]; + if ((r.comments || []).filter((p) => !n.has(p)).length === 0) return { leading: "", trailing: "" }; + let i = [], o = [], u; + return e.each(() => { + let p = e.node; + if (n == null ? void 0 : n.has(p)) return; + let { leading: c, trailing: y } = p; + c ? i.push(pl(e, t2)) : y && (u = cl(e, t2, u), o.push(u.doc)); + }, "comments"), { leading: i, trailing: o }; + } + function De(e, t2, r) { + let { leading: n, trailing: s } = Mt(e, r); + return !n && !s ? t2 : Ar(t2, (i) => [n, i, s]); + } + var Et = class extends Error { + constructor() { + super(...arguments); + __publicField(this, "name", "ArgExpansionBailout"); } - function baseRange(start, end, step, fromRight) { - var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length); - while (length--) { - result2[fromRight ? length : ++index] = start; - start += step; + }; + function Ke(e, t2, r, n, s) { + let i = e.node, o = K(i), u = s && i.typeParameters ? r("typeParameters") : ""; + if (o.length === 0) return [u, "(", v(e, t2, { filter: (d) => _e(t2.originalText, I(d)) === ")" }), ")"]; + let { parent: p } = e, c = It(p), y = jo(i), D = []; + if (gi(e, (d, b) => { + let B = b === o.length - 1; + B && i.rest && D.push("..."), D.push(r()), !B && (D.push(","), c || y ? D.push(" ") : oe(o[b], t2) ? D.push(E, E) : D.push(A2)); + }), n && !ml(e)) { + if (ne(u) || ne(D)) throw new Et(); + return l([_t(u), "(", _t(D), ")"]); + } + let F = o.every((d) => !R(d.decorators)); + return y && F ? [u, "(", ...D, ")"] : c ? [u, "(", ...D, ")"] : (Gr(p) || Fi(p) || p.type === "TypeAlias" || p.type === "UnionTypeAnnotation" || p.type === "IntersectionTypeAnnotation" || p.type === "FunctionTypeAnnotation" && p.returnType === i) && o.length === 1 && o[0].name === null && i.this !== o[0] && o[0].typeAnnotation && i.typeParameters === null && Vt(o[0].typeAnnotation) && !i.rest ? t2.arrowParens === "always" || i.type === "HookTypeAnnotation" ? ["(", ...D, ")"] : D : [u, "(", m([f2, ...D]), P(!xi(i) && ie(t2, "all") ? "," : ""), f2, ")"]; + } + function jo(e) { + if (!e) return false; + let t2 = K(e); + if (t2.length !== 1) return false; + let [r] = t2; + return !T(r) && (r.type === "ObjectPattern" || r.type === "ArrayPattern" || r.type === "Identifier" && r.typeAnnotation && (r.typeAnnotation.type === "TypeAnnotation" || r.typeAnnotation.type === "TSTypeAnnotation") && Je(r.typeAnnotation.typeAnnotation) || r.type === "FunctionTypeParam" && Je(r.typeAnnotation) && r !== e.rest || r.type === "AssignmentPattern" && (r.left.type === "ObjectPattern" || r.left.type === "ArrayPattern") && (r.right.type === "Identifier" || se(r.right) && r.right.properties.length === 0 || q(r.right) && r.right.elements.length === 0)); + } + function ll(e) { + let t2; + return e.returnType ? (t2 = e.returnType, t2.typeAnnotation && (t2 = t2.typeAnnotation)) : e.typeAnnotation && (t2 = e.typeAnnotation), t2; + } + function lt(e, t2) { + var _a3; + let r = ll(e); + if (!r) return false; + let n = (_a3 = e.typeParameters) == null ? void 0 : _a3.params; + if (n) { + if (n.length > 1) return false; + if (n.length === 1) { + let s = n[0]; + if (s.constraint || s.default) return false; } - return result2; } - function baseRepeat(string2, n) { - var result2 = ""; - if (!string2 || n < 1 || n > MAX_SAFE_INTEGER) { - return result2; + return K(e).length === 1 && (Je(r) || ne(t2)); + } + function ml(e) { + return e.match((t2) => t2.type === "ArrowFunctionExpression" && t2.body.type === "BlockStatement", (t2, r) => { + if (t2.type === "CallExpression" && r === "arguments" && t2.arguments.length === 1 && t2.callee.type === "CallExpression") { + let n = t2.callee.callee; + return n.type === "Identifier" || n.type === "MemberExpression" && !n.computed && n.object.type === "Identifier" && n.property.type === "Identifier"; } - do { - if (n % 2) { - result2 += string2; - } - n = nativeFloor(n / 2); - if (n) { - string2 += string2; + return false; + }, (t2, r) => t2.type === "VariableDeclarator" && r === "init" || t2.type === "ExportDefaultDeclaration" && r === "declaration" || t2.type === "TSExportAssignment" && r === "expression" || t2.type === "AssignmentExpression" && r === "right" && t2.left.type === "MemberExpression" && t2.left.object.type === "Identifier" && t2.left.object.name === "module" && t2.left.property.type === "Identifier" && t2.left.property.name === "exports", (t2) => t2.type !== "VariableDeclaration" || t2.kind === "const" && t2.declarations.length === 1); + } + function vo(e) { + let t2 = K(e); + return t2.length > 1 && t2.some((r) => r.type === "TSParameterProperty"); + } + function Nt(e, t2) { + return (t2 === "params" || t2 === "this" || t2 === "rest") && jo(e); + } + function X(e) { + let { node: t2 } = e; + return !t2.optional || t2.type === "Identifier" && t2 === e.parent.key ? "" : M(t2) || J(t2) && t2.computed || t2.type === "OptionalIndexedAccessType" ? "?." : "?"; + } + function sn(e) { + return e.node.definite || e.match(void 0, (t2, r) => r === "id" && t2.type === "VariableDeclarator" && t2.definite) ? "!" : ""; + } + var Dl = k(["DeclareClass", "DeclareComponent", "DeclareFunction", "DeclareHook", "DeclareVariable", "DeclareExportDeclaration", "DeclareExportAllDeclaration", "DeclareOpaqueType", "DeclareTypeAlias", "DeclareEnum", "DeclareInterface"]); + function Q(e) { + let { node: t2 } = e; + return t2.declare || Dl(t2) && e.parent.type !== "DeclareExportDeclaration" ? "declare " : ""; + } + var fl = k(["TSAbstractMethodDefinition", "TSAbstractPropertyDefinition", "TSAbstractAccessorProperty"]); + function Zt({ node: e }) { + return e.abstract || fl(e) ? "abstract " : ""; + } + function Ft(e, t2, r) { + return e.type === "EmptyStatement" ? T(e, x.Leading) ? [" ", t2] : t2 : e.type === "BlockStatement" || r ? [" ", t2] : m([A2, t2]); + } + function jt(e) { + return e.accessibility ? e.accessibility + " " : ""; + } + var yl = /^[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC][\$0-9A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]*$/, El = (e) => yl.test(e), Ro = El; + function Fl(e) { + return e.length === 1 ? e : e.toLowerCase().replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(?=\d)/u, "$1$2").replace(/^([+-]?[\d.]+)e[+-]?0+$/u, "$1").replace(/^([+-])?\./u, "$10.").replace(/(\.\d+?)0+(?=e|$)/u, "$1").replace(/\.(?=e|$)/u, ""); + } + var dt = Fl; + var dl = 0; + function on(e, t2, r) { + var _a3; + let { node: n, parent: s, grandparent: i, key: o } = e, u = o !== "body" && (s.type === "IfStatement" || s.type === "WhileStatement" || s.type === "SwitchStatement" || s.type === "DoWhileStatement"), p = n.operator === "|>" && ((_a3 = e.root.extra) == null ? void 0 : _a3.__isUsingHackPipeline), c = xs(e, t2, r, false, u); + if (u) return c; + if (p) return l(c); + if (o === "callee" && (M(s) || s.type === "NewExpression") || s.type === "UnaryExpression" || J(s) && !s.computed) return l([m([f2, ...c]), f2]); + let y = s.type === "ReturnStatement" || s.type === "ThrowStatement" || s.type === "JSXExpressionContainer" && i.type === "JSXAttribute" || n.operator !== "|" && s.type === "JsExpressionRoot" || n.type !== "NGPipeExpression" && (s.type === "NGRoot" && t2.parser === "__ng_binding" || s.type === "NGMicrosyntaxExpression" && i.type === "NGMicrosyntax" && i.body.length === 1) || n === s.body && s.type === "ArrowFunctionExpression" || n !== s.body && s.type === "ForStatement" || s.type === "ConditionalExpression" && i.type !== "ReturnStatement" && i.type !== "ThrowStatement" && !M(i) && i.type !== "NewExpression" || s.type === "TemplateLiteral" || Al(e), D = s.type === "AssignmentExpression" || s.type === "VariableDeclarator" || s.type === "ClassProperty" || s.type === "PropertyDefinition" || s.type === "TSAbstractPropertyDefinition" || s.type === "ClassPrivateProperty" || Oe(s), F = Te(n.left) && dr(n.operator, n.left.operator); + if (y || er(n) && !F || !er(n) && D) return l(c); + if (c.length === 0) return ""; + let C = H(n.right), d = c.findIndex((S) => typeof S != "string" && !Array.isArray(S) && S.type === Fe), b = c.slice(0, d === -1 ? 1 : d + 1), B = c.slice(b.length, C ? -1 : void 0), O = /* @__PURE__ */ Symbol("logicalChain-" + ++dl), h = l([...b, m(B)], { id: O }); + if (!C) return h; + let g = N(0, c, -1); + return l([h, yt(g, { groupId: O })]); + } + function xs(e, t2, r, n, s) { + var _a3; + let { node: i } = e; + if (!Te(i)) return [l(r())]; + let o = []; + dr(i.operator, i.left.operator) ? o = e.call(() => xs(e, t2, r, true, s), "left") : o.push(l(r("left"))); + let u = er(i), p = i.right.type === "ChainExpression" ? i.right.expression : i.right, c = (i.operator === "|>" || i.type === "NGPipeExpression" || Cl(e, t2)) && !Ee(t2.originalText, p), D = !T(p, x.Leading, Hr) && Ee(t2.originalText, p), F = i.type === "NGPipeExpression" ? "|" : i.operator, C = i.type === "NGPipeExpression" && i.arguments.length > 0 ? l(m([f2, ": ", L([A2, ": "], e.map(() => xe(2, l(r())), "arguments"))])) : "", d; + if (u) d = [F, Ee(t2.originalText, p) ? m([A2, r("right"), C]) : [" ", r("right"), C]]; + else { + let g = F === "|>" && ((_a3 = e.root.extra) == null ? void 0 : _a3.__isUsingHackPipeline) ? e.call(() => xs(e, t2, r, true, s), "right") : r("right"); + if (t2.experimentalOperatorPosition === "start") { + let S = ""; + if (D) switch (We(g)) { + case Be: + S = g.splice(0, 1)[0]; + break; + case Pe: + S = g.contents.splice(0, 1)[0]; + break; } - } while (n); - return result2; + d = [A2, S, F, " ", g, C]; + } else d = [c ? A2 : "", F, c ? " " : A2, g, C]; } - function baseRest(func, start) { - return setToString(overRest(func, start, identity), func + ""); + let { parent: b } = e, B = T(i.left, x.Trailing | x.Line); + if ((B || !(s && i.type === "LogicalExpression") && b.type !== i.type && i.left.type !== i.type && i.right.type !== i.type) && (d = l(d, { shouldBreak: B })), t2.experimentalOperatorPosition === "start" ? o.push(u || D ? " " : "", d) : o.push(c ? "" : " ", d), n && T(i)) { + let h = Qt(De(e, o, t2)); + return h.type === Me ? h.parts : Array.isArray(h) ? h : [h]; } - function baseSample(collection) { - return arraySample(values(collection)); + return o; + } + function er(e) { + return e.type !== "LogicalExpression" ? false : !!(se(e.right) && e.right.properties.length > 0 || q(e.right) && e.right.elements.length > 0 || H(e.right)); + } + var Jo = (e) => e.type === "BinaryExpression" && e.operator === "|"; + function Cl(e, t2) { + return (t2.parser === "__vue_expression" || t2.parser === "__vue_ts_expression") && Jo(e.node) && !e.hasAncestor((r) => !Jo(r) && r.type !== "JsExpressionRoot"); + } + function Al(e) { + if (e.key !== "arguments") return false; + let { parent: t2 } = e; + if (!(M(t2) && !t2.optional && t2.arguments.length === 1)) return false; + let { callee: r } = t2; + return r.type === "Identifier" && r.name === "Boolean"; + } + function un(e, t2, r) { + let { node: n } = e, { parent: s } = e, i = s.type !== "TypeParameterInstantiation" && (!Ue(s) || !t2.experimentalTernaries) && s.type !== "TSTypeParameterInstantiation" && s.type !== "GenericTypeAnnotation" && s.type !== "TSTypeReference" && s.type !== "TSTypeAssertion" && s.type !== "TupleTypeAnnotation" && s.type !== "TSTupleType" && !(s.type === "FunctionTypeParam" && !s.name && e.grandparent.this !== s) && !((Cr(s) || s.type === "VariableDeclarator") && Ee(t2.originalText, n)) && !(Cr(s) && T(s.id, x.Trailing | x.Line)), o = gs(n), u = e.map(() => { + let C = r(); + return o || (C = xe(2, C)), De(e, C, t2); + }, "types"), p = "", c = ""; + if (Yr(e) && ({ leading: p, trailing: c } = Mt(e, t2)), o) return [p, L(" | ", u), c]; + let y = i && !Ee(t2.originalText, n), D = [P([y ? A2 : "", "| "]), L([A2, "| "], u)]; + if (ge(e, t2)) return [p, l([m(D), f2]), c]; + let F = [p, l(D)]; + return (s.type === "TupleTypeAnnotation" || s.type === "TSTupleType") && s[s.type === "TupleTypeAnnotation" && s.types ? "types" : "elementTypes"].length > 1 ? [l([m([P(["(", f2]), F]), f2, P(")")]), c] : [l(i ? m(F) : F), c]; + } + var Tl = k(["VoidTypeAnnotation", "TSVoidKeyword", "NullLiteralTypeAnnotation", "TSNullKeyword"]), xl = k(["ObjectTypeAnnotation", "TSTypeLiteral", "GenericTypeAnnotation", "TSTypeReference"]); + function gs(e) { + let { types: t2 } = e; + if (t2.some((n) => T(n))) return false; + let r = t2.find((n) => xl(n)); + return r ? t2.every((n) => n === r || Tl(n)) : false; + } + function Go(e) { + return Vt(e) || Je(e) ? true : Se(e) ? gs(e) : false; + } + var gl = /* @__PURE__ */ new WeakSet(); + function G(e, t2, r = "typeAnnotation") { + let { node: { [r]: n } } = e; + if (!n) return ""; + let s = false; + if (n.type === "TSTypeAnnotation" || n.type === "TypeAnnotation") { + let i = e.call(Wo, r); + (i === "=>" || i === ":" && T(n, x.Leading)) && (s = true), gl.add(n); } - function baseSampleSize(collection, n) { - var array = values(collection); - return shuffleSelf(array, baseClamp(n, 0, array.length)); + return s ? [" ", t2(r)] : t2(r); + } + var Wo = (e) => e.match((t2) => t2.type === "TSTypeAnnotation", (t2, r) => (r === "returnType" || r === "typeAnnotation") && (t2.type === "TSFunctionType" || t2.type === "TSConstructorType")) ? "=>" : e.match((t2) => t2.type === "TSTypeAnnotation", (t2, r) => r === "typeAnnotation" && (t2.type === "TSJSDocNullableType" || t2.type === "TSJSDocNonNullableType" || t2.type === "TSTypePredicate")) || e.match((t2) => t2.type === "TypeAnnotation", (t2, r) => r === "typeAnnotation" && t2.type === "Identifier", (t2, r) => r === "id" && t2.type === "DeclareFunction") || e.match((t2) => t2.type === "TypeAnnotation", (t2, r) => r === "typeAnnotation" && t2.type === "Identifier", (t2, r) => r === "id" && t2.type === "DeclareHook") || e.match((t2) => t2.type === "TypeAnnotation", (t2, r) => r === "bound" && t2.type === "TypeParameter" && t2.usesExtendsBound) ? "" : ":"; + function an(e, t2, r) { + let n = Wo(e); + return n ? [n, " ", r("typeAnnotation")] : r("typeAnnotation"); + } + function hl(e, t2, r, n) { + let { node: s } = e, i = s.inexact ? "..." : ""; + return T(s, x.Dangling) ? l([r, i, v(e, t2, { indent: true }), f2, n]) : [r, i, n]; + } + function tr(e, t2, r) { + let { node: n } = e, s = [], i = "[", o = "]", u = n.type === "TupleTypeAnnotation" && n.types ? "types" : n.type === "TSTupleType" || n.type === "TupleTypeAnnotation" ? "elementTypes" : "elements", p = n[u]; + if (p.length === 0) s.push(hl(e, t2, i, o)); + else { + let c = N(0, p, -1), y = (c == null ? void 0 : c.type) !== "RestElement" && !n.inexact, D = c === null, F = /* @__PURE__ */ Symbol("array"), C = !t2.__inJestEach && p.length > 1 && p.every((B, O, h) => { + let g = B == null ? void 0 : B.type; + if (!q(B) && !se(B)) return false; + let S = h[O + 1]; + if (S && g !== S.type) return false; + let j = q(B) ? "elements" : "properties"; + return B[j] && B[j].length > 1; + }), d = hs(n, t2), b = y ? D ? "," : ie(t2) ? d ? P(",", "", { groupId: F }) : P(",") : "" : ""; + s.push(l([i, m([f2, d ? Bl(e, t2, r, b) : [Sl(e, t2, r, u, n.inexact), b], v(e, t2)]), f2, o], { shouldBreak: C, id: F })); + } + return s.push(X(e), G(e, r)), s; + } + function hs(e, t2) { + return q(e) && e.elements.length > 0 && e.elements.every((r) => r && (Ce(r) || Xn(r) && !T(r.argument)) && !T(r, x.Trailing | x.Line, (n) => !Z(t2.originalText, w(n), { backwards: true }))); + } + function qo({ node: e }, { originalText: t2 }) { + let r = I(e); + if (r === w(e)) return false; + let { length: n } = t2; + for (; r < n && t2[r] !== ","; ) r = qt(t2, Ut(t2, r + 1)); + return Yt(t2, r); + } + function Sl(e, t2, r, n, s) { + let i = []; + return e.each(({ node: o, isLast: u }) => { + i.push(o ? l(r()) : ""), (!u || s) && i.push([",", A2, o && qo(e, t2) ? f2 : ""]); + }, n), s && i.push("..."), i; + } + function Bl(e, t2, r, n) { + let s = []; + return e.each(({ isLast: i, next: o }) => { + s.push([r(), i ? n : ","]), i || s.push(qo(e, t2) ? [E, E] : T(o, x.Leading | x.Line) ? E : A2); + }, "elements"), zr(s); + } + function bl(e, t2, r) { + let { node: n } = e, s = le(n); + if (s.length === 0) return ["(", v(e, t2), ")"]; + let i = s.length - 1; + if (Il(s)) { + let D = ["("]; + return $t(e, (F, C) => { + D.push(r()), C !== i && D.push(", "); + }), D.push(")"), D; } - function baseSet(object, path5, value, customizer) { - if (!isObject(object)) { - return object; - } - path5 = castPath(path5, object); - var index = -1, length = path5.length, lastIndex = length - 1, nested = object; - while (nested != null && ++index < length) { - var key = toKey(path5[index]), newValue = value; - if (key === "__proto__" || key === "constructor" || key === "prototype") { - return object; - } - if (index != lastIndex) { - var objValue = nested[key]; - newValue = customizer ? customizer(objValue, key, nested) : undefined2; - if (newValue === undefined2) { - newValue = isObject(objValue) ? objValue : isIndex(path5[index + 1]) ? [] : {}; - } - } - assignValue(nested, key, newValue); - nested = nested[key]; + let o = false, u = []; + $t(e, ({ node: D }, F) => { + let C = r(); + F === i || (oe(D, t2) ? (o = true, C = [C, ",", E, E]) : C = [C, ",", A2]), u.push(C); + }); + let p = !t2.parser.startsWith("__ng_") && n.type !== "ImportExpression" && n.type !== "TSImportType" && n.type !== "TSExternalModuleReference" && ie(t2, "all") ? "," : ""; + function c() { + return l(["(", m([A2, ...u]), p, A2, ")"], { shouldBreak: true }); + } + if (o || e.parent.type !== "Decorator" && Ai(s)) return c(); + if (kl(s)) { + let D = u.slice(1); + if (D.some(ne)) return c(); + let F; + try { + F = r(Kn(n, 0), { expandFirstArg: true }); + } catch (C) { + if (C instanceof Et) return c(); + throw C; } - return object; + return ne(F) ? [ke, nt([["(", l(F, { shouldBreak: true }), ", ", ...D, ")"], c()])] : nt([["(", F, ", ", ...D, ")"], ["(", l(F, { shouldBreak: true }), ", ", ...D, ")"], c()]); } - var baseSetData = !metaMap ? identity : function(func, data) { - metaMap.set(func, data); - return func; - }; - var baseSetToString = !defineProperty ? identity : function(func, string2) { - return defineProperty(func, "toString", { - "configurable": true, - "enumerable": false, - "value": constant(string2), - "writable": true - }); - }; - function baseShuffle(collection) { - return shuffleSelf(values(collection)); - } - 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 result2 = Array2(length); - while (++index < length) { - result2[index] = array[index + start]; + if (Pl(s, u, t2)) { + let D = u.slice(0, -1); + if (D.some(ne)) return c(); + let F; + try { + F = r(Kn(n, -1), { expandLastArg: true }); + } catch (C) { + if (C instanceof Et) return c(); + throw C; } - return result2; + return ne(F) ? [ke, nt([["(", ...D, l(F, { shouldBreak: true }), ")"], c()])] : nt([["(", ...D, F, ")"], ["(", ...D, l(F, { shouldBreak: true }), ")"], c()]); } - function baseSome(collection, predicate) { - var result2; - baseEach(collection, function(value, index, collection2) { - result2 = predicate(value, index, collection2); - return !result2; - }); - return !!result2; - } - 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); - } - function baseSortedIndexBy(array, value, iteratee2, retHighest) { - var low = 0, high = array == null ? 0 : array.length; - if (high === 0) { - return 0; - } - value = iteratee2(value); - var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined2; - while (low < high) { - var mid = nativeFloor((low + high) / 2), computed = iteratee2(array[mid]), othIsDefined = computed !== undefined2, 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); + let y = ["(", m([f2, ...u]), P(p), f2, ")"]; + return Ur(e) ? y : l(y, { shouldBreak: u.some(ne) || o }); + } + function gr(e, t2 = false) { + return se(e) && (e.properties.length > 0 || T(e)) || q(e) && (e.elements.length > 0 || T(e)) || e.type === "TSTypeAssertion" && gr(e.expression) || Ae(e) && gr(e.expression) || e.type === "FunctionExpression" || e.type === "ArrowFunctionExpression" && (!e.returnType || !e.returnType.typeAnnotation || e.returnType.typeAnnotation.type !== "TSTypeReference" || Ll(e.body)) && (e.body.type === "BlockStatement" || e.body.type === "ArrowFunctionExpression" && gr(e.body, true) || se(e.body) || q(e.body) || !t2 && (M(e.body) || e.body.type === "ConditionalExpression") || H(e.body)) || e.type === "DoExpression" || e.type === "ModuleExpression"; + } + function Pl(e, t2, r) { + var _a3, _b2; + let n = N(0, e, -1); + if (e.length === 1) { + let i = N(0, t2, -1); + if (((_a3 = i.label) == null ? void 0 : _a3.embed) && ((_b2 = i.label) == null ? void 0 : _b2.hug) !== false) return true; } - function baseSortedUniq(array, iteratee2) { - var index = -1, length = array.length, resIndex = 0, result2 = []; - while (++index < length) { - var value = array[index], computed = iteratee2 ? iteratee2(value) : value; - if (!index || !eq(computed, seen)) { - var seen = computed; - result2[resIndex++] = value === 0 ? 0 : value; - } + let s = N(0, e, -2); + return !T(n, x.Leading) && !T(n, x.Trailing) && gr(n) && (!s || s.type !== n.type) && (e.length !== 2 || s.type !== "ArrowFunctionExpression" || !q(n)) && !(e.length > 1 && hs(n, r)); + } + function kl(e) { + if (e.length !== 2) return false; + let [t2, r] = e; + return t2.type === "ModuleExpression" && Ol(r) ? true : !T(t2) && (t2.type === "FunctionExpression" || t2.type === "ArrowFunctionExpression" && t2.body.type === "BlockStatement") && r.type !== "FunctionExpression" && r.type !== "ArrowFunctionExpression" && r.type !== "ConditionalExpression" && Yo(r) && !gr(r); + } + function Yo(e) { + if (e.type === "ParenthesizedExpression") return Yo(e.expression); + if (Ae(e) || e.type === "TypeCastExpression") { + let { typeAnnotation: t2 } = e; + if (t2.type === "TypeAnnotation" && (t2 = t2.typeAnnotation), t2.type === "TSArrayType" && (t2 = t2.elementType, t2.type === "TSArrayType" && (t2 = t2.elementType)), t2.type === "GenericTypeAnnotation" || t2.type === "TSTypeReference") { + let r = t2.type === "GenericTypeAnnotation" ? t2.typeParameters : t2.typeArguments; + (r == null ? void 0 : r.params.length) === 1 && (t2 = r.params[0]); } - return result2; + return Vt(t2) && Re(e.expression, 1); } - function baseToNumber(value) { - if (typeof value == "number") { - return value; - } - if (isSymbol(value)) { - return NAN; - } - return +value; + return Dt(e) && le(e).length > 1 ? false : Te(e) ? Re(e.left, 1) && Re(e.right, 1) : Vn(e) || Re(e); + } + function Il(e) { + return e.length === 2 ? Uo(e, 0) : e.length === 3 ? e[0].type === "Identifier" && Uo(e, 1) : false; + } + function Uo(e, t2) { + let r = e[t2], n = e[t2 + 1]; + return r.type === "ArrowFunctionExpression" && K(r).length === 0 && r.body.type === "BlockStatement" && n.type === "ArrayExpression" && !e.some((s) => T(s)); + } + function Ll(e) { + return e.type === "BlockStatement" && (e.body.some((t2) => t2.type !== "EmptyStatement") || T(e, x.Dangling)); + } + function Ol(e) { + if (!(e.type === "ObjectExpression" && e.properties.length === 1)) return false; + let [t2] = e.properties; + return Oe(t2) ? !t2.computed && (t2.key.type === "Identifier" && t2.key.name === "type" || V(t2.key) && t2.key.value === "type") && V(t2.value) && t2.value.value === "module" : false; + } + var hr = bl; + function Ho(e, t2, r) { + return [r("object"), l(m([f2, Ss(e, t2, r)]))]; + } + function Ss(e, t2, r) { + return ["::", r("callee")]; + } + var wl = (e) => ((e.type === "ChainExpression" || e.type === "TSNonNullExpression") && (e = e.expression), M(e) && le(e).length > 0); + function _l(e) { + let { node: t2, ancestors: r } = e; + for (let n of r) { + if (!(J(n) && n.object === t2 || n.type === "TSNonNullExpression" && n.expression === t2)) return n.type === "NewExpression" && n.callee === t2; + t2 = n; } - function baseToString(value) { - if (typeof value == "string") { - return value; - } - if (isArray(value)) { - return arrayMap(value, baseToString) + ""; - } - if (isSymbol(value)) { - return symbolToString ? symbolToString.call(value) : ""; - } - var result2 = value + ""; - return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2; + return false; + } + function Xo(e, t2, r) { + var _a3; + let n = r("object"), s = Bs(e, t2, r), { node: i } = e, o = e.findAncestor((c) => !(J(c) || c.type === "TSNonNullExpression")), u = e.findAncestor((c) => !(c.type === "ChainExpression" || c.type === "TSNonNullExpression")), p = o.type === "BindExpression" || o.type === "AssignmentExpression" && o.left.type !== "Identifier" || _l(e) || i.computed || i.object.type === "Identifier" && i.property.type === "Identifier" && !J(u) || (u.type === "AssignmentExpression" || u.type === "VariableDeclarator") && (wl(i.object) || ((_a3 = n.label) == null ? void 0 : _a3.memberChain)); + return pt(n.label, [n, p ? s : l(m([f2, s]))]); + } + function Bs(e, t2, r) { + let n = r("property"), { node: s } = e, i = X(e); + return s.computed ? !s.property || Ce(s.property) ? [i, "[", n, "]"] : l([i, "[", m([f2, n]), f2, "]"]) : [i, ".", n]; + } + function Vo(e, t2, r) { + if (e.node.type === "ChainExpression") return e.call(() => Vo(e, t2, r), "expression"); + let n = (e.parent.type === "ChainExpression" ? e.grandparent : e.parent).type === "ExpressionStatement", s = []; + function i(_) { + let { originalText: re } = t2, ae = at(re, I(_)); + return re.charAt(ae) === ")" ? ae !== false && Yt(re, ae + 1) : oe(_, t2); + } + function o() { + let { node: _ } = e; + if (_.type === "ChainExpression") return e.call(o, "expression"); + if (M(_) && (Tt(_.callee) || M(_.callee))) { + let re = i(_); + s.unshift({ node: _, hasTrailingEmptyLine: re, printed: [De(e, [X(e), r("typeArguments"), hr(e, t2, r)], t2), re ? E : ""] }), e.call(o, "callee"); + } else Tt(_) ? (s.unshift({ node: _, needsParens: ge(e, t2), printed: De(e, J(_) ? Bs(e, t2, r) : Ss(e, t2, r), t2) }), e.call(o, "object")) : _.type === "TSNonNullExpression" ? (s.unshift({ node: _, printed: De(e, "!", t2) }), e.call(o, "expression")) : s.unshift({ node: _, printed: r() }); } - function baseUniq(array, iteratee2, comparator) { - var index = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2; - if (comparator) { - isCommon = false; - includes2 = arrayIncludesWith; - } else if (length >= LARGE_ARRAY_SIZE) { - var set3 = iteratee2 ? null : createSet(array); - if (set3) { - return setToArray(set3); - } - isCommon = false; - includes2 = cacheHas; - seen = new SetCache(); - } else { - seen = iteratee2 ? [] : result2; - } - outer: - while (++index < length) { - var value = array[index], computed = iteratee2 ? iteratee2(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 (iteratee2) { - seen.push(computed); - } - result2.push(value); - } else if (!includes2(seen, computed, comparator)) { - if (seen !== result2) { - seen.push(computed); - } - result2.push(value); - } + let { node: u } = e; + s.unshift({ node: u, printed: [X(e), r("typeArguments"), hr(e, t2, r)] }), u.callee && e.call(o, "callee"); + let p = [], c = [s[0]], y = 1; + for (; y < s.length && (s[y].node.type === "TSNonNullExpression" || M(s[y].node) || J(s[y].node) && s[y].node.computed && Ce(s[y].node.property)); ++y) c.push(s[y]); + if (!M(s[0].node)) for (; y + 1 < s.length && (Tt(s[y].node) && Tt(s[y + 1].node)); ++y) c.push(s[y]); + p.push(c), c = []; + let D = false; + for (; y < s.length; ++y) { + if (D && Tt(s[y].node)) { + if (s[y].node.computed && Ce(s[y].node.property)) { + c.push(s[y]); + continue; } - return result2; - } - function baseUnset(object, path5) { - path5 = castPath(path5, object); - object = parent(object, path5); - return object == null || delete object[toKey(last(path5))]; - } - function baseUpdate(object, path5, updater, customizer) { - return baseSet(object, path5, updater(baseGet(object, path5)), customizer); - } - function baseWhile(array, predicate, isDrop, fromRight) { - var length = array.length, index = fromRight ? length : -1; - while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) { + p.push(c), c = [], D = false; } - return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index); + (M(s[y].node) || s[y].node.type === "ImportExpression") && (D = true), c.push(s[y]), T(s[y].node, x.Trailing) && (p.push(c), c = [], D = false); } - function baseWrapperValue(value, actions) { - var result2 = value; - if (result2 instanceof LazyWrapper) { - result2 = result2.value(); - } - return arrayReduce(actions, function(result3, action) { - return action.func.apply(action.thisArg, arrayPush([result3], action.args)); - }, result2); + c.length > 0 && p.push(c); + function F(_) { + return /^[A-Z]|^[$_]+$/u.test(_); } - function baseXor(arrays, iteratee2, comparator) { - var length = arrays.length; - if (length < 2) { - return length ? baseUniq(arrays[0]) : []; - } - var index = -1, result2 = Array2(length); - while (++index < length) { - var array = arrays[index], othIndex = -1; - while (++othIndex < length) { - if (othIndex != index) { - result2[index] = baseDifference(result2[index] || array, arrays[othIndex], iteratee2, comparator); - } - } - } - return baseUniq(baseFlatten(result2, 1), iteratee2, comparator); + function C(_) { + return _.length <= t2.tabWidth; } - function baseZipObject(props, values2, assignFunc) { - var index = -1, length = props.length, valsLength = values2.length, result2 = {}; - while (++index < length) { - var value = index < valsLength ? values2[index] : undefined2; - assignFunc(result2, props[index], value); + function d(_) { + var _a3; + let re = (_a3 = _[1][0]) == null ? void 0 : _a3.node.computed; + if (_[0].length === 1) { + let it = _[0][0].node; + return it.type === "ThisExpression" || it.type === "Identifier" && (F(it.name) || n && C(it.name) || re); } - return result2; + let ae = N(0, _[0], -1).node; + return J(ae) && ae.property.type === "Identifier" && (F(ae.property.name) || re); } - function castArrayLikeObject(value) { - return isArrayLikeObject(value) ? value : []; + let b = p.length >= 2 && !T(p[1][0].node) && d(p); + function B(_) { + let re = _.map((ae) => ae.printed); + return _.length > 0 && N(0, _, -1).needsParens ? ["(", ...re, ")"] : re; } - function castFunction(value) { - return typeof value == "function" ? value : identity; + function O(_) { + return _.length === 0 ? "" : m([E, L(E, _.map(B))]); } - function castPath(value, object) { - if (isArray(value)) { - return value; - } - return isKey(value, object) ? [value] : stringToPath(toString(value)); + let h = p.map(B), g = h, S = b ? 3 : 2, j = p.flat(), U = j.slice(1, -1).some((_) => T(_.node, x.Leading)) || j.slice(0, -1).some((_) => T(_.node, x.Trailing)) || p[S] && T(p[S][0].node, x.Leading); + if (p.length <= S && !U && !p.some((_) => N(0, _, -1).hasTrailingEmptyLine)) return Ur(e) ? g : l(g); + let fe = N(0, p[b ? 1 : 0], -1).node, Y = !M(fe) && i(fe), z = [B(p[0]), b ? p.slice(1, 2).map(B) : "", Y ? E : "", O(p.slice(b ? 2 : 1))], ee = s.map(({ node: _ }) => _).filter(M); + function Ie() { + let _ = N(0, N(0, p, -1), -1).node, re = N(0, h, -1); + return M(_) && ne(re) && ee.slice(0, -1).some((ae) => ae.arguments.some(Ht)); } - var castRest = baseRest; - function castSlice(array, start, end) { - var length = array.length; - end = end === undefined2 ? length : end; - return !start && end >= length ? array : baseSlice(array, start, end); + let st; + return U || ee.length > 2 && ee.some((_) => !_.arguments.every((re) => Re(re))) || h.slice(0, -1).some(ne) || Ie() ? st = l(z) : st = [ne(g) || Y ? ke : "", nt([g, z])], pt({ memberChain: true }, st); + } + var $o = Vo; + function vt(e, t2, r) { + var _a3; + let { node: n } = e, s = n.type === "NewExpression", i = X(e), o = le(n), u = n.type !== "TSImportType" && n.typeArguments ? r("typeArguments") : "", p = o.length === 1 && Wr(o[0], t2.originalText); + if (p || Nl(e) || jl(e) || It(n, e.parent)) { + let D = []; + if ($t(e, () => { + D.push(r()); + }), !(p && ((_a3 = D[0].label) == null ? void 0 : _a3.embed))) return [s ? "new " : "", Ko(e, r), i, u, "(", L(", ", D), ")"]; } - var clearTimeout2 = ctxClearTimeout || function(id) { - return root.clearTimeout(id); - }; - function cloneBuffer(buffer, isDeep) { - if (isDeep) { - return buffer.slice(); + let c = n.type === "ImportExpression" || n.type === "TSImportType" || n.type === "TSExternalModuleReference"; + if (!c && !s && Tt(n.callee) && !e.call(() => ge(e, t2), "callee", ...n.callee.type === "ChainExpression" ? ["expression"] : [])) return $o(e, t2, r); + let y = [s ? "new " : "", Ko(e, r), i, u, hr(e, t2, r)]; + return c || M(n.callee) ? l(y) : y; + } + function Ko(e, t2) { + let { node: r } = e; + return r.type === "ImportExpression" ? `import${r.phase ? `.${r.phase}` : ""}` : r.type === "TSImportType" ? "import" : r.type === "TSExternalModuleReference" ? "require" : t2("callee"); + } + var Ml = ["require", "require.resolve", "require.resolve.paths", "import.meta.resolve"]; + function Nl(e) { + let { node: t2 } = e; + if (!(t2.type === "ImportExpression" || t2.type === "TSImportType" || t2.type === "TSExternalModuleReference" || t2.type === "CallExpression" && !t2.optional && Pt(t2.callee, Ml))) return false; + let r = le(t2); + return r.length === 1 && V(r[0]) && !T(r[0]); + } + function jl(e) { + let { node: t2 } = e; + if (t2.type !== "CallExpression" || t2.optional || t2.callee.type !== "Identifier") return false; + let r = le(t2); + return t2.callee.name === "require" ? (r.length === 1 && V(r[0]) || r.length > 1) && !T(r[0]) : t2.callee.name === "define" && e.parent.type === "ExpressionStatement" ? r.length === 1 || r.length === 2 && r[0].type === "ArrayExpression" || r.length === 3 && V(r[0]) && r[1].type === "ArrayExpression" : false; + } + function ht(e, t2, r, n, s, i) { + let o = vl(e, t2, r, n, i), u = i ? r(i, { assignmentLayout: o }) : ""; + switch (o) { + case "break-after-operator": + return l([l(n), s, l(m([A2, u]))]); + case "never-break-after-operator": + return l([l(n), s, " ", u]); + case "fluid": { + let p = /* @__PURE__ */ Symbol("assignment"); + return l([l(n), s, l(m(A2), { id: p }), je, yt(u, { groupId: p })]); } - var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); - buffer.copy(result2); - return result2; - } - function cloneArrayBuffer(arrayBuffer) { - var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer)); - return result2; - } - function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; - return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); - } - function cloneRegExp(regexp) { - var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp)); - result2.lastIndex = regexp.lastIndex; - return result2; - } - function cloneSymbol(symbol) { - return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {}; - } - function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); + case "break-lhs": + return l([n, s, " ", l(u)]); + case "chain": + return [l(n), s, A2, u]; + case "chain-tail": + return [l(n), s, m([A2, u])]; + case "chain-tail-arrow-chain": + return [l(n), s, u]; + case "only-left": + return n; } - function compareAscending(value, other) { - if (value !== other) { - var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value); - var othIsDefined = other !== undefined2, 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; + } + function Zo(e, t2, r) { + let { node: n } = e; + return ht(e, t2, r, r("left"), [" ", n.operator], "right"); + } + function eu(e, t2, r) { + return ht(e, t2, r, r("id"), " =", "init"); + } + function vl(e, t2, r, n, s) { + let { node: i } = e, o = i[s]; + if (!o) return "only-left"; + let u = !pn(o); + if (e.match(pn, tu, (F) => !u || F.type !== "ExpressionStatement" && F.type !== "VariableDeclaration")) return u ? o.type === "ArrowFunctionExpression" && o.body.type === "ArrowFunctionExpression" ? "chain-tail-arrow-chain" : "chain-tail" : "chain"; + if (!u && pn(o.right) || Ee(t2.originalText, o)) return "break-after-operator"; + if (i.type === "ImportAttribute" || o.type === "CallExpression" && o.callee.name === "require" || t2.parser === "json5" || t2.parser === "jsonc" || t2.parser === "json") return "never-break-after-operator"; + let y = Vi(n); + if (Jl(i) || ql(i) || bs(i) && y) return "break-lhs"; + let D = Ul(i, n, t2); + return e.call(() => Rl(e, t2, r, D), s) ? "break-after-operator" : Gl(i) ? "break-lhs" : !y && (D || o.type === "TemplateLiteral" || o.type === "TaggedTemplateExpression" || Ei(o) || Ce(o) || o.type === "ClassExpression") ? "never-break-after-operator" : "fluid"; + } + function Rl(e, t2, r, n) { + let s = e.node; + if (Te(s) && !er(s)) return true; + switch (s.type) { + case "StringLiteralTypeAnnotation": + case "SequenceExpression": + return true; + case "TSConditionalType": + case "ConditionalTypeAnnotation": + if (!t2.experimentalTernaries && !Xl(s)) break; + return true; + case "ConditionalExpression": { + if (!t2.experimentalTernaries) { + let { test: c } = s; + return Te(c) && !er(c); } + let { consequent: u, alternate: p } = s; + return u.type === "ConditionalExpression" || p.type === "ConditionalExpression"; } - return 0; + case "ClassExpression": + return R(s.decorators); } - function compareMultiple(object, other, orders) { - var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; - while (++index < length) { - var result2 = compareAscending(objCriteria[index], othCriteria[index]); - if (result2) { - if (index >= ordersLength) { - return result2; - } - var order = orders[index]; - return result2 * (order == "desc" ? -1 : 1); - } - } - return object.index - other.index; + if (n) return false; + let i = s, o = []; + for (; ; ) if (i.type === "UnaryExpression" || i.type === "AwaitExpression" || i.type === "YieldExpression" && i.argument !== null) i = i.argument, o.push("argument"); + else if (i.type === "TSNonNullExpression") i = i.expression, o.push("expression"); + else break; + return !!(V(i) || e.call(() => ru(e, t2, r), ...o)); + } + function Jl(e) { + if (tu(e)) { + let t2 = e.left || e.id; + return t2.type === "ObjectPattern" && t2.properties.length > 2 && t2.properties.some((r) => { + var _a3; + return Oe(r) && (!r.shorthand || ((_a3 = r.value) == null ? void 0 : _a3.type) === "AssignmentPattern"); + }); } - 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), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried; - while (++leftIndex < leftLength) { - result2[leftIndex] = partials[leftIndex]; - } - while (++argsIndex < holdersLength) { - if (isUncurried || argsIndex < argsLength) { - result2[holders[argsIndex]] = args[argsIndex]; - } - } - while (rangeLength--) { - result2[leftIndex++] = args[argsIndex++]; - } - return result2; + return false; + } + function pn(e) { + return e.type === "AssignmentExpression"; + } + function tu(e) { + return pn(e) || e.type === "VariableDeclarator"; + } + function Gl(e) { + let t2 = Wl(e); + if (R(t2)) { + let r = e.type === "TSTypeAliasDeclaration" ? "constraint" : "bound"; + if (t2.length > 1 && t2.some((n) => n[r] || n.default)) return true; } - 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), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried; - while (++argsIndex < rangeLength) { - result2[argsIndex] = args[argsIndex]; - } - var offset = argsIndex; - while (++rightIndex < rightLength) { - result2[offset + rightIndex] = partials[rightIndex]; - } - while (++holdersIndex < holdersLength) { - if (isUncurried || argsIndex < argsLength) { - result2[offset + holders[holdersIndex]] = args[argsIndex++]; - } - } - return result2; + return false; + } + function Wl(e) { + var _a3; + if (Cr(e)) return (_a3 = e.typeParameters) == null ? void 0 : _a3.params; + } + function ql(e) { + if (e.type !== "VariableDeclarator") return false; + let { typeAnnotation: t2 } = e.id; + if (!t2 || !t2.typeAnnotation) return false; + let r = Qo(t2.typeAnnotation); + return R(r) && r.length > 1 && r.some((n) => R(Qo(n)) || n.type === "TSConditionalType"); + } + function bs(e) { + var _a3; + return e.type === "VariableDeclarator" && ((_a3 = e.init) == null ? void 0 : _a3.type) === "ArrowFunctionExpression"; + } + function Qo(e) { + let t2; + switch (e.type) { + case "GenericTypeAnnotation": + t2 = e.typeParameters; + break; + case "TSTypeReference": + t2 = e.typeArguments; + break; } - function copyArray(source, array) { - var index = -1, length = source.length; - array || (array = Array2(length)); - while (++index < length) { - array[index] = source[index]; - } - return array; - } - 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) : undefined2; - if (newValue === undefined2) { - newValue = source[key]; - } - if (isNew) { - baseAssignValue(object, key, newValue); - } else { - assignValue(object, key, newValue); - } + return t2 == null ? void 0 : t2.params; + } + function ru(e, t2, r, n = false) { + var _a3; + let { node: s } = e, i = () => ru(e, t2, r, true); + if (s.type === "ChainExpression" || s.type === "TSNonNullExpression") return e.call(i, "expression"); + if (M(s)) { + if ((_a3 = vt(e, t2, r).label) == null ? void 0 : _a3.memberChain) return false; + let u = le(s); + return !(u.length === 0 || u.length === 1 && Fr(u[0], t2)) || Yl(s, r) ? false : e.call(i, "callee"); + } + return J(s) ? e.call(i, "object") : n && (s.type === "Identifier" || s.type === "ThisExpression"); + } + function Ul(e, t2, r) { + return Oe(e) ? (t2 = Qt(t2), typeof t2 == "string" && ot(t2) < r.tabWidth + 3) : false; + } + function Yl(e, t2) { + let r = Hl(e); + if (R(r)) { + if (r.length > 1) return true; + if (r.length === 1) { + let s = r[0]; + if (Se(s) || xt(s) || s.type === "TSTypeLiteral" || s.type === "ObjectTypeAnnotation") return true; } - return object; + let n = e.typeParameters ? "typeParameters" : "typeArguments"; + if (ne(t2(n))) return true; } - function copySymbols(source, object) { - return copyObject(source, getSymbols(source), object); + return false; + } + function Hl(e) { + var _a3, _b2; + return (_b2 = (_a3 = e.typeParameters) != null ? _a3 : e.typeArguments) == null ? void 0 : _b2.params; + } + function zo(e) { + switch (e.type) { + case "FunctionTypeAnnotation": + case "GenericTypeAnnotation": + case "TSFunctionType": + return !!e.typeParameters; + case "TSTypeReference": + return !!e.typeArguments; + default: + return false; } - function copySymbolsIn(source, object) { - return copyObject(source, getSymbolsIn(source), object); + } + function Xl(e) { + return zo(e.checkType) || zo(e.extendsType); + } + var cn = /* @__PURE__ */ new WeakMap(); + function su(e) { + return /^(?:\d+|\d+\.\d+)$/u.test(e); + } + function nu(e, t2) { + return t2.parser === "json" || t2.parser === "jsonc" || !V(e.key) || ut(pe(e.key), t2).slice(1, -1) !== e.key.value ? false : !!(Ro(e.key.value) && !(t2.parser === "babel-ts" && e.type === "ClassProperty" || (t2.parser === "typescript" || t2.parser === "oxc-ts") && e.type === "PropertyDefinition") || su(e.key.value) && String(Number(e.key.value)) === e.key.value && e.type !== "ImportAttribute" && (t2.parser === "babel" || t2.parser === "acorn" || t2.parser === "oxc" || t2.parser === "espree" || t2.parser === "meriyah" || t2.parser === "__babel_estree")); + } + function Vl(e, t2) { + let { key: r } = e.node; + return (r.type === "Identifier" || Ce(r) && su(dt(pe(r))) && String(r.value) === dt(pe(r)) && !(t2.parser === "typescript" || t2.parser === "babel-ts" || t2.parser === "oxc-ts")) && (t2.parser === "json" || t2.parser === "jsonc" || t2.quoteProps === "consistent" && cn.get(e.parent)); + } + function Ct(e, t2, r) { + let { node: n } = e; + if (n.computed) return ["[", r("key"), "]"]; + let { parent: s } = e, { key: i } = n; + if (t2.quoteProps === "consistent" && !cn.has(s)) { + let o = e.siblings.some((u) => !u.computed && V(u.key) && !nu(u, t2)); + cn.set(s, o); } - function createAggregator(setter, initializer) { - return function(collection, iteratee2) { - var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; - return func(collection, setter, getIteratee(iteratee2, 2), accumulator); - }; + if (Vl(e, t2)) { + let o = ut(JSON.stringify(i.type === "Identifier" ? i.name : i.value.toString()), t2); + return e.call(() => De(e, o, t2), "key"); } - function createAssigner(assigner) { - return baseRest(function(object, sources) { - var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2; - customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2; - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - customizer = length < 3 ? undefined2 : customizer; - length = 1; - } - object = Object2(object); - while (++index < length) { - var source = sources[index]; - if (source) { - assigner(object, source, index, customizer); - } - } - return object; - }); + return nu(n, t2) && (t2.quoteProps === "as-needed" || t2.quoteProps === "consistent" && !cn.get(s)) ? e.call(() => De(e, /^\d/u.test(i.value) ? dt(i.value) : i.value, t2), "key") : r("key"); + } + function ln(e, t2, r) { + let { node: n } = e; + return n.shorthand ? r("value") : ht(e, t2, r, Ct(e, t2, r), ":", "value"); + } + var $l = ({ node: e, key: t2, parent: r }) => t2 === "value" && e.type === "FunctionExpression" && (r.type === "ObjectMethod" || r.type === "ClassMethod" || r.type === "ClassPrivateMethod" || r.type === "MethodDefinition" || r.type === "TSAbstractMethodDefinition" || r.type === "TSDeclareMethod" || r.type === "Property" && mt(r)); + function mn(e, t2, r, n) { + if ($l(e)) return Dn(e, t2, r); + let { node: s } = e, i = false; + if ((s.type === "FunctionDeclaration" || s.type === "FunctionExpression") && (n == null ? void 0 : n.expandLastArg)) { + let { parent: y } = e; + M(y) && (le(y).length > 1 || K(s).every((D) => D.type === "Identifier" && !D.typeAnnotation)) && (i = true); } - function createBaseEach(eachFunc, fromRight) { - return function(collection, iteratee2) { - if (collection == null) { - return collection; - } - if (!isArrayLike(collection)) { - return eachFunc(collection, iteratee2); - } - var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection); - while (fromRight ? index-- : ++index < length) { - if (iteratee2(iterable[index], index, iterable) === false) { - break; - } - } - return collection; - }; + let o = [Q(e), s.async ? "async " : "", `function${s.generator ? "*" : ""} `, s.id ? r("id") : ""], u = Ke(e, t2, r, i), p = rr(e, r), c = lt(s, p); + return o.push(r("typeParameters"), l([c ? l(u) : u, p]), s.body ? " " : "", r("body")), t2.semi && (s.declare || !s.body) && o.push(";"), o; + } + function Sr(e, t2, r) { + let { node: n } = e, { kind: s } = n, i = n.value || n, o = []; + return !s || s === "init" || s === "method" || s === "constructor" ? i.async && o.push("async ") : (Le(s === "get" || s === "set"), o.push(s, " ")), i.generator && o.push("*"), o.push(Ct(e, t2, r), n.optional ? "?" : "", n === i ? Dn(e, t2, r) : r("value")), o; + } + function Dn(e, t2, r) { + let { node: n } = e, s = Ke(e, t2, r), i = rr(e, r), o = vo(n), u = lt(n, i), p = [r("typeParameters"), l([o ? l(s, { shouldBreak: true }) : u ? l(s) : s, i])]; + return n.body ? p.push(" ", r("body")) : p.push(t2.semi ? ";" : ""), p; + } + function Kl(e) { + let t2 = K(e); + return t2.length === 1 && !e.typeParameters && !T(e, x.Dangling) && t2[0].type === "Identifier" && !t2[0].typeAnnotation && !T(t2[0]) && !t2[0].optional && !e.predicate && !e.returnType; + } + function fn(e, t2) { + if (t2.arrowParens === "always") return false; + if (t2.arrowParens === "avoid") { + let { node: r } = e; + return Kl(r); } - function createBaseFor(fromRight) { - return function(object, iteratee2, keysFunc) { - var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length; - while (length--) { - var key = props[fromRight ? length : ++index]; - if (iteratee2(iterable[key], key, iterable) === false) { - break; - } - } - return object; - }; + return false; + } + function rr(e, t2) { + let { node: r } = e, s = [G(e, t2, "returnType")]; + return r.predicate && s.push(t2("predicate")), s; + } + function iu(e, t2, r) { + let { node: n } = e, s = []; + if (n.argument) { + let u = r("argument"); + Ql(t2, n.argument) ? u = ["(", m([E, u]), E, ")"] : (Te(n.argument) || t2.experimentalTernaries && n.argument.type === "ConditionalExpression" && (n.argument.consequent.type === "ConditionalExpression" || n.argument.alternate.type === "ConditionalExpression")) && (u = l([P("("), m([f2, u]), f2, P(")")])), s.push(" ", u); } - 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; - } - function createCaseFirst(methodName) { - return function(string2) { - string2 = toString(string2); - var strSymbols = hasUnicode(string2) ? stringToArray(string2) : undefined2; - var chr = strSymbols ? strSymbols[0] : string2.charAt(0); - var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string2.slice(1); - return chr[methodName]() + trailing; - }; + let i = T(n, x.Dangling), o = t2.semi && i && T(n, x.Last | x.Line); + return o && s.push(";"), i && s.push(" ", v(e, t2)), !o && t2.semi && s.push(";"), s; + } + function ou(e, t2, r) { + return ["return", iu(e, t2, r)]; + } + function uu(e, t2, r) { + return ["throw", iu(e, t2, r)]; + } + function Ql(e, t2) { + if (Ee(e.originalText, t2) || T(t2, x.Leading, (r) => ue(e.originalText, w(r), I(r))) && !H(t2)) return true; + if (Xt(t2)) { + let r = t2, n; + for (; n = Di(r); ) if (r = n, Ee(e.originalText, r)) return true; } - function createCompounder(callback) { - return function(string2) { - return arrayReduce(words(deburr(string2).replace(reApos, "")), callback, ""); - }; + return false; + } + function au(e, t2) { + if (t2.semi || ks(e, t2) || Ls(e, t2) || Is2(e, t2)) return false; + let { node: r, key: n, parent: s } = e; + return !!(r.type === "ExpressionStatement" && (n === "body" && (s.type === "Program" || s.type === "BlockStatement" || s.type === "StaticBlock" || s.type === "TSModuleBlock") || n === "consequent" && s.type === "SwitchCase") && e.call(() => pu(e, t2), "expression")); + } + function pu(e, t2) { + let { node: r } = e; + switch (r.type) { + case "ParenthesizedExpression": + case "TypeCastExpression": + case "ArrayExpression": + case "ArrayPattern": + case "TemplateLiteral": + case "TemplateElement": + case "RegExpLiteral": + return true; + case "ArrowFunctionExpression": + if (!fn(e, t2)) return true; + break; + case "UnaryExpression": { + let { prefix: n, operator: s } = r; + if (n && (s === "+" || s === "-")) return true; + break; + } + case "BindExpression": + if (!r.object) return true; + break; + case "Literal": + if (r.regex) return true; + break; + default: + if (H(r)) return true; } - function createCtor(Ctor) { - return function() { - 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), result2 = Ctor.apply(thisBinding, args); - return isObject(result2) ? result2 : thisBinding; - }; + return ge(e, t2) ? true : Xt(r) ? e.call(() => pu(e, t2), ...Rr(r)) : false; + } + var Ps = ({ node: e, parent: t2 }) => e.type === "ExpressionStatement" && t2.type === "Program" && t2.body.length === 1 && (Array.isArray(t2.directives) && t2.directives.length === 0 || !t2.directives); + function ks(e, t2) { + return (t2.parentParser === "markdown" || t2.parentParser === "mdx") && Ps(e) && H(e.node.expression); + } + function Is2(e, t2) { + return t2.__isHtmlInlineEventHandler && Ps(e); + } + function Ls(e, t2) { + return (t2.parser === "__vue_event_binding" || t2.parser === "__vue_ts_event_binding") && Ps(e); + } + var Os = class extends Error { + constructor(t2, r, n = "type") { + super(`Unexpected ${r} node ${n}: ${JSON.stringify(t2[n])}.`); + __publicField(this, "name", "UnexpectedNodeError"); + this.node = t2; } - function createCurry(func, bitmask, arity) { - var Ctor = createCtor(func); - function wrapper() { - var length = arguments.length, args = Array2(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, - undefined2, - args, - holders, - undefined2, - undefined2, - arity - length - ); - } - var fn = this && this !== root && this instanceof wrapper ? Ctor : func; - return apply(fn, this, args); - } - return wrapper; - } - function createFind(findIndexFunc) { - return function(collection, predicate, fromIndex) { - var iterable = Object2(collection); - if (!isArrayLike(collection)) { - var iteratee2 = getIteratee(predicate, 3); - collection = keys(collection); - predicate = function(key) { - return iteratee2(iterable[key], key, iterable); - }; - } - var index = findIndexFunc(collection, predicate, fromIndex); - return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2; - }; + }, Qe = Os; + function ws(e) { + if (typeof e != "string") throw new TypeError("Expected a string"); + return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"); + } + var _s = (_b = class { + constructor(t2) { + __privateAdd(this, __s_instances); + __privateAdd(this, _e2); + __privateSet(this, _e2, new Set(t2)); } - 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 TypeError2(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) : undefined2; - 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 index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value; - while (++index2 < length) { - result2 = funcs[index2].call(this, result2); - } - return result2; - }; - }); + getLeadingWhitespaceCount(t2) { + let r = __privateGet(this, _e2), n = 0; + for (let s = 0; s < t2.length && r.has(t2.charAt(s)); s++) n++; + return n; } - function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, 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 ? undefined2 : createCtor(func); - function wrapper() { - var length = arguments.length, args = Array2(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, - ary2, - 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 && ary2 < length) { - args.length = ary2; - } - if (this && this !== root && this instanceof wrapper) { - fn = Ctor || createCtor(fn); - } - return fn.apply(thisBinding, args); - } - return wrapper; - } - function createInverter(setter, toIteratee) { - return function(object, iteratee2) { - return baseInverter(object, setter, toIteratee(iteratee2), {}); - }; + getTrailingWhitespaceCount(t2) { + let r = __privateGet(this, _e2), n = 0; + for (let s = t2.length - 1; s >= 0 && r.has(t2.charAt(s)); s--) n++; + return n; } - function createMathOperation(operator, defaultValue) { - return function(value, other) { - var result2; - if (value === undefined2 && other === undefined2) { - return defaultValue; - } - if (value !== undefined2) { - result2 = value; - } - if (other !== undefined2) { - if (result2 === undefined2) { - return other; - } - if (typeof value == "string" || typeof other == "string") { - value = baseToString(value); - other = baseToString(other); - } else { - value = baseToNumber(value); - other = baseToNumber(other); - } - result2 = operator(value, other); - } - return result2; - }; + getLeadingWhitespace(t2) { + let r = this.getLeadingWhitespaceCount(t2); + return t2.slice(0, r); } - function createOver(arrayFunc) { - return flatRest(function(iteratees) { - iteratees = arrayMap(iteratees, baseUnary(getIteratee())); - return baseRest(function(args) { - var thisArg = this; - return arrayFunc(iteratees, function(iteratee2) { - return apply(iteratee2, thisArg, args); - }); - }); - }); + getTrailingWhitespace(t2) { + let r = this.getTrailingWhitespaceCount(t2); + return t2.slice(t2.length - r); } - function createPadding(length, chars) { - chars = chars === undefined2 ? " " : baseToString(chars); - var charsLength = chars.length; - if (charsLength < 2) { - return charsLength ? baseRepeat(chars, length) : chars; - } - var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars))); - return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length); + hasLeadingWhitespace(t2) { + return __privateGet(this, _e2).has(t2.charAt(0)); } - 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 = Array2(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; + hasTrailingWhitespace(t2) { + return __privateGet(this, _e2).has(N(0, t2, -1)); } - function createRange3(fromRight) { - return function(start, end, step) { - if (step && typeof step != "number" && isIterateeCall(start, end, step)) { - end = step = undefined2; - } - start = toFinite(start); - if (end === undefined2) { - end = start; - start = 0; - } else { - end = toFinite(end); - } - step = step === undefined2 ? start < end ? 1 : -1 : toFinite(step); - return baseRange(start, end, step, fromRight); - }; + trimStart(t2) { + let r = this.getLeadingWhitespaceCount(t2); + return t2.slice(r); } - function createRelationalOperation(operator) { - return function(value, other) { - if (!(typeof value == "string" && typeof other == "string")) { - value = toNumber(value); - other = toNumber(other); - } - return operator(value, other); - }; + trimEnd(t2) { + let r = this.getTrailingWhitespaceCount(t2); + return t2.slice(0, t2.length - r); } - function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) { - var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : 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, - ary2, - arity - ]; - var result2 = wrapFunc.apply(undefined2, newData); - if (isLaziable(func)) { - setData(result2, newData); - } - result2.placeholder = placeholder; - return setWrapToString(result2, func, bitmask); - } - function createRound(methodName) { - var func = Math2[methodName]; - return function(number, precision) { - number = toNumber(number); - precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); - if (precision && nativeIsFinite(number)) { - 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); - }; + trim(t2) { + return this.trimEnd(this.trimStart(t2)); } - var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values2) { - return new Set2(values2); - }; - 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)); - }; + split(t2, r = false) { + let n = `[${ws([...__privateGet(this, _e2)].join(""))}]+`, s = new RegExp(r ? `(${n})` : n, "u"); + return t2.split(s); } - function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) { - var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; - if (!isBindKey && typeof func != "function") { - throw new TypeError2(FUNC_ERROR_TEXT); - } - var length = partials ? partials.length : 0; - if (!length) { - bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); - partials = holders = undefined2; - } - ary2 = ary2 === undefined2 ? ary2 : nativeMax(toInteger(ary2), 0); - arity = arity === undefined2 ? arity : toInteger(arity); - length -= holders ? holders.length : 0; - if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { - var partialsRight = partials, holdersRight = holders; - partials = holders = undefined2; - } - var data = isBindKey ? undefined2 : getData(func); - var newData = [ - func, - bitmask, - thisArg, - partials, - holders, - partialsRight, - holdersRight, - argPos, - ary2, - 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] === undefined2 ? 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 result2 = createBind(func, bitmask, thisArg); - } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { - result2 = createCurry(func, bitmask, arity); - } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { - result2 = createPartial(func, bitmask, thisArg, partials); - } else { - result2 = createHybrid.apply(undefined2, newData); - } - var setter = data ? baseSetData : setData; - return setWrapToString(setter(result2, newData), func, bitmask); + hasWhitespaceCharacter(t2) { + let r = __privateGet(this, _e2); + return Array.prototype.some.call(t2, (n) => r.has(n)); } - function customDefaultsAssignIn(objValue, srcValue, key, object) { - if (objValue === undefined2 || eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key)) { - return srcValue; - } - return objValue; + hasNonWhitespaceCharacter(t2) { + let r = __privateGet(this, _e2); + return Array.prototype.some.call(t2, (n) => !r.has(n)); } - function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { - if (isObject(objValue) && isObject(srcValue)) { - stack.set(srcValue, objValue); - baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack); - stack["delete"](srcValue); - } - return objValue; + isWhitespaceOnly(t2) { + let r = __privateGet(this, _e2); + return Array.prototype.every.call(t2, (n) => r.has(n)); } - function customOmitClone(value) { - return isPlainObject(value) ? undefined2 : value; + dedentString(t2) { + let r = __privateMethod(this, __s_instances, t_fn).call(this, t2); + return r === 0 ? t2 : t2.split(` +`).map((n) => n.slice(r)).join(` +`); } - 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; - } - var arrStacked = stack.get(array); - var othStacked = stack.get(other); - if (arrStacked && othStacked) { - return arrStacked == other && othStacked == array; - } - var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2; - stack.set(array, other); - stack.set(other, array); - 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 !== undefined2) { - if (compared) { + }, _e2 = new WeakMap(), __s_instances = new WeakSet(), t_fn = function(t2) { + let r = Number.POSITIVE_INFINITY; + for (let n of t2.split(` +`)) { + if (n.length === 0) continue; + let s = this.getLeadingWhitespaceCount(n); + if (s === 0) return 0; + n.length !== s && s < r && (r = s); + } + return r === Number.POSITIVE_INFINITY ? 0 : r; + }, _b), cu = _s; + var yn = new cu(` +\r `), Ms = (e) => e === "" || e === A2 || e === E || e === f2; + function zl(e, t2, r) { + var _a3, _b2, _c3, _d, _e3; + let { node: n } = e; + if (n.type === "JSXElement" && Dm(n)) return [r("openingElement"), r("closingElement")]; + let s = n.type === "JSXElement" ? r("openingElement") : r("openingFragment"), i = n.type === "JSXElement" ? r("closingElement") : r("closingFragment"); + if (n.children.length === 1 && n.children[0].type === "JSXExpressionContainer" && (n.children[0].expression.type === "TemplateLiteral" || n.children[0].expression.type === "TaggedTemplateExpression")) return [s, ...e.map(r, "children"), i]; + n.children = n.children.map((g) => fm(g) ? { type: "JSXText", value: " ", raw: " " } : g); + let o = n.children.some(H), u = n.children.filter((g) => g.type === "JSXExpressionContainer").length > 1, p = n.type === "JSXElement" && n.openingElement.attributes.length > 1, c = ne(s) || o || p || u, y = e.parent.rootMarker === "mdx", D = t2.singleQuote ? "{' '}" : '{" "}', F = y ? A2 : P([D, f2], " "), C = ((_b2 = (_a3 = n.openingElement) == null ? void 0 : _a3.name) == null ? void 0 : _b2.name) === "fbt", d = Zl(e, t2, r, F, C), b = n.children.some((g) => Br(g)); + for (let g = d.length - 2; g >= 0; g--) { + let S = d[g] === "" && d[g + 1] === "", j = d[g] === E && d[g + 1] === "" && d[g + 2] === E, U = (d[g] === f2 || d[g] === E) && d[g + 1] === "" && d[g + 2] === F, fe = d[g] === F && d[g + 1] === "" && (d[g + 2] === f2 || d[g + 2] === E), Y = d[g] === F && d[g + 1] === "" && d[g + 2] === F, z = d[g] === f2 && d[g + 1] === "" && d[g + 2] === E || d[g] === E && d[g + 1] === "" && d[g + 2] === f2; + j && b || S || U || Y || z ? d.splice(g, 2) : fe && d.splice(g + 1, 2); + } + for (; d.length > 0 && Ms(N(0, d, -1)); ) d.pop(); + for (; d.length > 1 && Ms(d[0]) && Ms(d[1]); ) d.shift(), d.shift(); + let B = [""]; + for (let [g, S] of d.entries()) { + if (S === F) { + if (g === 1 && $i(d[g - 1])) { + if (d.length === 2) { + B.push([B.pop(), D]); continue; } - result2 = false; - break; - } - if (seen) { - if (!arraySome(other, function(othValue2, othIndex) { - if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { - result2 = false; - break; - } - } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - result2 = false; - break; + B.push([D, E], ""); + continue; + } else if (g === d.length - 1) { + B.push([B.pop(), D]); + continue; + } else if (d[g - 1] === "" && d[g - 2] === E) { + B.push([B.pop(), D]); + continue; } } - stack["delete"](array); - stack["delete"](other); - return result2; + g % 2 === 0 ? B.push([B.pop(), S]) : B.push(S, ""), ne(S) && (c = true); } - 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 Uint8Array2(object), new Uint8Array2(other))) { - return false; - } - return true; - case boolTag2: - case dateTag: - case numberTag: - return eq(+object, +other); - case errorTag: - return object.name == other.name && object.message == other.message; - case regexpTag: - case stringTag: - 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; - } - var stacked = stack.get(object); - if (stacked) { - return stacked == other; - } - bitmask |= COMPARE_UNORDERED_FLAG; - stack.set(object, other); - var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); - stack["delete"](object); - return result2; - case symbolTag: - if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other); - } - } - return false; + let O = b ? zr(B) : l(B, { shouldBreak: true }); + if (((_c3 = t2.cursorNode) == null ? void 0 : _c3.type) === "JSXText" && n.children.includes(t2.cursorNode) ? O = [Tr, O, Tr] : ((_d = t2.nodeBeforeCursor) == null ? void 0 : _d.type) === "JSXText" && n.children.includes(t2.nodeBeforeCursor) ? O = [Tr, O] : ((_e3 = t2.nodeAfterCursor) == null ? void 0 : _e3.type) === "JSXText" && n.children.includes(t2.nodeAfterCursor) && (O = [O, Tr]), y) return O; + let h = l([s, m([E, O]), E, i]); + return c ? h : nt([l([s, ...d, i]), h]); + } + function Zl(e, t2, r, n, s) { + let i = "", o = [i]; + function u(c) { + i = c, o.push([o.pop(), c]); } - 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; - } - } - var objStacked = stack.get(object); - var othStacked = stack.get(other); - if (objStacked && othStacked) { - return objStacked == other && othStacked == object; - } - var result2 = 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); - } - if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { - result2 = false; - break; - } - skipCtor || (skipCtor = key == "constructor"); - } - if (result2 && !skipCtor) { - var objCtor = object.constructor, othCtor = other.constructor; - if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { - result2 = false; - } + function p(c) { + c !== "" && (i = c, o.push(c, "")); + } + return e.each(({ node: c, next: y }) => { + if (c.type === "JSXText") { + let D = pe(c); + if (Br(c)) { + let F = yn.split(D, true); + F[0] === "" && (F.shift(), /\n/u.test(F[0]) ? p(mu(s, F[1], c, y)) : p(n), F.shift()); + let C; + if (N(0, F, -1) === "" && (F.pop(), C = F.pop()), F.length === 0) return; + for (let [d, b] of F.entries()) d % 2 === 1 ? p(A2) : u(b); + C !== void 0 ? /\n/u.test(C) ? p(mu(s, i, c, y)) : p(n) : p(lu(s, i, c, y)); + } else /\n/u.test(D) ? D.match(/\n/gu).length > 1 && p(E) : p(n); + } else { + let D = r(); + if (u(D), y && Br(y)) { + let C = yn.trim(pe(y)), [d] = yn.split(C); + p(lu(s, d, c, y)); + } else p(E); } - stack["delete"](object); - stack["delete"](other); - return result2; - } - function flatRest(func) { - return setToString(overRest(func, undefined2, flatten), func + ""); - } - function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); + }, "children"), o; + } + function lu(e, t2, r, n) { + return e ? "" : r.type === "JSXElement" && !r.closingElement || (n == null ? void 0 : n.type) === "JSXElement" && !n.closingElement ? t2.length === 1 ? f2 : E : f2; + } + function mu(e, t2, r, n) { + return e ? E : t2.length === 1 ? r.type === "JSXElement" && !r.closingElement || (n == null ? void 0 : n.type) === "JSXElement" && !n.closingElement ? E : f2 : E; + } + var em = k(["ArrayExpression", "JSXAttribute", "JSXElement", "JSXExpressionContainer", "JSXFragment", "ExpressionStatement", "NewExpression", "CallExpression", "OptionalCallExpression", "ConditionalExpression", "JsExpressionRoot", "MatchExpressionCase"]); + function tm(e, t2, r) { + let { parent: n } = e; + if (em(n)) return t2; + let s = rm(e), i = ge(e, r); + return l([i ? "" : P("("), m([f2, t2]), f2, i ? "" : P(")")], { shouldBreak: s }); + } + function rm(e) { + return e.match(void 0, (t2, r) => r === "body" && t2.type === "ArrowFunctionExpression", (t2, r) => r === "arguments" && M(t2)) && (e.match(void 0, void 0, void 0, (t2, r) => r === "expression" && t2.type === "JSXExpressionContainer") || e.match(void 0, void 0, void 0, (t2, r) => r === "expression" && t2.type === "ChainExpression", (t2, r) => r === "expression" && t2.type === "JSXExpressionContainer")); + } + function nm(e, t2, r) { + let { node: n } = e, s = [r("name")]; + if (n.value) { + let i; + if (V(n.value)) { + let o = pe(n.value), u = W(0, W(0, o.slice(1, -1), "'", "'"), """, '"'), p = wr(u, t2.jsxSingleQuote); + u = p === '"' ? W(0, u, '"', """) : W(0, u, "'", "'"), i = e.call(() => De(e, qe(p + u + p), t2), "value"); + } else i = r("value"); + s.push("=", i); } - function getAllKeysIn(object) { - return baseGetAllKeys(object, keysIn, getSymbolsIn); + return s; + } + function sm(e, t2, r) { + let { node: n } = e, s = (i, o) => i.type === "JSXEmptyExpression" || !T(i) && (q(i) || se(i) || i.type === "ArrowFunctionExpression" || i.type === "AwaitExpression" && (s(i.argument, i) || i.argument.type === "JSXElement") || M(i) || i.type === "ChainExpression" && M(i.expression) || i.type === "FunctionExpression" || i.type === "TemplateLiteral" || i.type === "TaggedTemplateExpression" || i.type === "DoExpression" || H(o) && (i.type === "ConditionalExpression" || Te(i))); + return s(n.expression, e.parent) ? l(["{", r("expression"), je, "}"]) : l(["{", m([f2, r("expression")]), f2, je, "}"]); + } + function im(e, t2, r) { + var _a3, _b2; + let { node: n } = e, s = T(n.name) || T(n.typeArguments); + if (n.selfClosing && n.attributes.length === 0 && !s) return ["<", r("name"), r("typeArguments"), " />"]; + if (((_a3 = n.attributes) == null ? void 0 : _a3.length) === 1 && V(n.attributes[0].value) && !n.attributes[0].value.value.includes(` +`) && !s && !T(n.attributes[0])) return l(["<", r("name"), r("typeArguments"), " ", ...e.map(r, "attributes"), n.selfClosing ? " />" : ">"]); + let i = (_b2 = n.attributes) == null ? void 0 : _b2.some((u) => V(u.value) && u.value.value.includes(` +`)), o = t2.singleAttributePerLine && n.attributes.length > 1 ? E : A2; + return l(["<", r("name"), r("typeArguments"), m(e.map(() => [o, r()], "attributes")), ...om(n, t2, s)], { shouldBreak: i }); + } + function om(e, t2, r) { + return e.selfClosing ? [A2, "/>"] : um(e, t2, r) ? [">"] : [f2, ">"]; + } + function um(e, t2, r) { + let n = e.attributes.length > 0 && T(N(0, e.attributes, -1), x.Trailing); + return e.attributes.length === 0 && !r || (t2.bracketSameLine || t2.jsxBracketSameLine) && (!r || e.attributes.length > 0) && !n; + } + function am(e, t2, r) { + let { node: n } = e, s = [""), s; + } + function pm(e, t2) { + let { node: r } = e, n = T(r), s = T(r, x.Line), i = r.type === "JSXOpeningFragment"; + return [i ? "<" : ""]; + } + function cm(e, t2, r) { + let n = De(e, zl(e, t2, r), t2); + return tm(e, n, t2); + } + function lm(e, t2) { + let { node: r } = e, n = T(r, x.Line); + return [v(e, t2, { indent: n }), n ? E : ""]; + } + function mm(e, t2, r) { + let { node: n } = e; + return ["{", e.call(({ node: s }) => { + let i = ["...", r()]; + return T(s) ? [m([f2, De(e, i, t2)]), f2] : i; + }, n.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"]; + } + function Du(e, t2, r) { + let { node: n } = e; + if (n.type.startsWith("JSX")) switch (n.type) { + case "JSXAttribute": + return nm(e, t2, r); + case "JSXIdentifier": + return n.name; + case "JSXNamespacedName": + return L(":", [r("namespace"), r("name")]); + case "JSXMemberExpression": + return L(".", [r("object"), r("property")]); + case "JSXSpreadAttribute": + case "JSXSpreadChild": + return mm(e, t2, r); + case "JSXExpressionContainer": + return sm(e, t2, r); + case "JSXFragment": + case "JSXElement": + return cm(e, t2, r); + case "JSXOpeningElement": + return im(e, t2, r); + case "JSXClosingElement": + return am(e, t2, r); + case "JSXOpeningFragment": + case "JSXClosingFragment": + return pm(e, t2); + case "JSXEmptyExpression": + return lm(e, t2); + case "JSXText": + throw new Error("JSXText should be handled by JSXElement"); + default: + throw new Qe(n, "JSX"); } - var getData = !metaMap ? noop : function(func) { - return metaMap.get(func); - }; - function getFuncName(func) { - var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty.call(realNames, result2) ? array.length : 0; - while (length--) { - var data = array[length], otherFunc = data.func; - if (otherFunc == null || otherFunc == func) { - return data.name; - } + } + function Dm(e) { + if (e.children.length === 0) return true; + if (e.children.length > 1) return false; + let t2 = e.children[0]; + return t2.type === "JSXText" && !Br(t2); + } + function Br(e) { + return e.type === "JSXText" && (yn.hasNonWhitespaceCharacter(pe(e)) || !/\n/u.test(pe(e))); + } + function fm(e) { + return e.type === "JSXExpressionContainer" && V(e.expression) && e.expression.value === " " && !T(e.expression); + } + function fu(e) { + let { node: t2, parent: r } = e; + if (!H(t2) || !H(r)) return false; + let { index: n, siblings: s } = e, i; + for (let o = n; o > 0; o--) { + let u = s[o - 1]; + if (!(u.type === "JSXText" && !Br(u))) { + i = u; + break; } - return result2; } - function getHolder(func) { - var object = hasOwnProperty.call(lodash, "placeholder") ? lodash : func; - return object.placeholder; - } - function getIteratee() { - var result2 = lodash.iteratee || iteratee; - result2 = result2 === iteratee ? baseIteratee : result2; - return arguments.length ? result2(arguments[0], arguments[1]) : result2; - } - function getMapData(map3, key) { - var data = map3.__data__; - return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; - } - function getMatchData(object) { - var result2 = keys(object), length = result2.length; - while (length--) { - var key = result2[length], value = object[key]; - result2[length] = [key, value, isStrictComparable(value)]; + return (i == null ? void 0 : i.type) === "JSXExpressionContainer" && i.expression.type === "JSXEmptyExpression" && Ot(i.expression); + } + function ym(e) { + return Ot(e.node) || fu(e); + } + var nr = ym; + function Eu(e, t2, r) { + let { node: n } = e; + if (n.type.startsWith("NG")) switch (n.type) { + case "NGRoot": + return r("node"); + case "NGPipeExpression": + return on(e, t2, r); + case "NGChainedExpression": + return l(L([";", A2], e.map(() => dm(e) ? r() : ["(", r(), ")"], "expressions"))); + case "NGEmptyExpression": + return ""; + case "NGMicrosyntax": + return e.map(() => [e.isFirst ? "" : yu(e) ? " " : [";", A2], r()], "body"); + case "NGMicrosyntaxKey": + return /^[$_a-z][\w$]*(?:-[$_a-z][\w$])*$/iu.test(n.name) ? n.name : JSON.stringify(n.name); + case "NGMicrosyntaxExpression": + return [r("expression"), n.alias === null ? "" : [" as ", r("alias")]]; + case "NGMicrosyntaxKeyedExpression": { + let { index: s, parent: i } = e, o = yu(e) || Em(e) || (s === 1 && (n.key.name === "then" || n.key.name === "else" || n.key.name === "as") || s === 2 && (n.key.name === "else" && i.body[s - 1].type === "NGMicrosyntaxKeyedExpression" && i.body[s - 1].key.name === "then" || n.key.name === "track")) && i.body[0].type === "NGMicrosyntaxExpression"; + return [r("key"), o ? " " : ": ", r("expression")]; } - return result2; - } - function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined2; + case "NGMicrosyntaxLet": + return ["let ", r("key"), n.value === null ? "" : [" = ", r("value")]]; + case "NGMicrosyntaxAs": + return [r("key"), " as ", r("alias")]; + default: + throw new Qe(n, "Angular"); } - function getRawTag(value) { - var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; - try { - value[symToStringTag] = undefined2; - var unmasked = true; - } catch (e) { + } + function yu({ node: e, index: t2 }) { + return e.type === "NGMicrosyntaxKeyedExpression" && e.key.name === "of" && t2 === 1; + } + function Em(e) { + let { node: t2 } = e; + return e.parent.body[1].key.name === "of" && t2.type === "NGMicrosyntaxKeyedExpression" && t2.key.name === "track" && t2.key.type === "NGMicrosyntaxKey"; + } + var Fm = k(["CallExpression", "OptionalCallExpression", "AssignmentExpression"]); + function dm({ node: e }) { + return Er(e, Fm); + } + function Ns(e, t2, r) { + let { node: n } = e; + return l([L(A2, e.map(r, "decorators")), Cu(n, t2) ? E : A2]); + } + function Fu(e, t2, r) { + return Au(e.node) ? [L(E, e.map(r, "declaration", "decorators")), E] : ""; + } + function du(e, t2, r) { + let { node: n, parent: s } = e, { decorators: i } = n; + if (!R(i) || Au(s) || nr(e)) return ""; + let o = n.type === "ClassExpression" || n.type === "ClassDeclaration" || Cu(n, t2); + return [e.key === "declaration" && fi(s) ? E : o ? ke : "", L(A2, e.map(r, "decorators")), A2]; + } + function Cu(e, t2) { + return e.decorators.some((r) => Z(t2.originalText, I(r))); + } + function Au(e) { + var _a3; + if (e.type !== "ExportDefaultDeclaration" && e.type !== "ExportNamedDeclaration" && e.type !== "DeclareExportDeclaration") return false; + let t2 = (_a3 = e.declaration) == null ? void 0 : _a3.decorators; + return R(t2) && bt(e, t2[0]); + } + var js = /* @__PURE__ */ new WeakMap(); + function Tu(e) { + return js.has(e) || js.set(e, e.type === "ConditionalExpression" && !ye(e, (t2) => t2.type === "ObjectExpression")), js.get(e); + } + var Cm = (e) => e.type === "SequenceExpression"; + function xu(e, t2, r, n = {}) { + let s = [], i, o = [], u = false, p = !n.expandLastArg && e.node.body.type === "ArrowFunctionExpression", c; + (function O() { + let { node: h } = e, g = Am(e, t2, r, n); + if (s.length === 0) s.push(g); + else { + let { leading: S, trailing: j } = Mt(e, t2); + s.push([S, g]), o.unshift(j); } - var result2 = nativeObjectToString.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag] = tag; - } else { - delete value[symToStringTag]; - } + p && (u || (u = h.returnType && K(h).length > 0 || h.typeParameters || K(h).some((S) => S.type !== "Identifier"))), !p || h.body.type !== "ArrowFunctionExpression" ? (i = r("body", n), c = h.body) : e.call(O, "body"); + })(); + let y = !Ee(t2.originalText, c) && (Cm(c) || Tm(c, i, t2) || !u && Tu(c)), D = e.key === "callee" && Dt(e.parent), F = /* @__PURE__ */ Symbol("arrow-chain"), C = xm(e, n, { signatureDocs: s, shouldBreak: u }), d = false, b = false, B = false; + return p && (D || n.assignmentLayout) && (b = true, B = !T(e.node, x.Leading & x.Line), d = n.assignmentLayout === "chain-tail-arrow-chain" || D && !y), i = gm(e, t2, n, { bodyDoc: i, bodyComments: o, functionBody: c, shouldPutBodyOnSameLine: y }), l([l(b ? m([B ? f2 : "", C]) : C, { shouldBreak: d, id: F }), " =>", p ? yt(i, { groupId: F }) : l(i), p && D ? P(f2, "", { groupId: F }) : ""]); + } + function Am(e, t2, r, n) { + let { node: s } = e, i = []; + if (s.async && i.push("async "), fn(e, t2)) i.push(r(["params", 0])); + else { + let u = n.expandLastArg || n.expandFirstArg, p = rr(e, r); + if (u) { + if (ne(p)) throw new Et(); + p = l(_t(p)); } - return result2; + i.push(l([Ke(e, t2, r, u, true), p])); } - var getSymbols = !nativeGetSymbols ? stubArray : function(object) { - if (object == null) { - return []; - } - object = Object2(object); - return arrayFilter(nativeGetSymbols(object), function(symbol) { - return propertyIsEnumerable.call(object, symbol); - }); + let o = v(e, t2, { filter(u) { + let p = at(t2.originalText, I(u)); + return p !== false && t2.originalText.slice(p, p + 2) === "=>"; + } }); + return o && i.push(" ", o), i; + } + function Tm(e, t2, r) { + var _a3, _b2; + return q(e) || se(e) || e.type === "ArrowFunctionExpression" || e.type === "DoExpression" || e.type === "BlockStatement" || H(e) || ((_a3 = t2.label) == null ? void 0 : _a3.hug) !== false && (((_b2 = t2.label) == null ? void 0 : _b2.embed) || Wr(e, r.originalText)); + } + function xm(e, t2, { signatureDocs: r, shouldBreak: n }) { + if (r.length === 1) return r[0]; + let { parent: s, key: i } = e; + return i !== "callee" && Dt(s) || Te(s) ? l([r[0], " =>", m([A2, L([" =>", A2], r.slice(1))])], { shouldBreak: n }) : i === "callee" && Dt(s) || t2.assignmentLayout ? l(L([" =>", A2], r), { shouldBreak: n }) : l(m(L([" =>", A2], r)), { shouldBreak: n }); + } + function gm(e, t2, r, { bodyDoc: n, bodyComments: s, functionBody: i, shouldPutBodyOnSameLine: o }) { + let { node: u, parent: p } = e, c = r.expandLastArg && ie(t2, "all") ? P(",") : "", y = (r.expandLastArg || p.type === "JSXExpressionContainer") && !T(u) ? f2 : ""; + return o && Tu(i) ? [" ", l([P("", "("), m([f2, n]), P("", ")"), c, y]), s] : o ? [" ", n, s] : [m([A2, n, s]), c, y]; + } + var hm = (_c2 = Array.prototype.findLast) != null ? _c2 : function(e) { + for (let t2 = this.length - 1; t2 >= 0; t2--) { + let r = this[t2]; + if (e(r, t2, this)) return r; + } + }, Sm = Wt("findLast", function() { + if (Array.isArray(this)) return hm; + }), gu = Sm; + function br(e, t2, r, n) { + let { node: s } = e, i = [], o = gu(0, s[n], (u) => u.type !== "EmptyStatement"); + return e.each(({ node: u }) => { + u.type !== "EmptyStatement" && (i.push(r()), u !== o && (i.push(E), oe(u, t2) && i.push(E))); + }, n), i; + } + function En(e, t2, r) { + let n = Bm(e, t2, r), { node: s, parent: i } = e; + if (s.type === "Program" && (i == null ? void 0 : i.type) !== "ModuleExpression") return n ? [n, E] : ""; + let o = []; + if (s.type === "StaticBlock" && o.push("static "), o.push("{"), n) o.push(m([E, n]), E); + else { + let u = e.grandparent; + i.type === "ArrowFunctionExpression" || i.type === "FunctionExpression" || i.type === "FunctionDeclaration" || i.type === "ComponentDeclaration" || i.type === "HookDeclaration" || i.type === "ObjectMethod" || i.type === "ClassMethod" || i.type === "ClassPrivateMethod" || i.type === "ForStatement" || i.type === "WhileStatement" || i.type === "DoWhileStatement" || i.type === "DoExpression" || i.type === "ModuleExpression" || i.type === "CatchClause" && !u.finalizer || i.type === "TSModuleDeclaration" || i.type === "MatchStatementCase" || s.type === "StaticBlock" || o.push(E); + } + return o.push("}"), o; + } + function Bm(e, t2, r) { + let { node: n } = e, s = R(n.directives), i = n.body.some((p) => p.type !== "EmptyStatement"), o = T(n, x.Dangling); + if (!s && !i && !o) return ""; + let u = []; + return s && (u.push(br(e, t2, r, "directives")), (i || o) && (u.push(E), oe(N(0, n.directives, -1), t2) && u.push(E))), i && u.push(br(e, t2, r, "body")), o && u.push(v(e, t2)), u; + } + function bm(e) { + let t2 = /* @__PURE__ */ new WeakMap(); + return function(r) { + return t2.has(r) || t2.set(r, Symbol(e)), t2.get(r); }; - var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { - var result2 = []; - while (object) { - arrayPush(result2, getSymbols(object)); - object = getPrototype(object); + } + var hu = bm; + function Rt(e, t2, r) { + let { node: n } = e, s = [], i = n.type === "ObjectTypeAnnotation", o = !Bu(e), u = o ? A2 : E, p = T(n, x.Dangling), [c, y] = i && n.exact ? ["{|", "|}"] : "{}", D; + if (Pm(e, ({ node: F, next: C, isLast: d }) => { + if (D != null ? D : D = F, s.push(r()), o && i) { + let { parent: b } = e; + b.inexact || !d ? s.push(",") : ie(t2) && s.push(P(",")); + } + !o && (km({ node: F, next: C }, t2) || Pu({ node: F, next: C }, t2)) && s.push(";"), d || (s.push(u), oe(F, t2) && s.push(E)); + }), p && s.push(v(e, t2)), n.type === "ObjectTypeAnnotation" && n.inexact) { + let F; + T(n, x.Dangling) ? F = [T(n, x.Line) || Z(t2.originalText, I(N(0, et(n), -1))) ? E : A2, "..."] : F = [D ? A2 : "", "..."], s.push(F); + } + if (o) { + let F = p || t2.objectWrap === "preserve" && D && ue(t2.originalText, w(n), w(D)), C; + if (s.length === 0) C = c + y; + else { + let d = t2.bracketSpacing ? A2 : f2; + C = [c, m([d, ...s]), d, y]; } - return result2; - }; - var getTag = baseGetTag; - if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) { - getTag = function(value) { - var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, 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 result2; - }; + return e.match(void 0, (d, b) => b === "typeAnnotation", (d, b) => b === "typeAnnotation", Nt) || e.match(void 0, (d, b) => d.type === "FunctionTypeParam" && b === "typeAnnotation", Nt) ? C : l(C, { shouldBreak: F }); } - function getView(start, end, transforms) { - var index = -1, length = transforms.length; - while (++index < length) { - var data = transforms[index], size2 = data.size; - switch (data.type) { - case "drop": - start += size2; - break; - case "dropRight": - end -= size2; - break; - case "take": - end = nativeMin(end, start + size2); - break; - case "takeRight": - start = nativeMax(start, end - size2); - break; - } - } - return { "start": start, "end": end }; + return [c, s.length > 0 ? [m([E, s]), E] : "", y]; + } + function Bu(e) { + let { node: t2 } = e; + if (t2.type === "ObjectTypeAnnotation") { + let { key: r, parent: n } = e; + return r === "body" && (n.type === "InterfaceDeclaration" || n.type === "DeclareInterface" || n.type === "DeclareClass"); } - function getWrapDetails(source) { - var match = source.match(reWrapDetails); - return match ? match[1].split(reSplitDetails) : []; + return t2.type === "ClassBody" || t2.type === "TSInterfaceBody"; + } + function Pm(e, t2) { + let { node: r } = e; + if (r.type === "ClassBody" || r.type === "TSInterfaceBody") { + e.each(t2, "body"); + return; } - function hasPath(object, path5, hasFunc) { - path5 = castPath(path5, object); - var index = -1, length = path5.length, result2 = false; - while (++index < length) { - var key = toKey(path5[index]); - if (!(result2 = object != null && hasFunc(object, key))) { - break; - } - object = object[key]; - } - if (result2 || ++index != length) { - return result2; - } - length = object == null ? 0 : object.length; - return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); + if (r.type === "TSTypeLiteral") { + e.each(t2, "members"); + return; } - function initCloneArray(array) { - var length = array.length, result2 = new array.constructor(length); - if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) { - result2.index = array.index; - result2.input = array.input; - } - return result2; + if (r.type === "ObjectTypeAnnotation") { + let n = ["properties", "indexers", "callProperties", "internalSlots"].flatMap((s) => e.map(({ node: i, index: o }) => ({ node: i, loc: w(i), selector: [s, o] }), s)).sort((s, i) => s.loc - i.loc); + for (let [s, { node: i, selector: o }] of n.entries()) e.call(() => { + var _a3; + return t2({ node: i, next: (_a3 = n[s + 1]) == null ? void 0 : _a3.node, isLast: s === n.length - 1 }); + }, ...o); } - function initCloneObject(object) { - return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {}; - } - function initCloneByTag(object, tag, isDeep) { - var Ctor = object.constructor; - switch (tag) { - case arrayBufferTag: - return cloneArrayBuffer(object); - case boolTag2: - 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); - } - } - 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"); - } - function isFlattenable(value) { - return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); - } - 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); - } - 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; + } + function he(e, t2) { + let { parent: r } = e; + return e.callParent(Bu) ? t2.semi || r.type === "ObjectTypeAnnotation" ? ";" : "" : r.type === "TSTypeLiteral" ? e.isLast ? t2.semi ? P(";") : "" : t2.semi || Pu({ node: e.node, next: e.next }, t2) ? ";" : P("", ";") : ""; + } + var Su = k(["ClassProperty", "PropertyDefinition", "ClassPrivateProperty", "ClassAccessorProperty", "AccessorProperty", "TSAbstractPropertyDefinition", "TSAbstractAccessorProperty"]), bu = (e) => { + if (e.computed || e.typeAnnotation) return false; + let { type: t2, name: r } = e.key; + return t2 === "Identifier" && (r === "static" || r === "get" || r === "set"); + }; + function km({ node: e, next: t2 }, r) { + var _a3; + if (r.semi || !Su(e)) return false; + if (!e.value && bu(e)) return true; + if (!t2 || t2.static || t2.accessibility || t2.readonly) return false; + if (!t2.computed) { + let n = (_a3 = t2.key) == null ? void 0 : _a3.name; + if (n === "in" || n === "instanceof") return true; } - function isKey(value, object) { - if (isArray(value)) { - return false; + if (Su(t2) && t2.variance && !t2.static && !t2.declare) return true; + switch (t2.type) { + case "ClassProperty": + case "PropertyDefinition": + case "TSAbstractPropertyDefinition": + return t2.computed; + case "MethodDefinition": + case "TSAbstractMethodDefinition": + case "ClassMethod": + case "ClassPrivateMethod": { + if ((t2.value ? t2.value.async : t2.async) || t2.kind === "get" || t2.kind === "set") return false; + let s = t2.value ? t2.value.generator : t2.generator; + return !!(t2.computed || s); } - var type = typeof value; - if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) { + case "TSIndexSignature": return true; - } - return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object); } - function isKeyable(value) { - var type = typeof value; - return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; - } - function isLaziable(func) { - var funcName = getFuncName(func), other = lodash[funcName]; - if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) { - return false; - } - if (func === other) { + return false; + } + var Im = k(["TSPropertySignature"]); + function Pu({ node: e, next: t2 }, r) { + if (r.semi || !Im(e)) return false; + if (bu(e)) return true; + if (!t2) return false; + switch (t2.type) { + case "TSCallSignatureDeclaration": return true; - } - var data = getData(other); - return !!data && func === data[0]; } - function isMasked(func) { - return !!maskSrcKey && maskSrcKey in func; + return false; + } + var Lm = hu("heritageGroup"), Om = k(["TSInterfaceDeclaration", "DeclareInterface", "InterfaceDeclaration", "InterfaceTypeAnnotation"]); + function sr(e, t2, r) { + let { node: n } = e, s = Om(n), i = [Q(e), Zt(e), s ? "interface" : "class"], o = Iu(e), u = [], p = []; + if (n.type !== "InterfaceTypeAnnotation") { + n.id && u.push(" "); + for (let y of ["id", "typeParameters"]) if (n[y]) { + let { leading: D, trailing: F } = e.call(() => Mt(e, t2), y); + u.push(D, r(y), m(F)); + } } - var isMaskable = coreJsData ? isFunction : stubFalse; - function isPrototype(value) { - var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto; - return value === proto; + if (n.superClass) { + let y = [Mm(e, t2, r), r(n.superTypeArguments ? "superTypeArguments" : "superTypeParameters")], D = e.call(() => ["extends ", De(e, y, t2)], "superClass"); + o ? p.push(A2, l(D)) : p.push(" ", D); + } else p.push(Rs(e, t2, r, "extends")); + p.push(Rs(e, t2, r, "mixins"), Rs(e, t2, r, "implements")); + let c; + return o ? (c = Lm(n), i.push(l([...u, m(p)], { id: c }))) : i.push(...u, ...p), !s && o && wm(n.body) ? i.push(P(E, " ", { groupId: c })) : i.push(" "), i.push(r("body")), i; + } + function wm(e) { + return e.type === "ObjectTypeAnnotation" ? ["properties", "indexers", "callProperties", "internalSlots"].some((t2) => R(e[t2])) : R(e.body); + } + function ku(e) { + let t2 = e.superClass ? 1 : 0; + for (let r of ["extends", "mixins", "implements"]) if (Array.isArray(e[r]) && (t2 += e[r].length), t2 > 1) return true; + return t2 > 1; + } + function _m(e) { + var _a3, _b2, _c3, _d, _e3, _f; + let { node: t2 } = e; + if (T(t2.id, x.Trailing) || T(t2.typeParameters, x.Trailing) || T(t2.superClass) || ku(t2)) return true; + if (t2.superClass) return e.parent.type === "AssignmentExpression" ? false : !((_a3 = t2.superTypeArguments) != null ? _a3 : t2.superTypeParameters) && J(t2.superClass); + let r = (_f = (_d = (_b2 = t2.extends) == null ? void 0 : _b2[0]) != null ? _d : (_c3 = t2.mixins) == null ? void 0 : _c3[0]) != null ? _f : (_e3 = t2.implements) == null ? void 0 : _e3[0]; + return r ? r.type === "InterfaceExtends" && r.id.type === "QualifiedTypeIdentifier" && !r.typeParameters || (r.type === "TSClassImplements" || r.type === "TSInterfaceHeritage") && J(r.expression) && !r.typeArguments : false; + } + var vs = /* @__PURE__ */ new WeakMap(); + function Iu(e) { + let { node: t2 } = e; + return vs.has(t2) || vs.set(t2, _m(e)), vs.get(t2); + } + function Rs(e, t2, r, n) { + let { node: s } = e; + if (!R(s[n])) return ""; + let i = v(e, t2, { marker: n }), o = L([",", A2], e.map(r, n)); + if (!ku(s)) { + let u = [`${n} `, i, o]; + return Iu(e) ? [A2, l(u)] : [" ", u]; } - function isStrictComparable(value) { - return value === value && !isObject(value); + return [A2, i, i && E, n, l(m([A2, o]))]; + } + function Mm(e, t2, r) { + let n = r("superClass"), { parent: s } = e; + return s.type === "AssignmentExpression" ? l(P(["(", m([f2, n]), f2, ")"], n)) : n; + } + function Fn(e, t2, r) { + let { node: n } = e, s = []; + return R(n.decorators) && s.push(Ns(e, t2, r)), s.push(jt(n)), n.static && s.push("static "), s.push(Zt(e)), n.override && s.push("override "), s.push(Sr(e, t2, r)), s; + } + function dn(e, t2, r) { + let { node: n } = e, s = []; + R(n.decorators) && s.push(Ns(e, t2, r)), s.push(Q(e), jt(n)), n.static && s.push("static "), s.push(Zt(e)), n.override && s.push("override "), n.readonly && s.push("readonly "), n.variance && s.push(r("variance")), (n.type === "ClassAccessorProperty" || n.type === "AccessorProperty" || n.type === "TSAbstractAccessorProperty") && s.push("accessor "), s.push(Ct(e, t2, r), X(e), sn(e), G(e, r)); + let i = n.type === "TSAbstractPropertyDefinition" || n.type === "TSAbstractAccessorProperty"; + return [ht(e, t2, r, s, " =", i ? void 0 : "value"), t2.semi ? ";" : ""]; + } + var Nm = k(["TSAsExpression", "TSTypeAssertion", "TSNonNullExpression", "TSInstantiationExpression", "TSSatisfiesExpression"]); + function Js(e) { + return Nm(e) ? Js(e.expression) : e; + } + var Lu = k(["FunctionExpression", "ArrowFunctionExpression"]); + function Ou(e) { + return e.type === "MemberExpression" || e.type === "OptionalMemberExpression" || e.type === "Identifier" && e.name !== "undefined"; + } + function jm(e, t2) { + if (Ls(e, t2)) { + let r = Js(e.node.expression); + return Lu(r) || Ou(r); } - function matchesStrictComparable(key, srcValue) { - return function(object) { - if (object == null) { - return false; - } - return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object)); - }; + return !(!t2.semi || ks(e, t2) || Is2(e, t2)); + } + function wu(e, t2, r) { + return [r("expression"), jm(e, t2) ? ";" : ""]; + } + function _u(e, t2, r) { + if (t2.__isVueBindings || t2.__isVueForBindingLeft) { + let n = e.map(r, "program", "body", 0, "params"); + if (n.length === 1) return n[0]; + let s = L([",", A2], n); + return t2.__isVueForBindingLeft ? ["(", m([f2, l(s)]), f2, ")"] : s; } - function memoizeCapped(func) { - var result2 = memoize(func, function(key) { - if (cache.size === MAX_MEMOIZE_SIZE) { - cache.clear(); - } - return key; - }); - var cache = result2.cache; - return result2; + if (t2.__isEmbeddedTypescriptGenericParameters) { + let n = e.map(r, "program", "body", 0, "typeParameters", "params"); + return L([",", A2], n); } - 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; - if (!(isCommon || isCombo)) { - return data; - } - if (srcBitmask & WRAP_BIND_FLAG) { - data[2] = source[2]; - newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; - } - 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]; - } - 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]; - } - value = source[7]; - if (value) { - data[7] = value; - } - if (srcBitmask & WRAP_ARY_FLAG) { - data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); - } - if (data[9] == null) { - data[9] = source[9]; + } + function ju(e, t2) { + let { node: r } = e; + switch (r.type) { + case "RegExpLiteral": + return Mu(r); + case "BigIntLiteral": + return Cn(r.extra.raw); + case "NumericLiteral": + return dt(r.extra.raw); + case "StringLiteral": + return qe(ut(r.extra.raw, t2)); + case "NullLiteral": + return "null"; + case "BooleanLiteral": + return String(r.value); + case "DirectiveLiteral": + return Nu(r.extra.raw, t2); + case "Literal": { + if (r.regex) return Mu(r.regex); + if (r.bigint) return Cn(r.raw); + let { value: n } = r; + return typeof n == "number" ? dt(r.raw) : typeof n == "string" ? vm(e) ? Nu(r.raw, t2) : qe(ut(r.raw, t2)) : String(n); } - data[0] = source[0]; - data[1] = newBitmask; - return data; } - function nativeKeysIn(object) { - var result2 = []; - if (object != null) { - for (var key in Object2(object)) { - result2.push(key); - } - } - return result2; + } + function vm(e) { + if (e.key !== "expression") return; + let { parent: t2 } = e; + return t2.type === "ExpressionStatement" && typeof t2.directive == "string"; + } + function Cn(e) { + return e.toLowerCase(); + } + function Mu({ pattern: e, flags: t2 }) { + return t2 = [...t2].sort().join(""), `/${e}/${t2}`; + } + var Rm = "use strict"; + function Nu(e, t2) { + let r = e.slice(1, -1); + if (r === Rm || !(r.includes('"') || r.includes("'"))) { + let n = t2.singleQuote ? "'" : '"'; + return n + r + n; } - function objectToString(value) { - return nativeObjectToString.call(value); + return e; + } + function Jm(e, t2, r) { + let n = e.originalText.slice(t2, r); + for (let s of e[/* @__PURE__ */ Symbol.for("comments")]) { + let i = w(s); + if (i > r) break; + let o = I(s); + if (o < t2) continue; + let u = i - t2, p = o - t2; + n = n.slice(0, u) + W(0, n.slice(u, p), /[^\n]/gu, " ") + n.slice(p); } - function overRest(func, start, transform2) { - start = nativeMax(start === undefined2 ? func.length - 1 : start, 0); - return function() { - var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array2(length); - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array2(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = transform2(array); - return apply(func, this, otherArgs); - }; + return n; + } + var Jt = Jm; + var vu = k(["ImportDeclaration", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration", "DeclareExportDeclaration", "DeclareExportAllDeclaration"]), Gm = k(["EnumBooleanBody", "EnumNumberBody", "EnumBigIntBody", "EnumStringBody", "EnumSymbolBody"]); + function ir(e, t2, r) { + var _a3; + let { node: n, parent: s } = e, i = Gm(n), o = n.type === "TSEnumBody" || i, u = vu(n), p = i && n.hasUnknownMembers, c = o ? "members" : u ? "attributes" : "properties", y = n[c], D = o || n.type === "ObjectPattern" && s.type !== "FunctionDeclaration" && s.type !== "FunctionExpression" && s.type !== "ArrowFunctionExpression" && s.type !== "ObjectMethod" && s.type !== "ClassMethod" && s.type !== "ClassPrivateMethod" && s.type !== "AssignmentPattern" && s.type !== "CatchClause" && n.properties.some((B) => B.value && (B.value.type === "ObjectPattern" || B.value.type === "ArrayPattern")) || n.type !== "ObjectPattern" && t2.objectWrap === "preserve" && y.length > 0 && Wm(n, y[0], t2), F = [], C = e.map(({ node: B }) => { + let O = [...F, l(r())]; + return F = [",", A2], oe(B, t2) && F.push(E), O; + }, c); + if (p) { + let B; + if (T(n, x.Dangling)) { + let O = T(n, x.Line); + B = [v(e, t2), O || Z(t2.originalText, I(N(0, et(n), -1))) ? E : A2, "..."]; + } else B = ["..."]; + C.push([...F, ...B]); + } + let d = !(p || ((_a3 = N(0, y, -1)) == null ? void 0 : _a3.type) === "RestElement"), b; + if (C.length === 0) { + if (!T(n, x.Dangling)) return ["{}", G(e, r)]; + b = l(["{", v(e, t2, { indent: true }), f2, "}", X(e), G(e, r)]); + } else { + let B = t2.bracketSpacing ? A2 : f2; + b = ["{", m([B, ...C]), P(d && ie(t2) ? "," : ""), B, "}", X(e), G(e, r)]; + } + return e.match((B) => B.type === "ObjectPattern" && !R(B.decorators), Nt) || Je(n) && (e.match(void 0, (B, O) => O === "typeAnnotation", (B, O) => O === "typeAnnotation", Nt) || e.match(void 0, (B, O) => B.type === "FunctionTypeParam" && O === "typeAnnotation", Nt)) || !D && e.match((B) => B.type === "ObjectPattern", (B) => B.type === "AssignmentExpression" || B.type === "VariableDeclarator") ? b : l(b, { shouldBreak: D }); + } + function Wm(e, t2, r) { + let n = r.originalText, s = w(e), i = w(t2); + if (vu(e)) { + let o = w(e), u = Jt(r, o, i); + s = o + u.lastIndexOf("{"); } - function parent(object, path5) { - return path5.length < 2 ? object : baseGet(object, baseSlice(path5, 0, -1)); + return ue(n, s, i); + } + function Ru(e, t2, r) { + let { node: n } = e; + return ["import", n.phase ? ` ${n.phase}` : "", Ws(n), Wu(e, t2, r), Gu(e, t2, r), Uu(e, t2, r), t2.semi ? ";" : ""]; + } + var Ju = (e) => e.type === "ExportDefaultDeclaration" || e.type === "DeclareExportDeclaration" && e.default; + function An(e, t2, r) { + let { node: n } = e, s = [Fu(e, t2, r), Q(e), "export", Ju(n) ? " default" : ""], { declaration: i, exported: o } = n; + return T(n, x.Dangling) && (s.push(" ", v(e, t2)), qr(n) && s.push(E)), i ? s.push(" ", r("declaration")) : (s.push(Ym(n)), n.type === "ExportAllDeclaration" || n.type === "DeclareExportAllDeclaration" ? (s.push(" *"), o && s.push(" as ", r("exported"))) : s.push(Wu(e, t2, r)), s.push(Gu(e, t2, r), Uu(e, t2, r))), s.push(Um(n, t2)), s; + } + var qm = k(["ClassDeclaration", "ComponentDeclaration", "FunctionDeclaration", "TSInterfaceDeclaration", "DeclareClass", "DeclareComponent", "DeclareFunction", "DeclareHook", "HookDeclaration", "TSDeclareFunction", "EnumDeclaration"]); + function Um(e, t2) { + return t2.semi && (!e.declaration || Ju(e) && !qm(e.declaration)) ? ";" : ""; + } + function Gs(e, t2 = true) { + return e && e !== "value" ? `${t2 ? " " : ""}${e}${t2 ? "" : " "}` : ""; + } + function Ws(e, t2) { + return Gs(e.importKind, t2); + } + function Ym(e) { + return Gs(e.exportKind); + } + function Gu(e, t2, r) { + let { node: n } = e; + return n.source ? [qu(n, t2) ? " from" : "", " ", r("source")] : ""; + } + function Wu(e, t2, r) { + let { node: n } = e; + if (!qu(n, t2)) return ""; + let s = [" "]; + if (R(n.specifiers)) { + let i = [], o = []; + e.each(() => { + let u = e.node.type; + if (u === "ExportNamespaceSpecifier" || u === "ExportDefaultSpecifier" || u === "ImportNamespaceSpecifier" || u === "ImportDefaultSpecifier") i.push(r()); + else if (u === "ExportSpecifier" || u === "ImportSpecifier") o.push(r()); + else throw new Qe(n, "specifier"); + }, "specifiers"), s.push(L(", ", i)), o.length > 0 && (i.length > 0 && s.push(", "), o.length > 1 || i.length > 0 || n.specifiers.some((p) => T(p)) ? s.push(l(["{", m([t2.bracketSpacing ? A2 : f2, L([",", A2], o)]), P(ie(t2) ? "," : ""), t2.bracketSpacing ? A2 : f2, "}"])) : s.push(["{", t2.bracketSpacing ? " " : "", ...o, t2.bracketSpacing ? " " : "", "}"])); + } else s.push("{}"); + return s; + } + function qu(e, t2) { + return e.type !== "ImportDeclaration" || R(e.specifiers) || e.importKind === "type" ? true : Jt(t2, w(e), w(e.source)).trimEnd().endsWith("from"); + } + function Hm(e, t2) { + var _a3, _b2; + if ((_a3 = e.extra) == null ? void 0 : _a3.deprecatedAssertSyntax) return "assert"; + let r = Jt(t2, I(e.source), ((_b2 = e.attributes) == null ? void 0 : _b2[0]) ? w(e.attributes[0]) : I(e)).trimStart(); + return r.startsWith("assert") ? "assert" : r.startsWith("with") || R(e.attributes) ? "with" : void 0; + } + var Xm = (e) => { + let { attributes: t2 } = e; + if (t2.length !== 1) return false; + let [r] = t2, { type: n, key: s, value: i } = r; + return n === "ImportAttribute" && (s.type === "Identifier" && s.name === "type" || V(s) && s.value === "type") && V(i) && !T(r) && !T(s) && !T(i); + }; + function Uu(e, t2, r) { + let { node: n } = e; + if (!n.source) return ""; + let s = Hm(n, t2); + if (!s) return ""; + let i = ir(e, t2, r); + return Xm(n) && (i = _t(i)), [` ${s} `, i]; + } + function Yu(e, t2, r) { + let { node: n } = e, { type: s } = n, i = s.startsWith("Import"), o = i ? "imported" : "local", u = i ? "local" : "exported", p = n[o], c = n[u], y = "", D = ""; + return s === "ExportNamespaceSpecifier" || s === "ImportNamespaceSpecifier" ? y = "*" : p && (y = r(o)), c && !Vm(n) && (D = r(u)), [Gs(s === "ImportSpecifier" ? n.importKind : n.exportKind, false), y, y && D ? " as " : "", D]; + } + function Vm(e) { + if (e.type !== "ImportSpecifier" && e.type !== "ExportSpecifier") return false; + let { local: t2, [e.type === "ImportSpecifier" ? "imported" : "exported"]: r } = e; + if (t2.type !== r.type || !pi(t2, r)) return false; + if (V(t2)) return t2.value === r.value && pe(t2) === pe(r); + switch (t2.type) { + case "Identifier": + return t2.name === r.name; + default: + return false; } - 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] : undefined2; + } + function or(e, t2) { + return ["...", t2("argument"), G(e, t2)]; + } + function $m(e) { + let t2 = [e]; + for (let r = 0; r < t2.length; r++) { + let n = t2[r]; + for (let s of ["test", "consequent", "alternate"]) { + let i = n[s]; + if (H(i)) return true; + i.type === "ConditionalExpression" && t2.push(i); } - return array; } - function safeGet(object, key) { - if (key === "constructor" && typeof object[key] === "function") { - return; - } - if (key == "__proto__") { - return; + return false; + } + function Km(e, t2, r) { + let { node: n } = e, s = n.type === "ConditionalExpression", i = s ? "alternate" : "falseType", { parent: o } = e, u = s ? r("test") : [r("checkType"), " ", "extends", " ", r("extendsType")]; + return o.type === n.type && o[i] === n ? xe(2, u) : u; + } + var Qm = /* @__PURE__ */ new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"], ["AwaitExpression", "argument"]]); + function zm(e) { + let { node: t2 } = e; + if (t2.type !== "ConditionalExpression") return false; + let r, n = t2; + for (let s = 0; !r; s++) { + let i = e.getParentNode(s); + if (i.type === "ChainExpression" && i.expression === n || M(i) && i.callee === n || J(i) && i.object === n || i.type === "TSNonNullExpression" && i.expression === n) { + n = i; + continue; } - return object[key]; - } - var setData = shortOut(baseSetData); - var setTimeout2 = ctxSetTimeout || function(func, wait) { - return root.setTimeout(func, wait); - }; - var setToString = shortOut(baseSetToString); - function setWrapToString(wrapper, reference, bitmask) { - var source = reference + ""; - return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); - } - 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(undefined2, arguments); - }; + i.type === "NewExpression" && i.callee === n || Ae(i) && i.expression === n ? (r = e.getParentNode(s + 1), n = i) : r = i; } - function shuffleSelf(array, size2) { - var index = -1, length = array.length, lastIndex = length - 1; - size2 = size2 === undefined2 ? length : size2; - while (++index < size2) { - var rand = baseRandom(index, lastIndex), value = array[rand]; - array[rand] = array[index]; - array[index] = value; - } - array.length = size2; - return array; + return n === t2 ? false : r[Qm.get(r.type)] === n; + } + function Hu(e, t2, r) { + let { node: n } = e, s = n.type === "ConditionalExpression", i = s ? "consequent" : "trueType", o = s ? "alternate" : "falseType", u = s ? ["test"] : ["checkType", "extendsType"], p = n[i], c = n[o], y = [], D = false, { parent: F } = e, C = F.type === n.type && u.some((Y) => F[Y] === n), d = F.type === n.type && !C, b, B, O = 0; + do + B = b || n, b = e.getParentNode(O), O++; + while (b && b.type === n.type && u.every((Y) => b[Y] !== B)); + let h = b || F, g = B; + if (s && (H(n[u[0]]) || H(p) || H(c) || $m(g))) { + D = true, d = true; + let Y = (ee) => [P("("), m([f2, ee]), f2, P(")")], z = (ee) => ee.type === "NullLiteral" || ee.type === "Literal" && ee.value === null || ee.type === "Identifier" && ee.name === "undefined"; + y.push(" ? ", z(p) ? r(i) : Y(r(i)), " : ", c.type === n.type || z(c) ? r(o) : Y(r(o))); + } else { + let Y = (ee) => t2.useTabs ? m(r(ee)) : xe(2, r(ee)), z = [A2, "? ", p.type === n.type ? P("", "(") : "", Y(i), p.type === n.type ? P("", ")") : "", A2, ": ", Y(o)]; + y.push(F.type !== n.type || F[o] === n || C ? z : t2.useTabs ? Qr(m(z)) : xe(Math.max(0, t2.tabWidth - 2), z)); } - var stringToPath = memoizeCapped(function(string2) { - var result2 = []; - if (string2.charCodeAt(0) === 46) { - result2.push(""); - } - string2.replace(rePropName, function(match, number, quote, subString) { - result2.push(quote ? subString.replace(reEscapeChar, "$1") : number || match); - }); - return result2; - }); - function toKey(value) { - if (typeof value == "string" || isSymbol(value)) { - return value; + let S = (Y) => F === h ? l(Y) : Y, j = !D && (J(F) || F.type === "NGPipeExpression" && F.left === n) && !F.computed, U = zm(e), fe = S([Km(e, t2, r), d ? y : m(y), s && j && !U ? f2 : ""]); + return C || U ? l([m([f2, fe]), f2]) : fe; + } + function Zm(e, t2) { + return (J(t2) || t2.type === "NGPipeExpression" && t2.left === e) && !t2.computed; + } + function eD(e, t2, r, n) { + return [...e.map((i) => et(i)), et(t2), et(r)].flat().some((i) => ce(i) && ue(n.originalText, w(i), I(i))); + } + var tD = /* @__PURE__ */ new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"], ["AwaitExpression", "argument"]]); + function rD(e) { + let { node: t2 } = e; + if (t2.type !== "ConditionalExpression") return false; + let r, n = t2; + for (let s = 0; !r; s++) { + let i = e.getParentNode(s); + if (i.type === "ChainExpression" && i.expression === n || M(i) && i.callee === n || J(i) && i.object === n || i.type === "TSNonNullExpression" && i.expression === n) { + n = i; + continue; } - var result2 = value + ""; - return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2; + i.type === "NewExpression" && i.callee === n || Ae(i) && i.expression === n ? (r = e.getParentNode(s + 1), n = i) : r = i; } - function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) { - } - try { - return func + ""; - } catch (e) { + return n === t2 ? false : r[tD.get(r.type)] === n; + } + var qs = (e) => [P("("), m([f2, e]), f2, P(")")]; + function ur(e, t2, r, n) { + if (!t2.experimentalTernaries) return Hu(e, t2, r); + let { node: s } = e, i = s.type === "ConditionalExpression", o = Ue(s), u = i ? "consequent" : "trueType", p = i ? "alternate" : "falseType", c = i ? ["test"] : ["checkType", "extendsType"], y = s[u], D = s[p], F = c.map((mr) => s[mr]), { parent: C } = e, d = C.type === s.type, b = d && c.some((mr) => C[mr] === s), B = d && C[p] === s, O = y.type === s.type, h = D.type === s.type, g = h || B, S = t2.tabWidth > 2 || t2.useTabs, j, U, fe = 0; + do + U = j || s, j = e.getParentNode(fe), fe++; + while (j && j.type === s.type && c.every((mr) => j[mr] !== U)); + let Y = j || C, z = n && n.assignmentLayout && n.assignmentLayout !== "break-after-operator" && (C.type === "AssignmentExpression" || C.type === "VariableDeclarator" || C.type === "ClassProperty" || C.type === "PropertyDefinition" || C.type === "ClassPrivateProperty" || C.type === "ObjectProperty" || C.type === "Property"), ee = (C.type === "ReturnStatement" || C.type === "ThrowStatement") && !(O || h), Ie = i && Y.type === "JSXExpressionContainer" && e.grandparent.type !== "JSXAttribute", st = rD(e), _ = Zm(s, C), re = o && ge(e, t2), ae = S ? t2.useTabs ? " " : " ".repeat(t2.tabWidth - 1) : "", it = eD(F, y, D, t2) || O || h, Bt = !g && !d && !o && (Ie ? y.type === "NullLiteral" || y.type === "Literal" && y.value === null : Fr(y, t2) && $n(s.test, 3)), Mn = g || B || o && !d || d && i && $n(s.test, 1) || Bt, Pr = []; + !O && T(y, x.Dangling) && e.call(() => { + Pr.push(v(e, t2), E); + }, "consequent"); + let cr = []; + T(s.test, x.Dangling) && e.call(() => { + cr.push(v(e, t2)); + }, "test"), !h && T(D, x.Dangling) && e.call(() => { + cr.push(v(e, t2)); + }, "alternate"), T(s, x.Dangling) && cr.push(v(e, t2)); + let $s = /* @__PURE__ */ Symbol("test"), xa = /* @__PURE__ */ Symbol("consequent"), kr = /* @__PURE__ */ Symbol("test-and-consequent"), ga = i ? [qs(r("test")), s.test.type === "ConditionalExpression" ? ke : ""] : [r("checkType"), " ", "extends", " ", Ue(s.extendsType) || s.extendsType.type === "TSMappedType" ? r("extendsType") : l(qs(r("extendsType")))], Ks = l([ga, " ?"], { id: $s }), ha = r(u), Ir = m([O || Ie && (H(y) || d || g) ? E : A2, Pr, ha]), Sa = Mn ? l([Ks, g ? Ir : P(Ir, l(Ir, { id: xa }), { groupId: $s })], { id: kr }) : [Ks, Ir], Nn = r(p), Qs = Bt ? P(Nn, Qr(qs(Nn)), { groupId: kr }) : Nn, lr = [Sa, cr.length > 0 ? [m([E, cr]), E] : h ? E : Bt ? P(A2, " ", { groupId: kr }) : A2, ":", h ? " " : S ? Mn ? P(ae, P(g || Bt ? " " : ae, " "), { groupId: kr }) : P(ae, " ") : " ", h ? Qs : l([m(Qs), Ie && !Bt ? f2 : ""]), _ && !st ? f2 : "", it ? ke : ""]; + return z && !it ? l(m([f2, l(lr)])) : z || ee ? l(m(lr)) : st || o && b ? l([m([f2, lr]), re ? f2 : ""]) : C === Y ? l(lr) : lr; + } + function Xu(e, t2, r, n) { + var _a3; + let { node: s } = e; + if (Jr(s)) return ju(e, t2); + switch (s.type) { + case "JsExpressionRoot": + return r("node"); + case "JsonRoot": + return [v(e, t2), r("node"), E]; + case "File": + return (_a3 = _u(e, t2, r)) != null ? _a3 : r("program"); + case "ExpressionStatement": + return wu(e, t2, r); + case "ChainExpression": + return r("expression"); + case "ParenthesizedExpression": + return !T(s.expression) && (se(s.expression) || q(s.expression)) ? ["(", r("expression"), ")"] : l(["(", m([f2, r("expression")]), f2, ")"]); + case "AssignmentExpression": + return Zo(e, t2, r); + case "VariableDeclarator": + return eu(e, t2, r); + case "BinaryExpression": + case "LogicalExpression": + return on(e, t2, r); + case "AssignmentPattern": + return [r("left"), " = ", r("right")]; + case "OptionalMemberExpression": + case "MemberExpression": + return Xo(e, t2, r); + case "MetaProperty": + return [r("meta"), ".", r("property")]; + case "BindExpression": + return Ho(e, t2, r); + case "Identifier": + return [s.name, X(e), sn(e), G(e, r)]; + case "V8IntrinsicIdentifier": + return ["%", s.name]; + case "SpreadElement": + return or(e, r); + case "RestElement": + return or(e, r); + case "FunctionDeclaration": + case "FunctionExpression": + return mn(e, t2, r, n); + case "ArrowFunctionExpression": + return xu(e, t2, r, n); + case "YieldExpression": + return [`yield${s.delegate ? "*" : ""}`, s.argument ? [" ", r("argument")] : ""]; + case "AwaitExpression": { + let i = ["await"]; + if (s.argument) { + i.push(" ", r("argument")); + let { parent: o } = e; + if (M(o) && o.callee === s || J(o) && o.object === s) { + i = [m([f2, ...i]), f2]; + let u = e.findAncestor((p) => p.type === "AwaitExpression" || p.type === "BlockStatement"); + if ((u == null ? void 0 : u.type) !== "AwaitExpression" || !ye(u.argument, (p) => p === s)) return l(i); + } } + return i; } - return ""; - } - function updateWrapDetails(details, bitmask) { - arrayEach(wrapFlags, function(pair) { - var value = "_." + pair[0]; - if (bitmask & pair[1] && !arrayIncludes(details, value)) { - details.push(value); + case "ExportDefaultDeclaration": + case "ExportNamedDeclaration": + case "ExportAllDeclaration": + return An(e, t2, r); + case "ImportDeclaration": + return Ru(e, t2, r); + case "ImportSpecifier": + case "ExportSpecifier": + case "ImportNamespaceSpecifier": + case "ExportNamespaceSpecifier": + case "ImportDefaultSpecifier": + case "ExportDefaultSpecifier": + return Yu(e, t2, r); + case "ImportAttribute": + return ln(e, t2, r); + case "Program": + case "BlockStatement": + case "StaticBlock": + return En(e, t2, r); + case "ClassBody": + return Rt(e, t2, r); + case "ThrowStatement": + return uu(e, t2, r); + case "ReturnStatement": + return ou(e, t2, r); + case "NewExpression": + case "ImportExpression": + case "OptionalCallExpression": + case "CallExpression": + return vt(e, t2, r); + case "ObjectExpression": + case "ObjectPattern": + return ir(e, t2, r); + case "Property": + return mt(s) ? Sr(e, t2, r) : ln(e, t2, r); + case "ObjectProperty": + return ln(e, t2, r); + case "ObjectMethod": + return Sr(e, t2, r); + case "Decorator": + return ["@", r("expression")]; + case "ArrayExpression": + case "ArrayPattern": + return tr(e, t2, r); + case "SequenceExpression": { + let { parent: i } = e; + if (i.type === "ExpressionStatement" || i.type === "ForStatement") { + let u = []; + return e.each(({ isFirst: p }) => { + p ? u.push(r()) : u.push(",", m([A2, r()])); + }, "expressions"), l(u); } - }); - return details.sort(); - } - function wrapperClone(wrapper) { - if (wrapper instanceof LazyWrapper) { - return wrapper.clone(); - } - var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); - result2.__actions__ = copyArray(wrapper.__actions__); - result2.__index__ = wrapper.__index__; - result2.__values__ = wrapper.__values__; - return result2; - } - function chunk(array, size2, guard) { - if (guard ? isIterateeCall(array, size2, guard) : size2 === undefined2) { - size2 = 1; - } else { - size2 = nativeMax(toInteger(size2), 0); + let o = L([",", A2], e.map(r, "expressions")); + return (i.type === "ReturnStatement" || i.type === "ThrowStatement") && e.key === "argument" || i.type === "ArrowFunctionExpression" && e.key === "body" ? l(P([m([f2, o]), f2], o)) : l(o); } - var length = array == null ? 0 : array.length; - if (!length || size2 < 1) { - return []; + case "ThisExpression": + return "this"; + case "Super": + return "super"; + case "Directive": + return [r("value"), t2.semi ? ";" : ""]; + case "UnaryExpression": { + let i = [s.operator]; + return /[a-z]$/u.test(s.operator) && i.push(" "), T(s.argument) ? i.push(l(["(", m([f2, r("argument")]), f2, ")"])) : i.push(r("argument")), i; } - var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size2)); - while (index < length) { - result2[resIndex++] = baseSlice(array, index, index += size2); + case "UpdateExpression": + return [s.prefix ? s.operator : "", r("argument"), s.prefix ? "" : s.operator]; + case "ConditionalExpression": + return ur(e, t2, r, n); + case "VariableDeclaration": { + let i = e.map(r, "declarations"), o = e.parent, u = o.type === "ForStatement" || o.type === "ForInStatement" || o.type === "ForOfStatement", p = s.declarations.some((y) => y.init), c; + return i.length === 1 && !T(s.declarations[0]) ? c = i[0] : i.length > 0 && (c = m(i[0])), l([Q(e), s.kind, c ? [" ", c] : "", m(i.slice(1).map((y) => [",", p && !u ? E : A2, y])), t2.semi && !(u && o.body !== s) ? ";" : ""]); } - return result2; - } - function compact(array) { - var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = []; - while (++index < length) { - var value = array[index]; - if (value) { - result2[resIndex++] = value; + case "WithStatement": + return l(["with (", r("object"), ")", Ft(s.body, r("body"))]); + case "IfStatement": { + let i = Ft(s.consequent, r("consequent")), u = [l(["if (", l([m([f2, r("test")]), f2]), ")", i])]; + if (s.alternate) { + let p = T(s.consequent, x.Trailing | x.Line) || qr(s), c = s.consequent.type === "BlockStatement" && !p; + u.push(c ? " " : E), T(s, x.Dangling) && u.push(v(e, t2), p ? E : " "), u.push("else", l(Ft(s.alternate, r("alternate"), s.alternate.type === "IfStatement"))); } + return u; } - return result2; - } - function concat() { - var length = arguments.length; - if (!length) { - return []; - } - var args = Array2(length - 1), array = arguments[0], index = length; - while (index--) { - args[index - 1] = arguments[index]; - } - return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); - } - var difference = baseRest(function(array, values2) { - return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true)) : []; - }); - var differenceBy = baseRest(function(array, values2) { - var iteratee2 = last(values2); - if (isArrayLikeObject(iteratee2)) { - iteratee2 = undefined2; + case "ForStatement": { + let i = Ft(s.body, r("body")), o = v(e, t2), u = o ? [o, f2] : ""; + return !s.init && !s.test && !s.update ? [u, l(["for (;;)", i])] : [u, l(["for (", l([m([f2, r("init"), ";", A2, r("test"), ";", s.update ? [A2, r("update")] : P("", A2)]), f2]), ")", i])]; } - return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : []; - }); - var differenceWith = baseRest(function(array, values2) { - var comparator = last(values2); - if (isArrayLikeObject(comparator)) { - comparator = undefined2; + case "WhileStatement": + return l(["while (", l([m([f2, r("test")]), f2]), ")", Ft(s.body, r("body"))]); + case "ForInStatement": + return l(["for (", r("left"), " in ", r("right"), ")", Ft(s.body, r("body"))]); + case "ForOfStatement": + return l(["for", s.await ? " await" : "", " (", r("left"), " of ", r("right"), ")", Ft(s.body, r("body"))]); + case "DoWhileStatement": { + let i = Ft(s.body, r("body")); + return [l(["do", i]), s.body.type === "BlockStatement" ? " " : E, "while (", l([m([f2, r("test")]), f2]), ")", t2.semi ? ";" : ""]; } - return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : []; - }); - function drop(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; + case "DoExpression": + return [s.async ? "async " : "", "do ", r("body")]; + case "BreakStatement": + case "ContinueStatement": + return [s.type === "BreakStatement" ? "break" : "continue", s.label ? [" ", r("label")] : "", t2.semi ? ";" : ""]; + case "LabeledStatement": + return [r("label"), `:${s.body.type === "EmptyStatement" && !T(s.body, x.Leading) ? "" : " "}`, r("body")]; + case "TryStatement": + return ["try ", r("block"), s.handler ? [" ", r("handler")] : "", s.finalizer ? [" finally ", r("finalizer")] : ""]; + case "CatchClause": + if (s.param) { + let i = T(s.param, (u) => !ce(u) || u.leading && Z(t2.originalText, I(u)) || u.trailing && Z(t2.originalText, w(u), { backwards: true })), o = r("param"); + return ["catch ", i ? ["(", m([f2, o]), f2, ") "] : ["(", o, ") "], r("body")]; + } + return ["catch ", r("body")]; + case "SwitchStatement": + return [l(["switch (", m([f2, r("discriminant")]), f2, ")"]), " {", s.cases.length > 0 ? m([E, L(E, e.map(({ node: i, isLast: o }) => [r(), !o && oe(i, t2) ? E : ""], "cases"))]) : "", E, "}"]; + case "SwitchCase": { + let i = []; + s.test ? i.push("case ", r("test"), ":") : i.push("default:"), T(s, x.Dangling) && i.push(" ", v(e, t2)); + let o = s.consequent.filter((u) => u.type !== "EmptyStatement"); + if (o.length > 0) { + let u = br(e, t2, r, "consequent"); + i.push(o.length === 1 && o[0].type === "BlockStatement" ? [" ", u] : m([E, u])); + } + return i; } - n = guard || n === undefined2 ? 1 : toInteger(n); - return baseSlice(array, n < 0 ? 0 : n, length); + case "DebuggerStatement": + return ["debugger", t2.semi ? ";" : ""]; + case "ClassDeclaration": + case "ClassExpression": + return sr(e, t2, r); + case "ClassMethod": + case "ClassPrivateMethod": + case "MethodDefinition": + return Fn(e, t2, r); + case "ClassProperty": + case "PropertyDefinition": + case "ClassPrivateProperty": + case "ClassAccessorProperty": + case "AccessorProperty": + return dn(e, t2, r); + case "TemplateElement": + return qe(s.value.raw); + case "TemplateLiteral": + return en(e, t2, r); + case "TaggedTemplateExpression": + return oo(e, t2, r); + case "PrivateIdentifier": + return ["#", s.name]; + case "PrivateName": + return ["#", r("id")]; + case "TopicReference": + return "%"; + case "ArgumentPlaceholder": + return "?"; + case "ModuleExpression": + return ["module ", r("body")]; + case "VoidPattern": + return "void"; + case "EmptyStatement": + if (kt(e)) return ";"; + case "InterpreterDirective": + default: + throw new Qe(s, "ESTree"); } - function dropRight(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = guard || n === undefined2 ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, 0, n < 0 ? 0 : n); + } + function Tn(e) { + return [e("elementType"), "[]"]; + } + var nD = k(["SatisfiesExpression", "TSSatisfiesExpression"]); + function xn(e, t2, r) { + let { parent: n, node: s, key: i } = e, u = s.type === "AsConstExpression" ? "const" : r("typeAnnotation"), p = [r("expression"), " ", nD(s) ? "satisfies" : "as", " ", u]; + return i === "callee" && M(n) || i === "object" && J(n) ? l([m([f2, ...p]), f2]) : p; + } + function Vu(e, t2, r) { + let { node: n } = e, s = [Q(e), "component"]; + n.id && s.push(" ", r("id")), s.push(r("typeParameters")); + let i = sD(e, t2, r); + return n.rendersType ? s.push(l([i, " ", r("rendersType")])) : s.push(l([i])), n.body && s.push(" ", r("body")), t2.semi && n.type === "DeclareComponent" && s.push(";"), s; + } + function sD(e, t2, r) { + let { node: n } = e, s = n.params; + if (n.rest && (s = [...s, n.rest]), s.length === 0) return ["(", v(e, t2, { filter: (o) => _e(t2.originalText, I(o)) === ")" }), ")"]; + let i = []; + return oD(e, (o, u) => { + let p = u === s.length - 1; + p && n.rest && i.push("..."), i.push(r()), !p && (i.push(","), oe(s[u], t2) ? i.push(E, E) : i.push(A2)); + }), ["(", m([f2, ...i]), P(ie(t2, "all") && !iD(n, s) ? "," : ""), f2, ")"]; + } + function iD(e, t2) { + var _a3; + return e.rest || ((_a3 = N(0, t2, -1)) == null ? void 0 : _a3.type) === "RestElement"; + } + function oD(e, t2) { + let { node: r } = e, n = 0, s = (i) => t2(i, n++); + e.each(s, "params"), r.rest && e.call(s, "rest"); + } + function $u(e, t2, r) { + let { node: n } = e; + return n.shorthand ? r("local") : [r("name"), " as ", r("local")]; + } + function Ku(e, t2, r) { + let { node: n } = e, s = []; + return n.name && s.push(r("name"), n.optional ? "?: " : ": "), s.push(r("typeAnnotation")), s; + } + function Us(e, t2, r) { + return ir(e, t2, r); + } + function Qu(e, t2, r) { + let { node: n } = e; + return [n.type === "EnumSymbolBody" || n.explicitType ? `of ${n.type.slice(4, -4).toLowerCase()} ` : "", Us(e, t2, r)]; + } + function gn(e, t2) { + let { node: r } = e, n = t2("id"); + r.computed && (n = ["[", n, "]"]); + let s = ""; + return r.initializer && (s = t2("initializer")), r.init && (s = t2("init")), s ? [n, " = ", s] : n; + } + function hn(e, t2) { + let { node: r } = e; + return [Q(e), r.const ? "const " : "", "enum ", t2("id"), " ", t2("body")]; + } + function Sn(e, t2, r) { + let { node: n } = e, s = [Zt(e)]; + (n.type === "TSConstructorType" || n.type === "TSConstructSignatureDeclaration") && s.push("new "); + let i = Ke(e, t2, r, false, true), o = []; + return n.type === "FunctionTypeAnnotation" ? o.push(uD(e) ? " => " : ": ", r("returnType")) : o.push(G(e, r, "returnType")), lt(n, o) && (i = l(i)), s.push(i, o), [l(s), n.type === "TSConstructSignatureDeclaration" || n.type === "TSCallSignatureDeclaration" ? he(e, t2) : ""]; + } + function uD(e) { + var _a3; + let { node: t2, parent: r } = e; + return t2.type === "FunctionTypeAnnotation" && (Gr(r) || !((r.type === "ObjectTypeProperty" || r.type === "ObjectTypeInternalSlot") && !r.variance && !r.optional && bt(r, t2) || r.type === "ObjectTypeCallProperty" || ((_a3 = e.getParentNode(2)) == null ? void 0 : _a3.type) === "DeclareFunction")); + } + function Zu(e, t2, r) { + let { node: n } = e, s = ["hook"]; + n.id && s.push(" ", r("id")); + let i = Ke(e, t2, r, false, true), o = rr(e, r), u = lt(n, o); + return s.push(l([u ? l(i) : i, o]), n.body ? " " : "", r("body")), s; + } + function ea(e, t2, r) { + let { node: n } = e, s = [Q(e), "hook"]; + return n.id && s.push(" ", r("id")), t2.semi && s.push(";"), s; + } + function zu(e) { + var _a3; + let { node: t2 } = e; + return t2.type === "HookTypeAnnotation" && ((_a3 = e.getParentNode(2)) == null ? void 0 : _a3.type) === "DeclareHook"; + } + function ta(e, t2, r) { + let { node: n } = e, s = Ke(e, t2, r, false, true), i = [zu(e) ? ": " : " => ", r("returnType")]; + return l([zu(e) ? "" : "hook ", lt(n, i) ? l(s) : s, i]); + } + function Bn(e, t2, r) { + return [r("objectType"), X(e), "[", r("indexType"), "]"]; + } + function bn(e, t2, r) { + return ["infer ", r("typeParameter")]; + } + function Pn(e, t2, r) { + let n = false; + return l(e.map(({ isFirst: s, previous: i, node: o, index: u }) => { + let p = r(); + if (s) return p; + let c = Je(o), y = Je(i); + return y && c ? [" & ", n ? m(p) : p] : !y && !c || Ee(t2.originalText, o) ? t2.experimentalOperatorPosition === "start" ? m([A2, "& ", p]) : m([" &", A2, p]) : (u > 1 && (n = true), [" & ", u > 1 ? m(p) : p]); + }, "types")); + } + function aD(e) { + switch (e) { + case null: + return ""; + case "PlusOptional": + return "+?"; + case "MinusOptional": + return "-?"; + case "Optional": + return "?"; } - function dropRightWhile(array, predicate) { - return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true, true) : []; + } + function na(e, t2, r) { + let { node: n } = e; + return [l([n.variance ? r("variance") : "", "[", m([r("keyTparam"), " in ", r("sourceType")]), "]", aD(n.optional), ": ", r("propType")]), he(e, t2)]; + } + function ra(e, t2) { + return e === "+" || e === "-" ? e + t2 : t2; + } + function sa(e, t2, r) { + let { node: n } = e, s = false; + if (t2.objectWrap === "preserve") { + let i = w(n), o = Jt(t2, i + 1, w(n.key)), u = i + 1 + o.search(/\S/u); + ue(t2.originalText, i, u) && (s = true); } - function dropWhile(array, predicate) { - return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : []; + return l(["{", m([t2.bracketSpacing ? A2 : f2, T(n, x.Dangling) ? l([v(e, t2), E]) : "", l([n.readonly ? [ra(n.readonly, "readonly"), " "] : "", "[", r("key"), " in ", r("constraint"), n.nameType ? [" as ", r("nameType")] : "", "]", n.optional ? ra(n.optional, "?") : "", n.typeAnnotation ? ": " : "", r("typeAnnotation")]), t2.semi ? P(";") : ""]), t2.bracketSpacing ? A2 : f2, "}"], { shouldBreak: s }); + } + function ia(e, t2, r) { + let { node: n } = e; + return [l(["match (", m([f2, r("argument")]), f2, ")"]), " {", n.cases.length > 0 ? m([E, L(E, e.map(({ node: s, isLast: i }) => [r(), !i && oe(s, t2) ? E : ""], "cases"))]) : "", E, "}"]; + } + function oa(e, t2, r) { + let { node: n } = e, s = T(n, x.Dangling) ? [" ", v(e, t2)] : [], i = n.type === "MatchStatementCase" ? [" ", r("body")] : m([A2, r("body"), ","]); + return [r("pattern"), n.guard ? l([m([A2, "if (", r("guard"), ")"])]) : "", l([" =>", s, i])]; + } + function ua(e, t2, r) { + let { node: n } = e; + switch (n.type) { + case "MatchOrPattern": + return lD(e, t2, r); + case "MatchAsPattern": + return [r("pattern"), " as ", r("target")]; + case "MatchWildcardPattern": + return ["_"]; + case "MatchLiteralPattern": + return r("literal"); + case "MatchUnaryPattern": + return [n.operator, r("argument")]; + case "MatchIdentifierPattern": + return r("id"); + case "MatchMemberPattern": { + let s = n.property.type === "Identifier" ? [".", r("property")] : ["[", m([f2, r("property")]), f2, "]"]; + return l([r("base"), s]); + } + case "MatchBindingPattern": + return [n.kind, " ", r("id")]; + case "MatchObjectPattern": { + let s = e.map(r, "properties"); + return n.rest && s.push(r("rest")), l(["{", m([f2, L([",", A2], s)]), n.rest ? "" : P(","), f2, "}"]); + } + case "MatchArrayPattern": { + let s = e.map(r, "elements"); + return n.rest && s.push(r("rest")), l(["[", m([f2, L([",", A2], s)]), n.rest ? "" : P(","), f2, "]"]); + } + case "MatchObjectPatternProperty": + return n.shorthand ? r("pattern") : l([r("key"), ":", m([A2, r("pattern")])]); + case "MatchRestPattern": { + let s = ["..."]; + return n.argument && s.push(r("argument")), s; + } + } + } + var aa = k(["MatchWildcardPattern", "MatchLiteralPattern", "MatchUnaryPattern", "MatchIdentifierPattern"]); + function pD(e) { + let { patterns: t2 } = e; + if (t2.some((n) => T(n))) return false; + let r = t2.find((n) => n.type === "MatchObjectPattern"); + return r ? t2.every((n) => n === r || aa(n)) : false; + } + function cD(e) { + return aa(e) || e.type === "MatchObjectPattern" ? true : e.type === "MatchOrPattern" ? pD(e) : false; + } + function lD(e, t2, r) { + let { node: n } = e, { parent: s } = e, i = s.type !== "MatchStatementCase" && s.type !== "MatchExpressionCase" && s.type !== "MatchArrayPattern" && s.type !== "MatchObjectPatternProperty" && !Ee(t2.originalText, n), o = cD(n), u = e.map(() => { + let c = r(); + return o || (c = xe(2, c)), De(e, c, t2); + }, "patterns"); + if (o) return L(" | ", u); + let p = [P(["| "]), L([A2, "| "], u)]; + return ge(e, t2) ? l([m([P([f2]), p]), f2]) : s.type === "MatchArrayPattern" && s.elements.length > 1 ? l([m([P(["(", f2]), p]), f2, P(")")]) : l(i ? m(p) : p); + } + function pa(e, t2, r) { + let { node: n } = e, s = [Q(e), "opaque type ", r("id"), r("typeParameters")]; + if (n.supertype && s.push(": ", r("supertype")), n.lowerBound || n.upperBound) { + let i = []; + n.lowerBound && i.push(m([A2, "super ", r("lowerBound")])), n.upperBound && i.push(m([A2, "extends ", r("upperBound")])), s.push(l(i)); } - 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); + return n.impltype && s.push(" = ", r("impltype")), s.push(t2.semi ? ";" : ""), s; + } + function kn(e, t2, r) { + let { node: n } = e; + return ["...", ...n.type === "TupleTypeSpreadElement" && n.label ? [r("label"), ": "] : [], r("typeAnnotation")]; + } + function In(e, t2, r) { + let { node: n } = e; + return [n.variance ? r("variance") : "", r("label"), n.optional ? "?" : "", ": ", r("elementType")]; + } + function Ln(e, t2, r) { + let { node: n } = e, s = [Q(e), "type ", r("id"), r("typeParameters")], i = n.type === "TSTypeAliasDeclaration" ? "typeAnnotation" : "right"; + return [ht(e, t2, r, s, " =", i), t2.semi ? ";" : ""]; + } + function mD(e, t2, r) { + let { node: n } = e; + return K(n).length === 1 && n.type.startsWith("TS") && !n[r][0].constraint && e.parent.type === "ArrowFunctionExpression" && !(t2.filepath && /\.ts$/u.test(t2.filepath)); + } + function Gt(e, t2, r, n) { + let { node: s } = e; + if (!s[n]) return ""; + if (!Array.isArray(s[n])) return r(n); + let i = It(e.grandparent), o = e.match((c) => !(c[n].length === 1 && Je(c[n][0])), void 0, (c, y) => y === "typeAnnotation", (c) => c.type === "Identifier", bs); + if (s[n].length === 0 || !o && (i || s[n].length === 1 && (s[n][0].type === "NullableTypeAnnotation" || Go(s[n][0])))) return ["<", L(", ", e.map(r, n)), DD(e, t2), ">"]; + let p = s.type === "TSTypeParameterInstantiation" ? "" : mD(e, t2, n) ? "," : ie(t2) ? P(",") : ""; + return l(["<", m([f2, L([",", A2], e.map(r, n))]), p, f2, ">"]); + } + function DD(e, t2) { + let { node: r } = e; + if (!T(r, x.Dangling)) return ""; + let n = !T(r, x.Line), s = v(e, t2, { indent: !n }); + return n ? s : [s, E]; + } + function On(e, t2, r) { + let { node: n } = e, s = [n.const ? "const " : ""], i = n.type === "TSTypeParameter" ? r("name") : n.name; + if (n.variance && s.push(r("variance")), n.in && s.push("in "), n.out && s.push("out "), s.push(i), n.bound && (n.usesExtendsBound && s.push(" extends "), s.push(G(e, r, "bound"))), n.constraint) { + let o = /* @__PURE__ */ Symbol("constraint"); + s.push(" extends", l(m(A2), { id: o }), je, yt(r("constraint"), { groupId: o })); } - 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); + if (n.default) { + let o = /* @__PURE__ */ Symbol("default"); + s.push(" =", l(m(A2), { id: o }), je, yt(r("default"), { groupId: o })); } - function findLastIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; + return l(s); + } + function wn(e, t2) { + let { node: r } = e; + return [r.type === "TSTypePredicate" && r.asserts ? "asserts " : r.type === "TypePredicate" && r.kind ? `${r.kind} ` : "", t2("parameterName"), r.typeAnnotation ? [" is ", G(e, t2)] : ""]; + } + function _n({ node: e }, t2) { + let r = e.type === "TSTypeQuery" ? "exprName" : "argument"; + return ["typeof ", t2(r), t2("typeArguments")]; + } + function ca(e, t2, r) { + var _a3; + let { node: n } = e; + if (Nr(n)) return n.type.slice(0, -14).toLowerCase(); + switch (n.type) { + case "ComponentDeclaration": + case "DeclareComponent": + case "ComponentTypeAnnotation": + return Vu(e, t2, r); + case "ComponentParameter": + return $u(e, t2, r); + case "ComponentTypeParameter": + return Ku(e, t2, r); + case "HookDeclaration": + return Zu(e, t2, r); + case "DeclareHook": + return ea(e, t2, r); + case "HookTypeAnnotation": + return ta(e, t2, r); + case "DeclareFunction": + return [Q(e), "function ", r("id"), r("predicate"), t2.semi ? ";" : ""]; + case "DeclareModule": + return ["declare module ", r("id"), " ", r("body")]; + case "DeclareModuleExports": + return ["declare module.exports", G(e, r), t2.semi ? ";" : ""]; + case "DeclareNamespace": + return ["declare namespace ", r("id"), " ", r("body")]; + case "DeclareVariable": + return [Q(e), (_a3 = n.kind) != null ? _a3 : "var", " ", r("id"), t2.semi ? ";" : ""]; + case "DeclareExportDeclaration": + case "DeclareExportAllDeclaration": + return An(e, t2, r); + case "DeclareOpaqueType": + case "OpaqueType": + return pa(e, t2, r); + case "DeclareTypeAlias": + case "TypeAlias": + return Ln(e, t2, r); + case "IntersectionTypeAnnotation": + return Pn(e, t2, r); + case "UnionTypeAnnotation": + return un(e, t2, r); + case "ConditionalTypeAnnotation": + return ur(e, t2, r); + case "InferTypeAnnotation": + return bn(e, t2, r); + case "FunctionTypeAnnotation": + return Sn(e, t2, r); + case "TupleTypeAnnotation": + return tr(e, t2, r); + case "TupleTypeLabeledElement": + return In(e, t2, r); + case "TupleTypeSpreadElement": + return kn(e, t2, r); + case "GenericTypeAnnotation": + return [r("id"), Gt(e, t2, r, "typeParameters")]; + case "IndexedAccessType": + case "OptionalIndexedAccessType": + return Bn(e, t2, r); + case "TypeAnnotation": + return an(e, t2, r); + case "TypeParameter": + return On(e, t2, r); + case "TypeofTypeAnnotation": + return _n(e, r); + case "ExistsTypeAnnotation": + return "*"; + case "ArrayTypeAnnotation": + return Tn(r); + case "DeclareEnum": + case "EnumDeclaration": + return hn(e, r); + case "EnumBooleanBody": + case "EnumNumberBody": + case "EnumBigIntBody": + case "EnumStringBody": + case "EnumSymbolBody": + return Qu(e, t2, r); + case "EnumBooleanMember": + case "EnumNumberMember": + case "EnumBigIntMember": + case "EnumStringMember": + case "EnumDefaultedMember": + return gn(e, r); + case "FunctionTypeParam": { + let s = n.name ? r("name") : e.parent.this === n ? "this" : ""; + return [s, X(e), s ? ": " : "", r("typeAnnotation")]; } - var index = length - 1; - if (fromIndex !== undefined2) { - index = toInteger(fromIndex); - index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); + case "DeclareClass": + case "DeclareInterface": + case "InterfaceDeclaration": + case "InterfaceTypeAnnotation": + return sr(e, t2, r); + case "ObjectTypeAnnotation": + return Rt(e, t2, r); + case "ClassImplements": + case "InterfaceExtends": + return [r("id"), r("typeParameters")]; + case "NullableTypeAnnotation": + return ["?", r("typeAnnotation")]; + case "Variance": { + let { kind: s } = n; + return Le(s === "plus" || s === "minus"), s === "plus" ? "+" : "-"; } - return baseFindIndex(array, getIteratee(predicate, 3), index, true); - } - function flatten(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, 1) : []; - } - function flattenDeep(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, INFINITY) : []; - } - function flattenDepth(array, depth) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; + case "KeyofTypeAnnotation": + return ["keyof ", r("argument")]; + case "ObjectTypeCallProperty": + return [n.static ? "static " : "", r("value"), he(e, t2)]; + case "ObjectTypeMappedTypeProperty": + return na(e, t2, r); + case "ObjectTypeIndexer": + return [n.static ? "static " : "", n.variance ? r("variance") : "", "[", r("id"), n.id ? ": " : "", r("key"), "]: ", r("value"), he(e, t2)]; + case "ObjectTypeProperty": { + let s = ""; + return n.proto ? s = "proto " : n.static && (s = "static "), [s, n.kind !== "init" ? n.kind + " " : "", n.variance ? r("variance") : "", Ct(e, t2, r), X(e), mt(n) ? "" : ": ", r("value"), he(e, t2)]; } - depth = depth === undefined2 ? 1 : toInteger(depth); - return baseFlatten(array, depth); + case "ObjectTypeInternalSlot": + return [n.static ? "static " : "", "[[", r("id"), "]]", X(e), n.method ? "" : ": ", r("value"), he(e, t2)]; + case "ObjectTypeSpreadProperty": + return or(e, r); + case "QualifiedTypeofIdentifier": + case "QualifiedTypeIdentifier": + return [r("qualification"), ".", r("id")]; + case "NullLiteralTypeAnnotation": + return "null"; + case "BooleanLiteralTypeAnnotation": + return String(n.value); + case "StringLiteralTypeAnnotation": + return qe(ut(pe(n), t2)); + case "NumberLiteralTypeAnnotation": + return dt(pe(n)); + case "BigIntLiteralTypeAnnotation": + return Cn(pe(n)); + case "TypeCastExpression": + return ["(", r("expression"), G(e, r), ")"]; + case "TypePredicate": + return wn(e, r); + case "TypeOperator": + return [n.operator, " ", r("typeAnnotation")]; + case "TypeParameterDeclaration": + case "TypeParameterInstantiation": + return Gt(e, t2, r, "params"); + case "InferredPredicate": + case "DeclaredPredicate": + return [e.key === "predicate" && e.parent.type !== "DeclareFunction" && !e.parent.returnType ? ": " : " ", "%checks", ...n.type === "DeclaredPredicate" ? ["(", r("value"), ")"] : []]; + case "AsExpression": + case "AsConstExpression": + case "SatisfiesExpression": + return xn(e, t2, r); + case "MatchExpression": + case "MatchStatement": + return ia(e, t2, r); + case "MatchExpressionCase": + case "MatchStatementCase": + return oa(e, t2, r); + case "MatchOrPattern": + case "MatchAsPattern": + case "MatchWildcardPattern": + case "MatchLiteralPattern": + case "MatchUnaryPattern": + case "MatchIdentifierPattern": + case "MatchMemberPattern": + case "MatchBindingPattern": + case "MatchObjectPattern": + case "MatchObjectPatternProperty": + case "MatchRestPattern": + case "MatchArrayPattern": + return ua(e, t2, r); } - function fromPairs(pairs2) { - var index = -1, length = pairs2 == null ? 0 : pairs2.length, result2 = {}; - while (++index < length) { - var pair = pairs2[index]; - result2[pair[0]] = pair[1]; + } + function la(e, t2, r) { + let { node: n } = e, s = n.parameters.length > 1 ? P(ie(t2) ? "," : "") : "", i = l([m([f2, L([", ", f2], e.map(r, "parameters"))]), s, f2]); + return [e.key === "body" && e.parent.type === "ClassBody" && n.static ? "static " : "", n.readonly ? "readonly " : "", "[", n.parameters ? i : "", "]", G(e, r), he(e, t2)]; + } + function Ys(e, t2, r) { + let { node: n } = e; + return [n.postfix ? "" : r, G(e, t2), n.postfix ? r : ""]; + } + function ma(e, t2, r) { + let { node: n } = e, s = [], i = n.kind && n.kind !== "method" ? `${n.kind} ` : ""; + s.push(jt(n), i, n.computed ? "[" : "", r("key"), n.computed ? "]" : "", X(e)); + let o = Ke(e, t2, r, false, true), u = G(e, r, "returnType"), p = lt(n, u); + return s.push(p ? l(o) : o), n.returnType && s.push(l(u)), [l(s), he(e, t2)]; + } + function Da(e, t2, r) { + let { node: n } = e; + return [Q(e), n.kind === "global" ? "" : `${n.kind} `, r("id"), n.body ? [" ", l(r("body"))] : t2.semi ? ";" : ""]; + } + function fa(e, t2, r) { + let { node: n } = e, s = !(q(n.expression) || se(n.expression)), i = l(["<", m([f2, r("typeAnnotation")]), f2, ">"]), o = [P("("), m([f2, r("expression")]), f2, P(")")]; + return s ? nt([[i, r("expression")], [i, l(o, { shouldBreak: true })], [i, r("expression")]]) : l([i, r("expression")]); + } + function ya(e, t2, r) { + let { node: n } = e; + if (n.type.startsWith("TS")) { + if (jr(n)) return n.type.slice(2, -7).toLowerCase(); + switch (n.type) { + case "TSThisType": + return "this"; + case "TSTypeAssertion": + return fa(e, t2, r); + case "TSDeclareFunction": + return mn(e, t2, r); + case "TSExportAssignment": + return ["export = ", r("expression"), t2.semi ? ";" : ""]; + case "TSModuleBlock": + return En(e, t2, r); + case "TSInterfaceBody": + case "TSTypeLiteral": + return Rt(e, t2, r); + case "TSTypeAliasDeclaration": + return Ln(e, t2, r); + case "TSQualifiedName": + return [r("left"), ".", r("right")]; + case "TSAbstractMethodDefinition": + case "TSDeclareMethod": + return Fn(e, t2, r); + case "TSAbstractAccessorProperty": + case "TSAbstractPropertyDefinition": + return dn(e, t2, r); + case "TSInterfaceHeritage": + case "TSClassImplements": + case "TSInstantiationExpression": + return [r("expression"), r("typeArguments")]; + case "TSTemplateLiteralType": + return en(e, t2, r); + case "TSNamedTupleMember": + return In(e, t2, r); + case "TSRestType": + return kn(e, t2, r); + case "TSOptionalType": + return [r("typeAnnotation"), "?"]; + case "TSInterfaceDeclaration": + return sr(e, t2, r); + case "TSTypeParameterDeclaration": + case "TSTypeParameterInstantiation": + return Gt(e, t2, r, "params"); + case "TSTypeParameter": + return On(e, t2, r); + case "TSAsExpression": + case "TSSatisfiesExpression": + return xn(e, t2, r); + case "TSArrayType": + return Tn(r); + case "TSPropertySignature": + return [n.readonly ? "readonly " : "", Ct(e, t2, r), X(e), G(e, r), he(e, t2)]; + case "TSParameterProperty": + return [jt(n), n.static ? "static " : "", n.override ? "override " : "", n.readonly ? "readonly " : "", r("parameter")]; + case "TSTypeQuery": + return _n(e, r); + case "TSIndexSignature": + return la(e, t2, r); + case "TSTypePredicate": + return wn(e, r); + case "TSNonNullExpression": + return [r("expression"), "!"]; + case "TSImportType": + return [vt(e, t2, r), n.qualifier ? [".", r("qualifier")] : "", Gt(e, t2, r, "typeArguments")]; + case "TSLiteralType": + return r("literal"); + case "TSIndexedAccessType": + return Bn(e, t2, r); + case "TSTypeOperator": + return [n.operator, " ", r("typeAnnotation")]; + case "TSMappedType": + return sa(e, t2, r); + case "TSMethodSignature": + return ma(e, t2, r); + case "TSNamespaceExportDeclaration": + return ["export as namespace ", r("id"), t2.semi ? ";" : ""]; + case "TSEnumDeclaration": + return hn(e, r); + case "TSEnumBody": + return Us(e, t2, r); + case "TSEnumMember": + return gn(e, r); + case "TSImportEqualsDeclaration": + return ["import ", Ws(n, false), r("id"), " = ", r("moduleReference"), t2.semi ? ";" : ""]; + case "TSExternalModuleReference": + return vt(e, t2, r); + case "TSModuleDeclaration": + return Da(e, t2, r); + case "TSConditionalType": + return ur(e, t2, r); + case "TSInferType": + return bn(e, t2, r); + case "TSIntersectionType": + return Pn(e, t2, r); + case "TSUnionType": + return un(e, t2, r); + case "TSFunctionType": + case "TSCallSignatureDeclaration": + case "TSConstructorType": + case "TSConstructSignatureDeclaration": + return Sn(e, t2, r); + case "TSTupleType": + return tr(e, t2, r); + case "TSTypeReference": + return [r("typeName"), Gt(e, t2, r, "typeArguments")]; + case "TSTypeAnnotation": + return an(e, t2, r); + case "TSEmptyBodyFunctionExpression": + return Dn(e, t2, r); + case "TSJSDocAllType": + return "*"; + case "TSJSDocUnknownType": + return "?"; + case "TSJSDocNullableType": + return Ys(e, r, "?"); + case "TSJSDocNonNullableType": + return Ys(e, r, "!"); + case "TSParenthesizedType": + default: + throw new Qe(n, "TypeScript"); + } + } + } + function fD(e, t2, r, n) { + for (let s of [Eu, Du, ca, ya, Xu]) { + let i = s(e, t2, r, n); + if (i !== void 0) return i; + } + } + var yD = k(["ClassMethod", "ClassPrivateMethod", "ClassProperty", "ClassAccessorProperty", "AccessorProperty", "TSAbstractAccessorProperty", "PropertyDefinition", "TSAbstractPropertyDefinition", "ClassPrivateProperty", "MethodDefinition", "TSAbstractMethodDefinition", "TSDeclareMethod"]); + function ED(e, t2, r, n) { + var _a3; + e.isRoot && ((_a3 = t2.__onHtmlBindingRoot) == null ? void 0 : _a3.call(t2, e.node, t2)); + let { node: s } = e, i = nr(e) ? t2.originalText.slice(w(s), I(s)) : fD(e, t2, r, n); + if (!i) return ""; + if (yD(s)) return i; + let o = R(s.decorators), u = du(e, t2, r), p = s.type === "ClassExpression"; + if (o && !p) return Ar(i, (D) => l([u, D])); + let c = ge(e, t2), y = au(e, t2); + return !u && !c && !y ? i : Ar(i, (D) => [y ? ";" : "", c ? "(" : "", c && p && o ? [m([A2, u, D]), A2] : [u, D], c ? ")" : ""]); + } + var Hs = ED; + var FD = { experimental_avoidAstMutation: true }; + var Ea = [{ name: "JSON.stringify", type: "data", aceMode: "json", extensions: [".importmap"], filenames: ["package.json", "package-lock.json", "composer.json"], tmScope: "source.json", aliases: ["geojson", "jsonl", "sarif", "topojson"], codemirrorMode: "javascript", codemirrorMimeType: "application/json", parsers: ["json-stringify"], vscodeLanguageIds: ["json"], linguistLanguageId: 174 }, { name: "JSON", type: "data", aceMode: "json", extensions: [".json", ".4DForm", ".4DProject", ".avsc", ".geojson", ".gltf", ".har", ".ice", ".JSON-tmLanguage", ".json.example", ".mcmeta", ".sarif", ".tact", ".tfstate", ".tfstate.backup", ".topojson", ".webapp", ".webmanifest", ".yy", ".yyp"], filenames: [".all-contributorsrc", ".arcconfig", ".auto-changelog", ".c8rc", ".htmlhintrc", ".imgbotconfig", ".nycrc", ".tern-config", ".tern-project", ".watchmanconfig", ".babelrc", ".jscsrc", ".jshintrc", ".jslintrc", ".swcrc"], tmScope: "source.json", aliases: ["geojson", "jsonl", "sarif", "topojson"], codemirrorMode: "javascript", codemirrorMimeType: "application/json", parsers: ["json"], vscodeLanguageIds: ["json"], linguistLanguageId: 174 }, { name: "JSON with Comments", type: "data", aceMode: "javascript", extensions: [".jsonc", ".code-snippets", ".code-workspace", ".sublime-build", ".sublime-color-scheme", ".sublime-commands", ".sublime-completions", ".sublime-keymap", ".sublime-macro", ".sublime-menu", ".sublime-mousemap", ".sublime-project", ".sublime-settings", ".sublime-theme", ".sublime-workspace", ".sublime_metrics", ".sublime_session"], filenames: [], tmScope: "source.json.comments", aliases: ["jsonc"], codemirrorMode: "javascript", codemirrorMimeType: "text/javascript", group: "JSON", parsers: ["jsonc"], vscodeLanguageIds: ["jsonc"], linguistLanguageId: 423 }, { name: "JSON5", type: "data", aceMode: "json5", extensions: [".json5"], tmScope: "source.js", codemirrorMode: "javascript", codemirrorMimeType: "application/json", parsers: ["json5"], vscodeLanguageIds: ["json5"], linguistLanguageId: 175 }]; + var Vs = {}; + vn(Vs, { getVisitorKeys: () => da, massageAstNode: () => Aa, print: () => CD }); + var ar = [[]], Fa = { JsonRoot: ["node"], ArrayExpression: ["elements"], ObjectExpression: ["properties"], ObjectProperty: ["key", "value"], UnaryExpression: ["argument"], NullLiteral: ar[0], BooleanLiteral: ar[0], StringLiteral: ar[0], NumericLiteral: ar[0], Identifier: ar[0], TemplateLiteral: ["quasis"], TemplateElement: ar[0] }; + var dD = _r(Fa), da = dD; + function CD(e, t2, r) { + let { node: n } = e; + switch (n.type) { + case "JsonRoot": + return [r("node"), E]; + case "ArrayExpression": { + if (n.elements.length === 0) return "[]"; + let s = e.map(() => e.node === null ? "null" : r(), "elements"); + return ["[", m([E, L([",", E], s)]), E, "]"]; } - return result2; - } - function head(array) { - return array && array.length ? array[0] : undefined2; + case "ObjectExpression": + return n.properties.length === 0 ? "{}" : ["{", m([E, L([",", E], e.map(r, "properties"))]), E, "}"]; + case "ObjectProperty": + return [r("key"), ": ", r("value")]; + case "UnaryExpression": + return [n.operator === "+" ? "" : n.operator, r("argument")]; + case "NullLiteral": + return "null"; + case "BooleanLiteral": + return n.value ? "true" : "false"; + case "StringLiteral": + return JSON.stringify(n.value); + case "NumericLiteral": + return Ca(e) ? JSON.stringify(String(n.value)) : JSON.stringify(n.value); + case "Identifier": + return Ca(e) ? JSON.stringify(n.name) : n.name; + case "TemplateLiteral": + return r(["quasis", 0]); + case "TemplateElement": + return JSON.stringify(n.value.cooked); + default: + throw new Qe(n, "JSON"); } - function indexOf2(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); + } + function Ca(e) { + return e.key === "key" && e.parent.type === "ObjectProperty"; + } + var AD = /* @__PURE__ */ new Set(["start", "end", "extra", "loc", "comments", "leadingComments", "trailingComments", "innerComments", "errors", "range", "tokens"]); + function Aa(e, t2) { + let { type: r } = e; + if (r === "ObjectProperty") { + let { key: n } = e; + n.type === "Identifier" ? t2.key = { type: "StringLiteral", value: n.name } : n.type === "NumericLiteral" && (t2.key = { type: "StringLiteral", value: String(n.value) }); + return; } - function initial(array) { - var length = array == null ? 0 : array.length; - return length ? baseSlice(array, 0, -1) : []; + if (r === "UnaryExpression" && e.operator === "+") return t2.argument; + if (r === "ArrayExpression") { + for (let [n, s] of e.elements.entries()) s === null && t2.elements.splice(n, 0, { type: "NullLiteral" }); + return; } - var intersection = baseRest(function(arrays) { - var mapped = arrayMap(arrays, castArrayLikeObject); - return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : []; - }); - var intersectionBy = baseRest(function(arrays) { - var iteratee2 = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); - if (iteratee2 === last(mapped)) { - iteratee2 = undefined2; - } else { - mapped.pop(); - } - return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : []; - }); - var intersectionWith = baseRest(function(arrays) { - var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); - comparator = typeof comparator == "function" ? comparator : undefined2; - if (comparator) { - mapped.pop(); + if (r === "TemplateLiteral") return { type: "StringLiteral", value: e.quasis[0].value.cooked }; + } + Aa.ignoredProperties = AD; + var pr = { bracketSpacing: { category: "Common", type: "boolean", default: true, description: "Print spaces between brackets.", oppositeDescription: "Do not print spaces between brackets." }, objectWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap object literals.", choices: [{ value: "preserve", description: "Keep as multi-line, if there is a newline between the opening brace and first property." }, { value: "collapse", description: "Fit to a single line when possible." }] }, singleQuote: { category: "Common", type: "boolean", default: false, description: "Use single quotes instead of double quotes." }, proseWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap prose.", choices: [{ value: "always", description: "Wrap prose if it exceeds the print width." }, { value: "never", description: "Do not wrap prose." }, { value: "preserve", description: "Wrap prose as-is." }] }, bracketSameLine: { category: "Common", type: "boolean", default: false, description: "Put > of opening tags on the last line instead of on a new line." }, singleAttributePerLine: { category: "Common", type: "boolean", default: false, description: "Enforce single attribute per line in HTML, Vue and JSX." } }; + var St = "JavaScript", TD = { arrowParens: { category: St, type: "choice", default: "always", description: "Include parentheses around a sole arrow function parameter.", choices: [{ value: "always", description: "Always include parens. Example: `(x) => x`" }, { value: "avoid", description: "Omit parens when possible. Example: `x => x`" }] }, bracketSameLine: pr.bracketSameLine, objectWrap: pr.objectWrap, bracketSpacing: pr.bracketSpacing, jsxBracketSameLine: { category: St, type: "boolean", description: "Put > on the last line instead of at a new line.", deprecated: "2.4.0" }, semi: { category: St, type: "boolean", default: true, description: "Print semicolons.", oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them." }, experimentalOperatorPosition: { category: St, type: "choice", default: "end", description: "Where to print operators when binary expressions wrap lines.", choices: [{ value: "start", description: "Print operators at the start of new lines." }, { value: "end", description: "Print operators at the end of previous lines." }] }, experimentalTernaries: { category: St, type: "boolean", default: false, description: "Use curious ternaries, with the question mark after the condition.", oppositeDescription: "Default behavior of ternaries; keep question marks on the same line as the consequent." }, singleQuote: pr.singleQuote, jsxSingleQuote: { category: St, type: "boolean", default: false, description: "Use single quotes in JSX." }, quoteProps: { category: St, type: "choice", default: "as-needed", description: "Change when properties in objects are quoted.", choices: [{ value: "as-needed", description: "Only add quotes around object properties where required." }, { value: "consistent", description: "If at least one property in an object requires quotes, quote all properties." }, { value: "preserve", description: "Respect the input use of quotes in object properties." }] }, trailingComma: { category: St, type: "choice", default: "all", description: "Print trailing commas wherever possible when multi-line.", choices: [{ value: "all", description: "Trailing commas wherever possible (including function arguments)." }, { value: "es5", description: "Trailing commas where valid in ES5 (objects, arrays, etc.)" }, { value: "none", description: "No trailing commas." }] }, singleAttributePerLine: pr.singleAttributePerLine }, Ta = TD; + var xD = { estree: Xs, "estree-json": Vs }, gD = [...zs, ...Ea]; + return Ia(hD); + }); + } +}); + +// ../../node_modules/prettier/standalone.js +var require_standalone = __commonJS({ + "../../node_modules/prettier/standalone.js"(exports, module) { + (function(t2) { + function e() { + var o = t2(); + return o.default || o; + } + if (typeof exports == "object" && typeof module == "object") module.exports = e(); + else if (typeof define == "function" && define.amd) define(e); + else { + var f2 = typeof globalThis < "u" ? globalThis : typeof global < "u" ? global : typeof self < "u" ? self : this || {}; + f2.prettier = e(); + } + })(function() { + "use strict"; + var _a2, _Qt_instances, t_fn, e_fn, _b, _c, _d, _e2; + var Zn = Object.create; + var Je = Object.defineProperty; + var eo = Object.getOwnPropertyDescriptor; + var to = Object.getOwnPropertyNames; + var uo = Object.getPrototypeOf, ro = Object.prototype.hasOwnProperty; + var no = (e, t2) => () => (t2 || e((t2 = { exports: {} }).exports, t2), t2.exports), Yt = (e, t2) => { + for (var u in t2) Je(e, u, { get: t2[u], enumerable: true }); + }, ku = (e, t2, u, r) => { + if (t2 && typeof t2 == "object" || typeof t2 == "function") for (let o of to(t2)) !ro.call(e, o) && o !== u && Je(e, o, { get: () => t2[o], enumerable: !(r = eo(t2, o)) || r.enumerable }); + return e; + }; + var oo = (e, t2, u) => (u = e != null ? Zn(uo(e)) : {}, ku(t2 || !e || !e.__esModule ? Je(u, "default", { value: e, enumerable: true }) : u, e)), ao = (e) => ku(Je({}, "__esModule", { value: true }), e); + var pn = no((af, dn) => { + var bt, At, _t, xt, Bt, $e, bu, Ke, Tt, fn, Nt, Ve, St, wt, Ot, pe, ln, Pt, It, Aa; + St = /\/(?![*\/])(?:\[(?:[^\]\\\n\r\u2028\u2029]+|\\.)*\]|[^\/\\\n\r\u2028\u2029]+|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/yu; + Ve = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y; + bt = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]+|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/yu; + Ot = /(['"])(?:[^'"\\\n\r]+|(?!\1)['"]|\\(?:\r\n|[^]))*(\1)?/y; + Nt = /(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y; + pe = /[`}](?:[^`\\$]+|\\[^]|\$(?!\{))*(`|\$\{)?/y; + It = /[\t\v\f\ufeff\p{Zs}]+/yu; + Ke = /\r?\n|[\r\u2028\u2029]/y; + Tt = /\/\*(?:[^*]+|\*(?!\/))*(\*\/)?/y; + wt = /\/\/.*/y; + _t = /[<>.:={}]|\/(?![\/*])/y; + At = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/yu; + xt = /(['"])(?:[^'"]+|(?!\1)['"])*(\1)?/y; + Bt = /[^<>{}]+/y; + Pt = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/; + ln = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/; + $e = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/; + bu = /^(?:return|throw|yield)$/; + fn = RegExp(Ke.source); + dn.exports = Aa = function* (e, { jsx: t2 = false } = {}) { + var u, r, o, n, a2, s, i, D, f2, l, d, c, p, F; + for ({ length: s } = e, n = 0, a2 = "", F = [{ tag: "JS" }], u = [], d = 0, c = false; n < s; ) { + switch (D = F[F.length - 1], D.tag) { + case "JS": + case "JSNonExpressionParen": + case "InterpolationInTemplate": + case "InterpolationInJSX": + if (e[n] === "/" && (Pt.test(a2) || $e.test(a2)) && (St.lastIndex = n, i = St.exec(e))) { + n = St.lastIndex, a2 = i[0], c = true, yield { type: "RegularExpressionLiteral", value: i[0], closed: i[1] !== void 0 && i[1] !== "\\" }; + continue; + } + if (Ve.lastIndex = n, i = Ve.exec(e)) { + switch (p = i[0], f2 = Ve.lastIndex, l = p, p) { + case "(": + a2 === "?NonExpressionParenKeyword" && F.push({ tag: "JSNonExpressionParen", nesting: d }), d++, c = false; + break; + case ")": + d--, c = true, D.tag === "JSNonExpressionParen" && d === D.nesting && (F.pop(), l = "?NonExpressionParenEnd", c = false); + break; + case "{": + Ve.lastIndex = 0, o = !ln.test(a2) && (Pt.test(a2) || $e.test(a2)), u.push(o), c = false; + break; + case "}": + switch (D.tag) { + case "InterpolationInTemplate": + if (u.length === D.nesting) { + pe.lastIndex = n, i = pe.exec(e), n = pe.lastIndex, a2 = i[0], i[1] === "${" ? (a2 = "?InterpolationInTemplate", c = false, yield { type: "TemplateMiddle", value: i[0] }) : (F.pop(), c = true, yield { type: "TemplateTail", value: i[0], closed: i[1] === "`" }); + continue; + } + break; + case "InterpolationInJSX": + if (u.length === D.nesting) { + F.pop(), n += 1, a2 = "}", yield { type: "JSXPunctuator", value: "}" }; + continue; + } + } + c = u.pop(), l = c ? "?ExpressionBraceEnd" : "}"; + break; + case "]": + c = true; + break; + case "++": + case "--": + l = c ? "?PostfixIncDec" : "?UnaryIncDec"; + break; + case "<": + if (t2 && (Pt.test(a2) || $e.test(a2))) { + F.push({ tag: "JSXTag" }), n += 1, a2 = "<", yield { type: "JSXPunctuator", value: p }; + continue; + } + c = false; + break; + default: + c = false; + } + n = f2, a2 = l, yield { type: "Punctuator", value: p }; + continue; + } + if (bt.lastIndex = n, i = bt.exec(e)) { + switch (n = bt.lastIndex, l = i[0], i[0]) { + case "for": + case "if": + case "while": + case "with": + a2 !== "." && a2 !== "?." && (l = "?NonExpressionParenKeyword"); + } + a2 = l, c = !$e.test(i[0]), yield { type: i[1] === "#" ? "PrivateIdentifier" : "IdentifierName", value: i[0] }; + continue; + } + if (Ot.lastIndex = n, i = Ot.exec(e)) { + n = Ot.lastIndex, a2 = i[0], c = true, yield { type: "StringLiteral", value: i[0], closed: i[2] !== void 0 }; + continue; + } + if (Nt.lastIndex = n, i = Nt.exec(e)) { + n = Nt.lastIndex, a2 = i[0], c = true, yield { type: "NumericLiteral", value: i[0] }; + continue; + } + if (pe.lastIndex = n, i = pe.exec(e)) { + n = pe.lastIndex, a2 = i[0], i[1] === "${" ? (a2 = "?InterpolationInTemplate", F.push({ tag: "InterpolationInTemplate", nesting: u.length }), c = false, yield { type: "TemplateHead", value: i[0] }) : (c = true, yield { type: "NoSubstitutionTemplate", value: i[0], closed: i[1] === "`" }); + continue; + } + break; + case "JSXTag": + case "JSXTagEnd": + if (_t.lastIndex = n, i = _t.exec(e)) { + switch (n = _t.lastIndex, l = i[0], i[0]) { + case "<": + F.push({ tag: "JSXTag" }); + break; + case ">": + F.pop(), a2 === "/" || D.tag === "JSXTagEnd" ? (l = "?JSX", c = true) : F.push({ tag: "JSXChildren" }); + break; + case "{": + F.push({ tag: "InterpolationInJSX", nesting: u.length }), l = "?InterpolationInJSX", c = false; + break; + case "/": + a2 === "<" && (F.pop(), F[F.length - 1].tag === "JSXChildren" && F.pop(), F.push({ tag: "JSXTagEnd" })); + } + a2 = l, yield { type: "JSXPunctuator", value: i[0] }; + continue; + } + if (At.lastIndex = n, i = At.exec(e)) { + n = At.lastIndex, a2 = i[0], yield { type: "JSXIdentifier", value: i[0] }; + continue; + } + if (xt.lastIndex = n, i = xt.exec(e)) { + n = xt.lastIndex, a2 = i[0], yield { type: "JSXString", value: i[0], closed: i[2] !== void 0 }; + continue; + } + break; + case "JSXChildren": + if (Bt.lastIndex = n, i = Bt.exec(e)) { + n = Bt.lastIndex, a2 = i[0], yield { type: "JSXText", value: i[0] }; + continue; + } + switch (e[n]) { + case "<": + F.push({ tag: "JSXTag" }), n++, a2 = "<", yield { type: "JSXPunctuator", value: "<" }; + continue; + case "{": + F.push({ tag: "InterpolationInJSX", nesting: u.length }), n++, a2 = "?InterpolationInJSX", c = false, yield { type: "JSXPunctuator", value: "{" }; + continue; + } + } + if (It.lastIndex = n, i = It.exec(e)) { + n = It.lastIndex, yield { type: "WhiteSpace", value: i[0] }; + continue; + } + if (Ke.lastIndex = n, i = Ke.exec(e)) { + n = Ke.lastIndex, c = false, bu.test(a2) && (a2 = "?NoLineTerminatorHere"), yield { type: "LineTerminatorSequence", value: i[0] }; + continue; + } + if (Tt.lastIndex = n, i = Tt.exec(e)) { + n = Tt.lastIndex, fn.test(i[0]) && (c = false, bu.test(a2) && (a2 = "?NoLineTerminatorHere")), yield { type: "MultiLineComment", value: i[0], closed: i[1] !== void 0 }; + continue; + } + if (wt.lastIndex = n, i = wt.exec(e)) { + n = wt.lastIndex, c = false, yield { type: "SingleLineComment", value: i[0] }; + continue; + } + r = String.fromCodePoint(e.codePointAt(n)), n += r.length, a2 = r, c = false, yield { type: D.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid", value: r }; } - return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : []; - }); - function join(array, separator) { - return array == null ? "" : nativeJoin.call(array, separator); - } - function last(array) { - var length = array == null ? 0 : array.length; - return length ? array[length - 1] : undefined2; + }; + }); + var di = {}; + Yt(di, { __debug: () => li, check: () => ci, doc: () => wu, format: () => Hn, formatWithCursor: () => Jn, getSupportInfo: () => fi, util: () => Pu, version: () => Yn }); + var X = (e, t2) => (u, r, ...o) => { + var _a3; + return u | 1 && r == null ? void 0 : ((_a3 = t2.call(r)) != null ? _a3 : r[e]).apply(r, o); + }; + var io = (_a2 = String.prototype.replaceAll) != null ? _a2 : function(e, t2) { + return e.global ? this.replace(e, t2) : this.split(e).join(t2); + }, so = X("replaceAll", function() { + if (typeof this == "string") return io; + }), oe = so; + var Ne = class { + diff(t2, u, r = {}) { + let o; + typeof r == "function" ? (o = r, r = {}) : "callback" in r && (o = r.callback); + let n = this.castInput(t2, r), a2 = this.castInput(u, r), s = this.removeEmpty(this.tokenize(n, r)), i = this.removeEmpty(this.tokenize(a2, r)); + return this.diffWithOptionsObj(s, i, r, o); + } + diffWithOptionsObj(t2, u, r, o) { + var n; + let a2 = (m) => { + if (m = this.postProcess(m, r), o) { + setTimeout(function() { + o(m); + }, 0); + return; + } else return m; + }, s = u.length, i = t2.length, D = 1, f2 = s + i; + r.maxEditLength != null && (f2 = Math.min(f2, r.maxEditLength)); + let l = (n = r.timeout) !== null && n !== void 0 ? n : 1 / 0, d = Date.now() + l, c = [{ oldPos: -1, lastComponent: void 0 }], p = this.extractCommon(c[0], u, t2, 0, r); + if (c[0].oldPos + 1 >= i && p + 1 >= s) return a2(this.buildValues(c[0].lastComponent, u, t2)); + let F = -1 / 0, C = 1 / 0, y = () => { + for (let m = Math.max(F, -D); m <= Math.min(C, D); m += 2) { + let h, E = c[m - 1], g = c[m + 1]; + E && (c[m - 1] = void 0); + let A2 = false; + if (g) { + let Q = g.oldPos - m; + A2 = g && 0 <= Q && Q < s; + } + let J = E && E.oldPos + 1 < i; + if (!A2 && !J) { + c[m] = void 0; + continue; + } + if (!J || A2 && E.oldPos < g.oldPos ? h = this.addToPath(g, true, false, 0, r) : h = this.addToPath(E, false, true, 1, r), p = this.extractCommon(h, u, t2, m, r), h.oldPos + 1 >= i && p + 1 >= s) return a2(this.buildValues(h.lastComponent, u, t2)) || true; + c[m] = h, h.oldPos + 1 >= i && (C = Math.min(C, m - 1)), p + 1 >= s && (F = Math.max(F, m + 1)); + } + D++; + }; + if (o) (function m() { + setTimeout(function() { + if (D > f2 || Date.now() > d) return o(void 0); + y() || m(); + }, 0); + })(); + else for (; D <= f2 && Date.now() <= d; ) { + let m = y(); + if (m) return m; + } + } + addToPath(t2, u, r, o, n) { + let a2 = t2.lastComponent; + return a2 && !n.oneChangePerToken && a2.added === u && a2.removed === r ? { oldPos: t2.oldPos + o, lastComponent: { count: a2.count + 1, added: u, removed: r, previousComponent: a2.previousComponent } } : { oldPos: t2.oldPos + o, lastComponent: { count: 1, added: u, removed: r, previousComponent: a2 } }; + } + extractCommon(t2, u, r, o, n) { + let a2 = u.length, s = r.length, i = t2.oldPos, D = i - o, f2 = 0; + for (; D + 1 < a2 && i + 1 < s && this.equals(r[i + 1], u[D + 1], n); ) D++, i++, f2++, n.oneChangePerToken && (t2.lastComponent = { count: 1, previousComponent: t2.lastComponent, added: false, removed: false }); + return f2 && !n.oneChangePerToken && (t2.lastComponent = { count: f2, previousComponent: t2.lastComponent, added: false, removed: false }), t2.oldPos = i, D; + } + equals(t2, u, r) { + return r.comparator ? r.comparator(t2, u) : t2 === u || !!r.ignoreCase && t2.toLowerCase() === u.toLowerCase(); + } + removeEmpty(t2) { + let u = []; + for (let r = 0; r < t2.length; r++) t2[r] && u.push(t2[r]); + return u; } - function lastIndexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = length; - if (fromIndex !== undefined2) { - 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); + castInput(t2, u) { + return t2; } - function nth(array, n) { - return array && array.length ? baseNth(array, toInteger(n)) : undefined2; + tokenize(t2, u) { + return Array.from(t2); } - var pull = baseRest(pullAll); - function pullAll(array, values2) { - return array && array.length && values2 && values2.length ? basePullAll(array, values2) : array; + join(t2) { + return t2.join(""); } - function pullAllBy(array, values2, iteratee2) { - return array && array.length && values2 && values2.length ? basePullAll(array, values2, getIteratee(iteratee2, 2)) : array; + postProcess(t2, u) { + return t2; } - function pullAllWith(array, values2, comparator) { - return array && array.length && values2 && values2.length ? basePullAll(array, values2, undefined2, comparator) : array; + get useLongestToken() { + return false; } - var pullAt = flatRest(function(array, indexes) { - var length = array == null ? 0 : array.length, result2 = baseAt(array, indexes); - basePullAt(array, arrayMap(indexes, function(index) { - return isIndex(index, length) ? +index : index; - }).sort(compareAscending)); - return result2; - }); - function remove(array, predicate) { - var result2 = []; - if (!(array && array.length)) { - return result2; - } - var index = -1, indexes = [], length = array.length; - predicate = getIteratee(predicate, 3); - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result2.push(value); - indexes.push(index); + buildValues(t2, u, r) { + let o = [], n; + for (; t2; ) o.push(t2), n = t2.previousComponent, delete t2.previousComponent, t2 = n; + o.reverse(); + let a2 = o.length, s = 0, i = 0, D = 0; + for (; s < a2; s++) { + let f2 = o[s]; + if (f2.removed) f2.value = this.join(r.slice(D, D + f2.count)), D += f2.count; + else { + if (!f2.added && this.useLongestToken) { + let l = u.slice(i, i + f2.count); + l = l.map(function(d, c) { + let p = r[D + c]; + return p.length > d.length ? p : d; + }), f2.value = this.join(l); + } else f2.value = this.join(u.slice(i, i + f2.count)); + i += f2.count, f2.added || (D += f2.count); } } - basePullAt(array, indexes); - return result2; + return o; } - function reverse(array) { - return array == null ? array : nativeReverse.call(array); + }; + var jt = class extends Ne { + tokenize(t2) { + return t2.slice(); } - 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 === undefined2 ? length : toInteger(end); - } - return baseSlice(array, start, end); + join(t2) { + return t2; } - function sortedIndex(array, value) { - return baseSortedIndex(array, value); + removeEmpty(t2) { + return t2; } - function sortedIndexBy(array, value, iteratee2) { - return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2)); + }, vu = new jt(); + function Ut(e, t2, u) { + return vu.diff(e, t2, u); + } + var Do = () => { + }, P = Do; + var Lu = "cr", Mu = "crlf", co = "lf", fo = co, Wt = "\r", Yu = `\r +`, He = ` +`, lo = He; + function ju(e) { + let t2 = e.indexOf(Wt); + return t2 !== -1 ? e.charAt(t2 + 1) === He ? Mu : Lu : fo; + } + function Se(e) { + return e === Lu ? Wt : e === Mu ? Yu : lo; + } + var po = /* @__PURE__ */ new Map([[He, /\n/gu], [Wt, /\r/gu], [Yu, /\r\n/gu]]); + function $t(e, t2) { + var _a3, _b2; + let u = po.get(t2); + return (_b2 = (_a3 = e.match(u)) == null ? void 0 : _a3.length) != null ? _b2 : 0; + } + var Fo = /\r\n?/gu; + function Uu(e) { + return oe(0, e, Fo, He); + } + function mo(e) { + return this[e < 0 ? this.length + e : e]; + } + var Eo = X("at", function() { + if (Array.isArray(this) || typeof this == "string") return mo; + }), b = Eo; + var G = "string", j = "array", U = "cursor", I = "indent", k = "align", v = "trim", x = "group", w = "fill", B = "if-break", R = "indent-if-break", L = "line-suffix", M = "line-suffix-boundary", _ = "line", O = "label", T = "break-parent", Xe = /* @__PURE__ */ new Set([U, I, k, v, x, w, B, R, L, M, _, O, T]); + function Wu(e) { + let t2 = e.length; + for (; t2 > 0 && (e[t2 - 1] === "\r" || e[t2 - 1] === ` +`); ) t2--; + return t2 < e.length ? e.slice(0, t2) : e; + } + function Co(e) { + if (typeof e == "string") return G; + if (Array.isArray(e)) return j; + if (!e) return; + let { type: t2 } = e; + if (Xe.has(t2)) return t2; + } + var H = Co; + var ho = (e) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(e); + function go(e) { + let t2 = e === null ? "null" : typeof e; + if (t2 !== "string" && t2 !== "object") return `Unexpected doc '${t2}', +Expected it to be 'string' or 'object'.`; + if (H(e)) throw new Error("doc is valid."); + let u = Object.prototype.toString.call(e); + if (u !== "[object Object]") return `Unexpected doc '${u}'.`; + let r = ho([...Xe].map((o) => `'${o}'`)); + return `Unexpected doc.type '${e.type}'. +Expected it to be ${r}.`; + } + var Vt = class extends Error { + constructor(t2) { + super(go(t2)); + __publicField(this, "name", "InvalidDocError"); + this.doc = t2; } - 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; - } + }, Z = Vt; + var $u = {}; + function yo(e, t2, u, r) { + let o = [e]; + for (; o.length > 0; ) { + let n = o.pop(); + if (n === $u) { + u(o.pop()); + continue; } - return -1; - } - function sortedLastIndex(array, value) { - return baseSortedIndex(array, value, true); - } - function sortedLastIndexBy(array, value, iteratee2) { - return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2), true); - } - 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; + u && o.push(n, $u); + let a2 = H(n); + if (!a2) throw new Z(n); + if ((t2 == null ? void 0 : t2(n)) !== false) switch (a2) { + case j: + case w: { + let s = a2 === j ? n : n.parts; + for (let i = s.length, D = i - 1; D >= 0; --D) o.push(s[D]); + break; } + case B: + o.push(n.flatContents, n.breakContents); + break; + case x: + if (r && n.expandedStates) for (let s = n.expandedStates.length, i = s - 1; i >= 0; --i) o.push(n.expandedStates[i]); + else o.push(n.contents); + break; + case k: + case I: + case R: + case O: + case L: + o.push(n.contents); + break; + case G: + case U: + case v: + case M: + case _: + case T: + break; + default: + throw new Z(n); } - return -1; - } - function sortedUniq(array) { - return array && array.length ? baseSortedUniq(array) : []; - } - function sortedUniqBy(array, iteratee2) { - return array && array.length ? baseSortedUniq(array, getIteratee(iteratee2, 2)) : []; - } - function tail(array) { - var length = array == null ? 0 : array.length; - return length ? baseSlice(array, 1, length) : []; - } - function take(array, n, guard) { - if (!(array && array.length)) { - return []; - } - n = guard || n === undefined2 ? 1 : toInteger(n); - return baseSlice(array, 0, n < 0 ? 0 : n); } - function takeRight(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; + } + var we = yo; + function Pe(e, t2) { + if (typeof e == "string") return t2(e); + let u = /* @__PURE__ */ new Map(); + return r(e); + function r(n) { + if (u.has(n)) return u.get(n); + let a2 = o(n); + return u.set(n, a2), a2; + } + function o(n) { + switch (H(n)) { + case j: + return t2(n.map(r)); + case w: + return t2({ ...n, parts: n.parts.map(r) }); + case B: + return t2({ ...n, breakContents: r(n.breakContents), flatContents: r(n.flatContents) }); + case x: { + let { expandedStates: a2, contents: s } = n; + return a2 ? (a2 = a2.map(r), s = a2[0]) : s = r(s), t2({ ...n, contents: s, expandedStates: a2 }); + } + case k: + case I: + case R: + case O: + case L: + return t2({ ...n, contents: r(n.contents) }); + case G: + case U: + case v: + case M: + case _: + case T: + return t2(n); + default: + throw new Z(n); } - n = guard || n === undefined2 ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, n < 0 ? 0 : n, length); } - function takeRightWhile(array, predicate) { - return array && array.length ? baseWhile(array, getIteratee(predicate, 3), false, true) : []; + } + function qe(e, t2, u) { + let r = u, o = false; + function n(a2) { + if (o) return false; + let s = t2(a2); + s !== void 0 && (o = true, r = s); } - function takeWhile(array, predicate) { - return array && array.length ? baseWhile(array, getIteratee(predicate, 3)) : []; + return we(e, n), r; + } + function bo(e) { + if (e.type === x && e.break || e.type === _ && e.hard || e.type === T) return true; + } + function Gu(e) { + return qe(e, bo, false); + } + function Vu(e) { + if (e.length > 0) { + let t2 = b(0, e, -1); + !t2.expandedStates && !t2.break && (t2.break = "propagated"); } - var union = baseRest(function(arrays) { - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); - }); - var unionBy = baseRest(function(arrays) { - var iteratee2 = last(arrays); - if (isArrayLikeObject(iteratee2)) { - iteratee2 = undefined2; + return null; + } + function zu(e) { + let t2 = /* @__PURE__ */ new Set(), u = []; + function r(n) { + if (n.type === T && Vu(u), n.type === x) { + if (u.push(n), t2.has(n)) return false; + t2.add(n); } - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)); - }); - var unionWith = baseRest(function(arrays) { - var comparator = last(arrays); - comparator = typeof comparator == "function" ? comparator : undefined2; - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator); - }); - function uniq(array) { - return array && array.length ? baseUniq(array) : []; - } - function uniqBy(array, iteratee2) { - return array && array.length ? baseUniq(array, getIteratee(iteratee2, 2)) : []; } - function uniqWith(array, comparator) { - comparator = typeof comparator == "function" ? comparator : undefined2; - return array && array.length ? baseUniq(array, undefined2, comparator) : []; + function o(n) { + n.type === x && u.pop().break && Vu(u); } - 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)); - }); - } - function unzipWith(array, iteratee2) { - if (!(array && array.length)) { - return []; - } - var result2 = unzip(array); - if (iteratee2 == null) { - return result2; - } - return arrayMap(result2, function(group) { - return apply(iteratee2, undefined2, group); - }); + we(e, r, o, true); + } + function Ao(e) { + return e.type === _ && !e.hard ? e.soft ? "" : " " : e.type === B ? e.flatContents : e; + } + function Ju(e) { + return Pe(e, Ao); + } + function Ku(e) { + for (e = [...e]; e.length >= 2 && b(0, e, -2).type === _ && b(0, e, -1).type === T; ) e.length -= 2; + if (e.length > 0) { + let t2 = Oe(b(0, e, -1)); + e[e.length - 1] = t2; } - var without = baseRest(function(array, values2) { - return isArrayLikeObject(array) ? baseDifference(array, values2) : []; - }); - var xor = baseRest(function(arrays) { - return baseXor(arrayFilter(arrays, isArrayLikeObject)); - }); - var xorBy = baseRest(function(arrays) { - var iteratee2 = last(arrays); - if (isArrayLikeObject(iteratee2)) { - iteratee2 = undefined2; + return e; + } + function Oe(e) { + switch (H(e)) { + case I: + case R: + case x: + case L: + case O: { + let t2 = Oe(e.contents); + return { ...e, contents: t2 }; } - return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2)); - }); - var xorWith = baseRest(function(arrays) { - var comparator = last(arrays); - comparator = typeof comparator == "function" ? comparator : undefined2; - return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator); - }); - var zip = baseRest(unzip); - function zipObject(props, values2) { - return baseZipObject(props || [], values2 || [], assignValue); - } - function zipObjectDeep(props, values2) { - return baseZipObject(props || [], values2 || [], baseSet); - } - var zipWith = baseRest(function(arrays) { - var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2; - iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2; - return unzipWith(arrays, iteratee2); - }); - function chain(value) { - var result2 = lodash(value); - result2.__chain__ = true; - return result2; - } - function tap(value, interceptor) { - interceptor(value); - return value; - } - function thru(value, interceptor) { - return interceptor(value); + case B: + return { ...e, breakContents: Oe(e.breakContents), flatContents: Oe(e.flatContents) }; + case w: + return { ...e, parts: Ku(e.parts) }; + case j: + return Ku(e); + case G: + return Wu(e); + case k: + case U: + case v: + case M: + case _: + case T: + break; + default: + throw new Z(e); } - 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": undefined2 - }); - return new LodashWrapper(value, this.__chain__).thru(function(array) { - if (length && !array.length) { - array.push(undefined2); + return e; + } + function Qe(e) { + return Oe(xo(e)); + } + function _o(e) { + switch (H(e)) { + case w: + if (e.parts.every((t2) => t2 === "")) return ""; + break; + case x: + if (!e.contents && !e.id && !e.break && !e.expandedStates) return ""; + if (e.contents.type === x && e.contents.id === e.id && e.contents.break === e.break && e.contents.expandedStates === e.expandedStates) return e.contents; + break; + case k: + case I: + case R: + case L: + if (!e.contents) return ""; + break; + case B: + if (!e.flatContents && !e.breakContents) return ""; + break; + case j: { + let t2 = []; + for (let u of e) { + if (!u) continue; + let [r, ...o] = Array.isArray(u) ? u : [u]; + typeof r == "string" && typeof b(0, t2, -1) == "string" ? t2[t2.length - 1] += r : t2.push(r), t2.push(...o); } - return array; - }); - }); - function wrapperChain() { - return chain(this); - } - function wrapperCommit() { - return new LodashWrapper(this.value(), this.__chain__); - } - function wrapperNext() { - if (this.__values__ === undefined2) { - this.__values__ = toArray(this.value()); + return t2.length === 0 ? "" : t2.length === 1 ? t2[0] : t2; } - var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++]; - return { "done": done, "value": value }; - } - function wrapperToIterator() { - return this; + case G: + case U: + case v: + case M: + case _: + case O: + case T: + break; + default: + throw new Z(e); } - function wrapperPlant(value) { - var result2, parent2 = this; - while (parent2 instanceof baseLodash) { - var clone2 = wrapperClone(parent2); - clone2.__index__ = 0; - clone2.__values__ = undefined2; - if (result2) { - previous.__wrapped__ = clone2; - } else { - result2 = clone2; - } - var previous = clone2; - parent2 = parent2.__wrapped__; - } - previous.__wrapped__ = value; - return result2; + return e; + } + function xo(e) { + return Pe(e, (t2) => _o(t2)); + } + function Hu(e, t2 = Ze) { + return Pe(e, (u) => typeof u == "string" ? Ie(t2, u.split(` +`)) : u); + } + function Bo(e) { + if (e.type === _) return true; + } + function Xu(e) { + return qe(e, Bo, false); + } + function Ee(e, t2) { + return e.type === O ? { ...e, contents: t2(e.contents) } : t2(e); + } + var N = P, et = P, qu = P, Qu = P; + function ae(e) { + return N(e), { type: I, contents: e }; + } + function De(e, t2) { + return Qu(e), N(t2), { type: k, contents: t2, n: e }; + } + function Zu(e) { + return De(Number.NEGATIVE_INFINITY, e); + } + function tt(e) { + return De({ type: "root" }, e); + } + function er(e) { + return De(-1, e); + } + function ut(e, t2, u) { + N(e); + let r = e; + if (t2 > 0) { + for (let o = 0; o < Math.floor(t2 / u); ++o) r = ae(r); + r = De(t2 % u, r), r = De(Number.NEGATIVE_INFINITY, r); } - 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": undefined2 - }); - return new LodashWrapper(wrapped, this.__chain__); + return r; + } + var ce = { type: T }; + var ee = { type: U }; + function tr(e) { + return qu(e), { type: w, parts: e }; + } + function Kt(e, t2 = {}) { + return N(e), et(t2.expandedStates, true), { type: x, id: t2.id, contents: e, break: !!t2.shouldBreak, expandedStates: t2.expandedStates }; + } + function ur(e, t2) { + return Kt(e[0], { ...t2, expandedStates: e }); + } + function rr(e, t2 = "", u = {}) { + return N(e), t2 !== "" && N(t2), { type: B, breakContents: e, flatContents: t2, groupId: u.groupId }; + } + function nr(e, t2) { + return N(e), { type: R, contents: e, groupId: t2.groupId, negate: t2.negate }; + } + function Ie(e, t2) { + N(e), et(t2); + let u = []; + for (let r = 0; r < t2.length; r++) r !== 0 && u.push(e), u.push(t2[r]); + return u; + } + function or(e, t2) { + return N(t2), e ? { type: O, label: e, contents: t2 } : t2; + } + var rt = { type: _ }, ar = { type: _, soft: true }, ke = { type: _, hard: true }, V = [ke, ce], Gt = { type: _, hard: true, literal: true }, Ze = [Gt, ce]; + function ve(e) { + return N(e), { type: L, contents: e }; + } + var ir = { type: M }; + var sr = { type: v }; + function te(e) { + var _a3; + if (!e) return ""; + if (Array.isArray(e)) { + let t2 = []; + for (let u of e) if (Array.isArray(u)) t2.push(...te(u)); + else { + let r = te(u); + r !== "" && t2.push(r); } - return this.thru(reverse); - } - function wrapperValue() { - return baseWrapperValue(this.__wrapped__, this.__actions__); + return t2; } - var countBy = createAggregator(function(result2, value, key) { - if (hasOwnProperty.call(result2, key)) { - ++result2[key]; - } else { - baseAssignValue(result2, key, 1); - } - }); - function every(collection, predicate, guard) { - var func = isArray(collection) ? arrayEvery : baseEvery; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined2; + return e.type === B ? { ...e, breakContents: te(e.breakContents), flatContents: te(e.flatContents) } : e.type === x ? { ...e, contents: te(e.contents), expandedStates: (_a3 = e.expandedStates) == null ? void 0 : _a3.map(te) } : e.type === w ? { type: "fill", parts: e.parts.map(te) } : e.contents ? { ...e, contents: te(e.contents) } : e; + } + function Dr(e) { + let t2 = /* @__PURE__ */ Object.create(null), u = /* @__PURE__ */ new Set(); + return r(te(e)); + function r(n, a2, s) { + var _a3, _b2; + if (typeof n == "string") return JSON.stringify(n); + if (Array.isArray(n)) { + let i = n.map(r).filter(Boolean); + return i.length === 1 ? i[0] : `[${i.join(", ")}]`; + } + if (n.type === _) { + let i = ((_a3 = s == null ? void 0 : s[a2 + 1]) == null ? void 0 : _a3.type) === T; + return n.literal ? i ? "literalline" : "literallineWithoutBreakParent" : n.hard ? i ? "hardline" : "hardlineWithoutBreakParent" : n.soft ? "softline" : "line"; + } + if (n.type === T) return ((_b2 = s == null ? void 0 : s[a2 - 1]) == null ? void 0 : _b2.type) === _ && s[a2 - 1].hard ? void 0 : "breakParent"; + if (n.type === v) return "trim"; + if (n.type === I) return "indent(" + r(n.contents) + ")"; + if (n.type === k) return n.n === Number.NEGATIVE_INFINITY ? "dedentToRoot(" + r(n.contents) + ")" : n.n < 0 ? "dedent(" + r(n.contents) + ")" : n.n.type === "root" ? "markAsRoot(" + r(n.contents) + ")" : "align(" + JSON.stringify(n.n) + ", " + r(n.contents) + ")"; + if (n.type === B) return "ifBreak(" + r(n.breakContents) + (n.flatContents ? ", " + r(n.flatContents) : "") + (n.groupId ? (n.flatContents ? "" : ', ""') + `, { groupId: ${o(n.groupId)} }` : "") + ")"; + if (n.type === R) { + let i = []; + n.negate && i.push("negate: true"), n.groupId && i.push(`groupId: ${o(n.groupId)}`); + let D = i.length > 0 ? `, { ${i.join(", ")} }` : ""; + return `indentIfBreak(${r(n.contents)}${D})`; + } + if (n.type === x) { + let i = []; + n.break && n.break !== "propagated" && i.push("shouldBreak: true"), n.id && i.push(`id: ${o(n.id)}`); + let D = i.length > 0 ? `, { ${i.join(", ")} }` : ""; + return n.expandedStates ? `conditionalGroup([${n.expandedStates.map((f2) => r(f2)).join(",")}]${D})` : `group(${r(n.contents)}${D})`; + } + if (n.type === w) return `fill([${n.parts.map((i) => r(i)).join(", ")}])`; + if (n.type === L) return "lineSuffix(" + r(n.contents) + ")"; + if (n.type === M) return "lineSuffixBoundary"; + if (n.type === O) return `label(${JSON.stringify(n.label)}, ${r(n.contents)})`; + if (n.type === U) return "cursor"; + throw new Error("Unknown doc type " + n.type); + } + function o(n) { + if (typeof n != "symbol") return JSON.stringify(String(n)); + if (n in t2) return t2[n]; + let a2 = n.description || "symbol"; + for (let s = 0; ; s++) { + let i = a2 + (s > 0 ? ` #${s}` : ""); + if (!u.has(i)) return u.add(i), t2[n] = `Symbol.for(${JSON.stringify(i)})`; } - return func(collection, getIteratee(predicate, 3)); - } - function filter(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - return func(collection, getIteratee(predicate, 3)); - } - var find = createFind(findIndex); - var findLast = createFind(findLastIndex); - function flatMap(collection, iteratee2) { - return baseFlatten(map2(collection, iteratee2), 1); - } - function flatMapDeep(collection, iteratee2) { - return baseFlatten(map2(collection, iteratee2), INFINITY); - } - function flatMapDepth(collection, iteratee2, depth) { - depth = depth === undefined2 ? 1 : toInteger(depth); - return baseFlatten(map2(collection, iteratee2), depth); - } - function forEach(collection, iteratee2) { - var func = isArray(collection) ? arrayEach : baseEach; - return func(collection, getIteratee(iteratee2, 3)); - } - function forEachRight(collection, iteratee2) { - var func = isArray(collection) ? arrayEachRight : baseEachRight; - return func(collection, getIteratee(iteratee2, 3)); } - var groupBy = createAggregator(function(result2, value, key) { - if (hasOwnProperty.call(result2, key)) { - result2[key].push(value); - } else { - baseAssignValue(result2, key, [value]); - } - }); - 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 isString3(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1; - } - var invokeMap = baseRest(function(collection, path5, args) { - var index = -1, isFunc = typeof path5 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : []; - baseEach(collection, function(value) { - result2[++index] = isFunc ? apply(path5, value, args) : baseInvoke(value, path5, args); - }); - return result2; - }); - var keyBy = createAggregator(function(result2, value, key) { - baseAssignValue(result2, key, value); - }); - function map2(collection, iteratee2) { - var func = isArray(collection) ? arrayMap : baseMap; - return func(collection, getIteratee(iteratee2, 3)); + } + var cr = () => /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g; + function zt(e) { + return e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510; + } + function Jt(e) { + return e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9776 && e <= 9783 || e >= 9800 && e <= 9811 || e === 9855 || e >= 9866 && e <= 9871 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12773 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e >= 94192 && e <= 94198 || e >= 94208 && e <= 101589 || e >= 101631 && e <= 101662 || e >= 101760 && e <= 101874 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e >= 119552 && e <= 119638 || e >= 119648 && e <= 119670 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128728 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129674 || e >= 129678 && e <= 129734 || e === 129736 || e >= 129741 && e <= 129756 || e >= 129759 && e <= 129770 || e >= 129775 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141; + } + var fr = "\xA9\xAE\u203C\u2049\u2122\u2139\u2194\u2195\u2196\u2197\u2198\u2199\u21A9\u21AA\u2328\u23CF\u23F1\u23F2\u23F8\u23F9\u23FA\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600\u2601\u2602\u2603\u2604\u260E\u2611\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638\u2639\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694\u2695\u2696\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F1\u26F7\u26F8\u26F9\u2702\u2708\u2709\u270C\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u2764\u27A1\u2934\u2935\u2B05\u2B06\u2B07"; + var To = /[^\x20-\x7F]/u, No = new Set(fr); + function So(e) { + if (!e) return 0; + if (!To.test(e)) return e.length; + e = e.replace(cr(), (u) => No.has(u) ? " " : " "); + let t2 = 0; + for (let u of e) { + let r = u.codePointAt(0); + r <= 31 || r >= 127 && r <= 159 || r >= 768 && r <= 879 || r >= 65024 && r <= 65039 || (t2 += zt(r) || Jt(r) ? 2 : 1); } - function orderBy(collection, iteratees, orders, guard) { - if (collection == null) { - return []; - } - if (!isArray(iteratees)) { - iteratees = iteratees == null ? [] : [iteratees]; + return t2; + } + var Re = So; + var wo = { type: 0 }, Oo = { type: 1 }, Ht = { value: "", length: 0, queue: [], get root() { + return Ht; + } }; + function lr(e, t2, u) { + let r = t2.type === 1 ? e.queue.slice(0, -1) : [...e.queue, t2], o = "", n = 0, a2 = 0, s = 0; + for (let p of r) switch (p.type) { + case 0: + f2(), u.useTabs ? i(1) : D(u.tabWidth); + break; + case 3: { + let { string: F } = p; + f2(), o += F, n += F.length; + break; } - orders = guard ? undefined2 : orders; - if (!isArray(orders)) { - orders = orders == null ? [] : [orders]; + case 2: { + let { width: F } = p; + a2 += 1, s += F; + break; } - return baseOrderBy(collection, iteratees, orders); - } - var partition = createAggregator(function(result2, value, key) { - result2[key ? 0 : 1].push(value); - }, function() { - return [[], []]; - }); - function reduce(collection, iteratee2, accumulator) { - var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3; - return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach); - } - function reduceRight(collection, iteratee2, accumulator) { - var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3; - return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight); - } - function reject(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - return func(collection, negate(getIteratee(predicate, 3))); + default: + throw new Error(`Unexpected indent comment '${p.type}'.`); } - function sample(collection) { - var func = isArray(collection) ? arraySample : baseSample; - return func(collection); + return d(), { ...e, value: o, length: n, queue: r }; + function i(p) { + o += " ".repeat(p), n += u.tabWidth * p; } - function sampleSize(collection, n, guard) { - if (guard ? isIterateeCall(collection, n, guard) : n === undefined2) { - n = 1; - } else { - n = toInteger(n); - } - var func = isArray(collection) ? arraySampleSize : baseSampleSize; - return func(collection, n); + function D(p) { + o += " ".repeat(p), n += p; } - function shuffle(collection) { - var func = isArray(collection) ? arrayShuffle : baseShuffle; - return func(collection); + function f2() { + u.useTabs ? l() : d(); } - function size(collection) { - if (collection == null) { - return 0; - } - if (isArrayLike(collection)) { - return isString3(collection) ? stringSize(collection) : collection.length; - } - var tag = getTag(collection); - if (tag == mapTag || tag == setTag) { - return collection.size; - } - return baseKeys(collection).length; + function l() { + a2 > 0 && i(a2), c(); } - function some(collection, predicate, guard) { - var func = isArray(collection) ? arraySome : baseSome; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined2; - } - return func(collection, getIteratee(predicate, 3)); + function d() { + s > 0 && D(s), c(); } - 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), []); - }); - var now = ctxNow || function() { - return root.Date.now(); - }; - function after(n, func) { - if (typeof func != "function") { - throw new TypeError2(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n < 1) { - return func.apply(this, arguments); - } - }; + function c() { + a2 = 0, s = 0; } - function ary(func, n, guard) { - n = guard ? undefined2 : n; - n = func && n == null ? func.length : n; - return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n); + } + function dr(e, t2, u) { + if (!t2) return e; + if (t2.type === "root") return { ...e, root: e }; + if (t2 === Number.NEGATIVE_INFINITY) return e.root; + let r; + return typeof t2 == "number" ? t2 < 0 ? r = Oo : r = { type: 2, width: t2 } : r = { type: 3, string: t2 }, lr(e, r, u); + } + function pr(e, t2) { + return lr(e, wo, t2); + } + function Po(e) { + let t2 = 0; + for (let u = e.length - 1; u >= 0; u--) { + let r = e[u]; + if (r === " " || r === " ") t2++; + else break; } - function before(n, func) { - var result2; - if (typeof func != "function") { - throw new TypeError2(FUNC_ERROR_TEXT); + return t2; + } + function Xt(e) { + let t2 = Po(e); + return { text: t2 === 0 ? e : e.slice(0, e.length - t2), count: t2 }; + } + var W = /* @__PURE__ */ Symbol("MODE_BREAK"), q = /* @__PURE__ */ Symbol("MODE_FLAT"), qt = /* @__PURE__ */ Symbol("DOC_FILL_PRINTED_LENGTH"); + function nt(e, t2, u, r, o, n) { + var _a3; + if (u === Number.POSITIVE_INFINITY) return true; + let a2 = t2.length, s = false, i = [e], D = ""; + for (; u >= 0; ) { + if (i.length === 0) { + if (a2 === 0) return true; + i.push(t2[--a2]); + continue; } - n = toInteger(n); - return function() { - if (--n > 0) { - result2 = func.apply(this, arguments); + let { mode: f2, doc: l } = i.pop(), d = H(l); + switch (d) { + case G: + l && (s && (D += " ", u -= 1, s = false), D += l, u -= Re(l)); + break; + case j: + case w: { + let c = d === j ? l : l.parts, p = (_a3 = l[qt]) != null ? _a3 : 0; + for (let F = c.length - 1; F >= p; F--) i.push({ mode: f2, doc: c[F] }); + break; } - if (n <= 1) { - func = undefined2; + case I: + case k: + case R: + case O: + i.push({ mode: f2, doc: l.contents }); + break; + case v: { + let { text: c, count: p } = Xt(D); + D = c, u += p; + break; } - return result2; - }; - } - 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); - }); - 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); - }); - function curry(func, arity, guard) { - arity = guard ? undefined2 : arity; - var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity); - result2.placeholder = curry.placeholder; - return result2; - } - function curryRight(func, arity, guard) { - arity = guard ? undefined2 : arity; - var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity); - result2.placeholder = curryRight.placeholder; - return result2; - } - function debounce(func, wait, options) { - var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; - if (typeof func != "function") { - throw new TypeError2(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 = undefined2; - lastInvokeTime = time; - result2 = func.apply(thisArg, args); - return result2; - } - function leadingEdge(time) { - lastInvokeTime = time; - timerId = setTimeout2(timerExpired, wait); - return leading ? invokeFunc(time) : result2; - } - 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; - return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; - } - function timerExpired() { - var time = now(); - if (shouldInvoke(time)) { - return trailingEdge(time); + case x: { + if (n && l.break) return false; + let c = l.break ? W : f2, p = l.expandedStates && c === W ? b(0, l.expandedStates, -1) : l.contents; + i.push({ mode: c, doc: p }); + break; } - timerId = setTimeout2(timerExpired, remainingWait(time)); - } - function trailingEdge(time) { - timerId = undefined2; - if (trailing && lastArgs) { - return invokeFunc(time); + case B: { + let p = (l.groupId ? o[l.groupId] || q : f2) === W ? l.breakContents : l.flatContents; + p && i.push({ mode: f2, doc: p }); + break; } - lastArgs = lastThis = undefined2; - return result2; + case _: + if (f2 === W || l.hard) return true; + l.soft || (s = true); + break; + case L: + r = true; + break; + case M: + if (r) return false; + break; } - function cancel() { - if (timerId !== undefined2) { - clearTimeout2(timerId); + } + return false; + } + function Ce(e, t2) { + var _a3; + let u = /* @__PURE__ */ Object.create(null), r = t2.printWidth, o = Se(t2.endOfLine), n = 0, a2 = [{ indent: Ht, mode: W, doc: e }], s = "", i = false, D = [], f2 = [], l = [], d = [], c = 0; + for (zu(e); a2.length > 0; ) { + let { indent: m, mode: h, doc: E } = a2.pop(); + switch (H(E)) { + case G: { + let g = o !== ` +` ? oe(0, E, ` +`, o) : E; + g && (s += g, a2.length > 0 && (n += Re(g))); + break; } - lastInvokeTime = 0; - lastArgs = lastCallTime = lastThis = timerId = undefined2; - } - function flush() { - return timerId === undefined2 ? result2 : trailingEdge(now()); - } - function debounced() { - var time = now(), isInvoking = shouldInvoke(time); - lastArgs = arguments; - lastThis = this; - lastCallTime = time; - if (isInvoking) { - if (timerId === undefined2) { - return leadingEdge(lastCallTime); + case j: + for (let g = E.length - 1; g >= 0; g--) a2.push({ indent: m, mode: h, doc: E[g] }); + break; + case U: + if (f2.length >= 2) throw new Error("There are too many 'cursor' in doc."); + f2.push(c + s.length); + break; + case I: + a2.push({ indent: pr(m, t2), mode: h, doc: E.contents }); + break; + case k: + a2.push({ indent: dr(m, E.n, t2), mode: h, doc: E.contents }); + break; + case v: + y(); + break; + case x: + switch (h) { + case q: + if (!i) { + a2.push({ indent: m, mode: E.break ? W : q, doc: E.contents }); + break; + } + case W: { + i = false; + let g = { indent: m, mode: q, doc: E.contents }, A2 = r - n, J = D.length > 0; + if (!E.break && nt(g, a2, A2, J, u)) a2.push(g); + else if (E.expandedStates) { + let Q = b(0, E.expandedStates, -1); + if (E.break) { + a2.push({ indent: m, mode: W, doc: Q }); + break; + } else for (let re = 1; re < E.expandedStates.length + 1; re++) if (re >= E.expandedStates.length) { + a2.push({ indent: m, mode: W, doc: Q }); + break; + } else { + let Te = E.expandedStates[re], ne = { indent: m, mode: q, doc: Te }; + if (nt(ne, a2, A2, J, u)) { + a2.push(ne); + break; + } + } + } else a2.push({ indent: m, mode: W, doc: E.contents }); + break; + } + } + E.id && (u[E.id] = b(0, a2, -1).mode); + break; + case w: { + let g = r - n, A2 = (_a3 = E[qt]) != null ? _a3 : 0, { parts: J } = E, Q = J.length - A2; + if (Q === 0) break; + let re = J[A2 + 0], Te = J[A2 + 1], ne = { indent: m, mode: q, doc: re }, Rt = { indent: m, mode: W, doc: re }, Lt = nt(ne, [], g, D.length > 0, u, true); + if (Q === 1) { + Lt ? a2.push(ne) : a2.push(Rt); + break; } - if (maxing) { - clearTimeout2(timerId); - timerId = setTimeout2(timerExpired, wait); - return invokeFunc(lastCallTime); + let Iu = { indent: m, mode: q, doc: Te }, Mt = { indent: m, mode: W, doc: Te }; + if (Q === 2) { + Lt ? a2.push(Iu, ne) : a2.push(Mt, Rt); + break; } + let Xn = J[A2 + 2], qn = { indent: m, mode: h, doc: { ...E, [qt]: A2 + 2 } }, Qn = nt({ indent: m, mode: q, doc: [re, Te, Xn] }, [], g, D.length > 0, u, true); + a2.push(qn), Qn ? a2.push(Iu, ne) : Lt ? a2.push(Mt, ne) : a2.push(Mt, Rt); + break; } - if (timerId === undefined2) { - timerId = setTimeout2(timerExpired, wait); + case B: + case R: { + let g = E.groupId ? u[E.groupId] : h; + if (g === W) { + let A2 = E.type === B ? E.breakContents : E.negate ? E.contents : ae(E.contents); + A2 && a2.push({ indent: m, mode: h, doc: A2 }); + } + if (g === q) { + let A2 = E.type === B ? E.flatContents : E.negate ? ae(E.contents) : E.contents; + A2 && a2.push({ indent: m, mode: h, doc: A2 }); + } + break; } - return result2; + case L: + D.push({ indent: m, mode: h, doc: E.contents }); + break; + case M: + D.length > 0 && a2.push({ indent: m, mode: h, doc: ke }); + break; + case _: + switch (h) { + case q: + if (E.hard) i = true; + else { + E.soft || (s += " ", n += 1); + break; + } + case W: + if (D.length > 0) { + a2.push({ indent: m, mode: h, doc: E }, ...D.reverse()), D.length = 0; + break; + } + E.literal ? (s += o, n = 0, m.root && (m.root.value && (s += m.root.value), n = m.root.length)) : (y(), s += o + m.value, n = m.length); + break; + } + break; + case O: + a2.push({ indent: m, mode: h, doc: E.contents }); + break; + case T: + break; + default: + throw new Z(E); } - debounced.cancel = cancel; - debounced.flush = flush; - return debounced; + a2.length === 0 && D.length > 0 && (a2.push(...D.reverse()), D.length = 0); } - var defer = baseRest(function(func, args) { - return baseDelay(func, 1, args); - }); - var delay = baseRest(function(func, wait, args) { - return baseDelay(func, toNumber(wait) || 0, args); - }); - function flip(func) { - return createWrap(func, WRAP_FLIP_FLAG); + let p = l.join("") + s, F = [...d, ...f2]; + if (F.length !== 2) return { formatted: p }; + let C = F[0]; + return { formatted: p, cursorNodeStart: C, cursorNodeText: p.slice(C, b(0, F, -1)) }; + function y() { + let { text: m, count: h } = Xt(s); + m && (l.push(m), c += m.length), s = "", n -= h, f2.length > 0 && (d.push(...f2.map((E) => Math.min(E, c))), f2.length = 0); } - function memoize(func, resolver) { - if (typeof func != "function" || resolver != null && typeof resolver != "function") { - throw new TypeError2(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 result2 = func.apply(this, args); - memoized.cache = cache.set(key, result2) || cache; - return result2; - }; - memoized.cache = new (memoize.Cache || MapCache)(); - return memoized; + } + function Io(e, t2, u = 0) { + let r = 0; + for (let o = u; o < e.length; ++o) e[o] === " " ? r = r + t2 - r % t2 : r++; + return r; + } + var he = Io; + var Qt = (_b = class { + constructor(t2) { + __privateAdd(this, _Qt_instances); + this.stack = [t2]; } - memoize.Cache = MapCache; - function negate(predicate) { - if (typeof predicate != "function") { - throw new TypeError2(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); - }; + get key() { + var _a3; + let { stack: t2, siblings: u } = this; + return (_a3 = b(0, t2, u === null ? -2 : -4)) != null ? _a3 : null; } - function once(func) { - return before(2, func); + get index() { + return this.siblings === null ? null : b(0, this.stack, -2); } - 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); - }); - }); - var partial = baseRest(function(func, partials) { - var holders = replaceHolders(partials, getHolder(partial)); - return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders); - }); - var partialRight = baseRest(function(func, partials) { - var holders = replaceHolders(partials, getHolder(partialRight)); - return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders); - }); - var rearg = flatRest(function(func, indexes) { - return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes); - }); - function rest(func, start) { - if (typeof func != "function") { - throw new TypeError2(FUNC_ERROR_TEXT); - } - start = start === undefined2 ? start : toInteger(start); - return baseRest(func, start); + get node() { + return b(0, this.stack, -1); } - function spread(func, start) { - if (typeof func != "function") { - throw new TypeError2(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); - }); + get parent() { + return this.getNode(1); } - function throttle(func, wait, options) { - var leading = true, trailing = true; - if (typeof func != "function") { - throw new TypeError2(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 - }); + get grandparent() { + return this.getNode(2); } - function unary(func) { - return ary(func, 1); + get isInArray() { + return this.siblings !== null; } - function wrap(value, wrapper) { - return partial(castFunction(wrapper), value); + get siblings() { + let { stack: t2 } = this, u = b(0, t2, -3); + return Array.isArray(u) ? u : null; } - function castArray() { - if (!arguments.length) { - return []; - } - var value = arguments[0]; - return isArray(value) ? value : [value]; + get next() { + let { siblings: t2 } = this; + return t2 === null ? null : t2[this.index + 1]; } - function clone(value) { - return baseClone(value, CLONE_SYMBOLS_FLAG); + get previous() { + let { siblings: t2 } = this; + return t2 === null ? null : t2[this.index - 1]; } - function cloneWith(value, customizer) { - customizer = typeof customizer == "function" ? customizer : undefined2; - return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); + get isFirst() { + return this.index === 0; } - function cloneDeep2(value) { - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); + get isLast() { + let { siblings: t2, index: u } = this; + return t2 !== null && u === t2.length - 1; } - function cloneDeepWith(value, customizer) { - customizer = typeof customizer == "function" ? customizer : undefined2; - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); + get isRoot() { + return this.stack.length === 1; } - function conformsTo(object, source) { - return source == null || baseConformsTo(object, source, keys(source)); + get root() { + return this.stack[0]; } - function eq(value, other) { - return value === other || value !== value && other !== other; + get ancestors() { + return [...__privateMethod(this, _Qt_instances, e_fn).call(this)]; } - var gt = createRelationalOperation(baseGt); - var gte = createRelationalOperation(function(value, other) { - return value >= other; - }); - var isArguments = baseIsArguments(/* @__PURE__ */ (function() { - return arguments; - })()) ? baseIsArguments : function(value) { - return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); - }; - var isArray = Array2.isArray; - var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; - function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); + getName() { + let { stack: t2 } = this, { length: u } = t2; + return u > 1 ? b(0, t2, -2) : null; } - function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); + getValue() { + return b(0, this.stack, -1); } - function isBoolean3(value) { - return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag2; + getNode(t2 = 0) { + let u = __privateMethod(this, _Qt_instances, t_fn).call(this, t2); + return u === -1 ? null : this.stack[u]; } - var isBuffer = nativeIsBuffer || stubFalse; - var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; - function isElement(value) { - return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); + getParentNode(t2 = 0) { + return this.getNode(t2 + 1); } - function isEmpty2(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; - } + call(t2, ...u) { + let { stack: r } = this, { length: o } = r, n = b(0, r, -1); + for (let a2 of u) n = n == null ? void 0 : n[a2], r.push(a2, n); + try { + return t2(this); + } finally { + r.length = o; } - return true; - } - function isEqual(value, other) { - return baseIsEqual(value, other); } - function isEqualWith(value, other, customizer) { - customizer = typeof customizer == "function" ? customizer : undefined2; - var result2 = customizer ? customizer(value, other) : undefined2; - return result2 === undefined2 ? baseIsEqual(value, other, undefined2, customizer) : !!result2; - } - function isError(value) { - if (!isObjectLike(value)) { - return false; + callParent(t2, u = 0) { + let r = __privateMethod(this, _Qt_instances, t_fn).call(this, u + 1), o = this.stack.splice(r + 1); + try { + return t2(this); + } finally { + this.stack.push(...o); } - var tag = baseGetTag(value); - return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value); - } - function isFinite2(value) { - return typeof value == "number" && nativeIsFinite(value); } - function isFunction(value) { - if (!isObject(value)) { - return false; + each(t2, ...u) { + let { stack: r } = this, { length: o } = r, n = b(0, r, -1); + for (let a2 of u) n = n[a2], r.push(a2, n); + try { + for (let a2 = 0; a2 < n.length; ++a2) r.push(a2, n[a2]), t2(this, a2, n), r.length -= 2; + } finally { + r.length = o; } - var tag = baseGetTag(value); - return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; - } - function isInteger(value) { - return typeof value == "number" && value == toInteger(value); } - function isLength(value) { - return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; - } - function isObject(value) { - var type = typeof value; - return value != null && (type == "object" || type == "function"); + map(t2, ...u) { + let r = []; + return this.each((o, n, a2) => { + r[n] = t2(o, n, a2); + }, ...u), r; } - function isObjectLike(value) { - return value != null && typeof value == "object"; + match(...t2) { + let u = this.stack.length - 1, r = null, o = this.stack[u--]; + for (let n of t2) { + if (o === void 0) return false; + let a2 = null; + if (typeof r == "number" && (a2 = r, r = this.stack[u--], o = this.stack[u--]), n && !n(o, r, a2)) return false; + r = this.stack[u--], o = this.stack[u--]; + } + return true; } - var isMap2 = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; - function isMatch(object, source) { - return object === source || baseIsMatch(object, source, getMatchData(source)); + findAncestor(t2) { + for (let u of __privateMethod(this, _Qt_instances, e_fn).call(this)) if (t2(u)) return u; } - function isMatchWith(object, source, customizer) { - customizer = typeof customizer == "function" ? customizer : undefined2; - return baseIsMatch(object, source, getMatchData(source), customizer); + hasAncestor(t2) { + for (let u of __privateMethod(this, _Qt_instances, e_fn).call(this)) if (t2(u)) return true; + return false; } - function isNaN2(value) { - return isNumber3(value) && value != +value; + }, _Qt_instances = new WeakSet(), t_fn = function(t2) { + let { stack: u } = this; + for (let r = u.length - 1; r >= 0; r -= 2) if (!Array.isArray(u[r]) && --t2 < 0) return r; + return -1; + }, e_fn = function* () { + let { stack: t2 } = this; + for (let u = t2.length - 3; u >= 0; u -= 2) { + let r = t2[u]; + Array.isArray(r) || (yield r); } - function isNative(value) { - if (isMaskable(value)) { - throw new Error2(CORE_ERROR_TEXT); + }, _b), Fr = Qt; + function ko(e) { + return e !== null && typeof e == "object"; + } + var ge = ko; + function ye(e) { + return (t2, u, r) => { + let o = !!(r == null ? void 0 : r.backwards); + if (u === false) return false; + let { length: n } = t2, a2 = u; + for (; a2 >= 0 && a2 < n; ) { + let s = t2.charAt(a2); + if (e instanceof RegExp) { + if (!e.test(s)) return a2; + } else if (!e.includes(s)) return a2; + o ? a2-- : a2++; } - return baseIsNative(value); - } - function isNull(value) { - return value === null; + return a2 === -1 || a2 === n ? a2 : false; + }; + } + var mr = ye(/\s/u), Y = ye(" "), ot = ye(",; "), at = ye(/[^\n\r]/u); + var Er = (e) => e === ` +` || e === "\r" || e === "\u2028" || e === "\u2029"; + function vo(e, t2, u) { + let r = !!(u == null ? void 0 : u.backwards); + if (t2 === false) return false; + let o = e.charAt(t2); + if (r) { + if (e.charAt(t2 - 1) === "\r" && o === ` +`) return t2 - 2; + if (Er(o)) return t2 - 1; + } else { + if (o === "\r" && e.charAt(t2 + 1) === ` +`) return t2 + 2; + if (Er(o)) return t2 + 1; } - function isNil(value) { - return value == null; + return t2; + } + var K = vo; + function Ro(e, t2, u = {}) { + let r = Y(e, u.backwards ? t2 - 1 : t2, u), o = K(e, r, u); + return r !== o; + } + var z = Ro; + function Lo(e) { + return Array.isArray(e) && e.length > 0; + } + var Cr = Lo; + function* be(e, t2) { + let { getVisitorKeys: u, filter: r = () => true } = t2, o = (n) => ge(n) && r(n); + for (let n of u(e)) { + let a2 = e[n]; + if (Array.isArray(a2)) for (let s of a2) o(s) && (yield s); + else o(a2) && (yield a2); } - function isNumber3(value) { - return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag; + } + function* hr(e, t2) { + let u = [e]; + for (let r = 0; r < u.length; r++) { + let o = u[r]; + for (let n of be(o, t2)) yield n, u.push(n); } - function isPlainObject(value) { - if (!isObjectLike(value) || baseGetTag(value) != objectTag) { - return false; + } + function gr(e, t2) { + return be(e, t2).next().done; + } + function yr(e, t2, u) { + var _a3, _b2; + let { cache: r } = u; + if (r.has(e)) return r.get(e); + let { filter: o } = u; + if (!o) return []; + let n, a2 = ((_b2 = (_a3 = u.getChildren) == null ? void 0 : _a3.call(u, e, u)) != null ? _b2 : [...be(e, { getVisitorKeys: u.getVisitorKeys })]).flatMap((D) => (n != null ? n : n = [e, ...t2], o(D, n) ? [D] : yr(D, n, u))), { locStart: s, locEnd: i } = u; + return a2.sort((D, f2) => s(D) - s(f2) || i(D) - i(f2)), r.set(e, a2), a2; + } + var it = yr; + function Mo(e) { + let t2 = e.type || e.kind || "(unknown type)", u = String(e.name || e.id && (typeof e.id == "object" ? e.id.name : e.id) || e.key && (typeof e.key == "object" ? e.key.name : e.key) || e.value && (typeof e.value == "object" ? "" : String(e.value)) || e.operator || ""); + return u.length > 20 && (u = u.slice(0, 19) + "\u2026"), t2 + (u ? " " + u : ""); + } + function Zt(e, t2) { + var _a3; + ((_a3 = e.comments) != null ? _a3 : e.comments = []).push(t2), t2.printed = false, t2.nodeDescription = Mo(e); + } + function fe(e, t2) { + t2.leading = true, t2.trailing = false, Zt(e, t2); + } + function ue(e, t2, u) { + t2.leading = false, t2.trailing = false, u && (t2.marker = u), Zt(e, t2); + } + function le(e, t2) { + t2.leading = false, t2.trailing = true, Zt(e, t2); + } + var uu = /* @__PURE__ */ new WeakMap(); + function Ar(e, t2, u, r, o = []) { + let { locStart: n, locEnd: a2 } = u, s = n(t2), i = a2(t2), D = it(e, o, { cache: uu, locStart: n, locEnd: a2, getVisitorKeys: u.getVisitorKeys, filter: u.printer.canAttachComment, getChildren: u.printer.getCommentChildNodes }), f2, l, d = 0, c = D.length; + for (; d < c; ) { + let p = d + c >> 1, F = D[p], C = n(F), y = a2(F); + if (C <= s && i <= y) return Ar(F, t2, u, F, [F, ...o]); + if (y <= s) { + f2 = F, d = p + 1; + continue; } - var proto = getPrototype(value); - if (proto === null) { - return true; + if (i <= C) { + l = F, c = p; + continue; } - var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor; - return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; + throw new Error("Comment location overlaps with node location"); } - var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; - function isSafeInteger(value) { - return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; + if ((r == null ? void 0 : r.type) === "TemplateLiteral") { + let { quasis: p } = r, F = tu(p, t2, u); + f2 && tu(p, f2, u) !== F && (f2 = null), l && tu(p, l, u) !== F && (l = null); + } + return { enclosingNode: r, precedingNode: f2, followingNode: l }; + } + var eu = () => false; + function _r(e, t2) { + let { comments: u } = e; + if (delete e.comments, !Cr(u) || !t2.printer.canAttachComment) return; + let r = [], { printer: { features: { experimental_avoidAstMutation: o }, handleComments: n = {} }, originalText: a2 } = t2, { ownLine: s = eu, endOfLine: i = eu, remaining: D = eu } = n, f2 = u.map((l, d) => ({ ...Ar(e, l, t2), comment: l, text: a2, options: t2, ast: e, isLastComment: u.length - 1 === d })); + for (let [l, d] of f2.entries()) { + let { comment: c, precedingNode: p, enclosingNode: F, followingNode: C, text: y, options: m, ast: h, isLastComment: E } = d, g; + if (o ? g = [d] : (c.enclosingNode = F, c.precedingNode = p, c.followingNode = C, g = [c, y, m, h, E]), Yo(y, m, f2, l)) c.placement = "ownLine", s(...g) || (C ? fe(C, c) : p ? le(p, c) : F ? ue(F, c) : ue(h, c)); + else if (jo(y, m, f2, l)) c.placement = "endOfLine", i(...g) || (p ? le(p, c) : C ? fe(C, c) : F ? ue(F, c) : ue(h, c)); + else if (c.placement = "remaining", !D(...g)) if (p && C) { + let A2 = r.length; + A2 > 0 && r[A2 - 1].followingNode !== C && br(r, m), r.push(d); + } else p ? le(p, c) : C ? fe(C, c) : F ? ue(F, c) : ue(h, c); + } + if (br(r, t2), !o) for (let l of u) delete l.precedingNode, delete l.enclosingNode, delete l.followingNode; + } + var xr = (e) => !/[\S\n\u2028\u2029]/u.test(e); + function Yo(e, t2, u, r) { + let { comment: o, precedingNode: n } = u[r], { locStart: a2, locEnd: s } = t2, i = a2(o); + if (n) for (let D = r - 1; D >= 0; D--) { + let { comment: f2, precedingNode: l } = u[D]; + if (l !== n || !xr(e.slice(s(f2), i))) break; + i = a2(f2); + } + return z(e, i, { backwards: true }); + } + function jo(e, t2, u, r) { + let { comment: o, followingNode: n } = u[r], { locStart: a2, locEnd: s } = t2, i = s(o); + if (n) for (let D = r + 1; D < u.length; D++) { + let { comment: f2, followingNode: l } = u[D]; + if (l !== n || !xr(e.slice(i, a2(f2)))) break; + i = s(f2); + } + return z(e, i); + } + function br(e, t2) { + var _a3, _b2, _c2; + let u = e.length; + if (u === 0) return; + let { precedingNode: r, followingNode: o } = e[0], n = t2.locStart(o), a2; + for (a2 = u; a2 > 0; --a2) { + let { comment: s, precedingNode: i, followingNode: D } = e[a2 - 1]; + P(i, r), P(D, o); + let f2 = t2.originalText.slice(t2.locEnd(s), n); + if ((_c2 = (_b2 = (_a3 = t2.printer).isGap) == null ? void 0 : _b2.call(_a3, f2, t2)) != null ? _c2 : /^[\s(]*$/u.test(f2)) n = t2.locStart(s); + else break; } - var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; - function isString3(value) { - return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag; + for (let [s, { comment: i }] of e.entries()) s < a2 ? le(r, i) : fe(o, i); + for (let s of [r, o]) s.comments && s.comments.length > 1 && s.comments.sort((i, D) => t2.locStart(i) - t2.locStart(D)); + e.length = 0; + } + function tu(e, t2, u) { + let r = u.locStart(t2) - 1; + for (let o = 1; o < e.length; ++o) if (r < u.locStart(e[o])) return o - 1; + return 0; + } + function Uo(e, t2) { + let u = t2 - 1; + u = Y(e, u, { backwards: true }), u = K(e, u, { backwards: true }), u = Y(e, u, { backwards: true }); + let r = K(e, u, { backwards: true }); + return u !== r; + } + var Le = Uo; + function Br(e, t2) { + let u = e.node; + return u.printed = true, t2.printer.printComment(e, t2); + } + function Wo(e, t2) { + var _a3; + let u = e.node, r = [Br(e, t2)], { printer: o, originalText: n, locStart: a2, locEnd: s } = t2; + if ((_a3 = o.isBlockComment) == null ? void 0 : _a3.call(o, u)) { + let f2 = z(n, s(u)) ? z(n, a2(u), { backwards: true }) ? V : rt : " "; + r.push(f2); + } else r.push(V); + let D = K(n, Y(n, s(u))); + return D !== false && z(n, D) && r.push(V), r; + } + function $o(e, t2, u) { + var _a3; + let r = e.node, o = Br(e, t2), { printer: n, originalText: a2, locStart: s } = t2, i = (_a3 = n.isBlockComment) == null ? void 0 : _a3.call(n, r); + if ((u == null ? void 0 : u.hasLineSuffix) && !(u == null ? void 0 : u.isBlock) || z(a2, s(r), { backwards: true })) { + let D = Le(a2, s(r)); + return { doc: ve([V, D ? V : "", o]), isBlock: i, hasLineSuffix: true }; + } + return !i || (u == null ? void 0 : u.hasLineSuffix) ? { doc: [ve([" ", o]), ce], isBlock: i, hasLineSuffix: true } : { doc: [" ", o], isBlock: i, hasLineSuffix: false }; + } + function Vo(e, t2) { + let u = e.node; + if (!u) return {}; + let r = t2[/* @__PURE__ */ Symbol.for("printedComments")]; + if ((u.comments || []).filter((i) => !r.has(i)).length === 0) return { leading: "", trailing: "" }; + let n = [], a2 = [], s; + return e.each(() => { + let i = e.node; + if (r == null ? void 0 : r.has(i)) return; + let { leading: D, trailing: f2 } = i; + D ? n.push(Wo(e, t2)) : f2 && (s = $o(e, t2, s), a2.push(s.doc)); + }, "comments"), { leading: n, trailing: a2 }; + } + function Tr(e, t2, u) { + let { leading: r, trailing: o } = Vo(e, u); + return !r && !o ? t2 : Ee(t2, (n) => [r, n, o]); + } + function Nr(e) { + let { [/* @__PURE__ */ Symbol.for("comments")]: t2, [/* @__PURE__ */ Symbol.for("printedComments")]: u } = e; + for (let r of t2) { + if (!r.printed && !u.has(r)) throw new Error('Comment "' + r.value.trim() + '" was not printed. Please report this error!'); + delete r.printed; } - function isSymbol(value) { - return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag; + } + var Sr = () => P; + var Me = class extends Error { + constructor() { + super(...arguments); + __publicField(this, "name", "ConfigError"); } - var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; - function isUndefined(value) { - return value === undefined2; + }, Ye = class extends Error { + constructor() { + super(...arguments); + __publicField(this, "name", "UndefinedParserError"); } - function isWeakMap(value) { - return isObjectLike(value) && getTag(value) == weakMapTag; + }; + var wr = { checkIgnorePragma: { category: "Special", type: "boolean", default: false, description: "Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.", cliCategory: "Other" }, cursorOffset: { category: "Special", type: "int", default: -1, range: { start: -1, end: 1 / 0, step: 1 }, description: "Print (to stderr) where a cursor at the given position would move to after formatting.", cliCategory: "Editor" }, endOfLine: { category: "Global", type: "choice", default: "lf", description: "Which end of line characters to apply.", choices: [{ value: "lf", description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos" }, { value: "crlf", description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows" }, { value: "cr", description: "Carriage Return character only (\\r), used very rarely" }, { value: "auto", description: `Maintain existing +(mixed values within one file are normalised by looking at what's used after the first line)` }] }, filepath: { category: "Special", type: "path", description: "Specify the input filepath. This will be used to do parser inference.", cliName: "stdin-filepath", cliCategory: "Other", cliDescription: "Path to the file to pretend that stdin comes from." }, insertPragma: { category: "Special", type: "boolean", default: false, description: "Insert @format pragma into file's first docblock comment.", cliCategory: "Other" }, parser: { category: "Global", type: "choice", default: void 0, description: "Which parser to use.", exception: (e) => typeof e == "string" || typeof e == "function", choices: [{ value: "flow", description: "Flow" }, { value: "babel", description: "JavaScript" }, { value: "babel-flow", description: "Flow" }, { value: "babel-ts", description: "TypeScript" }, { value: "typescript", description: "TypeScript" }, { value: "acorn", description: "JavaScript" }, { value: "espree", description: "JavaScript" }, { value: "meriyah", description: "JavaScript" }, { value: "css", description: "CSS" }, { value: "less", description: "Less" }, { value: "scss", description: "SCSS" }, { value: "json", description: "JSON" }, { value: "json5", description: "JSON5" }, { value: "jsonc", description: "JSON with Comments" }, { value: "json-stringify", description: "JSON.stringify" }, { value: "graphql", description: "GraphQL" }, { value: "markdown", description: "Markdown" }, { value: "mdx", description: "MDX" }, { value: "vue", description: "Vue" }, { value: "yaml", description: "YAML" }, { value: "glimmer", description: "Ember / Handlebars" }, { value: "html", description: "HTML" }, { value: "angular", description: "Angular" }, { value: "lwc", description: "Lightning Web Components" }, { value: "mjml", description: "MJML" }] }, plugins: { type: "path", array: true, default: [{ value: [] }], category: "Global", description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.", exception: (e) => typeof e == "string" || typeof e == "object", cliName: "plugin", cliCategory: "Config" }, printWidth: { category: "Global", type: "int", default: 80, description: "The line length where Prettier will try wrap.", range: { start: 0, end: 1 / 0, step: 1 } }, rangeEnd: { category: "Special", type: "int", default: 1 / 0, range: { start: 0, end: 1 / 0, step: 1 }, description: `Format code ending at a given character offset (exclusive). +The range will extend forwards to the end of the selected statement.`, cliCategory: "Editor" }, rangeStart: { category: "Special", type: "int", default: 0, range: { start: 0, end: 1 / 0, step: 1 }, description: `Format code starting at a given character offset. +The range will extend backwards to the start of the first line containing the selected statement.`, cliCategory: "Editor" }, requirePragma: { category: "Special", type: "boolean", default: false, description: "Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.", cliCategory: "Other" }, tabWidth: { type: "int", category: "Global", default: 2, description: "Number of spaces per indentation level.", range: { start: 0, end: 1 / 0, step: 1 } }, useTabs: { category: "Global", type: "boolean", default: false, description: "Indent with tabs instead of spaces." }, embeddedLanguageFormatting: { category: "Global", type: "choice", default: "auto", description: "Control how Prettier formats quoted code embedded in the file.", choices: [{ value: "auto", description: "Format embedded code if Prettier can automatically identify it." }, { value: "off", description: "Never automatically format embedded code." }] } }; + function st({ plugins: e = [], showDeprecated: t2 = false } = {}) { + let u = e.flatMap((o) => { + var _a3; + return (_a3 = o.languages) != null ? _a3 : []; + }), r = []; + for (let o of Go(Object.assign({}, ...e.map(({ options: n }) => n), wr))) !t2 && o.deprecated || (Array.isArray(o.choices) && (t2 || (o.choices = o.choices.filter((n) => !n.deprecated)), o.name === "parser" && (o.choices = [...o.choices, ...Ko(o.choices, u, e)])), o.pluginDefaults = Object.fromEntries(e.filter((n) => { + var _a3; + return ((_a3 = n.defaultOptions) == null ? void 0 : _a3[o.name]) !== void 0; + }).map((n) => [n.name, n.defaultOptions[o.name]])), r.push(o)); + return { languages: u, options: r }; + } + function* Ko(e, t2, u) { + let r = new Set(e.map((o) => o.value)); + for (let o of t2) if (o.parsers) { + for (let n of o.parsers) if (!r.has(n)) { + r.add(n); + let a2 = u.find((i) => i.parsers && Object.prototype.hasOwnProperty.call(i.parsers, n)), s = o.name; + (a2 == null ? void 0 : a2.name) && (s += ` (plugin: ${a2.name})`), yield { value: n, description: s }; + } + } + } + function Go(e) { + let t2 = []; + for (let [u, r] of Object.entries(e)) { + let o = { name: u, ...r }; + Array.isArray(o.default) && (o.default = b(0, o.default, -1).value), t2.push(o); } - function isWeakSet(value) { - return isObjectLike(value) && baseGetTag(value) == weakSetTag; + return t2; + } + var zo = (_c = Array.prototype.toReversed) != null ? _c : function() { + return [...this].reverse(); + }, Jo = X("toReversed", function() { + if (Array.isArray(this)) return zo; + }), Or = Jo; + function Ho() { + var _a3, _b2, _c2, _d2, _e3, _f, _g, _h; + let e = globalThis, t2 = (_b2 = (_a3 = e.Deno) == null ? void 0 : _a3.build) == null ? void 0 : _b2.os; + return typeof t2 == "string" ? t2 === "windows" : (_h = (_g = (_d2 = (_c2 = e.navigator) == null ? void 0 : _c2.platform) == null ? void 0 : _d2.startsWith("Win")) != null ? _g : (_f = (_e3 = e.process) == null ? void 0 : _e3.platform) == null ? void 0 : _f.startsWith("win")) != null ? _h : false; + } + var Xo = Ho(); + function Pr(e) { + if (e = e instanceof URL ? e : new URL(e), e.protocol !== "file:") throw new TypeError(`URL must be a file URL: received "${e.protocol}"`); + return e; + } + function qo(e) { + return e = Pr(e), decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25")); + } + function Qo(e) { + e = Pr(e); + let t2 = decodeURIComponent(e.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\"); + return e.hostname !== "" && (t2 = `\\\\${e.hostname}${t2}`), t2; + } + function ru(e) { + return Xo ? Qo(e) : qo(e); + } + var Ir = (e) => String(e).split(/[/\\]/u).pop(), kr = (e) => String(e).startsWith("file:"); + function vr(e, t2) { + var _a3; + if (!t2) return; + let u = Ir(t2).toLowerCase(); + return (_a3 = e.find(({ filenames: r }) => r == null ? void 0 : r.some((o) => o.toLowerCase() === u))) != null ? _a3 : e.find(({ extensions: r }) => r == null ? void 0 : r.some((o) => u.endsWith(o))); + } + function Zo(e, t2) { + var _a3, _b2; + if (t2) return (_b2 = (_a3 = e.find(({ name: u }) => u.toLowerCase() === t2)) != null ? _a3 : e.find(({ aliases: u }) => u == null ? void 0 : u.includes(t2))) != null ? _b2 : e.find(({ extensions: u }) => u == null ? void 0 : u.includes(`.${t2}`)); + } + var ea = void 0; + function Rr(e, t2) { + if (t2) { + if (kr(t2)) try { + t2 = ru(t2); + } catch { + return; + } + if (typeof t2 == "string") return e.find(({ isSupported: u }) => u == null ? void 0 : u({ filepath: t2 })); } - var lt = createRelationalOperation(baseLt); - var lte = createRelationalOperation(function(value, other) { - return value <= other; + } + function ta(e, t2) { + var _a3, _b2, _c2, _d2, _e3, _f; + let u = Or(0, e.plugins).flatMap((o) => { + var _a4; + return (_a4 = o.languages) != null ? _a4 : []; }); - function toArray(value) { - if (!value) { - return []; - } - if (isArrayLike(value)) { - return isString3(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); + return (_f = (_e3 = (_d2 = (_c2 = (_b2 = (_a3 = Zo(u, t2.language)) != null ? _a3 : vr(u, t2.physicalFile)) != null ? _b2 : vr(u, t2.file)) != null ? _c2 : Rr(u, t2.physicalFile)) != null ? _d2 : Rr(u, t2.file)) != null ? _e3 : ea == null ? void 0 : ea(u, t2.physicalFile)) == null ? void 0 : _f.parsers[0]; + } + var Dt = ta; + var ie = { key: (e) => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(e) ? e : JSON.stringify(e), value(e) { + if (e === null || typeof e != "object") return JSON.stringify(e); + if (Array.isArray(e)) return `[${e.map((u) => ie.value(u)).join(", ")}]`; + let t2 = Object.keys(e); + return t2.length === 0 ? "{}" : `{ ${t2.map((u) => `${ie.key(u)}: ${ie.value(e[u])}`).join(", ")} }`; + }, pair: ({ key: e, value: t2 }) => ie.value({ [e]: t2 }) }; + var nu = new Proxy(String, { get: () => nu }), $ = nu, ou = () => nu; + var Lr = (e, t2, { descriptor: u }) => { + let r = [`${$.yellow(typeof e == "string" ? u.key(e) : u.pair(e))} is deprecated`]; + return t2 && r.push(`we now treat it as ${$.blue(typeof t2 == "string" ? u.key(t2) : u.pair(t2))}`), r.join("; ") + "."; + }; + var ct = /* @__PURE__ */ Symbol.for("vnopts.VALUE_NOT_EXIST"), Ae = /* @__PURE__ */ Symbol.for("vnopts.VALUE_UNCHANGED"); + var Mr = " ".repeat(2), jr = (e, t2, u) => { + let { text: r, list: o } = u.normalizeExpectedResult(u.schemas[e].expected(u)), n = []; + return r && n.push(Yr(e, t2, r, u.descriptor)), o && n.push([Yr(e, t2, o.title, u.descriptor)].concat(o.values.map((a2) => Ur(a2, u.loggerPrintWidth))).join(` +`)), Wr(n, u.loggerPrintWidth); + }; + function Yr(e, t2, u, r) { + return [`Invalid ${$.red(r.key(e))} value.`, `Expected ${$.blue(u)},`, `but received ${t2 === ct ? $.gray("nothing") : $.red(r.value(t2))}.`].join(" "); + } + function Ur({ text: e, list: t2 }, u) { + let r = []; + return e && r.push(`- ${$.blue(e)}`), t2 && r.push([`- ${$.blue(t2.title)}:`].concat(t2.values.map((o) => Ur(o, u - Mr.length).replace(/^|\n/g, `$&${Mr}`))).join(` +`)), Wr(r, u); + } + function Wr(e, t2) { + if (e.length === 1) return e[0]; + let [u, r] = e, [o, n] = e.map((a2) => a2.split(` +`, 1)[0].length); + return o > t2 && o > n ? r : u; + } + var _e = [], au = []; + function ft(e, t2, u) { + if (e === t2) return 0; + let r = u == null ? void 0 : u.maxDistance, o = e; + e.length > t2.length && (e = t2, t2 = o); + let n = e.length, a2 = t2.length; + for (; n > 0 && e.charCodeAt(~-n) === t2.charCodeAt(~-a2); ) n--, a2--; + let s = 0; + for (; s < n && e.charCodeAt(s) === t2.charCodeAt(s); ) s++; + if (n -= s, a2 -= s, r !== void 0 && a2 - n > r) return r; + if (n === 0) return r !== void 0 && a2 > r ? r : a2; + let i, D, f2, l, d = 0, c = 0; + for (; d < n; ) au[d] = e.charCodeAt(s + d), _e[d] = ++d; + for (; c < a2; ) { + for (i = t2.charCodeAt(s + c), f2 = c++, D = c, d = 0; d < n; d++) l = i === au[d] ? f2 : f2 + 1, f2 = _e[d], D = _e[d] = f2 > D ? l > D ? D + 1 : l : l > f2 ? f2 + 1 : l; + if (r !== void 0) { + let p = D; + for (d = 0; d < n; d++) _e[d] < p && (p = _e[d]); + if (p > r) return r; + } + } + return _e.length = n, au.length = n, r !== void 0 && D > r ? r : D; + } + function $r(e, t2, u) { + if (!Array.isArray(t2) || t2.length === 0) return; + let r = u == null ? void 0 : u.maxDistance, o = e.length; + for (let i of t2) if (i === e) return i; + if (r === 0) return; + let n, a2 = Number.POSITIVE_INFINITY, s = /* @__PURE__ */ new Set(); + for (let i of t2) { + if (s.has(i)) continue; + s.add(i); + let D = Math.abs(i.length - o); + if (D >= a2 || r !== void 0 && D > r) continue; + let f2 = Number.isFinite(a2) ? r === void 0 ? a2 : Math.min(a2, r) : r, l = f2 === void 0 ? ft(e, i) : ft(e, i, { maxDistance: f2 }); + if (r !== void 0 && l > r) continue; + let d = l; + if (f2 !== void 0 && l === f2 && f2 === r && (d = ft(e, i)), d < a2 && (a2 = d, n = i, a2 === 0)) break; + } + if (!(r !== void 0 && a2 > r)) return n; + } + var lt = (e, t2, { descriptor: u, logger: r, schemas: o }) => { + let n = [`Ignored unknown option ${$.yellow(u.pair({ key: e, value: t2 }))}.`], a2 = $r(e, Object.keys(o), { maxDistance: 3 }); + a2 && n.push(`Did you mean ${$.blue(u.key(a2))}?`), r.warn(n.join(" ")); + }; + var ua = ["default", "expected", "validate", "deprecated", "forward", "redirect", "overlap", "preprocess", "postprocess"]; + function ra(e, t2) { + let u = new e(t2), r = Object.create(u); + for (let o of ua) o in t2 && (r[o] = na(t2[o], u, S.prototype[o].length)); + return r; + } + var S = class { + static create(t2) { + return ra(this, t2); } - 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; + constructor(t2) { + this.name = t2.name; } - function toInteger(value) { - var result2 = toFinite(value), remainder = result2 % 1; - return result2 === result2 ? remainder ? result2 - remainder : result2 : 0; + default(t2) { } - function toLength(value) { - return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; + expected(t2) { + return "nothing"; } - 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 = baseTrim(value); - var isBinary = reIsBinary.test(value); - return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; + validate(t2, u) { + return false; } - function toPlainObject(value) { - return copyObject(value, keysIn(value)); + deprecated(t2, u) { + return false; } - function toSafeInteger(value) { - return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0; + forward(t2, u) { } - function toString(value) { - return value == null ? "" : baseToString(value); + redirect(t2, u) { } - 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]); - } - } - }); - var assignIn = createAssigner(function(object, source) { - copyObject(source, keysIn(source), object); - }); - var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keysIn(source), object, customizer); - }); - var assignWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keys(source), object, customizer); - }); - var at = flatRest(baseAt); - function create(prototype, properties) { - var result2 = baseCreate(prototype); - return properties == null ? result2 : baseAssign(result2, properties); - } - var defaults = baseRest(function(object, sources) { - object = Object2(object); - var index = -1; - var length = sources.length; - var guard = length > 2 ? sources[2] : undefined2; - 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 === undefined2 || eq(value, objectProto[key]) && !hasOwnProperty.call(object, key)) { - object[key] = source[key]; - } - } - } - return object; - }); - var defaultsDeep = baseRest(function(args) { - args.push(undefined2, customDefaultsMerge); - return apply(mergeWith, undefined2, args); - }); - function findKey(object, predicate) { - return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); + overlap(t2, u, r) { + return t2; } - function findLastKey(object, predicate) { - return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); + preprocess(t2, u) { + return t2; } - function forIn(object, iteratee2) { - return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn); + postprocess(t2, u) { + return Ae; } - function forInRight(object, iteratee2) { - return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn); + }; + function na(e, t2, u) { + return typeof e == "function" ? (...r) => e(...r.slice(0, u - 1), t2, ...r.slice(u - 1)) : () => e; + } + var dt = class extends S { + constructor(t2) { + super(t2), this._sourceName = t2.sourceName; } - function forOwn(object, iteratee2) { - return object && baseForOwn(object, getIteratee(iteratee2, 3)); + expected(t2) { + return t2.schemas[this._sourceName].expected(t2); } - function forOwnRight(object, iteratee2) { - return object && baseForOwnRight(object, getIteratee(iteratee2, 3)); + validate(t2, u) { + return u.schemas[this._sourceName].validate(t2, u); } - function functions(object) { - return object == null ? [] : baseFunctions(object, keys(object)); + redirect(t2, u) { + return this._sourceName; } - function functionsIn(object) { - return object == null ? [] : baseFunctions(object, keysIn(object)); + }; + var pt = class extends S { + expected() { + return "anything"; } - function get(object, path5, defaultValue) { - var result2 = object == null ? undefined2 : baseGet(object, path5); - return result2 === undefined2 ? defaultValue : result2; + validate() { + return true; } - function has(object, path5) { - return object != null && hasPath(object, path5, baseHas); + }; + var Ft = class extends S { + constructor({ valueSchema: t2, name: u = t2.name, ...r }) { + super({ ...r, name: u }), this._valueSchema = t2; } - function hasIn(object, path5) { - return object != null && hasPath(object, path5, baseHasIn); + expected(t2) { + let { text: u, list: r } = t2.normalizeExpectedResult(this._valueSchema.expected(t2)); + return { text: u && `an array of ${u}`, list: r && { title: "an array of the following values", values: [{ list: r }] } }; } - var invert = createInverter(function(result2, value, key) { - if (value != null && typeof value.toString != "function") { - value = nativeObjectToString.call(value); - } - result2[value] = key; - }, constant(identity)); - var invertBy = createInverter(function(result2, value, key) { - if (value != null && typeof value.toString != "function") { - value = nativeObjectToString.call(value); - } - if (hasOwnProperty.call(result2, value)) { - result2[value].push(key); - } else { - result2[value] = [key]; + validate(t2, u) { + if (!Array.isArray(t2)) return false; + let r = []; + for (let o of t2) { + let n = u.normalizeValidateResult(this._valueSchema.validate(o, u), o); + n !== true && r.push(n.value); } - }, getIteratee); - var invoke = baseRest(baseInvoke); - function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); - } - function keysIn(object) { - return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); - } - function mapKeys(object, iteratee2) { - var result2 = {}; - iteratee2 = getIteratee(iteratee2, 3); - baseForOwn(object, function(value, key, object2) { - baseAssignValue(result2, iteratee2(value, key, object2), value); - }); - return result2; - } - function mapValues(object, iteratee2) { - var result2 = {}; - iteratee2 = getIteratee(iteratee2, 3); - baseForOwn(object, function(value, key, object2) { - baseAssignValue(result2, key, iteratee2(value, key, object2)); - }); - return result2; + return r.length === 0 ? true : { value: r }; } - var merge2 = createAssigner(function(object, source, srcIndex) { - baseMerge(object, source, srcIndex); - }); - var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { - baseMerge(object, source, srcIndex, customizer); - }); - var omit = flatRest(function(object, paths) { - var result2 = {}; - if (object == null) { - return result2; - } - var isDeep = false; - paths = arrayMap(paths, function(path5) { - path5 = castPath(path5, object); - isDeep || (isDeep = path5.length > 1); - return path5; - }); - copyObject(object, getAllKeysIn(object), result2); - if (isDeep) { - result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); - } - var length = paths.length; - while (length--) { - baseUnset(result2, paths[length]); + deprecated(t2, u) { + let r = []; + for (let o of t2) { + let n = u.normalizeDeprecatedResult(this._valueSchema.deprecated(o, u), o); + n !== false && r.push(...n.map(({ value: a2 }) => ({ value: [a2] }))); } - return result2; - }); - function omitBy(object, predicate) { - return pickBy(object, negate(getIteratee(predicate))); + return r; } - var pick = flatRest(function(object, paths) { - return object == null ? {} : basePick(object, paths); - }); - function pickBy(object, predicate) { - if (object == null) { - return {}; + forward(t2, u) { + let r = []; + for (let o of t2) { + let n = u.normalizeForwardResult(this._valueSchema.forward(o, u), o); + r.push(...n.map(Vr)); } - var props = arrayMap(getAllKeysIn(object), function(prop) { - return [prop]; - }); - predicate = getIteratee(predicate); - return basePickBy(object, props, function(value, path5) { - return predicate(value, path5[0]); - }); + return r; } - function result(object, path5, defaultValue) { - path5 = castPath(path5, object); - var index = -1, length = path5.length; - if (!length) { - length = 1; - object = undefined2; - } - while (++index < length) { - var value = object == null ? undefined2 : object[toKey(path5[index])]; - if (value === undefined2) { - index = length; - value = defaultValue; - } - object = isFunction(value) ? value.call(object) : value; - } - return object; - } - function set2(object, path5, value) { - return object == null ? object : baseSet(object, path5, value); - } - function setWith(object, path5, value, customizer) { - customizer = typeof customizer == "function" ? customizer : undefined2; - return object == null ? object : baseSet(object, path5, value, customizer); - } - var toPairs = createToPairs(keys); - var toPairsIn = createToPairs(keysIn); - function transform(object, iteratee2, accumulator) { - var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object); - iteratee2 = getIteratee(iteratee2, 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 = {}; - } + redirect(t2, u) { + let r = [], o = []; + for (let n of t2) { + let a2 = u.normalizeRedirectResult(this._valueSchema.redirect(n, u), n); + "remain" in a2 && r.push(a2.remain), o.push(...a2.redirect.map(Vr)); } - (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) { - return iteratee2(accumulator, value, index, object2); - }); - return accumulator; + return r.length === 0 ? { redirect: o } : { redirect: o, remain: r }; } - function unset(object, path5) { - return object == null ? true : baseUnset(object, path5); + overlap(t2, u) { + return t2.concat(u); } - function update(object, path5, updater) { - return object == null ? object : baseUpdate(object, path5, castFunction(updater)); + }; + function Vr({ from: e, to: t2 }) { + return { from: [e], to: t2 }; + } + var mt = class extends S { + expected() { + return "true or false"; } - function updateWith(object, path5, updater, customizer) { - customizer = typeof customizer == "function" ? customizer : undefined2; - return object == null ? object : baseUpdate(object, path5, castFunction(updater), customizer); + validate(t2) { + return typeof t2 == "boolean"; } - function values(object) { - return object == null ? [] : baseValues(object, keys(object)); + }; + function Gr(e, t2) { + let u = /* @__PURE__ */ Object.create(null); + for (let r of e) { + let o = r[t2]; + if (u[o]) throw new Error(`Duplicate ${t2} ${JSON.stringify(o)}`); + u[o] = r; } - function valuesIn(object) { - return object == null ? [] : baseValues(object, keysIn(object)); + return u; + } + function zr(e, t2) { + let u = /* @__PURE__ */ new Map(); + for (let r of e) { + let o = r[t2]; + if (u.has(o)) throw new Error(`Duplicate ${t2} ${JSON.stringify(o)}`); + u.set(o, r); } - function clamp(number, lower, upper) { - if (upper === undefined2) { - upper = lower; - lower = undefined2; - } - if (upper !== undefined2) { - upper = toNumber(upper); - upper = upper === upper ? upper : 0; - } - if (lower !== undefined2) { - lower = toNumber(lower); - lower = lower === lower ? lower : 0; - } - return baseClamp(toNumber(number), lower, upper); + return u; + } + function Jr() { + let e = /* @__PURE__ */ Object.create(null); + return (t2) => { + let u = JSON.stringify(t2); + return e[u] ? true : (e[u] = true, false); + }; + } + function Hr(e, t2) { + let u = [], r = []; + for (let o of e) t2(o) ? u.push(o) : r.push(o); + return [u, r]; + } + function Xr(e) { + return e === Math.floor(e); + } + function qr(e, t2) { + if (e === t2) return 0; + let u = typeof e, r = typeof t2, o = ["undefined", "object", "boolean", "number", "string"]; + return u !== r ? o.indexOf(u) - o.indexOf(r) : u !== "string" ? Number(e) - Number(t2) : e.localeCompare(t2); + } + function Qr(e) { + return (...t2) => { + let u = e(...t2); + return typeof u == "string" ? new Error(u) : u; + }; + } + function iu(e) { + return e === void 0 ? {} : e; + } + function su(e) { + if (typeof e == "string") return { text: e }; + let { text: t2, list: u } = e; + return oa((t2 || u) !== void 0, "Unexpected `expected` result, there should be at least one field."), u ? { text: t2, list: { title: u.title, values: u.values.map(su) } } : { text: t2 }; + } + function Du(e, t2) { + return e === true ? true : e === false ? { value: t2 } : e; + } + function cu(e, t2, u = false) { + return e === false ? false : e === true ? u ? true : [{ value: t2 }] : "value" in e ? [e] : e.length === 0 ? false : e; + } + function Kr(e, t2) { + return typeof e == "string" || "key" in e ? { from: t2, to: e } : "from" in e ? { from: e.from, to: e.to } : { from: t2, to: e.to }; + } + function Et(e, t2) { + return e === void 0 ? [] : Array.isArray(e) ? e.map((u) => Kr(u, t2)) : [Kr(e, t2)]; + } + function fu(e, t2) { + let u = Et(typeof e == "object" && "redirect" in e ? e.redirect : e, t2); + return u.length === 0 ? { remain: t2, redirect: u } : typeof e == "object" && "remain" in e ? { remain: e.remain, redirect: u } : { redirect: u }; + } + function oa(e, t2) { + if (!e) throw new Error(t2); + } + var Ct = class extends S { + constructor(t2) { + super(t2), this._choices = zr(t2.choices.map((u) => u && typeof u == "object" ? u : { value: u }), "value"); } - function inRange(number, start, end) { - start = toFinite(start); - if (end === undefined2) { - end = start; - start = 0; - } else { - end = toFinite(end); - } - number = toNumber(number); - return baseInRange(number, start, end); + expected({ descriptor: t2 }) { + let u = Array.from(this._choices.keys()).map((a2) => this._choices.get(a2)).filter(({ hidden: a2 }) => !a2).map((a2) => a2.value).sort(qr).map(t2.value), r = u.slice(0, -2), o = u.slice(-2); + return { text: r.concat(o.join(" or ")).join(", "), list: { title: "one of the following values", values: u } }; } - function random(lower, upper, floating) { - if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) { - upper = floating = undefined2; - } - if (floating === undefined2) { - if (typeof upper == "boolean") { - floating = upper; - upper = undefined2; - } else if (typeof lower == "boolean") { - floating = lower; - lower = undefined2; - } - } - if (lower === undefined2 && upper === undefined2) { - lower = 0; - upper = 1; - } else { - lower = toFinite(lower); - if (upper === undefined2) { - 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); + validate(t2) { + return this._choices.has(t2); } - var camelCase = createCompounder(function(result2, word, index) { - word = word.toLowerCase(); - return result2 + (index ? capitalize(word) : word); - }); - function capitalize(string2) { - return upperFirst(toString(string2).toLowerCase()); - } - function deburr(string2) { - string2 = toString(string2); - return string2 && string2.replace(reLatin, deburrLetter).replace(reComboMark, ""); - } - function endsWith2(string2, target, position) { - string2 = toString(string2); - target = baseToString(target); - var length = string2.length; - position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length); - var end = position; - position -= target.length; - return position >= 0 && string2.slice(position, end) == target; - } - function escape2(string2) { - string2 = toString(string2); - return string2 && reHasUnescapedHtml.test(string2) ? string2.replace(reUnescapedHtml, escapeHtmlChar) : string2; - } - function escapeRegExp(string2) { - string2 = toString(string2); - return string2 && reHasRegExpChar.test(string2) ? string2.replace(reRegExpChar, "\\$&") : string2; - } - var kebabCase = createCompounder(function(result2, word, index) { - return result2 + (index ? "-" : "") + word.toLowerCase(); - }); - var lowerCase = createCompounder(function(result2, word, index) { - return result2 + (index ? " " : "") + word.toLowerCase(); - }); - var lowerFirst = createCaseFirst("toLowerCase"); - function pad(string2, length, chars) { - string2 = toString(string2); - length = toInteger(length); - var strLength = length ? stringSize(string2) : 0; - if (!length || strLength >= length) { - return string2; - } - var mid = (length - strLength) / 2; - return createPadding(nativeFloor(mid), chars) + string2 + createPadding(nativeCeil(mid), chars); - } - function padEnd(string2, length, chars) { - string2 = toString(string2); - length = toInteger(length); - var strLength = length ? stringSize(string2) : 0; - return length && strLength < length ? string2 + createPadding(length - strLength, chars) : string2; - } - function padStart(string2, length, chars) { - string2 = toString(string2); - length = toInteger(length); - var strLength = length ? stringSize(string2) : 0; - return length && strLength < length ? createPadding(length - strLength, chars) + string2 : string2; - } - function parseInt2(string2, radix, guard) { - if (guard || radix == null) { - radix = 0; - } else if (radix) { - radix = +radix; - } - return nativeParseInt(toString(string2).replace(reTrimStart, ""), radix || 0); - } - function repeat(string2, n, guard) { - if (guard ? isIterateeCall(string2, n, guard) : n === undefined2) { - n = 1; - } else { - n = toInteger(n); - } - return baseRepeat(toString(string2), n); + deprecated(t2) { + let u = this._choices.get(t2); + return u && u.deprecated ? { value: t2 } : false; } - function replace() { - var args = arguments, string2 = toString(args[0]); - return args.length < 3 ? string2 : string2.replace(args[1], args[2]); + forward(t2) { + let u = this._choices.get(t2); + return u ? u.forward : void 0; } - var snakeCase = createCompounder(function(result2, word, index) { - return result2 + (index ? "_" : "") + word.toLowerCase(); - }); - function split(string2, separator, limit) { - if (limit && typeof limit != "number" && isIterateeCall(string2, separator, limit)) { - separator = limit = undefined2; - } - limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0; - if (!limit) { - return []; - } - string2 = toString(string2); - if (string2 && (typeof separator == "string" || separator != null && !isRegExp(separator))) { - separator = baseToString(separator); - if (!separator && hasUnicode(string2)) { - return castSlice(stringToArray(string2), 0, limit); - } - } - return string2.split(separator, limit); + redirect(t2) { + let u = this._choices.get(t2); + return u ? u.redirect : void 0; } - var startCase = createCompounder(function(result2, word, index) { - return result2 + (index ? " " : "") + upperFirst(word); - }); - function startsWith2(string2, target, position) { - string2 = toString(string2); - position = position == null ? 0 : baseClamp(toInteger(position), 0, string2.length); - target = baseToString(target); - return string2.slice(position, position + target.length) == target; - } - function template(string2, options, guard) { - var settings = lodash.templateSettings; - if (guard && isIterateeCall(string2, options, guard)) { - options = undefined2; - } - string2 = toString(string2); - options = assignInWith({}, options, settings, customDefaultsAssignIn); - var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); - var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; - var reDelimiters = RegExp2( - (options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", - "g" - ); - var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n"; - string2.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { - interpolateValue || (interpolateValue = esTemplateValue); - source += string2.slice(index, offset).replace(reUnescapedString, escapeStringChar); - if (escapeValue) { - isEscaping = true; - source += "' +\n__e(" + escapeValue + ") +\n'"; - } - if (evaluateValue) { - isEvaluating = true; - source += "';\n" + evaluateValue + ";\n__p += '"; - } - if (interpolateValue) { - source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; - } - index = offset + match.length; - return match; - }); - source += "';\n"; - var variable = hasOwnProperty.call(options, "variable") && options.variable; - if (!variable) { - source = "with (obj) {\n" + source + "\n}\n"; - } else if (reForbiddenIdentifierChars.test(variable)) { - throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT); - } - source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;"); - source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}"; - var result2 = attempt(function() { - return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues); - }); - result2.source = source; - if (isError(result2)) { - throw result2; - } - return result2; + }; + var ht = class extends S { + expected() { + return "a number"; } - function toLower(value) { - return toString(value).toLowerCase(); + validate(t2, u) { + return typeof t2 == "number"; } - function toUpper(value) { - return toString(value).toUpperCase(); + }; + var gt = class extends ht { + expected() { + return "an integer"; } - function trim(string2, chars, guard) { - string2 = toString(string2); - if (string2 && (guard || chars === undefined2)) { - return baseTrim(string2); - } - if (!string2 || !(chars = baseToString(chars))) { - return string2; - } - var strSymbols = stringToArray(string2), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; - return castSlice(strSymbols, start, end).join(""); + validate(t2, u) { + return u.normalizeValidateResult(super.validate(t2, u), t2) === true && Xr(t2); } - function trimEnd(string2, chars, guard) { - string2 = toString(string2); - if (string2 && (guard || chars === undefined2)) { - return string2.slice(0, trimmedEndIndex(string2) + 1); - } - if (!string2 || !(chars = baseToString(chars))) { - return string2; - } - var strSymbols = stringToArray(string2), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; - return castSlice(strSymbols, 0, end).join(""); + }; + var je = class extends S { + expected() { + return "a string"; } - function trimStart(string2, chars, guard) { - string2 = toString(string2); - if (string2 && (guard || chars === undefined2)) { - return string2.replace(reTrimStart, ""); - } - if (!string2 || !(chars = baseToString(chars))) { - return string2; - } - var strSymbols = stringToArray(string2), start = charsStartIndex(strSymbols, stringToArray(chars)); - return castSlice(strSymbols, start).join(""); + validate(t2) { + return typeof t2 == "string"; } - function truncate(string2, options) { - var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; - if (isObject(options)) { - var separator = "separator" in options ? options.separator : separator; - length = "length" in options ? toInteger(options.length) : length; - omission = "omission" in options ? baseToString(options.omission) : omission; - } - string2 = toString(string2); - var strLength = string2.length; - if (hasUnicode(string2)) { - var strSymbols = stringToArray(string2); - strLength = strSymbols.length; - } - if (length >= strLength) { - return string2; - } - var end = length - stringSize(omission); - if (end < 1) { - return omission; - } - var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string2.slice(0, end); - if (separator === undefined2) { - return result2 + omission; - } - if (strSymbols) { - end += result2.length - end; - } - if (isRegExp(separator)) { - if (string2.slice(end).search(separator)) { - var match, substring = result2; - if (!separator.global) { - separator = RegExp2(separator.source, toString(reFlags.exec(separator)) + "g"); - } - separator.lastIndex = 0; - while (match = separator.exec(substring)) { - var newEnd = match.index; - } - result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd); - } - } else if (string2.indexOf(baseToString(separator), end) != end) { - var index = result2.lastIndexOf(separator); - if (index > -1) { - result2 = result2.slice(0, index); + }; + var Zr = ie, en = lt, tn = jr, un = Lr; + var yt = class { + constructor(t2, u) { + let { logger: r = console, loggerPrintWidth: o = 80, descriptor: n = Zr, unknown: a2 = en, invalid: s = tn, deprecated: i = un, missing: D = () => false, required: f2 = () => false, preprocess: l = (c) => c, postprocess: d = () => Ae } = u || {}; + this._utils = { descriptor: n, logger: r || { warn: () => { + } }, loggerPrintWidth: o, schemas: Gr(t2, "name"), normalizeDefaultResult: iu, normalizeExpectedResult: su, normalizeDeprecatedResult: cu, normalizeForwardResult: Et, normalizeRedirectResult: fu, normalizeValidateResult: Du }, this._unknownHandler = a2, this._invalidHandler = Qr(s), this._deprecatedHandler = i, this._identifyMissing = (c, p) => !(c in p) || D(c, p), this._identifyRequired = f2, this._preprocess = l, this._postprocess = d, this.cleanHistory(); + } + cleanHistory() { + this._hasDeprecationWarned = Jr(); + } + normalize(t2) { + let u = {}, o = [this._preprocess(t2, this._utils)], n = () => { + for (; o.length !== 0; ) { + let a2 = o.shift(), s = this._applyNormalization(a2, u); + o.push(...s); } + }; + n(); + for (let a2 of Object.keys(this._utils.schemas)) { + let s = this._utils.schemas[a2]; + if (!(a2 in u)) { + let i = iu(s.default(this._utils)); + "value" in i && o.push({ [a2]: i.value }); + } + } + n(); + for (let a2 of Object.keys(this._utils.schemas)) { + if (!(a2 in u)) continue; + let s = this._utils.schemas[a2], i = u[a2], D = s.postprocess(i, this._utils); + D !== Ae && (this._applyValidation(D, a2, s), u[a2] = D); + } + return this._applyPostprocess(u), this._applyRequiredCheck(u), u; + } + _applyNormalization(t2, u) { + let r = [], { knownKeys: o, unknownKeys: n } = this._partitionOptionKeys(t2); + for (let a2 of o) { + let s = this._utils.schemas[a2], i = s.preprocess(t2[a2], this._utils); + this._applyValidation(i, a2, s); + let D = ({ from: c, to: p }) => { + r.push(typeof p == "string" ? { [p]: c } : { [p.key]: p.value }); + }, f2 = ({ value: c, redirectTo: p }) => { + let F = cu(s.deprecated(c, this._utils), i, true); + if (F !== false) if (F === true) this._hasDeprecationWarned(a2) || this._utils.logger.warn(this._deprecatedHandler(a2, p, this._utils)); + else for (let { value: C } of F) { + let y = { key: a2, value: C }; + if (!this._hasDeprecationWarned(y)) { + let m = typeof p == "string" ? { key: p, value: C } : p; + this._utils.logger.warn(this._deprecatedHandler(y, m, this._utils)); + } + } + }; + Et(s.forward(i, this._utils), i).forEach(D); + let d = fu(s.redirect(i, this._utils), i); + if (d.redirect.forEach(D), "remain" in d) { + let c = d.remain; + u[a2] = a2 in u ? s.overlap(u[a2], c, this._utils) : c, f2({ value: c }); + } + for (let { from: c, to: p } of d.redirect) f2({ value: c, redirectTo: p }); + } + for (let a2 of n) { + let s = t2[a2]; + this._applyUnknownHandler(a2, s, u, (i, D) => { + r.push({ [i]: D }); + }); } - return result2 + omission; + return r; } - function unescape3(string2) { - string2 = toString(string2); - return string2 && reHasEscapedHtml.test(string2) ? string2.replace(reEscapedHtml, unescapeHtmlChar) : string2; + _applyRequiredCheck(t2) { + for (let u of Object.keys(this._utils.schemas)) if (this._identifyMissing(u, t2) && this._identifyRequired(u)) throw this._invalidHandler(u, ct, this._utils); } - var upperCase = createCompounder(function(result2, word, index) { - return result2 + (index ? " " : "") + word.toUpperCase(); - }); - var upperFirst = createCaseFirst("toUpperCase"); - function words(string2, pattern, guard) { - string2 = toString(string2); - pattern = guard ? undefined2 : pattern; - if (pattern === undefined2) { - return hasUnicodeWord(string2) ? unicodeWords(string2) : asciiWords(string2); - } - return string2.match(pattern) || []; + _partitionOptionKeys(t2) { + let [u, r] = Hr(Object.keys(t2).filter((o) => !this._identifyMissing(o, t2)), (o) => o in this._utils.schemas); + return { knownKeys: u, unknownKeys: r }; } - var attempt = baseRest(function(func, args) { - try { - return apply(func, undefined2, args); - } catch (e) { - return isError(e) ? e : new Error2(e); + _applyValidation(t2, u, r) { + let o = Du(r.validate(t2, this._utils), t2); + if (o !== true) throw this._invalidHandler(u, o.value, this._utils); + } + _applyUnknownHandler(t2, u, r, o) { + let n = this._unknownHandler(t2, u, this._utils); + if (n) for (let a2 of Object.keys(n)) { + if (this._identifyMissing(a2, n)) continue; + let s = n[a2]; + a2 in this._utils.schemas ? o(a2, s) : r[a2] = s; } - }); - var bindAll = flatRest(function(object, methodNames) { - arrayEach(methodNames, function(key) { - key = toKey(key); - baseAssignValue(object, key, bind(object[key], object)); - }); - return object; - }); - function cond(pairs2) { - var length = pairs2 == null ? 0 : pairs2.length, toIteratee = getIteratee(); - pairs2 = !length ? [] : arrayMap(pairs2, function(pair) { - if (typeof pair[1] != "function") { - throw new TypeError2(FUNC_ERROR_TEXT); - } - return [toIteratee(pair[0]), pair[1]]; - }); - return baseRest(function(args) { - var index = -1; - while (++index < length) { - var pair = pairs2[index]; - if (apply(pair[0], this, args)) { - return apply(pair[1], this, args); + } + _applyPostprocess(t2) { + let u = this._postprocess(t2, this._utils); + if (u !== Ae) { + if (u.delete) for (let r of u.delete) delete t2[r]; + if (u.override) { + let { knownKeys: r, unknownKeys: o } = this._partitionOptionKeys(u.override); + for (let n of r) { + let a2 = u.override[n]; + this._applyValidation(a2, n, this._utils.schemas[n]), t2[n] = a2; + } + for (let n of o) { + let a2 = u.override[n]; + this._applyUnknownHandler(n, a2, t2, (s, i) => { + let D = this._utils.schemas[s]; + this._applyValidation(i, s, D), t2[s] = i; + }); } } - }); + } } - function conforms(source) { - return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); + }; + var lu; + function ia(e, t2, { logger: u = false, isCLI: r = false, passThrough: o = false, FlagSchema: n, descriptor: a2 } = {}) { + if (r) { + if (!n) throw new Error("'FlagSchema' option is required."); + if (!a2) throw new Error("'descriptor' option is required."); + } else a2 = ie; + let s = o ? Array.isArray(o) ? (d, c) => o.includes(d) ? { [d]: c } : void 0 : (d, c) => ({ [d]: c }) : (d, c, p) => { + let { _: F, ...C } = p.schemas; + return lt(d, c, { ...p, schemas: C }); + }, i = sa(t2, { isCLI: r, FlagSchema: n }), D = new yt(i, { logger: u, unknown: s, descriptor: a2 }), f2 = u !== false; + f2 && lu && (D._hasDeprecationWarned = lu); + let l = D.normalize(e); + return f2 && (lu = D._hasDeprecationWarned), l; + } + function sa(e, { isCLI: t2, FlagSchema: u }) { + let r = []; + t2 && r.push(pt.create({ name: "_" })); + for (let o of e) r.push(Da(o, { isCLI: t2, optionInfos: e, FlagSchema: u })), o.alias && t2 && r.push(dt.create({ name: o.alias, sourceName: o.name })); + return r; + } + function Da(e, { isCLI: t2, optionInfos: u, FlagSchema: r }) { + let { name: o } = e, n = { name: o }, a2, s = {}; + switch (e.type) { + case "int": + a2 = gt, t2 && (n.preprocess = Number); + break; + case "string": + a2 = je; + break; + case "choice": + a2 = Ct, n.choices = e.choices.map((i) => (i == null ? void 0 : i.redirect) ? { ...i, redirect: { to: { key: e.name, value: i.redirect } } } : i); + break; + case "boolean": + a2 = mt; + break; + case "flag": + a2 = r, n.flags = u.flatMap((i) => [i.alias, i.description && i.name, i.oppositeDescription && `no-${i.name}`].filter(Boolean)); + break; + case "path": + a2 = je; + break; + default: + throw new Error(`Unexpected type ${e.type}`); } - function constant(value) { - return function() { - return value; - }; + if (e.exception ? n.validate = (i, D, f2) => e.exception(i) || D.validate(i, f2) : n.validate = (i, D, f2) => i === void 0 || D.validate(i, f2), e.redirect && (s.redirect = (i) => i ? { to: typeof e.redirect == "string" ? e.redirect : { key: e.redirect.option, value: e.redirect.value } } : void 0), e.deprecated && (s.deprecated = true), t2 && !e.array) { + let i = n.preprocess || ((D) => D); + n.preprocess = (D, f2, l) => f2.preprocess(i(Array.isArray(D) ? b(0, D, -1) : D), l); + } + return e.array ? Ft.create({ ...t2 ? { preprocess: (i) => Array.isArray(i) ? i : [i] } : {}, ...s, valueSchema: a2.create(n) }) : a2.create({ ...n, ...s }); + } + var rn = ia; + var ca = (_d = Array.prototype.findLast) != null ? _d : function(e) { + for (let t2 = this.length - 1; t2 >= 0; t2--) { + let u = this[t2]; + if (e(u, t2, this)) return u; + } + }, fa = X("findLast", function() { + if (Array.isArray(this)) return ca; + }), du = fa; + var nn = /* @__PURE__ */ Symbol.for("PRETTIER_IS_FRONT_MATTER"), pu = []; + function la(e) { + return !!(e == null ? void 0 : e[nn]); + } + var de = la; + var on = /* @__PURE__ */ new Set(["yaml", "toml"]), Ue = ({ node: e }) => de(e) && on.has(e.language); + async function Fu(e, t2, u, r) { + var _a3; + let { node: o } = u, { language: n } = o; + if (!on.has(n)) return; + let a2 = o.value.trim(), s; + if (a2) { + let i = n === "yaml" ? n : Dt(r, { language: n }); + if (!i) return; + s = a2 ? await e(a2, { parser: i }) : ""; + } else s = a2; + return tt([o.startDelimiter, (_a3 = o.explicitLanguage) != null ? _a3 : "", V, s, s ? V : "", o.endDelimiter]); + } + function da(e, t2) { + return Ue({ node: e }) && (delete t2.end, delete t2.raw, delete t2.value), t2; + } + var mu = da; + function pa({ node: e }) { + return e.raw; + } + var Eu = pa; + var an = /* @__PURE__ */ new Set(["tokens", "comments", "parent", "enclosingNode", "precedingNode", "followingNode"]), Fa = (e) => Object.keys(e).filter((t2) => !an.has(t2)); + function ma(e, t2) { + let u = e ? (r) => e(r, an) : Fa; + return t2 ? new Proxy(u, { apply: (r, o, n) => de(n[0]) ? pu : Reflect.apply(r, o, n) }) : u; + } + var Cu = ma; + function gu(e, t2) { + if (!t2) throw new Error("parserName is required."); + let u = du(0, e, (o) => o.parsers && Object.prototype.hasOwnProperty.call(o.parsers, t2)); + if (u) return u; + let r = `Couldn't resolve parser "${t2}".`; + throw r += " Plugins must be explicitly added to the standalone bundle.", new Me(r); + } + function sn(e, t2) { + if (!t2) throw new Error("astFormat is required."); + let u = du(0, e, (o) => o.printers && Object.prototype.hasOwnProperty.call(o.printers, t2)); + if (u) return u; + let r = `Couldn't find plugin for AST format "${t2}".`; + throw r += " Plugins must be explicitly added to the standalone bundle.", new Me(r); + } + function We({ plugins: e, parser: t2 }) { + let u = gu(e, t2); + return yu(u, t2); + } + function yu(e, t2) { + let u = e.parsers[t2]; + return typeof u == "function" ? u() : u; + } + async function Dn(e, t2) { + let u = e.printers[t2], r = typeof u == "function" ? await u() : u; + return Ea(r); + } + var hu = /* @__PURE__ */ new WeakMap(), Q0 = /* @__PURE__ */ Symbol("PRINTER_NORMALIZED_MARK"); + function Ea(e) { + if (hu.has(e)) return hu.get(e); + let { features: t2, getVisitorKeys: u, embed: r, massageAstNode: o, print: n, ...a2 } = e; + t2 = ya(t2); + let s = t2.experimental_frontMatterSupport; + u = Cu(u, s.massageAstNode || s.embed || s.print); + let i = o; + o && s.massageAstNode && (i = new Proxy(o, { apply(d, c, p) { + return mu(...p), Reflect.apply(d, c, p); + } })); + let D = r; + if (r) { + let d; + D = new Proxy(r, { get(c, p, F) { + return p === "getVisitorKeys" ? (d != null ? d : d = r.getVisitorKeys ? Cu(r.getVisitorKeys, s.massageAstNode || s.embed) : u, d) : Reflect.get(c, p, F); + }, apply: (c, p, F) => s.embed && Ue(...F) ? Fu : Reflect.apply(c, p, F) }); + } + let f2 = n; + s.print && (f2 = new Proxy(n, { apply(d, c, p) { + let [F] = p; + return de(F.node) ? Eu(F) : Reflect.apply(d, c, p); + } })); + let l = { features: t2, getVisitorKeys: u, embed: D, massageAstNode: i, print: f2, ...a2 }; + return hu.set(e, l), l; + } + var Ca = ["clean", "embed", "print"], ha = Object.fromEntries(Ca.map((e) => [e, false])); + function ga(e) { + return { ...ha, ...e }; + } + function ya(e) { + return { experimental_avoidAstMutation: false, ...e, experimental_frontMatterSupport: ga(e == null ? void 0 : e.experimental_frontMatterSupport) }; + } + var cn = { astFormat: "estree", printer: {}, originalText: void 0, locStart: null, locEnd: null, getVisitorKeys: null }; + async function ba(e, t2 = {}) { + var _a3; + let u = { ...e }; + if (!u.parser) if (u.filepath) { + if (u.parser = Dt(u, { physicalFile: u.filepath }), !u.parser) throw new Ye(`No parser could be inferred for file "${u.filepath}".`); + } else throw new Ye("No parser and no file path given, couldn't infer a parser."); + let r = st({ plugins: e.plugins, showDeprecated: true }).options, o = { ...cn, ...Object.fromEntries(r.filter((l) => l.default !== void 0).map((l) => [l.name, l.default])) }, n = gu(u.plugins, u.parser), a2 = await yu(n, u.parser); + u.astFormat = a2.astFormat, u.locEnd = a2.locEnd, u.locStart = a2.locStart; + let s = ((_a3 = n.printers) == null ? void 0 : _a3[a2.astFormat]) ? n : sn(u.plugins, a2.astFormat), i = await Dn(s, a2.astFormat); + u.printer = i, u.getVisitorKeys = i.getVisitorKeys; + let D = s.defaultOptions ? Object.fromEntries(Object.entries(s.defaultOptions).filter(([, l]) => l !== void 0)) : {}, f2 = { ...o, ...D }; + for (let [l, d] of Object.entries(f2)) (u[l] === null || u[l] === void 0) && (u[l] = d); + return u.parser === "json" && (u.trailingComma = "none"), rn(u, r, { passThrough: Object.keys(cn), ...t2 }); + } + var se = ba; + var Ff = oo(pn(), 1); + var Au = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC", Fn = "\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65", sf = new RegExp("[" + Au + "]"), Df = new RegExp("[" + Au + Fn + "]"); + Au = Fn = null; + var _u = { keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"], strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"], strictBind: ["eval", "arguments"] }, cf = new Set(_u.keyword), ff = new Set(_u.strict), lf = new Set(_u.strictBind); + var kt = (e, t2) => (u) => e(t2(u)); + function En(e) { + return { keyword: e.cyan, capitalized: e.yellow, jsxIdentifier: e.yellow, punctuator: e.yellow, number: e.magenta, string: e.green, regex: e.magenta, comment: e.gray, invalid: kt(kt(e.white, e.bgRed), e.bold), gutter: e.gray, marker: kt(e.red, e.bold), message: kt(e.red, e.bold), reset: e.reset }; + } + var gf = En(ou(true)), yf = En(ou(false)); + function _a() { + return new Proxy({}, { get: () => (e) => e }); + } + var mn = /\r\n|[\n\r\u2028\u2029]/; + function xa(e, t2, u) { + let r = Object.assign({ column: 0, line: -1 }, e.start), o = Object.assign({}, r, e.end), { linesAbove: n = 2, linesBelow: a2 = 3 } = u || {}, s = r.line, i = r.column, D = o.line, f2 = o.column, l = Math.max(s - (n + 1), 0), d = Math.min(t2.length, D + a2); + s === -1 && (l = 0), D === -1 && (d = t2.length); + let c = D - s, p = {}; + if (c) for (let F = 0; F <= c; F++) { + let C = F + s; + if (!i) p[C] = true; + else if (F === 0) { + let y = t2[C - 1].length; + p[C] = [i, y - i + 1]; + } else if (F === c) p[C] = [0, f2]; + else { + let y = t2[C - F].length; + p[C] = [0, y]; + } + } + else i === f2 ? i ? p[s] = [i, 0] : p[s] = true : p[s] = [i, f2 - i]; + return { start: l, end: d, markerLines: p }; + } + function Cn(e, t2, u = {}) { + let o = _a(false), n = e.split(mn), { start: a2, end: s, markerLines: i } = xa(t2, n, u), D = t2.start && typeof t2.start.column == "number", f2 = String(s).length, d = e.split(mn, s).slice(a2, s).map((c, p) => { + let F = a2 + 1 + p, y = ` ${` ${F}`.slice(-f2)} |`, m = i[F], h = !i[F + 1]; + if (m) { + let E = ""; + if (Array.isArray(m)) { + let g = c.slice(0, Math.max(m[0] - 1, 0)).replace(/[^\t]/g, " "), A2 = m[1] || 1; + E = [` + `, o.gutter(y.replace(/\d/g, " ")), " ", g, o.marker("^").repeat(A2)].join(""), h && u.message && (E += " " + o.message(u.message)); + } + return [o.marker(">"), o.gutter(y), c.length > 0 ? ` ${c}` : "", E].join(""); + } else return ` ${o.gutter(y)}${c.length > 0 ? ` ${c}` : ""}`; + }).join(` +`); + return u.message && !D && (d = `${" ".repeat(f2 + 1)}${u.message} +${d}`), d; + } + async function Ba(e, t2) { + let u = await We(t2), r = u.preprocess ? await u.preprocess(e, t2) : e; + t2.originalText = r; + let o; + try { + o = await u.parse(r, t2, t2); + } catch (n) { + Ta(n, e); } - function defaultTo(value, defaultValue) { - return value == null || value !== value ? defaultValue : value; + return { text: r, ast: o }; + } + function Ta(e, t2) { + let { loc: u } = e; + if (u) { + let r = Cn(t2, u, { highlightCode: true }); + throw e.message += ` +` + r, e.codeFrame = r, e; } - var flow = createFlow(); - var flowRight = createFlow(true); - function identity(value) { - return value; + throw e; + } + var Fe = Ba; + async function hn(e, t2, u, r, o) { + if (u.embeddedLanguageFormatting !== "auto") return; + let { printer: n } = u, { embed: a2 } = n; + if (!a2) return; + if (a2.length > 2) throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/plugins#optional-embed"); + let { hasPrettierIgnore: s } = n, { getVisitorKeys: i } = a2, D = []; + d(); + let f2 = e.stack; + for (let { print: c, node: p, pathStack: F } of D) try { + e.stack = F; + let C = await c(l, t2, e, u); + C && o.set(p, C); + } catch (C) { + if (globalThis.PRETTIER_DEBUG) throw C; + } + e.stack = f2; + function l(c, p) { + return Na(c, p, u, r); } - function iteratee(func) { - return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG)); + function d() { + let { node: c } = e; + if (c === null || typeof c != "object" || (s == null ? void 0 : s(e))) return; + for (let F of i(c)) Array.isArray(c[F]) ? e.each(d, F) : e.call(d, F); + let p = a2(e, u); + if (p) { + if (typeof p == "function") { + D.push({ print: p, node: c, pathStack: [...e.stack] }); + return; + } + o.set(c, p); + } } - function matches(source) { - return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); + } + async function Na(e, t2, u, r) { + let o = await se({ ...u, ...t2, parentParser: u.parser, originalText: e, cursorOffset: void 0, rangeStart: void 0, rangeEnd: void 0 }, { passThrough: true }), { ast: n } = await Fe(e, o), a2 = await r(n, o); + return Qe(a2); + } + function Sa(e, t2, u, r) { + let { originalText: o, [/* @__PURE__ */ Symbol.for("comments")]: n, locStart: a2, locEnd: s, [/* @__PURE__ */ Symbol.for("printedComments")]: i } = t2, { node: D } = e, f2 = a2(D), l = s(D); + for (let c of n) a2(c) >= f2 && s(c) <= l && i.add(c); + let { printPrettierIgnored: d } = t2.printer; + return d ? d(e, t2, u, r) : o.slice(f2, l); + } + var gn = Sa; + async function Ge(e, t2) { + ({ ast: e } = await xu(e, t2)); + let u = /* @__PURE__ */ new Map(), r = new Fr(e), o = Sr(t2), n = /* @__PURE__ */ new Map(); + await hn(r, s, t2, Ge, n); + let a2 = await yn(r, t2, s, void 0, n); + if (Nr(t2), t2.cursorOffset >= 0) { + if (t2.nodeAfterCursor && !t2.nodeBeforeCursor) return [ee, a2]; + if (t2.nodeBeforeCursor && !t2.nodeAfterCursor) return [a2, ee]; } - function matchesProperty(path5, srcValue) { - return baseMatchesProperty(path5, baseClone(srcValue, CLONE_DEEP_FLAG)); + return a2; + function s(D, f2) { + return D === void 0 || D === r ? i(f2) : Array.isArray(D) ? r.call(() => i(f2), ...D) : r.call(() => i(f2), D); + } + function i(D) { + o(r); + let f2 = r.node; + if (f2 == null) return ""; + let l = ge(f2) && D === void 0; + if (l && u.has(f2)) return u.get(f2); + let d = yn(r, t2, s, D, n); + return l && u.set(f2, d), d; + } + } + function yn(e, t2, u, r, o) { + var _a3, _b2; + let { node: n } = e, { printer: a2 } = t2, s; + switch (((_a3 = a2.hasPrettierIgnore) == null ? void 0 : _a3.call(a2, e)) ? s = gn(e, t2, u, r) : o.has(n) ? s = o.get(n) : s = a2.print(e, t2, u, r), n) { + case t2.cursorNode: + s = Ee(s, (i) => [ee, i, ee]); + break; + case t2.nodeBeforeCursor: + s = Ee(s, (i) => [i, ee]); + break; + case t2.nodeAfterCursor: + s = Ee(s, (i) => [ee, i]); + break; } - var method = baseRest(function(path5, args) { - return function(object) { - return baseInvoke(object, path5, args); - }; - }); - var methodOf = baseRest(function(object, args) { - return function(path5) { - return baseInvoke(object, path5, args); - }; - }); - function mixin(object, source, options) { - var props = keys(source), methodNames = baseFunctions(source, props); - if (options == null && !(isObject(source) && (methodNames.length || !props.length))) { - options = source; - source = object; - object = this; - methodNames = baseFunctions(source, keys(source)); - } - var chain2 = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object); - arrayEach(methodNames, function(methodName) { - var func = source[methodName]; - object[methodName] = func; - if (isFunc) { - object.prototype[methodName] = function() { - var chainAll = this.__chain__; - if (chain2 || chainAll) { - var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__); - actions.push({ "func": func, "args": arguments, "thisArg": object }); - result2.__chain__ = chainAll; - return result2; - } - return func.apply(object, arrayPush([this.value()], arguments)); - }; + return a2.printComment && !((_b2 = a2.willPrintOwnComments) == null ? void 0 : _b2.call(a2, e, t2)) && (s = Tr(e, s, t2)), s; + } + async function xu(e, t2) { + var _a3; + let u = (_a3 = e.comments) != null ? _a3 : []; + t2[/* @__PURE__ */ Symbol.for("comments")] = u, t2[/* @__PURE__ */ Symbol.for("printedComments")] = /* @__PURE__ */ new Set(), _r(e, t2); + let { printer: { preprocess: r } } = t2; + return e = r ? await r(e, t2) : e, { ast: e, comments: u }; + } + function wa(e, t2) { + let { cursorOffset: u, locStart: r, locEnd: o, getVisitorKeys: n } = t2, a2 = (c) => r(c) <= u && o(c) >= u, s = e, i = [e]; + for (let c of hr(e, { getVisitorKeys: n, filter: a2 })) i.push(c), s = c; + if (gr(s, { getVisitorKeys: n })) return { cursorNode: s }; + let D, f2, l = -1, d = Number.POSITIVE_INFINITY; + for (; i.length > 0 && (D === void 0 || f2 === void 0); ) { + s = i.pop(); + let c = D !== void 0, p = f2 !== void 0; + for (let F of be(s, { getVisitorKeys: n })) { + if (!c) { + let C = o(F); + C <= u && C > l && (D = F, l = C); + } + if (!p) { + let C = r(F); + C >= u && C < d && (f2 = F, d = C); } - }); - return object; - } - function noConflict() { - if (root._ === this) { - root._ = oldDash; } - return this; - } - function noop() { - } - function nthArg(n) { - n = toInteger(n); - return baseRest(function(args) { - return baseNth(args, n); - }); } - var over = createOver(arrayMap); - var overEvery = createOver(arrayEvery); - var overSome = createOver(arraySome); - function property(path5) { - return isKey(path5) ? baseProperty(toKey(path5)) : basePropertyDeep(path5); + return { nodeBeforeCursor: D, nodeAfterCursor: f2 }; + } + var Bu = wa; + function Oa(e, t2) { + let { printer: u } = t2, r = u.massageAstNode; + if (!r) return e; + let { getVisitorKeys: o } = u, { ignoredProperties: n } = r; + return a2(e); + function a2(s, i) { + if (!ge(s)) return s; + if (Array.isArray(s)) return s.map((d) => a2(d, i)).filter(Boolean); + let D = {}, f2 = new Set(o(s)); + for (let d in s) !Object.prototype.hasOwnProperty.call(s, d) || (n == null ? void 0 : n.has(d)) || (f2.has(d) ? D[d] = a2(s[d], s) : D[d] = s[d]); + let l = r(s, D, i); + if (l !== null) return l != null ? l : D; + } + } + var bn = Oa; + var Pa = (_e2 = Array.prototype.findLastIndex) != null ? _e2 : function(e) { + for (let t2 = this.length - 1; t2 >= 0; t2--) { + let u = this[t2]; + if (e(u, t2, this)) return t2; } - function propertyOf(object) { - return function(path5) { - return object == null ? undefined2 : baseGet(object, path5); - }; + return -1; + }, Ia = X("findLastIndex", function() { + if (Array.isArray(this)) return Pa; + }), An = Ia; + var ka = ({ parser: e }) => e === "json" || e === "json5" || e === "jsonc" || e === "json-stringify"; + function va(e, t2) { + return t2 = new Set(t2), e.find((u) => Bn.has(u.type) && t2.has(u)); + } + function _n(e) { + let t2 = An(0, e, (u) => u.type !== "Program" && u.type !== "File"); + return t2 === -1 ? e : e.slice(0, t2 + 1); + } + function Ra(e, t2, { locStart: u, locEnd: r }) { + let [o, ...n] = e, [a2, ...s] = t2; + if (o === a2) return [o, a2]; + let i = u(o); + for (let f2 of _n(s)) if (u(f2) >= i) a2 = f2; + else break; + let D = r(a2); + for (let f2 of _n(n)) { + if (r(f2) <= D) o = f2; + else break; + if (o === a2) break; } - var range = createRange3(); - var rangeRight = createRange3(true); - function stubArray() { - return []; + return [o, a2]; + } + function Tu(e, t2, u, r, o = [], n) { + let { locStart: a2, locEnd: s } = u, i = a2(e), D = s(e); + if (t2 > D || t2 < i || n === "rangeEnd" && t2 === i || n === "rangeStart" && t2 === D) return; + let f2 = [e, ...o], l = it(e, f2, { cache: uu, locStart: a2, locEnd: s, getVisitorKeys: u.getVisitorKeys, filter: u.printer.canAttachComment, getChildren: u.printer.getCommentChildNodes }); + for (let d of l) { + let c = Tu(d, t2, u, r, f2, n); + if (c) return c; } - function stubFalse() { - return false; + if (r(e, o[0])) return f2; + } + function La(e, t2) { + return t2 !== "DeclareExportDeclaration" && e !== "TypeParameterDeclaration" && (e === "Directive" || e === "TypeAlias" || e === "TSExportAssignment" || e.startsWith("Declare") || e.startsWith("TSDeclare") || e.endsWith("Statement") || e.endsWith("Declaration")); + } + var Bn = /* @__PURE__ */ new Set(["JsonRoot", "ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral", "UnaryExpression", "TemplateLiteral"]), Ma = /* @__PURE__ */ new Set(["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"]); + function xn(e, t2, u) { + if (!t2) return false; + switch (e.parser) { + case "flow": + case "hermes": + case "babel": + case "babel-flow": + case "babel-ts": + case "typescript": + case "acorn": + case "espree": + case "meriyah": + case "oxc": + case "oxc-ts": + case "__babel_estree": + return La(t2.type, u == null ? void 0 : u.type); + case "json": + case "json5": + case "jsonc": + case "json-stringify": + return Bn.has(t2.type); + case "graphql": + return Ma.has(t2.kind); + case "vue": + return t2.tag !== "root"; } - function stubObject() { - return {}; + return false; + } + function Tn(e, t2, u) { + let { rangeStart: r, rangeEnd: o, locStart: n, locEnd: a2 } = t2; + P(o > r); + let s = e.slice(r, o).search(/\S/u), i = s === -1; + if (!i) for (r += s; o > r && !/\S/u.test(e[o - 1]); --o) ; + let D = Tu(u, r, t2, (c, p) => xn(t2, c, p), [], "rangeStart"); + if (!D) return; + let f2 = i ? D : Tu(u, o, t2, (c) => xn(t2, c), [], "rangeEnd"); + if (!f2) return; + let l, d; + if (ka(t2)) { + let c = va(D, f2); + l = c, d = c; + } else [l, d] = Ra(D, f2, t2); + return [Math.min(n(l), n(d)), Math.max(a2(l), a2(d))]; + } + var On = "\uFEFF", Nn = /* @__PURE__ */ Symbol("cursor"); + async function Pn(e, t2, u = 0) { + if (!e || e.trim().length === 0) return { formatted: "", cursorOffset: -1, comments: [] }; + let { ast: r, text: o } = await Fe(e, t2); + t2.cursorOffset >= 0 && (t2 = { ...t2, ...Bu(r, t2) }); + let n = await Ge(r, t2, u); + u > 0 && (n = ut([V, n], u, t2.tabWidth)); + let a2 = Ce(n, t2); + if (u > 0) { + let i = a2.formatted.trim(); + a2.cursorNodeStart !== void 0 && (a2.cursorNodeStart -= a2.formatted.indexOf(i), a2.cursorNodeStart < 0 && (a2.cursorNodeStart = 0, a2.cursorNodeText = a2.cursorNodeText.trimStart()), a2.cursorNodeStart + a2.cursorNodeText.length > i.length && (a2.cursorNodeText = a2.cursorNodeText.trimEnd())), a2.formatted = i + Se(t2.endOfLine); } - function stubString() { - return ""; + let s = t2[/* @__PURE__ */ Symbol.for("comments")]; + if (t2.cursorOffset >= 0) { + let i, D, f2, l; + if ((t2.cursorNode || t2.nodeBeforeCursor || t2.nodeAfterCursor) && a2.cursorNodeText) if (f2 = a2.cursorNodeStart, l = a2.cursorNodeText, t2.cursorNode) i = t2.locStart(t2.cursorNode), D = o.slice(i, t2.locEnd(t2.cursorNode)); + else { + if (!t2.nodeBeforeCursor && !t2.nodeAfterCursor) throw new Error("Cursor location must contain at least one of cursorNode, nodeBeforeCursor, nodeAfterCursor"); + i = t2.nodeBeforeCursor ? t2.locEnd(t2.nodeBeforeCursor) : 0; + let y = t2.nodeAfterCursor ? t2.locStart(t2.nodeAfterCursor) : o.length; + D = o.slice(i, y); + } + else i = 0, D = o, f2 = 0, l = a2.formatted; + let d = t2.cursorOffset - i; + if (D === l) return { formatted: a2.formatted, cursorOffset: f2 + d, comments: s }; + let c = D.split(""); + c.splice(d, 0, Nn); + let p = l.split(""), F = Ut(c, p), C = f2; + for (let y of F) if (y.removed) { + if (y.value.includes(Nn)) break; + } else C += y.count; + return { formatted: a2.formatted, cursorOffset: C, comments: s }; + } + return { formatted: a2.formatted, cursorOffset: -1, comments: s }; + } + async function Ya(e, t2) { + var _a3; + let { ast: u, text: r } = await Fe(e, t2), [o, n] = (_a3 = Tn(r, t2, u)) != null ? _a3 : [0, 0], a2 = r.slice(o, n), s = Math.min(o, r.lastIndexOf(` +`, o) + 1), i = r.slice(s, o).match(/^\s*/u)[0], D = he(i, t2.tabWidth), f2 = await Pn(a2, { ...t2, rangeStart: 0, rangeEnd: Number.POSITIVE_INFINITY, cursorOffset: t2.cursorOffset > o && t2.cursorOffset <= n ? t2.cursorOffset - o : -1, endOfLine: "lf" }, D), l = f2.formatted.trimEnd(), { cursorOffset: d } = t2; + d > n ? d += l.length - a2.length : f2.cursorOffset >= 0 && (d = f2.cursorOffset + o); + let c = r.slice(0, o) + l + r.slice(n); + if (t2.endOfLine !== "lf") { + let p = Se(t2.endOfLine); + d >= 0 && p === `\r +` && (d += $t(c.slice(0, d), ` +`)), c = oe(0, c, ` +`, p); } - function stubTrue() { - return true; + return { formatted: c, cursorOffset: d, comments: f2.comments }; + } + function Nu(e, t2, u) { + return typeof t2 != "number" || Number.isNaN(t2) || t2 < 0 || t2 > e.length ? u : t2; + } + function Sn(e, t2) { + let { cursorOffset: u, rangeStart: r, rangeEnd: o } = t2; + return u = Nu(e, u, -1), r = Nu(e, r, 0), o = Nu(e, o, e.length), { ...t2, cursorOffset: u, rangeStart: r, rangeEnd: o }; + } + function In(e, t2) { + let { cursorOffset: u, rangeStart: r, rangeEnd: o, endOfLine: n } = Sn(e, t2), a2 = e.charAt(0) === On; + if (a2 && (e = e.slice(1), u--, r--, o--), n === "auto" && (n = ju(e)), e.includes("\r")) { + let s = (i) => $t(e.slice(0, Math.max(i, 0)), `\r +`); + u -= s(u), r -= s(r), o -= s(o), e = Uu(e); } - function times(n, iteratee2) { - n = toInteger(n); - if (n < 1 || n > MAX_SAFE_INTEGER) { - return []; - } - var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH); - iteratee2 = getIteratee(iteratee2); - n -= MAX_ARRAY_LENGTH; - var result2 = baseTimes(length, iteratee2); - while (++index < n) { - iteratee2(index); - } - return result2; + return { hasBOM: a2, text: e, options: Sn(e, { ...t2, cursorOffset: u, rangeStart: r, rangeEnd: o, endOfLine: n }) }; + } + async function wn(e, t2) { + let u = await We(t2); + return !u.hasPragma || u.hasPragma(e); + } + async function ja(e, t2) { + var _a3, _b2; + return (_b2 = (_a3 = await We(t2)).hasIgnorePragma) == null ? void 0 : _b2.call(_a3, e); + } + async function Su(e, t2) { + let { hasBOM: u, text: r, options: o } = In(e, await se(t2)); + if (o.rangeStart >= o.rangeEnd && r !== "" || o.requirePragma && !await wn(r, o) || o.checkIgnorePragma && await ja(r, o)) return { formatted: e, cursorOffset: t2.cursorOffset, comments: [] }; + let n; + return o.rangeStart > 0 || o.rangeEnd < r.length ? n = await Ya(r, o) : (!o.requirePragma && o.insertPragma && o.printer.insertPragma && !await wn(r, o) && (r = o.printer.insertPragma(r)), n = await Pn(r, o)), u && (n.formatted = On + n.formatted, n.cursorOffset >= 0 && n.cursorOffset++), n; + } + async function kn(e, t2, u) { + let { text: r, options: o } = In(e, await se(t2)), n = await Fe(r, o); + return u && (u.preprocessForPrint && (n.ast = await xu(n.ast, o)), u.massage && (n.ast = bn(n.ast, o))), n; + } + async function vn(e, t2) { + t2 = await se(t2); + let u = await Ge(e, t2); + return Ce(u, t2); + } + async function Rn(e, t2) { + let u = Dr(e), { formatted: r } = await Su(u, { ...t2, parser: "__js_expression" }); + return r; + } + async function Ln(e, t2) { + t2 = await se(t2); + let { ast: u } = await Fe(e, t2); + return t2.cursorOffset >= 0 && (t2 = { ...t2, ...Bu(u, t2) }), Ge(u, t2); + } + async function Mn(e, t2) { + return Ce(e, await se(t2)); + } + var wu = {}; + Yt(wu, { builders: () => Wa, printer: () => $a, utils: () => Va }); + var Wa = { join: Ie, line: rt, softline: ar, hardline: V, literalline: Ze, group: Kt, conditionalGroup: ur, fill: tr, lineSuffix: ve, lineSuffixBoundary: ir, cursor: ee, breakParent: ce, ifBreak: rr, trim: sr, indent: ae, indentIfBreak: nr, align: De, addAlignmentToDoc: ut, markAsRoot: tt, dedentToRoot: Zu, dedent: er, hardlineWithoutBreakParent: ke, literallineWithoutBreakParent: Gt, label: or, concat: (e) => e }, $a = { printDocToString: Ce }, Va = { willBreak: Gu, traverseDoc: we, findInDoc: qe, mapDoc: Pe, removeLines: Ju, stripTrailingHardline: Qe, replaceEndOfLine: Hu, canBreak: Xu }; + var Yn = "3.8.1"; + var Pu = {}; + Yt(Pu, { addDanglingComment: () => ue, addLeadingComment: () => fe, addTrailingComment: () => le, getAlignmentSize: () => he, getIndentSize: () => jn, getMaxContinuousCount: () => Un, getNextNonSpaceNonCommentCharacter: () => Wn, getNextNonSpaceNonCommentCharacterIndex: () => ni, getPreferredQuote: () => Kn, getStringWidth: () => Re, hasNewline: () => z, hasNewlineInRange: () => Gn, hasSpaces: () => zn, isNextLineEmpty: () => Di, isNextLineEmptyAfterIndex: () => vt, isPreviousLineEmpty: () => ai, makeString: () => si, skip: () => ye, skipEverythingButNewLine: () => at, skipInlineComment: () => xe, skipNewline: () => K, skipSpaces: () => Y, skipToLineEnd: () => ot, skipTrailingComment: () => Be, skipWhitespace: () => mr }); + function Ka(e, t2) { + if (t2 === false) return false; + if (e.charAt(t2) === "/" && e.charAt(t2 + 1) === "*") { + for (let u = t2 + 2; u < e.length; ++u) if (e.charAt(u) === "*" && e.charAt(u + 1) === "/") return u + 2; } - function toPath(value) { - if (isArray(value)) { - return arrayMap(value, toKey); - } - return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); - } - function uniqueId(prefix) { - var id = ++idCounter3; - return toString(prefix) + id; - } - var add = createMathOperation(function(augend, addend) { - return augend + addend; - }, 0); - var ceil = createRound("ceil"); - var divide = createMathOperation(function(dividend, divisor) { - return dividend / divisor; - }, 1); - var floor = createRound("floor"); - function max(array) { - return array && array.length ? baseExtremum(array, identity, baseGt) : undefined2; - } - function maxBy(array, iteratee2) { - return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseGt) : undefined2; - } - function mean(array) { - return baseMean(array, identity); - } - function meanBy(array, iteratee2) { - return baseMean(array, getIteratee(iteratee2, 2)); - } - function min(array) { - return array && array.length ? baseExtremum(array, identity, baseLt) : undefined2; - } - function minBy(array, iteratee2) { - return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseLt) : undefined2; - } - var multiply = createMathOperation(function(multiplier, multiplicand) { - return multiplier * multiplicand; - }, 1); - var round = createRound("round"); - var subtract = createMathOperation(function(minuend, subtrahend) { - return minuend - subtrahend; - }, 0); - function sum(array) { - return array && array.length ? baseSum(array, identity) : 0; - } - function sumBy(array, iteratee2) { - return array && array.length ? baseSum(array, getIteratee(iteratee2, 2)) : 0; - } - lodash.after = after; - lodash.ary = ary; - lodash.assign = assign; - lodash.assignIn = assignIn; - lodash.assignInWith = assignInWith; - lodash.assignWith = assignWith; - lodash.at = at; - lodash.before = before; - lodash.bind = bind; - lodash.bindAll = bindAll; - lodash.bindKey = bindKey; - lodash.castArray = castArray; - lodash.chain = chain; - lodash.chunk = chunk; - lodash.compact = compact; - lodash.concat = concat; - lodash.cond = cond; - lodash.conforms = conforms; - lodash.constant = constant; - lodash.countBy = countBy; - lodash.create = create; - lodash.curry = curry; - lodash.curryRight = curryRight; - lodash.debounce = debounce; - lodash.defaults = defaults; - lodash.defaultsDeep = defaultsDeep; - lodash.defer = defer; - lodash.delay = delay; - lodash.difference = difference; - lodash.differenceBy = differenceBy; - lodash.differenceWith = differenceWith; - lodash.drop = drop; - lodash.dropRight = dropRight; - lodash.dropRightWhile = dropRightWhile; - lodash.dropWhile = dropWhile; - lodash.fill = fill; - lodash.filter = filter; - lodash.flatMap = flatMap; - lodash.flatMapDeep = flatMapDeep; - lodash.flatMapDepth = flatMapDepth; - lodash.flatten = flatten; - lodash.flattenDeep = flattenDeep; - lodash.flattenDepth = flattenDepth; - lodash.flip = flip; - lodash.flow = flow; - lodash.flowRight = flowRight; - lodash.fromPairs = fromPairs; - lodash.functions = functions; - lodash.functionsIn = functionsIn; - lodash.groupBy = groupBy; - lodash.initial = initial; - lodash.intersection = intersection; - lodash.intersectionBy = intersectionBy; - lodash.intersectionWith = intersectionWith; - lodash.invert = invert; - lodash.invertBy = invertBy; - lodash.invokeMap = invokeMap; - lodash.iteratee = iteratee; - lodash.keyBy = keyBy; - lodash.keys = keys; - lodash.keysIn = keysIn; - lodash.map = map2; - lodash.mapKeys = mapKeys; - lodash.mapValues = mapValues; - lodash.matches = matches; - lodash.matchesProperty = matchesProperty; - lodash.memoize = memoize; - lodash.merge = merge2; - lodash.mergeWith = mergeWith; - lodash.method = method; - lodash.methodOf = methodOf; - lodash.mixin = mixin; - lodash.negate = negate; - lodash.nthArg = nthArg; - lodash.omit = omit; - lodash.omitBy = omitBy; - lodash.once = once; - lodash.orderBy = orderBy; - lodash.over = over; - lodash.overArgs = overArgs; - lodash.overEvery = overEvery; - lodash.overSome = overSome; - lodash.partial = partial; - lodash.partialRight = partialRight; - lodash.partition = partition; - lodash.pick = pick; - lodash.pickBy = pickBy; - lodash.property = property; - lodash.propertyOf = propertyOf; - lodash.pull = pull; - lodash.pullAll = pullAll; - lodash.pullAllBy = pullAllBy; - lodash.pullAllWith = pullAllWith; - lodash.pullAt = pullAt; - lodash.range = range; - lodash.rangeRight = rangeRight; - lodash.rearg = rearg; - lodash.reject = reject; - lodash.remove = remove; - lodash.rest = rest; - lodash.reverse = reverse; - lodash.sampleSize = sampleSize; - lodash.set = set2; - lodash.setWith = setWith; - lodash.shuffle = shuffle; - lodash.slice = slice; - lodash.sortBy = sortBy; - lodash.sortedUniq = sortedUniq; - lodash.sortedUniqBy = sortedUniqBy; - lodash.split = split; - lodash.spread = spread; - lodash.tail = tail; - lodash.take = take; - lodash.takeRight = takeRight; - lodash.takeRightWhile = takeRightWhile; - lodash.takeWhile = takeWhile; - lodash.tap = tap; - lodash.throttle = throttle; - lodash.thru = thru; - lodash.toArray = toArray; - lodash.toPairs = toPairs; - lodash.toPairsIn = toPairsIn; - lodash.toPath = toPath; - lodash.toPlainObject = toPlainObject; - lodash.transform = transform; - lodash.unary = unary; - lodash.union = union; - lodash.unionBy = unionBy; - lodash.unionWith = unionWith; - lodash.uniq = uniq; - lodash.uniqBy = uniqBy; - lodash.uniqWith = uniqWith; - lodash.unset = unset; - lodash.unzip = unzip; - lodash.unzipWith = unzipWith; - lodash.update = update; - lodash.updateWith = updateWith; - lodash.values = values; - lodash.valuesIn = valuesIn; - lodash.without = without; - lodash.words = words; - lodash.wrap = wrap; - lodash.xor = xor; - lodash.xorBy = xorBy; - lodash.xorWith = xorWith; - lodash.zip = zip; - lodash.zipObject = zipObject; - lodash.zipObjectDeep = zipObjectDeep; - lodash.zipWith = zipWith; - lodash.entries = toPairs; - lodash.entriesIn = toPairsIn; - lodash.extend = assignIn; - lodash.extendWith = assignInWith; - mixin(lodash, lodash); - lodash.add = add; - lodash.attempt = attempt; - lodash.camelCase = camelCase; - lodash.capitalize = capitalize; - lodash.ceil = ceil; - lodash.clamp = clamp; - lodash.clone = clone; - lodash.cloneDeep = cloneDeep2; - lodash.cloneDeepWith = cloneDeepWith; - lodash.cloneWith = cloneWith; - lodash.conformsTo = conformsTo; - lodash.deburr = deburr; - lodash.defaultTo = defaultTo; - lodash.divide = divide; - lodash.endsWith = endsWith2; - lodash.eq = eq; - lodash.escape = escape2; - lodash.escapeRegExp = escapeRegExp; - lodash.every = every; - lodash.find = find; - lodash.findIndex = findIndex; - lodash.findKey = findKey; - lodash.findLast = findLast; - lodash.findLastIndex = findLastIndex; - lodash.findLastKey = findLastKey; - lodash.floor = floor; - lodash.forEach = forEach; - lodash.forEachRight = forEachRight; - lodash.forIn = forIn; - lodash.forInRight = forInRight; - lodash.forOwn = forOwn; - lodash.forOwnRight = forOwnRight; - lodash.get = get; - lodash.gt = gt; - lodash.gte = gte; - lodash.has = has; - lodash.hasIn = hasIn; - lodash.head = head; - lodash.identity = identity; - lodash.includes = includes; - lodash.indexOf = indexOf2; - lodash.inRange = inRange; - lodash.invoke = invoke; - lodash.isArguments = isArguments; - lodash.isArray = isArray; - lodash.isArrayBuffer = isArrayBuffer; - lodash.isArrayLike = isArrayLike; - lodash.isArrayLikeObject = isArrayLikeObject; - lodash.isBoolean = isBoolean3; - lodash.isBuffer = isBuffer; - lodash.isDate = isDate; - lodash.isElement = isElement; - lodash.isEmpty = isEmpty2; - lodash.isEqual = isEqual; - lodash.isEqualWith = isEqualWith; - lodash.isError = isError; - lodash.isFinite = isFinite2; - lodash.isFunction = isFunction; - lodash.isInteger = isInteger; - lodash.isLength = isLength; - lodash.isMap = isMap2; - lodash.isMatch = isMatch; - lodash.isMatchWith = isMatchWith; - lodash.isNaN = isNaN2; - lodash.isNative = isNative; - lodash.isNil = isNil; - lodash.isNull = isNull; - lodash.isNumber = isNumber3; - lodash.isObject = isObject; - lodash.isObjectLike = isObjectLike; - lodash.isPlainObject = isPlainObject; - lodash.isRegExp = isRegExp; - lodash.isSafeInteger = isSafeInteger; - lodash.isSet = isSet; - lodash.isString = isString3; - lodash.isSymbol = isSymbol; - lodash.isTypedArray = isTypedArray; - lodash.isUndefined = isUndefined; - lodash.isWeakMap = isWeakMap; - lodash.isWeakSet = isWeakSet; - lodash.join = join; - lodash.kebabCase = kebabCase; - lodash.last = last; - lodash.lastIndexOf = lastIndexOf; - lodash.lowerCase = lowerCase; - lodash.lowerFirst = lowerFirst; - lodash.lt = lt; - lodash.lte = lte; - lodash.max = max; - lodash.maxBy = maxBy; - lodash.mean = mean; - lodash.meanBy = meanBy; - lodash.min = min; - lodash.minBy = minBy; - lodash.stubArray = stubArray; - lodash.stubFalse = stubFalse; - lodash.stubObject = stubObject; - lodash.stubString = stubString; - lodash.stubTrue = stubTrue; - lodash.multiply = multiply; - lodash.nth = nth; - lodash.noConflict = noConflict; - lodash.noop = noop; - lodash.now = now; - lodash.pad = pad; - lodash.padEnd = padEnd; - lodash.padStart = padStart; - lodash.parseInt = parseInt2; - lodash.random = random; - lodash.reduce = reduce; - lodash.reduceRight = reduceRight; - lodash.repeat = repeat; - lodash.replace = replace; - lodash.result = result; - lodash.round = round; - lodash.runInContext = runInContext2; - lodash.sample = sample; - lodash.size = size; - lodash.snakeCase = snakeCase; - lodash.some = some; - lodash.sortedIndex = sortedIndex; - lodash.sortedIndexBy = sortedIndexBy; - lodash.sortedIndexOf = sortedIndexOf; - lodash.sortedLastIndex = sortedLastIndex; - lodash.sortedLastIndexBy = sortedLastIndexBy; - lodash.sortedLastIndexOf = sortedLastIndexOf; - lodash.startCase = startCase; - lodash.startsWith = startsWith2; - lodash.subtract = subtract; - lodash.sum = sum; - lodash.sumBy = sumBy; - lodash.template = template; - lodash.times = times; - lodash.toFinite = toFinite; - lodash.toInteger = toInteger; - lodash.toLength = toLength; - lodash.toLower = toLower; - lodash.toNumber = toNumber; - lodash.toSafeInteger = toSafeInteger; - lodash.toString = toString; - lodash.toUpper = toUpper; - lodash.trim = trim; - lodash.trimEnd = trimEnd; - lodash.trimStart = trimStart; - lodash.truncate = truncate; - lodash.unescape = unescape3; - lodash.uniqueId = uniqueId; - lodash.upperCase = upperCase; - lodash.upperFirst = upperFirst; - lodash.each = forEach; - lodash.eachRight = forEachRight; - lodash.first = head; - mixin(lodash, (function() { - var source = {}; - baseForOwn(lodash, function(func, methodName) { - if (!hasOwnProperty.call(lodash.prototype, methodName)) { - source[methodName] = func; - } - }); - return source; - })(), { "chain": false }); - lodash.VERSION = VERSION; - arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) { - lodash[methodName].placeholder = lodash; - }); - arrayEach(["drop", "take"], function(methodName, index) { - LazyWrapper.prototype[methodName] = function(n) { - n = n === undefined2 ? 1 : nativeMax(toInteger(n), 0); - var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone(); - if (result2.__filtered__) { - result2.__takeCount__ = nativeMin(n, result2.__takeCount__); - } else { - result2.__views__.push({ - "size": nativeMin(n, MAX_ARRAY_LENGTH), - "type": methodName + (result2.__dir__ < 0 ? "Right" : "") - }); - } - return result2; - }; - LazyWrapper.prototype[methodName + "Right"] = function(n) { - return this.reverse()[methodName](n).reverse(); - }; - }); - arrayEach(["filter", "map", "takeWhile"], function(methodName, index) { - var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; - LazyWrapper.prototype[methodName] = function(iteratee2) { - var result2 = this.clone(); - result2.__iteratees__.push({ - "iteratee": getIteratee(iteratee2, 3), - "type": type - }); - result2.__filtered__ = result2.__filtered__ || isFilter; - return result2; - }; - }); - arrayEach(["head", "last"], function(methodName, index) { - var takeName = "take" + (index ? "Right" : ""); - LazyWrapper.prototype[methodName] = function() { - return this[takeName](1).value()[0]; - }; - }); - arrayEach(["initial", "tail"], function(methodName, index) { - var dropName = "drop" + (index ? "" : "Right"); - LazyWrapper.prototype[methodName] = function() { - return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); - }; - }); - LazyWrapper.prototype.compact = function() { - return this.filter(identity); - }; - LazyWrapper.prototype.find = function(predicate) { - return this.filter(predicate).head(); - }; - LazyWrapper.prototype.findLast = function(predicate) { - return this.reverse().find(predicate); - }; - LazyWrapper.prototype.invokeMap = baseRest(function(path5, args) { - if (typeof path5 == "function") { - return new LazyWrapper(this); - } - return this.map(function(value) { - return baseInvoke(value, path5, args); - }); - }); - LazyWrapper.prototype.reject = function(predicate) { - return this.filter(negate(getIteratee(predicate))); - }; - LazyWrapper.prototype.slice = function(start, end) { - start = toInteger(start); - var result2 = this; - if (result2.__filtered__ && (start > 0 || end < 0)) { - return new LazyWrapper(result2); - } - if (start < 0) { - result2 = result2.takeRight(-start); - } else if (start) { - result2 = result2.drop(start); - } - if (end !== undefined2) { - end = toInteger(end); - result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start); - } - return result2; - }; - LazyWrapper.prototype.takeRightWhile = function(predicate) { - return this.reverse().takeWhile(predicate).reverse(); - }; - LazyWrapper.prototype.toArray = function() { - return this.take(MAX_ARRAY_LENGTH); + return t2; + } + var xe = Ka; + function Ga(e, t2) { + return t2 === false ? false : e.charAt(t2) === "/" && e.charAt(t2 + 1) === "/" ? at(e, t2) : t2; + } + var Be = Ga; + function za(e, t2) { + let u = null, r = t2; + for (; r !== u; ) u = r, r = Y(e, r), r = xe(e, r), r = Be(e, r), r = K(e, r); + return r; + } + var ze = za; + function Ja(e, t2) { + let u = null, r = t2; + for (; r !== u; ) u = r, r = ot(e, r), r = xe(e, r), r = Y(e, r); + return r = Be(e, r), r = K(e, r), r !== false && z(e, r); + } + var vt = Ja; + function Ha(e, t2) { + let u = e.lastIndexOf(` +`); + return u === -1 ? 0 : he(e.slice(u + 1).match(/^[\t ]*/u)[0], t2); + } + var jn = Ha; + function Ou(e) { + if (typeof e != "string") throw new TypeError("Expected a string"); + return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"); + } + function Xa(e, t2) { + let u = e.matchAll(new RegExp(`(?:${Ou(t2)})+`, "gu")); + return u.reduce || (u = [...u]), u.reduce((r, [o]) => Math.max(r, o.length), 0) / t2.length; + } + var Un = Xa; + function qa(e, t2) { + let u = ze(e, t2); + return u === false ? "" : e.charAt(u); + } + var Wn = qa; + var $n = Object.freeze({ character: "'", codePoint: 39 }), Vn = Object.freeze({ character: '"', codePoint: 34 }), Qa = Object.freeze({ preferred: $n, alternate: Vn }), Za = Object.freeze({ preferred: Vn, alternate: $n }); + function ei(e, t2) { + let { preferred: u, alternate: r } = t2 === true || t2 === "'" ? Qa : Za, { length: o } = e, n = 0, a2 = 0; + for (let s = 0; s < o; s++) { + let i = e.charCodeAt(s); + i === u.codePoint ? n++ : i === r.codePoint && a2++; + } + return (n > a2 ? r : u).character; + } + var Kn = ei; + function ti(e, t2, u) { + for (let r = t2; r < u; ++r) if (e.charAt(r) === ` +`) return true; + return false; + } + var Gn = ti; + function ui(e, t2, u = {}) { + return Y(e, u.backwards ? t2 - 1 : t2, u) !== t2; + } + var zn = ui; + function ri(e, t2, u) { + return ze(e, u(t2)); + } + function ni(e, t2) { + return arguments.length === 2 || typeof t2 == "number" ? ze(e, t2) : ri(...arguments); + } + function oi(e, t2, u) { + return Le(e, u(t2)); + } + function ai(e, t2) { + return arguments.length === 2 || typeof t2 == "number" ? Le(e, t2) : oi(...arguments); + } + function ii(e, t2, u) { + return vt(e, u(t2)); + } + function si(e, t2, u) { + let r = t2 === '"' ? "'" : '"', n = oe(0, e, /\\(.)|(["'])/gsu, (a2, s, i) => s === r ? s : i === t2 ? "\\" + i : i || (u && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(s) ? s : "\\" + s)); + return t2 + n + t2; + } + function Di(e, t2) { + return arguments.length === 2 || typeof t2 == "number" ? vt(e, t2) : ii(...arguments); + } + function me(e, t2 = 1) { + return async (...u) => { + var _a3, _b2; + let r = (_a3 = u[t2]) != null ? _a3 : {}, o = (_b2 = r.plugins) != null ? _b2 : []; + return u[t2] = { ...r, plugins: Array.isArray(o) ? o : Object.values(o) }, e(...u); }; - baseForOwn(LazyWrapper.prototype, function(func, methodName) { - var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName); - if (!lodashFunc) { - return; - } - lodash.prototype[methodName] = function() { - var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray(value); - var interceptor = function(value2) { - var result3 = lodashFunc.apply(lodash, arrayPush([value2], args)); - return isTaker && chainAll ? result3[0] : result3; - }; - if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) { - isLazy = useLazy = false; - } - var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid; - if (!retUnwrapped && useLazy) { - value = onlyLazy ? value : new LazyWrapper(this); - var result2 = func.apply(value, args); - result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 }); - return new LodashWrapper(result2, chainAll); - } - if (isUnwrapped && onlyLazy) { - return func.apply(this, args); - } - result2 = this.thru(interceptor); - return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2; - }; - }); - arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) { - var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName); - lodash.prototype[methodName] = function() { - var args = arguments; - if (retUnwrapped && !this.__chain__) { - var value = this.value(); - return func.apply(isArray(value) ? value : [], args); - } - return this[chainName](function(value2) { - return func.apply(isArray(value2) ? value2 : [], args); - }); - }; - }); - baseForOwn(LazyWrapper.prototype, function(func, methodName) { - var lodashFunc = lodash[methodName]; - if (lodashFunc) { - var key = lodashFunc.name + ""; - if (!hasOwnProperty.call(realNames, key)) { - realNames[key] = []; - } - realNames[key].push({ "name": methodName, "func": lodashFunc }); - } - }); - realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{ - "name": "wrapper", - "func": undefined2 - }]; - LazyWrapper.prototype.clone = lazyClone; - LazyWrapper.prototype.reverse = lazyReverse; - LazyWrapper.prototype.value = lazyValue; - lodash.prototype.at = wrapperAt; - lodash.prototype.chain = wrapperChain; - lodash.prototype.commit = wrapperCommit; - lodash.prototype.next = wrapperNext; - lodash.prototype.plant = wrapperPlant; - lodash.prototype.reverse = wrapperReverse; - lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; - lodash.prototype.first = lodash.prototype.head; - if (symIterator) { - lodash.prototype[symIterator] = wrapperToIterator; - } - return lodash; - }); - var _2 = runInContext(); - if (typeof define == "function" && typeof define.amd == "object" && define.amd) { - root._ = _2; - define(function() { - return _2; - }); - } else if (freeModule) { - (freeModule.exports = _2)._ = _2; - freeExports._ = _2; - } else { - root._ = _2; } - }).call(exports); + var Jn = me(Su); + async function Hn(e, t2) { + let { formatted: u } = await Jn(e, { ...t2, cursorOffset: -1 }); + return u; + } + async function ci(e, t2) { + return await Hn(e, t2) === e; + } + var fi = me(st, 0), li = { parse: me(kn), formatAST: me(vn), formatDoc: me(Rn), printToDoc: me(Ln), printDocToString: me(Mn) }; + return ao(di); + }); } }); @@ -25152,28 +21311,28 @@ var require_messages = __commonJS({ Object.defineProperty(exports, "__esModule", { value: true }); exports.Message = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType = exports.RequestType0 = exports.AbstractMessageSignature = exports.ParameterStructures = exports.ResponseError = exports.ErrorCodes = void 0; var is = require_is(); - var ErrorCodes; - (function(ErrorCodes2) { - ErrorCodes2.ParseError = -32700; - ErrorCodes2.InvalidRequest = -32600; - ErrorCodes2.MethodNotFound = -32601; - ErrorCodes2.InvalidParams = -32602; - ErrorCodes2.InternalError = -32603; - ErrorCodes2.jsonrpcReservedErrorRangeStart = -32099; - ErrorCodes2.serverErrorStart = -32099; - ErrorCodes2.MessageWriteError = -32099; - ErrorCodes2.MessageReadError = -32098; - ErrorCodes2.PendingResponseRejected = -32097; - ErrorCodes2.ConnectionInactive = -32096; - ErrorCodes2.ServerNotInitialized = -32002; - ErrorCodes2.UnknownErrorCode = -32001; - ErrorCodes2.jsonrpcReservedErrorRangeEnd = -32e3; - ErrorCodes2.serverErrorEnd = -32e3; - })(ErrorCodes || (exports.ErrorCodes = ErrorCodes = {})); - var ResponseError = class _ResponseError extends Error { + var ErrorCodes2; + (function(ErrorCodes3) { + ErrorCodes3.ParseError = -32700; + ErrorCodes3.InvalidRequest = -32600; + ErrorCodes3.MethodNotFound = -32601; + ErrorCodes3.InvalidParams = -32602; + ErrorCodes3.InternalError = -32603; + ErrorCodes3.jsonrpcReservedErrorRangeStart = -32099; + ErrorCodes3.serverErrorStart = -32099; + ErrorCodes3.MessageWriteError = -32099; + ErrorCodes3.MessageReadError = -32098; + ErrorCodes3.PendingResponseRejected = -32097; + ErrorCodes3.ConnectionInactive = -32096; + ErrorCodes3.ServerNotInitialized = -32002; + ErrorCodes3.UnknownErrorCode = -32001; + ErrorCodes3.jsonrpcReservedErrorRangeEnd = -32e3; + ErrorCodes3.serverErrorEnd = -32e3; + })(ErrorCodes2 || (exports.ErrorCodes = ErrorCodes2 = {})); + var ResponseError2 = class _ResponseError extends Error { constructor(code, message, data) { super(message); - this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode; + this.code = is.number(code) ? code : ErrorCodes2.UnknownErrorCode; this.data = data; Object.setPrototypeOf(this, _ResponseError.prototype); } @@ -25188,7 +21347,7 @@ var require_messages = __commonJS({ return result; } }; - exports.ResponseError = ResponseError; + exports.ResponseError = ResponseError2; var ParameterStructures = class _ParameterStructures { constructor(kind) { this.kind = kind; @@ -26780,7 +22939,7 @@ var require_connection = __commonJS({ var CancellationReceiverStrategy; (function(CancellationReceiverStrategy2) { CancellationReceiverStrategy2.Message = Object.freeze({ - createCancellationTokenSource(_2) { + createCancellationTokenSource(_) { return new cancellation_1.CancellationTokenSource(); } }); @@ -26795,7 +22954,7 @@ var require_connection = __commonJS({ sendCancellation(conn, id) { return conn.sendNotification(CancelNotification.type, { id }); }, - cleanup(_2) { + cleanup(_) { } }); function is(value) { @@ -31836,6 +27995,15 @@ var require_main3 = __commonJS({ } }); +// ../../node_modules/yaml-language-server/lib/esm/languageservice/jsonSchema.js +var SchemaDialect; +(function(SchemaDialect2) { + SchemaDialect2["draft04"] = "draft04"; + SchemaDialect2["draft07"] = "draft07"; + SchemaDialect2["draft2019"] = "draft2019-09"; + SchemaDialect2["draft2020"] = "draft2020-12"; +})(SchemaDialect || (SchemaDialect = {})); + // ../../node_modules/jsonc-parser/lib/esm/impl/scanner.js function createScanner(text, ignoreTrivia = false) { const len = text.length; @@ -32258,30 +28426,30 @@ var CharacterCodes; })(CharacterCodes || (CharacterCodes = {})); // ../../node_modules/jsonc-parser/lib/esm/impl/string-intern.js -var cachedSpaces = new Array(20).fill(0).map((_2, index) => { +var cachedSpaces = new Array(20).fill(0).map((_, index) => { return " ".repeat(index); }); var maxCachedValues = 200; var cachedBreakLinesWithSpaces = { " ": { - "\n": new Array(maxCachedValues).fill(0).map((_2, index) => { + "\n": new Array(maxCachedValues).fill(0).map((_, index) => { return "\n" + " ".repeat(index); }), - "\r": new Array(maxCachedValues).fill(0).map((_2, index) => { + "\r": new Array(maxCachedValues).fill(0).map((_, index) => { return "\r" + " ".repeat(index); }), - "\r\n": new Array(maxCachedValues).fill(0).map((_2, index) => { + "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => { return "\r\n" + " ".repeat(index); }) }, " ": { - "\n": new Array(maxCachedValues).fill(0).map((_2, index) => { + "\n": new Array(maxCachedValues).fill(0).map((_, index) => { return "\n" + " ".repeat(index); }), - "\r": new Array(maxCachedValues).fill(0).map((_2, index) => { + "\r": new Array(maxCachedValues).fill(0).map((_, index) => { return "\r" + " ".repeat(index); }), - "\r\n": new Array(maxCachedValues).fill(0).map((_2, index) => { + "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => { return "\r\n" + " ".repeat(index); }) } @@ -33070,18 +29238,18 @@ var LIB; return t3.match(A2) ? t3.replace(A2, ((t4) => C(t4))) : t3; } var x = r(975); - const P = x.posix || x, _2 = "/"; + const P = x.posix || x, _ = "/"; var I; !(function(t3) { t3.joinPath = function(t4, ...e2) { return t4.with({ path: P.join(t4.path, ...e2) }); }, t3.resolvePath = function(t4, ...e2) { let r2 = t4.path, n2 = false; - r2[0] !== _2 && (r2 = _2 + r2, n2 = true); + r2[0] !== _ && (r2 = _ + r2, n2 = true); let i2 = P.resolve(r2, ...e2); - return n2 && i2[0] === _2 && !t4.authority && (i2 = i2.substring(1)), t4.with({ path: i2 }); + return n2 && i2[0] === _ && !t4.authority && (i2 = i2.substring(1)), t4.with({ path: i2 }); }, t3.dirname = function(t4) { - if (0 === t4.path.length || t4.path === _2) return t4; + if (0 === t4.path.length || t4.path === _) return t4; let e2 = P.dirname(t4.path); return 1 === e2.length && 46 === e2.charCodeAt(0) && (e2 = ""), t4.with({ path: e2 }); }, t3.basename = function(t4) { @@ -34935,7 +31103,7 @@ var JSONSchemaService = ( } return _this.promise.all(openPromises); }; - return resolveRefs(schema4, schema4, schemaURL, dependencies).then(function(_2) { + return resolveRefs(schema4, schema4, schemaURL, dependencies).then(function(_) { return new ResolvedSchema(schema4, resolveErrors); }); }; @@ -35094,42 +31262,6 @@ function format3(template, values) { }); } -// ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/strings.js -function convertSimple2RegExpPattern(pattern) { - return pattern.replace(/[-\\{}+?|^$.,[\]()#\s]/g, "\\$&").replace(/[*]/g, ".*"); -} -function getIndentation(lineContent, position) { - if (lineContent.length < position) { - return 0; - } - for (let i = 0; i < position; i++) { - const char = lineContent.charCodeAt(i); - if (char !== 32 && char !== 9) { - return i; - } - } - return position; -} -function safeCreateUnicodeRegExp(pattern) { - try { - return new RegExp(pattern, "u"); - } catch (ignore) { - return new RegExp(pattern); - } -} -function getFirstNonWhitespaceCharacterAfterOffset(str, offset) { - offset++; - for (let i = offset; i < str.length; i++) { - const char = str.charAt(i); - if (char === " " || char === " ") { - offset++; - } else { - return offset; - } - } - return offset; -} - // ../../node_modules/yaml-language-server/lib/esm/languageservice/services/yamlSchemaService.js var path2 = __toESM(require_path_browserify()); @@ -36740,7 +32872,7 @@ var Pair = class _Pair { value = value.clone(schema4); return new _Pair(key, value); } - toJSON(_2, ctx) { + toJSON(_, ctx) { const pair = (ctx == null ? void 0 : ctx.mapAsMap) ? /* @__PURE__ */ new Map() : {}; return addPairToJSMap(ctx, pair, this); } @@ -36991,7 +33123,7 @@ var YAMLMap = class extends Collection { * @param {Class} Type - If set, forces the returned collection type * @returns Instance of Type, Map, or Object */ - toJSON(_2, ctx, Type) { + toJSON(_, ctx, Type) { const map2 = Type ? new Type() : (ctx == null ? void 0 : ctx.mapAsMap) ? /* @__PURE__ */ new Map() : {}; if (ctx == null ? void 0 : ctx.onCreate) ctx.onCreate(map2); @@ -37093,7 +33225,7 @@ var YAMLSeq = class extends Collection { else this.items[idx] = value; } - toJSON(_2, ctx) { + toJSON(_, ctx) { const seq2 = []; if (ctx == null ? void 0 : ctx.onCreate) ctx.onCreate(seq2); @@ -37492,9 +33624,9 @@ var YAMLOMap = class _YAMLOMap extends YAMLSeq { * If `ctx` is given, the return type is actually `Map`, * but TypeScript won't allow widening the signature of a child method. */ - toJSON(_2, ctx) { + toJSON(_, ctx) { if (!ctx) - return super.toJSON(_2); + return super.toJSON(_); const map2 = /* @__PURE__ */ new Map(); if (ctx == null ? void 0 : ctx.onCreate) ctx.onCreate(map2); @@ -37711,8 +33843,8 @@ var YAMLSet = class _YAMLSet extends YAMLMap { this.items.push(new Pair(key)); } } - toJSON(_2, ctx) { - return super.toJSON(_2, ctx, Set); + toJSON(_, ctx) { + return super.toJSON(_, ctx, Set); } toString(ctx, onComment, onChompKeep) { if (!ctx) @@ -41685,10 +37817,68 @@ function stringify3(value, replacer, options) { return new Document(value, _replacer, options).toString(options); } +// ../../node_modules/yaml-language-server/lib/esm/languageservice/parser/astNodeUtils.js +function getNodeValue4(node) { + switch (node.type) { + case "array": + return node.children.map(getNodeValue4); + case "object": { + const obj = /* @__PURE__ */ Object.create(null); + for (let _i = 0, _a = node.children; _i < _a.length; _i++) { + const prop = _a[_i]; + const valueNode = prop.children[1]; + if (valueNode) { + obj[prop.children[0].value] = getNodeValue4(valueNode); + } + } + return obj; + } + case "null": + case "string": + case "number": + return node.value; + case "boolean": + return node.source; + default: + return void 0; + } +} +function contains3(node, offset, includeRightBound = false) { + return offset >= node.offset && offset <= node.offset + node.length || includeRightBound && offset === node.offset + node.length; +} +function findNodeAtOffset3(node, offset, includeRightBound) { + if (includeRightBound === void 0) { + includeRightBound = false; + } + if (contains3(node, offset, includeRightBound)) { + const children = node.children; + if (Array.isArray(children)) { + for (let i = 0; i < children.length && children[i].offset <= offset; i++) { + const item = findNodeAtOffset3(children[i], offset, includeRightBound); + if (item) { + return item; + } + } + } + return node; + } + return void 0; +} + +// ../../node_modules/yaml-language-server/lib/esm/languageservice/parser/scalar-type.js +function parseYamlBoolean(input) { + if (["true", "True", "TRUE", "y", "Y", "yes", "Yes", "YES", "on", "On", "ON"].lastIndexOf(input) >= 0) { + return true; + } else if (["false", "False", "FALSE", "n", "N", "no", "No", "NO", "off", "Off", "OFF"].lastIndexOf(input) >= 0) { + return false; + } + throw `Invalid boolean "${input}"`; +} + // ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/objects.js function equals2(one, other, type) { - if (type === "boolean") { - one = JSON.parse(one); + if (type === "boolean" && typeof one === "string") { + one = parseYamlBoolean(one); } if (one === other) { return true; @@ -41797,6 +37987,117 @@ function isAnyOfAllOfOneOfType(schema4) { return !!(schema4.anyOf || schema4.allOf || schema4.oneOf); } +// ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/arrUtils.js +function matchOffsetToDocument(offset, jsonDocuments) { + for (const jsonDoc of jsonDocuments.documents) { + if (jsonDoc.internalDocument && jsonDoc.internalDocument.range[0] <= offset && jsonDoc.internalDocument.range[2] >= offset) { + return jsonDoc; + } + } + if (jsonDocuments.documents.length === 1) { + return jsonDocuments.documents[0]; + } + return null; +} +function filterInvalidCustomTags(customTags) { + const validCustomTags = ["mapping", "scalar", "sequence"]; + if (!customTags) { + return []; + } + return customTags.filter((tag) => { + if (typeof tag === "string") { + const typeInfo = tag.split(" "); + const type = typeInfo[1] && typeInfo[1].toLowerCase() || "scalar"; + if (type === "map") { + return false; + } + return validCustomTags.indexOf(type) !== -1; + } + return false; + }); +} +function isArrayEqual(fst, snd) { + if (!snd || !fst) { + return false; + } + if (snd.length !== fst.length) { + return false; + } + for (let index = fst.length - 1; index >= 0; index--) { + if (fst[index] !== snd[index]) { + return false; + } + } + return true; +} + +// ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/strings.js +function convertSimple2RegExpPattern(pattern) { + return pattern.replace(/[-\\{}+?|^$.,[\]()#\s]/g, "\\$&").replace(/[*]/g, ".*"); +} +function getIndentation(lineContent, position) { + if (lineContent.length < position) { + return 0; + } + for (let i = 0; i < position; i++) { + const char = lineContent.charCodeAt(i); + if (char !== 32 && char !== 9) { + return i; + } + } + return position; +} +function safeCreateUnicodeRegExp(pattern) { + try { + return new RegExp(pattern, "u"); + } catch (ignore) { + return new RegExp(pattern); + } +} +function getFirstNonWhitespaceCharacterAfterOffset(str, offset) { + offset++; + for (let i = offset; i < str.length; i++) { + const char = str.charAt(i); + if (char === " " || char === " ") { + offset++; + } else { + return offset; + } + } + return offset; +} + +// ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/filePatternAssociation.js +var FilePatternAssociation2 = class { + constructor(pattern) { + try { + this.patternRegExp = new RegExp(convertSimple2RegExpPattern(pattern) + "$"); + } catch (e) { + this.patternRegExp = null; + } + this.schemas = []; + } + addSchema(id) { + this.schemas.push(id); + } + matchesPattern(fileName) { + return this.patternRegExp && this.patternRegExp.test(fileName); + } + getSchemas() { + return this.schemas; + } +}; + +// ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/math.js +function floatSafeRemainder(val, step) { + const valDecCount = (val.toString().split(".")[1] || "").length; + const stepDecCount = (step.toString().split(".")[1] || "").length; + const decCount = Math.max(valDecCount, stepDecCount); + const valInt = parseInt(val.toFixed(decCount).replace(".", "")); + const stepInt = parseInt(step.toFixed(decCount).replace(".", "")); + return valInt % stepInt / Math.pow(10, decCount); +} + // ../../node_modules/yaml-language-server/node_modules/vscode-json-languageservice/lib/esm/utils/json.js function stringifyObject(obj, indent, stringifyLiteral) { if (obj !== null && typeof obj === "object") { @@ -43923,109 +40224,23 @@ function findNode(pointer, node) { return findNode(pointer, arrayItem); } } - return null; -} -function parseJSONPointer(path5) { - if (path5 === "#") { - return []; - } - if (path5[0] !== "#" || path5[1] !== "/") { - return null; - } - return path5.substring(2).split(/\//).map(unescape2); -} -function unescape2(str) { - return str.replace(/~1/g, "/").replace(/~0/g, "~"); -} - -// ../../node_modules/yaml-language-server/lib/esm/languageservice/parser/jsonParser07.js -init_main(); - -// ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/arrUtils.js -function matchOffsetToDocument(offset, jsonDocuments) { - for (const jsonDoc of jsonDocuments.documents) { - if (jsonDoc.internalDocument && jsonDoc.internalDocument.range[0] <= offset && jsonDoc.internalDocument.range[2] >= offset) { - return jsonDoc; - } - } - if (jsonDocuments.documents.length === 1) { - return jsonDocuments.documents[0]; - } - return null; -} -function filterInvalidCustomTags(customTags) { - const validCustomTags = ["mapping", "scalar", "sequence"]; - if (!customTags) { - return []; - } - return customTags.filter((tag) => { - if (typeof tag === "string") { - const typeInfo = tag.split(" "); - const type = typeInfo[1] && typeInfo[1].toLowerCase() || "scalar"; - if (type === "map") { - return false; - } - return validCustomTags.indexOf(type) !== -1; - } - return false; - }); -} -function isArrayEqual(fst, snd) { - if (!snd || !fst) { - return false; - } - if (snd.length !== fst.length) { - return false; - } - for (let index = fst.length - 1; index >= 0; index--) { - if (fst[index] !== snd[index]) { - return false; - } - } - return true; + return null; } - -// ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/math.js -function floatSafeRemainder(val, step) { - const valDecCount = (val.toString().split(".")[1] || "").length; - const stepDecCount = (step.toString().split(".")[1] || "").length; - const decCount = Math.max(valDecCount, stepDecCount); - const valInt = parseInt(val.toFixed(decCount).replace(".", "")); - const stepInt = parseInt(step.toFixed(decCount).replace(".", "")); - return valInt % stepInt / Math.pow(10, decCount); +function parseJSONPointer(path5) { + if (path5 === "#") { + return []; + } + if (path5[0] !== "#" || path5[1] !== "/") { + return null; + } + return path5.substring(2).split(/\//).map(unescape2); +} +function unescape2(str) { + return str.replace(/~1/g, "/").replace(/~0/g, "~"); } -// ../../node_modules/yaml-language-server/lib/esm/languageservice/parser/jsonParser07.js -var formats2 = { - "color-hex": { - errorMessage: t("colorHexFormatWarning"), - pattern: /^#([0-9A-Fa-f]{3,4}|([0-9A-Fa-f]{2}){3,4})$/ - }, - "date-time": { - errorMessage: t("dateTimeFormatWarning"), - pattern: /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i - }, - date: { - errorMessage: t("dateFormatWarning"), - pattern: /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/i - }, - time: { - errorMessage: t("timeFormatWarning"), - pattern: /^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i - }, - email: { - errorMessage: t("emailFormatWarning"), - pattern: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ - }, - ipv4: { - errorMessage: t("ipv4FormatWarning"), - pattern: /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/ - }, - ipv6: { - errorMessage: t("ipv6FormatWarning"), - pattern: /^([0-9a-f]|:){1,4}(:([0-9a-f]{0,4})*){1,7}$/i - } -}; +// ../../node_modules/yaml-language-server/lib/esm/languageservice/parser/schemaValidation/baseValidator.js +init_main(); var YAML_SOURCE = "YAML"; var YAML_SCHEMA_PREFIX = "yaml-schema: "; var ProblemType; @@ -44039,127 +40254,6 @@ var ProblemTypeMessages = { [ProblemType.typeMismatchWarning]: 'Incorrect type. Expected "{0}".', [ProblemType.constWarning]: "Value must be {0}." }; -var ASTNodeImpl2 = class { - constructor(parent, internalNode, offset, length) { - this.offset = offset; - this.length = length; - this.parent = parent; - this.internalNode = internalNode; - } - getNodeFromOffsetEndInclusive(offset) { - const collector = []; - const findNode2 = (node) => { - if (offset >= node.offset && offset <= node.offset + node.length) { - const children = node.children; - for (let i = 0; i < children.length && children[i].offset <= offset; i++) { - const item = findNode2(children[i]); - if (item) { - collector.push(item); - } - } - return node; - } - return null; - }; - const foundNode = findNode2(this); - let currMinDist = Number.MAX_VALUE; - let currMinNode = null; - for (const currNode of collector) { - const minDist = currNode.length + currNode.offset - offset + (offset - currNode.offset); - if (minDist < currMinDist) { - currMinNode = currNode; - currMinDist = minDist; - } - } - return currMinNode || foundNode; - } - get children() { - return []; - } - toString() { - return "type: " + this.type + " (" + this.offset + "/" + this.length + ")" + (this.parent ? " parent: {" + this.parent.toString() + "}" : ""); - } -}; -var NullASTNodeImpl2 = class extends ASTNodeImpl2 { - constructor(parent, internalNode, offset, length) { - super(parent, internalNode, offset, length); - this.type = "null"; - this.value = null; - } -}; -var BooleanASTNodeImpl2 = class extends ASTNodeImpl2 { - constructor(parent, internalNode, boolValue, boolSource, offset, length) { - super(parent, internalNode, offset, length); - this.type = "boolean"; - this.value = boolValue; - this.source = boolSource; - } -}; -var ArrayASTNodeImpl2 = class extends ASTNodeImpl2 { - constructor(parent, internalNode, offset, length) { - super(parent, internalNode, offset, length); - this.type = "array"; - this.items = []; - } - get children() { - return this.items; - } -}; -var NumberASTNodeImpl2 = class extends ASTNodeImpl2 { - constructor(parent, internalNode, offset, length) { - super(parent, internalNode, offset, length); - this.type = "number"; - this.isInteger = true; - this.value = Number.NaN; - } -}; -var StringASTNodeImpl2 = class extends ASTNodeImpl2 { - constructor(parent, internalNode, offset, length) { - super(parent, internalNode, offset, length); - this.type = "string"; - this.value = ""; - } -}; -var PropertyASTNodeImpl2 = class extends ASTNodeImpl2 { - constructor(parent, internalNode, offset, length) { - super(parent, internalNode, offset, length); - this.type = "property"; - this.colonOffset = -1; - } - get children() { - return this.valueNode ? [this.keyNode, this.valueNode] : [this.keyNode]; - } -}; -var ObjectASTNodeImpl2 = class extends ASTNodeImpl2 { - constructor(parent, internalNode, offset, length) { - super(parent, internalNode, offset, length); - this.type = "object"; - this.properties = []; - } - get children() { - return this.properties; - } -}; -function asSchema2(schema4) { - if (schema4 === void 0) { - return void 0; - } - if (isBoolean2(schema4)) { - return schema4 ? {} : { not: {} }; - } - if (typeof schema4 !== "object") { - console.warn(`Wrong schema: ${JSON.stringify(schema4)}, it MUST be an Object or Boolean`); - schema4 = { - type: schema4 - }; - } - return schema4; -} -var EnumMatch2; -(function(EnumMatch3) { - EnumMatch3[EnumMatch3["Key"] = 0] = "Key"; - EnumMatch3[EnumMatch3["Enum"] = 1] = "Enum"; -})(EnumMatch2 || (EnumMatch2 = {})); var SchemaCollector2 = class _SchemaCollector { constructor(focusOffset = -1, exclude = null) { this.focusOffset = focusOffset; @@ -44182,18 +40276,14 @@ var SchemaCollector2 = class _SchemaCollector { var NoOpSchemaCollector2 = class { constructor() { } - // eslint-disable-next-line @typescript-eslint/no-explicit-any get schemas() { return []; } - // eslint-disable-next-line @typescript-eslint/no-unused-vars - add(schema4) { + add() { } - // eslint-disable-next-line @typescript-eslint/no-unused-vars - merge(other) { + merge() { } - // eslint-disable-next-line @typescript-eslint/no-unused-vars - include(node) { + include() { return true; } newSub() { @@ -44201,6 +40291,36 @@ var NoOpSchemaCollector2 = class { } }; NoOpSchemaCollector2.instance = new NoOpSchemaCollector2(); +var formats2 = { + "color-hex": { + errorMessage: t("Invalid color format. Use #RGB, #RGBA, #RRGGBB or #RRGGBBAA."), + pattern: /^#([0-9A-Fa-f]{3,4}|([0-9A-Fa-f]{2}){3,4})$/ + }, + "date-time": { + errorMessage: t("String is not a RFC3339 date-time."), + pattern: /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i + }, + date: { + errorMessage: t("String is not a RFC3339 date."), + pattern: /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/i + }, + time: { + errorMessage: t("String is not a RFC3339 time."), + pattern: /^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i + }, + email: { + errorMessage: t("String is not an e-mail address."), + pattern: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ + }, + ipv4: { + errorMessage: t("String does not match IPv4 format."), + pattern: /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/ + }, + ipv6: { + errorMessage: t("String does not match IPv6 format."), + pattern: /^([0-9a-f]|:){1,4}(:([0-9a-f]{0,4})*){1,7}$/i + } +}; var ValidationResult2 = class { constructor(isKubernetes) { this.problems = []; @@ -44208,61 +40328,80 @@ var ValidationResult2 = class { this.propertiesValueMatches = 0; this.primaryValueMatches = 0; this.enumValueMatch = false; - if (isKubernetes) { + this.enumValues = null; + if (isKubernetes) this.enumValues = []; - } else { - this.enumValues = null; + } + getEvaluatedItems(node) { + var _a; + (_a = this.evaluatedItemsByNode) != null ? _a : this.evaluatedItemsByNode = /* @__PURE__ */ new Map(); + let evaluated = this.evaluatedItemsByNode.get(node); + if (!evaluated) { + evaluated = /* @__PURE__ */ new Set(); + this.evaluatedItemsByNode.set(node, evaluated); } + return evaluated; } hasProblems() { - return !!this.problems.length; + return this.problems.length > 0; } - mergeAll(validationResults) { - for (const validationResult of validationResults) { - this.merge(validationResult); + merge(other) { + var _a, _b; + this.problems = this.problems.concat(other.problems); + if (other.evaluatedProperties) { + (_a = this.evaluatedProperties) != null ? _a : this.evaluatedProperties = /* @__PURE__ */ new Set(); + for (const p of other.evaluatedProperties) + this.evaluatedProperties.add(p); + } + if (other.evaluatedItemsByNode) { + (_b = this.evaluatedItemsByNode) != null ? _b : this.evaluatedItemsByNode = /* @__PURE__ */ new Map(); + for (const [node, set2] of other.evaluatedItemsByNode) { + const target = this.evaluatedItemsByNode.get(node); + if (target) { + for (const i of set2) + target.add(i); + } else { + this.evaluatedItemsByNode.set(node, new Set(set2)); + } + } } } - merge(validationResult) { - this.problems = this.problems.concat(validationResult.problems); - } - mergeEnumValues(validationResult) { - if (!this.enumValueMatch && !validationResult.enumValueMatch && this.enumValues && validationResult.enumValues) { - this.enumValues = this.enumValues.concat(validationResult.enumValues); - for (const error of this.problems) { - if (error.code === ErrorCode.EnumValueMismatch) { - error.message = t("enumWarning", [...new Set(this.enumValues)].map((v) => { - return JSON.stringify(v); - }).join(", ")); + mergeEnumValues(other) { + if (!this.enumValueMatch && !other.enumValueMatch && this.enumValues && other.enumValues) { + this.enumValues = this.enumValues.concat(other.enumValues); + for (const err of this.problems) { + if (err.code === ErrorCode.EnumValueMismatch) { + err.message = t("Value is not accepted. Valid values: {0}.", [...new Set(this.enumValues)].map((v) => JSON.stringify(v)).join(", ")); } } } } - /** - * Merge multiple warnings with same problemType together - * @param subValidationResult another possible result - */ - mergeWarningGeneric(subValidationResult, problemTypesToMerge) { - var _a, _b, _c; - if ((_a = this.problems) == null ? void 0 : _a.length) { - for (const problemType of problemTypesToMerge) { - const bestResults = this.problems.filter((p) => p.problemType === problemType); - for (const bestResult of bestResults) { - const mergingResult = (_b = subValidationResult.problems) == null ? void 0 : _b.find( - (p) => p.problemType === problemType && bestResult.location.offset === p.location.offset && (problemType !== ProblemType.missingRequiredPropWarning || isArrayEqual(p.problemArgs, bestResult.problemArgs)) - ); - if (mergingResult) { - if ((_c = mergingResult.problemArgs) == null ? void 0 : _c.length) { - mergingResult.problemArgs.filter((p) => !bestResult.problemArgs.includes(p)).forEach((p) => bestResult.problemArgs.push(p)); - bestResult.message = getWarningMessage(bestResult.problemType, bestResult.problemArgs); - } - this.mergeSources(mergingResult, bestResult); + mergeWarningGeneric(sub, problemTypesToMerge) { + var _a, _b, _c, _d; + if (!((_a = this.problems) == null ? void 0 : _a.length)) + return; + for (const problemType of problemTypesToMerge) { + const bestResults = this.problems.filter((p) => p.problemType === problemType); + for (const bestResult of bestResults) { + const mergingResult = (_b = sub.problems) == null ? void 0 : _b.find((p) => p.problemType === problemType && bestResult.location.offset === p.location.offset && (problemType !== ProblemType.missingRequiredPropWarning || isArrayEqual(p.problemArgs, bestResult.problemArgs))); + if (!mergingResult) + continue; + if ((_c = mergingResult.problemArgs) == null ? void 0 : _c.length) { + mergingResult.problemArgs.filter((p) => !bestResult.problemArgs.includes(p)).forEach((p) => bestResult.problemArgs.push(p)); + if (bestResult.problemType) { + bestResult.message = getWarningMessage(bestResult.problemType, (_d = bestResult.problemArgs) != null ? _d : []); } } + this.mergeSources(mergingResult, bestResult); } } } - mergePropertyMatch(propertyValidationResult) { - this.merge(propertyValidationResult); + mergePropertyMatch(propertyValidationResult, mergeEvaluated = true) { + if (mergeEvaluated) { + this.merge(propertyValidationResult); + } else { + this.problems = this.problems.concat(propertyValidationResult.problems); + } this.propertiesMatches++; if (propertyValidationResult.enumValueMatch || !propertyValidationResult.hasProblems() && propertyValidationResult.propertiesMatches) { this.propertiesValueMatches++; @@ -44272,212 +40411,192 @@ var ValidationResult2 = class { } } mergeSources(mergingResult, bestResult) { - const mergingSource = mergingResult.source.replace(YAML_SCHEMA_PREFIX, ""); - if (!bestResult.source.includes(mergingSource)) { + var _a; + const mergingSource = ((_a = mergingResult.source) != null ? _a : "").replace(YAML_SCHEMA_PREFIX, ""); + if (mergingSource && bestResult.source && !bestResult.source.includes(mergingSource)) { bestResult.source = bestResult.source + " | " + mergingSource; } - if (!bestResult.schemaUri.includes(mergingResult.schemaUri[0])) { + if (bestResult.schemaUri && mergingResult.schemaUri && !bestResult.schemaUri.includes(mergingResult.schemaUri[0])) { bestResult.schemaUri = bestResult.schemaUri.concat(mergingResult.schemaUri); } } compareGeneric(other) { const hasProblems = this.hasProblems(); - if (hasProblems !== other.hasProblems()) { + if (hasProblems !== other.hasProblems()) return hasProblems ? -1 : 1; - } - if (this.enumValueMatch !== other.enumValueMatch) { + if (this.enumValueMatch !== other.enumValueMatch) return other.enumValueMatch ? -1 : 1; - } - if (this.propertiesValueMatches !== other.propertiesValueMatches) { + if (this.propertiesValueMatches !== other.propertiesValueMatches) return this.propertiesValueMatches - other.propertiesValueMatches; - } - if (this.primaryValueMatches !== other.primaryValueMatches) { + if (this.primaryValueMatches !== other.primaryValueMatches) return this.primaryValueMatches - other.primaryValueMatches; - } return this.propertiesMatches - other.propertiesMatches; } compareKubernetes(other) { const hasProblems = this.hasProblems(); - if (this.propertiesMatches !== other.propertiesMatches) { + if (this.propertiesMatches !== other.propertiesMatches) return this.propertiesMatches - other.propertiesMatches; - } - if (this.enumValueMatch !== other.enumValueMatch) { + if (this.enumValueMatch !== other.enumValueMatch) return other.enumValueMatch ? -1 : 1; - } - if (this.primaryValueMatches !== other.primaryValueMatches) { + if (this.primaryValueMatches !== other.primaryValueMatches) return this.primaryValueMatches - other.primaryValueMatches; - } - if (this.propertiesValueMatches !== other.propertiesValueMatches) { + if (this.propertiesValueMatches !== other.propertiesValueMatches) return this.propertiesValueMatches - other.propertiesValueMatches; - } - if (hasProblems !== other.hasProblems()) { + if (hasProblems !== other.hasProblems()) return hasProblems ? -1 : 1; - } return this.propertiesMatches - other.propertiesMatches; } }; -function getNodeValue4(node) { - switch (node.type) { - case "array": - return node.children.map(getNodeValue4); - case "object": { - const obj = /* @__PURE__ */ Object.create(null); - for (let _i = 0, _a = node.children; _i < _a.length; _i++) { - const prop = _a[_i]; - const valueNode = prop.children[1]; - if (valueNode) { - obj[prop.children[0].value] = getNodeValue4(valueNode); +var BaseValidator = class { + collectSeenKeys(node) { + const seenKeys = /* @__PURE__ */ Object.create(null); + const unprocessedNodes = [...node.properties]; + while (unprocessedNodes.length > 0) { + const propertyNode = unprocessedNodes.pop(); + if (!propertyNode) + continue; + const key = propertyNode.keyNode.value; + if (key === "<<" && propertyNode.valueNode) { + const valueNode = propertyNode.valueNode; + switch (valueNode.type) { + case "object": + unprocessedNodes.push(...valueNode.properties); + break; + case "array": + valueNode.items.forEach((sequenceNode) => { + if (sequenceNode && sequenceNode.type === "object" && isIterable(sequenceNode.properties)) { + unprocessedNodes.push(...sequenceNode.properties); + } + }); + break; + default: + break; } + } else { + seenKeys[key] = propertyNode.valueNode; } - return obj; } - case "null": - case "string": - case "number": - return node.value; - case "boolean": - return node.source; - default: - return void 0; + return seenKeys; } -} -function contains3(node, offset, includeRightBound = false) { - return offset >= node.offset && offset <= node.offset + node.length || includeRightBound && offset === node.offset + node.length; -} -function findNodeAtOffset3(node, offset, includeRightBound) { - if (includeRightBound === void 0) { - includeRightBound = false; + validateDocument(root, textDocument, schema4, options) { + const validationResult = new ValidationResult2(options.isKubernetes); + this.validateNode(root, schema4, schema4, validationResult, NoOpSchemaCollector2.instance, options); + return validationResult.problems.map((p) => { + const range = Range.create(textDocument.positionAt(p.location.offset), textDocument.positionAt(p.location.offset + p.location.length)); + const diagnostic = Diagnostic.create(range, p.message, p.severity, p.code ? p.code : ErrorCode.Undefined, p.source); + diagnostic.data = { schemaUri: p.schemaUri, ...p.data }; + return diagnostic; + }); } - if (contains3(node, offset, includeRightBound)) { - const children = node.children; - if (Array.isArray(children)) { - for (let i = 0; i < children.length && children[i].offset <= offset; i++) { - const item = findNodeAtOffset3(children[i], offset, includeRightBound); - if (item) { - return item; - } - } - } - return node; + getMatchingSchemas(root, schema4, options, focusOffset, exclude) { + const matchingSchemas = new SchemaCollector2(focusOffset, exclude); + this.validateNode(root, schema4, schema4, new ValidationResult2(options.isKubernetes), matchingSchemas, options); + return matchingSchemas.schemas; } - return void 0; -} -var JSONDocument2 = class { - constructor(root, syntaxErrors = [], comments = []) { - this.root = root; - this.syntaxErrors = syntaxErrors; - this.comments = comments; + getNoOpCollector() { + return NoOpSchemaCollector2.instance; } - getNodeFromOffset(offset, includeRightBound = false) { - if (this.root) { - return findNodeAtOffset3(this.root, offset, includeRightBound); + getSchemaSource(schema4, originalSchema) { + var _a; + let label; + if (schema4.title) { + label = schema4.title; + } else if (schema4.closestTitle) { + label = schema4.closestTitle; + } else if (originalSchema.closestTitle) { + label = originalSchema.closestTitle; + } else { + const uriString = (_a = schema4.url) != null ? _a : originalSchema.url; + if (uriString) + label = URI.parse(uriString).toString(); } - return void 0; + return label ? `${YAML_SCHEMA_PREFIX}${label}` : YAML_SOURCE; } - getNodeFromOffsetEndInclusive(offset) { - return this.root && this.root.getNodeFromOffsetEndInclusive(offset); + getSchemaUri(schema4, originalSchema) { + var _a; + const uriString = (_a = schema4.url) != null ? _a : originalSchema.url; + return uriString ? [uriString] : []; } - visit(visitor) { - if (this.root) { - const doVisit = (node) => { - let ctn = visitor(node); - const children = node.children; - if (Array.isArray(children)) { - for (let i = 0; i < children.length && ctn; i++) { - ctn = doVisit(children[i]); - } - } - return ctn; - }; - doVisit(this.root); + // ---------------- core traversal ---------------- + validateNode(node, schema4, originalSchema, validationResult, matchingSchemas, options) { + if (!node) + return; + if (!schema4 || typeof schema4 !== "object") + return; + if (schema4._dialect) { + const subDialect = schema4._dialect; + const currentDialect = this.getCurrentDialect(); + if (subDialect !== currentDialect) { + const subValidator = getValidator(subDialect); + subValidator.validateNode(node, schema4, originalSchema, validationResult, matchingSchemas, options); + return; + } } - } - validate(textDocument, schema4) { - if (this.root && schema4) { - const validationResult = new ValidationResult2(this.isKubernetes); - validate2(this.root, schema4, schema4, validationResult, NoOpSchemaCollector2.instance, { - isKubernetes: this.isKubernetes, - disableAdditionalProperties: this.disableAdditionalProperties, - uri: this.uri - }); - return validationResult.problems.map((p) => { - const range = Range.create(textDocument.positionAt(p.location.offset), textDocument.positionAt(p.location.offset + p.location.length)); - const diagnostic = Diagnostic.create(range, p.message, p.severity, p.code ? p.code : ErrorCode.Undefined, p.source); - diagnostic.data = { schemaUri: p.schemaUri, ...p.data }; - return diagnostic; - }); + if (!schema4.url) + schema4.url = originalSchema.url; + schema4.closestTitle = schema4.title || originalSchema.closestTitle; + switch (node.type) { + case "object": + this.validateObjectNode(node, schema4, originalSchema, validationResult, matchingSchemas, options); + break; + case "array": + this.validateArrayNode(node, schema4, originalSchema, validationResult, matchingSchemas, options); + break; + case "string": + this.validateStringNode(node, schema4, originalSchema, validationResult); + break; + case "number": + this.validateNumberNode(node, schema4, originalSchema, validationResult); + break; + case "property": + this.validateNode(node.valueNode, schema4, schema4, validationResult, matchingSchemas, options); + break; + default: + break; } - return null; - } - /** - * This method returns the list of applicable schemas - * - * currently used @param didCallFromAutoComplete flag to differentiate the method call, when it is from auto complete - * then user still types something and skip the validation for timebeing untill completed. - * On https://github.com/redhat-developer/yaml-language-server/pull/719 the auto completes need to populate the list of enum string which matches to the enum - * and on https://github.com/redhat-developer/vscode-yaml/issues/803 the validation should throw the error based on the enum string. - * - * @param schema schema - * @param focusOffset offsetValue - * @param exclude excluded Node - * @param didCallFromAutoComplete true if method called from AutoComplete - * @returns array of applicable schemas - */ - getMatchingSchemas(schema4, focusOffset = -1, exclude = null, didCallFromAutoComplete) { - const matchingSchemas = new SchemaCollector2(focusOffset, exclude); - if (this.root && schema4) { - validate2(this.root, schema4, schema4, new ValidationResult2(this.isKubernetes), matchingSchemas, { - isKubernetes: this.isKubernetes, - disableAdditionalProperties: this.disableAdditionalProperties, - uri: this.uri, - callFromAutoComplete: didCallFromAutoComplete - }); + this.validateGenericNode(node, schema4, originalSchema, validationResult, matchingSchemas, options); + matchingSchemas.add({ node, schema: schema4 }); + this.applyUnevaluatedItems(node, schema4, originalSchema, validationResult, matchingSchemas, options); + if (node.type === "object") { + const seenKeys = this.collectSeenKeys(node); + this.applyUnevaluatedProperties(node, schema4, originalSchema, validationResult, matchingSchemas, options, seenKeys); } - return matchingSchemas.schemas; - } -}; -function validate2(node, schema4, originalSchema, validationResult, matchingSchemas, options) { - const { isKubernetes, callFromAutoComplete } = options; - if (!node) { - return; - } - if (typeof schema4 !== "object") { - return; - } - if (!schema4.url) { - schema4.url = originalSchema.url; - } - schema4.closestTitle = schema4.title || originalSchema.closestTitle; - switch (node.type) { - case "object": - _validateObjectNode(node, schema4, validationResult, matchingSchemas); - break; - case "array": - _validateArrayNode(node, schema4, validationResult, matchingSchemas); - break; - case "string": - _validateStringNode(node, schema4, validationResult); - break; - case "number": - _validateNumberNode(node, schema4, validationResult); - break; - case "property": - return validate2(node.valueNode, schema4, schema4, validationResult, matchingSchemas, options); } - _validateNode(); - matchingSchemas.add({ node, schema: schema4 }); - function _validateNode() { - function matchesType(type) { + // ---------------- shared generic keywords ---------------- + validateGenericNode(node, schema4, originalSchema, validationResult, matchingSchemas, options) { + var _a; + const { isKubernetes, callFromAutoComplete } = options; + const matchesType = (type) => { return node.type === type || type === "integer" && node.type === "number" && node.isInteger; - } + }; + const mergeEvaluated = (target, source) => { + var _a2, _b; + if (source.evaluatedProperties) { + (_a2 = target.evaluatedProperties) != null ? _a2 : target.evaluatedProperties = /* @__PURE__ */ new Set(); + for (const p of source.evaluatedProperties) + target.evaluatedProperties.add(p); + } + if (source.evaluatedItemsByNode) { + (_b = target.evaluatedItemsByNode) != null ? _b : target.evaluatedItemsByNode = /* @__PURE__ */ new Map(); + for (const [nodeRef, set2] of source.evaluatedItemsByNode) { + const targetSet = target.evaluatedItemsByNode.get(nodeRef); + if (targetSet) { + for (const i of set2) + targetSet.add(i); + } else { + target.evaluatedItemsByNode.set(nodeRef, new Set(set2)); + } + } + } + }; if (Array.isArray(schema4.type)) { if (!schema4.type.some(matchesType)) { validationResult.problems.push({ location: { offset: node.offset, length: node.length }, severity: DiagnosticSeverity.Warning, - message: schema4.errorMessage || t("typeArrayMismatchWarning", schema4.type.join(", ")), - source: getSchemaSource(schema4, originalSchema), - schemaUri: getSchemaUri(schema4, originalSchema) + message: schema4.errorMessage || t("Incorrect type. Expected one of {0}.", schema4.type.join(", ")), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) }); } } else if (schema4.type) { @@ -44487,8 +40606,8 @@ function validate2(node, schema4, originalSchema, validationResult, matchingSche location: { offset: node.offset, length: node.length }, severity: DiagnosticSeverity.Warning, message: schema4.errorMessage || getWarningMessage(ProblemType.typeMismatchWarning, [schemaType]), - source: getSchemaSource(schema4, originalSchema), - schemaUri: getSchemaUri(schema4, originalSchema), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema), problemType: ProblemType.typeMismatchWarning, problemArgs: [schemaType] }); @@ -44496,21 +40615,28 @@ function validate2(node, schema4, originalSchema, validationResult, matchingSche } if (Array.isArray(schema4.allOf)) { for (const subSchemaRef of schema4.allOf) { - validate2(node, asSchema2(subSchemaRef), schema4, validationResult, matchingSchemas, options); + const subSchema = asSchema2(subSchemaRef); + const subValidationResult = new ValidationResult2(isKubernetes); + const subMatchingSchemas = matchingSchemas.newSub(); + this.validateNode(node, subSchema, schema4, subValidationResult, subMatchingSchemas, options); + validationResult.merge(subValidationResult); + validationResult.propertiesMatches += subValidationResult.propertiesMatches; + validationResult.propertiesValueMatches += subValidationResult.propertiesValueMatches; + matchingSchemas.merge(subMatchingSchemas); } } const notSchema = asSchema2(schema4.not); if (notSchema) { const subValidationResult = new ValidationResult2(isKubernetes); const subMatchingSchemas = matchingSchemas.newSub(); - validate2(node, notSchema, schema4, subValidationResult, subMatchingSchemas, options); + this.validateNode(node, notSchema, schema4, subValidationResult, subMatchingSchemas, options); if (!subValidationResult.hasProblems()) { validationResult.problems.push({ location: { offset: node.offset, length: node.length }, severity: DiagnosticSeverity.Warning, - message: t("notSchemaWarning"), - source: getSchemaSource(schema4, originalSchema), - schemaUri: getSchemaUri(schema4, originalSchema) + message: t("Matches a schema that is not allowed."), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) }); } for (const ms of subMatchingSchemas.schemas) { @@ -44519,58 +40645,58 @@ function validate2(node, schema4, originalSchema, validationResult, matchingSche } } const testAlternatives = (alternatives, maxOneMatch) => { - var _a; - const matches = []; + var _a2; const subMatches = []; const noPropertyMatches = []; + const validResults = []; let bestMatch = null; for (const subSchemaRef of alternatives) { const subSchema = { ...asSchema2(subSchemaRef) }; const subValidationResult = new ValidationResult2(isKubernetes); const subMatchingSchemas = matchingSchemas.newSub(); - validate2(node, subSchema, schema4, subValidationResult, subMatchingSchemas, options); + this.validateNode(node, subSchema, schema4, subValidationResult, subMatchingSchemas, options); if (!subValidationResult.hasProblems() || callFromAutoComplete) { - matches.push(subSchema); subMatches.push(subSchema); - if (subValidationResult.propertiesMatches === 0) { + if (subValidationResult.propertiesMatches === 0) noPropertyMatches.push(subSchema); - } - if (subSchema.format) { + if (subSchema.format) subMatches.pop(); - } + } + if (!subValidationResult.hasProblems()) { + validResults.push(subValidationResult); } if (!bestMatch) { - bestMatch = { - schema: subSchema, - validationResult: subValidationResult, - matchingSchemas: subMatchingSchemas - }; + bestMatch = { schema: subSchema, validationResult: subValidationResult, matchingSchemas: subMatchingSchemas }; } else if (isKubernetes) { - bestMatch = alternativeComparison(subValidationResult, bestMatch, subSchema, subMatchingSchemas); + bestMatch = this.alternativeComparison(subValidationResult, bestMatch, subSchema, subMatchingSchemas); } else { - bestMatch = genericComparison(node, maxOneMatch, subValidationResult, bestMatch, subSchema, subMatchingSchemas); + bestMatch = this.genericComparison(node, maxOneMatch, subValidationResult, bestMatch, subSchema, subMatchingSchemas); } } if (subMatches.length > 1 && (subMatches.length > 1 || noPropertyMatches.length === 0) && maxOneMatch) { validationResult.problems.push({ location: { offset: node.offset, length: 1 }, severity: DiagnosticSeverity.Warning, - message: t("oneOfWarning"), - source: getSchemaSource(schema4, originalSchema), - schemaUri: getSchemaUri(schema4, originalSchema) + message: t("Matches multiple schemas when only one must validate."), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) }); } - if (bestMatch !== null) { + if (bestMatch) { validationResult.merge(bestMatch.validationResult); validationResult.propertiesMatches += bestMatch.validationResult.propertiesMatches; validationResult.propertiesValueMatches += bestMatch.validationResult.propertiesValueMatches; validationResult.enumValueMatch = validationResult.enumValueMatch || bestMatch.validationResult.enumValueMatch; - if ((_a = bestMatch.validationResult.enumValues) == null ? void 0 : _a.length) { + if ((_a2 = bestMatch.validationResult.enumValues) == null ? void 0 : _a2.length) { validationResult.enumValues = (validationResult.enumValues || []).concat(bestMatch.validationResult.enumValues); } matchingSchemas.merge(bestMatch.matchingSchemas); } - return matches.length; + if (validResults.length > 0) { + for (const result of validResults) { + mergeEvaluated(validationResult, result); + } + } }; if (Array.isArray(schema4.anyOf)) { testAlternatives(schema4.anyOf, false); @@ -44578,40 +40704,40 @@ function validate2(node, schema4, originalSchema, validationResult, matchingSche if (Array.isArray(schema4.oneOf)) { testAlternatives(schema4.oneOf, true); } - const testBranch = (schema5, originalSchema2) => { + const testBranch = (branchSchema, original) => { const subValidationResult = new ValidationResult2(isKubernetes); const subMatchingSchemas = matchingSchemas.newSub(); - validate2(node, asSchema2(schema5), originalSchema2, subValidationResult, subMatchingSchemas, options); + this.validateNode(node, asSchema2(branchSchema), original, subValidationResult, subMatchingSchemas, options); validationResult.merge(subValidationResult); validationResult.propertiesMatches += subValidationResult.propertiesMatches; validationResult.propertiesValueMatches += subValidationResult.propertiesValueMatches; matchingSchemas.merge(subMatchingSchemas); }; - const testCondition = (ifSchema2, originalSchema2, thenSchema, elseSchema) => { - const subSchema = asSchema2(ifSchema2); + const testCondition = (ifSchemaRef, original, thenSchema, elseSchema) => { + const subSchema = asSchema2(ifSchemaRef); const subValidationResult = new ValidationResult2(isKubernetes); const subMatchingSchemas = matchingSchemas.newSub(); - validate2(node, subSchema, originalSchema2, subValidationResult, subMatchingSchemas, options); + this.validateNode(node, subSchema, original, subValidationResult, subMatchingSchemas, options); matchingSchemas.merge(subMatchingSchemas); - const { filePatternAssociation } = subSchema; + const filePatternAssociation = subSchema == null ? void 0 : subSchema.filePatternAssociation; if (filePatternAssociation) { const association = new FilePatternAssociation2(filePatternAssociation); if (!association.matchesPattern(options.uri)) { subValidationResult.problems.push({ location: { offset: node.offset, length: node.length }, severity: DiagnosticSeverity.Warning, - message: t("ifFilePatternAssociation", filePatternAssociation, options.uri), - source: getSchemaSource(schema4, originalSchema2), - schemaUri: getSchemaUri(schema4, originalSchema2) + message: t("filePatternAssociation '{0}' does not match with doc uri '{1}'", filePatternAssociation, options.uri), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) }); } } if (!subValidationResult.hasProblems()) { - if (thenSchema) { - testBranch(thenSchema, originalSchema2); - } + mergeEvaluated(validationResult, subValidationResult); + if (thenSchema) + testBranch(thenSchema, original); } else if (elseSchema) { - testBranch(elseSchema, originalSchema2); + testBranch(elseSchema, original); } }; const ifSchema = asSchema2(schema4.if); @@ -44634,578 +40760,610 @@ function validate2(node, schema4, originalSchema, validationResult, matchingSche location: { offset: node.offset, length: node.length }, severity: DiagnosticSeverity.Warning, code: ErrorCode.EnumValueMismatch, - message: schema4.errorMessage || t("enumWarning", schema4.enum.map((v) => { - return JSON.stringify(v); - }).join(", ")), - source: getSchemaSource(schema4, originalSchema), - schemaUri: getSchemaUri(schema4, originalSchema), + message: schema4.errorMessage || t("Value is not accepted. Valid values: {0}.", ((_a = schema4.enum) != null ? _a : []).map((v) => JSON.stringify(v)).join(", ")), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema), data: { values: schema4.enum } }); } } if (isDefined2(schema4.const)) { const val = getNodeValue4(node); - if (!equals2(val, schema4.const, node.type) && !isAutoCompleteEqualMaybe(callFromAutoComplete, node, val, schema4.const)) { + const c = schema4.const; + if (!equals2(val, c, node.type) && !isAutoCompleteEqualMaybe(callFromAutoComplete, node, val, c)) { validationResult.problems.push({ location: { offset: node.offset, length: node.length }, severity: DiagnosticSeverity.Warning, code: ErrorCode.EnumValueMismatch, problemType: ProblemType.constWarning, - message: schema4.errorMessage || getWarningMessage(ProblemType.constWarning, [JSON.stringify(schema4.const)]), - source: getSchemaSource(schema4, originalSchema), - schemaUri: getSchemaUri(schema4, originalSchema), - problemArgs: [JSON.stringify(schema4.const)], - data: { values: [schema4.const] } + message: schema4.errorMessage || getWarningMessage(ProblemType.constWarning, [JSON.stringify(c)]), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema), + problemArgs: [JSON.stringify(c)], + data: { values: [c] } }); validationResult.enumValueMatch = false; } else { validationResult.enumValueMatch = true; } - validationResult.enumValues = [schema4.const]; + validationResult.enumValues = [c]; } if (schema4.deprecationMessage && node.parent) { validationResult.problems.push({ location: { offset: node.parent.offset, length: node.parent.length }, severity: DiagnosticSeverity.Warning, message: schema4.deprecationMessage, - source: getSchemaSource(schema4, originalSchema), - schemaUri: getSchemaUri(schema4, originalSchema) - }); - } - } - function _validateNumberNode(node2, schema5, validationResult2) { - const val = node2.value; - if (isNumber2(schema5.multipleOf)) { - if (floatSafeRemainder(val, schema5.multipleOf) !== 0) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, - severity: DiagnosticSeverity.Warning, - message: t("multipleOfWarning", schema5.multipleOf), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) - }); - } - } - function getExclusiveLimit(limit, exclusive) { - if (isNumber2(exclusive)) { - return exclusive; - } - if (isBoolean2(exclusive) && exclusive) { - return limit; - } - return void 0; - } - function getLimit(limit, exclusive) { - if (!isBoolean2(exclusive) || !exclusive) { - return limit; - } - return void 0; - } - const exclusiveMinimum = getExclusiveLimit(schema5.minimum, schema5.exclusiveMinimum); - if (isNumber2(exclusiveMinimum) && val <= exclusiveMinimum) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, - severity: DiagnosticSeverity.Warning, - message: t("exclusiveMinimumWarning", exclusiveMinimum), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) - }); - } - const exclusiveMaximum = getExclusiveLimit(schema5.maximum, schema5.exclusiveMaximum); - if (isNumber2(exclusiveMaximum) && val >= exclusiveMaximum) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, - severity: DiagnosticSeverity.Warning, - message: t("exclusiveMaximumWarning", exclusiveMaximum), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) - }); - } - const minimum = getLimit(schema5.minimum, schema5.exclusiveMinimum); - if (isNumber2(minimum) && val < minimum) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, - severity: DiagnosticSeverity.Warning, - message: t("minimumWarning", minimum), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) - }); - } - const maximum = getLimit(schema5.maximum, schema5.exclusiveMaximum); - if (isNumber2(maximum) && val > maximum) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, - severity: DiagnosticSeverity.Warning, - message: t("maximumWarning", maximum), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) }); } } - function _validateStringNode(node2, schema5, validationResult2) { - if (isNumber2(schema5.minLength) && node2.value.length < schema5.minLength) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, + // ---------------- shared leaf validations ---------------- + validateStringNode(node, schema4, originalSchema, validationResult) { + var _a, _b; + const value = node.value; + if (isNumber2(schema4.minLength) && value.length < ((_a = schema4.minLength) != null ? _a : 0)) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, severity: DiagnosticSeverity.Warning, - message: t("minLengthWarning", schema5.minLength), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) + message: t("String is shorter than the minimum length of {0}.", schema4.minLength), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) }); } - if (isNumber2(schema5.maxLength) && node2.value.length > schema5.maxLength) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, + if (isNumber2(schema4.maxLength) && value.length > ((_b = schema4.maxLength) != null ? _b : 0)) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, severity: DiagnosticSeverity.Warning, - message: t("maxLengthWarning", schema5.maxLength), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) + message: t("String is longer than the maximum length of {0}.", schema4.maxLength), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) }); } - if (isString2(schema5.pattern)) { - const regex = safeCreateUnicodeRegExp(schema5.pattern); - if (!regex.test(node2.value)) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, + if (isString2(schema4.pattern)) { + const regex = safeCreateUnicodeRegExp(schema4.pattern); + if (!regex.test(value)) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, severity: DiagnosticSeverity.Warning, - message: schema5.patternErrorMessage || schema5.errorMessage || t("patternWarning", schema5.pattern), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) + message: schema4.patternErrorMessage || schema4.errorMessage || t('String does not match the pattern of "{0}".', schema4.pattern), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) }); } } - if (schema5.format) { - switch (schema5.format) { + if (schema4.format) { + switch (schema4.format) { case "uri": - case "uri-reference": - { - let errorMessage; - if (!node2.value) { - errorMessage = t("uriEmpty"); - } else { - try { - const uri = URI.parse(node2.value); - if (!uri.scheme && schema5.format === "uri") { - errorMessage = t("uriSchemeMissing"); - } - } catch (e) { - errorMessage = e.message; + case "uri-reference": { + let errorMessage; + if (!value) { + errorMessage = t("URI expected."); + } else { + try { + const uri = URI.parse(value); + if (!uri.scheme && schema4.format === "uri") { + errorMessage = t("URI with a scheme is expected."); } + } catch (e) { + errorMessage = e instanceof Error ? e.message : String(e); } - if (errorMessage) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, - severity: DiagnosticSeverity.Warning, - message: schema5.patternErrorMessage || schema5.errorMessage || t("uriFormatWarning", errorMessage), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) - }); - } + } + if (errorMessage) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: schema4.patternErrorMessage || schema4.errorMessage || t("String is not a URI: {0}", errorMessage), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); } break; + } case "color-hex": case "date-time": case "date": case "time": case "email": case "ipv4": - case "ipv6": - { - const format6 = formats2[schema5.format]; - if (!node2.value || !format6.pattern.test(node2.value)) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, - severity: DiagnosticSeverity.Warning, - message: schema5.patternErrorMessage || schema5.errorMessage || t(format6.errorMessage), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) - }); - } + case "ipv6": { + const format6 = formats2[schema4.format]; + if (!value || !format6.pattern.test(value)) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: schema4.patternErrorMessage || schema4.errorMessage || t(format6.errorMessage), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); } break; + } default: + break; } } } - function _validateArrayNode(node2, schema5, validationResult2, matchingSchemas2) { - if (Array.isArray(schema5.items)) { - const subSchemas = schema5.items; - for (let index = 0; index < subSchemas.length; index++) { - const subSchemaRef = subSchemas[index]; - const subSchema = asSchema2(subSchemaRef); - const itemValidationResult = new ValidationResult2(isKubernetes); - const item = node2.items[index]; - if (item) { - validate2(item, subSchema, schema5, itemValidationResult, matchingSchemas2, options); - validationResult2.mergePropertyMatch(itemValidationResult); - validationResult2.mergeEnumValues(itemValidationResult); - } else if (node2.items.length >= subSchemas.length) { - validationResult2.propertiesValueMatches++; - } + validateNumberNode(node, schema4, originalSchema, validationResult) { + var _a; + const val = node.value; + if (isNumber2(schema4.multipleOf)) { + if (floatSafeRemainder(val, (_a = schema4.multipleOf) != null ? _a : 0) !== 0) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: t("Value is not divisible by {0}.", schema4.multipleOf), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); } - if (node2.items.length > subSchemas.length) { - if (typeof schema5.additionalItems === "object") { - for (let i = subSchemas.length; i < node2.items.length; i++) { - const itemValidationResult = new ValidationResult2(isKubernetes); - validate2(node2.items[i], schema5.additionalItems, schema5, itemValidationResult, matchingSchemas2, options); - validationResult2.mergePropertyMatch(itemValidationResult); - validationResult2.mergeEnumValues(itemValidationResult); - } - } else if (schema5.additionalItems === false) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, + } + const limits = this.getNumberLimits(schema4); + if (isNumber2(limits.exclusiveMinimum) && val <= limits.exclusiveMinimum) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: t("Value is below the exclusive minimum of {0}.", limits.exclusiveMinimum), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); + } + if (isNumber2(limits.exclusiveMaximum) && val >= limits.exclusiveMaximum) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: t("Value is above the exclusive maximum of {0}.", limits.exclusiveMaximum), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); + } + if (isNumber2(limits.minimum) && val < limits.minimum) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: t("Value is below the minimum of {0}.", limits.minimum), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); + } + if (isNumber2(limits.maximum) && val > limits.maximum) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: t("Value is above the maximum of {0}.", limits.maximum), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); + } + } + // ---------------- array validation (draft hotspot) ---------------- + validateArrayNode(node, schema4, originalSchema, validationResult, matchingSchemas, options) { + var _a; + const { isKubernetes } = options; + const items = (_a = node.items) != null ? _a : []; + const evaluatedItems = schema4.items ? validationResult.getEvaluatedItems(node) : void 0; + if (Array.isArray(schema4.items)) { + const subSchemas = schema4.items; + for (let index = 0; index < subSchemas.length; index++) { + const subSchema = asSchema2(subSchemas[index]); + const itemValidationResult = new ValidationResult2(isKubernetes); + const item = items[index]; + if (item) { + this.validateNode(item, subSchema, schema4, itemValidationResult, matchingSchemas, options); + validationResult.mergePropertyMatch(itemValidationResult, false); + validationResult.mergeEnumValues(itemValidationResult); + evaluatedItems == null ? void 0 : evaluatedItems.add(index); + } else if (items.length >= subSchemas.length) { + validationResult.propertiesValueMatches++; + } + } + if (items.length > subSchemas.length) { + const additional = schema4.additionalItems; + if (additional === false) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, severity: DiagnosticSeverity.Warning, - message: t("additionalItemsWarning", subSchemas.length), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) + message: t("Array has too many items according to schema. Expected {0} or fewer.", subSchemas.length), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) }); + for (let i = subSchemas.length; i < items.length; i++) { + evaluatedItems == null ? void 0 : evaluatedItems.add(i); + } + } else if (typeof additional === "object") { + for (let i = subSchemas.length; i < items.length; i++) { + const itemValidationResult = new ValidationResult2(isKubernetes); + this.validateNode(items[i], additional, schema4, itemValidationResult, matchingSchemas, options); + validationResult.mergePropertyMatch(itemValidationResult, false); + validationResult.mergeEnumValues(itemValidationResult); + evaluatedItems == null ? void 0 : evaluatedItems.add(i); + } + } else if (additional === true) { + for (let i = subSchemas.length; i < items.length; i++) { + evaluatedItems == null ? void 0 : evaluatedItems.add(i); + } } } } else { - const itemSchema = asSchema2(schema5.items); + const itemSchema = asSchema2(schema4.items); if (itemSchema) { - const itemValidationResult = new ValidationResult2(isKubernetes); - node2.items.forEach((item) => { - if (itemSchema.oneOf && itemSchema.oneOf.length === 1) { - const subSchemaRef = itemSchema.oneOf[0]; - const subSchema = { ...asSchema2(subSchemaRef) }; - subSchema.title = schema5.title; - subSchema.closestTitle = schema5.closestTitle; - validate2(item, subSchema, schema5, itemValidationResult, matchingSchemas2, options); - validationResult2.mergePropertyMatch(itemValidationResult); - validationResult2.mergeEnumValues(itemValidationResult); - } else { - validate2(item, itemSchema, schema5, itemValidationResult, matchingSchemas2, options); - validationResult2.mergePropertyMatch(itemValidationResult); - validationResult2.mergeEnumValues(itemValidationResult); - } - }); + const currentEvaluatedItems = validationResult.getEvaluatedItems(node); + for (let i = 0; i < items.length; i++) { + const item = items[i]; + const itemValidationResult = new ValidationResult2(isKubernetes); + this.validateNode(item, itemSchema, schema4, itemValidationResult, matchingSchemas, options); + validationResult.mergePropertyMatch(itemValidationResult, false); + validationResult.mergeEnumValues(itemValidationResult); + currentEvaluatedItems.add(i); + } } } - const containsSchema = asSchema2(schema5.contains); - if (containsSchema) { - const doesContain = node2.items.some((item) => { - const itemValidationResult = new ValidationResult2(isKubernetes); - validate2(item, containsSchema, schema5, itemValidationResult, NoOpSchemaCollector2.instance, options); - return !itemValidationResult.hasProblems(); + this.applyContains(node, schema4, originalSchema, validationResult, matchingSchemas, options); + this.applyArrayLength(node, schema4, originalSchema, validationResult, options); + this.applyUniqueItems(node, schema4, originalSchema, validationResult); + } + applyContains(node, schema4, originalSchema, validationResult, _matchingSchemas, options) { + var _a; + const { isKubernetes } = options; + const containsSchema = asSchema2(schema4.contains); + if (!containsSchema) + return; + const doesContain = ((_a = node.items) != null ? _a : []).some((item) => { + const itemValidationResult = new ValidationResult2(isKubernetes); + this.validateNode(item, containsSchema, schema4, itemValidationResult, NoOpSchemaCollector2.instance, options); + return !itemValidationResult.hasProblems(); + }); + if (!doesContain) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: schema4.errorMessage || t("Array does not contain required item."), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) }); - if (!doesContain) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, - severity: DiagnosticSeverity.Warning, - message: schema5.errorMessage || t("requiredItemMissingWarning"), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) - }); - } } - if (isNumber2(schema5.minItems) && node2.items.length < schema5.minItems) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, + } + applyArrayLength(node, schema4, originalSchema, validationResult, _options) { + var _a, _b; + if (isNumber2(schema4.minItems) && node.items.length < ((_a = schema4.minItems) != null ? _a : 0)) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, severity: DiagnosticSeverity.Warning, - message: t("minItemsWarning", schema5.minItems), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) + message: t("Array has too few items. Expected {0} or more.", schema4.minItems), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) }); } - if (isNumber2(schema5.maxItems) && node2.items.length > schema5.maxItems) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, + if (isNumber2(schema4.maxItems) && node.items.length > ((_b = schema4.maxItems) != null ? _b : 0)) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, severity: DiagnosticSeverity.Warning, - message: t("maxItemsWarning", schema5.maxItems), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) + message: t("Array has too many items. Expected {0} or fewer.", schema4.maxItems), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) }); } - if (schema5.uniqueItems === true) { - const values = getNodeValue4(node2); - const duplicates = values.some((value, index) => { - return index !== values.lastIndexOf(value); - }); + } + applyUniqueItems(node, schema4, originalSchema, validationResult) { + if (schema4.uniqueItems === true) { + const values = getNodeValue4(node); + const duplicates = Array.isArray(values) && values.some((v, i) => i !== values.lastIndexOf(v)); if (duplicates) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, severity: DiagnosticSeverity.Warning, - message: t("uniqueItemsWarning"), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) + message: t("Array has duplicate items."), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) }); } } } - function _validateObjectNode(node2, schema5, validationResult2, matchingSchemas2) { - var _a; + // ---------------- object validation ---------------- + validateObjectNode(node, schema4, originalSchema, validationResult, matchingSchemas, options) { const seenKeys = /* @__PURE__ */ Object.create(null); const unprocessedProperties = []; - const unprocessedNodes = [...node2.properties]; + const unprocessedNodes = [...node.properties]; while (unprocessedNodes.length > 0) { const propertyNode = unprocessedNodes.pop(); + if (!propertyNode) + continue; const key = propertyNode.keyNode.value; if (key === "<<" && propertyNode.valueNode) { switch (propertyNode.valueNode.type) { - case "object": { - unprocessedNodes.push(...propertyNode.valueNode["properties"]); + case "object": + unprocessedNodes.push(...propertyNode.valueNode.properties); break; - } - case "array": { - propertyNode.valueNode["items"].forEach((sequenceNode) => { - if (sequenceNode && isIterable(sequenceNode["properties"])) { - unprocessedNodes.push(...sequenceNode["properties"]); + case "array": + propertyNode.valueNode.items.forEach((sequenceNode) => { + if (sequenceNode && sequenceNode.type === "object" && isIterable(sequenceNode.properties)) { + unprocessedNodes.push(...sequenceNode.properties); } }); break; - } - default: { + default: break; - } } } else { seenKeys[key] = propertyNode.valueNode; unprocessedProperties.push(key); } } - if (Array.isArray(schema5.required)) { - for (const propertyName of schema5.required) { + const propertyProcessed = (prop) => { + let index = unprocessedProperties.indexOf(prop); + while (index >= 0) { + unprocessedProperties.splice(index, 1); + index = unprocessedProperties.indexOf(prop); + } + }; + this.applyRequired(node, schema4, originalSchema, validationResult, options, seenKeys); + this.applyProperties(node, schema4, originalSchema, validationResult, matchingSchemas, options, seenKeys, unprocessedProperties, propertyProcessed); + this.applyPatternProperties(node, schema4, originalSchema, validationResult, matchingSchemas, options, seenKeys, unprocessedProperties, propertyProcessed); + this.applyAdditionalProperties(node, schema4, originalSchema, validationResult, matchingSchemas, options, seenKeys, unprocessedProperties); + this.applyPropertyCount(node, schema4, originalSchema, validationResult); + this.applyDependencies(node, schema4, originalSchema, validationResult, matchingSchemas, options, seenKeys); + this.applyPropertyNames(node, schema4, validationResult, options); + } + applyRequired(node, schema4, originalSchema, validationResult, _options, seenKeys) { + if (Array.isArray(schema4.required)) { + for (const propertyName of schema4.required) { if (seenKeys[propertyName] === void 0) { - const keyNode = node2.parent && node2.parent.type === "property" && node2.parent.keyNode; - const location = keyNode ? { offset: keyNode.offset, length: keyNode.length } : { offset: node2.offset, length: 1 }; - validationResult2.problems.push({ + const keyNode = node.parent && node.parent.type === "property" && node.parent.keyNode; + const location = keyNode ? { offset: keyNode.offset, length: keyNode.length } : { offset: node.offset, length: 1 }; + validationResult.problems.push({ location, severity: DiagnosticSeverity.Warning, - message: getWarningMessage(ProblemType.missingRequiredPropWarning, [propertyName]), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema), + message: schema4.errorMessage || getWarningMessage(ProblemType.missingRequiredPropWarning, [propertyName]), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema), problemArgs: [propertyName], problemType: ProblemType.missingRequiredPropWarning }); } } } - const propertyProcessed = (prop) => { - let index = unprocessedProperties.indexOf(prop); - while (index >= 0) { - unprocessedProperties.splice(index, 1); - index = unprocessedProperties.indexOf(prop); + } + applyProperties(_node, schema4, originalSchema, validationResult, matchingSchemas, options, seenKeys, _unprocessedProperties, propertyProcessed) { + var _a, _b; + const { isKubernetes } = options; + const props = schema4.properties; + if (!props) + return; + for (const propertyName of Object.keys(props)) { + propertyProcessed(propertyName); + const propertySchemaRef = props[propertyName]; + const child = seenKeys[propertyName]; + if (!child) + continue; + (_a = validationResult.evaluatedProperties) != null ? _a : validationResult.evaluatedProperties = /* @__PURE__ */ new Set(); + validationResult.evaluatedProperties.add(propertyName); + if (isBoolean2(propertySchemaRef)) { + if (!propertySchemaRef) { + const propertyNode = child.parent; + validationResult.problems.push({ + location: { offset: propertyNode.keyNode.offset, length: propertyNode.keyNode.length }, + severity: DiagnosticSeverity.Warning, + message: schema4.errorMessage || t("Property {0} is not allowed.", propertyName), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); + } else { + validationResult.propertiesMatches++; + validationResult.propertiesValueMatches++; + } + } else { + propertySchemaRef.url = (_b = schema4.url) != null ? _b : originalSchema.url; + const propertyValidationResult = new ValidationResult2(isKubernetes); + this.validateNode(child, propertySchemaRef, schema4, propertyValidationResult, matchingSchemas, options); + validationResult.mergePropertyMatch(propertyValidationResult, false); + validationResult.mergeEnumValues(propertyValidationResult); } - }; - if (schema5.properties) { - for (const propertyName of Object.keys(schema5.properties)) { + } + } + applyPatternProperties(_node, schema4, originalSchema, validationResult, matchingSchemas, options, seenKeys, unprocessedProperties, propertyProcessed) { + var _a; + const { isKubernetes } = options; + const patternProps = schema4.patternProperties; + if (!patternProps) + return; + for (const propertyPattern of Object.keys(patternProps)) { + const regex = safeCreateUnicodeRegExp(propertyPattern); + for (const propertyName of unprocessedProperties.slice(0)) { + if (!regex.test(propertyName)) + continue; propertyProcessed(propertyName); - const propertySchema = schema5.properties[propertyName]; const child = seenKeys[propertyName]; - if (child) { - if (isBoolean2(propertySchema)) { - if (!propertySchema) { - const propertyNode = child.parent; - validationResult2.problems.push({ - location: { - offset: propertyNode.keyNode.offset, - length: propertyNode.keyNode.length - }, - severity: DiagnosticSeverity.Warning, - message: schema5.errorMessage || t("DisallowedExtraPropWarning", propertyName), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) - }); - } else { - validationResult2.propertiesMatches++; - validationResult2.propertiesValueMatches++; - } + if (!child) + continue; + (_a = validationResult.evaluatedProperties) != null ? _a : validationResult.evaluatedProperties = /* @__PURE__ */ new Set(); + validationResult.evaluatedProperties.add(propertyName); + const propertySchemaRef = patternProps[propertyPattern]; + if (isBoolean2(propertySchemaRef)) { + if (!propertySchemaRef) { + const propertyNode = child.parent; + validationResult.problems.push({ + location: { offset: propertyNode.keyNode.offset, length: propertyNode.keyNode.length }, + severity: DiagnosticSeverity.Warning, + message: schema4.errorMessage || t("Property {0} is not allowed.", propertyName), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); } else { - propertySchema.url = (_a = schema5.url) != null ? _a : originalSchema.url; - const propertyValidationResult = new ValidationResult2(isKubernetes); - validate2(child, propertySchema, schema5, propertyValidationResult, matchingSchemas2, options); - validationResult2.mergePropertyMatch(propertyValidationResult); - validationResult2.mergeEnumValues(propertyValidationResult); - } - } - } - } - if (schema5.patternProperties) { - for (const propertyPattern of Object.keys(schema5.patternProperties)) { - const regex = safeCreateUnicodeRegExp(propertyPattern); - for (const propertyName of unprocessedProperties.slice(0)) { - if (regex.test(propertyName)) { - propertyProcessed(propertyName); - const child = seenKeys[propertyName]; - if (child) { - const propertySchema = schema5.patternProperties[propertyPattern]; - if (isBoolean2(propertySchema)) { - if (!propertySchema) { - const propertyNode = child.parent; - validationResult2.problems.push({ - location: { - offset: propertyNode.keyNode.offset, - length: propertyNode.keyNode.length - }, - severity: DiagnosticSeverity.Warning, - message: schema5.errorMessage || t("DisallowedExtraPropWarning", propertyName), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) - }); - } else { - validationResult2.propertiesMatches++; - validationResult2.propertiesValueMatches++; - } - } else { - const propertyValidationResult = new ValidationResult2(isKubernetes); - validate2(child, propertySchema, schema5, propertyValidationResult, matchingSchemas2, options); - validationResult2.mergePropertyMatch(propertyValidationResult); - validationResult2.mergeEnumValues(propertyValidationResult); - } - } + validationResult.propertiesMatches++; + validationResult.propertiesValueMatches++; } + } else { + const propertyValidationResult = new ValidationResult2(isKubernetes); + this.validateNode(child, propertySchemaRef, schema4, propertyValidationResult, matchingSchemas, options); + validationResult.mergePropertyMatch(propertyValidationResult, false); + validationResult.mergeEnumValues(propertyValidationResult); } } } - if (typeof schema5.additionalProperties === "object") { + } + applyAdditionalProperties(_node, schema4, originalSchema, validationResult, matchingSchemas, options, seenKeys, unprocessedProperties) { + var _a, _b, _c, _d; + const { isKubernetes } = options; + const additional = schema4.additionalProperties; + if (typeof additional === "object") { for (const propertyName of unprocessedProperties) { const child = seenKeys[propertyName]; - if (child) { - const propertyValidationResult = new ValidationResult2(isKubernetes); - validate2(child, schema5.additionalProperties, schema5, propertyValidationResult, matchingSchemas2, options); - validationResult2.mergePropertyMatch(propertyValidationResult); - validationResult2.mergeEnumValues(propertyValidationResult); - } + if (!child) + continue; + (_a = validationResult.evaluatedProperties) != null ? _a : validationResult.evaluatedProperties = /* @__PURE__ */ new Set(); + validationResult.evaluatedProperties.add(propertyName); + const propertyValidationResult = new ValidationResult2(isKubernetes); + this.validateNode(child, additional, schema4, propertyValidationResult, matchingSchemas, options); + validationResult.mergePropertyMatch(propertyValidationResult, false); + validationResult.mergeEnumValues(propertyValidationResult); } - } else if (schema5.additionalProperties === false || schema5.type === "object" && schema5.additionalProperties === void 0 && options.disableAdditionalProperties === true) { + return; + } + if (additional === true) { if (unprocessedProperties.length > 0) { - const possibleProperties = schema5.properties && Object.entries(schema5.properties).filter(([key, property]) => { - if (seenKeys[key]) { - return false; - } - if (property && typeof property === "object" && (property.doNotSuggest || property.deprecationMessage)) { - return false; - } - return true; - }).map(([key]) => key); + (_b = validationResult.evaluatedProperties) != null ? _b : validationResult.evaluatedProperties = /* @__PURE__ */ new Set(); for (const propertyName of unprocessedProperties) { - const child = seenKeys[propertyName]; - if (child) { - let propertyNode = null; - if (child.type !== "property") { - propertyNode = child.parent; - if (propertyNode.type === "object") { - propertyNode = propertyNode.properties[0]; - } - } else { - propertyNode = child; - } - const problem = { - location: { - offset: propertyNode.keyNode.offset, - length: propertyNode.keyNode.length - }, - severity: DiagnosticSeverity.Warning, - code: ErrorCode.PropertyExpected, - message: schema5.errorMessage || t("DisallowedExtraPropWarning", propertyName), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) - }; - if (possibleProperties == null ? void 0 : possibleProperties.length) { - problem.data = { properties: possibleProperties }; - } - validationResult2.problems.push(problem); + if (seenKeys[propertyName]) { + validationResult.evaluatedProperties.add(propertyName); } } } + return; } - if (isNumber2(schema5.maxProperties)) { - if (node2.properties.length > schema5.maxProperties) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, - severity: DiagnosticSeverity.Warning, - message: t("MaxPropWarning", schema5.maxProperties), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) - }); + const forbidExtra = additional === false || schema4.type === "object" && additional === void 0 && options.disableAdditionalProperties === true; + if (!forbidExtra) + return; + if (unprocessedProperties.length === 0) + return; + const possibleProperties = schema4.properties && Object.entries(schema4.properties).filter(([key, property]) => { + if (seenKeys[key]) + return false; + if (property && typeof property === "object" && (property.doNotSuggest || property.deprecationMessage)) + return false; + return true; + }).map(([key]) => key); + for (const propertyName of unprocessedProperties) { + const child = seenKeys[propertyName]; + if (!child) + continue; + let propertyNode = child.type === "property" ? child : (_c = child.parent) != null ? _c : child; + if (propertyNode.type === "object") { + propertyNode = (_d = propertyNode.properties[0]) != null ? _d : propertyNode; } + const keyNode = propertyNode.type === "property" ? propertyNode.keyNode : propertyNode; + const problem = { + location: { offset: keyNode.offset, length: keyNode.length }, + severity: DiagnosticSeverity.Warning, + code: ErrorCode.PropertyExpected, + message: schema4.errorMessage || t("Property {0} is not allowed.", propertyName), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }; + if (possibleProperties == null ? void 0 : possibleProperties.length) + problem.data = { properties: possibleProperties }; + validationResult.problems.push(problem); } - if (isNumber2(schema5.minProperties)) { - if (node2.properties.length < schema5.minProperties) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, - severity: DiagnosticSeverity.Warning, - message: t("MinPropWarning", schema5.minProperties), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) - }); - } + } + applyPropertyCount(node, schema4, originalSchema, validationResult) { + var _a, _b; + if (isNumber2(schema4.maxProperties) && node.properties.length > ((_a = schema4.maxProperties) != null ? _a : 0)) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: t("Object has more properties than limit of {0}.", schema4.maxProperties), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); } - if (schema5.dependencies) { - for (const key of Object.keys(schema5.dependencies)) { - const prop = seenKeys[key]; - if (prop) { - const propertyDep = schema5.dependencies[key]; - if (Array.isArray(propertyDep)) { - for (const requiredProp of propertyDep) { - if (!seenKeys[requiredProp]) { - validationResult2.problems.push({ - location: { offset: node2.offset, length: node2.length }, - severity: DiagnosticSeverity.Warning, - message: t("RequiredDependentPropWarning", requiredProp, key), - source: getSchemaSource(schema5, originalSchema), - schemaUri: getSchemaUri(schema5, originalSchema) - }); - } else { - validationResult2.propertiesValueMatches++; - } - } + if (isNumber2(schema4.minProperties) && node.properties.length < ((_b = schema4.minProperties) != null ? _b : 0)) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: t("Object has fewer properties than the required number of {0}", schema4.minProperties), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); + } + } + applyDependencies(node, schema4, originalSchema, validationResult, matchingSchemas, options, seenKeys) { + const { isKubernetes } = options; + const deps = schema4.dependencies; + if (!deps) + return; + for (const key of Object.keys(deps)) { + const prop = seenKeys[key]; + if (!prop) + continue; + const propertyDep = deps[key]; + if (Array.isArray(propertyDep)) { + for (const requiredProp of propertyDep) { + if (!seenKeys[requiredProp]) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: t("Object is missing property {0} required by property {1}.", requiredProp, key), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); } else { - const propertySchema = asSchema2(propertyDep); - if (propertySchema) { - const propertyValidationResult = new ValidationResult2(isKubernetes); - validate2(node2, propertySchema, schema5, propertyValidationResult, matchingSchemas2, options); - validationResult2.mergePropertyMatch(propertyValidationResult); - validationResult2.mergeEnumValues(propertyValidationResult); - } + validationResult.propertiesValueMatches++; } } + } else { + const propertySchema = asSchema2(propertyDep); + if (propertySchema) { + const propertyValidationResult = new ValidationResult2(isKubernetes); + this.validateNode(node, propertySchema, schema4, propertyValidationResult, matchingSchemas, options); + validationResult.mergePropertyMatch(propertyValidationResult); + validationResult.mergeEnumValues(propertyValidationResult); + } } } - const propertyNames = asSchema2(schema5.propertyNames); - if (propertyNames) { - for (const f2 of node2.properties) { - const key = f2.keyNode; - if (key) { - validate2(key, propertyNames, schema5, validationResult2, NoOpSchemaCollector2.instance, options); - } + } + applyPropertyNames(node, schema4, validationResult, options) { + const propertyNames = asSchema2(schema4.propertyNames); + if (!propertyNames) + return; + for (const f2 of node.properties) { + const key = f2.keyNode; + if (key) { + this.validateNode(key, propertyNames, schema4, validationResult, NoOpSchemaCollector2.instance, options); } } } - function alternativeComparison(subValidationResult, bestMatch, subSchema, subMatchingSchemas) { + // ---------------- unevaluated hooks (2019/2020) ---------------- + applyUnevaluatedProperties(_node, _schema, _originalSchema, _validationResult, _matchingSchemas, _options, _seenKeys, _unprocessedProperties) { + } + applyUnevaluatedItems(_node, _schema, _originalSchema, _validationResult, _matchingSchemas, _options) { + } + // ---------------- best-match helpers ---------------- + alternativeComparison(subValidationResult, bestMatch, subSchema, subMatchingSchemas) { const compareResult = subValidationResult.compareKubernetes(bestMatch.validationResult); if (compareResult > 0) { - bestMatch = { - schema: subSchema, - validationResult: subValidationResult, - matchingSchemas: subMatchingSchemas - }; - } else if (compareResult === 0) { + return { schema: subSchema, validationResult: subValidationResult, matchingSchemas: subMatchingSchemas }; + } + if (compareResult === 0) { bestMatch.matchingSchemas.merge(subMatchingSchemas); bestMatch.validationResult.mergeEnumValues(subValidationResult); } return bestMatch; } - function genericComparison(node2, maxOneMatch, subValidationResult, bestMatch, subSchema, subMatchingSchemas) { + genericComparison(node, maxOneMatch, subValidationResult, bestMatch, subSchema, subMatchingSchemas) { if (!maxOneMatch && !subValidationResult.hasProblems() && !bestMatch.validationResult.hasProblems()) { bestMatch.matchingSchemas.merge(subMatchingSchemas); bestMatch.validationResult.propertiesMatches += subValidationResult.propertiesMatches; bestMatch.validationResult.propertiesValueMatches += subValidationResult.propertiesValueMatches; } else { const compareResult = subValidationResult.compareGeneric(bestMatch.validationResult); - if (compareResult > 0 || compareResult === 0 && maxOneMatch && bestMatch.schema.type === "object" && node2.type !== "null" && node2.type !== bestMatch.schema.type) { - bestMatch = { - schema: subSchema, - validationResult: subValidationResult, - matchingSchemas: subMatchingSchemas - }; - } else if (compareResult === 0 || (node2.value === null || node2.type === "null") && node2.length === 0) { - mergeValidationMatches(bestMatch, subMatchingSchemas, subValidationResult); + if (compareResult > 0 || compareResult === 0 && maxOneMatch && bestMatch.schema.type === "object" && node.type !== "null" && node.type !== bestMatch.schema.type) { + bestMatch = { schema: subSchema, validationResult: subValidationResult, matchingSchemas: subMatchingSchemas }; + } else if (compareResult === 0 || (node.value === null || node.type === "null") && node.length === 0) { + this.mergeValidationMatches(bestMatch, subMatchingSchemas, subValidationResult); } } return bestMatch; } - function mergeValidationMatches(bestMatch, subMatchingSchemas, subValidationResult) { + mergeValidationMatches(bestMatch, subMatchingSchemas, subValidationResult) { bestMatch.matchingSchemas.merge(subMatchingSchemas); bestMatch.validationResult.mergeEnumValues(subValidationResult); bestMatch.validationResult.mergeWarningGeneric(subValidationResult, [ @@ -45214,52 +41372,568 @@ function validate2(node, schema4, originalSchema, validationResult, matchingSche ProblemType.constWarning ]); } -} -function getSchemaSource(schema4, originalSchema) { - var _a; - if (schema4) { - let label; - if (schema4.title) { - label = schema4.title; - } else if (schema4.closestTitle) { - label = schema4.closestTitle; - } else if (originalSchema.closestTitle) { - label = originalSchema.closestTitle; - } else { - const uriString = (_a = schema4.url) != null ? _a : originalSchema.url; - if (uriString) { - const url = URI.parse(uriString); - if (url.scheme === "file") { - label = url.fsPath; - } - label = url.toString(); - } - } - if (label) { - return `${YAML_SCHEMA_PREFIX}${label}`; - } +}; +function asSchema2(schema4) { + if (schema4 === void 0) + return void 0; + if (isBoolean2(schema4)) + return schema4 ? {} : { not: {} }; + if (typeof schema4 !== "object") { + console.warn(`Wrong schema: ${JSON.stringify(schema4)}, it MUST be an Object or Boolean`); + return { type: schema4 }; } - return YAML_SOURCE; -} -function getSchemaUri(schema4, originalSchema) { - var _a; - const uriString = (_a = schema4.url) != null ? _a : originalSchema.url; - return uriString ? [uriString] : []; + return schema4; } function getWarningMessage(problemType, args) { return t(ProblemTypeMessages[problemType], args.join(" | ")); } function isAutoCompleteEqualMaybe(callFromAutoComplete, node, nodeValue, schemaValue) { - if (!callFromAutoComplete) { + if (!callFromAutoComplete) return false; - } const isWithoutValue = nodeValue === null && node.length === 0; - if (isWithoutValue) { + if (isWithoutValue) return true; - } return isString2(nodeValue) && isString2(schemaValue) && schemaValue.startsWith(nodeValue); } +// ../../node_modules/yaml-language-server/lib/esm/languageservice/parser/schemaValidation/draft04Validator.js +var Draft04Validator = class extends BaseValidator { + getCurrentDialect() { + return SchemaDialect.draft04; + } + /** + * Keyword: exclusiveMinimum/exclusiveMaximum + * + * Booleans that make minimum/maximum exclusive. + */ + getNumberLimits(schema4) { + const minimum = isNumber2(schema4.minimum) ? schema4.minimum : void 0; + const maximum = isNumber2(schema4.maximum) ? schema4.maximum : void 0; + const exclusiveMinimum = isBoolean2(schema4.exclusiveMinimum) && schema4.exclusiveMinimum ? minimum : void 0; + const exclusiveMaximum = isBoolean2(schema4.exclusiveMaximum) && schema4.exclusiveMaximum ? maximum : void 0; + return { + minimum: exclusiveMinimum === void 0 ? minimum : void 0, + maximum: exclusiveMaximum === void 0 ? maximum : void 0, + exclusiveMinimum, + exclusiveMaximum + }; + } +}; + +// ../../node_modules/yaml-language-server/lib/esm/languageservice/parser/schemaValidation/draft07Validator.js +var Draft07Validator = class extends BaseValidator { + getCurrentDialect() { + return SchemaDialect.draft07; + } + /** + * Keyword: exclusiveMinimum/exclusiveMaximum are treated as numeric bounds + */ + getNumberLimits(schema4) { + const minimum = isNumber2(schema4.minimum) ? schema4.minimum : void 0; + const maximum = isNumber2(schema4.maximum) ? schema4.maximum : void 0; + const exclusiveMinimum = isNumber2(schema4.exclusiveMinimum) ? schema4.exclusiveMinimum : void 0; + const exclusiveMaximum = isNumber2(schema4.exclusiveMaximum) ? schema4.exclusiveMaximum : void 0; + return { + minimum: exclusiveMinimum === void 0 ? minimum : void 0, + maximum: exclusiveMaximum === void 0 ? maximum : void 0, + exclusiveMinimum, + exclusiveMaximum + }; + } +}; + +// ../../node_modules/yaml-language-server/lib/esm/languageservice/parser/schemaValidation/draft2019Validator.js +init_main(); +var Draft2019Validator = class extends Draft07Validator { + getCurrentDialect() { + return SchemaDialect.draft2019; + } + /** + * Keyword: contains + minContains/maxContains + * + * Draft-07 behavior: contains must match at least 1 item. + * Draft-2019-09 behavior: minContains/maxContains constrain how many matches are required/allowed. + */ + applyContains(node, schema4, originalSchema, validationResult, _matchingSchemas, options) { + var _a; + const containsSchema = asSchema2(schema4.contains); + if (!containsSchema) + return; + const minContainsRaw = schema4.minContains; + const maxContainsRaw = schema4.maxContains; + const minContains = isNumber2(minContainsRaw) ? minContainsRaw : 1; + const maxContains = isNumber2(maxContainsRaw) ? maxContainsRaw : void 0; + let matchCount = 0; + const items = (_a = node.items) != null ? _a : []; + for (const item of items) { + const itemValidationResult = new ValidationResult2(options.isKubernetes); + this.validateNode(item, containsSchema, schema4, itemValidationResult, this.getNoOpCollector(), options); + if (!itemValidationResult.hasProblems()) { + matchCount++; + if (maxContains !== void 0 && matchCount > maxContains) { + break; + } + } + } + if (matchCount < minContains) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: schema4.errorMessage || t('Array has too few items matching "contains". Expected {0} or more.', minContains), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); + } + if (maxContains !== void 0 && matchCount > maxContains) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: schema4.errorMessage || t('Array has too many items matching "contains". Expected {0} or fewer.', maxContains), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); + } + } + /** + * Keyword: dependentRequired + dependentSchemas. + */ + applyDependencies(node, schema4, originalSchema, validationResult, matchingSchemas, options, seenKeys) { + super.applyDependencies(node, schema4, originalSchema, validationResult, matchingSchemas, options, seenKeys); + const dependentRequired = schema4.dependentRequired; + if (dependentRequired && typeof dependentRequired === "object") { + for (const prop of Object.keys(dependentRequired)) { + if (!seenKeys[prop]) + continue; + const requiredProps = dependentRequired[prop]; + if (!Array.isArray(requiredProps)) + continue; + for (const requiredProp of requiredProps) { + if (!seenKeys[requiredProp]) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: t("Object is missing property {0} required by property {1}.", requiredProp, prop), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); + } else { + validationResult.propertiesValueMatches++; + } + } + } + } + const dependentSchemas = schema4.dependentSchemas; + if (dependentSchemas && typeof dependentSchemas === "object") { + for (const prop of Object.keys(dependentSchemas)) { + if (!seenKeys[prop]) + continue; + const depSchema = asSchema2(dependentSchemas[prop]); + if (!depSchema) + continue; + const depValidationResult = new ValidationResult2(options.isKubernetes); + this.validateNode(node, depSchema, schema4, depValidationResult, matchingSchemas, options); + validationResult.mergePropertyMatch(depValidationResult); + validationResult.mergeEnumValues(depValidationResult); + } + } + } + /** + * Keyword: unevaluatedProperties + */ + applyUnevaluatedProperties(node, schema4, originalSchema, validationResult, matchingSchemas, options, seenKeys) { + var _a, _b, _c, _d; + const unevaluated = schema4.unevaluatedProperties; + if (unevaluated === void 0) + return; + if (!seenKeys) + return; + (_a = validationResult.evaluatedProperties) != null ? _a : validationResult.evaluatedProperties = /* @__PURE__ */ new Set(); + const remaining = Object.keys(seenKeys).filter((name) => { + var _a2; + return !((_a2 = validationResult.evaluatedProperties) == null ? void 0 : _a2.has(name)); + }); + if (remaining.length === 0) + return; + if (unevaluated === false) { + for (const propName of remaining) { + const child = seenKeys[propName]; + if (!child) + continue; + const propertyNode = child.type === "property" ? child : child.parent; + const keyNode = propertyNode.keyNode; + if (!keyNode) + continue; + validationResult.problems.push({ + location: { offset: keyNode.offset, length: keyNode.length }, + severity: DiagnosticSeverity.Warning, + code: ErrorCode.PropertyExpected, + message: schema4.errorMessage || t("Property {0} is not allowed.", propName), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); + (_b = validationResult.evaluatedProperties) == null ? void 0 : _b.add(propName); + } + return; + } + if (unevaluated === true) { + for (const propName of remaining) { + (_c = validationResult.evaluatedProperties) == null ? void 0 : _c.add(propName); + } + return; + } + const unevaluatedSchema = asSchema2(unevaluated); + if (!unevaluatedSchema) + return; + for (const propName of remaining) { + const child = seenKeys[propName]; + if (!child) + continue; + const valueNode = child.type === "property" ? child.valueNode : child; + if (!valueNode) + continue; + const subResult = new ValidationResult2(options.isKubernetes); + this.validateNode(valueNode, unevaluatedSchema, schema4, subResult, matchingSchemas, options); + validationResult.mergePropertyMatch(subResult); + validationResult.mergeEnumValues(subResult); + (_d = validationResult.evaluatedProperties) == null ? void 0 : _d.add(propName); + } + } + /** + * Keyword: unevaluatedItems + */ + applyUnevaluatedItems(node, schema4, originalSchema, validationResult, matchingSchemas, options) { + var _a; + const unevaluated = schema4.unevaluatedItems; + if (unevaluated === void 0) + return; + const items = (_a = node.items) != null ? _a : []; + if (items.length === 0) + return; + const evaluated = validationResult.getEvaluatedItems(node); + const remaining = []; + for (let i = 0; i < items.length; i++) { + if (!evaluated.has(i)) + remaining.push(i); + } + if (remaining.length === 0) + return; + if (unevaluated === false) { + for (const idx of remaining) { + const item = items[idx]; + validationResult.problems.push({ + location: { offset: item.offset, length: item.length || 1 }, + severity: DiagnosticSeverity.Warning, + code: ErrorCode.PropertyExpected, + message: schema4.errorMessage || t("Array has too many items according to schema. Expected {0} or fewer.", idx), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); + evaluated.add(idx); + } + return; + } + if (unevaluated === true) { + for (const idx of remaining) + evaluated.add(idx); + return; + } + const unevaluatedSchema = asSchema2(unevaluated); + if (!unevaluatedSchema) + return; + for (const idx of remaining) { + const item = items[idx]; + const subResult = new ValidationResult2(options.isKubernetes); + this.validateNode(item, unevaluatedSchema, schema4, subResult, matchingSchemas, options); + validationResult.merge(subResult); + validationResult.mergeEnumValues(subResult); + evaluated.add(idx); + } + } +}; + +// ../../node_modules/yaml-language-server/lib/esm/languageservice/parser/schemaValidation/draft2020Validator.js +init_main(); +var Draft2020Validator = class extends Draft2019Validator { + getCurrentDialect() { + return SchemaDialect.draft2020; + } + /** + * Keyword: prefixItems + items + */ + validateArrayNode(node, schema4, originalSchema, validationResult, matchingSchemas, options) { + var _a; + const items = (_a = node.items) != null ? _a : []; + const evaluatedItems = validationResult.getEvaluatedItems(node); + const prefixItems = schema4.prefixItems; + if (Array.isArray(prefixItems)) { + const limit = Math.min(prefixItems.length, items.length); + for (let i = 0; i < limit; i++) { + const subSchema = asSchema2(prefixItems[i]); + if (!subSchema) { + evaluatedItems.add(i); + continue; + } + const itemValidationResult = new ValidationResult2(options.isKubernetes); + this.validateNode(items[i], subSchema, schema4, itemValidationResult, matchingSchemas, options); + validationResult.mergePropertyMatch(itemValidationResult, false); + validationResult.mergeEnumValues(itemValidationResult); + evaluatedItems.add(i); + } + } + const itemsKeyword = schema4.items; + const prefixLen = Array.isArray(prefixItems) ? prefixItems.length : 0; + if (items.length > prefixLen) { + if (itemsKeyword === false) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: t("Array has too many items according to schema. Expected {0} or fewer.", prefixLen), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); + for (let i = prefixLen; i < items.length; i++) { + evaluatedItems.add(i); + } + } else { + const tailSchema = asSchema2(itemsKeyword); + if (tailSchema) { + for (let i = prefixLen; i < items.length; i++) { + const itemValidationResult = new ValidationResult2(options.isKubernetes); + this.validateNode(items[i], tailSchema, schema4, itemValidationResult, matchingSchemas, options); + validationResult.mergePropertyMatch(itemValidationResult, false); + validationResult.mergeEnumValues(itemValidationResult); + evaluatedItems.add(i); + } + } + } + } + this.applyContains(node, schema4, originalSchema, validationResult, matchingSchemas, options); + this.applyArrayLength(node, schema4, originalSchema, validationResult, options); + this.applyUniqueItems(node, schema4, originalSchema, validationResult); + } + /** + * Draft 2020-12: contains keyword affects the unevaluatedItems keyword + */ + applyContains(node, schema4, originalSchema, validationResult, _matchingSchemas, options) { + var _a; + const containsSchema = asSchema2(schema4.contains); + if (!containsSchema) + return; + const items = (_a = node.items) != null ? _a : []; + const minContainsRaw = schema4.minContains; + const maxContainsRaw = schema4.maxContains; + const minContains = isNumber2(minContainsRaw) ? minContainsRaw : 1; + const maxContains = isNumber2(maxContainsRaw) ? maxContainsRaw : void 0; + let matchCount = 0; + const evaluatedItems = validationResult.getEvaluatedItems(node); + for (let i = 0; i < items.length; i++) { + const itemValidationResult = new ValidationResult2(options.isKubernetes); + this.validateNode(items[i], containsSchema, schema4, itemValidationResult, this.getNoOpCollector(), options); + if (!itemValidationResult.hasProblems()) { + evaluatedItems.add(i); + matchCount++; + if (maxContains !== void 0 && matchCount > maxContains) { + break; + } + } + } + if (matchCount < minContains) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: schema4.errorMessage || t('Array has too few items matching "contains". Expected {0} or more.', minContains), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); + } + if (maxContains !== void 0 && matchCount > maxContains) { + validationResult.problems.push({ + location: { offset: node.offset, length: node.length }, + severity: DiagnosticSeverity.Warning, + message: schema4.errorMessage || t('Array has too many items matching "contains". Expected {0} or fewer.', maxContains), + source: this.getSchemaSource(schema4, originalSchema), + schemaUri: this.getSchemaUri(schema4, originalSchema) + }); + } + } +}; + +// ../../node_modules/yaml-language-server/lib/esm/languageservice/parser/schemaValidation/validatorFactory.js +function getValidator(dialect) { + switch (dialect) { + case SchemaDialect.draft04: + return new Draft04Validator(); + case SchemaDialect.draft07: + return new Draft07Validator(); + case SchemaDialect.draft2019: + return new Draft2019Validator(); + case SchemaDialect.draft2020: + return new Draft2020Validator(); + default: + return new Draft07Validator(); + } +} + +// ../../node_modules/yaml-language-server/lib/esm/languageservice/parser/jsonDocument.js +var ASTNodeImpl2 = class { + constructor(parent, internalNode, offset, length) { + this.offset = offset; + this.length = length; + this.parent = parent; + this.internalNode = internalNode; + } + getNodeFromOffsetEndInclusive(offset) { + const collector = []; + const findNode2 = (node) => { + if (offset >= node.offset && offset <= node.offset + node.length) { + const children = node.children; + for (let i = 0; i < children.length && children[i].offset <= offset; i++) { + const item = findNode2(children[i]); + if (item) { + collector.push(item); + } + } + return node; + } + return null; + }; + const foundNode = findNode2(this); + let currMinDist = Number.MAX_VALUE; + let currMinNode = null; + for (const currNode of collector) { + const minDist = currNode.length + currNode.offset - offset + (offset - currNode.offset); + if (minDist < currMinDist) { + currMinNode = currNode; + currMinDist = minDist; + } + } + return currMinNode || foundNode; + } + get children() { + return []; + } + toString() { + return "type: " + this.type + " (" + this.offset + "/" + this.length + ")" + (this.parent ? " parent: {" + this.parent.toString() + "}" : ""); + } +}; +var NullASTNodeImpl2 = class extends ASTNodeImpl2 { + constructor(parent, internalNode, offset, length) { + super(parent, internalNode, offset, length); + this.type = "null"; + this.value = null; + } +}; +var BooleanASTNodeImpl2 = class extends ASTNodeImpl2 { + constructor(parent, internalNode, boolValue, boolSource, offset, length) { + super(parent, internalNode, offset, length); + this.type = "boolean"; + this.value = boolValue; + this.source = boolSource; + } +}; +var ArrayASTNodeImpl2 = class extends ASTNodeImpl2 { + constructor(parent, internalNode, offset, length) { + super(parent, internalNode, offset, length); + this.type = "array"; + this.items = []; + } + get children() { + return this.items; + } +}; +var NumberASTNodeImpl2 = class extends ASTNodeImpl2 { + constructor(parent, internalNode, offset, length) { + super(parent, internalNode, offset, length); + this.type = "number"; + this.isInteger = true; + this.value = Number.NaN; + } +}; +var StringASTNodeImpl2 = class extends ASTNodeImpl2 { + constructor(parent, internalNode, offset, length) { + super(parent, internalNode, offset, length); + this.type = "string"; + this.value = ""; + } +}; +var PropertyASTNodeImpl2 = class extends ASTNodeImpl2 { + constructor(parent, internalNode, offset, length) { + super(parent, internalNode, offset, length); + this.type = "property"; + this.colonOffset = -1; + } + get children() { + return this.valueNode ? [this.keyNode, this.valueNode] : [this.keyNode]; + } +}; +var ObjectASTNodeImpl2 = class extends ASTNodeImpl2 { + constructor(parent, internalNode, offset, length) { + super(parent, internalNode, offset, length); + this.type = "object"; + this.properties = []; + } + get children() { + return this.properties; + } +}; +var EnumMatch2; +(function(EnumMatch3) { + EnumMatch3[EnumMatch3["Key"] = 0] = "Key"; + EnumMatch3[EnumMatch3["Enum"] = 1] = "Enum"; +})(EnumMatch2 || (EnumMatch2 = {})); +var JSONDocument2 = class { + constructor(root, syntaxErrors = [], comments = []) { + this.root = root; + this.syntaxErrors = syntaxErrors; + this.comments = comments; + } + getNodeFromOffset(offset, includeRightBound = false) { + if (this.root) { + return findNodeAtOffset3(this.root, offset, includeRightBound); + } + return void 0; + } + getNodeFromOffsetEndInclusive(offset) { + return this.root && this.root.getNodeFromOffsetEndInclusive(offset); + } + visit(visitor) { + if (this.root) { + const doVisit = (node) => { + let ctn = visitor(node); + const children = node.children; + if (Array.isArray(children)) { + for (let i = 0; i < children.length && ctn; i++) { + ctn = doVisit(children[i]); + } + } + return ctn; + }; + doVisit(this.root); + } + } + validate(textDocument, schema4) { + if (!this.root || !schema4) + return null; + const validator = getValidator(schema4._dialect); + return validator.validateDocument(this.root, textDocument, schema4, { + isKubernetes: this.isKubernetes, + disableAdditionalProperties: this.disableAdditionalProperties, + uri: this.uri + }); + } + getMatchingSchemas(schema4, focusOffset = -1, exclude = null, didCallFromAutoComplete) { + if (!this.root || !schema4) + return []; + const validator = getValidator(schema4._dialect); + return validator.getMatchingSchemas(this.root, schema4, { + isKubernetes: this.isKubernetes, + disableAdditionalProperties: this.disableAdditionalProperties, + uri: this.uri, + callFromAutoComplete: didCallFromAutoComplete + }, focusOffset, exclude); + } +}; + // ../../node_modules/yaml-language-server/lib/esm/languageservice/parser/ast-converter.js var aliasDepth = { maxRefCount: 1e3, @@ -45415,10 +42089,10 @@ function collectFlowMapRange(node) { return [start, end, end]; } -// ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/astUtils.js +// ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/yamlAstUtils.js function getParent(doc, nodeToFind) { let parentNode; - visit2(doc, (_2, node, path5) => { + visit2(doc, (_, node, path5) => { if (node === nodeToFind) { parentNode = path5[path5.length - 1]; return visit2.BREAK; @@ -45893,45 +42567,159 @@ function isModeline(lineText) { // ../../node_modules/yaml-language-server/lib/esm/languageservice/services/yamlSchemaService.js var import_ajv = __toESM(require_ajv()); var import_ajv_draft_04 = __toESM(require_dist()); -var ajv = new import_ajv.default(); -var ajv4 = new import_ajv_draft_04.default(); -var jsonSchema07 = require_json_schema_draft_07(); -var schema07Validator = ajv.compile(jsonSchema07); +var import__ = __toESM(require__()); +var import__2 = __toESM(require__2()); + +// ../../node_modules/yaml-language-server/lib/esm/languageservice/services/crdUtil.js +function autoDetectKubernetesSchemaFromDocument(doc, crdCatalogURI, kubernetesSchema) { + const res = getGroupVersionKindFromDocument(doc); + if (!res) { + return void 0; + } + const { group, version, kind } = res; + if (!group || !version || !kind) { + return void 0; + } + const k8sSchema = kubernetesSchema.schema; + const kubernetesBuildIns = (k8sSchema.oneOf || []).map((s) => { + if (typeof s === "boolean") { + return void 0; + } + return s._$ref || s.$ref; + }).filter((ref) => ref).map((ref) => ref.replace("_definitions.json#/definitions/", "").toLowerCase()); + const groupWithoutK8sIO = group.replace(".k8s.io", ""); + const k8sTypeName = `io.k8s.api.${groupWithoutK8sIO.toLowerCase()}.${version.toLowerCase()}.${kind.toLowerCase()}`; + if (kubernetesBuildIns.includes(k8sTypeName)) { + return void 0; + } + if (k8sTypeName.includes("openshift.io")) { + return `${crdCatalogURI}/openshift/v4.15-strict/${kind.toLowerCase()}_${group.toLowerCase()}_${version.toLowerCase()}.json`; + } + const schemaURL = `${crdCatalogURI}/${group.toLowerCase()}/${kind.toLowerCase()}_${version.toLowerCase()}.json`; + return schemaURL; +} +function getGroupVersionKindFromDocument(doc) { + if (doc instanceof SingleYAMLDocument) { + try { + const rootJSON = doc.root.internalNode.toJSON(); + if (!rootJSON) { + return void 0; + } + const groupVersion = rootJSON["apiVersion"]; + if (!groupVersion) { + return void 0; + } + const [group, version] = groupVersion.split("/"); + if (!group || !version) { + return void 0; + } + const kind = rootJSON["kind"]; + if (!kind) { + return void 0; + } + return { group, version, kind }; + } catch (error) { + console.error("Error parsing YAML document:", error); + return void 0; + } + } + return void 0; +} + +// ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/schemaUrls.js +var KUBERNETES_SCHEMA_URL = "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.32.1-standalone-strict/all.json"; +var JSON_SCHEMASTORE_URL = "https://www.schemastore.org/api/json/catalog.json"; +var CRD_CATALOG_URL = "https://raw.githubusercontent.com/datreeio/CRDs-catalog/main"; +function getSchemaUrls(schema4) { + const result = /* @__PURE__ */ new Map(); + if (!schema4) { + return result; + } + if (schema4.url) { + if (schema4.url.startsWith("schemaservice://combinedSchema/")) { + addSchemasForOf(schema4, result); + } else { + result.set(schema4.url, schema4); + } + } else { + addSchemasForOf(schema4, result); + } + return result; +} +function addSchemasForOf(schema4, result) { + if (schema4.allOf) { + addInnerSchemaUrls(schema4.allOf, result); + } + if (schema4.anyOf) { + addInnerSchemaUrls(schema4.anyOf, result); + } + if (schema4.oneOf) { + addInnerSchemaUrls(schema4.oneOf, result); + } +} +function addInnerSchemaUrls(schemas2, result) { + for (const subSchema of schemas2) { + if (!isBoolean2(subSchema) && subSchema.url && !result.has(subSchema.url)) { + result.set(subSchema.url, subSchema); + } + } +} + +// ../../node_modules/yaml-language-server/lib/esm/languageservice/services/yamlSchemaService.js +var ajv4 = new import_ajv_draft_04.default({ allErrors: true }); +var ajv7 = new import_ajv.default({ allErrors: true }); +var ajv2019 = new import__.default({ allErrors: true }); +var ajv2020 = new import__2.default({ allErrors: true }); var jsonSchema04 = require_json_schema_draft_04(); +var jsonSchema07 = require_json_schema_draft_07(); +var jsonSchema2019 = require_schema(); +var jsonSchema2020 = require_schema2(); var schema04Validator = ajv4.compile(jsonSchema04); -var SCHEMA_04_URI_WITH_HTTPS = ajv4.defaultMeta().replace("http://", "https://"); +var schema07Validator = ajv7.compile(jsonSchema07); +var schema2019Validator = ajv2019.compile(jsonSchema2019); +var schema2020Validator = ajv2020.compile(jsonSchema2020); +var schemaDialectCache = /* @__PURE__ */ new Map(); +var schemaDialectInFlight = /* @__PURE__ */ new Map(); +var REF_SIBLING_NONCONSTRAINT_KEYS = /* @__PURE__ */ new Set([ + "$ref", + "_$ref", + "$schema", + "$id", + "id", + "_baseUrl", + "_dialect", + "$anchor", + "$dynamicAnchor", + "$dynamicRef", + "$recursiveAnchor", + "$recursiveRef", + "definitions", + "$defs", + "$comment", + "title", + "description", + "$vocabulary", + "examples", + "default", + "url", + "closestTitle", + "unevaluatedProperties", + "unevaluatedItems" +]); var MODIFICATION_ACTIONS; (function(MODIFICATION_ACTIONS2) { MODIFICATION_ACTIONS2[MODIFICATION_ACTIONS2["delete"] = 0] = "delete"; MODIFICATION_ACTIONS2[MODIFICATION_ACTIONS2["add"] = 1] = "add"; MODIFICATION_ACTIONS2[MODIFICATION_ACTIONS2["deleteAll"] = 2] = "deleteAll"; })(MODIFICATION_ACTIONS || (MODIFICATION_ACTIONS = {})); -var FilePatternAssociation2 = class { - constructor(pattern) { - try { - this.patternRegExp = new RegExp(convertSimple2RegExpPattern(pattern) + "$"); - } catch (e) { - this.patternRegExp = null; - } - this.schemas = []; - } - addSchema(id) { - this.schemas.push(id); - } - matchesPattern(fileName) { - return this.patternRegExp && this.patternRegExp.test(fileName); - } - getSchemas() { - return this.schemas; - } -}; var YAMLSchemaService = class extends JSONSchemaService { - constructor(requestService, contextService, promiseConstructor) { + constructor(requestService, contextService, promiseConstructor, yamlSettings) { super(requestService, contextService, promiseConstructor); this.schemaUriToNameAndDescription = /* @__PURE__ */ new Map(); this.customSchemaProvider = void 0; this.requestService = requestService; this.schemaPriorityMapping = /* @__PURE__ */ new Map(); + this.yamlSettings = yamlSettings; } registerCustomSchemaProvider(customSchemaProvider) { this.customSchemaProvider = customSchemaProvider; @@ -45961,125 +42749,466 @@ var YAMLSchemaService = class extends JSONSchemaService { } return result; } + collectSchemaNodes(push, ...values) { + const collect = (value) => { + if (!value || typeof value !== "object") + return; + if (Array.isArray(value)) { + for (const entry of value) { + collect(entry); + } + return; + } + push(value); + }; + for (const value of values) { + collect(value); + } + } + schemaMapValues(map2) { + if (!map2 || typeof map2 !== "object") + return void 0; + return Object.values(map2); + } async resolveSchemaContent(schemaToResolve, schemaURL, dependencies) { + var _a; const resolveErrors = schemaToResolve.errors.slice(0); - let schema4 = schemaToResolve.schema; - const contextService = this.contextService; - const validator = this.normalizeId(schema4.$schema) === ajv4.defaultMeta() || this.normalizeId(schema4.$schema) === SCHEMA_04_URI_WITH_HTTPS ? schema04Validator : schema07Validator; - if (!validator(schema4)) { - const errs = []; - for (const err of validator.errors) { - errs.push(`${err.instancePath} : ${err.message}`); - } - resolveErrors.push(`Schema '${getSchemaTitle(schemaToResolve.schema, schemaURL)}' is not valid: -${errs.join("\n")}`); - } - const findSection = (schema5, path5) => { - if (!path5) { - return schema5; - } - let current = schema5; - if (path5[0] === "/") { - path5 = path5.substr(1); - } - path5.split("/").some((part) => { - current = current[part]; - return !current; - }); - return current; + const loc = toDisplayString2(schemaURL); + const raw = schemaToResolve.schema; + if (raw === null || Array.isArray(raw) || typeof raw !== "object" && typeof raw !== "boolean") { + const got = raw === null ? "null" : Array.isArray(raw) ? "array" : typeof raw; + resolveErrors.push(t("Schema '{0}' is not valid: {1}", loc, `expected a JSON Schema object or boolean, got "${got}".`)); + return new ResolvedSchema({}, resolveErrors); + } + const _cloneSchema = (value, seen, stopCondition) => { + if (value === null || typeof value !== "object") + return value; + if (stopCondition) { + const replacement = stopCondition(value, seen.size); + if (replacement !== void 0) + return replacement; + } + if (seen.has(value)) + return seen.get(value); + if (Array.isArray(value)) { + const arr = []; + seen.set(value, arr); + for (const item of value) { + arr.push(_cloneSchema(item, seen, stopCondition)); + } + return arr; + } + const result = {}; + seen.set(value, result); + for (const prop in value) { + result[prop] = _cloneSchema(value[prop], seen, stopCondition); + } + return result; + }; + const _loadSchema = this.loadSchema.bind(this); + async function _metaValidateSchemaNode(node, hasNestedSchema) { + if (!node || typeof node !== "object") + return; + const dialect = await pickSchemaDialect(node.$schema, _loadSchema); + dialect && (node._dialect = dialect); + const validator = pickMetaValidator(dialect); + if (!validator) + return; + let toValidate = node; + if (hasNestedSchema) { + const stopAtDialectBoundary = (val, seenSize) => { + if (seenSize !== 0 && val && typeof val === "object" && val.$schema) + return {}; + return void 0; + }; + toValidate = _cloneSchema(node, /* @__PURE__ */ new Map(), stopAtDialectBoundary); + } + if (!validator(toValidate)) { + const errs = []; + for (const err of validator.errors) { + errs.push(`${err.instancePath} : ${err.message}`); + } + resolveErrors.push(t("Schema '{0}' is not valid: {1}", loc, ` +${errs.join("\n")}`)); + } + } + const resourceIndexByUri = /* @__PURE__ */ new Map(); + const _getResourceIndex = (resourceUri) => { + let entry = resourceIndexByUri.get(resourceUri); + if (!entry) { + entry = { fragments: /* @__PURE__ */ new Map() }; + resourceIndexByUri.set(resourceUri, entry); + } + return entry; + }; + const _addResourceDynamicAnchors = (scope, resourceUri) => { + var _a2; + const entry = resourceIndexByUri.get(resourceUri); + if (!entry || entry.fragments.size === 0) + return scope; + let result = scope; + for (const [name, entryItem] of entry.fragments) { + if (!entryItem.dynamic) + continue; + const current = (_a2 = result == null ? void 0 : result.get(name)) != null ? _a2 : []; + if (current.some((existing) => existing._baseUrl === resourceUri)) + continue; + if (result === scope) + result = scope ? new Map(scope) : /* @__PURE__ */ new Map(); + result.set(name, current.concat(entryItem.node)); + } + return result; }; - const merge2 = (target, sourceRoot, sourceURI, path5) => { - const section = findSection(sourceRoot, path5); - if (section) { - for (const key in section) { - if (Object.prototype.hasOwnProperty.call(section, key) && !Object.prototype.hasOwnProperty.call(target, key)) { - target[key] = section[key]; + const _resolveAgainstBase = (baseUri, ref) => { + if (this.contextService) + return this.contextService.resolveRelativePath(ref, baseUri); + return this.normalizeId(ref); + }; + const _preferLocalBaseForRemoteId = async (currentBase, id) => { + try { + const currentBaseUri = URI.parse(currentBase); + const idUri = URI.parse(id); + const localFileName = path2.posix.basename(idUri.path); + const localDir = path2.posix.dirname(currentBaseUri.path); + const localPath = path2.posix.join(localDir, localFileName); + const localUriStr = currentBaseUri.with({ path: localPath, query: idUri.query, fragment: idUri.fragment }).toString(); + if (localUriStr === currentBase) + return localUriStr; + const content = await this.requestService(localUriStr); + return content ? localUriStr : _resolveAgainstBase(currentBase, id); + } catch { + return _resolveAgainstBase(currentBase, id); + } + }; + const _indexSchemaResources = async (root, initialBaseUri) => { + const preOrderStack = [{ node: root, baseUri: initialBaseUri }]; + const postOrderStack = []; + const childListByNode = /* @__PURE__ */ new WeakMap(); + const seen = /* @__PURE__ */ new Set(); + while (preOrderStack.length) { + const current = preOrderStack.pop(); + if (!current) + continue; + const node = current.node; + if (!node || typeof node !== "object" || seen.has(node)) + continue; + seen.add(node); + let baseUri = current.baseUri; + const id = node.$id || node.id; + if (id) { + const preferredBaseUri = await _preferLocalBaseForRemoteId(baseUri, id); + node._baseUrl = preferredBaseUri; + const hashIndex = preferredBaseUri.indexOf("#"); + if (hashIndex !== -1 && hashIndex < preferredBaseUri.length - 1) { + const frag = preferredBaseUri.slice(hashIndex + 1); + _getResourceIndex(baseUri).fragments.set(frag, { node }); + } else { + baseUri = preferredBaseUri; + const entry = _getResourceIndex(preferredBaseUri); + if (!entry.root) { + entry.root = node; + } + } + } + if (node.$anchor) { + _getResourceIndex(baseUri).fragments.set(node.$anchor, { node }); + } + if (node.$dynamicAnchor) { + node._baseUrl = baseUri; + _getResourceIndex(baseUri).fragments.set(node.$dynamicAnchor, { node, dynamic: true }); + } + const children = []; + childListByNode.set(node, children); + this.collectSchemaNodes((entry) => { + children.push(entry); + preOrderStack.push({ node: entry, baseUri }); + }, node.not, node.if, node.then, node.else, node.contains, node.propertyNames, node.additionalProperties, node.items, node.additionalItems, node.prefixItems, this.schemaMapValues(node.properties), this.schemaMapValues(node.patternProperties), this.schemaMapValues(node.definitions), this.schemaMapValues(node.$defs), this.schemaMapValues(node.dependentSchemas), this.schemaMapValues(node.dependencies), node.allOf, node.anyOf, node.oneOf, node.schemaSequence); + postOrderStack.push(node); + } + const hasNestedSchema = /* @__PURE__ */ new WeakMap(); + while (postOrderStack.length) { + const node = postOrderStack.pop(); + let hasNested = false; + for (const child of childListByNode.get(node)) { + if (child.$schema || hasNestedSchema.get(child)) { + hasNested = true; + break; + } + } + hasNestedSchema.set(node, hasNested); + if (node === root || node.$schema) + await _metaValidateSchemaNode(node, hasNested); + } + }; + let schema4 = raw; + const schemaBaseURL = (_a = schemaToResolve.uri) != null ? _a : schemaURL; + await _indexSchemaResources(schema4, schemaBaseURL); + const _findSection = (schemaRoot, refPath, sourceURI) => { + if (!refPath) { + return schemaRoot; + } + if (refPath[0] === "/") { + let current = schemaRoot; + const parts = refPath.substr(1).split("/"); + for (const part of parts) { + current = current == null ? void 0 : current[part.replace(/~1/g, "/").replace(/~0/g, "~")]; + if (current === null) + return void 0; + } + return current; + } + return _getResourceIndex(sourceURI).fragments.get(refPath).node; + }; + const _merge = (target, sourceRoot, sourceURI, refPath, clone = false) => { + const section = _findSection(sourceRoot, refPath, sourceURI); + if (typeof section === "boolean") { + if (!section) + target.not = {}; + return; + } + if (typeof section === "object" && section) { + const source = clone ? _cloneSchema(section, /* @__PURE__ */ new Map()) : section; + for (const key in source) { + if (Object.prototype.hasOwnProperty.call(source, key) && !Object.prototype.hasOwnProperty.call(target, key)) { + target[key] = source[key]; } } + return; } else { - resolveErrors.push(t("json.schema.invalidref", path5, sourceURI)); + resolveErrors.push(t("$ref '{0}' in '{1}' cannot be resolved.", refPath, sourceURI)); } }; - const resolveExternalLink = (node, uri, linkPath, parentSchemaURL, parentSchemaDependencies) => { - if (contextService && !/^\w+:\/\/.*/.test(uri)) { - uri = contextService.resolveRelativePath(uri, parentSchemaURL); + const _resolveRefUri = (parentSchemaURL, refUri) => { + var _a2; + const resolvedAgainstParent = _resolveAgainstBase(parentSchemaURL, refUri); + if (!refUri.startsWith("/")) + return resolvedAgainstParent; + const parentResource = (_a2 = resourceIndexByUri.get(parentSchemaURL)) == null ? void 0 : _a2.root; + const parentResourceId = (parentResource == null ? void 0 : parentResource.$id) || (parentResource == null ? void 0 : parentResource.id); + const resolvedParentId = _resolveAgainstBase(parentSchemaURL, parentResourceId); + if (!resolvedParentId.startsWith("http://") && !resolvedParentId.startsWith("https://")) + return resolvedAgainstParent; + return _resolveAgainstBase(resolvedParentId, refUri); + }; + const _resolveLocalSiblingFromRemoteUri = (parentSchemaURL, resolvedRefUri) => { + try { + const parentUri = URI.parse(parentSchemaURL); + const targetUri = URI.parse(resolvedRefUri); + if (parentUri.scheme !== "file") + return void 0; + if (targetUri.scheme !== "http" && targetUri.scheme !== "https") + return void 0; + const localFileName = path2.posix.basename(targetUri.path); + if (!localFileName) + return void 0; + const localDir = path2.posix.dirname(parentUri.path); + const localPath = path2.posix.join(localDir, localFileName); + return parentUri.with({ path: localPath, query: targetUri.query, fragment: targetUri.fragment }).toString(); + } catch { + return void 0; } - uri = this.normalizeId(uri); - const referencedHandle = this.getOrAddSchemaHandle(uri); - return referencedHandle.getUnresolvedSchema().then((unresolvedSchema) => { - parentSchemaDependencies[uri] = true; - if (unresolvedSchema.errors.length) { - const loc = linkPath ? uri + "#" + linkPath : uri; - resolveErrors.push(t("json.schema.problemloadingref", loc, unresolvedSchema.errors[0])); + }; + const resolveExternalLink = (node, uri, linkPath, parentSchemaURL, parentSchemaDependencies, resolutionStack2, recursiveAnchorBase, inheritedDynamicScope) => { + const _attachResolvedSchema = (node2, schemaRoot, schemaUri, linkPath2, parentSchemaDependencies2, resolveRefDependencies, resolutionStack3, recursiveAnchorBase2, inheritedDynamicScope2) => { + parentSchemaDependencies2[schemaUri] = true; + _merge(node2, schemaRoot, schemaUri, linkPath2, !!inheritedDynamicScope2 || !!recursiveAnchorBase2); + if (!recursiveAnchorBase2 || !node2._baseUrl) + node2._baseUrl = schemaUri; + node2.url = schemaUri; + const nextStack = new Set(resolutionStack3); + nextStack.add(schemaUri); + return resolveRefs(node2, schemaRoot, schemaUri, resolveRefDependencies, nextStack, recursiveAnchorBase2, inheritedDynamicScope2); + }; + const _resolveByUri = (targetUris2, index = 0) => { + var _a2; + const targetUri = targetUris2[index]; + const embeddedSchema = (_a2 = resourceIndexByUri.get(targetUri)) == null ? void 0 : _a2.root; + if (embeddedSchema) { + return _attachResolvedSchema(node, embeddedSchema, targetUri, linkPath, parentSchemaDependencies, parentSchemaDependencies, resolutionStack2, recursiveAnchorBase, inheritedDynamicScope); } - merge2(node, unresolvedSchema.schema, uri, linkPath); - node.url = uri; - return resolveRefs(node, unresolvedSchema.schema, uri, referencedHandle.dependencies); - }); + const referencedHandle = this.getOrAddSchemaHandle(targetUri); + return referencedHandle.getUnresolvedSchema().then(async (unresolvedSchema) => { + var _a3; + if (((_a3 = unresolvedSchema.errors) == null ? void 0 : _a3.some((error) => error.toLowerCase().includes("unable to load schema from"))) && index + 1 < targetUris2.length) { + return _resolveByUri(targetUris2, index + 1); + } + if (unresolvedSchema.errors.length) { + const loc2 = linkPath ? targetUri + "#" + linkPath : targetUri; + resolveErrors.push(t("Problems loading reference '{0}': {1}", loc2, unresolvedSchema.errors[0])); + } + await _indexSchemaResources(unresolvedSchema.schema, targetUri); + return _attachResolvedSchema(node, unresolvedSchema.schema, targetUri, linkPath, parentSchemaDependencies, referencedHandle.dependencies, resolutionStack2, recursiveAnchorBase, inheritedDynamicScope); + }); + }; + const resolvedUri = _resolveRefUri(parentSchemaURL, uri); + const localSiblingUri = _resolveLocalSiblingFromRemoteUri(parentSchemaURL, resolvedUri); + const targetUris = localSiblingUri && localSiblingUri !== resolvedUri ? [localSiblingUri, resolvedUri] : [resolvedUri]; + return _resolveByUri(targetUris); }; - const resolveRefs = async (node, parentSchema, parentSchemaURL, parentSchemaDependencies) => { + const resolveRefs = async (node, parentSchema, parentSchemaURL, parentSchemaDependencies, resolutionStack2, recursiveAnchorBase, inheritedDynamicScope) => { + var _a2; if (!node || typeof node !== "object") { return null; } - const toWalk = [node]; - const seen = /* @__PURE__ */ new Set(); + const toWalk = [{ node, baseURL: parentSchemaURL, recursiveAnchorBase, inheritedDynamicScope }]; + const seen = /* @__PURE__ */ new WeakSet(); const openPromises = []; - const collectEntries = (...entries) => { - for (const entry of entries) { - if (typeof entry === "object") { - toWalk.push(entry); + const _handleRef = (next, nodeBaseURL, nodeDialect, recursiveAnchorBase2, inheritedDynamicScope2, siblingRefCycleKeys) => { + var _a3, _b, _c, _d, _e, _f, _g, _h; + const currentDynamicScope = _addResourceDynamicAnchors(inheritedDynamicScope2, nodeBaseURL); + this.collectSchemaNodes((entry) => toWalk.push({ node: entry, baseURL: nodeBaseURL, recursiveAnchorBase: recursiveAnchorBase2, inheritedDynamicScope: currentDynamicScope }), this.schemaMapValues(next.definitions || next.$defs)); + const _hasRefSiblings = (node2) => { + for (const k of Object.keys(node2)) { + if (REF_SIBLING_NONCONSTRAINT_KEYS.has(k)) + continue; + return true; } - } - }; - const collectMapEntries = (...maps) => { - for (const map2 of maps) { - if (typeof map2 === "object") { - for (const key in map2) { - const entry = map2[key]; - if (typeof entry === "object") { - toWalk.push(entry); - } + return false; + }; + const _rewriteRefWithSiblingsToAllOf = (node2) => { + var _a4, _b2; + const siblings = {}; + for (const k of Object.keys(node2)) { + if (!REF_SIBLING_NONCONSTRAINT_KEYS.has(k)) { + siblings[k] = node2[k]; + delete node2[k]; } } - } - }; - const collectArrayEntries = (...arrays) => { - for (const array of arrays) { - if (Array.isArray(array)) { - for (const entry of array) { - if (typeof entry === "object") { - toWalk.push(entry); - } - } + const refValue = (_b2 = (_a4 = node2.$dynamicRef) != null ? _a4 : node2.$recursiveRef) != null ? _b2 : node2.$ref; + if (typeof refValue !== "string") + return; + node2.allOf = [ + { [node2.$dynamicRef ? "$dynamicRef" : node2.$recursiveRef ? "$recursiveRef" : "$ref"]: refValue }, + siblings + ]; + delete node2.$dynamicRef; + delete node2.$recursiveRef; + delete node2.$ref; + }; + const _stripRefSiblings = (node2) => { + for (const k of Object.keys(node2)) { + if (!REF_SIBLING_NONCONSTRAINT_KEYS.has(k)) + delete node2[k]; } - } - }; - const handleRef = (next) => { + }; const seenRefs = /* @__PURE__ */ new Set(); - while (next.$ref) { - const ref = decodeURIComponent(next.$ref); + const _mergeIfResourceAlreadyInResolutionStack = (ref, resolvedResource, frag) => { + var _a4; + if (!resolutionStack2.has(resolvedResource)) + return false; + if (!seenRefs.has(ref)) { + const source = (_a4 = resourceIndexByUri.get(resolvedResource)) == null ? void 0 : _a4.root; + if (source && typeof source === "object") { + _merge(next, source, resolvedResource, frag, !!recursiveAnchorBase2); + } + seenRefs.add(ref); + } + return true; + }; + while (next.$dynamicRef || next.$recursiveRef || next.$ref) { + const isDynamicRef = typeof next.$dynamicRef === "string"; + const isRecursiveRef = !isDynamicRef && typeof next.$recursiveRef === "string"; + const rawRef = (_b = (_a3 = next.$dynamicRef) != null ? _a3 : next.$recursiveRef) != null ? _b : next.$ref; + if (typeof rawRef !== "string") + break; + next._$ref = rawRef; + const ref = decodeURIComponent(rawRef); const segments = ref.split("#", 2); - next._$ref = next.$ref; + const baseUri = segments[0]; + const frag = segments.length > 1 ? segments[1] : ""; + const resolvedRefKey = `${baseUri ? _resolveAgainstBase(nodeBaseURL, baseUri) : nodeBaseURL}#${frag}`; + if (_hasRefSiblings(next)) { + if (nodeDialect === SchemaDialect.draft04 || nodeDialect === SchemaDialect.draft07) { + _stripRefSiblings(next); + } else { + if (siblingRefCycleKeys == null ? void 0 : siblingRefCycleKeys.has(resolvedRefKey)) + break; + _rewriteRefWithSiblingsToAllOf(next); + if (Array.isArray(next.allOf)) { + for (let i = 0; i < next.allOf.length; i++) { + const entry = next.allOf[i]; + if (entry && typeof entry === "object") { + let nextSiblingRefCycleKeys; + if (i === 0) { + nextSiblingRefCycleKeys = new Set(siblingRefCycleKeys); + nextSiblingRefCycleKeys.add(resolvedRefKey); + } + toWalk.push({ + node: entry, + baseURL: nodeBaseURL, + recursiveAnchorBase: recursiveAnchorBase2, + inheritedDynamicScope: currentDynamicScope, + siblingRefCycleKeys: nextSiblingRefCycleKeys + }); + } + } + } + return; + } + } + delete next.$dynamicRef; + delete next.$recursiveRef; delete next.$ref; - if (segments[0].length > 0) { - openPromises.push(resolveExternalLink(next, segments[0], segments[1], parentSchemaURL, parentSchemaDependencies)); - return; - } else { - if (!seenRefs.has(ref)) { - merge2(next, parentSchema, parentSchemaURL, segments[1]); - seenRefs.add(ref); + if (isRecursiveRef && (ref === "#" || ref === "")) { + const targetRoot = (_c = resourceIndexByUri.get(nodeBaseURL)) == null ? void 0 : _c.root; + const recursiveBase = (targetRoot == null ? void 0 : targetRoot.$recursiveAnchor) && recursiveAnchorBase2 ? recursiveAnchorBase2 : nodeBaseURL; + if (recursiveBase.length > 0) { + if ((resolutionStack2 == null ? void 0 : resolutionStack2.has(recursiveBase)) || recursiveBase === nodeBaseURL) { + const sourceRoot = (_e = (_d = resourceIndexByUri.get(recursiveBase)) == null ? void 0 : _d.root) != null ? _e : parentSchema; + if (!seenRefs.has(ref)) { + _merge(next, sourceRoot, recursiveBase, "", false); + seenRefs.add(ref); + } + continue; + } + openPromises.push(resolveExternalLink(next, recursiveBase, "", nodeBaseURL, parentSchemaDependencies, resolutionStack2, recursiveAnchorBase2, currentDynamicScope)); + return; + } + continue; + } else if (isDynamicRef) { + const targetResource = baseUri.length > 0 ? _resolveAgainstBase(nodeBaseURL, baseUri) : nodeBaseURL; + const targetFragments = (_f = resourceIndexByUri.get(targetResource)) == null ? void 0 : _f.fragments; + const targetHasDynamicAnchor = frag.length > 0 && ((_g = targetFragments == null ? void 0 : targetFragments.get(frag)) == null ? void 0 : _g.dynamic); + const dynamicTarget = targetHasDynamicAnchor ? (_h = currentDynamicScope == null ? void 0 : currentDynamicScope.get(frag)) == null ? void 0 : _h[0] : void 0; + const resolveResource = dynamicTarget ? dynamicTarget._baseUrl : targetResource; + if (dynamicTarget && (resolveResource === nodeBaseURL || resolutionStack2.has(resolveResource))) { + if (!seenRefs.has(ref)) { + _merge(next, dynamicTarget, resolveResource, "", false); + seenRefs.add(ref); + } + continue; + } + if (baseUri.length > 0 || targetHasDynamicAnchor) { + if (_mergeIfResourceAlreadyInResolutionStack(ref, resolveResource, frag)) + continue; + openPromises.push(resolveExternalLink(next, resolveResource, frag, nodeBaseURL, parentSchemaDependencies, resolutionStack2, recursiveAnchorBase2, currentDynamicScope)); + return; } + } else if (baseUri.length > 0) { + const resolvedBaseUri = _resolveAgainstBase(nodeBaseURL, baseUri); + if (_mergeIfResourceAlreadyInResolutionStack(ref, resolvedBaseUri, frag)) + continue; + openPromises.push(resolveExternalLink(next, baseUri, frag, nodeBaseURL, parentSchemaDependencies, resolutionStack2, recursiveAnchorBase2, currentDynamicScope)); + return; + } + if (!seenRefs.has(ref)) { + _merge(next, parentSchema, nodeBaseURL, frag, isDynamicRef && !!currentDynamicScope); + seenRefs.add(ref); } } - collectEntries(next.items, next.additionalItems, next.additionalProperties, next.not, next.contains, next.propertyNames, next.if, next.then, next.else); - collectMapEntries(next.definitions, next.properties, next.patternProperties, next.dependencies); - collectArrayEntries(next.anyOf, next.allOf, next.oneOf, next.items, next.schemaSequence); + this.collectSchemaNodes((entry) => toWalk.push({ + node: entry, + baseURL: next._baseUrl || nodeBaseURL, + dialect: nodeDialect, + recursiveAnchorBase: recursiveAnchorBase2, + inheritedDynamicScope: currentDynamicScope + }), next.not, next.if, next.then, next.else, next.contains, next.propertyNames, next.additionalProperties, next.items, next.additionalItems, next.prefixItems, this.schemaMapValues(next.properties), this.schemaMapValues(next.patternProperties), this.schemaMapValues(next.dependentSchemas), this.schemaMapValues(next.dependencies), next.allOf, next.anyOf, next.oneOf, next.schemaSequence); }; if (parentSchemaURL.indexOf("#") > 0) { const segments = parentSchemaURL.split("#", 2); if (segments[0].length > 0 && segments[1].length > 0) { const newSchema = {}; - await resolveExternalLink(newSchema, segments[0], segments[1], parentSchemaURL, parentSchemaDependencies); + await resolveExternalLink(newSchema, segments[0], segments[1], parentSchemaURL, parentSchemaDependencies, resolutionStack2, recursiveAnchorBase, inheritedDynamicScope); for (const key in schema4) { if (key === "required") { continue; @@ -46092,16 +43221,23 @@ ${errs.join("\n")}`); } } while (toWalk.length) { - const next = toWalk.pop(); - if (seen.has(next)) { + const item = toWalk.pop(); + const next = item.node; + const nodeBaseURL = next._baseUrl || item.baseURL; + const nodeDialect = next._dialect || item.dialect; + const nodeRecursiveAnchorBase = (_a2 = item.recursiveAnchorBase) != null ? _a2 : next.$recursiveAnchor ? nodeBaseURL : void 0; + if (seen.has(next)) continue; - } seen.add(next); - handleRef(next); + _handleRef(next, nodeBaseURL, nodeDialect, nodeRecursiveAnchorBase, item.inheritedDynamicScope, item.siblingRefCycleKeys); } return Promise.all(openPromises); }; - await resolveRefs(schema4, schema4, schemaURL, dependencies); + const resolutionStack = /* @__PURE__ */ new Set(); + const rootResource = schema4._baseUrl || schemaURL; + if (rootResource) + resolutionStack.add(rootResource); + await resolveRefs(schema4, schema4, schemaURL, dependencies, resolutionStack); return new ResolvedSchema(schema4, resolveErrors); } getSchemaForResource(resource, doc) { @@ -46131,24 +43267,34 @@ ${errs.join("\n")}`); const resolveSchemaForResource = (schemas2) => { const schemaHandle = super.createCombinedSchema(resource, schemas2); return schemaHandle.getResolvedSchema().then((schema4) => { - if (schema4.schema && typeof schema4.schema === "object") { - schema4.schema.url = schemaHandle.url; - } - if (schema4.schema && schema4.schema.schemaSequence && schema4.schema.schemaSequence[doc.currentDocIndex]) { - return new ResolvedSchema(schema4.schema.schemaSequence[doc.currentDocIndex]); - } - return schema4; + return this.finalizeResolvedSchema(schema4, schemaHandle.url, doc, false); }); }; - const resolveSchema = () => { + const resolveSchema = async () => { + var _a, _b; const seen = /* @__PURE__ */ Object.create(null); const schemas2 = []; + let k8sAllSchema = void 0; for (const entry of this.filePatternAssociations) { if (entry.matchesPattern(resource)) { for (const schemaId of entry.getURIs()) { if (!seen[schemaId]) { - schemas2.push(schemaId); - seen[schemaId] = true; + if (((_a = this.yamlSettings) == null ? void 0 : _a.kubernetesCRDStoreEnabled) && schemaId === KUBERNETES_SCHEMA_URL) { + if (!k8sAllSchema) { + k8sAllSchema = await this.getResolvedSchema(KUBERNETES_SCHEMA_URL); + } + const kubeSchema = autoDetectKubernetesSchemaFromDocument(doc, (_b = this.yamlSettings.kubernetesCRDStoreUrl) != null ? _b : CRD_CATALOG_URL, k8sAllSchema); + if (kubeSchema) { + schemas2.push(kubeSchema); + seen[schemaId] = true; + } else { + schemas2.push(schemaId); + seen[schemaId] = true; + } + } else { + schemas2.push(schemaId); + seen[schemaId] = true; + } } } } @@ -46193,9 +43339,21 @@ ${errs.join("\n")}`); }, () => { return resolveSchema(); }); - } else { - return resolveSchema(); } + return resolveSchema(); + } + finalizeResolvedSchema(schema4, schemaUrl, doc, includeErrorsForSequence) { + if (schema4.schema && typeof schema4.schema === "object") { + schema4.schema.url = schemaUrl; + if (schema4.schema.schemaSequence && schema4.schema.schemaSequence[doc.currentDocIndex]) { + const selectedSchema = schema4.schema.schemaSequence[doc.currentDocIndex]; + if (includeErrorsForSequence) { + return new ResolvedSchema(selectedSchema, schema4.errors); + } + return new ResolvedSchema(selectedSchema); + } + } + return schema4; } // Set the priority of a schema in the schema service addSchemaPriority(uri, priority) { @@ -46233,13 +43391,7 @@ ${errs.join("\n")}`); async resolveCustomSchema(schemaUri, doc) { const unresolvedSchema = await this.loadSchema(schemaUri); const schema4 = await this.resolveSchemaContent(unresolvedSchema, schemaUri, []); - if (schema4.schema && typeof schema4.schema === "object") { - schema4.schema.url = schemaUri; - } - if (schema4.schema && schema4.schema.schemaSequence && schema4.schema.schemaSequence[doc.currentDocIndex]) { - return new ResolvedSchema(schema4.schema.schemaSequence[doc.currentDocIndex], schema4.errors); - } - return schema4; + return this.finalizeResolvedSchema(schema4, schemaUri, doc, true); } /** * Save a schema with schema ID and schema content. @@ -46337,10 +43489,6 @@ ${errs.join("\n")}`); return id; } } - /* - * Everything below here is needed because we're importing from vscode-json-languageservice umd and we need - * to provide a wrapper around the javascript methods we are calling since they have no type - */ getOrAddSchemaHandle(id, unresolvedSchemaContent) { return super.getOrAddSchemaHandle(id, unresolvedSchemaContent); } @@ -46351,14 +43499,14 @@ ${errs.join("\n")}`); return requestService(schemaUri).then( (content) => { if (!content) { - const errorMessage = t("json.schema.nocontent", "Unable to load schema from '{0}': No content. {1}", toDisplayString2(schemaUri), unresolvedJsonSchema.errors); + const errorMessage = t("Unable to load schema from '{0}': No content. {1}", toDisplayString2(schemaUri), unresolvedJsonSchema.errors); return new UnresolvedSchema({}, [errorMessage]); } try { const schemaContent = parse3(content); return new UnresolvedSchema(schemaContent, []); } catch (yamlError) { - const errorMessage = t("json.schema.invalidFormat", "Unable to parse content from '{0}': {1}.", toDisplayString2(schemaUri), yamlError); + const errorMessage = t("Unable to parse content from '{0}': {1}.", toDisplayString2(schemaUri), yamlError); return new UnresolvedSchema({}, [errorMessage]); } }, @@ -46382,7 +43530,7 @@ ${errs.join("\n")}`); } else if (unresolvedJsonSchema.errors && unresolvedJsonSchema.errors.length > 0) { let errorMessage = unresolvedJsonSchema.errors[0]; if (errorMessage.toLowerCase().indexOf("load") !== -1) { - errorMessage = t("json.schema.noContent", toDisplayString2(schemaUri)); + errorMessage = t("Unable to load schema from '{0}': No content.", toDisplayString2(schemaUri)); } else if (errorMessage.toLowerCase().indexOf("parse") !== -1) { const content = await requestService(schemaUri); const jsonErrors = []; @@ -46390,7 +43538,7 @@ ${errs.join("\n")}`); if (jsonErrors.length && schemaContent) { const { offset } = jsonErrors[0]; const { line, column } = getLineAndColumnFromOffset(content, offset); - errorMessage = t("json.schema.invalidFormat", toDisplayString2(schemaUri), line, column); + errorMessage = t("Unable to parse content from '{0}': Parse error at line: {1} column: {2}", toDisplayString2(schemaUri), line, column); } } return new UnresolvedSchema({}, [errorMessage]); @@ -46437,6 +43585,86 @@ function getLineAndColumnFromOffset(text, offset) { const column = lines[lines.length - 1].length + 1; return { line, column }; } +function normalizeSchemaUri(uri) { + if (!uri) + return ""; + let s; + if (typeof uri === "string") { + s = uri; + } else { + s = uri.$id || uri.id || ""; + } + s = s.trim(); + const hash = s.indexOf("#"); + s = hash === -1 ? s : s.slice(0, hash); + s = s.replace(/^http:\/\/json-schema\.org\//i, "https://json-schema.org/"); + s = s.replace(/\/+$/g, ""); + return s; +} +function knownDialectFromSchemaUri(schemaUri) { + if (schemaUri === normalizeSchemaUri(ajv4.defaultMeta())) + return SchemaDialect.draft04; + if (schemaUri === normalizeSchemaUri(ajv7.defaultMeta())) + return SchemaDialect.draft07; + if (schemaUri === normalizeSchemaUri(ajv2019.defaultMeta())) + return SchemaDialect.draft2019; + if (schemaUri === normalizeSchemaUri(ajv2020.defaultMeta())) + return SchemaDialect.draft2020; + return void 0; +} +async function pickSchemaDialect($schema, loadSchema) { + if (!$schema) + return void 0; + const s = normalizeSchemaUri($schema || ""); + const dialect = knownDialectFromSchemaUri(s); + if (dialect) + return dialect; + const cached = schemaDialectCache.get(s); + if (cached) { + return cached; + } + const inflight = schemaDialectInFlight.get(s); + if (inflight) { + return inflight; + } + if (!loadSchema) + return void 0; + const promise = (async () => { + var _a; + const meta = await loadSchema(s); + if ((_a = meta.errors) == null ? void 0 : _a.length) + return void 0; + const metaSchema = meta.schema; + if (!metaSchema || typeof metaSchema !== "object") + return void 0; + const metaDialect = knownDialectFromSchemaUri(metaSchema.$schema); + if (metaDialect) + return metaDialect; + return void 0; + })(); + schemaDialectInFlight.set(s, promise); + try { + const result = await promise; + schemaDialectCache.set(s, result); + return result; + } finally { + schemaDialectInFlight.delete(s); + } +} +function pickMetaValidator(dialect) { + switch (dialect) { + case SchemaDialect.draft04: + return schema04Validator; + case SchemaDialect.draft07: + return schema07Validator; + case SchemaDialect.draft2019: + return schema2019Validator; + case SchemaDialect.draft2020: + return schema2020Validator; + default: + return void 0; + } +} // ../../node_modules/yaml-language-server/lib/esm/languageservice/services/documentSymbols.js var YAMLDocumentSymbols = class { @@ -46495,6 +43723,7 @@ var YAMLDocumentSymbols = class { }; // ../../node_modules/yaml-language-server/lib/esm/languageservice/services/yamlHover.js +var path3 = __toESM(require_path_browserify()); init_main(); // ../../node_modules/yaml-language-server/lib/esm/languageservice/parser/isKubernetes.js @@ -46504,8 +43733,56 @@ function setKubernetesParserOption(jsonDocuments, option) { } } +// ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/yamlScalar.js +function toYamlStringScalar(s, preferSingleQuote = false) { + const quote = preferSingleQuote ? "'" : '"'; + if (s.length === 0) { + return `${quote}${quote}`; + } + if (s.length === 1 && s === '"') { + return '"\\""'; + } + if (s.length === 2 && (s[0] === '"' && s[1] === '"' || s[0] === "'" && s[1] === "'")) { + return s[0] === '"' ? '"\\"\\""' : `"''"`; + } + if (s.length >= 2) { + const firstChar = s[0]; + const lastChar = s[s.length - 1]; + if (firstChar === '"' && lastChar === '"' || firstChar === "'" && lastChar === "'") { + return s; + } + } + if (/["\\]/.test(s)) { + return JSON.stringify(s); + } + if (/^(?:on|off|true|false|yes|no|null|~)$/i.test(s)) { + return `${quote}${s}${quote}`; + } + if (/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(s) || /^0x[0-9a-fA-F]+$/.test(s) || /^0o[0-7]+$/.test(s) || /^0[0-7]+$/.test(s)) { + return `"${s}"`; + } + if (/^\s|\s$/.test(s)) { + return preferSingleQuote ? `'${s.replace(/'/g, "''")}'` : JSON.stringify(s); + } + if (/(?:^|\s)#/.test(s)) { + return preferSingleQuote ? `'${s.replace(/'/g, "''")}'` : JSON.stringify(s); + } + if (/^[\][{}#&*!|>'"%@`]/.test(s)) { + return preferSingleQuote ? `'${s.replace(/'/g, "''")}'` : JSON.stringify(s); + } + if (/^[-?:](\s|$)/.test(s)) { + return preferSingleQuote ? `'${s.replace(/'/g, "''")}'` : JSON.stringify(s); + } + if (/(?:^|[^:]):(?:\s|$)/.test(s)) { + return preferSingleQuote ? `'${s.replace(/'/g, "''")}'` : JSON.stringify(s); + } + if (/[\n\t\r]/.test(s)) { + return JSON.stringify(s); + } + return s; +} + // ../../node_modules/yaml-language-server/lib/esm/languageservice/services/yamlHover.js -var path3 = __toESM(require_path_browserify()); var YAMLHover = class { constructor(schemaService, telemetry) { this.telemetry = telemetry; @@ -46515,6 +43792,7 @@ var YAMLHover = class { configure(languageSettings) { if (languageSettings) { this.shouldHover = languageSettings.hover; + this.shouldHoverAnchor = languageSettings.hoverAnchor; this.indentation = languageSettings.indentation; } } @@ -46567,6 +43845,13 @@ var YAMLHover = class { }; return result; }; + if (this.shouldHoverAnchor && node.type === "property" && node.valueNode) { + if (node.valueNode.type === "object") { + const resolved = this.resolveMergeKeys(node.valueNode, doc); + const contents = "```yaml\n" + stringify3(resolved, null, 2) + "\n```"; + return Promise.resolve(createHover(contents)); + } + } const removePipe = (value) => { return value.replace(/\s\|\|\s*$/, ""); }; @@ -46594,9 +43879,7 @@ var YAMLHover = class { } s.schema.enum.forEach((enumValue, idx) => { var _a; - if (typeof enumValue !== "string") { - enumValue = JSON.stringify(enumValue); - } + enumValue = typeof enumValue === "string" ? toYamlStringScalar(enumValue, false) : JSON.stringify(enumValue); const foundIdx = markdownEnums.findIndex((me) => me.value === enumValue); if (foundIdx < 0) { markdownEnums.push({ @@ -46640,7 +43923,7 @@ var YAMLHover = class { } if (markdownEnums.length !== 0) { result = ensureLineBreak(result); - result += t("allowedValues") + "\n\n"; + result += t("Allowed Values:") + "\n\n"; if (enumIdx) { markdownEnums.unshift(markdownEnums.splice(enumIdx, 1)[0]); } @@ -46657,7 +43940,7 @@ var YAMLHover = class { if (markdownExamples.length !== 0) { markdownExamples.forEach((example) => { result = ensureLineBreak(result); - result += t("example") + "\n\n"; + result += t("Example:") + "\n\n"; result += `\`\`\`yaml ${example}\`\`\` `; @@ -46665,18 +43948,118 @@ ${example}\`\`\` } if (result.length > 0 && schema4.schema.url) { result = ensureLineBreak(result); - result += t("source", getSchemaName(schema4.schema), schema4.schema.url); + result += t("Source: [{0}]({1})", getSchemaName(schema4.schema), schema4.schema.url); } return createHover(result); } return null; }); } + /** + * Resolves merge keys (<<) and anchors recursively in an object node + * @param node The object AST node to resolve + * @param doc The YAML document for resolving anchors + * @param currentRecursionLevel Current recursion level (default: 0) + * @returns A plain JavaScript object with all merges resolved + */ + resolveMergeKeys(node, doc, currentRecursionLevel = 0) { + const result = {}; + const unprocessedProperties = [...node.properties]; + while (unprocessedProperties.length > 0) { + const propertyNode = unprocessedProperties.shift(); + const key = propertyNode.keyNode.value; + if (key === "<<" && propertyNode.valueNode) { + const mergeValue2 = this.resolveMergeValue(propertyNode.valueNode, doc, currentRecursionLevel + 1); + if (mergeValue2 && typeof mergeValue2 === "object" && !Array.isArray(mergeValue2)) { + const mergeKeys = Object.keys(mergeValue2); + for (const mergeKey of mergeKeys) { + result[mergeKey] = mergeValue2[mergeKey]; + } + } + } else { + result[key] = this.astNodeToValue(propertyNode.valueNode, doc, currentRecursionLevel); + } + } + return result; + } + /** + * Resolves a merge value (which might be an alias) and recursively resolves its merge keys + * @param node The AST node that might be an alias or object + * @param doc The YAML document for resolving anchors + * @param currentRecursionLevel Current recursion level + * @returns The resolved value + */ + resolveMergeValue(node, doc, currentRecursionLevel) { + const MAX_MERGE_RECURSION_LEVEL = 10; + if (currentRecursionLevel >= MAX_MERGE_RECURSION_LEVEL) { + return { "<<": node.parent.internalNode["value"] + " (recursion limit reached)" }; + } + if (node.type === "object") { + return this.resolveMergeKeys(node, doc, currentRecursionLevel); + } + return this.astNodeToValue(node, doc, currentRecursionLevel); + } + /** + * Converts an AST node to a plain JavaScript value + * @param node The AST node to convert + * @param doc The YAML document for resolving anchors + * @param currentRecursionLevel Current recursion level + * @returns The converted value + */ + astNodeToValue(node, doc, currentRecursionLevel) { + if (!node) { + return null; + } + switch (node.type) { + case "object": { + return this.resolveMergeKeys(node, doc, currentRecursionLevel); + } + case "array": { + return node.children.map((child) => this.astNodeToValue(child, doc, currentRecursionLevel)); + } + case "string": + case "number": + case "boolean": + case "null": { + return node.value; + } + default: { + return this.nodeToValue(node.internalNode); + } + } + } + /** + * Converts a YAML Node to a plain JavaScript value + * @param node The YAML node to convert + * @returns The converted value + */ + nodeToValue(node) { + if (isAlias(node)) { + return node.source; + } + if (isMap(node)) { + const result = {}; + for (const pair of node.items) { + if (pair.key && pair.value) { + const key = this.nodeToValue(pair.key); + const value = this.nodeToValue(pair.value); + if (typeof key === "string") { + result[key] = value; + } + } + } + return result; + } + if (isSeq(node)) { + return node.items.map((item) => this.nodeToValue(item)); + } + return node.value; + } // copied from https://github.com/microsoft/vscode-json-languageservice/blob/2ea5ad3d2ffbbe40dea11cfe764a502becf113ce/src/services/jsonHover.ts#L112 toMarkdown(plain) { if (plain) { let escaped = plain.replace(/([^\n\r])(\r?\n)([^\n\r])/gm, "$1\n\n$3"); - escaped = escaped.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&"); + escaped = escaped.replace(/[\\`*_{}[\]#+!]/g, "\\$&"); if (this.indentation !== void 0) { const indentationMatchRegex = new RegExp(` {${this.indentation.length}}`, "g"); escaped = escaped.replace(indentationMatchRegex, " "); @@ -46729,6 +44112,41 @@ function isAllSchemasMatched(node, matchingSchemas, schema4) { // ../../node_modules/yaml-language-server/lib/esm/languageservice/services/yamlValidation.js init_main(); +// ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/diagnostic-filter.js +var YAML_DISABLE_PATTERN = /^\s*#\s*yaml-language-server-disable\b(.*)$/; +function parseDisableSpecifiers(raw) { + const trimmed = raw.trim(); + if (!trimmed) { + return []; + } + return trimmed.split(",").map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0); +} +function shouldSuppressDiagnostic(specifiers, diagnosticMessage) { + if (specifiers.length === 0) { + return true; + } + const lowerMessage = diagnosticMessage.toLowerCase(); + return specifiers.some((spec) => lowerMessage.includes(spec)); +} +function filterSuppressedDiagnostics(diagnostics, getStartLine, getMessage, getLineText) { + return diagnostics.filter((diag) => { + const line = getStartLine(diag); + if (line === 0) { + return true; + } + const prevLineText = getLineText(line - 1); + if (prevLineText === void 0) { + return true; + } + const match = YAML_DISABLE_PATTERN.exec(prevLineText); + if (!match) { + return true; + } + const specifiers = parseDisableSpecifiers(match[1]); + return !shouldSuppressDiagnostic(specifiers, getMessage(diag)); + }); +} + // ../../node_modules/yaml-language-server/lib/esm/languageservice/services/validation/unused-anchors.js init_main(); var UnusedAnchorsValidator = class { @@ -46759,7 +44177,7 @@ var UnusedAnchorsValidator = class { const aToken = this.getAnchorNode(anchorParent.get(anchor), anchor); if (aToken) { const range = Range.create(document.positionAt(aToken.offset), document.positionAt(aToken.offset + aToken.source.length)); - const warningDiagnostic = Diagnostic.create(range, t("unUsedAnchor", aToken.source), DiagnosticSeverity.Information, 0); + const warningDiagnostic = Diagnostic.create(range, t('Unused anchor "{0}"', aToken.source), DiagnosticSeverity.Information, 0); warningDiagnostic.tags = [DiagnosticTag.Unnecessary]; result.push(warningDiagnostic); } @@ -46771,7 +44189,7 @@ var UnusedAnchorsValidator = class { const startOffset = nodeRange[0]; const endOffset = nodeRange[1]; const range = Range.create(document.positionAt(startOffset), document.positionAt(endOffset)); - const warningDiagnostic = Diagnostic.create(range, t("unUsedAlias", node.toString()), DiagnosticSeverity.Information, 0); + const warningDiagnostic = Diagnostic.create(range, t('Unresolved alias "{0}"', node.toString()), DiagnosticSeverity.Information, 0); warningDiagnostic.tags = [DiagnosticTag.Unnecessary]; result.push(warningDiagnostic); } @@ -46824,10 +44242,10 @@ var YAMLStyleValidator = class { visit2(yamlDoc.internalDocument, (key, node) => { var _a, _b; if (this.forbidMapping && isMap(node) && ((_a = node.srcToken) == null ? void 0 : _a.type) === "flow-collection") { - result.push(Diagnostic.create(this.getRangeOf(document, node.srcToken), t("flowStyleMapForbidden", "Flow style mapping is forbidden"), DiagnosticSeverity.Error, "flowMap")); + result.push(Diagnostic.create(this.getRangeOf(document, node.srcToken), t("Flow style mapping is forbidden"), DiagnosticSeverity.Error, "flowMap")); } if (this.forbidSequence && isSeq(node) && ((_b = node.srcToken) == null ? void 0 : _b.type) === "flow-collection") { - result.push(Diagnostic.create(this.getRangeOf(document, node.srcToken), t("flowStyleSeqForbidden"), DiagnosticSeverity.Error, "flowSeq")); + result.push(Diagnostic.create(this.getRangeOf(document, node.srcToken), t("Flow style sequence is forbidden"), DiagnosticSeverity.Error, "flowSeq")); } }); return result; @@ -46851,6 +44269,7 @@ var MapKeyOrderValidator = class { if (compare(node.items[i - 1], node.items[i]) > 0) { const range = createRange2(document, node.items[i - 1]); result.push(Diagnostic.create(range, `Wrong ordering of key "${node.items[i - 1].key}" in mapping`, DiagnosticSeverity.Error, "mapKeyOrder")); + break; } } } @@ -46859,9 +44278,9 @@ var MapKeyOrderValidator = class { } }; function createRange2(document, node) { - var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k; - const start = (_f = (_c = (_a = node == null ? void 0 : node.srcToken.start[0]) == null ? void 0 : _a.offset) != null ? _c : (_b = node == null ? void 0 : node.srcToken) == null ? void 0 : _b.key.offset) != null ? _f : (_e = (_d = node == null ? void 0 : node.srcToken) == null ? void 0 : _d.sep[0]) == null ? void 0 : _e.offset; - const end = ((_g = node == null ? void 0 : node.srcToken) == null ? void 0 : _g.value.offset) || ((_i = (_h = node == null ? void 0 : node.srcToken) == null ? void 0 : _h.sep[0]) == null ? void 0 : _i.offset) || ((_j = node == null ? void 0 : node.srcToken) == null ? void 0 : _j.key.offset) || ((_k = node == null ? void 0 : node.srcToken.start[node.srcToken.start.length - 1]) == null ? void 0 : _k.offset); + const keySourceToken = node.key.srcToken; + const start = keySourceToken.offset; + const end = start + keySourceToken.source.length; return Range.create(document.positionAt(start), document.positionAt(end)); } function compare(thiz, that) { @@ -46957,7 +44376,13 @@ var YAMLValidation = class { foundSignatures.add(errSig); } } - return duplicateMessagesRemoved; + const textBuffer = new TextBuffer(textDocument); + return filterSuppressedDiagnostics(duplicateMessagesRemoved, (d) => d.range.start.line, (d) => d.message, (line) => { + if (line < 0 || line >= textBuffer.getLineCount()) { + return void 0; + } + return textBuffer.getLineContent(line).replace(/[\r\n]+$/, ""); + }); } runAdditionalValidators(document, yarnDoc) { const result = []; @@ -47088,6 +44513,7 @@ function createNormalizedFolding(document, node) { } // ../../node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCodeActions.js +var path4 = __toESM(require_path_browserify()); init_main(); // ../../node_modules/yaml-language-server/lib/esm/commands.js @@ -47096,8 +44522,194 @@ var YamlCommands; YamlCommands2["JUMP_TO_SCHEMA"] = "jumpToSchema"; })(YamlCommands || (YamlCommands = {})); -// ../../node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCodeActions.js -var path4 = __toESM(require_path_browserify()); +// ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/block-string-rewriter.js +var BlockStringRewriter = class { + constructor(indentation, maxLineLength) { + this.indentation = indentation; + this.maxLineLength = maxLineLength; + } + writeFoldedBlockScalar(node) { + if (node.type !== "QUOTE_DOUBLE" && node.type !== "QUOTE_SINGLE") { + return null; + } + const stringContent = node.value; + const currentIndentNum = node.srcToken.indent; + let indentText = this.indentation; + for (let i = 0; i < currentIndentNum / this.indentation.length; i++) { + indentText += this.indentation; + } + const lines = []; + const splitLines2 = stringContent.split("\n"); + for (const line of splitLines2) { + let remainder = line; + slicing: while (remainder.length > this.maxLineLength) { + let location = this.maxLineLength; + while (!/ /.test(remainder.charAt(location))) { + location++; + if (location >= remainder.length) { + break slicing; + } + } + while (/ /.test(remainder.charAt(location))) { + location++; + if (location >= remainder.length) { + break slicing; + } + } + const head = remainder.substring( + 0, + location - 1 + /* -1 to remove one space character, which is automatically added between lines */ + ); + lines.push(head); + remainder = remainder.substring(location); + } + lines.push(remainder); + lines.push("\n"); + } + lines.pop(); + for (let i = 1; i < lines.length; ) { + if (/^[ \t]+$/.test(lines[i])) { + if (lines[i - 1] === "\n" || lines[i - 1] === "") { + lines.splice(i - 1, 1); + continue; + } else { + return null; + } + } + i++; + } + let blockScalarHeaderSource = ">"; + if (lines[lines.length - 1] !== "\n" && lines[lines.length - 1] !== "") { + blockScalarHeaderSource += "-"; + } else if ((lines[lines.length - 2] === "\n" || lines[lines.length - 2] === "") && lines[lines.length - 3] !== "\n" && lines[lines.length - 3] !== "") { + lines.splice(lines.length - 2, 2); + } else { + blockScalarHeaderSource += "+"; + } + if (/ /.test(stringContent.charAt(0))) { + blockScalarHeaderSource += `${indentText.length}`; + } + const newProps = lines.flatMap((line) => { + if (line === "\n" || line === "") { + return [ + { + type: "newline", + indent: 0, + offset: node.srcToken.offset, + source: "\n" + } + ]; + } + return [ + { + type: "newline", + indent: 0, + offset: node.srcToken.offset, + source: "\n" + }, + { + type: "space", + indent: 0, + offset: node.srcToken.offset, + source: indentText + }, + { + type: "scalar", + indent: 0, + offset: node.srcToken.offset, + source: line + } + ]; + }); + newProps.unshift({ + type: "block-scalar-header", + source: blockScalarHeaderSource, + offset: node.srcToken.offset, + indent: 0 + }); + const blockString2 = { + type: "block-scalar", + offset: node.srcToken.offset, + indent: 0, + source: "", + props: newProps + }; + return cst_exports.stringify(blockString2); + } + writeLiteralBlockScalar(node) { + if (node.type !== "QUOTE_DOUBLE" && node.type !== "QUOTE_SINGLE") { + return null; + } + const stringContent = node.value; + if (stringContent.indexOf("\n") < 0) { + return null; + } + const currentIndentNum = node.srcToken.indent; + let indentText = this.indentation; + for (let i = 0; i < currentIndentNum / this.indentation.length; i++) { + indentText += this.indentation; + } + const lines = stringContent.split("\n"); + let blockScalarHeaderSource = "|"; + if (lines[lines.length - 1] !== "\n" && lines[lines.length - 1] !== "") { + blockScalarHeaderSource += "-"; + } else if (lines[lines.length - 2] !== "\n" && lines[lines.length - 2] !== "") { + lines.splice(lines.length - 1, 1); + } else { + blockScalarHeaderSource += "+"; + } + if (/ /.test(stringContent.charAt(0))) { + blockScalarHeaderSource += `${indentText.length}`; + } + const newProps = lines.flatMap((line) => { + if (line === "") { + return [ + { + type: "newline", + indent: 0, + offset: node.srcToken.offset, + source: "\n" + } + ]; + } + return [ + { + type: "newline", + indent: 0, + offset: node.srcToken.offset, + source: "\n" + }, + { + type: "space", + indent: 0, + offset: node.srcToken.offset, + source: indentText + }, + { + type: "scalar", + indent: 0, + offset: node.srcToken.offset, + source: line + } + ]; + }); + newProps.unshift({ + type: "block-scalar-header", + source: blockScalarHeaderSource, + offset: node.srcToken.offset, + indent: 0 + }); + const blockString2 = { + type: "block-scalar", + offset: node.srcToken.offset, + indent: 0, + source: "", + props: newProps + }; + return cst_exports.stringify(blockString2); + } +}; // ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/flow-style-rewriter.js var FlowStyleRewriter = class { @@ -47151,14 +44763,15 @@ var FlowStyleRewriter = class { }; // ../../node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCodeActions.js -var _ = __toESM(require_lodash()); var YamlCodeActions = class { constructor(clientCapabilities) { this.clientCapabilities = clientCapabilities; this.indentation = " "; + this.lineWidth = 80; } - configure(settings) { + configure(settings, printWidth) { this.indentation = settings.indentation; + this.lineWidth = printWidth; } getCodeAction(document, params) { if (!params.context.diagnostics) { @@ -47170,6 +44783,7 @@ var YamlCodeActions = class { result.push(...this.getTabToSpaceConverting(params.context.diagnostics, document)); result.push(...this.getUnusedAnchorsDelete(params.context.diagnostics, document)); result.push(...this.getConvertToBlockStyleActions(params.context.diagnostics, document)); + result.push(...this.getConvertStringToBlockStyleActions(params.range, document)); result.push(...this.getKeyOrderActions(params.context.diagnostics, document)); result.push(...this.getQuickFixForPropertyOrValueMismatch(params.context.diagnostics, document)); return result; @@ -47194,7 +44808,7 @@ var YamlCodeActions = class { } const result = []; for (const schemaUri of schemaUriToDiagnostic.keys()) { - const action = CodeAction.create(t("jumpToSchema", path4.basename(schemaUri)), Command.create("JumpToSchema", YamlCommands.JUMP_TO_SCHEMA, schemaUri)); + const action = CodeAction.create(t("Jump to schema location ({0})", path4.basename(schemaUri)), Command.create("JumpToSchema", YamlCommands.JUMP_TO_SCHEMA, schemaUri)); action.diagnostics = schemaUriToDiagnostic.get(schemaUri); result.push(action); } @@ -47225,7 +44839,7 @@ var YamlCodeActions = class { if (replacedTabs !== diag.range.end.character - diag.range.start.character) { resultRange = Range.create(diag.range.start, Position.create(diag.range.end.line, diag.range.start.character + replacedTabs)); } - result.push(CodeAction.create(t("convertToSpace"), createWorkspaceEdit(document.uri, [TextEdit.replace(resultRange, newText)]), CodeActionKind.QuickFix)); + result.push(CodeAction.create(t("Convert Tab to Spaces"), createWorkspaceEdit(document.uri, [TextEdit.replace(resultRange, newText)]), CodeActionKind.QuickFix)); } } if (result.length !== 0) { @@ -47260,7 +44874,7 @@ var YamlCodeActions = class { } } if (replaceEdits.length > 0) { - result.push(CodeAction.create(t("convertAllSpaceToTab"), createWorkspaceEdit(document.uri, replaceEdits), CodeActionKind.QuickFix)); + result.push(CodeAction.create(t("Convert all Tabs to Spaces"), createWorkspaceEdit(document.uri, replaceEdits), CodeActionKind.QuickFix)); } } return result; @@ -47275,7 +44889,7 @@ var YamlCodeActions = class { const lineContent = buffer.getLineContent(range.end.line); const lastWhitespaceChar = getFirstNonWhitespaceCharacterAfterOffset(lineContent, range.end.character); range.end.character = lastWhitespaceChar; - const action = CodeAction.create(t("deleteUnusedAnchor", actual), createWorkspaceEdit(document.uri, [TextEdit.del(range)]), CodeActionKind.QuickFix); + const action = CodeAction.create(t("Delete unused anchor: {0}", actual), createWorkspaceEdit(document.uri, [TextEdit.del(range)]), CodeActionKind.QuickFix); action.diagnostics = [diag]; result.push(action); } @@ -47289,7 +44903,7 @@ var YamlCodeActions = class { const value = document.getText(diagnostic.range).toLocaleLowerCase(); if (value === '"true"' || value === '"false"' || value === "'true'" || value === "'false'") { const newValue = value.includes("true") ? "true" : "false"; - results.push(CodeAction.create(t("convertToBoolean"), createWorkspaceEdit(document.uri, [TextEdit.replace(diagnostic.range, newValue)]), CodeActionKind.QuickFix)); + results.push(CodeAction.create(t("Convert to boolean"), createWorkspaceEdit(document.uri, [TextEdit.replace(diagnostic.range, newValue)]), CodeActionKind.QuickFix)); } } } @@ -47303,14 +44917,47 @@ var YamlCodeActions = class { if (isMap(node.internalNode) || isSeq(node.internalNode)) { const blockTypeDescription = isMap(node.internalNode) ? "map" : "sequence"; const rewriter = new FlowStyleRewriter(this.indentation); - results.push(CodeAction.create(t("convertToBlockStyle", "Convert to block style {0}", blockTypeDescription), createWorkspaceEdit(document.uri, [TextEdit.replace(diagnostic.range, rewriter.write(node))]), CodeActionKind.QuickFix)); + results.push(CodeAction.create(t("Convert to block style {0}", blockTypeDescription), createWorkspaceEdit(document.uri, [TextEdit.replace(diagnostic.range, rewriter.write(node))]), CodeActionKind.QuickFix)); + } + } + } + return results; + } + getConvertStringToBlockStyleActions(range, document) { + const yamlDocument = yamlDocumentsCache.getYamlDocument(document); + const startOffset = range ? document.offsetAt(range.start) : 0; + const endOffset = range ? document.offsetAt(range.end) : Infinity; + const results = []; + for (const singleYamlDocument of yamlDocument.documents) { + const matchingNodes = []; + visit2(singleYamlDocument.internalDocument, (key, node) => { + if (isScalar(node)) { + if (startOffset <= node.range[0] && node.range[2] <= endOffset || node.range[0] <= startOffset && endOffset <= node.range[2]) { + if (node.type === "QUOTE_DOUBLE" || node.type === "QUOTE_SINGLE") { + if (typeof node.value === "string" && (node.value.indexOf("\n") >= 0 || node.value.length > this.lineWidth)) { + matchingNodes.push(node); + } + } + } + } + }); + for (const node of matchingNodes) { + const range2 = Range.create(document.positionAt(node.range[0]), document.positionAt(node.range[1])); + const rewriter = new BlockStringRewriter(this.indentation, this.lineWidth); + const foldedBlockScalar = rewriter.writeFoldedBlockScalar(node); + if (foldedBlockScalar !== null) { + results.push(CodeAction.create(t("Convert string to folded block string"), createWorkspaceEdit(document.uri, [TextEdit.replace(range2, foldedBlockScalar)]), CodeActionKind.Refactor)); + } + const literalBlockScalar = rewriter.writeLiteralBlockScalar(node); + if (literalBlockScalar !== null) { + results.push(CodeAction.create(t("Convert string to literal block string"), createWorkspaceEdit(document.uri, [TextEdit.replace(range2, literalBlockScalar)]), CodeActionKind.Refactor)); } } } return results; } getKeyOrderActions(diagnostics, document) { - var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n; + var _a, _b, _c, _d, _e; const results = []; for (const diagnostic of diagnostics) { if ((diagnostic == null ? void 0 : diagnostic.code) === "mapKeyOrder") { @@ -47319,7 +44966,29 @@ var YamlCodeActions = class { node = node.parent; } if (node && isMap(node.internalNode)) { - const sorted = _.cloneDeep(node.internalNode); + const sorted = structuredClone(node.internalNode); + const _getTrailingTokens = (value) => { + var _a2, _b2, _c2; + if (!value) + return; + if (cst_exports.isScalar(value)) { + if (value.type === "block-scalar") { + (_a2 = value.props) != null ? _a2 : value.props = []; + return value.props; + } + (_b2 = value.end) != null ? _b2 : value.end = []; + return value.end; + } + if (value.type === "flow-collection") { + (_c2 = value.end) != null ? _c2 : value.end = []; + return value.end; + } + if (value.type === "block-map") { + const lastItem = value.items[value.items.length - 1]; + return lastItem ? _getTrailingTokens(lastItem.value) : void 0; + } + return; + }; if ((sorted.srcToken.type === "block-map" || sorted.srcToken.type === "flow-collection") && (node.internalNode.srcToken.type === "block-map" || node.internalNode.srcToken.type === "flow-collection")) { sorted.srcToken.items.sort((a2, b) => { if (a2.key && b.key && cst_exports.isScalar(a2.key) && cst_exports.isScalar(b.key)) { @@ -47339,31 +45008,21 @@ var YamlCodeActions = class { const item = sorted.srcToken.items[i]; const uItem = node.internalNode.srcToken.items[i]; item.start = uItem.start; - if (((_a = item.value) == null ? void 0 : _a.type) === "alias" || ((_b = item.value) == null ? void 0 : _b.type) === "scalar" || ((_c = item.value) == null ? void 0 : _c.type) === "single-quoted-scalar" || ((_d = item.value) == null ? void 0 : _d.type) === "double-quoted-scalar") { - const newLineIndex = (_g = (_f = (_e = item.value) == null ? void 0 : _e.end) == null ? void 0 : _f.findIndex((p) => p.type === "newline")) != null ? _g : -1; - let newLineToken = null; - if (((_h = uItem.value) == null ? void 0 : _h.type) === "block-scalar") { - newLineToken = (_j = (_i = uItem.value) == null ? void 0 : _i.props) == null ? void 0 : _j.find((p) => p.type === "newline"); - } else if (cst_exports.isScalar(uItem.value)) { - newLineToken = (_l = (_k = uItem.value) == null ? void 0 : _k.end) == null ? void 0 : _l.find((p) => p.type === "newline"); - } - if (newLineToken && newLineIndex < 0) { - item.value.end = (_m = item.value.end) != null ? _m : []; - item.value.end.push(newLineToken); - } - if (!newLineToken && newLineIndex > -1) { - item.value.end.splice(newLineIndex, 1); - } - } else if (((_n = item.value) == null ? void 0 : _n.type) === "block-scalar") { - const newline = item.value.props.find((p) => p.type === "newline"); - if (!newline) { - item.value.props.push({ type: "newline", indent: 0, offset: item.value.offset, source: "\n" }); - } + while (((_b = (_a = item.start) == null ? void 0 : _a[0]) == null ? void 0 : _b.type) === "newline") + item.start.shift(); + const itemTokens = _getTrailingTokens(item.value); + const itemNewLineIndex = (_c = itemTokens == null ? void 0 : itemTokens.findIndex((p) => p.type === "newline")) != null ? _c : -1; + const uNewLineToken = (_e = (_d = _getTrailingTokens(uItem.value)) == null ? void 0 : _d.find((p) => p.type === "newline" && p.offset < node.offset + node.length)) != null ? _e : null; + if (uNewLineToken && itemNewLineIndex < 0 && itemTokens) { + itemTokens.push({ type: "newline", indent: 0, offset: item.value.offset, source: "\n" }); + } + if (!uNewLineToken && itemNewLineIndex > -1 && itemTokens) { + itemTokens.splice(itemNewLineIndex, 1); } } } const replaceRange = Range.create(document.positionAt(node.offset), document.positionAt(node.offset + node.length)); - results.push(CodeAction.create(t("fixKeyOrderToMap"), createWorkspaceEdit(document.uri, [TextEdit.replace(replaceRange, cst_exports.stringify(sorted.srcToken))]), CodeActionKind.QuickFix)); + results.push(CodeAction.create(t("Fix key order for this map"), createWorkspaceEdit(document.uri, [TextEdit.replace(replaceRange, cst_exports.stringify(sorted.srcToken))]), CodeActionKind.QuickFix)); } } } @@ -47391,7 +45050,8 @@ var YamlCodeActions = class { continue; } for (const value of values) { - results.push(CodeAction.create(String(value), createWorkspaceEdit(document.uri, [TextEdit.replace(diagnostic.range, String(value))]), CodeActionKind.QuickFix)); + const scalar = typeof value === "string" ? toYamlStringScalar(value) : String(value); + results.push(CodeAction.create(scalar, createWorkspaceEdit(document.uri, [TextEdit.replace(diagnostic.range, scalar)]), CodeActionKind.QuickFix)); } } return results; @@ -47400,8 +45060,15 @@ var YamlCodeActions = class { function getNodeForDiagnostic(document, diagnostic) { const yamlDocuments = yamlDocumentsCache.getYamlDocument(document); const startOffset = document.offsetAt(diagnostic.range.start); + const endOffset = document.offsetAt(diagnostic.range.end); const yamlDoc = matchOffsetToDocument(startOffset, yamlDocuments); - const node = yamlDoc.getNodeFromOffset(startOffset); + let node = yamlDoc.getNodeFromOffset(startOffset); + if (node && startOffset < endOffset && node.offset + node.length === startOffset) { + const nodeInsideRange = yamlDoc.getNodeFromOffset(startOffset + 1); + if (nodeInsideRange) { + node = nodeInsideRange; + } + } return node; } function createWorkspaceEdit(uri, edits) { @@ -47454,45 +45121,6 @@ function doDocumentOnTypeFormatting(document, params) { // ../../node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCodeLens.js init_main(); - -// ../../node_modules/yaml-language-server/lib/esm/languageservice/utils/schemaUrls.js -var JSON_SCHEMASTORE_URL = "https://www.schemastore.org/api/json/catalog.json"; -function getSchemaUrls(schema4) { - const result = /* @__PURE__ */ new Map(); - if (!schema4) { - return result; - } - if (schema4.url) { - if (schema4.url.startsWith("schemaservice://combinedSchema/")) { - addSchemasForOf(schema4, result); - } else { - result.set(schema4.url, schema4); - } - } else { - addSchemasForOf(schema4, result); - } - return result; -} -function addSchemasForOf(schema4, result) { - if (schema4.allOf) { - addInnerSchemaUrls(schema4.allOf, result); - } - if (schema4.anyOf) { - addInnerSchemaUrls(schema4.anyOf, result); - } - if (schema4.oneOf) { - addInnerSchemaUrls(schema4.oneOf, result); - } -} -function addInnerSchemaUrls(schemas2, result) { - for (const subSchema of schemas2) { - if (!isBoolean2(subSchema) && subSchema.url && !result.has(subSchema.url)) { - result.set(subSchema.url, subSchema); - } - } -} - -// ../../node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCodeLens.js var YamlCodeLens = class { constructor(schemaService, telemetry) { this.schemaService = schemaService; @@ -47733,7 +45361,6 @@ function prependToObject(obj, consecutiveArrays) { } // ../../node_modules/yaml-language-server/lib/esm/languageservice/services/yamlCompletion.js -var doubleQuotesEscapeRegExp = /[\\]+"/g; var parentCompletionKind = CompletionItemKind.Class; var existingProposeItem = "__"; var YamlCompletion = class { @@ -47744,7 +45371,6 @@ var YamlCompletion = class { this.telemetry = telemetry; this.completionEnabled = true; this.arrayPrefixIndentation = ""; - this.isNumberExp = /^\d+$/; } configure(languageSettings, yamlSettings) { var _a; @@ -47869,7 +45495,7 @@ var YamlCompletion = class { if (!isString2(label)) { label = String(label); } - label = label.replace(/[\n]/g, "\u21B5"); + label = label.replace(/\n|\\n/g, "\u21B5"); if (label.length > 60) { const shortendedLabel = label.substr(0, 57).trim() + "..."; if (!proposed[shortendedLabel]) { @@ -47883,13 +45509,12 @@ var YamlCompletion = class { completionItem.insertText = label; completionItem.textEdit = TextEdit.replace(overwriteRange, label); } else { - let mdText = completionItem.insertText.replace(/\${[0-9]+[:|](.*)}/g, (s, arg) => arg).replace(/\$([0-9]+)/g, ""); - const splitMDText = mdText.split(":"); - let value = splitMDText.length > 1 ? splitMDText[1].trim() : mdText; - if (value && /^(['\\"\\])$/.test(value)) { - value = `${this.getQuote()}\\${value}${this.getQuote()}`; - mdText = splitMDText.length > 1 ? splitMDText[0] + ": " + value : value; - completionItem.insertText = mdText; + const mdText = completionItem.insertText.replace(/\${[0-9]+[:|](.*)}/g, (s, arg) => arg).replace(/\$([0-9]+)/g, ""); + const singleCharMatch = mdText.match(/^([^:"]+):\s*(['\\"\\])$/); + if (singleCharMatch) { + const key = singleCharMatch[1]; + const char = singleCharMatch[2]; + completionItem.insertText = `${key}: ${this.getQuote()}\\${char}${this.getQuote()}`; } if (completionItem.insertText.endsWith("$1") && !isForParentCompletion) { completionItem.insertText = completionItem.insertText.substr(0, completionItem.insertText.length - 2); @@ -47923,6 +45548,9 @@ var YamlCompletion = class { if (existing && !existing.documentation && completionItem.documentation) { existing.documentation = completionItem.documentation; } + if (existing && !existing.detail && completionItem.detail) { + existing.detail = completionItem.detail; + } }, error: (message) => { var _a2; @@ -48305,8 +45933,9 @@ ${indent}`); } } let insertText = key; + const isRequiredProp = Array.isArray(schema5.schema.required) ? schema5.schema.required.includes(key) : false; if (!key.startsWith(existingKey) || !hasColon) { - insertText = this.getInsertTextForProperty(key, propertySchema, separatorAfter, identCompensation + this.indentation); + insertText = this.getInsertTextForProperty(key, propertySchema, separatorAfter, identCompensation + this.indentation, isRequiredProp); } const isNodeNull = isScalar(originalNode) && originalNode.value === null || isMap(originalNode) && originalNode.items.length === 0; const existsParentCompletion = ((_b = schema5.schema.required) == null ? void 0 : _b.length) > 0; @@ -48322,7 +45951,7 @@ ${indent}`); if ((_c = schema5.schema.required) == null ? void 0 : _c.includes(key)) { collector.add({ label: key, - insertText: this.getInsertTextForProperty(key, propertySchema, separatorAfter, identCompensation + this.indentation), + insertText: this.getInsertTextForProperty(key, propertySchema, separatorAfter, identCompensation + this.indentation, true), insertTextFormat: InsertTextFormat.Snippet, documentation: this.fromMarkup(propertySchema.markdownDescription) || propertySchema.description || "", parent: { @@ -48339,17 +45968,34 @@ ${indent}`); if (nodeParent && isSeq(nodeParent) && isPrimitiveType(schema5.schema)) { this.addSchemaValueCompletions(schema5.schema, separatorAfter, collector, {}, ignoreScalars); } - if (schema5.schema.propertyNames && schema5.schema.additionalProperties && schema5.schema.type === "object") { + if (schema5.schema.type === "object" && schema5.schema.propertyNames && schema5.schema.additionalProperties !== false) { const propertyNameSchema = asSchema2(schema5.schema.propertyNames); if (!propertyNameSchema.deprecationMessage && !propertyNameSchema.doNotSuggest) { - const label = propertyNameSchema.title || "property"; - collector.add({ - kind: CompletionItemKind.Property, - label, - insertText: `\${1:${label}}: `, - insertTextFormat: InsertTextFormat.Snippet, - documentation: this.fromMarkup(propertyNameSchema.markdownDescription) || propertyNameSchema.description || "" - }); + const doc2 = this.fromMarkup((propertyNameSchema.markdownDescription || propertyNameSchema.description || "") + (propertyNameSchema.pattern ? ` + +**Pattern:** \`${propertyNameSchema.pattern}\`` : "")); + const { candidates, impossible } = this.getPropertyNamesCandidates(propertyNameSchema); + if (impossible) { + } else if (candidates.length) { + for (const key of candidates) { + collector.add({ + kind: CompletionItemKind.Property, + label: key, + insertText: `${key}: `, + insertTextFormat: InsertTextFormat.PlainText, + documentation: doc2 + }); + } + } else { + const label = propertyNameSchema.title || "property"; + collector.add({ + kind: CompletionItemKind.Property, + label, + insertText: `\${1:${label}}: `, + insertTextFormat: InsertTextFormat.Snippet, + documentation: doc2 + }); + } } } } @@ -48434,18 +46080,19 @@ ${indent}`); const insertText = `- ${this.getInsertTextForObject(schema4, separatorAfter).insertText.trimLeft()}`; const schemaTypeTitle = schemaType ? " type `" + schemaType + "`" : ""; const schemaDescription = schema4.description ? " (" + schema4.description + ")" : ""; - const documentation = this.getDocumentationWithMarkdownText(t("create.item.array", schemaTypeTitle, schemaDescription), insertText); + const documentation = this.getDocumentationWithMarkdownText(t("Create an item of an array{0}{1}", schemaTypeTitle, schemaDescription), insertText); collector.add({ kind: this.getSuggestionKind(schema4.type), - label: t("array.item") + (schemaType || index), + label: t("- (array item) ") + (schemaType || index), documentation, insertText, insertTextFormat: InsertTextFormat.Snippet }); } - getInsertTextForProperty(key, propertySchema, separatorAfter, indent = this.indentation) { + getInsertTextForProperty(key, propertySchema, separatorAfter, indent = this.indentation, isRequired = false) { const propertyText = this.getInsertTextForValue(key, "", "string"); const resultText = propertyText + ":"; + const hasRequiredDefault = propertySchema && isRequired && isDefined2(propertySchema.default); let value; let nValueProposals = 0; if (propertySchema) { @@ -48481,7 +46128,7 @@ ${indent}`); } nValueProposals += propertySchema.enum.length; } - if (propertySchema.const) { + if (isDefined2(propertySchema.const)) { if (!value) { value = this.getInsertTextForGuessedValue(propertySchema.const, "", type); value = this.evaluateTab1Symbol(value); @@ -48490,8 +46137,12 @@ ${indent}`); nValueProposals++; } if (isDefined2(propertySchema.default)) { - if (!value) { - value = " " + this.getInsertTextForGuessedValue(propertySchema.default, "", type); + if (!value || hasRequiredDefault) { + let defText = this.getInsertTextForGuessedValue(propertySchema.default, "", type); + if (hasRequiredDefault) { + defText = this.evaluateTab1Symbol(defText); + } + value = " " + defText; } nValueProposals++; } @@ -48511,9 +46162,8 @@ ${indent}- ${this.getInsertTextForArray(propertySchema.items, separatorAfter, 1, if (nValueProposals === 0) { switch (type) { case "boolean": - value = " $1"; - break; case "string": + case "anyOf": value = " $1"; break; case "object": @@ -48531,15 +46181,12 @@ ${indent}- `; case "null": value = " ${1:null}"; break; - case "anyOf": - value = " $1"; - break; default: return propertyText; } } } - if (!value || nValueProposals > 1) { + if (!value || nValueProposals > 1 && !hasRequiredDefault) { value = " $1"; } return resultText + value + separatorAfter; @@ -48572,10 +46219,10 @@ ${indent}- `; case "number": case "integer": case "anyOf": { - let value = propertySchema.default || propertySchema.const; - if (value) { + let value = propertySchema.default !== void 0 ? propertySchema.default : propertySchema.const; + if (value !== void 0) { if (type === "string") { - value = this.convertToStringValue(value); + value = toYamlStringScalar(value); } insertText += `${indent}${key}: \${${insertIndex++}:${value}} `; @@ -48623,7 +46270,7 @@ ${objectInsertResult.insertText} `; break; case "string": - insertText += `${indent}${key}: \${${insertIndex++}:${this.convertToStringValue(propertySchema.default)}} + insertText += `${indent}${key}: \${${insertIndex++}:${toYamlStringScalar(propertySchema.default)}} `; break; case "array": @@ -48685,12 +46332,10 @@ ${objectInsertResult.insertText} } return this.getInsertTextForValue(value, separatorAfter, type); case "string": { - let snippetValue = JSON.stringify(value); - snippetValue = snippetValue.substr(1, snippetValue.length - 2); - snippetValue = this.getInsertTextForPlainText(snippetValue); - if (type === "string") { - snippetValue = this.convertToStringValue(snippetValue); + if (type === "number" || type === "integer") { + return "${1:" + value + "}" + separatorAfter; } + const snippetValue = this.getInsertTextForPlainText(toYamlStringScalar(value)); return "${1:" + snippetValue + "}" + separatorAfter; } case "number": @@ -48700,7 +46345,7 @@ ${objectInsertResult.insertText} return this.getInsertTextForValue(value, separatorAfter, type); } getInsertTextForPlainText(text) { - return text.replace(/[\\$}]/g, "\\$&"); + return text.replace(/\\(?=[$}\\])/g, "\\\\").replace(/[$}]/g, "\\$&"); } // eslint-disable-next-line @typescript-eslint/no-explicit-any getInsertTextForValue(value, separatorAfter, type) { @@ -48718,7 +46363,7 @@ ${objectInsertResult.insertText} } type = Array.isArray(type) ? type[0] : type; if (type === "string") { - value = this.convertToStringValue(value); + value = toYamlStringScalar(String(value), this.isSingleQuote); } return this.getInsertTextForPlainText(value + separatorAfter); } @@ -48798,17 +46443,17 @@ ${objectInsertResult.insertText} type = "array"; } let label; - if (typeof value == "object") { - label = t("Default Value"); + if (typeof value === "object") { + label = t("Default value"); } else { - label = value.toString().replace(doubleQuotesEscapeRegExp, '"'); + label = this.getLabelForValue(value); } collector.add({ kind: this.getSuggestionKind(type), label, insertText: this.getInsertTextForValue(value, separatorAfter, type), insertTextFormat: InsertTextFormat.Snippet, - detail: t("Default Value") + detail: t("Default value") }); hasProposals = true; } @@ -48878,7 +46523,10 @@ ${objectInsertResult.insertText} if (Array.isArray(value)) { return JSON.stringify(value); } - return "" + value; + if (typeof value === "string") { + return toYamlStringScalar(value, this.isSingleQuote); + } + return String(value); } collectDefaultSnippets(schema4, separatorAfter, collector, settings, arrayDepth = 0) { if (Array.isArray(schema4.defaultSnippets)) { @@ -49056,41 +46704,43 @@ ${insertText} } return 0; } - convertToStringValue(param) { - let value; - if (typeof param === "string") { - value = ["on", "off", "true", "false", "yes", "no"].includes(param.toLowerCase()) ? `${this.getQuote()}${param}${this.getQuote()}` : param; - } else { - value = "" + param; - } - if (value.length === 0) { - return value; - } - if (value === "true" || value === "false" || value === "null" || this.isNumberExp.test(value)) { - return `"${value}"`; - } - if (value.indexOf('"') !== -1) { - value = value.replace(doubleQuotesEscapeRegExp, '"'); - } - let doQuote = !isNaN(parseInt(value)) || value.charAt(0) === "@"; - if (!doQuote) { - let idx = value.indexOf(":", 0); - for (; idx > 0 && idx < value.length; idx = value.indexOf(":", idx + 1)) { - if (idx === value.length - 1) { - doQuote = true; - break; - } - const nextChar = value.charAt(idx + 1); - if (nextChar === " " || nextChar === " ") { - doQuote = true; - break; + getPropertyNamesCandidates(schema4) { + let impossible = false; + const collect = (node) => { + var _a, _b, _c; + if (!node || typeof node !== "object") + return null; + if (Array.isArray(node.allOf) && node.allOf.length) { + let intersection = null; + for (const part of node.allOf) { + const partSet = collect(part); + if (!partSet) + continue; + intersection = intersection ? new Set([...intersection].filter((v) => partSet.has(v))) : new Set(partSet); + if (intersection.size === 0) { + impossible = true; + return /* @__PURE__ */ new Set(); + } } + if (intersection) + return intersection; } - } - if (doQuote) { - value = `"${value}"`; - } - return value; + const result = /* @__PURE__ */ new Set(); + if (typeof node.const === "string") + result.add(node.const); + (_a = node.enum) == null ? void 0 : _a.forEach((val) => typeof val === "string" && result.add(val)); + (_b = node.anyOf) == null ? void 0 : _b.forEach((branch) => { + var _a2; + return (_a2 = collect(branch)) == null ? void 0 : _a2.forEach((val) => result.add(val)); + }); + (_c = node.oneOf) == null ? void 0 : _c.forEach((branch) => { + var _a2; + return (_a2 = collect(branch)) == null ? void 0 : _a2.forEach((val) => result.add(val)); + }); + return result.size ? result : null; + }; + const set2 = collect(schema4); + return { candidates: set2 ? [...set2] : [], impossible }; } getQuote() { return this.isSingleQuote ? `'` : `"`; @@ -49250,6 +46900,180 @@ function trimEndNewLine(str) { return str; } +// ../../node_modules/yaml-language-server/lib/esm/languageservice/services/yamlRename.js +init_main(); +var import_vscode_languageserver_protocol = __toESM(require_main2()); +var YamlRename = class { + constructor(telemetry) { + this.telemetry = telemetry; + } + prepareRename(document, params) { + var _a; + try { + const target = this.findTarget(document, params.position); + if (!target) { + return null; + } + if (!this.findAnchorToken(target.yamlDoc, target.anchorNode)) { + return null; + } + return this.getNameRange(document, target.token); + } catch (err) { + (_a = this.telemetry) == null ? void 0 : _a.sendError("yaml.prepareRename.error", err); + return null; + } + } + doRename(document, params) { + var _a; + try { + const target = this.findTarget(document, params.position); + if (!target) { + return null; + } + const anchorToken = this.findAnchorToken(target.yamlDoc, target.anchorNode); + if (!anchorToken) { + return null; + } + const newName = params.newName; + const invalidChar = this.findInvalidAnchorChar(newName); + if (invalidChar !== null) { + throw new import_vscode_languageserver_protocol.ResponseError(import_vscode_languageserver_protocol.ErrorCodes.InvalidParams, `Anchor name cannot contain '${invalidChar}'`); + } + const edits = []; + edits.push(TextEdit.replace(this.getNameRange(document, anchorToken), newName)); + visit2(target.yamlDoc.internalDocument, (key, node) => { + if (isAlias(node) && node.srcToken && node.resolve(target.yamlDoc.internalDocument) === target.anchorNode) { + edits.push(TextEdit.replace(this.getNameRange(document, node.srcToken), newName)); + } + }); + return { + changes: { + [document.uri]: edits + } + }; + } catch (err) { + if (err instanceof import_vscode_languageserver_protocol.ResponseError) { + throw err; + } + (_a = this.telemetry) == null ? void 0 : _a.sendError("yaml.rename.error", err); + return null; + } + } + findTarget(document, position) { + const yamlDocuments = yamlDocumentsCache.getYamlDocument(document); + const offset = document.offsetAt(position); + const yamlDoc = matchOffsetToDocument(offset, yamlDocuments); + if (!yamlDoc) { + return null; + } + const [node] = yamlDoc.getNodeFromPosition(offset, new TextBuffer(document)); + if (!node) { + return this.findByToken(yamlDoc, offset); + } + if (isAlias(node) && node.srcToken && this.isOffsetInsideToken(node.srcToken, offset)) { + const anchorNode = node.resolve(yamlDoc.internalDocument); + if (!anchorNode) { + return null; + } + return { anchorNode, token: node.srcToken, yamlDoc }; + } + if ((isCollection(node) || isScalar(node)) && node.anchor) { + const anchorToken = this.findAnchorToken(yamlDoc, node); + if (anchorToken && this.isOffsetInsideToken(anchorToken, offset)) { + return { anchorNode: node, token: anchorToken, yamlDoc }; + } + } + return this.findByToken(yamlDoc, offset); + } + findByToken(yamlDoc, offset) { + let target; + visit2(yamlDoc.internalDocument, (key, node) => { + if (isAlias(node) && node.srcToken && this.isOffsetInsideToken(node.srcToken, offset)) { + const anchorNode = node.resolve(yamlDoc.internalDocument); + if (anchorNode) { + target = { anchorNode, token: node.srcToken, yamlDoc }; + return visit2.BREAK; + } + } + if ((isCollection(node) || isScalar(node)) && node.anchor) { + const anchorToken = this.findAnchorToken(yamlDoc, node); + if (anchorToken && this.isOffsetInsideToken(anchorToken, offset)) { + target = { anchorNode: node, token: anchorToken, yamlDoc }; + return visit2.BREAK; + } + } + }); + return target != null ? target : null; + } + findAnchorToken(yamlDoc, node) { + const parent = yamlDoc.getParent(node); + const candidates = []; + if (parent && parent.srcToken) { + candidates.push(parent.srcToken); + } + if (node.srcToken) { + candidates.push(node.srcToken); + } + for (const token of candidates) { + const anchor = this.getAnchorFromToken(token, node); + if (anchor) { + return anchor; + } + } + return void 0; + } + getAnchorFromToken(token, node) { + var _a; + if (isCollectionItem(token)) { + return this.getAnchorFromCollectionItem(token); + } else if (cst_exports.isCollection(token)) { + const collection = token; + for (const item of (_a = collection.items) != null ? _a : []) { + if (item.value !== node.srcToken) { + continue; + } + const anchor = this.getAnchorFromCollectionItem(item); + if (anchor) { + return anchor; + } + } + } + return void 0; + } + getAnchorFromCollectionItem(token) { + for (const t2 of token.start) { + if (t2.type === "anchor") { + return t2; + } + } + if (token.sep && Array.isArray(token.sep)) { + for (const t2 of token.sep) { + if (t2.type === "anchor") { + return t2; + } + } + } + return void 0; + } + getNameRange(document, token) { + const startOffset = token.offset + 1; + const endOffset = token.offset + token.source.length; + return Range.create(document.positionAt(startOffset), document.positionAt(endOffset)); + } + isOffsetInsideToken(token, offset) { + return offset >= token.offset && offset <= token.offset + token.source.length; + } + findInvalidAnchorChar(name) { + const invalidChars = ["[", "]", "{", "}", ",", " ", " "]; + for (const char of invalidChars) { + if (name.includes(char)) { + return char === " " ? "space" : char === " " ? "tab" : char; + } + } + return null; + } +}; + // ../../node_modules/yaml-language-server/lib/esm/languageservice/yamlLanguageService.js var SchemaPriority; (function(SchemaPriority2) { @@ -49258,7 +47082,7 @@ var SchemaPriority; SchemaPriority2[SchemaPriority2["Settings"] = 3] = "Settings"; })(SchemaPriority || (SchemaPriority = {})); function getLanguageService(params) { - const schemaService = new YAMLSchemaService(params.schemaRequestService, params.workspaceContext); + const schemaService = new YAMLSchemaService(params.schemaRequestService, params.workspaceContext, null, params.yamlSettings); const completer = new YamlCompletion(schemaService, params.clientCapabilities, yamlDocumentsCache, params.telemetry); const hover = new YAMLHover(schemaService, params.telemetry); const yamlDocumentSymbols = new YAMLDocumentSymbols(schemaService, params.telemetry); @@ -49268,9 +47092,11 @@ function getLanguageService(params) { const yamlCodeLens = new YamlCodeLens(schemaService, params.telemetry); const yamlLinks = new YamlLinks(params.telemetry); const yamlDefinition = new YamlDefinition(params.telemetry); + const yamlRename = new YamlRename(params.telemetry); new JSONSchemaSelection(schemaService, params.yamlSettings, params.connection); return { configure: (settings) => { + var _a, _b; schemaService.clearExternalSchemas(); if (settings.schemas) { schemaService.schemaPriorityMapping = /* @__PURE__ */ new Map(); @@ -49284,7 +47110,7 @@ function getLanguageService(params) { hover.configure(settings); completer.configure(settings, params.yamlSettings); formatter.configure(settings); - yamlCodeActions.configure(settings); + yamlCodeActions.configure(settings, ((_b = (_a = params == null ? void 0 : params.yamlSettings) == null ? void 0 : _a.yamlFormatterSettings) == null ? void 0 : _b.printWidth) || 80); }, registerCustomSchemaProvider: (schemaProvider) => { schemaService.registerCustomSchemaProvider(schemaProvider); @@ -49324,7 +47150,9 @@ function getLanguageService(params) { getCodeLens: (document) => { return yamlCodeLens.getCodeLens(document); }, - resolveCodeLens: (param) => yamlCodeLens.resolveCodeLens(param) + resolveCodeLens: (param) => yamlCodeLens.resolveCodeLens(param), + prepareRename: (document, params2) => yamlRename.prepareRename(document, params2), + doRename: (document, params2) => yamlRename.doRename(document, params2) }; } @@ -49347,11 +47175,14 @@ var SettingsState = class { enable: true }; this.yamlShouldHover = true; + this.yamlShouldHoverAnchor = true; this.yamlShouldCompletion = true; this.schemaStoreSettings = []; this.customTags = []; this.schemaStoreEnabled = true; this.schemaStoreUrl = JSON_SCHEMASTORE_URL; + this.kubernetesCRDStoreEnabled = true; + this.kubernetesCRDStoreUrl = CRD_CATALOG_URL; this.indentation = void 0; this.disableAdditionalProperties = false; this.disableDefaultProperties = false; @@ -49382,15 +47213,3 @@ export { YAMLValidation, getLanguageService }; -/*! Bundled license information: - -lodash/lodash.js: - (** - * @license - * Lodash - * Copyright OpenJS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - *) -*/ diff --git a/packages/demo/ace-legacy-linters.html b/packages/demo/ace-legacy-linters.html new file mode 100644 index 00000000..f83d11e1 --- /dev/null +++ b/packages/demo/ace-legacy-linters.html @@ -0,0 +1,10 @@ + + + + + Ace Legacy Linters JavaScript Demo + + + + + diff --git a/packages/demo/ace-legacy-linters/demo.ts b/packages/demo/ace-legacy-linters/demo.ts new file mode 100644 index 00000000..b317b07f --- /dev/null +++ b/packages/demo/ace-legacy-linters/demo.ts @@ -0,0 +1,39 @@ +import * as ace from "ace-builds"; +import "ace-builds/src-noconflict/ext-language_tools"; +import "ace-builds/src-noconflict/mode-javascript"; +import "ace-builds/src-noconflict/theme-textmate"; + +const javascriptWorkerUrl = import.meta.env.DEV + ? "/@ace-legacy-linters/worker-javascript.js" + : "./ace-legacy-linters/src-noconflict/worker-javascript.js"; + +ace.config.setModuleUrl("ace/mode/javascript_worker", javascriptWorkerUrl); +ace.require("ace/ext/language_tools"); + +document.body.innerHTML = ` +
+

ace-legacy-linters JavaScript worker

+

+ JavaScript mode is active. The worker comes from ace-legacy-linters. + The sample starts with a syntax error so annotations are visible. +

+
+
+`; + +const editor = ace.edit("editor", { + mode: "ace/mode/javascript", + theme: "ace/theme/textmate", + value: [ + "function demo(name) {", + " const greeting = `Hello ${name}`;", + " console.log(greeting", + "}", + ].join("\n"), + enableBasicAutocompletion: true, + enableLiveAutocompletion: true, + enableSnippets: true, +}); + +editor.clearSelection(); +editor.focus(); diff --git a/packages/demo/index.html b/packages/demo/index.html index f7e6dbef..7f8ce48e 100644 --- a/packages/demo/index.html +++ b/packages/demo/index.html @@ -206,6 +206,10 @@

Demos

(Requires Language Server WebSocket Bridge or a plain WebSocket server) +
  • + Ace Legacy Linters JavaScript Worker Demo +
    (Ace JavaScript mode wired to the legacy replacement worker)
    +
  • diff --git a/packages/yaml-language-server-esbuild/package.json b/packages/yaml-language-server-esbuild/package.json index ace67a19..9ffaab03 100644 --- a/packages/yaml-language-server-esbuild/package.json +++ b/packages/yaml-language-server-esbuild/package.json @@ -12,7 +12,7 @@ "path-browserify": "^1.0.0", "prettier": "^3.5.1", "vscode-languageserver-textdocument": "^1.0.0", - "yaml-language-server": "^1.19.2", + "yaml-language-server": "^1.21.0", "esbuild": "^0.27.2" }, "main": "./dist/index.js" diff --git a/tests/ui-smoke/ace-legacy-linters.contract.tests.ts b/tests/ui-smoke/ace-legacy-linters.contract.tests.ts new file mode 100644 index 00000000..c2e2896e --- /dev/null +++ b/tests/ui-smoke/ace-legacy-linters.contract.tests.ts @@ -0,0 +1,115 @@ +import {expect} from "chai"; +import {createUiHarness} from "./shared/harness"; +import {phpContent} from "./fixtures/php"; +import {luaContent} from "./fixtures/lua"; +import {htmlContent} from "./fixtures/html"; +import {jsonContent} from "./fixtures/json"; +import {json5Content} from "./fixtures/json5"; +import {cssContent} from "./fixtures/css"; +import {lessContent} from "./fixtures/less"; +import {scssContent} from "./fixtures/scss"; +import {xmlContent} from "./fixtures/xml"; +import {yamlContent} from "./fixtures/yaml"; +import {javascriptContent} from "./fixtures/javascript"; +import {jsxContent} from "./fixtures/jsx"; + +describe("ace-legacy-linters UI contract tests", function () { + this.timeout(40000); + const harness = createUiHarness(); + + before(async function () { + await harness.start(); + }); + + after(async function () { + await harness.stop(); + }); + + it("uses the custom workers replacements with ace-builds", async function () { + await harness.openScenario("ace-legacy-linters"); + const page = harness.getPage(); + + const cases = [ + { + mode: "php", + content: phpContent, + label: "PHP", + }, + { + mode: "lua", + content: luaContent, + label: "Lua", + }, + { + mode: "html", + content: htmlContent, + label: "HTML", + }, + { + mode: "json", + content: jsonContent, + label: "JSON", + }, + { + mode: "json5", + content: json5Content, + label: "JSON5", + }, + { + mode: "css", + content: cssContent, + label: "CSS", + }, + { + mode: "less", + content: lessContent, + label: "LESS", + }, + { + mode: "scss", + content: scssContent, + label: "SCSS", + }, + { + mode: "xml", + content: xmlContent, + label: "XML", + }, + { + mode: "yaml", + content: yamlContent, + label: "YAML", + }, + { + mode: "javascript", + content: javascriptContent, + label: "JavaScript", + }, + { + mode: "jsx", + content: jsxContent, + label: "JSX", + }, + ]; + + for (const testCase of cases) { + harness.clearConsoleErrors(); + await harness.switchMode(testCase.mode); + await page.evaluate((content) => { + window.testFlags.workerReady = false; + window.testFlags.hasAnnotations = false; + window.editor.setValue(content); + window.editor.clearSelection(); + }, testCase.content); + + await harness.waitForFlag("workerReady"); + await harness.waitForFlag("hasAnnotations"); + + const annotations = await page.evaluate(() => window.editor.session.getAnnotations()); + expect(annotations, `${testCase.label} worker annotations`).to.be.an("array").that.is.not.empty; + + const errors = harness.getConsoleErrors(); + expect(errors, `Console errors for ${testCase.label}: ${errors.join("\n")}`).to.be.empty; + } + }); +}); diff --git a/tests/ui-smoke/fixtures/css.ts b/tests/ui-smoke/fixtures/css.ts new file mode 100644 index 00000000..53919c3e --- /dev/null +++ b/tests/ui-smoke/fixtures/css.ts @@ -0,0 +1,3 @@ +export const cssContent = `.foo { + color: +}`; diff --git a/tests/ui-smoke/fixtures/html.ts b/tests/ui-smoke/fixtures/html.ts new file mode 100644 index 00000000..7fab5f29 --- /dev/null +++ b/tests/ui-smoke/fixtures/html.ts @@ -0,0 +1,5 @@ +export const htmlContent = ` + + + +`; diff --git a/tests/ui-smoke/fixtures/javascript.ts b/tests/ui-smoke/fixtures/javascript.ts new file mode 100644 index 00000000..fd680bd8 --- /dev/null +++ b/tests/ui-smoke/fixtures/javascript.ts @@ -0,0 +1 @@ +export const javascriptContent = `const foo = bar;`; diff --git a/tests/ui-smoke/fixtures/json.ts b/tests/ui-smoke/fixtures/json.ts new file mode 100644 index 00000000..e12ef5e8 --- /dev/null +++ b/tests/ui-smoke/fixtures/json.ts @@ -0,0 +1,3 @@ +export const jsonContent = `{ + "foo": +}`; diff --git a/tests/ui-smoke/fixtures/json5.ts b/tests/ui-smoke/fixtures/json5.ts new file mode 100644 index 00000000..4e45a52e --- /dev/null +++ b/tests/ui-smoke/fixtures/json5.ts @@ -0,0 +1,4 @@ +export const json5Content = `{ + // comment + unquoted: , +}`; diff --git a/tests/ui-smoke/fixtures/jsx.ts b/tests/ui-smoke/fixtures/jsx.ts new file mode 100644 index 00000000..27cbda4d --- /dev/null +++ b/tests/ui-smoke/fixtures/jsx.ts @@ -0,0 +1,4 @@ +export const jsxContent = `const App = () => ( +
    + Hello
    +);`; diff --git a/tests/ui-smoke/fixtures/less.ts b/tests/ui-smoke/fixtures/less.ts new file mode 100644 index 00000000..239f1e41 --- /dev/null +++ b/tests/ui-smoke/fixtures/less.ts @@ -0,0 +1,6 @@ +export const lessContent = `@color: #f00; + +.foo { + color: @color + width: ; +}`; diff --git a/tests/ui-smoke/fixtures/lua.ts b/tests/ui-smoke/fixtures/lua.ts new file mode 100644 index 00000000..6e059186 --- /dev/null +++ b/tests/ui-smoke/fixtures/lua.ts @@ -0,0 +1,4 @@ +export const luaContent = `function foo(items) + print(items[ +end +`; diff --git a/tests/ui-smoke/fixtures/php.ts b/tests/ui-smoke/fixtures/php.ts new file mode 100644 index 00000000..541e112e --- /dev/null +++ b/tests/ui-smoke/fixtures/php.ts @@ -0,0 +1,5 @@ +export const phpContent = ` + +`; diff --git a/tests/ui-smoke/scenarios/ace-legacy-linters.html b/tests/ui-smoke/scenarios/ace-legacy-linters.html new file mode 100644 index 00000000..9c081ee9 --- /dev/null +++ b/tests/ui-smoke/scenarios/ace-legacy-linters.html @@ -0,0 +1,147 @@ + + + + + + ace-legacy-linters smoke + + + + +
    + + + + + + diff --git a/tests/ui-smoke/shared/harness.ts b/tests/ui-smoke/shared/harness.ts index bc432836..b6824013 100644 --- a/tests/ui-smoke/shared/harness.ts +++ b/tests/ui-smoke/shared/harness.ts @@ -43,6 +43,7 @@ export function createUiHarness() { async function openScenario(scenarioName: string, query = "") { clearConsoleErrors(); page.removeAllListeners("console"); + page.removeAllListeners("error"); page.removeAllListeners("pageerror"); page.on("console", (msg) => { @@ -50,6 +51,10 @@ export function createUiHarness() { consoleErrors.push(msg.text()); } }); + page.on("error", (error) => { + consoleErrors.push(error.message); + }); + page.on("pageerror", (error) => { consoleErrors.push(error.message); }); diff --git a/tests/ui-smoke/shared/types.ts b/tests/ui-smoke/shared/types.ts index 498283a6..784e0219 100644 --- a/tests/ui-smoke/shared/types.ts +++ b/tests/ui-smoke/shared/types.ts @@ -10,4 +10,6 @@ export interface UiTestFlags { formatResponseReceived: boolean; formatHasEdits: boolean; ready?: boolean; + workerReady?: boolean; + hasAnnotations?: boolean; } diff --git a/tools/prepare-ui-smoke-dist.js b/tools/prepare-ui-smoke-dist.js index 8a578f66..f5e4e80c 100644 --- a/tools/prepare-ui-smoke-dist.js +++ b/tools/prepare-ui-smoke-dist.js @@ -12,95 +12,82 @@ const packagesToCopy = [ workspacePath: "packages/ace-linters", sourceBuildDir: path.join(rootDir, "packages", "ace-linters", "build"), targetBuildDir: path.join(distDir, "build", "ace-linters"), - requiredFiles: ["ace-linters.js", "service-manager.js"], - }, - { + requiredFiles: ["ace-linters.js", "service-manager.js"] + }, { name: "ace-spell-check", workspacePath: "packages/ace-spell-check", sourceBuildDir: path.join(rootDir, "packages", "ace-spell-check", "build"), targetBuildDir: path.join(distDir, "build", "ace-spell-check"), - requiredFiles: ["ace-spell-check.js", "esm-dicts-resolver.js", path.join("dicts", "cspell-dict-typescript.json")], - }, - { + requiredFiles: [ + "ace-spell-check.js", "esm-dicts-resolver.js", path.join("dicts", "cspell-dict-typescript.json") + ] + }, { name: "ace-clang-linter", workspacePath: "packages/ace-clang-linter", sourceBuildDir: path.join(rootDir, "packages", "ace-clang-linter", "build"), targetBuildDir: path.join(distDir, "build", "ace-clang-linter"), - requiredFiles: ["ace-clang-linter.js"], - }, - { + requiredFiles: ["ace-clang-linter.js"] + }, { name: "ace-dart-linter", workspacePath: "packages/ace-dart-linter", sourceBuildDir: path.join(rootDir, "packages", "ace-dart-linter", "build"), targetBuildDir: path.join(distDir, "build", "ace-dart-linter"), - requiredFiles: ["ace-dart-linter.js"], - }, - { + requiredFiles: ["ace-dart-linter.js"] + }, { name: "ace-go-linter", workspacePath: "packages/ace-go-linter", sourceBuildDir: path.join(rootDir, "packages", "ace-go-linter", "build"), targetBuildDir: path.join(distDir, "build", "ace-go-linter"), - requiredFiles: ["ace-go-linter.js"], - }, - { + requiredFiles: ["ace-go-linter.js"] + }, { name: "ace-lua-linter", workspacePath: "packages/ace-lua-linter", sourceBuildDir: path.join(rootDir, "packages", "ace-lua-linter", "build"), targetBuildDir: path.join(distDir, "build", "ace-lua-linter"), - requiredFiles: ["ace-lua-linter.js"], - }, - { + requiredFiles: ["ace-lua-linter.js"] + }, { name: "ace-python-ruff-linter", workspacePath: "packages/ace-python-ruff-linter", sourceBuildDir: path.join(rootDir, "packages", "ace-python-ruff-linter", "build"), targetBuildDir: path.join(distDir, "build", "ace-python-ruff-linter"), - requiredFiles: ["python-service.js"], - }, - { + requiredFiles: ["python-service.js"] + }, { name: "ace-sql-linter", workspacePath: "packages/ace-sql-linter", sourceBuildDir: path.join(rootDir, "packages", "ace-sql-linter", "build"), targetBuildDir: path.join(distDir, "build", "ace-sql-linter"), - requiredFiles: ["mysql-service.js"], - }, - { + requiredFiles: ["mysql-service.js"] + }, { name: "ace-zig-linter", workspacePath: "packages/ace-zig-linter", sourceBuildDir: path.join(rootDir, "packages", "ace-zig-linter", "build"), targetBuildDir: path.join(distDir, "build", "ace-zig-linter"), - requiredFiles: ["ace-zig-linter.js"], - }, + requiredFiles: ["ace-zig-linter.js"] + }, { + name: "ace-legacy-linters", + workspacePath: "packages/ace-legacy-linters", + sourceBuildDir: path.join(rootDir, "packages", "ace-legacy-linters", "build"), + targetBuildDir: path.join(distDir, "build", "ace-legacy-linters"), + requiredFiles: [ + path.join("src-noconflict", "worker-php.js"), path.join("src-noconflict", "worker-lua.js"), + path.join("src-noconflict", "worker-html.js"), path.join("src-noconflict", "worker-json.js"), + path.join("src-noconflict", "worker-xml.js"), path.join("src-noconflict", "worker-yaml.js") + ] + } ]; const aceAssetsToCopy = [ { sourceFile: path.join(rootDir, "node_modules", "ace-builds", "src-noconflict", "ace.js"), - targetFile: path.join(distDir, "vendor", "ace", "ace.js"), - }, - { + targetFile: path.join(distDir, "vendor", "ace", "ace.js") + }, { sourceFile: path.join(rootDir, "node_modules", "ace-builds", "src-noconflict", "ext-language_tools.js"), - targetFile: path.join(distDir, "vendor", "ace", "ext-language_tools.js"), - }, + targetFile: path.join(distDir, "vendor", "ace", "ext-language_tools.js") + } ]; const aceModeFilesToCopy = [ - "mode-typescript.js", - "mode-json.js", - "mode-css.js", - "mode-html.js", - "mode-yaml.js", - "mode-php.js", - "mode-xml.js", - "mode-javascript.js", - "mode-lua.js", - "mode-less.js", - "mode-scss.js", - "mode-c_cpp.js", - "mode-dart.js", - "mode-golang.js", - "mode-python.js", - "mode-sql.js", - "mode-mysql.js", - "mode-pgsql.js", - "mode-zig.js", + "mode-typescript.js", "mode-json.js", "mode-json5.js", "mode-css.js", "mode-html.js", "mode-yaml.js", "mode-php.js", + "mode-xml.js", "mode-javascript.js", "mode-jsx.js", "mode-lua.js", "mode-less.js", "mode-scss.js", "mode-c_cpp.js", + "mode-dart.js", "mode-golang.js", "mode-python.js", "mode-sql.js", "mode-mysql.js", "mode-pgsql.js", "mode-zig.js" ]; function assertPathExists(targetPath, message) { @@ -125,7 +112,7 @@ function hasRequiredBuildArtifacts(pkg) { function buildWorkspacePackage(pkg) { childProcess.execSync(`${npmCommand()} run build -w ${pkg.workspacePath}`, { cwd: rootDir, - stdio: "inherit", + stdio: "inherit" }); } @@ -137,10 +124,8 @@ function ensurePackageBuilds() { } if (!hasRequiredBuildArtifacts(pkg)) { - throw new Error( - `Build output for ${pkg.name} is incomplete after build step. ` + - `Expected files: ${pkg.requiredFiles.join(", ")}` - ); + throw new Error(`Build output for ${pkg.name} is incomplete after build step. ` + + `Expected files: ${pkg.requiredFiles.join(", ")}`); } } } @@ -152,14 +137,20 @@ function copyPackageBuilds() { `Missing build output for ${pkg.name}. Run workspace build before preparing ui-smoke dist.` ); fs.mkdirSync(pkg.targetBuildDir, {recursive: true}); - fs.cpSync(pkg.sourceBuildDir, pkg.targetBuildDir, {recursive: true, force: true}); + fs.cpSync(pkg.sourceBuildDir, pkg.targetBuildDir, { + recursive: true, + force: true + }); } } function copyScenarios() { assertPathExists(scenariosDir, "Missing tests/ui-smoke/scenarios directory."); fs.mkdirSync(distDir, {recursive: true}); - fs.cpSync(scenariosDir, distDir, {recursive: true, force: true}); + fs.cpSync(scenariosDir, distDir, { + recursive: true, + force: true + }); } function copyAceAssets() { @@ -181,12 +172,24 @@ function copyAceAssets() { const snippetsTargetDir = path.join(distDir, "vendor", "ace", "snippets"); assertPathExists(snippetsSourceDir, `Missing Ace snippets directory: ${snippetsSourceDir}`); fs.mkdirSync(snippetsTargetDir, {recursive: true}); - fs.cpSync(snippetsSourceDir, snippetsTargetDir, {recursive: true, force: true}); + fs.cpSync(snippetsSourceDir, snippetsTargetDir, { + recursive: true, + force: true + }); } +function resetDist() { + fs.rmSync(distDir, { + recursive: true, + force: true + }); + fs.mkdirSync(distDir, {recursive: true}); +} + function prepareDist() { ensurePackageBuilds(); + resetDist(); copyPackageBuilds(); copyScenarios(); copyAceAssets(); diff --git a/vite.config.ts b/vite.config.ts index 5a48a07e..baed4608 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,6 +3,78 @@ import {resolve} from 'path'; import {readFileSync, readdirSync, writeFileSync, rmSync, existsSync} from 'fs'; import {viteStaticCopy} from 'vite-plugin-static-copy'; import {nodePolyfills} from "vite-plugin-node-polyfills"; +import {build as esbuild} from "esbuild"; + +const aceLegacyWorkerDevUrl = "/@ace-legacy-linters/worker-javascript.js"; +const aceLegacyWorkerBootstrapPath = resolve(__dirname, "packages/ace-legacy-linters/src/worker.js"); +const aceLegacyWorkerEntryPath = resolve(__dirname, "packages/ace-legacy-linters/src/workers/javascript-worker.ts"); +const aceLegacyWorkerSourceDir = resolve(__dirname, "packages/ace-legacy-linters/src"); +const aceOopSourcePath = resolve(__dirname, "node_modules/ace-code/src/lib/oop.js"); +const aceEventEmitterSourcePath = resolve(__dirname, "node_modules/ace-code/src/lib/event_emitter.js"); + +function wrapAceCodeModule(moduleFactory: string, moduleId: string, source: string) { + const normalizedSource = source + .replace(/^\uFEFF?/, "") + .replace(/^"use strict";\s*/, ""); + + return ` +${moduleFactory}(${JSON.stringify(moduleId)}, [], function(require, exports, module) { +"use strict"; +${normalizedSource.trim()} +}); +`.trim(); +} + +function createAceLegacyWorkerModule(bundleCode: string) { + return ` +ace.define("ace/mode/javascript_worker", [], function(require, exports, module) { +"use strict"; +var define = undefined; +${bundleCode} +exports.JavaScriptWorker = aceLegacyWorkerModule.JavaScriptWorker; +}); +`.trim(); +} + +async function buildAceLegacyJavascriptWorker() { + const [bootstrap, oopModule, eventEmitterModule, bundledWorker] = await Promise.all([ + Promise.resolve(readFileSync(aceLegacyWorkerBootstrapPath, "utf-8")), + Promise.resolve(readFileSync(aceOopSourcePath, "utf-8")), + Promise.resolve(readFileSync(aceEventEmitterSourcePath, "utf-8")), + esbuild({ + entryPoints: [aceLegacyWorkerEntryPath], + bundle: true, + write: false, + format: "iife", + globalName: "aceLegacyWorkerModule", + platform: "browser", + target: "es2019", + sourcemap: false, + minify: false, + metafile: true, + banner: { + js: "var aceLegacyWorkerModule;" + }, + footer: { + js: "aceLegacyWorkerModule = aceLegacyWorkerModule.default || aceLegacyWorkerModule;" + }, + }), + ]); + + return { + code: [ + bootstrap.trimEnd(), + "", + wrapAceCodeModule("ace.define", "ace/lib/oop", oopModule), + "", + wrapAceCodeModule("ace.define", "ace/lib/event_emitter", eventEmitterModule), + "", + createAceLegacyWorkerModule(bundledWorker.outputFiles[0].text), + "", + ].join("\n"), + inputs: Object.keys(bundledWorker.metafile?.inputs ?? {}), + }; +} // Plugin to handle .rs files as raw text (replaces webpack raw-loader) function rawLoader(extensions: string[]): Plugin { @@ -64,6 +136,48 @@ function flattenHtmlOutput(): Plugin { }; } +function aceLegacyWorkerDevPlugin(): Plugin { + const watchedPaths = [ + aceLegacyWorkerBootstrapPath, + aceOopSourcePath, + aceEventEmitterSourcePath, + aceLegacyWorkerSourceDir, + ]; + + return { + name: "vite-plugin-ace-legacy-worker-dev", + configureServer(server) { + server.watcher.add(watchedPaths); + server.watcher.on("change", (file) => { + if ( + file.startsWith(aceLegacyWorkerSourceDir) || + file === aceLegacyWorkerBootstrapPath || + file === aceOopSourcePath || + file === aceEventEmitterSourcePath + ) { + server.ws.send({type: "full-reload"}); + } + }); + + server.middlewares.use(async (req, res, next) => { + if (req.url !== aceLegacyWorkerDevUrl) { + next(); + return; + } + + try { + const {code, inputs} = await buildAceLegacyJavascriptWorker(); + server.watcher.add(inputs); + res.setHeader("Content-Type", "application/javascript"); + res.end(code); + } catch (error) { + next(error as Error); + } + }); + }, + }; +} + export default defineConfig(({command}) => { const useSourceAliases = command === 'serve'; @@ -86,6 +200,7 @@ export default defineConfig(({command}) => { multiprovider: resolve(__dirname, 'packages/demo/multiprovider.html'), svelte: resolve(__dirname, 'packages/demo/svelte.html'), change_mode: resolve(__dirname, 'packages/demo/change_mode.html'), + ace_legacy_linters: resolve(__dirname, 'packages/demo/ace-legacy-linters.html'), 'lsp-ai': resolve(__dirname, 'packages/demo/lsp-ai.html'), 'file-api-websockets': resolve(__dirname, 'packages/demo/file-api-websockets.html'), 'pylsp-websocket': resolve(__dirname, 'packages/demo/pylsp-websocket.html'), @@ -119,6 +234,7 @@ export default defineConfig(({command}) => { devServerRedirect(), rawLoader(['.rs']), flattenHtmlOutput(), + aceLegacyWorkerDevPlugin(), nodePolyfills({ include: ['buffer', 'process', 'util', 'stream', 'path', 'events'], globals: { @@ -135,6 +251,10 @@ export default defineConfig(({command}) => { { src: 'packages/ace-linters/build/*', dest: 'build', + }, + { + src: 'packages/ace-legacy-linters/build/src-noconflict/*', + dest: 'ace-legacy-linters/src-noconflict', } ], }), @@ -237,6 +357,10 @@ export default defineConfig(({command}) => { find: /^ace-spell-check\/build\/(.*)$/, replacement: resolve(__dirname, 'packages/ace-spell-check/src/$1.ts') }, + { + find: /^ace-legacy-linters\/src\/(.*)$/, + replacement: resolve(__dirname, 'packages/ace-legacy-linters/src/$1') + }, ] : [], },