lingo.dev 0.115.0 → 0.116.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/cli.cjs CHANGED
@@ -1,4 +1,8 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6;// src/cli/index.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6;
2
+
3
+ var _chunkZZGWAPLZcjs = require('./chunk-ZZGWAPLZ.cjs');
4
+
5
+ // src/cli/index.ts
2
6
  var _dotenv = require('dotenv'); var _dotenv2 = _interopRequireDefault(_dotenv);
3
7
  var _interactivecommander = require('interactive-commander');
4
8
  var _figlet = require('figlet'); var _figlet2 = _interopRequireDefault(_figlet);
@@ -203,6 +207,9 @@ var docLinks = {
203
207
  bucketNotFound: "https://lingo.dev/cli",
204
208
  authError: "https://lingo.dev/cli",
205
209
  localeTargetNotFound: "https://lingo.dev/cli",
210
+ // corrected key (previously misspelled as "lockFiletNotFound")
211
+ lockFileNotFound: "https://lingo.dev/cli",
212
+ // legacy alias for backward compatibility
206
213
  lockFiletNotFound: "https://lingo.dev/cli",
207
214
  failedReplexicaEngine: "https://lingo.dev/cli",
208
215
  placeHolderFailed: "https://lingo.dev/cli",
@@ -210,6 +217,9 @@ var docLinks = {
210
217
  connectionFailed: "https://lingo.dev/cli",
211
218
  invalidType: "https://lingo.dev/cli",
212
219
  invalidPathPattern: "https://lingo.dev/cli",
220
+ // corrected key (previously misspelled as "androidResouceError")
221
+ androidResourceError: "https://lingo.dev/cli",
222
+ // legacy alias for backward compatibility
213
223
  androidResouceError: "https://lingo.dev/cli",
214
224
  invalidBucketType: "https://lingo.dev/cli",
215
225
  invalidStringDict: "https://lingo.dev/cli"
@@ -2154,7 +2164,7 @@ function _isMetadataKey(key) {
2154
2164
  // src/cli/loaders/android.ts
2155
2165
  var _module = require('module');
2156
2166
  var _xml2js = require('xml2js');
2157
- var require2 = _module.createRequire.call(void 0, import.meta.url);
2167
+ var require2 = _module.createRequire.call(void 0, _chunkZZGWAPLZcjs.importMetaUrl);
2158
2168
  var sax = require2("sax");
2159
2169
  var defaultAndroidResourcesXml = `<?xml version="1.0" encoding="utf-8"?>
2160
2170
  <resources>
@@ -2172,7 +2182,7 @@ function createAndroidLoader() {
2172
2182
  console.error("Error parsing Android resource file:", error);
2173
2183
  throw new CLIError({
2174
2184
  message: "Failed to parse Android resource file",
2175
- docUrl: "androidResouceError"
2185
+ docUrl: "androidResourceError"
2176
2186
  });
2177
2187
  }
2178
2188
  },
@@ -2198,7 +2208,7 @@ function createAndroidLoader() {
2198
2208
  console.error("Error generating Android resource file:", error);
2199
2209
  throw new CLIError({
2200
2210
  message: "Failed to generate Android resource file",
2201
- docUrl: "androidResouceError"
2211
+ docUrl: "androidResourceError"
2202
2212
  });
2203
2213
  }
2204
2214
  }
@@ -2670,7 +2680,7 @@ function asString(value, name) {
2670
2680
  }
2671
2681
  throw new CLIError({
2672
2682
  message: `Expected string value for resource "${name}"`,
2673
- docUrl: "androidResouceError"
2683
+ docUrl: "androidResourceError"
2674
2684
  });
2675
2685
  }
2676
2686
  function asStringArray(value, name) {
@@ -2679,7 +2689,7 @@ function asStringArray(value, name) {
2679
2689
  }
2680
2690
  throw new CLIError({
2681
2691
  message: `Expected array of strings for resource "${name}"`,
2682
- docUrl: "androidResouceError"
2692
+ docUrl: "androidResourceError"
2683
2693
  });
2684
2694
  }
2685
2695
  function asPluralMap(value, name) {
@@ -2689,7 +2699,7 @@ function asPluralMap(value, name) {
2689
2699
  if (typeof pluralValue !== "string") {
2690
2700
  throw new CLIError({
2691
2701
  message: `Expected plural item "${quantity}" of "${name}" to be a string`,
2692
- docUrl: "androidResouceError"
2702
+ docUrl: "androidResourceError"
2693
2703
  });
2694
2704
  }
2695
2705
  result[quantity] = pluralValue;
@@ -2698,7 +2708,7 @@ function asPluralMap(value, name) {
2698
2708
  }
2699
2709
  throw new CLIError({
2700
2710
  message: `Expected object value for plurals resource "${name}"`,
2701
- docUrl: "androidResouceError"
2711
+ docUrl: "androidResourceError"
2702
2712
  });
2703
2713
  }
2704
2714
  function asBoolean(value, name) {
@@ -2712,7 +2722,7 @@ function asBoolean(value, name) {
2712
2722
  }
2713
2723
  throw new CLIError({
2714
2724
  message: `Expected boolean value for resource "${name}"`,
2715
- docUrl: "androidResouceError"
2725
+ docUrl: "androidResourceError"
2716
2726
  });
2717
2727
  }
2718
2728
  function asInteger(value, name) {
@@ -2721,7 +2731,7 @@ function asInteger(value, name) {
2721
2731
  }
2722
2732
  throw new CLIError({
2723
2733
  message: `Expected number value for resource "${name}"`,
2724
- docUrl: "androidResouceError"
2734
+ docUrl: "androidResourceError"
2725
2735
  });
2726
2736
  }
2727
2737
  function escapeAndroidString(value) {
@@ -3072,7 +3082,7 @@ function inferTypeFromValue(value) {
3072
3082
  }
3073
3083
  throw new CLIError({
3074
3084
  message: "Unable to infer Android resource type from payload",
3075
- docUrl: "androidResouceError"
3085
+ docUrl: "androidResourceError"
3076
3086
  });
3077
3087
  }
3078
3088
  function extractResourceMetadata(xml) {
@@ -4044,6 +4054,11 @@ function createXcodeXcstringsLoader(defaultLocale) {
4044
4054
  if (langTranslationEntity) {
4045
4055
  if ("stringUnit" in langTranslationEntity) {
4046
4056
  resultData[translationKey] = langTranslationEntity.stringUnit.value;
4057
+ } else if ("stringSet" in langTranslationEntity) {
4058
+ const values = langTranslationEntity.stringSet.values;
4059
+ if (Array.isArray(values) && values.length > 0) {
4060
+ resultData[translationKey] = values;
4061
+ }
4047
4062
  } else if ("variations" in langTranslationEntity) {
4048
4063
  if ("plural" in langTranslationEntity.variations) {
4049
4064
  resultData[translationKey] = {};
@@ -4088,6 +4103,21 @@ function createXcodeXcstringsLoader(defaultLocale) {
4088
4103
  if (hasDoNotTranslateFlag) {
4089
4104
  langDataToMerge.strings[key].shouldTranslate = false;
4090
4105
  }
4106
+ } else if (Array.isArray(value)) {
4107
+ langDataToMerge.strings[key] = {
4108
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _182 => _182.strings, 'optionalAccess', _183 => _183[key], 'optionalAccess', _184 => _184.extractionState]),
4109
+ localizations: {
4110
+ [locale]: {
4111
+ stringSet: {
4112
+ state: "translated",
4113
+ values: value
4114
+ }
4115
+ }
4116
+ }
4117
+ };
4118
+ if (hasDoNotTranslateFlag) {
4119
+ langDataToMerge.strings[key].shouldTranslate = false;
4120
+ }
4091
4121
  } else {
4092
4122
  const updatedVariations = {};
4093
4123
  for (const form in value) {
@@ -4133,7 +4163,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4133
4163
  for (const [locale, localization] of Object.entries(
4134
4164
  entity.localizations
4135
4165
  )) {
4136
- if (_optionalChain([localization, 'access', _182 => _182.variations, 'optionalAccess', _183 => _183.plural])) {
4166
+ if (_optionalChain([localization, 'access', _185 => _185.variations, 'optionalAccess', _186 => _186.plural])) {
4137
4167
  const pluralForms = localization.variations.plural;
4138
4168
  for (const form in pluralForms) {
4139
4169
  const pluralKey = `${translationKey}/${form}`;
@@ -4153,7 +4183,7 @@ function _removeLocale(input2, locale) {
4153
4183
  const { strings } = input2;
4154
4184
  const newStrings = _lodash2.default.cloneDeep(strings);
4155
4185
  for (const [key, value] of Object.entries(newStrings)) {
4156
- if (_optionalChain([value, 'access', _184 => _184.localizations, 'optionalAccess', _185 => _185[locale]])) {
4186
+ if (_optionalChain([value, 'access', _187 => _187.localizations, 'optionalAccess', _188 => _188[locale]])) {
4157
4187
  delete value.localizations[locale];
4158
4188
  }
4159
4189
  }
@@ -4345,14 +4375,14 @@ function pluralWithMetaToXcstrings(data) {
4345
4375
  if (element.type === "literal") {
4346
4376
  text += element.value;
4347
4377
  } else if (element.type === "pound") {
4348
- const pluralVar = Object.entries(_optionalChain([data, 'access', _186 => _186._meta, 'optionalAccess', _187 => _187.variables]) || {}).find(
4378
+ const pluralVar = Object.entries(_optionalChain([data, 'access', _189 => _189._meta, 'optionalAccess', _190 => _190.variables]) || {}).find(
4349
4379
  ([_36, meta]) => meta.role === "plural"
4350
4380
  );
4351
- text += _optionalChain([pluralVar, 'optionalAccess', _188 => _188[1], 'access', _189 => _189.format]) || "%lld";
4381
+ text += _optionalChain([pluralVar, 'optionalAccess', _191 => _191[1], 'access', _192 => _192.format]) || "%lld";
4352
4382
  } else if (element.type === "argument") {
4353
4383
  const varName = element.value;
4354
- const varMeta = _optionalChain([data, 'access', _190 => _190._meta, 'optionalAccess', _191 => _191.variables, 'optionalAccess', _192 => _192[varName]]);
4355
- text += _optionalChain([varMeta, 'optionalAccess', _193 => _193.format]) || "%@";
4384
+ const varMeta = _optionalChain([data, 'access', _193 => _193._meta, 'optionalAccess', _194 => _194.variables, 'optionalAccess', _195 => _195[varName]]);
4385
+ text += _optionalChain([varMeta, 'optionalAccess', _196 => _196.format]) || "%@";
4356
4386
  }
4357
4387
  }
4358
4388
  let xcstringsFormName = form;
@@ -4730,8 +4760,8 @@ async function formatDataWithBiome(data, filePath, options) {
4730
4760
  });
4731
4761
  return formatted.content;
4732
4762
  } catch (error) {
4733
- const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _194 => _194.stackTrace, 'optionalAccess', _195 => _195.toString, 'call', _196 => _196(), 'access', _197 => _197.split, 'call', _198 => _198("\n"), 'access', _199 => _199[0]]) : "";
4734
- if (_optionalChain([errorMessage, 'optionalAccess', _200 => _200.includes, 'call', _201 => _201("does not exist in the workspace")])) {
4763
+ const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _197 => _197.stackTrace, 'optionalAccess', _198 => _198.toString, 'call', _199 => _199(), 'access', _200 => _200.split, 'call', _201 => _201("\n"), 'access', _202 => _202[0]]) : "";
4764
+ if (_optionalChain([errorMessage, 'optionalAccess', _203 => _203.includes, 'call', _204 => _204("does not exist in the workspace")])) {
4735
4765
  } else {
4736
4766
  console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
4737
4767
  if (errorMessage) {
@@ -4778,7 +4808,7 @@ function createPoDataLoader(params) {
4778
4808
  Object.entries(entries).forEach(([msgid, entry]) => {
4779
4809
  if (msgid && entry.msgid) {
4780
4810
  const context = entry.msgctxt || "";
4781
- const fullEntry = _optionalChain([parsedPo, 'access', _202 => _202.translations, 'access', _203 => _203[context], 'optionalAccess', _204 => _204[msgid]]);
4811
+ const fullEntry = _optionalChain([parsedPo, 'access', _205 => _205.translations, 'access', _206 => _206[context], 'optionalAccess', _207 => _207[msgid]]);
4782
4812
  if (fullEntry) {
4783
4813
  result[msgid] = fullEntry;
4784
4814
  }
@@ -4788,8 +4818,8 @@ function createPoDataLoader(params) {
4788
4818
  return result;
4789
4819
  },
4790
4820
  async push(locale, data, originalInput, originalLocale, pullInput) {
4791
- const currentSections = _optionalChain([pullInput, 'optionalAccess', _205 => _205.split, 'call', _206 => _206("\n\n"), 'access', _207 => _207.filter, 'call', _208 => _208(Boolean)]) || [];
4792
- const originalSections = _optionalChain([originalInput, 'optionalAccess', _209 => _209.split, 'call', _210 => _210("\n\n"), 'access', _211 => _211.filter, 'call', _212 => _212(Boolean)]) || [];
4821
+ const currentSections = _optionalChain([pullInput, 'optionalAccess', _208 => _208.split, 'call', _209 => _209("\n\n"), 'access', _210 => _210.filter, 'call', _211 => _211(Boolean)]) || [];
4822
+ const originalSections = _optionalChain([originalInput, 'optionalAccess', _212 => _212.split, 'call', _213 => _213("\n\n"), 'access', _214 => _214.filter, 'call', _215 => _215(Boolean)]) || [];
4793
4823
  const result = originalSections.map((section) => {
4794
4824
  const sectionPo = _gettextparser2.default.po.parse(section);
4795
4825
  if (Object.keys(sectionPo.translations).length === 0) {
@@ -4858,8 +4888,8 @@ function createPoContentLoader() {
4858
4888
  {
4859
4889
  ...entry,
4860
4890
  msgstr: [
4861
- _optionalChain([data, 'access', _213 => _213[entry.msgid], 'optionalAccess', _214 => _214.singular]),
4862
- _optionalChain([data, 'access', _215 => _215[entry.msgid], 'optionalAccess', _216 => _216.plural]) || null
4891
+ _optionalChain([data, 'access', _216 => _216[entry.msgid], 'optionalAccess', _217 => _217.singular]),
4892
+ _optionalChain([data, 'access', _218 => _218[entry.msgid], 'optionalAccess', _219 => _219.plural]) || null
4863
4893
  ].filter(Boolean)
4864
4894
  }
4865
4895
  ]).fromPairs().value();
@@ -4981,7 +5011,7 @@ function pullV1(xliffElement, locale, originalLocale) {
4981
5011
  let key = getTransUnitKey(unit);
4982
5012
  if (!key) return;
4983
5013
  if (seenKeys.has(key)) {
4984
- const id = _optionalChain([unit, 'access', _217 => _217.getAttribute, 'call', _218 => _218("id"), 'optionalAccess', _219 => _219.trim, 'call', _220 => _220()]);
5014
+ const id = _optionalChain([unit, 'access', _220 => _220.getAttribute, 'call', _221 => _221("id"), 'optionalAccess', _222 => _222.trim, 'call', _223 => _223()]);
4985
5015
  if (id) {
4986
5016
  key = `${key}#${id}`;
4987
5017
  } else {
@@ -5029,7 +5059,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
5029
5059
  let key = getTransUnitKey(unit);
5030
5060
  if (!key) return;
5031
5061
  if (seenKeys.has(key)) {
5032
- const id = _optionalChain([unit, 'access', _221 => _221.getAttribute, 'call', _222 => _222("id"), 'optionalAccess', _223 => _223.trim, 'call', _224 => _224()]);
5062
+ const id = _optionalChain([unit, 'access', _224 => _224.getAttribute, 'call', _225 => _225("id"), 'optionalAccess', _226 => _226.trim, 'call', _227 => _227()]);
5033
5063
  if (id) {
5034
5064
  key = `${key}#${id}`;
5035
5065
  } else {
@@ -5071,7 +5101,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
5071
5101
  const translationKeys = new Set(Object.keys(translations));
5072
5102
  existingUnits.forEach((unit, key) => {
5073
5103
  if (!translationKeys.has(key)) {
5074
- _optionalChain([unit, 'access', _225 => _225.parentNode, 'optionalAccess', _226 => _226.removeChild, 'call', _227 => _227(unit)]);
5104
+ _optionalChain([unit, 'access', _228 => _228.parentNode, 'optionalAccess', _229 => _229.removeChild, 'call', _230 => _230(unit)]);
5075
5105
  }
5076
5106
  });
5077
5107
  return serializeWithDeclaration(
@@ -5114,18 +5144,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
5114
5144
  Array.from(container.children).forEach((child) => {
5115
5145
  const tagName = child.tagName;
5116
5146
  if (tagName === "unit") {
5117
- const unitId = _optionalChain([child, 'access', _228 => _228.getAttribute, 'call', _229 => _229("id"), 'optionalAccess', _230 => _230.trim, 'call', _231 => _231()]);
5147
+ const unitId = _optionalChain([child, 'access', _231 => _231.getAttribute, 'call', _232 => _232("id"), 'optionalAccess', _233 => _233.trim, 'call', _234 => _234()]);
5118
5148
  if (!unitId) return;
5119
5149
  const key = `resources/${fileId}/${currentPath}${unitId}/source`;
5120
5150
  const segment = child.querySelector("segment");
5121
- const source = _optionalChain([segment, 'optionalAccess', _232 => _232.querySelector, 'call', _233 => _233("source")]);
5151
+ const source = _optionalChain([segment, 'optionalAccess', _235 => _235.querySelector, 'call', _236 => _236("source")]);
5122
5152
  if (source) {
5123
5153
  result[key] = extractTextContent(source);
5124
5154
  } else {
5125
5155
  result[key] = unitId;
5126
5156
  }
5127
5157
  } else if (tagName === "group") {
5128
- const groupId = _optionalChain([child, 'access', _234 => _234.getAttribute, 'call', _235 => _235("id"), 'optionalAccess', _236 => _236.trim, 'call', _237 => _237()]);
5158
+ const groupId = _optionalChain([child, 'access', _237 => _237.getAttribute, 'call', _238 => _238("id"), 'optionalAccess', _239 => _239.trim, 'call', _240 => _240()]);
5129
5159
  const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
5130
5160
  traverseUnitsV2(child, fileId, newPath, result);
5131
5161
  }
@@ -5161,12 +5191,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
5161
5191
  Array.from(container.children).forEach((child) => {
5162
5192
  const tagName = child.tagName;
5163
5193
  if (tagName === "unit") {
5164
- const unitId = _optionalChain([child, 'access', _238 => _238.getAttribute, 'call', _239 => _239("id"), 'optionalAccess', _240 => _240.trim, 'call', _241 => _241()]);
5194
+ const unitId = _optionalChain([child, 'access', _241 => _241.getAttribute, 'call', _242 => _242("id"), 'optionalAccess', _243 => _243.trim, 'call', _244 => _244()]);
5165
5195
  if (!unitId) return;
5166
5196
  const key = `resources/${fileId}/${currentPath}${unitId}/source`;
5167
5197
  index.set(key, child);
5168
5198
  } else if (tagName === "group") {
5169
- const groupId = _optionalChain([child, 'access', _242 => _242.getAttribute, 'call', _243 => _243("id"), 'optionalAccess', _244 => _244.trim, 'call', _245 => _245()]);
5199
+ const groupId = _optionalChain([child, 'access', _245 => _245.getAttribute, 'call', _246 => _246("id"), 'optionalAccess', _247 => _247.trim, 'call', _248 => _248()]);
5170
5200
  const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
5171
5201
  indexUnitsV2(child, fileId, newPath, index);
5172
5202
  }
@@ -5187,9 +5217,9 @@ function updateUnitV2(unit, value) {
5187
5217
  setTextContent(source, value);
5188
5218
  }
5189
5219
  function getTransUnitKey(transUnit) {
5190
- const resname = _optionalChain([transUnit, 'access', _246 => _246.getAttribute, 'call', _247 => _247("resname"), 'optionalAccess', _248 => _248.trim, 'call', _249 => _249()]);
5220
+ const resname = _optionalChain([transUnit, 'access', _249 => _249.getAttribute, 'call', _250 => _250("resname"), 'optionalAccess', _251 => _251.trim, 'call', _252 => _252()]);
5191
5221
  if (resname) return resname;
5192
- const id = _optionalChain([transUnit, 'access', _250 => _250.getAttribute, 'call', _251 => _251("id"), 'optionalAccess', _252 => _252.trim, 'call', _253 => _253()]);
5222
+ const id = _optionalChain([transUnit, 'access', _253 => _253.getAttribute, 'call', _254 => _254("id"), 'optionalAccess', _255 => _255.trim, 'call', _256 => _256()]);
5193
5223
  if (id) return id;
5194
5224
  const sourceElement = transUnit.querySelector("source");
5195
5225
  if (sourceElement) {
@@ -5246,7 +5276,7 @@ function formatXml(xml) {
5246
5276
  if (cdataNode) {
5247
5277
  return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
5248
5278
  }
5249
- const textContent = _optionalChain([element, 'access', _254 => _254.textContent, 'optionalAccess', _255 => _255.trim, 'call', _256 => _256()]) || "";
5279
+ const textContent = _optionalChain([element, 'access', _257 => _257.textContent, 'optionalAccess', _258 => _258.trim, 'call', _259 => _259()]) || "";
5250
5280
  const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
5251
5281
  if (hasOnlyText && textContent) {
5252
5282
  return `${indent2}${openTag}${textContent}</${tagName}>`;
@@ -5539,7 +5569,7 @@ function createDatoClient(params) {
5539
5569
  ids: !records.length ? void 0 : records.join(",")
5540
5570
  }
5541
5571
  }).catch(
5542
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _257 => _257.response, 'optionalAccess', _258 => _258.body, 'optionalAccess', _259 => _259.data, 'optionalAccess', _260 => _260[0]]) || error)
5572
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _260 => _260.response, 'optionalAccess', _261 => _261.body, 'optionalAccess', _262 => _262.data, 'optionalAccess', _263 => _263[0]]) || error)
5543
5573
  );
5544
5574
  },
5545
5575
  findRecordsForModel: async (modelId, records) => {
@@ -5550,10 +5580,10 @@ function createDatoClient(params) {
5550
5580
  filter: {
5551
5581
  type: modelId,
5552
5582
  only_valid: "true",
5553
- ids: !_optionalChain([records, 'optionalAccess', _261 => _261.length]) ? void 0 : records.join(",")
5583
+ ids: !_optionalChain([records, 'optionalAccess', _264 => _264.length]) ? void 0 : records.join(",")
5554
5584
  }
5555
5585
  }).catch(
5556
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _262 => _262.response, 'optionalAccess', _263 => _263.body, 'optionalAccess', _264 => _264.data, 'optionalAccess', _265 => _265[0]]) || error)
5586
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _265 => _265.response, 'optionalAccess', _266 => _266.body, 'optionalAccess', _267 => _267.data, 'optionalAccess', _268 => _268[0]]) || error)
5557
5587
  );
