UNPKG

i18n-ai-translate

Version:

Use LLMs to translate your i18n JSON to any language.

1,708 lines (1,701 loc) 1.13 MB
#!/usr/bin/env node var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); // node_modules/dotenv/package.json var require_package = __commonJS({ "node_modules/dotenv/package.json"(exports2, module2) { module2.exports = { name: "dotenv", version: "16.4.7", description: "Loads environment variables from .env file", main: "lib/main.js", types: "lib/main.d.ts", exports: { ".": { types: "./lib/main.d.ts", require: "./lib/main.js", default: "./lib/main.js" }, "./config": "./config.js", "./config.js": "./config.js", "./lib/env-options": "./lib/env-options.js", "./lib/env-options.js": "./lib/env-options.js", "./lib/cli-options": "./lib/cli-options.js", "./lib/cli-options.js": "./lib/cli-options.js", "./package.json": "./package.json" }, scripts: { "dts-check": "tsc --project tests/types/tsconfig.json", lint: "standard", pretest: "npm run lint && npm run dts-check", test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000", "test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=lcov", prerelease: "npm test", release: "standard-version" }, repository: { type: "git", url: "git://github.com/motdotla/dotenv.git" }, funding: "https://dotenvx.com", keywords: [ "dotenv", "env", ".env", "environment", "variables", "config", "settings" ], readmeFilename: "README.md", license: "BSD-2-Clause", devDependencies: { "@types/node": "^18.11.3", decache: "^4.6.2", sinon: "^14.0.1", standard: "^17.0.0", "standard-version": "^9.5.0", tap: "^19.2.0", typescript: "^4.8.4" }, engines: { node: ">=12" }, browser: { fs: false } }; } }); // node_modules/dotenv/lib/main.js var require_main = __commonJS({ "node_modules/dotenv/lib/main.js"(exports2, module2) { var fs6 = require("fs"); var path4 = require("path"); var os = require("os"); var crypto = require("crypto"); var packageJson = require_package(); var version2 = packageJson.version; var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg; function parse(src) { const obj = {}; let lines = src.toString(); lines = lines.replace(/\r\n?/mg, "\n"); let match; while ((match = LINE.exec(lines)) != null) { const key = match[1]; let value = match[2] || ""; value = value.trim(); const maybeQuote = value[0]; value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2"); if (maybeQuote === '"') { value = value.replace(/\\n/g, "\n"); value = value.replace(/\\r/g, "\r"); } obj[key] = value; } return obj; } function _parseVault(options) { const vaultPath = _vaultPath(options); const result = DotenvModule.configDotenv({ path: vaultPath }); if (!result.parsed) { const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`); err.code = "MISSING_DATA"; throw err; } const keys = _dotenvKey(options).split(","); const length = keys.length; let decrypted; for (let i2 = 0; i2 < length; i2++) { try { const key = keys[i2].trim(); const attrs = _instructions(result, key); decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key); break; } catch (error) { if (i2 + 1 >= length) { throw error; } } } return DotenvModule.parse(decrypted); } function _log(message) { console.log(`[dotenv@${version2}][INFO] ${message}`); } function _warn(message) { console.log(`[dotenv@${version2}][WARN] ${message}`); } function _debug(message) { console.log(`[dotenv@${version2}][DEBUG] ${message}`); } function _dotenvKey(options) { if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) { return options.DOTENV_KEY; } if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) { return process.env.DOTENV_KEY; } return ""; } function _instructions(result, dotenvKey) { let uri; try { uri = new URL(dotenvKey); } catch (error) { if (error.code === "ERR_INVALID_URL") { const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development"); err.code = "INVALID_DOTENV_KEY"; throw err; } throw error; } const key = uri.password; if (!key) { const err = new Error("INVALID_DOTENV_KEY: Missing key part"); err.code = "INVALID_DOTENV_KEY"; throw err; } const environment = uri.searchParams.get("environment"); if (!environment) { const err = new Error("INVALID_DOTENV_KEY: Missing environment part"); err.code = "INVALID_DOTENV_KEY"; throw err; } const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`; const ciphertext = result.parsed[environmentKey]; if (!ciphertext) { const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`); err.code = "NOT_FOUND_DOTENV_ENVIRONMENT"; throw err; } return { ciphertext, key }; } function _vaultPath(options) { let possibleVaultPath = null; if (options && options.path && options.path.length > 0) { if (Array.isArray(options.path)) { for (const filepath of options.path) { if (fs6.existsSync(filepath)) { possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`; } } } else { possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`; } } else { possibleVaultPath = path4.resolve(process.cwd(), ".env.vault"); } if (fs6.existsSync(possibleVaultPath)) { return possibleVaultPath; } return null; } function _resolveHome(envPath) { return envPath[0] === "~" ? path4.join(os.homedir(), envPath.slice(1)) : envPath; } function _configVault(options) { _log("Loading env from encrypted .env.vault"); const parsed = DotenvModule._parseVault(options); let processEnv = process.env; if (options && options.processEnv != null) { processEnv = options.processEnv; } DotenvModule.populate(processEnv, parsed, options); return { parsed }; } function configDotenv(options) { const dotenvPath = path4.resolve(process.cwd(), ".env"); let encoding = "utf8"; const debug3 = Boolean(options && options.debug); if (options && options.encoding) { encoding = options.encoding; } else { if (debug3) { _debug("No encoding is specified. UTF-8 is used by default"); } } let optionPaths = [dotenvPath]; if (options && options.path) { if (!Array.isArray(options.path)) { optionPaths = [_resolveHome(options.path)]; } else { optionPaths = []; for (const filepath of options.path) { optionPaths.push(_resolveHome(filepath)); } } } let lastError; const parsedAll = {}; for (const path5 of optionPaths) { try { const parsed = DotenvModule.parse(fs6.readFileSync(path5, { encoding })); DotenvModule.populate(parsedAll, parsed, options); } catch (e2) { if (debug3) { _debug(`Failed to load ${path5} ${e2.message}`); } lastError = e2; } } let processEnv = process.env; if (options && options.processEnv != null) { processEnv = options.processEnv; } DotenvModule.populate(processEnv, parsedAll, options); if (lastError) { return { parsed: parsedAll, error: lastError }; } else { return { parsed: parsedAll }; } } function config2(options) { if (_dotenvKey(options).length === 0) { return DotenvModule.configDotenv(options); } const vaultPath = _vaultPath(options); if (!vaultPath) { _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`); return DotenvModule.configDotenv(options); } return DotenvModule._configVault(options); } function decrypt(encrypted, keyStr) { const key = Buffer.from(keyStr.slice(-64), "hex"); let ciphertext = Buffer.from(encrypted, "base64"); const nonce = ciphertext.subarray(0, 12); const authTag = ciphertext.subarray(-16); ciphertext = ciphertext.subarray(12, -16); try { const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce); aesgcm.setAuthTag(authTag); return `${aesgcm.update(ciphertext)}${aesgcm.final()}`; } catch (error) { const isRange = error instanceof RangeError; const invalidKeyLength = error.message === "Invalid key length"; const decryptionFailed = error.message === "Unsupported state or unable to authenticate data"; if (isRange || invalidKeyLength) { const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)"); err.code = "INVALID_DOTENV_KEY"; throw err; } else if (decryptionFailed) { const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY"); err.code = "DECRYPTION_FAILED"; throw err; } else { throw error; } } } function populate(processEnv, parsed, options = {}) { const debug3 = Boolean(options && options.debug); const override = Boolean(options && options.override); if (typeof parsed !== "object") { const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate"); err.code = "OBJECT_REQUIRED"; throw err; } for (const key of Object.keys(parsed)) { if (Object.prototype.hasOwnProperty.call(processEnv, key)) { if (override === true) { processEnv[key] = parsed[key]; } if (debug3) { if (override === true) { _debug(`"${key}" is already defined and WAS overwritten`); } else { _debug(`"${key}" is already defined and was NOT overwritten`); } } } else { processEnv[key] = parsed[key]; } } } var DotenvModule = { configDotenv, _configVault, _parseVault, config: config2, decrypt, parse, populate }; module2.exports.configDotenv = DotenvModule.configDotenv; module2.exports._configVault = DotenvModule._configVault; module2.exports._parseVault = DotenvModule._parseVault; module2.exports.config = DotenvModule.config; module2.exports.decrypt = DotenvModule.decrypt; module2.exports.parse = DotenvModule.parse; module2.exports.populate = DotenvModule.populate; module2.exports = DotenvModule; } }); // node_modules/iso-639-1/src/data.js var require_data = __commonJS({ "node_modules/iso-639-1/src/data.js"(exports2, module2) { var LANGUAGES_LIST = { aa: { name: "Afar", nativeName: "Afaraf" }, ab: { name: "Abkhaz", nativeName: "\u0430\u04A7\u0441\u0443\u0430 \u0431\u044B\u0437\u0448\u04D9\u0430" }, ae: { name: "Avestan", nativeName: "avesta" }, af: { name: "Afrikaans", nativeName: "Afrikaans" }, ak: { name: "Akan", nativeName: "Akan" }, am: { name: "Amharic", nativeName: "\u12A0\u121B\u122D\u129B" }, an: { name: "Aragonese", nativeName: "aragon\xE9s" }, ar: { name: "Arabic", nativeName: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629" }, as: { name: "Assamese", nativeName: "\u0985\u09B8\u09AE\u09C0\u09AF\u09BC\u09BE" }, av: { name: "Avaric", nativeName: "\u0430\u0432\u0430\u0440 \u043C\u0430\u0446\u04C0" }, ay: { name: "Aymara", nativeName: "aymar aru" }, az: { name: "Azerbaijani", nativeName: "az\u0259rbaycan dili" }, ba: { name: "Bashkir", nativeName: "\u0431\u0430\u0448\u04A1\u043E\u0440\u0442 \u0442\u0435\u043B\u0435" }, be: { name: "Belarusian", nativeName: "\u0431\u0435\u043B\u0430\u0440\u0443\u0441\u043A\u0430\u044F \u043C\u043E\u0432\u0430" }, bg: { name: "Bulgarian", nativeName: "\u0431\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438 \u0435\u0437\u0438\u043A" }, bi: { name: "Bislama", nativeName: "Bislama" }, bm: { name: "Bambara", nativeName: "bamanankan" }, bn: { name: "Bengali", nativeName: "\u09AC\u09BE\u0982\u09B2\u09BE" }, bo: { name: "Tibetan", nativeName: "\u0F56\u0F7C\u0F51\u0F0B\u0F61\u0F72\u0F42" }, br: { name: "Breton", nativeName: "brezhoneg" }, bs: { name: "Bosnian", nativeName: "bosanski jezik" }, ca: { name: "Catalan", nativeName: "Catal\xE0" }, ce: { name: "Chechen", nativeName: "\u043D\u043E\u0445\u0447\u0438\u0439\u043D \u043C\u043E\u0442\u0442" }, ch: { name: "Chamorro", nativeName: "Chamoru" }, co: { name: "Corsican", nativeName: "corsu" }, cr: { name: "Cree", nativeName: "\u14C0\u1426\u1403\u152D\u140D\u140F\u1423" }, cs: { name: "Czech", nativeName: "\u010De\u0161tina" }, cu: { name: "Old Church Slavonic", nativeName: "\u0469\u0437\u044B\u043A\u044A \u0441\u043B\u043E\u0432\u0463\u043D\u044C\u0441\u043A\u044A" }, cv: { name: "Chuvash", nativeName: "\u0447\u04D1\u0432\u0430\u0448 \u0447\u04D7\u043B\u0445\u0438" }, cy: { name: "Welsh", nativeName: "Cymraeg" }, da: { name: "Danish", nativeName: "Dansk" }, de: { name: "German", nativeName: "Deutsch" }, dv: { name: "Divehi", nativeName: "\u078B\u07A8\u0788\u07AC\u0780\u07A8" }, dz: { name: "Dzongkha", nativeName: "\u0F62\u0FAB\u0F7C\u0F44\u0F0B\u0F41" }, ee: { name: "Ewe", nativeName: "E\u028Begbe" }, el: { name: "Greek", nativeName: "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC" }, en: { name: "English", nativeName: "English" }, eo: { name: "Esperanto", nativeName: "Esperanto" }, es: { name: "Spanish", nativeName: "Espa\xF1ol" }, et: { name: "Estonian", nativeName: "eesti" }, eu: { name: "Basque", nativeName: "euskara" }, fa: { name: "Persian", nativeName: "\u0641\u0627\u0631\u0633\u06CC" }, ff: { name: "Fula", nativeName: "Fulfulde" }, fi: { name: "Finnish", nativeName: "suomi" }, fj: { name: "Fijian", nativeName: "vosa Vakaviti" }, fo: { name: "Faroese", nativeName: "F\xF8royskt" }, fr: { name: "French", nativeName: "Fran\xE7ais" }, fy: { name: "Western Frisian", nativeName: "Frysk" }, ga: { name: "Irish", nativeName: "Gaeilge" }, gd: { name: "Scottish Gaelic", nativeName: "G\xE0idhlig" }, gl: { name: "Galician", nativeName: "galego" }, gn: { name: "Guaran\xED", nativeName: "Ava\xF1e'\u1EBD" }, gu: { name: "Gujarati", nativeName: "\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0" }, gv: { name: "Manx", nativeName: "Gaelg" }, ha: { name: "Hausa", nativeName: "\u0647\u064E\u0648\u064F\u0633\u064E" }, he: { name: "Hebrew", nativeName: "\u05E2\u05D1\u05E8\u05D9\u05EA" }, hi: { name: "Hindi", nativeName: "\u0939\u093F\u0928\u094D\u0926\u0940" }, ho: { name: "Hiri Motu", nativeName: "Hiri Motu" }, hr: { name: "Croatian", nativeName: "Hrvatski" }, ht: { name: "Haitian", nativeName: "Krey\xF2l ayisyen" }, hu: { name: "Hungarian", nativeName: "magyar" }, hy: { name: "Armenian", nativeName: "\u0540\u0561\u0575\u0565\u0580\u0565\u0576" }, hz: { name: "Herero", nativeName: "Otjiherero" }, ia: { name: "Interlingua", nativeName: "Interlingua" }, id: { name: "Indonesian", nativeName: "Bahasa Indonesia" }, ie: { name: "Interlingue", nativeName: "Interlingue" }, ig: { name: "Igbo", nativeName: "As\u1EE5s\u1EE5 Igbo" }, ii: { name: "Nuosu", nativeName: "\uA188\uA320\uA4BF Nuosuhxop" }, ik: { name: "Inupiaq", nativeName: "I\xF1upiaq" }, io: { name: "Ido", nativeName: "Ido" }, is: { name: "Icelandic", nativeName: "\xCDslenska" }, it: { name: "Italian", nativeName: "Italiano" }, iu: { name: "Inuktitut", nativeName: "\u1403\u14C4\u1483\u144E\u1450\u1466" }, ja: { name: "Japanese", nativeName: "\u65E5\u672C\u8A9E" }, jv: { name: "Javanese", nativeName: "basa Jawa" }, ka: { name: "Georgian", nativeName: "\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8" }, kg: { name: "Kongo", nativeName: "Kikongo" }, ki: { name: "Kikuyu", nativeName: "G\u0129k\u0169y\u0169" }, kj: { name: "Kwanyama", nativeName: "Kuanyama" }, kk: { name: "Kazakh", nativeName: "\u049B\u0430\u0437\u0430\u049B \u0442\u0456\u043B\u0456" }, kl: { name: "Kalaallisut", nativeName: "kalaallisut" }, km: { name: "Khmer", nativeName: "\u1781\u17C1\u1798\u179A\u1797\u17B6\u179F\u17B6" }, kn: { name: "Kannada", nativeName: "\u0C95\u0CA8\u0CCD\u0CA8\u0CA1" }, ko: { name: "Korean", nativeName: "\uD55C\uAD6D\uC5B4" }, kr: { name: "Kanuri", nativeName: "Kanuri" }, ks: { name: "Kashmiri", nativeName: "\u0915\u0936\u094D\u092E\u0940\u0930\u0940" }, ku: { name: "Kurdish", nativeName: "Kurd\xEE" }, kv: { name: "Komi", nativeName: "\u043A\u043E\u043C\u0438 \u043A\u044B\u0432" }, kw: { name: "Cornish", nativeName: "Kernewek" }, ky: { name: "Kyrgyz", nativeName: "\u041A\u044B\u0440\u0433\u044B\u0437\u0447\u0430" }, la: { name: "Latin", nativeName: "latine" }, lb: { name: "Luxembourgish", nativeName: "L\xEBtzebuergesch" }, lg: { name: "Ganda", nativeName: "Luganda" }, li: { name: "Limburgish", nativeName: "Limburgs" }, ln: { name: "Lingala", nativeName: "Ling\xE1la" }, lo: { name: "Lao", nativeName: "\u0E9E\u0EB2\u0EAA\u0EB2\u0EA5\u0EB2\u0EA7" }, lt: { name: "Lithuanian", nativeName: "lietuvi\u0173 kalba" }, lu: { name: "Luba-Katanga", nativeName: "Kiluba" }, lv: { name: "Latvian", nativeName: "latvie\u0161u valoda" }, mg: { name: "Malagasy", nativeName: "fiteny malagasy" }, mh: { name: "Marshallese", nativeName: "Kajin M\u0327aje\u013C" }, mi: { name: "M\u0101ori", nativeName: "te reo M\u0101ori" }, mk: { name: "Macedonian", nativeName: "\u043C\u0430\u043A\u0435\u0434\u043E\u043D\u0441\u043A\u0438 \u0458\u0430\u0437\u0438\u043A" }, ml: { name: "Malayalam", nativeName: "\u0D2E\u0D32\u0D2F\u0D3E\u0D33\u0D02" }, mn: { name: "Mongolian", nativeName: "\u041C\u043E\u043D\u0433\u043E\u043B \u0445\u044D\u043B" }, mr: { name: "Marathi", nativeName: "\u092E\u0930\u093E\u0920\u0940" }, ms: { name: "Malay", nativeName: "Bahasa Melayu" }, mt: { name: "Maltese", nativeName: "Malti" }, my: { name: "Burmese", nativeName: "\u1017\u1019\u102C\u1005\u102C" }, na: { name: "Nauru", nativeName: "Dorerin Naoero" }, nb: { name: "Norwegian Bokm\xE5l", nativeName: "Norsk bokm\xE5l" }, nd: { name: "Northern Ndebele", nativeName: "isiNdebele" }, ne: { name: "Nepali", nativeName: "\u0928\u0947\u092A\u093E\u0932\u0940" }, ng: { name: "Ndonga", nativeName: "Owambo" }, nl: { name: "Dutch", nativeName: "Nederlands" }, nn: { name: "Norwegian Nynorsk", nativeName: "Norsk nynorsk" }, no: { name: "Norwegian", nativeName: "Norsk" }, nr: { name: "Southern Ndebele", nativeName: "isiNdebele" }, nv: { name: "Navajo", nativeName: "Din\xE9 bizaad" }, ny: { name: "Chichewa", nativeName: "chiChe\u0175a" }, oc: { name: "Occitan", nativeName: "occitan" }, oj: { name: "Ojibwe", nativeName: "\u140A\u14C2\u1511\u14C8\u142F\u14A7\u140E\u14D0" }, om: { name: "Oromo", nativeName: "Afaan Oromoo" }, or: { name: "Oriya", nativeName: "\u0B13\u0B21\u0B3C\u0B3F\u0B06" }, os: { name: "Ossetian", nativeName: "\u0438\u0440\u043E\u043D \xE6\u0432\u0437\u0430\u0433" }, pa: { name: "Panjabi", nativeName: "\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40" }, pi: { name: "P\u0101li", nativeName: "\u092A\u093E\u0934\u093F" }, pl: { name: "Polish", nativeName: "Polski" }, ps: { name: "Pashto", nativeName: "\u067E\u069A\u062A\u0648" }, pt: { name: "Portuguese", nativeName: "Portugu\xEAs" }, qu: { name: "Quechua", nativeName: "Runa Simi" }, rm: { name: "Romansh", nativeName: "rumantsch grischun" }, rn: { name: "Kirundi", nativeName: "Ikirundi" }, ro: { name: "Romanian", nativeName: "Rom\xE2n\u0103" }, ru: { name: "Russian", nativeName: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439" }, rw: { name: "Kinyarwanda", nativeName: "Ikinyarwanda" }, sa: { name: "Sanskrit", nativeName: "\u0938\u0902\u0938\u094D\u0915\u0943\u0924\u092E\u094D" }, sc: { name: "Sardinian", nativeName: "sardu" }, sd: { name: "Sindhi", nativeName: "\u0938\u093F\u0928\u094D\u0927\u0940" }, se: { name: "Northern Sami", nativeName: "Davvis\xE1megiella" }, sg: { name: "Sango", nativeName: "y\xE2ng\xE2 t\xEE s\xE4ng\xF6" }, si: { name: "Sinhala", nativeName: "\u0DC3\u0DD2\u0D82\u0DC4\u0DBD" }, sk: { name: "Slovak", nativeName: "sloven\u010Dina" }, sl: { name: "Slovenian", nativeName: "sloven\u0161\u010Dina" }, sm: { name: "Samoan", nativeName: "gagana fa'a Samoa" }, sn: { name: "Shona", nativeName: "chiShona" }, so: { name: "Somali", nativeName: "Soomaaliga" }, sq: { name: "Albanian", nativeName: "Shqip" }, sr: { name: "Serbian", nativeName: "\u0441\u0440\u043F\u0441\u043A\u0438 \u0458\u0435\u0437\u0438\u043A" }, ss: { name: "Swati", nativeName: "SiSwati" }, st: { name: "Southern Sotho", nativeName: "Sesotho" }, su: { name: "Sundanese", nativeName: "Basa Sunda" }, sv: { name: "Swedish", nativeName: "Svenska" }, sw: { name: "Swahili", nativeName: "Kiswahili" }, ta: { name: "Tamil", nativeName: "\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD" }, te: { name: "Telugu", nativeName: "\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41" }, tg: { name: "Tajik", nativeName: "\u0442\u043E\u04B7\u0438\u043A\u04E3" }, th: { name: "Thai", nativeName: "\u0E44\u0E17\u0E22" }, ti: { name: "Tigrinya", nativeName: "\u1275\u130D\u122D\u129B" }, tk: { name: "Turkmen", nativeName: "T\xFCrkmen\xE7e" }, tl: { name: "Tagalog", nativeName: "Wikang Tagalog" }, tn: { name: "Tswana", nativeName: "Setswana" }, to: { name: "Tonga", nativeName: "faka Tonga" }, tr: { name: "Turkish", nativeName: "T\xFCrk\xE7e" }, ts: { name: "Tsonga", nativeName: "Xitsonga" }, tt: { name: "Tatar", nativeName: "\u0442\u0430\u0442\u0430\u0440 \u0442\u0435\u043B\u0435" }, tw: { name: "Twi", nativeName: "Twi" }, ty: { name: "Tahitian", nativeName: "Reo Tahiti" }, ug: { name: "Uyghur", nativeName: "\u0626\u06C7\u064A\u063A\u06C7\u0631\u0686\u06D5\u200E" }, uk: { name: "Ukrainian", nativeName: "\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430" }, ur: { name: "Urdu", nativeName: "\u0627\u0631\u062F\u0648" }, uz: { name: "Uzbek", nativeName: "\u040E\u0437\u0431\u0435\u043A" }, ve: { name: "Venda", nativeName: "Tshiven\u1E13a" }, vi: { name: "Vietnamese", nativeName: "Ti\u1EBFng Vi\u1EC7t" }, vo: { name: "Volap\xFCk", nativeName: "Volap\xFCk" }, wa: { name: "Walloon", nativeName: "walon" }, wo: { name: "Wolof", nativeName: "Wollof" }, xh: { name: "Xhosa", nativeName: "isiXhosa" }, yi: { name: "Yiddish", nativeName: "\u05D9\u05D9\u05B4\u05D3\u05D9\u05E9" }, yo: { name: "Yoruba", nativeName: "Yor\xF9b\xE1" }, za: { name: "Zhuang", nativeName: "Sa\u026F cue\u014B\u0185" }, zh: { name: "Chinese", nativeName: "\u4E2D\u6587" }, zu: { name: "Zulu", nativeName: "isiZulu" } }; module2.exports = LANGUAGES_LIST; } }); // node_modules/iso-639-1/src/index.js var require_src = __commonJS({ "node_modules/iso-639-1/src/index.js"(exports2, module2) { var LANGUAGES_LIST = require_data(); var LANGUAGES = {}; var LANGUAGES_BY_NAME = {}; var LANGUAGE_CODES = []; var LANGUAGE_NAMES = []; var LANGUAGE_NATIVE_NAMES = []; for (const code in LANGUAGES_LIST) { const { name, nativeName } = LANGUAGES_LIST[code]; LANGUAGES[code] = LANGUAGES_BY_NAME[name.toLowerCase()] = LANGUAGES_BY_NAME[nativeName.toLowerCase()] = { code, name, nativeName }; LANGUAGE_CODES.push(code); LANGUAGE_NAMES.push(name); LANGUAGE_NATIVE_NAMES.push(nativeName); } module2.exports = class ISO63912 { static getLanguages(codes = []) { return codes.map( (code) => ISO63912.validate(code) ? Object.assign({}, LANGUAGES[code]) : { code, name: "", nativeName: "" } ); } static getName(code) { return ISO63912.validate(code) ? LANGUAGES_LIST[code].name : ""; } static getAllNames() { return LANGUAGE_NAMES.slice(); } static getNativeName(code) { return ISO63912.validate(code) ? LANGUAGES_LIST[code].nativeName : ""; } static getAllNativeNames() { return LANGUAGE_NATIVE_NAMES.slice(); } static getCode(name) { name = name.toLowerCase(); return LANGUAGES_BY_NAME.hasOwnProperty(name) ? LANGUAGES_BY_NAME[name].code : ""; } static getAllCodes() { return LANGUAGE_CODES.slice(); } static validate(code) { return LANGUAGES_LIST.hasOwnProperty(code); } }; } }); // node_modules/commander/lib/error.js var require_error = __commonJS({ "node_modules/commander/lib/error.js"(exports2) { var CommanderError2 = class extends Error { /** * Constructs the CommanderError class * @param {number} exitCode suggested exit code which could be used with process.exit * @param {string} code an id string representing the error * @param {string} message human-readable description of the error */ constructor(exitCode, code, message) { super(message); Error.captureStackTrace(this, this.constructor); this.name = this.constructor.name; this.code = code; this.exitCode = exitCode; this.nestedError = void 0; } }; var InvalidArgumentError2 = class extends CommanderError2 { /** * Constructs the InvalidArgumentError class * @param {string} [message] explanation of why argument is invalid */ constructor(message) { super(1, "commander.invalidArgument", message); Error.captureStackTrace(this, this.constructor); this.name = this.constructor.name; } }; exports2.CommanderError = CommanderError2; exports2.InvalidArgumentError = InvalidArgumentError2; } }); // node_modules/commander/lib/argument.js var require_argument = __commonJS({ "node_modules/commander/lib/argument.js"(exports2) { var { InvalidArgumentError: InvalidArgumentError2 } = require_error(); var Argument2 = class { /** * Initialize a new command argument with the given name and description. * The default is that the argument is required, and you can explicitly * indicate this with <> around the name. Put [] around the name for an optional argument. * * @param {string} name * @param {string} [description] */ constructor(name, description) { this.description = description || ""; this.variadic = false; this.parseArg = void 0; this.defaultValue = void 0; this.defaultValueDescription = void 0; this.argChoices = void 0; switch (name[0]) { case "<": this.required = true; this._name = name.slice(1, -1); break; case "[": this.required = false; this._name = name.slice(1, -1); break; default: this.required = true; this._name = name; break; } if (this._name.length > 3 && this._name.slice(-3) === "...") { this.variadic = true; this._name = this._name.slice(0, -3); } } /** * Return argument name. * * @return {string} */ name() { return this._name; } /** * @package */ _concatValue(value, previous) { if (previous === this.defaultValue || !Array.isArray(previous)) { return [value]; } return previous.concat(value); } /** * Set the default value, and optionally supply the description to be displayed in the help. * * @param {*} value * @param {string} [description] * @return {Argument} */ default(value, description) { this.defaultValue = value; this.defaultValueDescription = description; return this; } /** * Set the custom handler for processing CLI command arguments into argument values. * * @param {Function} [fn] * @return {Argument} */ argParser(fn) { this.parseArg = fn; return this; } /** * Only allow argument value to be one of choices. * * @param {string[]} values * @return {Argument} */ choices(values) { this.argChoices = values.slice(); this.parseArg = (arg, previous) => { if (!this.argChoices.includes(arg)) { throw new InvalidArgumentError2( `Allowed choices are ${this.argChoices.join(", ")}.` ); } if (this.variadic) { return this._concatValue(arg, previous); } return arg; }; return this; } /** * Make argument required. * * @returns {Argument} */ argRequired() { this.required = true; return this; } /** * Make argument optional. * * @returns {Argument} */ argOptional() { this.required = false; return this; } }; function humanReadableArgName(arg) { const nameOutput = arg.name() + (arg.variadic === true ? "..." : ""); return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]"; } exports2.Argument = Argument2; exports2.humanReadableArgName = humanReadableArgName; } }); // node_modules/commander/lib/help.js var require_help = __commonJS({ "node_modules/commander/lib/help.js"(exports2) { var { humanReadableArgName } = require_argument(); var Help2 = class { constructor() { this.helpWidth = void 0; this.minWidthToWrap = 40; this.sortSubcommands = false; this.sortOptions = false; this.showGlobalOptions = false; } /** * prepareContext is called by Commander after applying overrides from `Command.configureHelp()` * and just before calling `formatHelp()`. * * Commander just uses the helpWidth and the rest is provided for optional use by more complex subclasses. * * @param {{ error?: boolean, helpWidth?: number, outputHasColors?: boolean }} contextOptions */ prepareContext(contextOptions) { this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80; } /** * Get an array of the visible subcommands. Includes a placeholder for the implicit help command, if there is one. * * @param {Command} cmd * @returns {Command[]} */ visibleCommands(cmd) { const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden); const helpCommand = cmd._getHelpCommand(); if (helpCommand && !helpCommand._hidden) { visibleCommands.push(helpCommand); } if (this.sortSubcommands) { visibleCommands.sort((a2, b2) => { return a2.name().localeCompare(b2.name()); }); } return visibleCommands; } /** * Compare options for sort. * * @param {Option} a * @param {Option} b * @returns {number} */ compareOptions(a2, b2) { const getSortKey = (option) => { return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, ""); }; return getSortKey(a2).localeCompare(getSortKey(b2)); } /** * Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one. * * @param {Command} cmd * @returns {Option[]} */ visibleOptions(cmd) { const visibleOptions = cmd.options.filter((option) => !option.hidden); const helpOption = cmd._getHelpOption(); if (helpOption && !helpOption.hidden) { const removeShort = helpOption.short && cmd._findOption(helpOption.short); const removeLong = helpOption.long && cmd._findOption(helpOption.long); if (!removeShort && !removeLong) { visibleOptions.push(helpOption); } else if (helpOption.long && !removeLong) { visibleOptions.push( cmd.createOption(helpOption.long, helpOption.description) ); } else if (helpOption.short && !removeShort) { visibleOptions.push( cmd.createOption(helpOption.short, helpOption.description) ); } } if (this.sortOptions) { visibleOptions.sort(this.compareOptions); } return visibleOptions; } /** * Get an array of the visible global options. (Not including help.) * * @param {Command} cmd * @returns {Option[]} */ visibleGlobalOptions(cmd) { if (!this.showGlobalOptions) return []; const globalOptions = []; for (let ancestorCmd = cmd.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) { const visibleOptions = ancestorCmd.options.filter( (option) => !option.hidden ); globalOptions.push(...visibleOptions); } if (this.sortOptions) { globalOptions.sort(this.compareOptions); } return globalOptions; } /** * Get an array of the arguments if any have a description. * * @param {Command} cmd * @returns {Argument[]} */ visibleArguments(cmd) { if (cmd._argsDescription) { cmd.registeredArguments.forEach((argument) => { argument.description = argument.description || cmd._argsDescription[argument.name()] || ""; }); } if (cmd.registeredArguments.find((argument) => argument.description)) { return cmd.registeredArguments; } return []; } /** * Get the command term to show in the list of subcommands. * * @param {Command} cmd * @returns {string} */ subcommandTerm(cmd) { const args = cmd.registeredArguments.map((arg) => humanReadableArgName(arg)).join(" "); return cmd._name + (cmd._aliases[0] ? "|" + cmd._aliases[0] : "") + (cmd.options.length ? " [options]" : "") + // simplistic check for non-help option (args ? " " + args : ""); } /** * Get the option term to show in the list of options. * * @param {Option} option * @returns {string} */ optionTerm(option) { return option.flags; } /** * Get the argument term to show in the list of arguments. * * @param {Argument} argument * @returns {string} */ argumentTerm(argument) { return argument.name(); } /** * Get the longest command term length. * * @param {Command} cmd * @param {Help} helper * @returns {number} */ longestSubcommandTermLength(cmd, helper) { return helper.visibleCommands(cmd).reduce((max, command) => { return Math.max( max, this.displayWidth( helper.styleSubcommandTerm(helper.subcommandTerm(command)) ) ); }, 0); } /** * Get the longest option term length. * * @param {Command} cmd * @param {Help} helper * @returns {number} */ longestOptionTermLength(cmd, helper) { return helper.visibleOptions(cmd).reduce((max, option) => { return Math.max( max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))) ); }, 0); } /** * Get the longest global option term length. * * @param {Command} cmd * @param {Help} helper * @returns {number} */ longestGlobalOptionTermLength(cmd, helper) { return helper.visibleGlobalOptions(cmd).reduce((max, option) => { return Math.max( max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))) ); }, 0); } /** * Get the longest argument term length. * * @param {Command} cmd * @param {Help} helper * @returns {number} */ longestArgumentTermLength(cmd, helper) { return helper.visibleArguments(cmd).reduce((max, argument) => { return Math.max( max, this.displayWidth( helper.styleArgumentTerm(helper.argumentTerm(argument)) ) ); }, 0); } /** * Get the command usage to be displayed at the top of the built-in help. * * @param {Command} cmd * @returns {string} */ commandUsage(cmd) { let cmdName = cmd._name; if (cmd._aliases[0]) { cmdName = cmdName + "|" + cmd._aliases[0]; } let ancestorCmdNames = ""; for (let ancestorCmd = cmd.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) { ancestorCmdNames = ancestorCmd.name() + " " + ancestorCmdNames; } return ancestorCmdNames + cmdName + " " + cmd.usage(); } /** * Get the description for the command. * * @param {Command} cmd * @returns {string} */ commandDescription(cmd) { return cmd.description(); } /** * Get the subcommand summary to show in the list of subcommands. * (Fallback to description for backwards compatibility.) * * @param {Command} cmd * @returns {string} */ subcommandDescription(cmd) { return cmd.summary() || cmd.description(); } /** * Get the option description to show in the list of options. * * @param {Option} option * @return {string} */ optionDescription(option) { const extraInfo = []; if (option.argChoices) { extraInfo.push( // use stringify to match the display of the default value `choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}` ); } if (option.defaultValue !== void 0) { const showDefault = option.required || option.optional || option.isBoolean() && typeof option.defaultValue === "boolean"; if (showDefault) { extraInfo.push( `default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}` ); } } if (option.presetArg !== void 0 && option.optional) { extraInfo.push(`preset: ${JSON.stringify(option.presetArg)}`); } if (option.envVar !== void 0) { extraInfo.push(`env: ${option.envVar}`); } if (extraInfo.length > 0) { return `${option.description} (${extraInfo.join(", ")})`; } return option.description; } /** * Get the argument description to show in the list of arguments. * * @param {Argument} argument * @return {string} */ argumentDescription(argument) { const extraInfo = []; if (argument.argChoices) { extraInfo.push( // use stringify to match the display of the default value `choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}` ); } if (argument.defaultValue !== void 0) { extraInfo.push( `default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}` ); } if (extraInfo.length > 0) { const extraDescription = `(${extraInfo.join(", ")})`; if (argument.description) { return `${argument.description} ${extraDescription}`; } return extraDescription; } return argument.description; } /** * Generate the built-in help text. * * @param {Command} cmd * @param {Help} helper * @returns {string} */ formatHelp(cmd, helper) { const termWidth = helper.padWidth(cmd, helper); const helpWidth = helper.helpWidth ?? 80; function callFormatItem(term, description) { return helper.formatItem(term, termWidth, description, helper); } let output = [ `${helper.styleTitle("Usage:")} ${helper.styleUsage(helper.commandUsage(cmd))}`, "" ]; const commandDescription = helper.commandDescription(cmd); if (commandDescription.length > 0) { output = output.concat([ helper.boxWrap( helper.styleCommandDescription(commandDescription), helpWidth ), "" ]); } const argumentList = helper.visibleArguments(cmd).map((argument) => { return callFormatItem( helper.styleArgumentTerm(helper.argumentTerm(argument)), helper.styleArgumentDescription(helper.argumentDescription(argument)) ); }); if (argumentList.length > 0) { output = output.concat([ helper.styleTitle("Arguments:"), ...argumentList, "" ]); } const optionList = helper.visibleOptions(cmd).map((option) => { return callFormatItem( helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)) ); }); if (optionList.length > 0) { output = output.concat([ helper.styleTitle("Options:"), ...optionList, "" ]); } if (helper.showGlobalOptions) { const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => { return callFormatItem( helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)) ); }); if (globalOptionList.length > 0) { output = output.concat([ helper.styleTitle("Global Options:"), ...globalOptionList, "" ]); } } const commandList = helper.visibleCommands(cmd).map((cmd2) => { return callFormatItem( helper.styleSubcommandTerm(helper.subcommandTerm(cmd2)), helper.styleSubcommandDescription(helper.subcommandDescription(cmd2)) ); }); if (commandList.length > 0) { output = output.concat([ helper.styleTitle("Commands:"), ...command