5558
5588
  return result;
5559
5589
  } catch (_error) {
@@ -5569,10 +5599,10 @@ function createDatoClient(params) {
5569
5599
  updateRecord: async (id, payload) => {
5570
5600
  try {
5571
5601
  await dato.items.update(id, payload).catch(
5572
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _266 => _266.response, 'optionalAccess', _267 => _267.body, 'optionalAccess', _268 => _268.data, 'optionalAccess', _269 => _269[0]]) || error)
5602
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _269 => _269.response, 'optionalAccess', _270 => _270.body, 'optionalAccess', _271 => _271.data, 'optionalAccess', _272 => _272[0]]) || error)
5573
5603
  );
5574
5604
  } catch (_error) {
5575
- if (_optionalChain([_error, 'optionalAccess', _270 => _270.attributes, 'optionalAccess', _271 => _271.details, 'optionalAccess', _272 => _272.message])) {
5605
+ if (_optionalChain([_error, 'optionalAccess', _273 => _273.attributes, 'optionalAccess', _274 => _274.details, 'optionalAccess', _275 => _275.message])) {
5576
5606
  throw new Error(
5577
5607
  [
5578
5608
  `${_error.attributes.details.message}`,
@@ -5594,10 +5624,10 @@ function createDatoClient(params) {
5594
5624
  enableFieldLocalization: async (args) => {
5595
5625
  try {
5596
5626
  await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
5597
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _273 => _273.response, 'optionalAccess', _274 => _274.body, 'optionalAccess', _275 => _275.data, 'optionalAccess', _276 => _276[0]]) || error)
5627
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _276 => _276.response, 'optionalAccess', _277 => _277.body, 'optionalAccess', _278 => _278.data, 'optionalAccess', _279 => _279[0]]) || error)
5598
5628
  );
5599
5629
  } catch (_error) {
5600
- if (_optionalChain([_error, 'optionalAccess', _277 => _277.attributes, 'optionalAccess', _278 => _278.code]) === "NOT_FOUND") {
5630
+ if (_optionalChain([_error, 'optionalAccess', _280 => _280.attributes, 'optionalAccess', _281 => _281.code]) === "NOT_FOUND") {
5601
5631
  throw new Error(
5602
5632
  [
5603
5633
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -5605,7 +5635,7 @@ function createDatoClient(params) {
5605
5635
  ].join("\n\n")
5606
5636
  );
5607
5637
  }
5608
- if (_optionalChain([_error, 'optionalAccess', _279 => _279.attributes, 'optionalAccess', _280 => _280.details, 'optionalAccess', _281 => _281.message])) {
5638
+ if (_optionalChain([_error, 'optionalAccess', _282 => _282.attributes, 'optionalAccess', _283 => _283.details, 'optionalAccess', _284 => _284.message])) {
5609
5639
  throw new Error(
5610
5640
  [
5611
5641
  `${_error.attributes.details.message}`,
@@ -5683,7 +5713,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
5683
5713
  const records = await dato.findRecordsForModel(modelId);
5684
5714
  const recordChoices = createRecordChoices(
5685
5715
  records,
5686
- _optionalChain([config, 'access', _282 => _282.models, 'access', _283 => _283[modelId], 'optionalAccess', _284 => _284.records]) || [],
5716
+ _optionalChain([config, 'access', _285 => _285.models, 'access', _286 => _286[modelId], 'optionalAccess', _287 => _287.records]) || [],
5687
5717
  project
5688
5718
  );
5689
5719
  const selectedRecords = await promptRecordSelection(
@@ -5702,14 +5732,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
5702
5732
  },
5703
5733
  async pull(locale, input2, initCtx) {
5704
5734
  const result = {};
5705
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _285 => _285.models]) || {})) {
5706
- let records = _optionalChain([initCtx, 'optionalAccess', _286 => _286.models, 'access', _287 => _287[modelId], 'access', _288 => _288.records]) || [];
5735
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _288 => _288.models]) || {})) {
5736
+ let records = _optionalChain([initCtx, 'optionalAccess', _289 => _289.models, 'access', _290 => _290[modelId], 'access', _291 => _291.records]) || [];
5707
5737
  const recordIds = records.map((record) => record.id);
5708
5738
  records = await dato.findRecords(recordIds);
5709
5739
  console.log(`Fetched ${records.length} records for model ${modelId}`);
5710
5740
  if (records.length > 0) {
5711
5741
  result[modelId] = {
5712
- fields: _optionalChain([initCtx, 'optionalAccess', _289 => _289.models, 'optionalAccess', _290 => _290[modelId], 'optionalAccess', _291 => _291.fields]) || [],
5742
+ fields: _optionalChain([initCtx, 'optionalAccess', _292 => _292.models, 'optionalAccess', _293 => _293[modelId], 'optionalAccess', _294 => _294.fields]) || [],
5713
5743
  records
5714
5744
  };
5715
5745
  }
@@ -5772,7 +5802,7 @@ function createRecordChoices(records, selectedIds = [], project) {
5772
5802
  return records.map((record) => ({
5773
5803
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
5774
5804
  value: record.id,
5775
- checked: _optionalChain([selectedIds, 'optionalAccess', _292 => _292.includes, 'call', _293 => _293(record.id)])
5805
+ checked: _optionalChain([selectedIds, 'optionalAccess', _295 => _295.includes, 'call', _296 => _296(record.id)])
5776
5806
  }));
5777
5807
  }
5778
5808
  async function promptRecordSelection(modelName, choices) {
@@ -6091,7 +6121,7 @@ function createVttLoader() {
6091
6121
  if (!input2) {
6092
6122
  return "";
6093
6123
  }
6094
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _294 => _294.parse, 'call', _295 => _295(input2), 'optionalAccess', _296 => _296.cues]);
6124
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _297 => _297.parse, 'call', _298 => _298(input2), 'optionalAccess', _299 => _299.cues]);
6095
6125
  if (Object.keys(vtt).length === 0) {
6096
6126
  return {};
6097
6127
  } else {
@@ -6154,7 +6184,7 @@ function variableExtractLoader(params) {
6154
6184
  for (let i = 0; i < matches.length; i++) {
6155
6185
  const match2 = matches[i];
6156
6186
  const currentValue = result[key].value;
6157
- const newValue = _optionalChain([currentValue, 'optionalAccess', _297 => _297.replace, 'call', _298 => _298(match2, `{variable:${i}}`)]);
6187
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _300 => _300.replace, 'call', _301 => _301(match2, `{variable:${i}}`)]);
6158
6188
  result[key].value = newValue;
6159
6189
  result[key].variables[i] = match2;
6160
6190
  }
@@ -6167,7 +6197,7 @@ function variableExtractLoader(params) {
6167
6197
  result[key] = valueObj.value;
6168
6198
  const resultValue = result[key];
6169
6199
  if (isICUPluralObject(resultValue)) {
6170
- const originalValue = _optionalChain([originalInput, 'optionalAccess', _299 => _299[key]]);
6200
+ const originalValue = _optionalChain([originalInput, 'optionalAccess', _302 => _302[key]]);
6171
6201
  if (isICUPluralObject(originalValue) && originalValue._meta) {
6172
6202
  resultValue._meta = originalValue._meta;
6173
6203
  resultValue[Symbol.for("@lingo.dev/icu-plural-object")] = true;
@@ -6177,7 +6207,7 @@ function variableExtractLoader(params) {
6177
6207
  const variable = valueObj.variables[i];
6178
6208
  const currentValue = result[key];
6179
6209
  if (typeof currentValue === "string") {
6180
- const newValue = _optionalChain([currentValue, 'optionalAccess', _300 => _300.replace, 'call', _301 => _301(`{variable:${i}}`, variable)]);
6210
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _303 => _303.replace, 'call', _304 => _304(`{variable:${i}}`, variable)]);
6181
6211
  result[key] = newValue;
6182
6212
  }
6183
6213
  }
@@ -6378,7 +6408,7 @@ function createVueJsonLoader() {
6378
6408
  return createLoader({
6379
6409
  pull: async (locale, input2, ctx) => {
6380
6410
  const parsed = parseVueFile(input2);
6381
- return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _302 => _302.i18n, 'optionalAccess', _303 => _303[locale]]), () => ( {}));
6411
+ return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _305 => _305.i18n, 'optionalAccess', _306 => _306[locale]]), () => ( {}));
6382
6412
  },
6383
6413
  push: async (locale, data, originalInput) => {
6384
6414
  const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
@@ -6563,7 +6593,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
6563
6593
  objectExpression.properties.forEach((prop) => {
6564
6594
  if (!t.isObjectProperty(prop)) return;
6565
6595
  const key = getPropertyKey(prop);
6566
- const incomingVal = _optionalChain([data, 'optionalAccess', _304 => _304[key]]);
6596
+ const incomingVal = _optionalChain([data, 'optionalAccess', _307 => _307[key]]);
6567
6597
  if (incomingVal === void 0) {
6568
6598
  return;
6569
6599
  }
@@ -6599,7 +6629,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
6599
6629
  let modified = false;
6600
6630
  arrayExpression.elements.forEach((element, index) => {
6601
6631
  if (!element) return;
6602
- const incomingVal = _optionalChain([incoming, 'optionalAccess', _305 => _305[index]]);
6632
+ const incomingVal = _optionalChain([incoming, 'optionalAccess', _308 => _308[index]]);
6603
6633
  if (incomingVal === void 0) return;
6604
6634
  if (t.isStringLiteral(element) && typeof incomingVal === "string") {
6605
6635
  if (element.value !== incomingVal) {
@@ -7090,7 +7120,7 @@ var AST = class _AST {
7090
7120
  const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
7091
7121
  if (this.isStart() && !this.type)
7092
7122
  ret.unshift([]);
7093
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _306 => _306.#parent, 'optionalAccess', _307 => _307.type]) === "!")) {
7123
+ if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _309 => _309.#parent, 'optionalAccess', _310 => _310.type]) === "!")) {
7094
7124
  ret.push({});
7095
7125
  }
7096
7126
  return ret;
@@ -7098,7 +7128,7 @@ var AST = class _AST {
7098
7128
  isStart() {
7099
7129
  if (this.#root === this)
7100
7130
  return true;
7101
- if (!_optionalChain([this, 'access', _308 => _308.#parent, 'optionalAccess', _309 => _309.isStart, 'call', _310 => _310()]))
7131
+ if (!_optionalChain([this, 'access', _311 => _311.#parent, 'optionalAccess', _312 => _312.isStart, 'call', _313 => _313()]))
7102
7132
  return false;
7103
7133
  if (this.#parentIndex === 0)
7104
7134
  return true;
@@ -7114,12 +7144,12 @@ var AST = class _AST {
7114
7144
  isEnd() {
7115
7145
  if (this.#root === this)
7116
7146
  return true;
7117
- if (_optionalChain([this, 'access', _311 => _311.#parent, 'optionalAccess', _312 => _312.type]) === "!")
7147
+ if (_optionalChain([this, 'access', _314 => _314.#parent, 'optionalAccess', _315 => _315.type]) === "!")
7118
7148
  return true;
7119
- if (!_optionalChain([this, 'access', _313 => _313.#parent, 'optionalAccess', _314 => _314.isEnd, 'call', _315 => _315()]))
7149
+ if (!_optionalChain([this, 'access', _316 => _316.#parent, 'optionalAccess', _317 => _317.isEnd, 'call', _318 => _318()]))
7120
7150
  return false;
7121
7151
  if (!this.type)
7122
- return _optionalChain([this, 'access', _316 => _316.#parent, 'optionalAccess', _317 => _317.isEnd, 'call', _318 => _318()]);
7152
+ return _optionalChain([this, 'access', _319 => _319.#parent, 'optionalAccess', _320 => _320.isEnd, 'call', _321 => _321()]);
7123
7153
  const pl = this.#parent ? this.#parent.#parts.length : 0;
7124
7154
  return this.#parentIndex === pl - 1;
7125
7155
  }
@@ -7364,7 +7394,7 @@ var AST = class _AST {
7364
7394
  }
7365
7395
  }
7366
7396
  let end = "";
7367
- if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _319 => _319.#parent, 'optionalAccess', _320 => _320.type]) === "!") {
7397
+ if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _322 => _322.#parent, 'optionalAccess', _323 => _323.type]) === "!") {
7368
7398
  end = "(?:$|\\/)";
7369
7399
  }
7370
7400
  const final2 = start2 + src + end;
@@ -8454,7 +8484,7 @@ function createMdxSectionsSplit2Loader() {
8454
8484
  const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
8455
8485
  const result = {
8456
8486
  frontmatter: data.frontmatter,
8457
- codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _321 => _321.codePlaceholders]) || {},
8487
+ codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _324 => _324.codePlaceholders]) || {},
8458
8488
  content
8459
8489
  };
8460
8490
  return result;
@@ -9555,7 +9585,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
9555
9585
  ]
9556
9586
  });
9557
9587
  const result = JSON.parse(response.text);
9558
- return _optionalChain([result, 'optionalAccess', _322 => _322.data]) || {};
9588
+ return _optionalChain([result, 'optionalAccess', _325 => _325.data]) || {};
9559
9589
  }
9560
9590
  }
9561
9591
  function extractPayloadChunks(payload) {
@@ -9638,7 +9668,7 @@ function getPureModelProvider(provider) {
9638
9668
 
9639
9669
  ${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
9640
9670
  `;
9641
- switch (_optionalChain([provider, 'optionalAccess', _323 => _323.id])) {
9671
+ switch (_optionalChain([provider, 'optionalAccess', _326 => _326.id])) {
9642
9672
  case "openai": {
9643
9673
  if (!process.env.OPENAI_API_KEY) {
9644
9674
  throw new Error(
@@ -9696,7 +9726,7 @@ function getPureModelProvider(provider) {
9696
9726
  })(provider.model);
9697
9727
  }
9698
9728
  default: {
9699
- throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _324 => _324.id])));
9729
+ throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _327 => _327.id])));
9700
9730
  }
9701
9731
  }
9702
9732
  }
@@ -9982,7 +10012,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
9982
10012
  validateParams(i18nConfig, flags);
9983
10013
  ora.succeed("Localization configuration is valid");
9984
10014
  ora.start("Connecting to Lingo.dev Localization Engine...");
9985
- const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _325 => _325.provider]);
10015
+ const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _328 => _328.provider]);
9986
10016
  if (isByokMode) {
9987
10017
  authId = null;
9988
10018
  ora.succeed("Using external provider (BYOK mode)");
@@ -9996,16 +10026,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
9996
10026
  flags
9997
10027
  });
9998
10028
  let buckets = getBuckets(i18nConfig);
9999
- if (_optionalChain([flags, 'access', _326 => _326.bucket, 'optionalAccess', _327 => _327.length])) {
10029
+ if (_optionalChain([flags, 'access', _329 => _329.bucket, 'optionalAccess', _330 => _330.length])) {
10000
10030
  buckets = buckets.filter(
10001
10031
  (bucket) => flags.bucket.includes(bucket.type)
10002
10032
  );
10003
10033
  }
10004
10034
  ora.succeed("Buckets retrieved");
10005
- if (_optionalChain([flags, 'access', _328 => _328.file, 'optionalAccess', _329 => _329.length])) {
10035
+ if (_optionalChain([flags, 'access', _331 => _331.file, 'optionalAccess', _332 => _332.length])) {
10006
10036
  buckets = buckets.map((bucket) => {
10007
10037
  const paths = bucket.paths.filter(
10008
- (path19) => flags.file.find((file) => _optionalChain([path19, 'access', _330 => _330.pathPattern, 'optionalAccess', _331 => _331.includes, 'call', _332 => _332(file)]))
10038
+ (path19) => flags.file.find((file) => _optionalChain([path19, 'access', _333 => _333.pathPattern, 'optionalAccess', _334 => _334.includes, 'call', _335 => _335(file)]))
10009
10039
  );
10010
10040
  return { ...bucket, paths };
10011
10041
  }).filter((bucket) => bucket.paths.length > 0);
@@ -10026,7 +10056,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10026
10056
  });
10027
10057
  }
10028
10058
  }
10029
- const targetLocales = _optionalChain([flags, 'access', _333 => _333.locale, 'optionalAccess', _334 => _334.length]) ? flags.locale : i18nConfig.locale.targets;
10059
+ const targetLocales = _optionalChain([flags, 'access', _336 => _336.locale, 'optionalAccess', _337 => _337.length]) ? flags.locale : i18nConfig.locale.targets;
10030
10060
  ora.start("Setting up localization cache...");
10031
10061
  const checkLockfileProcessor = createDeltaProcessor("");
10032
10062
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -10314,7 +10344,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10314
10344
  }
10315
10345
  const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
10316
10346
  const checksums = await deltaProcessor.createChecksums(sourceData);
10317
- if (!_optionalChain([flags, 'access', _335 => _335.locale, 'optionalAccess', _336 => _336.length])) {
10347
+ if (!_optionalChain([flags, 'access', _338 => _338.locale, 'optionalAccess', _339 => _339.length])) {
10318
10348
  await deltaProcessor.saveChecksums(checksums);
10319
10349
  }
10320
10350
  }
@@ -10438,12 +10468,12 @@ function validateParams(i18nConfig, flags) {
10438
10468
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
10439
10469
  docUrl: "bucketNotFound"
10440
10470
  });
10441
- } else if (_optionalChain([flags, 'access', _337 => _337.locale, 'optionalAccess', _338 => _338.some, 'call', _339 => _339((locale) => !i18nConfig.locale.targets.includes(locale))])) {
10471
+ } else if (_optionalChain([flags, 'access', _340 => _340.locale, 'optionalAccess', _341 => _341.some, 'call', _342 => _342((locale) => !i18nConfig.locale.targets.includes(locale))])) {
10442
10472
  throw new ValidationError({
10443
10473
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
10444
10474
  docUrl: "localeTargetNotFound"
10445
10475
  });
10446
- } else if (_optionalChain([flags, 'access', _340 => _340.bucket, 'optionalAccess', _341 => _341.some, 'call', _342 => _342(
10476
+ } else if (_optionalChain([flags, 'access', _343 => _343.bucket, 'optionalAccess', _344 => _344.some, 'call', _345 => _345(
10447
10477
  (bucket) => !i18nConfig.buckets[bucket]
10448
10478
  )])) {
10449
10479
  throw new ValidationError({
@@ -10977,7 +11007,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
10977
11007
  const response = await engine.whoami();
10978
11008
  return {
10979
11009
  authenticated: !!response,
10980
- username: _optionalChain([response, 'optionalAccess', _343 => _343.email])
11010
+ username: _optionalChain([response, 'optionalAccess', _346 => _346.email])
10981
11011
  };
10982
11012
  } catch (error) {
10983
11013
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -11093,7 +11123,7 @@ function createExplicitLocalizer(provider) {
11093
11123
  }
11094
11124
  function createAiSdkLocalizer(params) {
11095
11125
  const skipAuth = params.skipAuth === true;
11096
- const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _344 => _344.apiKeyName]), () => ( ""))];
11126
+ const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _347 => _347.apiKeyName]), () => ( ""))];
11097
11127
  if (!skipAuth && !apiKey || !params.apiKeyName) {
11098
11128
  throw new Error(
11099
11129
  _dedent2.default`
@@ -11227,8 +11257,8 @@ async function setup(input2) {
11227
11257
  throw new Error(
11228
11258
  "No buckets found in i18n.json. Please add at least one bucket containing i18n content."
11229
11259
  );
11230
- } else if (_optionalChain([ctx, 'access', _345 => _345.flags, 'access', _346 => _346.bucket, 'optionalAccess', _347 => _347.some, 'call', _348 => _348(
11231
- (bucket) => !_optionalChain([ctx, 'access', _349 => _349.config, 'optionalAccess', _350 => _350.buckets, 'access', _351 => _351[bucket]])
11260
+ } else if (_optionalChain([ctx, 'access', _348 => _348.flags, 'access', _349 => _349.bucket, 'optionalAccess', _350 => _350.some, 'call', _351 => _351(
11261
+ (bucket) => !_optionalChain([ctx, 'access', _352 => _352.config, 'optionalAccess', _353 => _353.buckets, 'access', _354 => _354[bucket]])
11232
11262
  )])) {
11233
11263
  throw new Error(
11234
11264
  `One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
@@ -11241,7 +11271,7 @@ async function setup(input2) {
11241
11271
  title: "Selecting localization provider",
11242
11272
  task: async (ctx, task) => {
11243
11273
  ctx.localizer = createLocalizer(
11244
- _optionalChain([ctx, 'access', _352 => _352.config, 'optionalAccess', _353 => _353.provider]),
11274
+ _optionalChain([ctx, 'access', _355 => _355.config, 'optionalAccess', _356 => _356.provider]),
11245
11275
  ctx.flags.apiKey
11246
11276
  );
11247
11277
  if (!ctx.localizer) {
@@ -11254,7 +11284,7 @@ async function setup(input2) {
11254
11284
  },
11255
11285
  {
11256
11286
  title: "Checking authentication",
11257
- enabled: (ctx) => _optionalChain([ctx, 'access', _354 => _354.localizer, 'optionalAccess', _355 => _355.id]) === "Lingo.dev",
11287
+ enabled: (ctx) => _optionalChain([ctx, 'access', _357 => _357.localizer, 'optionalAccess', _358 => _358.id]) === "Lingo.dev",
11258
11288
  task: async (ctx, task) => {
11259
11289
  const authStatus = await ctx.localizer.checkAuth();
11260
11290
  if (!authStatus.authenticated) {
@@ -11267,7 +11297,7 @@ async function setup(input2) {
11267
11297
  },
11268
11298
  {
11269
11299
  title: "Validating configuration",
11270
- enabled: (ctx) => _optionalChain([ctx, 'access', _356 => _356.localizer, 'optionalAccess', _357 => _357.id]) !== "Lingo.dev",
11300
+ enabled: (ctx) => _optionalChain([ctx, 'access', _359 => _359.localizer, 'optionalAccess', _360 => _360.id]) !== "Lingo.dev",
11271
11301
  task: async (ctx, task) => {
11272
11302
  const validationStatus = await ctx.localizer.validateSettings();
11273
11303
  if (!validationStatus.valid) {
@@ -11598,7 +11628,7 @@ function createWorkerTask(args) {
11598
11628
  const processableData = _lodash2.default.chain(sourceData).entries().filter(
11599
11629
  ([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
11600
11630
  ).filter(
11601
- ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _358 => _358.onlyKeys, 'optionalAccess', _359 => _359.some, 'call', _360 => _360(
11631
+ ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _361 => _361.onlyKeys, 'optionalAccess', _362 => _362.some, 'call', _363 => _363(
11602
11632
  (pattern) => minimatch(key, pattern)
11603
11633
  )])
11604
11634
  ).fromPairs().value();
@@ -11666,7 +11696,7 @@ function createWorkerTask(args) {
11666
11696
  finalRenamedTargetData
11667
11697
  );
11668
11698
  const checksums = await deltaProcessor.createChecksums(sourceData);
11669
- if (!_optionalChain([args, 'access', _361 => _361.ctx, 'access', _362 => _362.flags, 'access', _363 => _363.targetLocale, 'optionalAccess', _364 => _364.length])) {
11699
+ if (!_optionalChain([args, 'access', _364 => _364.ctx, 'access', _365 => _365.flags, 'access', _366 => _366.targetLocale, 'optionalAccess', _367 => _367.length])) {
11670
11700
  await deltaProcessor.saveChecksums(checksums);
11671
11701
  }
11672
11702
  });
@@ -11871,10 +11901,10 @@ var flagsSchema2 = _zod.z.object({
11871
11901
  async function frozen(input2) {
11872
11902
  console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
11873
11903
  let buckets = getBuckets(input2.config);
11874
- if (_optionalChain([input2, 'access', _365 => _365.flags, 'access', _366 => _366.bucket, 'optionalAccess', _367 => _367.length])) {
11904
+ if (_optionalChain([input2, 'access', _368 => _368.flags, 'access', _369 => _369.bucket, 'optionalAccess', _370 => _370.length])) {
11875
11905
  buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
11876
11906
  }
11877
- if (_optionalChain([input2, 'access', _368 => _368.flags, 'access', _369 => _369.file, 'optionalAccess', _370 => _370.length])) {
11907
+ if (_optionalChain([input2, 'access', _371 => _371.flags, 'access', _372 => _372.file, 'optionalAccess', _373 => _373.length])) {
11878
11908
  buckets = buckets.map((bucket) => {
11879
11909
  const paths = bucket.paths.filter(
11880
11910
  (p) => input2.flags.file.some(
@@ -12011,13 +12041,13 @@ async function frozen(input2) {
12011
12041
 
12012
12042
  // src/cli/cmd/run/_utils.ts
12013
12043
  async function determineAuthId(ctx) {
12014
- const isByokMode = !!_optionalChain([ctx, 'access', _371 => _371.config, 'optionalAccess', _372 => _372.provider]);
12044
+ const isByokMode = !!_optionalChain([ctx, 'access', _374 => _374.config, 'optionalAccess', _375 => _375.provider]);
12015
12045
  if (isByokMode) {
12016
12046
  return null;
12017
12047
  } else {
12018
12048
  try {
12019
- const authStatus = await _optionalChain([ctx, 'access', _373 => _373.localizer, 'optionalAccess', _374 => _374.checkAuth, 'call', _375 => _375()]);
12020
- return _optionalChain([authStatus, 'optionalAccess', _376 => _376.username]) || null;
12049
+ const authStatus = await _optionalChain([ctx, 'access', _376 => _376.localizer, 'optionalAccess', _377 => _377.checkAuth, 'call', _378 => _378()]);
12050
+ return _optionalChain([authStatus, 'optionalAccess', _379 => _379.username]) || null;
12021
12051
  } catch (e3) {
12022
12052
  return null;
12023
12053
  }
@@ -12025,7 +12055,7 @@ async function determineAuthId(ctx) {
12025
12055
  }
12026
12056
 
12027
12057
  // src/cli/cmd/run/index.ts
12028
- var __dirname = path14.default.dirname(_url.fileURLToPath.call(void 0, import.meta.url));
12058
+ var __dirname = path14.default.dirname(_url.fileURLToPath.call(void 0, _chunkZZGWAPLZcjs.importMetaUrl));
12029
12059
  function playSound(type) {
12030
12060
  const platform = _os2.default.platform();
12031
12061
  return new Promise((resolve) => {
@@ -12215,7 +12245,7 @@ var InBranchFlow = class extends IntegrationFlow {
12215
12245
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
12216
12246
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
12217
12247
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
12218
- _optionalChain([this, 'access', _377 => _377.platformKit, 'optionalAccess', _378 => _378.gitConfig, 'call', _379 => _379()]);
12248
+ _optionalChain([this, 'access', _380 => _380.platformKit, 'optionalAccess', _381 => _381.gitConfig, 'call', _382 => _382()]);
12219
12249
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
12220
12250
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
12221
12251
  if (!processOwnCommits) {
@@ -12247,7 +12277,7 @@ var InBranchFlow = class extends IntegrationFlow {
12247
12277
  // src/cli/cmd/ci/flows/pull-request.ts
12248
12278
  var PullRequestFlow = class extends InBranchFlow {
12249
12279
  async preRun() {
12250
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _380 => _380()]);
12280
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _383 => _383()]);
12251
12281
  if (!canContinue) {
12252
12282
  return false;
12253
12283
  }
@@ -12514,10 +12544,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
12514
12544
  repo_slug: this.platformConfig.repositoryName,
12515
12545
  state: "OPEN"
12516
12546
  }).then(({ data: { values } }) => {
12517
- return _optionalChain([values, 'optionalAccess', _381 => _381.find, 'call', _382 => _382(
12518
- ({ source, destination }) => _optionalChain([source, 'optionalAccess', _383 => _383.branch, 'optionalAccess', _384 => _384.name]) === branch && _optionalChain([destination, 'optionalAccess', _385 => _385.branch, 'optionalAccess', _386 => _386.name]) === this.platformConfig.baseBranchName
12547
+ return _optionalChain([values, 'optionalAccess', _384 => _384.find, 'call', _385 => _385(
12548
+ ({ source, destination }) => _optionalChain([source, 'optionalAccess', _386 => _386.branch, 'optionalAccess', _387 => _387.name]) === branch && _optionalChain([destination, 'optionalAccess', _388 => _388.branch, 'optionalAccess', _389 => _389.name]) === this.platformConfig.baseBranchName
12519
12549
  )]);
12520
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _387 => _387.id]));
12550
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _390 => _390.id]));
12521
12551
  }
12522
12552
  async closePullRequest({ pullRequestNumber }) {
12523
12553
  await this.bb.repositories.declinePullRequest({
@@ -12613,7 +12643,7 @@ var GitHubPlatformKit = class extends PlatformKit {
12613
12643
  repo: this.platformConfig.repositoryName,
12614
12644
  base: this.platformConfig.baseBranchName,
12615
12645
  state: "open"
12616
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _388 => _388.number]));
12646
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _391 => _391.number]));
12617
12647
  }
12618
12648
  async closePullRequest({ pullRequestNumber }) {
12619
12649
  await this.octokit.rest.pulls.update({
@@ -12740,7 +12770,7 @@ var GitlabPlatformKit = class extends PlatformKit {
12740
12770
  sourceBranch: branch,
12741
12771
  state: "opened"
12742
12772
  });
12743
- return _optionalChain([mergeRequests, 'access', _389 => _389[0], 'optionalAccess', _390 => _390.iid]);
12773
+ return _optionalChain([mergeRequests, 'access', _392 => _392[0], 'optionalAccess', _393 => _393.iid]);
12744
12774
  }
12745
12775
  async closePullRequest({
12746
12776
  pullRequestNumber
@@ -12852,7 +12882,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12852
12882
  }
12853
12883
  const env = {
12854
12884
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
12855
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _391 => _391.pullRequest, 'optionalAccess', _392 => _392.toString, 'call', _393 => _393()]) || "false",
12885
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _394 => _394.pullRequest, 'optionalAccess', _395 => _395.toString, 'call', _396 => _396()]) || "false",
12856
12886
  ...options.commitMessage && {
12857
12887
  LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
12858
12888
  },
@@ -12878,7 +12908,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12878
12908
  const { isPullRequestMode } = platformKit.config;
12879
12909
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
12880
12910
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
12881
- const canRun = await _optionalChain([flow, 'access', _394 => _394.preRun, 'optionalCall', _395 => _395()]);
12911
+ const canRun = await _optionalChain([flow, 'access', _397 => _397.preRun, 'optionalCall', _398 => _398()]);
12882
12912
  if (canRun === false) {
12883
12913
  return;
12884
12914
  }
@@ -12888,7 +12918,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12888
12918
  if (!hasChanges) {
12889
12919
  return;
12890
12920
  }
12891
- await _optionalChain([flow, 'access', _396 => _396.postRun, 'optionalCall', _397 => _397()]);
12921
+ await _optionalChain([flow, 'access', _399 => _399.postRun, 'optionalCall', _400 => _400()]);
12892
12922
  });
12893
12923
  function parseBooleanArg(val) {
12894
12924
  if (val === true) return true;
@@ -12925,8 +12955,8 @@ function exitGracefully(elapsedMs = 0) {
12925
12955
  }
12926
12956
  }
12927
12957
  function checkForPendingOperations() {
12928
- const activeHandles = _optionalChain([process, 'access', _398 => _398._getActiveHandles, 'optionalCall', _399 => _399()]) || [];
12929
- const activeRequests = _optionalChain([process, 'access', _400 => _400._getActiveRequests, 'optionalCall', _401 => _401()]) || [];
12958
+ const activeHandles = _optionalChain([process, 'access', _401 => _401._getActiveHandles, 'optionalCall', _402 => _402()]) || [];
12959
+ const activeRequests = _optionalChain([process, 'access', _403 => _403._getActiveRequests, 'optionalCall', _404 => _404()]) || [];
12930
12960
  const nonStandardHandles = activeHandles.filter((handle) => {
12931
12961
  if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
12932
12962
  return false;
@@ -12995,17 +13025,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
12995
13025
  flags
12996
13026
  });
12997
13027
  let buckets = getBuckets(i18nConfig);
12998
- if (_optionalChain([flags, 'access', _402 => _402.bucket, 'optionalAccess', _403 => _403.length])) {
13028
+ if (_optionalChain([flags, 'access', _405 => _405.bucket, 'optionalAccess', _406 => _406.length])) {
12999
13029
  buckets = buckets.filter(
13000
13030
  (bucket) => flags.bucket.includes(bucket.type)
13001
13031
  );
13002
13032
  }
13003
13033
  ora.succeed("Buckets retrieved");
13004
- if (_optionalChain([flags, 'access', _404 => _404.file, 'optionalAccess', _405 => _405.length])) {
13034
+ if (_optionalChain([flags, 'access', _407 => _407.file, 'optionalAccess', _408 => _408.length])) {
13005
13035
  buckets = buckets.map((bucket) => {
13006
13036
  const paths = bucket.paths.filter(
13007
13037
  (path19) => flags.file.find(
13008
- (file) => _optionalChain([path19, 'access', _406 => _406.pathPattern, 'optionalAccess', _407 => _407.includes, 'call', _408 => _408(file)]) || _optionalChain([path19, 'access', _409 => _409.pathPattern, 'optionalAccess', _410 => _410.match, 'call', _411 => _411(file)]) || minimatch(path19.pathPattern, file)
13038
+ (file) => _optionalChain([path19, 'access', _409 => _409.pathPattern, 'optionalAccess', _410 => _410.includes, 'call', _411 => _411(file)]) || _optionalChain([path19, 'access', _412 => _412.pathPattern, 'optionalAccess', _413 => _413.match, 'call', _414 => _414(file)]) || minimatch(path19.pathPattern, file)
13009
13039
  )
13010
13040
  );
13011
13041
  return { ...bucket, paths };
@@ -13025,7 +13055,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
13025
13055
  });
13026
13056
  }
13027
13057
  }
13028
- const targetLocales = _optionalChain([flags, 'access', _412 => _412.locale, 'optionalAccess', _413 => _413.length]) ? flags.locale : i18nConfig.locale.targets;
13058
+ const targetLocales = _optionalChain([flags, 'access', _415 => _415.locale, 'optionalAccess', _416 => _416.length]) ? flags.locale : i18nConfig.locale.targets;
13029
13059
  let totalSourceKeyCount = 0;
13030
13060
  let uniqueKeysToTranslate = 0;
13031
13061
  let totalExistingTranslations = 0;
@@ -13298,7 +13328,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
13298
13328
  console.log(`\u2022 Per-language breakdown:`);
13299
13329
  for (const locale of targetLocales) {
13300
13330
  const words = totalWordCount.get(locale) || 0;
13301
- const percent = (words / totalWordsToTranslate * 100).toFixed(1);
13331
+ const percent = totalWordsToTranslate > 0 ? (words / totalWordsToTranslate * 100).toFixed(1) : "0.0";
13302
13332
  console.log(
13303
13333
  ` - ${locale}: ~${words.toLocaleString()} words (${percent}% of total)`
13304
13334
  );
@@ -13433,12 +13463,12 @@ function validateParams2(i18nConfig, flags) {
13433
13463
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
13434
13464
  docUrl: "bucketNotFound"
13435
13465
  });
13436
- } else if (_optionalChain([flags, 'access', _414 => _414.locale, 'optionalAccess', _415 => _415.some, 'call', _416 => _416((locale) => !i18nConfig.locale.targets.includes(locale))])) {
13466
+ } else if (_optionalChain([flags, 'access', _417 => _417.locale, 'optionalAccess', _418 => _418.some, 'call', _419 => _419((locale) => !i18nConfig.locale.targets.includes(locale))])) {
13437
13467
  throw new CLIError({
13438
13468
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
13439
13469
  docUrl: "localeTargetNotFound"
13440
13470
  });
13441
- } else if (_optionalChain([flags, 'access', _417 => _417.bucket, 'optionalAccess', _418 => _418.some, 'call', _419 => _419(
13471
+ } else if (_optionalChain([flags, 'access', _420 => _420.bucket, 'optionalAccess', _421 => _421.some, 'call', _422 => _422(
13442
13472
  (bucket) => !i18nConfig.buckets[bucket]
13443
13473
  )])) {
13444
13474
  throw new CLIError({
@@ -13530,7 +13560,7 @@ async function renderHero2() {
13530
13560
  // package.json
13531
13561
  var package_default = {
13532
13562
  name: "lingo.dev",
13533
- version: "0.115.0",
13563
+ version: "0.116.2",
13534
13564
  description: "Lingo.dev CLI",
13535
13565
  private: false,
13536
13566
  publishConfig: {
@@ -13726,7 +13756,7 @@ var package_default = {
13726
13756
  "php-array-reader": "^2.1.2",
13727
13757
  plist: "^3.1.0",
13728
13758
  "posthog-node": "^5.8.1",
13729
- prettier: "^3.4.2",
13759
+ prettier: "^3.6.2",
13730
13760
  react: "^18.3.1",
13731
13761
  "rehype-stringify": "^10.0.1",
13732
13762
  "remark-disable-tokenizers": "^1.1.1",
@@ -13822,7 +13852,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
13822
13852
  if (options.file && options.file.length) {
13823
13853
  buckets = buckets.map((bucket) => {
13824
13854
  const paths = bucket.paths.filter(
13825
- (bucketPath) => _optionalChain([options, 'access', _420 => _420.file, 'optionalAccess', _421 => _421.some, 'call', _422 => _422((f) => bucketPath.pathPattern.includes(f))])
13855
+ (bucketPath) => _optionalChain([options, 'access', _423 => _423.file, 'optionalAccess', _424 => _424.some, 'call', _425 => _425((f) => bucketPath.pathPattern.includes(f))])
13826
13856
  );
13827
13857
  return { ...bucket, paths };
13828
13858
  }).filter((bucket) => bucket.paths.length > 0);