lingo.dev 0.116.2 → 0.116.4

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
@@ -26,17 +26,17 @@ function getSettings(explicitApiKey) {
26
26
  _envVarsInfo();
27
27
  return {
28
28
  auth: {
29
- apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _37 => _37.auth, 'optionalAccess', _38 => _38.apiKey]) || defaults2.auth.apiKey,
30
- apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _39 => _39.auth, 'optionalAccess', _40 => _40.apiUrl]) || defaults2.auth.apiUrl,
31
- webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _41 => _41.auth, 'optionalAccess', _42 => _42.webUrl]) || defaults2.auth.webUrl
29
+ apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _38 => _38.auth, 'optionalAccess', _39 => _39.apiKey]) || defaults2.auth.apiKey,
30
+ apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _40 => _40.auth, 'optionalAccess', _41 => _41.apiUrl]) || defaults2.auth.apiUrl,
31
+ webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _42 => _42.auth, 'optionalAccess', _43 => _43.webUrl]) || defaults2.auth.webUrl
32
32
  },
33
33
  llm: {
34
- openaiApiKey: env.OPENAI_API_KEY || _optionalChain([systemFile, 'access', _43 => _43.llm, 'optionalAccess', _44 => _44.openaiApiKey]),
35
- anthropicApiKey: env.ANTHROPIC_API_KEY || _optionalChain([systemFile, 'access', _45 => _45.llm, 'optionalAccess', _46 => _46.anthropicApiKey]),
36
- groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access', _47 => _47.llm, 'optionalAccess', _48 => _48.groqApiKey]),
37
- googleApiKey: env.GOOGLE_API_KEY || _optionalChain([systemFile, 'access', _49 => _49.llm, 'optionalAccess', _50 => _50.googleApiKey]),
38
- openrouterApiKey: env.OPENROUTER_API_KEY || _optionalChain([systemFile, 'access', _51 => _51.llm, 'optionalAccess', _52 => _52.openrouterApiKey]),
39
- mistralApiKey: env.MISTRAL_API_KEY || _optionalChain([systemFile, 'access', _53 => _53.llm, 'optionalAccess', _54 => _54.mistralApiKey])
34
+ openaiApiKey: env.OPENAI_API_KEY || _optionalChain([systemFile, 'access', _44 => _44.llm, 'optionalAccess', _45 => _45.openaiApiKey]),
35
+ anthropicApiKey: env.ANTHROPIC_API_KEY || _optionalChain([systemFile, 'access', _46 => _46.llm, 'optionalAccess', _47 => _47.anthropicApiKey]),
36
+ groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access', _48 => _48.llm, 'optionalAccess', _49 => _49.groqApiKey]),
37
+ googleApiKey: env.GOOGLE_API_KEY || _optionalChain([systemFile, 'access', _50 => _50.llm, 'optionalAccess', _51 => _51.googleApiKey]),
38
+ openrouterApiKey: env.OPENROUTER_API_KEY || _optionalChain([systemFile, 'access', _52 => _52.llm, 'optionalAccess', _53 => _53.openrouterApiKey]),
39
+ mistralApiKey: env.MISTRAL_API_KEY || _optionalChain([systemFile, 'access', _54 => _54.llm, 'optionalAccess', _55 => _55.mistralApiKey])
40
40
  }
41
41
  };
42
42
  }
@@ -145,43 +145,43 @@ Please use LINGODOTDEV_API_KEY instead.
145
145
  function _envVarsInfo() {
146
146
  const env = _loadEnv();
147
147
  const systemFile = _loadSystemFile();
148
- if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _55 => _55.auth, 'optionalAccess', _56 => _56.apiKey])) {
148
+ if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _56 => _56.auth, 'optionalAccess', _57 => _57.apiKey])) {
149
149
  console.info(
150
150
  "\x1B[36m%s\x1B[0m",
151
151
  `\u2139\uFE0F Using LINGODOTDEV_API_KEY env var instead of credentials from user config`
152
152
  );
153
153
  }
154
- if (env.OPENAI_API_KEY && _optionalChain([systemFile, 'access', _57 => _57.llm, 'optionalAccess', _58 => _58.openaiApiKey])) {
154
+ if (env.OPENAI_API_KEY && _optionalChain([systemFile, 'access', _58 => _58.llm, 'optionalAccess', _59 => _59.openaiApiKey])) {
155
155
  console.info(
156
156
  "\x1B[36m%s\x1B[0m",
157
157
  `\u2139\uFE0F Using OPENAI_API_KEY env var instead of key from user config.`
158
158
  );
159
159
  }
160
- if (env.ANTHROPIC_API_KEY && _optionalChain([systemFile, 'access', _59 => _59.llm, 'optionalAccess', _60 => _60.anthropicApiKey])) {
160
+ if (env.ANTHROPIC_API_KEY && _optionalChain([systemFile, 'access', _60 => _60.llm, 'optionalAccess', _61 => _61.anthropicApiKey])) {
161
161
  console.info(
162
162
  "\x1B[36m%s\x1B[0m",
163
163
  `\u2139\uFE0F Using ANTHROPIC_API_KEY env var instead of key from user config`
164
164
  );
165
165
  }
166
- if (env.GROQ_API_KEY && _optionalChain([systemFile, 'access', _61 => _61.llm, 'optionalAccess', _62 => _62.groqApiKey])) {
166
+ if (env.GROQ_API_KEY && _optionalChain([systemFile, 'access', _62 => _62.llm, 'optionalAccess', _63 => _63.groqApiKey])) {
167
167
  console.info(
168
168
  "\x1B[36m%s\x1B[0m",
169
169
  `\u2139\uFE0F Using GROQ_API_KEY env var instead of key from user config`
170
170
  );
171
171
  }
172
- if (env.GOOGLE_API_KEY && _optionalChain([systemFile, 'access', _63 => _63.llm, 'optionalAccess', _64 => _64.googleApiKey])) {
172
+ if (env.GOOGLE_API_KEY && _optionalChain([systemFile, 'access', _64 => _64.llm, 'optionalAccess', _65 => _65.googleApiKey])) {
173
173
  console.info(
174
174
  "\x1B[36m%s\x1B[0m",
175
175
  `\u2139\uFE0F Using GOOGLE_API_KEY env var instead of key from user config`
176
176
  );
177
177
  }
178
- if (env.OPENROUTER_API_KEY && _optionalChain([systemFile, 'access', _65 => _65.llm, 'optionalAccess', _66 => _66.openrouterApiKey])) {
178
+ if (env.OPENROUTER_API_KEY && _optionalChain([systemFile, 'access', _66 => _66.llm, 'optionalAccess', _67 => _67.openrouterApiKey])) {
179
179
  console.info(
180
180
  "\x1B[36m%s\x1B[0m",
181
181
  `\u2139\uFE0F Using OPENROUTER_API_KEY env var instead of key from user config`
182
182
  );
183
183
  }
184
- if (env.MISTRAL_API_KEY && _optionalChain([systemFile, 'access', _67 => _67.llm, 'optionalAccess', _68 => _68.mistralApiKey])) {
184
+ if (env.MISTRAL_API_KEY && _optionalChain([systemFile, 'access', _68 => _68.llm, 'optionalAccess', _69 => _69.mistralApiKey])) {
185
185
  console.info(
186
186
  "\x1B[36m%s\x1B[0m",
187
187
  `\u2139\uFE0F Using MISTRAL_API_KEY env var instead of key from user config`
@@ -264,10 +264,10 @@ var LocalizationError = (_class5 = class extends Error {
264
264
  constructor(message, context) {
265
265
  super(message);_class5.prototype.__init5.call(this);;
266
266
  this.name = "LocalizationError";
267
- this.bucket = _optionalChain([context, 'optionalAccess', _69 => _69.bucket]);
268
- this.sourceLocale = _optionalChain([context, 'optionalAccess', _70 => _70.sourceLocale]);
269
- this.targetLocale = _optionalChain([context, 'optionalAccess', _71 => _71.targetLocale]);
270
- this.pathPattern = _optionalChain([context, 'optionalAccess', _72 => _72.pathPattern]);
267
+ this.bucket = _optionalChain([context, 'optionalAccess', _70 => _70.bucket]);
268
+ this.sourceLocale = _optionalChain([context, 'optionalAccess', _71 => _71.sourceLocale]);
269
+ this.targetLocale = _optionalChain([context, 'optionalAccess', _72 => _72.targetLocale]);
270
+ this.pathPattern = _optionalChain([context, 'optionalAccess', _73 => _73.pathPattern]);
271
271
  }
272
272
  }, _class5);
273
273
  var BucketProcessingError = (_class6 = class extends Error {
@@ -403,7 +403,7 @@ function createAuthenticator(params) {
403
403
  });
404
404
  if (res.ok) {
405
405
  const payload = await res.json();
406
- if (!_optionalChain([payload, 'optionalAccess', _73 => _73.email])) {
406
+ if (!_optionalChain([payload, 'optionalAccess', _74 => _74.email])) {
407
407
  return null;
408
408
  }
409
409
  return {
@@ -598,7 +598,7 @@ async function renderSummary(results) {
598
598
  if (succeededResults.length > 0) {
599
599
  console.log(_chalk2.default.hex(colors.green)("\n[Processed Files]"));
600
600
  for (const result of succeededResults) {
601
- const displayPath = _optionalChain([result, 'access', _74 => _74.pathPattern, 'optionalAccess', _75 => _75.replace, 'call', _76 => _76("[locale]", result.targetLocale)]) || "unknown";
601
+ const displayPath = _optionalChain([result, 'access', _75 => _75.pathPattern, 'optionalAccess', _76 => _76.replace, 'call', _77 => _77("[locale]", result.targetLocale)]) || "unknown";
602
602
  console.log(
603
603
  ` \u2713 ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
604
604
  );
@@ -607,7 +607,7 @@ async function renderSummary(results) {
607
607
  if (skippedResults.length > 0) {
608
608
  console.log(_chalk2.default.hex(colors.blue)("\n[Cached Files]"));
609
609
  for (const result of skippedResults) {
610
- const displayPath = _optionalChain([result, 'access', _77 => _77.pathPattern, 'optionalAccess', _78 => _78.replace, 'call', _79 => _79("[locale]", result.targetLocale)]) || "unknown";
610
+ const displayPath = _optionalChain([result, 'access', _78 => _78.pathPattern, 'optionalAccess', _79 => _79.replace, 'call', _80 => _80("[locale]", result.targetLocale)]) || "unknown";
611
611
  console.log(
612
612
  ` \u26A1 ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
613
613
  );
@@ -616,12 +616,12 @@ async function renderSummary(results) {
616
616
  if (failedResults.length > 0) {
617
617
  console.log(_chalk2.default.hex(colors.orange)("\n[Failed Files]"));
618
618
  for (const result of failedResults) {
619
- const displayPath = _optionalChain([result, 'access', _80 => _80.pathPattern, 'optionalAccess', _81 => _81.replace, 'call', _82 => _82("[locale]", result.targetLocale)]) || "unknown";
619
+ const displayPath = _optionalChain([result, 'access', _81 => _81.pathPattern, 'optionalAccess', _82 => _82.replace, 'call', _83 => _83("[locale]", result.targetLocale)]) || "unknown";
620
620
  console.log(
621
621
  ` \u274C ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
622
622
  );
623
623
  console.log(
624
- ` ${_chalk2.default.hex(colors.white)(String(_optionalChain([result, 'access', _83 => _83.error, 'optionalAccess', _84 => _84.message]) || "Unknown error"))}`
624
+ ` ${_chalk2.default.hex(colors.white)(String(_optionalChain([result, 'access', _84 => _84.error, 'optionalAccess', _85 => _85.message]) || "Unknown error"))}`
625
625
  );
626
626
  }
627
627
  }
@@ -1267,7 +1267,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
1267
1267
  });
1268
1268
  const auth2 = await newAuthenticator.whoami();
1269
1269
  if (auth2) {
1270
- _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _85 => _85.email])}`);
1270
+ _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _86 => _86.email])}`);
1271
1271
  } else {
1272
1272
  _ora2.default.call(void 0, ).fail("Authentication failed.");
1273
1273
  }
@@ -1357,7 +1357,7 @@ function getBuckets(i18nConfig) {
1357
1357
  const includeItems = bucketEntry.include.map(
1358
1358
  (item) => resolveBucketItem(item)
1359
1359
  );
1360
- const excludeItems = _optionalChain([bucketEntry, 'access', _86 => _86.exclude, 'optionalAccess', _87 => _87.map, 'call', _88 => _88(
1360
+ const excludeItems = _optionalChain([bucketEntry, 'access', _87 => _87.exclude, 'optionalAccess', _88 => _88.map, 'call', _89 => _89(
1361
1361
  (item) => resolveBucketItem(item)
1362
1362
  )]);
1363
1363
  const config = {
@@ -1395,7 +1395,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
1395
1395
  delimiter: pattern.delimiter
1396
1396
  }))
1397
1397
  );
1398
- const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _89 => _89.flatMap, 'call', _90 => _90(
1398
+ const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _90 => _90.flatMap, 'call', _91 => _91(
1399
1399
  (pattern) => expandPlaceholderedGlob(
1400
1400
  pattern.path,
1401
1401
  __spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)
@@ -1561,12 +1561,12 @@ function composeLoaders(...loaders) {
1561
1561
  return {
1562
1562
  init: async () => {
1563
1563
  for (const loader of loaders) {
1564
- await _optionalChain([loader, 'access', _91 => _91.init, 'optionalCall', _92 => _92()]);
1564
+ await _optionalChain([loader, 'access', _92 => _92.init, 'optionalCall', _93 => _93()]);
1565
1565
  }
1566
1566
  },
1567
1567
  setDefaultLocale(locale) {
1568
1568
  for (const loader of loaders) {
1569
- _optionalChain([loader, 'access', _93 => _93.setDefaultLocale, 'optionalCall', _94 => _94(locale)]);
1569
+ _optionalChain([loader, 'access', _94 => _94.setDefaultLocale, 'optionalCall', _95 => _95(locale)]);
1570
1570
  }
1571
1571
  return this;
1572
1572
  },
@@ -1587,7 +1587,7 @@ function composeLoaders(...loaders) {
1587
1587
  pullHints: async (originalInput) => {
1588
1588
  let result = originalInput;
1589
1589
  for (let i = 0; i < loaders.length; i++) {
1590
- const subResult = await _optionalChain([loaders, 'access', _95 => _95[i], 'access', _96 => _96.pullHints, 'optionalCall', _97 => _97(result)]);
1590
+ const subResult = await _optionalChain([loaders, 'access', _96 => _96[i], 'access', _97 => _97.pullHints, 'optionalCall', _98 => _98(result)]);
1591
1591
  if (subResult) {
1592
1592
  result = subResult;
1593
1593
  }
@@ -1609,7 +1609,7 @@ function createLoader(lDefinition) {
1609
1609
  if (state.initCtx) {
1610
1610
  return state.initCtx;
1611
1611
  }
1612
- state.initCtx = await _optionalChain([lDefinition, 'access', _98 => _98.init, 'optionalCall', _99 => _99()]);
1612
+ state.initCtx = await _optionalChain([lDefinition, 'access', _99 => _99.init, 'optionalCall', _100 => _100()]);
1613
1613
  return state.initCtx;
1614
1614
  },
1615
1615
  setDefaultLocale(locale) {
@@ -1619,8 +1619,8 @@ function createLoader(lDefinition) {
1619
1619
  state.defaultLocale = locale;
1620
1620
  return this;
1621
1621
  },
1622
- async pullHints() {
1623
- return _optionalChain([lDefinition, 'access', _100 => _100.pullHints, 'optionalCall', _101 => _101(state.originalInput)]);
1622
+ async pullHints(originalInput) {
1623
+ return _optionalChain([lDefinition, 'access', _101 => _101.pullHints, 'optionalCall', _102 => _102(originalInput || state.originalInput)]);
1624
1624
  },
1625
1625
  async pull(locale, input2) {
1626
1626
  if (!state.defaultLocale) {
@@ -1906,7 +1906,7 @@ function createDenormalizeLoader(options) {
1906
1906
  const preservedObjects = {};
1907
1907
  const nonPreservedInput = {};
1908
1908
  for (const [key, value] of Object.entries(inputDenormalized)) {
1909
- if (_optionalChain([options, 'optionalAccess', _102 => _102.shouldPreserveObject, 'optionalCall', _103 => _103(value)])) {
1909
+ if (_optionalChain([options, 'optionalAccess', _103 => _103.shouldPreserveObject, 'optionalCall', _104 => _104(value)])) {
1910
1910
  preservedObjects[key] = value;
1911
1911
  } else {
1912
1912
  nonPreservedInput[key] = value;
@@ -1939,7 +1939,7 @@ function createNormalizeLoader() {
1939
1939
  return normalized;
1940
1940
  },
1941
1941
  push: async (locale, data, originalInput) => {
1942
- const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _104 => _104.keysMap]), () => ( {}));
1942
+ const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _105 => _105.keysMap]), () => ( {}));
1943
1943
  const input2 = mapDenormalizedKeys(data, keysMap);
1944
1944
  const denormalized = _flat.unflatten.call(void 0, input2, {
1945
1945
  delimiter: "/",
@@ -2040,7 +2040,7 @@ function createTextFileLoader(pathPattern) {
2040
2040
  const trimmedResult = result.trim();
2041
2041
  return trimmedResult;
2042
2042
  },
2043
- async push(locale, data, _36, originalLocale) {
2043
+ async push(locale, data, _37, originalLocale) {
2044
2044
  const draftPath = pathPattern.replaceAll("[locale]", locale);
2045
2045
  const finalPath = path14.default.resolve(draftPath);
2046
2046
  const dirPath = path14.default.dirname(finalPath);
@@ -2073,8 +2073,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
2073
2073
  if (!templateData) {
2074
2074
  templateData = await readFileForLocale(pathPattern, originalLocale);
2075
2075
  }
2076
- if (_optionalChain([templateData, 'optionalAccess', _105 => _105.match, 'call', _106 => _106(/[\r\n]$/)])) {
2077
- const ending = _optionalChain([templateData, 'optionalAccess', _107 => _107.includes, 'call', _108 => _108("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _109 => _109.includes, 'call', _110 => _110("\r")]) ? "\r" : "\n";
2076
+ if (_optionalChain([templateData, 'optionalAccess', _106 => _106.match, 'call', _107 => _107(/[\r\n]$/)])) {
2077
+ const ending = _optionalChain([templateData, 'optionalAccess', _108 => _108.includes, 'call', _109 => _109("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _110 => _110.includes, 'call', _111 => _111("\r")]) ? "\r" : "\n";
2078
2078
  return ending;
2079
2079
  }
2080
2080
  return "";
@@ -2268,7 +2268,7 @@ async function parseAndroidDocument(input2) {
2268
2268
  const resourceNodes = [];
2269
2269
  let metaIndex = 0;
2270
2270
  for (const child of resourcesNode.$$) {
2271
- const elementName = _optionalChain([child, 'optionalAccess', _111 => _111["#name"]]);
2271
+ const elementName = _optionalChain([child, 'optionalAccess', _112 => _112["#name"]]);
2272
2272
  if (!isResourceElementName(elementName)) {
2273
2273
  continue;
2274
2274
  }
@@ -2276,11 +2276,11 @@ async function parseAndroidDocument(input2) {
2276
2276
  if (!meta || meta.type !== elementName) {
2277
2277
  continue;
2278
2278
  }
2279
- const name = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _112 => _112.$, 'optionalAccess', _113 => _113.name]), () => ( meta.name));
2279
+ const name = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _113 => _113.$, 'optionalAccess', _114 => _114.name]), () => ( meta.name));
2280
2280
  if (!name) {
2281
2281
  continue;
2282
2282
  }
2283
- const translatable = (_nullishCoalesce(_optionalChain([child, 'optionalAccess', _114 => _114.$, 'optionalAccess', _115 => _115.translatable]), () => ( ""))).toLowerCase() !== "false";
2283
+ const translatable = (_nullishCoalesce(_optionalChain([child, 'optionalAccess', _115 => _115.$, 'optionalAccess', _116 => _116.translatable]), () => ( ""))).toLowerCase() !== "false";
2284
2284
  switch (meta.type) {
2285
2285
  case "string": {
2286
2286
  resourceNodes.push({
@@ -2293,7 +2293,7 @@ async function parseAndroidDocument(input2) {
2293
2293
  break;
2294
2294
  }
2295
2295
  case "string-array": {
2296
- const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _116 => _116.item]), () => ( []));
2296
+ const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _117 => _117.item]), () => ( []));
2297
2297
  const items = [];
2298
2298
  const templateItems = meta.items;
2299
2299
  for (let i = 0; i < Math.max(itemNodes.length, templateItems.length); i++) {
@@ -2317,7 +2317,7 @@ async function parseAndroidDocument(input2) {
2317
2317
  break;
2318
2318
  }
2319
2319
  case "plurals": {
2320
- const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _117 => _117.item]), () => ( []));
2320
+ const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _118 => _118.item]), () => ( []));
2321
2321
  const templateItems = meta.items;
2322
2322
  const items = [];
2323
2323
  for (const templateItem of templateItems) {
@@ -2326,7 +2326,7 @@ async function parseAndroidDocument(input2) {
2326
2326
  continue;
2327
2327
  }
2328
2328
  const nodeItem = itemNodes.find(
2329
- (item) => _optionalChain([item, 'optionalAccess', _118 => _118.$, 'optionalAccess', _119 => _119.quantity]) === quantity
2329
+ (item) => _optionalChain([item, 'optionalAccess', _119 => _119.$, 'optionalAccess', _120 => _120.quantity]) === quantity
2330
2330
  );
2331
2331
  if (!nodeItem) {
2332
2332
  continue;
@@ -2607,7 +2607,7 @@ function cloneResourceNode(resource) {
2607
2607
  const nodeClone = deepClone(resource.node);
2608
2608
  const itemNodes = _nullishCoalesce(nodeClone.item, () => ( []));
2609
2609
  const items = itemNodes.map((itemNode, index) => {
2610
- const templateMeta = _nullishCoalesce(_nullishCoalesce(_optionalChain([resource, 'access', _120 => _120.items, 'access', _121 => _121[index], 'optionalAccess', _122 => _122.meta]), () => ( _optionalChain([resource, 'access', _123 => _123.items, 'access', _124 => _124[resource.items.length - 1], 'optionalAccess', _125 => _125.meta]))), () => ( makeTextMeta([])));
2610
+ const templateMeta = _nullishCoalesce(_nullishCoalesce(_optionalChain([resource, 'access', _121 => _121.items, 'access', _122 => _122[index], 'optionalAccess', _123 => _123.meta]), () => ( _optionalChain([resource, 'access', _124 => _124.items, 'access', _125 => _125[resource.items.length - 1], 'optionalAccess', _126 => _126.meta]))), () => ( makeTextMeta([])));
2611
2611
  return {
2612
2612
  node: itemNode,
2613
2613
  meta: cloneTextMeta(templateMeta)
@@ -2627,7 +2627,7 @@ function cloneResourceNode(resource) {
2627
2627
  const items = [];
2628
2628
  for (const templateItem of resource.items) {
2629
2629
  const cloneNode = itemNodes.find(
2630
- (item) => _optionalChain([item, 'optionalAccess', _126 => _126.$, 'optionalAccess', _127 => _127.quantity]) === templateItem.quantity
2630
+ (item) => _optionalChain([item, 'optionalAccess', _127 => _127.$, 'optionalAccess', _128 => _128.quantity]) === templateItem.quantity
2631
2631
  );
2632
2632
  if (!cloneNode) {
2633
2633
  continue;
@@ -2883,8 +2883,8 @@ function cloneDocumentStructure(document) {
2883
2883
  resourceNodes.map((r) => resourceLookupKey(r.type, r.name))
2884
2884
  );
2885
2885
  let filtered = resourcesClone.$$.filter((child) => {
2886
- const elementName = _optionalChain([child, 'optionalAccess', _128 => _128["#name"]]);
2887
- const name = _optionalChain([child, 'optionalAccess', _129 => _129.$, 'optionalAccess', _130 => _130.name]);
2886
+ const elementName = _optionalChain([child, 'optionalAccess', _129 => _129["#name"]]);
2887
+ const name = _optionalChain([child, 'optionalAccess', _130 => _130.$, 'optionalAccess', _131 => _131.name]);
2888
2888
  if (!isResourceElementName(elementName) || !name) {
2889
2889
  return true;
2890
2890
  }
@@ -2893,7 +2893,7 @@ function cloneDocumentStructure(document) {
2893
2893
  const cleaned = [];
2894
2894
  let lastWasWhitespace = false;
2895
2895
  for (const child of filtered) {
2896
- const isWhitespace = _optionalChain([child, 'optionalAccess', _131 => _131["#name"]]) === "__text__" && (!child._ || child._.trim() === "");
2896
+ const isWhitespace = _optionalChain([child, 'optionalAccess', _132 => _132["#name"]]) === "__text__" && (!child._ || child._.trim() === "");
2897
2897
  if (isWhitespace) {
2898
2898
  if (!lastWasWhitespace) {
2899
2899
  cleaned.push(child);
@@ -2915,8 +2915,8 @@ function buildResourceLookup(resources) {
2915
2915
  const lookup = /* @__PURE__ */ new Map();
2916
2916
  const children = Array.isArray(resources.$$) ? resources.$$ : [];
2917
2917
  for (const child of children) {
2918
- const type = _optionalChain([child, 'optionalAccess', _132 => _132["#name"]]);
2919
- const name = _optionalChain([child, 'optionalAccess', _133 => _133.$, 'optionalAccess', _134 => _134.name]);
2918
+ const type = _optionalChain([child, 'optionalAccess', _133 => _133["#name"]]);
2919
+ const name = _optionalChain([child, 'optionalAccess', _134 => _134.$, 'optionalAccess', _135 => _135.name]);
2920
2920
  if (!type || !name || !isResourceElementName(type)) {
2921
2921
  continue;
2922
2922
  }
@@ -2945,7 +2945,7 @@ function cloneResourceNodeFromLookup(resource, lookup) {
2945
2945
  }
2946
2946
  case "string-array": {
2947
2947
  const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
2948
- (child) => _optionalChain([child, 'optionalAccess', _135 => _135["#name"]]) === "item"
2948
+ (child) => _optionalChain([child, 'optionalAccess', _136 => _136["#name"]]) === "item"
2949
2949
  );
2950
2950
  node.item = childItems;
2951
2951
  if (childItems.length < resource.items.length) {
@@ -2974,12 +2974,12 @@ function cloneResourceNodeFromLookup(resource, lookup) {
2974
2974
  }
2975
2975
  case "plurals": {
2976
2976
  const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
2977
- (child) => _optionalChain([child, 'optionalAccess', _136 => _136["#name"]]) === "item"
2977
+ (child) => _optionalChain([child, 'optionalAccess', _137 => _137["#name"]]) === "item"
2978
2978
  );
2979
2979
  node.item = childItems;
2980
2980
  const itemMap = /* @__PURE__ */ new Map();
2981
2981
  for (const item of childItems) {
2982
- if (_optionalChain([item, 'optionalAccess', _137 => _137.$, 'optionalAccess', _138 => _138.quantity])) {
2982
+ if (_optionalChain([item, 'optionalAccess', _138 => _138.$, 'optionalAccess', _139 => _139.quantity])) {
2983
2983
  itemMap.set(item.$.quantity, item);
2984
2984
  }
2985
2985
  }
@@ -3269,7 +3269,7 @@ var _sync3 = require('csv-stringify/sync');
3269
3269
 
3270
3270
  function detectKeyColumnName(csvString) {
3271
3271
  const row = _sync.parse.call(void 0, csvString)[0];
3272
- const firstColumn = _optionalChain([row, 'optionalAccess', _139 => _139[0], 'optionalAccess', _140 => _140.trim, 'call', _141 => _141()]);
3272
+ const firstColumn = _optionalChain([row, 'optionalAccess', _140 => _140[0], 'optionalAccess', _141 => _141.trim, 'call', _142 => _142()]);
3273
3273
  return firstColumn || "KEY";
3274
3274
  }
3275
3275
  function createCsvLoader() {
@@ -3371,7 +3371,7 @@ function createHtmlLoader() {
3371
3371
  break;
3372
3372
  }
3373
3373
  const siblings = Array.from(parent.childNodes).filter(
3374
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _142 => _142.textContent, 'optionalAccess', _143 => _143.trim, 'call', _144 => _144()])
3374
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _143 => _143.textContent, 'optionalAccess', _144 => _144.trim, 'call', _145 => _145()])
3375
3375
  );
3376
3376
  const index = siblings.indexOf(current);
3377
3377
  if (index !== -1) {
@@ -3407,15 +3407,15 @@ function createHtmlLoader() {
3407
3407
  }
3408
3408
  });
3409
3409
  Array.from(element.childNodes).filter(
3410
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _145 => _145.textContent, 'optionalAccess', _146 => _146.trim, 'call', _147 => _147()])
3410
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _146 => _146.textContent, 'optionalAccess', _147 => _147.trim, 'call', _148 => _148()])
3411
3411
  ).forEach(processNode);
3412
3412
  }
3413
3413
  };
3414
3414
  Array.from(document.head.childNodes).filter(
3415
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _148 => _148.textContent, 'optionalAccess', _149 => _149.trim, 'call', _150 => _150()])
3415
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _149 => _149.textContent, 'optionalAccess', _150 => _150.trim, 'call', _151 => _151()])
3416
3416
  ).forEach(processNode);
3417
3417
  Array.from(document.body.childNodes).filter(
3418
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _151 => _151.textContent, 'optionalAccess', _152 => _152.trim, 'call', _153 => _153()])
3418
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _152 => _152.textContent, 'optionalAccess', _153 => _153.trim, 'call', _154 => _154()])
3419
3419
  ).forEach(processNode);
3420
3420
  return result;
3421
3421
  },
@@ -3440,7 +3440,7 @@ function createHtmlLoader() {
3440
3440
  for (let i = 0; i < indices.length; i++) {
3441
3441
  const index = parseInt(indices[i]);
3442
3442
  const siblings = Array.from(parent.childNodes).filter(
3443
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _154 => _154.textContent, 'optionalAccess', _155 => _155.trim, 'call', _156 => _156()])
3443
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _155 => _155.textContent, 'optionalAccess', _156 => _156.trim, 'call', _157 => _157()])
3444
3444
  );
3445
3445
  if (index >= siblings.length) {
3446
3446
  if (i === indices.length - 1) {
@@ -3491,7 +3491,7 @@ function createMarkdownLoader() {
3491
3491
  yaml: yamlEngine
3492
3492
  }
3493
3493
  });
3494
- const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _157 => _157.trim, 'call', _158 => _158()]), () => ( ""))).filter(Boolean);
3494
+ const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _158 => _158.trim, 'call', _159 => _159()]), () => ( ""))).filter(Boolean);
3495
3495
  return {
3496
3496
  ...Object.fromEntries(
3497
3497
  sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
@@ -3510,7 +3510,7 @@ function createMarkdownLoader() {
3510
3510
  );
3511
3511
  let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
3512
3512
  ([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
3513
- ).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _159 => _159.trim, 'call', _160 => _160()]), () => ( ""))).filter(Boolean).join("\n\n");
3513
+ ).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _160 => _160.trim, 'call', _161 => _161()]), () => ( ""))).filter(Boolean).join("\n\n");
3514
3514
  if (Object.keys(frontmatter).length > 0) {
3515
3515
  content = `
3516
3516
  ${content}`;
@@ -3535,7 +3535,7 @@ function createMarkdocLoader() {
3535
3535
  const result = {};
3536
3536
  const counters = {};
3537
3537
  traverseAndExtract(ast, "", result, counters);
3538
- if (_optionalChain([ast, 'access', _161 => _161.attributes, 'optionalAccess', _162 => _162.frontmatter])) {
3538
+ if (_optionalChain([ast, 'access', _162 => _162.attributes, 'optionalAccess', _163 => _163.frontmatter])) {
3539
3539
  const frontmatter = _yaml2.default.parse(ast.attributes.frontmatter);
3540
3540
  Object.entries(frontmatter).forEach(([key, value]) => {
3541
3541
  if (typeof value === "string") {
@@ -3581,7 +3581,7 @@ function traverseAndExtract(node, path19, result, counters, parentType) {
3581
3581
  if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
3582
3582
  semanticType = nodeSemanticType;
3583
3583
  }
3584
- if (node.type === "text" && _optionalChain([node, 'access', _163 => _163.attributes, 'optionalAccess', _164 => _164.content])) {
3584
+ if (node.type === "text" && _optionalChain([node, 'access', _164 => _164.attributes, 'optionalAccess', _165 => _165.content])) {
3585
3585
  const content = node.attributes.content;
3586
3586
  if (typeof content === "string" && content.trim()) {
3587
3587
  if (semanticType) {
@@ -3608,7 +3608,7 @@ function buildPathMap(node, path19, counters, pathMap, parentType) {
3608
3608
  if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
3609
3609
  semanticType = nodeSemanticType;
3610
3610
  }
3611
- if (node.type === "text" && _optionalChain([node, 'access', _165 => _165.attributes, 'optionalAccess', _166 => _166.content])) {
3611
+ if (node.type === "text" && _optionalChain([node, 'access', _166 => _166.attributes, 'optionalAccess', _167 => _167.content])) {
3612
3612
  const content = node.attributes.content;
3613
3613
  if (typeof content === "string" && content.trim()) {
3614
3614
  if (semanticType) {
@@ -3631,7 +3631,7 @@ function applyTranslations(node, path19, data, pathMap) {
3631
3631
  if (!node || typeof node !== "object") {
3632
3632
  return;
3633
3633
  }
3634
- if (node.type === "text" && _optionalChain([node, 'access', _167 => _167.attributes, 'optionalAccess', _168 => _168.content])) {
3634
+ if (node.type === "text" && _optionalChain([node, 'access', _168 => _168.attributes, 'optionalAccess', _169 => _169.content])) {
3635
3635
  const content = node.attributes.content;
3636
3636
  if (typeof content === "string") {
3637
3637
  const contentPath = path19 ? `${path19}/attributes/content` : "attributes/content";
@@ -3670,7 +3670,7 @@ function createPropertiesLoader() {
3670
3670
  return result;
3671
3671
  },
3672
3672
  async push(locale, payload) {
3673
- const result = Object.entries(payload).filter(([_36, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
3673
+ const result = Object.entries(payload).filter(([_37, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
3674
3674
  return result;
3675
3675
  }
3676
3676
  });
@@ -3681,7 +3681,7 @@ function isSkippableLine(line) {
3681
3681
  function parsePropertyLine(line) {
3682
3682
  const [key, ...valueParts] = line.split("=");
3683
3683
  return {
3684
- key: _optionalChain([key, 'optionalAccess', _169 => _169.trim, 'call', _170 => _170()]) || "",
3684
+ key: _optionalChain([key, 'optionalAccess', _170 => _170.trim, 'call', _171 => _171()]) || "",
3685
3685
  value: valueParts.join("=").trim()
3686
3686
  };
3687
3687
  }
@@ -3973,7 +3973,7 @@ var Parser = class {
3973
3973
  }
3974
3974
  }
3975
3975
  expect(type) {
3976
- if (_optionalChain([this, 'access', _171 => _171.current, 'call', _172 => _172(), 'optionalAccess', _173 => _173.type]) === type) {
3976
+ if (_optionalChain([this, 'access', _172 => _172.current, 'call', _173 => _173(), 'optionalAccess', _174 => _174.type]) === type) {
3977
3977
  this.advance();
3978
3978
  return true;
3979
3979
  }
@@ -3992,7 +3992,7 @@ function createXcodeStringsLoader() {
3992
3992
  return result;
3993
3993
  },
3994
3994
  async push(locale, payload) {
3995
- const lines = Object.entries(payload).filter(([_36, value]) => value != null).map(([key, value]) => {
3995
+ const lines = Object.entries(payload).filter(([_37, value]) => value != null).map(([key, value]) => {
3996
3996
  const escapedValue = escapeString(value);
3997
3997
  return `"${key}" = "${escapedValue}";`;
3998
3998
  });
@@ -4050,7 +4050,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4050
4050
  if (rootTranslationEntity.shouldTranslate === false) {
4051
4051
  continue;
4052
4052
  }
4053
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _174 => _174.localizations, 'optionalAccess', _175 => _175[locale]]);
4053
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _175 => _175.localizations, 'optionalAccess', _176 => _176[locale]]);
4054
4054
  if (langTranslationEntity) {
4055
4055
  if ("stringUnit" in langTranslationEntity) {
4056
4056
  resultData[translationKey] = langTranslationEntity.stringUnit.value;
@@ -4064,7 +4064,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4064
4064
  resultData[translationKey] = {};
4065
4065
  const pluralForms = langTranslationEntity.variations.plural;
4066
4066
  for (const form in pluralForms) {
4067
- if (_optionalChain([pluralForms, 'access', _176 => _176[form], 'optionalAccess', _177 => _177.stringUnit, 'optionalAccess', _178 => _178.value])) {
4067
+ if (_optionalChain([pluralForms, 'access', _177 => _177[form], 'optionalAccess', _178 => _178.stringUnit, 'optionalAccess', _179 => _179.value])) {
4068
4068
  resultData[translationKey][form] = pluralForms[form].stringUnit.value;
4069
4069
  }
4070
4070
  }
@@ -4090,7 +4090,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4090
4090
  const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
4091
4091
  if (typeof value === "string") {
4092
4092
  langDataToMerge.strings[key] = {
4093
- extractionState: _optionalChain([originalInput, 'optionalAccess', _179 => _179.strings, 'optionalAccess', _180 => _180[key], 'optionalAccess', _181 => _181.extractionState]),
4093
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _180 => _180.strings, 'optionalAccess', _181 => _181[key], 'optionalAccess', _182 => _182.extractionState]),
4094
4094
  localizations: {
4095
4095
  [locale]: {
4096
4096
  stringUnit: {
@@ -4105,7 +4105,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4105
4105
  }
4106
4106
  } else if (Array.isArray(value)) {
4107
4107
  langDataToMerge.strings[key] = {
4108
- extractionState: _optionalChain([originalInput, 'optionalAccess', _182 => _182.strings, 'optionalAccess', _183 => _183[key], 'optionalAccess', _184 => _184.extractionState]),
4108
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _183 => _183.strings, 'optionalAccess', _184 => _184[key], 'optionalAccess', _185 => _185.extractionState]),
4109
4109
  localizations: {
4110
4110
  [locale]: {
4111
4111
  stringSet: {
@@ -4163,7 +4163,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4163
4163
  for (const [locale, localization] of Object.entries(
4164
4164
  entity.localizations
4165
4165
  )) {
4166
- if (_optionalChain([localization, 'access', _185 => _185.variations, 'optionalAccess', _186 => _186.plural])) {
4166
+ if (_optionalChain([localization, 'access', _186 => _186.variations, 'optionalAccess', _187 => _187.plural])) {
4167
4167
  const pluralForms = localization.variations.plural;
4168
4168
  for (const form in pluralForms) {
4169
4169
  const pluralKey = `${translationKey}/${form}`;
@@ -4183,225 +4183,53 @@ function _removeLocale(input2, locale) {
4183
4183
  const { strings } = input2;
4184
4184
  const newStrings = _lodash2.default.cloneDeep(strings);
4185
4185
  for (const [key, value] of Object.entries(newStrings)) {
4186
- if (_optionalChain([value, 'access', _187 => _187.localizations, 'optionalAccess', _188 => _188[locale]])) {
4186
+ if (_optionalChain([value, 'access', _188 => _188.localizations, 'optionalAccess', _189 => _189[locale]])) {
4187
4187
  delete value.localizations[locale];
4188
4188
  }
4189
4189
  }
4190
4190
  return { ...input2, strings: newStrings };
4191
4191
  }
4192
4192
 
4193
- // src/cli/loaders/xcode-xcstrings-icu.ts
4194
- var ICU_TYPE_MARKER = Symbol.for("@lingo.dev/icu-plural-object");
4195
- var CLDR_PLURAL_CATEGORIES = /* @__PURE__ */ new Set([
4196
- "zero",
4197
- "one",
4198
- "two",
4199
- "few",
4200
- "many",
4201
- "other"
4202
- ]);
4203
- function isICUPluralObject(value) {
4204
- if (!value || typeof value !== "object" || Array.isArray(value)) {
4205
- return false;
4206
- }
4207
- if (ICU_TYPE_MARKER in value) {
4208
- return true;
4209
- }
4210
- if (!("icu" in value) || typeof value.icu !== "string") {
4211
- return false;
4212
- }
4213
- const icuPluralPattern = /^\{[\w]+,\s*plural,\s*.+\}$/;
4214
- if (!icuPluralPattern.test(value.icu)) {
4215
- return false;
4216
- }
4217
- if (value._meta !== void 0) {
4218
- if (typeof value._meta !== "object" || !value._meta.variables || typeof value._meta.variables !== "object") {
4219
- return false;
4220
- }
4221
- for (const [varName, varMeta] of Object.entries(value._meta.variables)) {
4222
- if (!varMeta || typeof varMeta !== "object" || typeof varMeta.format !== "string" || varMeta.role !== "plural" && varMeta.role !== "other") {
4223
- return false;
4224
- }
4225
- }
4226
- }
4227
- return true;
4228
- }
4229
- function isPluralFormsObject(value) {
4230
- if (!value || typeof value !== "object" || Array.isArray(value)) {
4231
- return false;
4232
- }
4233
- const keys = Object.keys(value);
4234
- if (keys.length === 0) {
4235
- return false;
4236
- }
4237
- const allKeysAreCldr = keys.every((key) => CLDR_PLURAL_CATEGORIES.has(key));
4238
- if (!allKeysAreCldr) {
4239
- return false;
4240
- }
4241
- const allValuesAreStrings = keys.every(
4242
- (key) => typeof value[key] === "string"
4243
- );
4244
- if (!allValuesAreStrings) {
4245
- return false;
4246
- }
4247
- if (!("other" in value)) {
4248
- return false;
4249
- }
4250
- return true;
4251
- }
4193
+ // src/cli/loaders/xcode-xcstrings-v2.ts
4194
+
4252
4195
  function getRequiredPluralCategories(locale) {
4253
4196
  try {
4254
4197
  const pluralRules = new Intl.PluralRules(locale);
4255
4198
  const categories = pluralRules.resolvedOptions().pluralCategories;
4256
4199
  if (!categories || categories.length === 0) {
4257
- throw new Error(`No plural categories found for locale: ${locale}`);
4200
+ return ["other"];
4258
4201
  }
4259
4202
  return categories;
4260
4203
  } catch (error) {
4261
- console.warn(
4262
- `[xcode-xcstrings-icu] Failed to resolve plural categories for locale "${locale}". Using fallback ["one", "other"]. Error: ${error instanceof Error ? error.message : String(error)}`
4263
- );
4264
- return ["one", "other"];
4204
+ return ["other"];
4265
4205
  }
4266
4206
  }
4267
- var CLDR_CATEGORY_TO_NUMBER = {
4268
- zero: 0,
4269
- one: 1,
4270
- two: 2
4271
- };
4272
- var NUMBER_TO_CLDR_CATEGORY = {
4273
- 0: "zero",
4274
- 1: "one",
4275
- 2: "two"
4276
- };
4277
- function xcstringsToPluralWithMeta(pluralForms, sourceLocale = "en") {
4278
- if (!pluralForms || Object.keys(pluralForms).length === 0) {
4279
- throw new Error("pluralForms cannot be empty");
4280
- }
4281
- const requiredCategories = getRequiredPluralCategories(sourceLocale);
4282
- const variables = {};
4283
- const formatRegex = /(%(?:(\d+)\$)?(?:[+-])?(?:\d+)?(?:\.(\d+))?([lhqLzjt]*)([diuoxXfFeEgGaAcspn@]))/g;
4284
- let maxMatches = [];
4285
- let maxMatchText = "";
4286
- for (const [form, text] of Object.entries(pluralForms)) {
4287
- if (typeof text !== "string") {
4288
- console.warn(
4289
- `Warning: Plural form "${form}" has non-string value:`,
4290
- text
4291
- );
4292
- continue;
4293
- }
4294
- const matches = [...text.matchAll(formatRegex)];
4295
- if (matches.length > maxMatches.length) {
4296
- maxMatches = matches;
4297
- maxMatchText = text;
4298
- }
4299
- }
4300
- let lastNumericIndex = -1;
4301
- maxMatches.forEach((match2, idx) => {
4302
- const specifier = match2[5];
4303
- if (/[diuoxXfFeE]/.test(specifier)) {
4304
- lastNumericIndex = idx;
4207
+ function isValidPluralForm(form, locale) {
4208
+ if (form.startsWith("=")) return true;
4209
+ const requiredCategories = getRequiredPluralCategories(locale);
4210
+ return requiredCategories.includes(form);
4211
+ }
4212
+ function buildIcuPluralString(forms, sourceLocale) {
4213
+ const requiredCategories = new Set(getRequiredPluralCategories(sourceLocale));
4214
+ const parts = Object.entries(forms).map(([form, text]) => {
4215
+ let normalizedForm = form;
4216
+ if (!requiredCategories.has(form)) {
4217
+ if (form === "zero") normalizedForm = "=0";
4218
+ else if (form === "one") normalizedForm = "=1";
4219
+ else if (form === "two") normalizedForm = "=2";
4305
4220
  }
4221
+ return `${normalizedForm} {${text}}`;
4306
4222
  });
4307
- let nonPluralCounter = 0;
4308
- maxMatches.forEach((match2, idx) => {
4309
- const fullFormat = match2[1];
4310
- const position = match2[2];
4311
- const precision = match2[3];
4312
- const lengthMod = match2[4];
4313
- const specifier = match2[5];
4314
- const isPluralVar = idx === lastNumericIndex;
4315
- const varName = isPluralVar ? "count" : `var${nonPluralCounter++}`;
4316
- variables[varName] = {
4317
- format: fullFormat,
4318
- role: isPluralVar ? "plural" : "other"
4319
- };
4320
- });
4321
- const variableKeys = Object.keys(variables);
4322
- const icuForms = Object.entries(pluralForms).filter(([form, text]) => {
4323
- if (typeof text !== "string") {
4324
- return false;
4325
- }
4326
- return true;
4327
- }).map(([form, text]) => {
4328
- let processed = text;
4329
- let vIdx = 0;
4330
- processed = processed.replace(formatRegex, () => {
4331
- if (vIdx >= variableKeys.length) {
4332
- vIdx++;
4333
- return "#";
4334
- }
4335
- const varName = variableKeys[vIdx];
4336
- const varMeta = variables[varName];
4337
- vIdx++;
4338
- if (varMeta.role === "plural") {
4339
- return "#";
4340
- } else {
4341
- return `{${varName}}`;
4342
- }
4343
- });
4344
- const isRequired = requiredCategories.includes(form);
4345
- const formKey = !isRequired && form in CLDR_CATEGORY_TO_NUMBER ? `=${CLDR_CATEGORY_TO_NUMBER[form]}` : form;
4346
- return `${formKey} {${processed}}`;
4347
- }).join(" ");
4348
- const pluralVarName = Object.keys(variables).find((name) => variables[name].role === "plural") || "count";
4349
- const icu = `{${pluralVarName}, plural, ${icuForms}}`;
4350
- const result = {
4351
- icu,
4352
- _meta: Object.keys(variables).length > 0 ? { variables } : void 0,
4353
- [ICU_TYPE_MARKER]: true
4354
- // Add type marker for robust detection
4355
- };
4356
- return result;
4223
+ return `{count, plural, ${parts.join(" ")}}`;
4357
4224
  }
4358
- function pluralWithMetaToXcstrings(data) {
4359
- if (!data.icu) {
4360
- throw new Error("ICU string is required");
4361
- }
4362
- const ast = parseICU(data.icu);
4363
- if (!ast || ast.length === 0) {
4364
- throw new Error("Invalid ICU format");
4365
- }
4366
- const pluralNode = ast.find((node) => node.type === "plural");
4367
- if (!pluralNode) {
4368
- throw new Error("No plural found in ICU format");
4225
+ function parseIcuPluralString(icuString, locale) {
4226
+ const pluralMatch = icuString.match(/\{[\w]+,\s*plural,\s*(.+)\}$/);
4227
+ if (!pluralMatch) {
4228
+ throw new Error(`Invalid ICU plural format: ${icuString}`);
4369
4229
  }
4230
+ const formsText = pluralMatch[1];
4370
4231
  const forms = {};
4371
- for (const [form, option] of Object.entries(pluralNode.options)) {
4372
- let text = "";
4373
- const optionValue = option.value;
4374
- for (const element of optionValue) {
4375
- if (element.type === "literal") {
4376
- text += element.value;
4377
- } else if (element.type === "pound") {
4378
- const pluralVar = Object.entries(_optionalChain([data, 'access', _189 => _189._meta, 'optionalAccess', _190 => _190.variables]) || {}).find(
4379
- ([_36, meta]) => meta.role === "plural"
4380
- );
4381
- text += _optionalChain([pluralVar, 'optionalAccess', _191 => _191[1], 'access', _192 => _192.format]) || "%lld";
4382
- } else if (element.type === "argument") {
4383
- const varName = element.value;
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]) || "%@";
4386
- }
4387
- }
4388
- let xcstringsFormName = form;
4389
- if (form.startsWith("=")) {
4390
- const numValue = parseInt(form.substring(1), 10);
4391
- xcstringsFormName = NUMBER_TO_CLDR_CATEGORY[numValue] || form;
4392
- }
4393
- forms[xcstringsFormName] = text;
4394
- }
4395
- return forms;
4396
- }
4397
- function parseICU(icu) {
4398
- const match2 = icu.match(/\{(\w+),\s*plural,\s*(.+)\}$/);
4399
- if (!match2) {
4400
- throw new Error("Invalid ICU plural format");
4401
- }
4402
- const varName = match2[1];
4403
- const formsText = match2[2];
4404
- const options = {};
4232
+ const exactMatches = /* @__PURE__ */ new Set();
4405
4233
  let i = 0;
4406
4234
  while (i < formsText.length) {
4407
4235
  while (i < formsText.length && /\s/.test(formsText[i])) {
@@ -4423,6 +4251,16 @@ function parseICU(icu) {
4423
4251
  }
4424
4252
  }
4425
4253
  if (!formName) break;
4254
+ if (formName === "=0") {
4255
+ formName = "zero";
4256
+ exactMatches.add("zero");
4257
+ } else if (formName === "=1") {
4258
+ formName = "one";
4259
+ exactMatches.add("one");
4260
+ } else if (formName === "=2") {
4261
+ formName = "two";
4262
+ exactMatches.add("two");
4263
+ }
4426
4264
  while (i < formsText.length && /\s/.test(formsText[i])) {
4427
4265
  i++;
4428
4266
  }
@@ -4447,119 +4285,204 @@ function parseICU(icu) {
4447
4285
  i++;
4448
4286
  }
4449
4287
  if (braceCount !== 0) {
4450
- const preview = formsText.substring(
4451
- Math.max(0, i - 50),
4452
- Math.min(formsText.length, i + 50)
4453
- );
4454
4288
  throw new Error(
4455
- `Unclosed brace for form '${formName}' in ICU MessageFormat.
4456
- Expected ${braceCount} more closing brace(s).
4457
- Context: ...${preview}...
4458
- Full ICU: {${varName}, plural, ${formsText}}`
4289
+ `Unclosed brace for form '${formName}' in ICU: ${icuString}`
4459
4290
  );
4460
4291
  }
4461
- const elements = parseFormText(formText);
4462
- options[formName] = {
4463
- value: elements
4464
- };
4292
+ forms[formName] = formText;
4465
4293
  }
4466
- return [
4467
- {
4468
- type: "plural",
4469
- value: varName,
4470
- options
4294
+ const filteredForms = {};
4295
+ for (const [form, text] of Object.entries(forms)) {
4296
+ if (exactMatches.has(form) || isValidPluralForm(form, locale)) {
4297
+ filteredForms[form] = text;
4471
4298
  }
4472
- ];
4473
- }
4474
- function parseFormText(text) {
4475
- const elements = [];
4476
- let currentText = "";
4477
- let i = 0;
4478
- while (i < text.length) {
4479
- if (text[i] === "#") {
4480
- if (currentText) {
4481
- elements.push({ type: "literal", value: currentText });
4482
- currentText = "";
4483
- }
4484
- elements.push({ type: "pound" });
4485
- i++;
4486
- } else if (text[i] === "{") {
4487
- if (currentText) {
4488
- elements.push({ type: "literal", value: currentText });
4489
- currentText = "";
4490
- }
4491
- let braceCount = 1;
4492
- let j = i + 1;
4493
- while (j < text.length && braceCount > 0) {
4494
- if (text[j] === "{") {
4495
- braceCount++;
4496
- } else if (text[j] === "}") {
4497
- braceCount--;
4498
- }
4499
- j++;
4500
- }
4501
- if (braceCount !== 0) {
4502
- throw new Error("Unclosed variable reference");
4503
- }
4504
- const varName = text.slice(i + 1, j - 1);
4505
- elements.push({ type: "argument", value: varName });
4506
- i = j;
4507
- } else {
4508
- currentText += text[i];
4509
- i++;
4510
- }
4511
- }
4512
- if (currentText) {
4513
- elements.push({ type: "literal", value: currentText });
4514
4299
  }
4515
- return elements;
4300
+ return filteredForms;
4516
4301
  }
4517
-
4518
- // src/cli/loaders/xcode-xcstrings-v2-loader.ts
4519
- function createXcodeXcstringsV2Loader(defaultLocale = "en") {
4302
+ function isIcuPluralString(value) {
4303
+ return typeof value === "string" && /^\{[\w]+,\s*plural,\s*.+\}$/.test(value);
4304
+ }
4305
+ function createXcodeXcstringsV2Loader(defaultLocale) {
4520
4306
  return createLoader({
4521
- async pull(locale, input2) {
4522
- const result = {};
4523
- for (const [key, value] of Object.entries(input2)) {
4524
- if (isPluralFormsObject(value)) {
4525
- try {
4526
- result[key] = xcstringsToPluralWithMeta(value, locale);
4527
- } catch (error) {
4528
- console.error(
4529
- `
4530
- [xcode-xcstrings-icu] Failed to convert plural forms for key "${key}":`,
4531
- `
4532
- Error: ${error instanceof Error ? error.message : String(error)}`,
4533
- `
4534
- Locale: ${locale}
4535
- `
4536
- );
4537
- result[key] = value;
4307
+ async pull(locale, input2, initCtx) {
4308
+ const resultData = {};
4309
+ const isSourceLanguage = locale === defaultLocale;
4310
+ for (const [translationKey, _translationEntity] of Object.entries(
4311
+ input2.strings
4312
+ )) {
4313
+ const rootTranslationEntity = _translationEntity;
4314
+ if (rootTranslationEntity.shouldTranslate === false) {
4315
+ continue;
4316
+ }
4317
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _190 => _190.localizations, 'optionalAccess', _191 => _191[locale]]);
4318
+ if (langTranslationEntity) {
4319
+ if (!resultData[translationKey]) {
4320
+ resultData[translationKey] = {};
4538
4321
  }
4539
- } else {
4540
- result[key] = value;
4322
+ if ("stringUnit" in langTranslationEntity) {
4323
+ resultData[translationKey].stringUnit = langTranslationEntity.stringUnit.value;
4324
+ if ("substitutions" in langTranslationEntity) {
4325
+ resultData[translationKey].substitutions = {};
4326
+ for (const [subName, subData] of Object.entries(
4327
+ langTranslationEntity.substitutions
4328
+ )) {
4329
+ const pluralForms = _optionalChain([subData, 'access', _192 => _192.variations, 'optionalAccess', _193 => _193.plural]);
4330
+ if (pluralForms) {
4331
+ const forms = {};
4332
+ for (const [form, formData] of Object.entries(pluralForms)) {
4333
+ forms[form] = formData.stringUnit.value;
4334
+ }
4335
+ const icuString = buildIcuPluralString(forms, locale);
4336
+ resultData[translationKey].substitutions[subName] = {
4337
+ variations: {
4338
+ plural: icuString
4339
+ }
4340
+ };
4341
+ }
4342
+ }
4343
+ }
4344
+ } else if ("stringSet" in langTranslationEntity) {
4345
+ const values = langTranslationEntity.stringSet.values;
4346
+ if (Array.isArray(values) && values.length > 0) {
4347
+ resultData[translationKey].stringSet = values;
4348
+ }
4349
+ } else if ("variations" in langTranslationEntity) {
4350
+ if ("plural" in langTranslationEntity.variations) {
4351
+ const pluralForms = langTranslationEntity.variations.plural;
4352
+ const forms = {};
4353
+ for (const [form, formData] of Object.entries(pluralForms)) {
4354
+ if (_optionalChain([formData, 'optionalAccess', _194 => _194.stringUnit, 'optionalAccess', _195 => _195.value])) {
4355
+ forms[form] = formData.stringUnit.value;
4356
+ }
4357
+ }
4358
+ const icuString = buildIcuPluralString(forms, locale);
4359
+ resultData[translationKey].variations = {
4360
+ plural: icuString
4361
+ };
4362
+ }
4363
+ }
4364
+ } else if (isSourceLanguage) {
4365
+ if (!resultData[translationKey]) {
4366
+ resultData[translationKey] = {};
4367
+ }
4368
+ resultData[translationKey].stringUnit = translationKey;
4541
4369
  }
4542
4370
  }
4543
- return result;
4371
+ return resultData;
4544
4372
  },
4545
- async push(locale, payload) {
4546
- const result = {};
4547
- for (const [key, value] of Object.entries(payload)) {
4548
- if (isICUPluralObject(value)) {
4549
- try {
4550
- const pluralForms = pluralWithMetaToXcstrings(value);
4551
- result[key] = pluralForms;
4552
- } catch (error) {
4553
- throw new Error(
4554
- `Failed to write plural translation for key "${key}" (locale: ${locale}).
4373
+ async push(locale, payload, originalInput) {
4374
+ const langDataToMerge = {};
4375
+ langDataToMerge.strings = {};
4376
+ const input2 = _lodash2.default.cloneDeep(originalInput) || {
4377
+ sourceLanguage: locale,
4378
+ strings: {}
4379
+ };
4380
+ for (const [baseKey, keyData] of Object.entries(payload)) {
4381
+ if (!keyData || typeof keyData !== "object") {
4382
+ continue;
4383
+ }
4384
+ const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[baseKey] && originalInput.strings[baseKey].shouldTranslate === false;
4385
+ const localizationData = {};
4386
+ if ("stringUnit" in keyData) {
4387
+ localizationData.stringUnit = {
4388
+ state: "translated",
4389
+ value: keyData.stringUnit
4390
+ };
4391
+ }
4392
+ if ("substitutions" in keyData && keyData.substitutions) {
4393
+ const subs = {};
4394
+ for (const [subName, subData] of Object.entries(
4395
+ keyData.substitutions
4396
+ )) {
4397
+ const pluralValue = _optionalChain([subData, 'optionalAccess', _196 => _196.variations, 'optionalAccess', _197 => _197.plural]);
4398
+ if (pluralValue && isIcuPluralString(pluralValue)) {
4399
+ try {
4400
+ const pluralForms = parseIcuPluralString(pluralValue, locale);
4401
+ const pluralOut = {};
4402
+ for (const [form, text] of Object.entries(pluralForms)) {
4403
+ pluralOut[form] = {
4404
+ stringUnit: {
4405
+ state: "translated",
4406
+ value: text
4407
+ }
4408
+ };
4409
+ }
4410
+ const sourceLocale = _optionalChain([originalInput, 'optionalAccess', _198 => _198.sourceLanguage]) || "en";
4411
+ const origFormatSpec = _optionalChain([originalInput, 'optionalAccess', _199 => _199.strings, 'optionalAccess', _200 => _200[baseKey], 'optionalAccess', _201 => _201.localizations, 'optionalAccess', _202 => _202[sourceLocale], 'optionalAccess', _203 => _203.substitutions, 'optionalAccess', _204 => _204[subName], 'optionalAccess', _205 => _205.formatSpecifier]) || subName;
4412
+ subs[subName] = {
4413
+ formatSpecifier: origFormatSpec,
4414
+ variations: {
4415
+ plural: pluralOut
4416
+ }
4417
+ };
4418
+ } catch (error) {
4419
+ throw new Error(
4420
+ `Failed to write substitution plural translation for key "${baseKey}/substitutions/${subName}" (locale: ${locale}).
4555
4421
  ${error instanceof Error ? error.message : String(error)}`
4556
- );
4422
+ );
4423
+ }
4424
+ }
4425
+ }
4426
+ if (Object.keys(subs).length > 0) {
4427
+ localizationData.substitutions = subs;
4428
+ }
4429
+ }
4430
+ if ("stringSet" in keyData && Array.isArray(keyData.stringSet)) {
4431
+ localizationData.stringSet = {
4432
+ state: "translated",
4433
+ values: keyData.stringSet
4434
+ };
4435
+ }
4436
+ if ("variations" in keyData && _optionalChain([keyData, 'access', _206 => _206.variations, 'optionalAccess', _207 => _207.plural])) {
4437
+ const pluralValue = keyData.variations.plural;
4438
+ if (isIcuPluralString(pluralValue)) {
4439
+ try {
4440
+ const pluralForms = parseIcuPluralString(pluralValue, locale);
4441
+ const pluralOut = {};
4442
+ for (const [form, text] of Object.entries(pluralForms)) {
4443
+ pluralOut[form] = {
4444
+ stringUnit: {
4445
+ state: "translated",
4446
+ value: text
4447
+ }
4448
+ };
4449
+ }
4450
+ localizationData.variations = {
4451
+ plural: pluralOut
4452
+ };
4453
+ } catch (error) {
4454
+ throw new Error(
4455
+ `Failed to write plural translation for key "${baseKey}" (locale: ${locale}).
4456
+ ${error instanceof Error ? error.message : String(error)}`
4457
+ );
4458
+ }
4459
+ }
4460
+ }
4461
+ if (Object.keys(localizationData).length > 0) {
4462
+ langDataToMerge.strings[baseKey] = {
4463
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _208 => _208.strings, 'optionalAccess', _209 => _209[baseKey], 'optionalAccess', _210 => _210.extractionState]),
4464
+ localizations: {
4465
+ [locale]: localizationData
4466
+ }
4467
+ };
4468
+ if (hasDoNotTranslateFlag) {
4469
+ langDataToMerge.strings[baseKey].shouldTranslate = false;
4557
4470
  }
4558
- } else {
4559
- result[key] = value;
4560
4471
  }
4561
4472
  }
4562
- return result;
4473
+ return _lodash2.default.merge(input2, langDataToMerge);
4474
+ },
4475
+ async pullHints(input2) {
4476
+ const hints = {};
4477
+ for (const [translationKey, _translationEntity] of Object.entries(
4478
+ input2.strings || {}
4479
+ )) {
4480
+ const rootTranslationEntity = _translationEntity;
4481
+ if (rootTranslationEntity.comment && typeof rootTranslationEntity.comment === "string") {
4482
+ hints[translationKey] = { hint: rootTranslationEntity.comment };
4483
+ }
4484
+ }
4485
+ return hints;
4563
4486
  }
4564
4487
  });
4565
4488
  }
@@ -4574,12 +4497,12 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
4574
4497
  const unlocalizableKeys = _getUnlocalizableKeys(input2);
4575
4498
  const result = _lodash2.default.omitBy(
4576
4499
  input2,
4577
- (_36, key) => unlocalizableKeys.includes(key)
4500
+ (_37, key) => unlocalizableKeys.includes(key)
4578
4501
  );
4579
4502
  if (returnUnlocalizedKeys) {
4580
4503
  result.unlocalizable = _lodash2.default.omitBy(
4581
4504
  input2,
4582
- (_36, key) => !unlocalizableKeys.includes(key)
4505
+ (_37, key) => !unlocalizableKeys.includes(key)
4583
4506
  );
4584
4507
  }
4585
4508
  return result;
@@ -4589,7 +4512,7 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
4589
4512
  const result = _lodash2.default.merge(
4590
4513
  {},
4591
4514
  data,
4592
- _lodash2.default.omitBy(originalInput, (_36, key) => !unlocalizableKeys.includes(key))
4515
+ _lodash2.default.omitBy(originalInput, (_37, key) => !unlocalizableKeys.includes(key))
4593
4516
  );
4594
4517
  return result;
4595
4518
  }
@@ -4620,7 +4543,7 @@ function _getUnlocalizableKeys(input2) {
4620
4543
  }
4621
4544
  }
4622
4545
  return false;
4623
- }).map(([key, _36]) => key);
4546
+ }).map(([key, _37]) => key);
4624
4547
  }
4625
4548
 
4626
4549
  // src/cli/loaders/formatters/prettier.ts
@@ -4760,8 +4683,8 @@ async function formatDataWithBiome(data, filePath, options) {
4760
4683
  });
4761
4684
  return formatted.content;
4762
4685
  } catch (error) {
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")])) {
4686
+ const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _211 => _211.stackTrace, 'optionalAccess', _212 => _212.toString, 'call', _213 => _213(), 'access', _214 => _214.split, 'call', _215 => _215("\n"), 'access', _216 => _216[0]]) : "";
4687
+ if (_optionalChain([errorMessage, 'optionalAccess', _217 => _217.includes, 'call', _218 => _218("does not exist in the workspace")])) {
4765
4688
  } else {
4766
4689
  console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
4767
4690
  if (errorMessage) {
@@ -4808,7 +4731,7 @@ function createPoDataLoader(params) {
4808
4731
  Object.entries(entries).forEach(([msgid, entry]) => {
4809
4732
  if (msgid && entry.msgid) {
4810
4733
  const context = entry.msgctxt || "";
4811
- const fullEntry = _optionalChain([parsedPo, 'access', _205 => _205.translations, 'access', _206 => _206[context], 'optionalAccess', _207 => _207[msgid]]);
4734
+ const fullEntry = _optionalChain([parsedPo, 'access', _219 => _219.translations, 'access', _220 => _220[context], 'optionalAccess', _221 => _221[msgid]]);
4812
4735
  if (fullEntry) {
4813
4736
  result[msgid] = fullEntry;
4814
4737
  }
@@ -4818,8 +4741,8 @@ function createPoDataLoader(params) {
4818
4741
  return result;
4819
4742
  },
4820
4743
  async push(locale, data, originalInput, originalLocale, pullInput) {
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)]) || [];
4744
+ const currentSections = _optionalChain([pullInput, 'optionalAccess', _222 => _222.split, 'call', _223 => _223("\n\n"), 'access', _224 => _224.filter, 'call', _225 => _225(Boolean)]) || [];
4745
+ const originalSections = _optionalChain([originalInput, 'optionalAccess', _226 => _226.split, 'call', _227 => _227("\n\n"), 'access', _228 => _228.filter, 'call', _229 => _229(Boolean)]) || [];
4823
4746
  const result = originalSections.map((section) => {
4824
4747
  const sectionPo = _gettextparser2.default.po.parse(section);
4825
4748
  if (Object.keys(sectionPo.translations).length === 0) {
@@ -4888,8 +4811,8 @@ function createPoContentLoader() {
4888
4811
  {
4889
4812
  ...entry,
4890
4813
  msgstr: [
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
4814
+ _optionalChain([data, 'access', _230 => _230[entry.msgid], 'optionalAccess', _231 => _231.singular]),
4815
+ _optionalChain([data, 'access', _232 => _232[entry.msgid], 'optionalAccess', _233 => _233.plural]) || null
4893
4816
  ].filter(Boolean)
4894
4817
  }
4895
4818
  ]).fromPairs().value();
@@ -5011,7 +4934,7 @@ function pullV1(xliffElement, locale, originalLocale) {
5011
4934
  let key = getTransUnitKey(unit);
5012
4935
  if (!key) return;
5013
4936
  if (seenKeys.has(key)) {
5014
- const id = _optionalChain([unit, 'access', _220 => _220.getAttribute, 'call', _221 => _221("id"), 'optionalAccess', _222 => _222.trim, 'call', _223 => _223()]);
4937
+ const id = _optionalChain([unit, 'access', _234 => _234.getAttribute, 'call', _235 => _235("id"), 'optionalAccess', _236 => _236.trim, 'call', _237 => _237()]);
5015
4938
  if (id) {
5016
4939
  key = `${key}#${id}`;
5017
4940
  } else {
@@ -5059,7 +4982,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
5059
4982
  let key = getTransUnitKey(unit);
5060
4983
  if (!key) return;
5061
4984
  if (seenKeys.has(key)) {
5062
- const id = _optionalChain([unit, 'access', _224 => _224.getAttribute, 'call', _225 => _225("id"), 'optionalAccess', _226 => _226.trim, 'call', _227 => _227()]);
4985
+ const id = _optionalChain([unit, 'access', _238 => _238.getAttribute, 'call', _239 => _239("id"), 'optionalAccess', _240 => _240.trim, 'call', _241 => _241()]);
5063
4986
  if (id) {
5064
4987
  key = `${key}#${id}`;
5065
4988
  } else {
@@ -5101,7 +5024,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
5101
5024
  const translationKeys = new Set(Object.keys(translations));
5102
5025
  existingUnits.forEach((unit, key) => {
5103
5026
  if (!translationKeys.has(key)) {
5104
- _optionalChain([unit, 'access', _228 => _228.parentNode, 'optionalAccess', _229 => _229.removeChild, 'call', _230 => _230(unit)]);
5027
+ _optionalChain([unit, 'access', _242 => _242.parentNode, 'optionalAccess', _243 => _243.removeChild, 'call', _244 => _244(unit)]);
5105
5028
  }
5106
5029
  });
5107
5030
  return serializeWithDeclaration(
@@ -5144,18 +5067,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
5144
5067
  Array.from(container.children).forEach((child) => {
5145
5068
  const tagName = child.tagName;
5146
5069
  if (tagName === "unit") {
5147
- const unitId = _optionalChain([child, 'access', _231 => _231.getAttribute, 'call', _232 => _232("id"), 'optionalAccess', _233 => _233.trim, 'call', _234 => _234()]);
5070
+ const unitId = _optionalChain([child, 'access', _245 => _245.getAttribute, 'call', _246 => _246("id"), 'optionalAccess', _247 => _247.trim, 'call', _248 => _248()]);
5148
5071
  if (!unitId) return;
5149
5072
  const key = `resources/${fileId}/${currentPath}${unitId}/source`;
5150
5073
  const segment = child.querySelector("segment");
5151
- const source = _optionalChain([segment, 'optionalAccess', _235 => _235.querySelector, 'call', _236 => _236("source")]);
5074
+ const source = _optionalChain([segment, 'optionalAccess', _249 => _249.querySelector, 'call', _250 => _250("source")]);
5152
5075
  if (source) {
5153
5076
  result[key] = extractTextContent(source);
5154
5077
  } else {
5155
5078
  result[key] = unitId;
5156
5079
  }
5157
5080
  } else if (tagName === "group") {
5158
- const groupId = _optionalChain([child, 'access', _237 => _237.getAttribute, 'call', _238 => _238("id"), 'optionalAccess', _239 => _239.trim, 'call', _240 => _240()]);
5081
+ const groupId = _optionalChain([child, 'access', _251 => _251.getAttribute, 'call', _252 => _252("id"), 'optionalAccess', _253 => _253.trim, 'call', _254 => _254()]);
5159
5082
  const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
5160
5083
  traverseUnitsV2(child, fileId, newPath, result);
5161
5084
  }
@@ -5191,12 +5114,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
5191
5114
  Array.from(container.children).forEach((child) => {
5192
5115
  const tagName = child.tagName;
5193
5116
  if (tagName === "unit") {
5194
- const unitId = _optionalChain([child, 'access', _241 => _241.getAttribute, 'call', _242 => _242("id"), 'optionalAccess', _243 => _243.trim, 'call', _244 => _244()]);
5117
+ const unitId = _optionalChain([child, 'access', _255 => _255.getAttribute, 'call', _256 => _256("id"), 'optionalAccess', _257 => _257.trim, 'call', _258 => _258()]);
5195
5118
  if (!unitId) return;
5196
5119
  const key = `resources/${fileId}/${currentPath}${unitId}/source`;
5197
5120
  index.set(key, child);
5198
5121
  } else if (tagName === "group") {
5199
- const groupId = _optionalChain([child, 'access', _245 => _245.getAttribute, 'call', _246 => _246("id"), 'optionalAccess', _247 => _247.trim, 'call', _248 => _248()]);
5122
+ const groupId = _optionalChain([child, 'access', _259 => _259.getAttribute, 'call', _260 => _260("id"), 'optionalAccess', _261 => _261.trim, 'call', _262 => _262()]);
5200
5123
  const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
5201
5124
  indexUnitsV2(child, fileId, newPath, index);
5202
5125
  }
@@ -5217,9 +5140,9 @@ function updateUnitV2(unit, value) {
5217
5140
  setTextContent(source, value);
5218
5141
  }
5219
5142
  function getTransUnitKey(transUnit) {
5220
- const resname = _optionalChain([transUnit, 'access', _249 => _249.getAttribute, 'call', _250 => _250("resname"), 'optionalAccess', _251 => _251.trim, 'call', _252 => _252()]);
5143
+ const resname = _optionalChain([transUnit, 'access', _263 => _263.getAttribute, 'call', _264 => _264("resname"), 'optionalAccess', _265 => _265.trim, 'call', _266 => _266()]);
5221
5144
  if (resname) return resname;
5222
- const id = _optionalChain([transUnit, 'access', _253 => _253.getAttribute, 'call', _254 => _254("id"), 'optionalAccess', _255 => _255.trim, 'call', _256 => _256()]);
5145
+ const id = _optionalChain([transUnit, 'access', _267 => _267.getAttribute, 'call', _268 => _268("id"), 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]);
5223
5146
  if (id) return id;
5224
5147
  const sourceElement = transUnit.querySelector("source");
5225
5148
  if (sourceElement) {
@@ -5276,7 +5199,7 @@ function formatXml(xml) {
5276
5199
  if (cdataNode) {
5277
5200
  return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
5278
5201
  }
5279
- const textContent = _optionalChain([element, 'access', _257 => _257.textContent, 'optionalAccess', _258 => _258.trim, 'call', _259 => _259()]) || "";
5202
+ const textContent = _optionalChain([element, 'access', _271 => _271.textContent, 'optionalAccess', _272 => _272.trim, 'call', _273 => _273()]) || "";
5280
5203
  const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
5281
5204
  if (hasOnlyText && textContent) {
5282
5205
  return `${indent2}${openTag}${textContent}</${tagName}>`;
@@ -5569,7 +5492,7 @@ function createDatoClient(params) {
5569
5492
  ids: !records.length ? void 0 : records.join(",")
5570
5493
  }
5571
5494
  }).catch(
5572
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _260 => _260.response, 'optionalAccess', _261 => _261.body, 'optionalAccess', _262 => _262.data, 'optionalAccess', _263 => _263[0]]) || error)
5495
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _274 => _274.response, 'optionalAccess', _275 => _275.body, 'optionalAccess', _276 => _276.data, 'optionalAccess', _277 => _277[0]]) || error)
5573
5496
  );
5574
5497
  },
5575
5498
  findRecordsForModel: async (modelId, records) => {
@@ -5580,10 +5503,10 @@ function createDatoClient(params) {
5580
5503
  filter: {
5581
5504
  type: modelId,
5582
5505
  only_valid: "true",
5583
- ids: !_optionalChain([records, 'optionalAccess', _264 => _264.length]) ? void 0 : records.join(",")
5506
+ ids: !_optionalChain([records, 'optionalAccess', _278 => _278.length]) ? void 0 : records.join(",")
5584
5507
  }
5585
5508
  }).catch(
5586
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _265 => _265.response, 'optionalAccess', _266 => _266.body, 'optionalAccess', _267 => _267.data, 'optionalAccess', _268 => _268[0]]) || error)
5509
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _279 => _279.response, 'optionalAccess', _280 => _280.body, 'optionalAccess', _281 => _281.data, 'optionalAccess', _282 => _282[0]]) || error)
5587
5510
  );
5588
5511
  return result;
5589
5512
  } catch (_error) {
@@ -5599,10 +5522,10 @@ function createDatoClient(params) {
5599
5522
  updateRecord: async (id, payload) => {
5600
5523
  try {
5601
5524
  await dato.items.update(id, payload).catch(
5602
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _269 => _269.response, 'optionalAccess', _270 => _270.body, 'optionalAccess', _271 => _271.data, 'optionalAccess', _272 => _272[0]]) || error)
5525
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _283 => _283.response, 'optionalAccess', _284 => _284.body, 'optionalAccess', _285 => _285.data, 'optionalAccess', _286 => _286[0]]) || error)
5603
5526
  );
5604
5527
  } catch (_error) {
5605
- if (_optionalChain([_error, 'optionalAccess', _273 => _273.attributes, 'optionalAccess', _274 => _274.details, 'optionalAccess', _275 => _275.message])) {
5528
+ if (_optionalChain([_error, 'optionalAccess', _287 => _287.attributes, 'optionalAccess', _288 => _288.details, 'optionalAccess', _289 => _289.message])) {
5606
5529
  throw new Error(
5607
5530
  [
5608
5531
  `${_error.attributes.details.message}`,
@@ -5624,10 +5547,10 @@ function createDatoClient(params) {
5624
5547
  enableFieldLocalization: async (args) => {
5625
5548
  try {
5626
5549
  await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
5627
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _276 => _276.response, 'optionalAccess', _277 => _277.body, 'optionalAccess', _278 => _278.data, 'optionalAccess', _279 => _279[0]]) || error)
5550
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _290 => _290.response, 'optionalAccess', _291 => _291.body, 'optionalAccess', _292 => _292.data, 'optionalAccess', _293 => _293[0]]) || error)
5628
5551
  );
5629
5552
  } catch (_error) {
5630
- if (_optionalChain([_error, 'optionalAccess', _280 => _280.attributes, 'optionalAccess', _281 => _281.code]) === "NOT_FOUND") {
5553
+ if (_optionalChain([_error, 'optionalAccess', _294 => _294.attributes, 'optionalAccess', _295 => _295.code]) === "NOT_FOUND") {
5631
5554
  throw new Error(
5632
5555
  [
5633
5556
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -5635,7 +5558,7 @@ function createDatoClient(params) {
5635
5558
  ].join("\n\n")
5636
5559
  );
5637
5560
  }
5638
- if (_optionalChain([_error, 'optionalAccess', _282 => _282.attributes, 'optionalAccess', _283 => _283.details, 'optionalAccess', _284 => _284.message])) {
5561
+ if (_optionalChain([_error, 'optionalAccess', _296 => _296.attributes, 'optionalAccess', _297 => _297.details, 'optionalAccess', _298 => _298.message])) {
5639
5562
  throw new Error(
5640
5563
  [
5641
5564
  `${_error.attributes.details.message}`,
@@ -5713,7 +5636,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
5713
5636
  const records = await dato.findRecordsForModel(modelId);
5714
5637
  const recordChoices = createRecordChoices(
5715
5638
  records,
5716
- _optionalChain([config, 'access', _285 => _285.models, 'access', _286 => _286[modelId], 'optionalAccess', _287 => _287.records]) || [],
5639
+ _optionalChain([config, 'access', _299 => _299.models, 'access', _300 => _300[modelId], 'optionalAccess', _301 => _301.records]) || [],
5717
5640
  project
5718
5641
  );
5719
5642
  const selectedRecords = await promptRecordSelection(
@@ -5732,14 +5655,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
5732
5655
  },
5733
5656
  async pull(locale, input2, initCtx) {
5734
5657
  const result = {};
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]) || [];
5658
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _302 => _302.models]) || {})) {
5659
+ let records = _optionalChain([initCtx, 'optionalAccess', _303 => _303.models, 'access', _304 => _304[modelId], 'access', _305 => _305.records]) || [];
5737
5660
  const recordIds = records.map((record) => record.id);
5738
5661
  records = await dato.findRecords(recordIds);
5739
5662
  console.log(`Fetched ${records.length} records for model ${modelId}`);
5740
5663
  if (records.length > 0) {
5741
5664
  result[modelId] = {
5742
- fields: _optionalChain([initCtx, 'optionalAccess', _292 => _292.models, 'optionalAccess', _293 => _293[modelId], 'optionalAccess', _294 => _294.fields]) || [],
5665
+ fields: _optionalChain([initCtx, 'optionalAccess', _306 => _306.models, 'optionalAccess', _307 => _307[modelId], 'optionalAccess', _308 => _308.fields]) || [],
5743
5666
  records
5744
5667
  };
5745
5668
  }
@@ -5802,7 +5725,7 @@ function createRecordChoices(records, selectedIds = [], project) {
5802
5725
  return records.map((record) => ({
5803
5726
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
5804
5727
  value: record.id,
5805
- checked: _optionalChain([selectedIds, 'optionalAccess', _295 => _295.includes, 'call', _296 => _296(record.id)])
5728
+ checked: _optionalChain([selectedIds, 'optionalAccess', _309 => _309.includes, 'call', _310 => _310(record.id)])
5806
5729
  }));
5807
5730
  }
5808
5731
  async function promptRecordSelection(modelName, choices) {
@@ -6121,7 +6044,7 @@ function createVttLoader() {
6121
6044
  if (!input2) {
6122
6045
  return "";
6123
6046
  }
6124
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _297 => _297.parse, 'call', _298 => _298(input2), 'optionalAccess', _299 => _299.cues]);
6047
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _311 => _311.parse, 'call', _312 => _312(input2), 'optionalAccess', _313 => _313.cues]);
6125
6048
  if (Object.keys(vtt).length === 0) {
6126
6049
  return {};
6127
6050
  } else {
@@ -6167,15 +6090,6 @@ function variableExtractLoader(params) {
6167
6090
  const inputValues = _lodash2.default.omitBy(input2, _lodash2.default.isEmpty);
6168
6091
  for (const [key, value] of Object.entries(inputValues)) {
6169
6092
  const originalValue = originalInput[key];
6170
- if (isICUPluralObject(originalValue)) {
6171
- const icuValue = isICUPluralObject(value) ? { icu: value.icu } : value;
6172
- result[key] = {
6173
- value: icuValue,
6174
- variables: []
6175
- // Metadata stored separately, not in variables
6176
- };
6177
- continue;
6178
- }
6179
6093
  const matches = originalValue.match(specifierPattern) || [];
6180
6094
  result[key] = result[key] || {
6181
6095
  value,
@@ -6184,7 +6098,7 @@ function variableExtractLoader(params) {
6184
6098
  for (let i = 0; i < matches.length; i++) {
6185
6099
  const match2 = matches[i];
6186
6100
  const currentValue = result[key].value;
6187
- const newValue = _optionalChain([currentValue, 'optionalAccess', _300 => _300.replace, 'call', _301 => _301(match2, `{variable:${i}}`)]);
6101
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _314 => _314.replace, 'call', _315 => _315(match2, `{variable:${i}}`)]);
6188
6102
  result[key].value = newValue;
6189
6103
  result[key].variables[i] = match2;
6190
6104
  }
@@ -6195,19 +6109,14 @@ function variableExtractLoader(params) {
6195
6109
  const result = {};
6196
6110
  for (const [key, valueObj] of Object.entries(data)) {
6197
6111
  result[key] = valueObj.value;
6198
- const resultValue = result[key];
6199
- if (isICUPluralObject(resultValue)) {
6200
- const originalValue = _optionalChain([originalInput, 'optionalAccess', _302 => _302[key]]);
6201
- if (isICUPluralObject(originalValue) && originalValue._meta) {
6202
- resultValue._meta = originalValue._meta;
6203
- resultValue[Symbol.for("@lingo.dev/icu-plural-object")] = true;
6204
- }
6205
- }
6206
6112
  for (let i = 0; i < valueObj.variables.length; i++) {
6207
6113
  const variable = valueObj.variables[i];
6208
6114
  const currentValue = result[key];
6209
6115
  if (typeof currentValue === "string") {
6210
- const newValue = _optionalChain([currentValue, 'optionalAccess', _303 => _303.replace, 'call', _304 => _304(`{variable:${i}}`, variable)]);
6116
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _316 => _316.replaceAll, 'call', _317 => _317(
6117
+ `{variable:${i}}`,
6118
+ variable
6119
+ )]);
6211
6120
  result[key] = newValue;
6212
6121
  }
6213
6122
  }
@@ -6408,7 +6317,7 @@ function createVueJsonLoader() {
6408
6317
  return createLoader({
6409
6318
  pull: async (locale, input2, ctx) => {
6410
6319
  const parsed = parseVueFile(input2);
6411
- return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _305 => _305.i18n, 'optionalAccess', _306 => _306[locale]]), () => ( {}));
6320
+ return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _318 => _318.i18n, 'optionalAccess', _319 => _319[locale]]), () => ( {}));
6412
6321
  },
6413
6322
  push: async (locale, data, originalInput) => {
6414
6323
  const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
@@ -6593,7 +6502,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
6593
6502
  objectExpression.properties.forEach((prop) => {
6594
6503
  if (!t.isObjectProperty(prop)) return;
6595
6504
  const key = getPropertyKey(prop);
6596
- const incomingVal = _optionalChain([data, 'optionalAccess', _307 => _307[key]]);
6505
+ const incomingVal = _optionalChain([data, 'optionalAccess', _320 => _320[key]]);
6597
6506
  if (incomingVal === void 0) {
6598
6507
  return;
6599
6508
  }
@@ -6629,7 +6538,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
6629
6538
  let modified = false;
6630
6539
  arrayExpression.elements.forEach((element, index) => {
6631
6540
  if (!element) return;
6632
- const incomingVal = _optionalChain([incoming, 'optionalAccess', _308 => _308[index]]);
6541
+ const incomingVal = _optionalChain([incoming, 'optionalAccess', _321 => _321[index]]);
6633
6542
  if (incomingVal === void 0) return;
6634
6543
  if (t.isStringLiteral(element) && typeof incomingVal === "string") {
6635
6544
  if (element.value !== incomingVal) {
@@ -7120,7 +7029,7 @@ var AST = class _AST {
7120
7029
  const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
7121
7030
  if (this.isStart() && !this.type)
7122
7031
  ret.unshift([]);
7123
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _309 => _309.#parent, 'optionalAccess', _310 => _310.type]) === "!")) {
7032
+ if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _322 => _322.#parent, 'optionalAccess', _323 => _323.type]) === "!")) {
7124
7033
  ret.push({});
7125
7034
  }
7126
7035
  return ret;
@@ -7128,7 +7037,7 @@ var AST = class _AST {
7128
7037
  isStart() {
7129
7038
  if (this.#root === this)
7130
7039
  return true;
7131
- if (!_optionalChain([this, 'access', _311 => _311.#parent, 'optionalAccess', _312 => _312.isStart, 'call', _313 => _313()]))
7040
+ if (!_optionalChain([this, 'access', _324 => _324.#parent, 'optionalAccess', _325 => _325.isStart, 'call', _326 => _326()]))
7132
7041
  return false;
7133
7042
  if (this.#parentIndex === 0)
7134
7043
  return true;
@@ -7144,12 +7053,12 @@ var AST = class _AST {
7144
7053
  isEnd() {
7145
7054
  if (this.#root === this)
7146
7055
  return true;
7147
- if (_optionalChain([this, 'access', _314 => _314.#parent, 'optionalAccess', _315 => _315.type]) === "!")
7056
+ if (_optionalChain([this, 'access', _327 => _327.#parent, 'optionalAccess', _328 => _328.type]) === "!")
7148
7057
  return true;
7149
- if (!_optionalChain([this, 'access', _316 => _316.#parent, 'optionalAccess', _317 => _317.isEnd, 'call', _318 => _318()]))
7058
+ if (!_optionalChain([this, 'access', _329 => _329.#parent, 'optionalAccess', _330 => _330.isEnd, 'call', _331 => _331()]))
7150
7059
  return false;
7151
7060
  if (!this.type)
7152
- return _optionalChain([this, 'access', _319 => _319.#parent, 'optionalAccess', _320 => _320.isEnd, 'call', _321 => _321()]);
7061
+ return _optionalChain([this, 'access', _332 => _332.#parent, 'optionalAccess', _333 => _333.isEnd, 'call', _334 => _334()]);
7153
7062
  const pl = this.#parent ? this.#parent.#parts.length : 0;
7154
7063
  return this.#parentIndex === pl - 1;
7155
7064
  }
@@ -7371,7 +7280,7 @@ var AST = class _AST {
7371
7280
  if (!this.type) {
7372
7281
  const noEmpty = this.isStart() && this.isEnd();
7373
7282
  const src = this.#parts.map((p) => {
7374
- const [re, _36, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
7283
+ const [re, _37, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
7375
7284
  this.#hasMagic = this.#hasMagic || hasMagic;
7376
7285
  this.#uflag = this.#uflag || uflag;
7377
7286
  return re;
@@ -7394,7 +7303,7 @@ var AST = class _AST {
7394
7303
  }
7395
7304
  }
7396
7305
  let end = "";
7397
- if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _322 => _322.#parent, 'optionalAccess', _323 => _323.type]) === "!") {
7306
+ if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _335 => _335.#parent, 'optionalAccess', _336 => _336.type]) === "!") {
7398
7307
  end = "(?:$|\\/)";
7399
7308
  }
7400
7309
  const final2 = start2 + src + end;
@@ -7444,7 +7353,7 @@ var AST = class _AST {
7444
7353
  if (typeof p === "string") {
7445
7354
  throw new Error("string type in extglob ast??");
7446
7355
  }
7447
- const [re, _36, _hasMagic, uflag] = p.toRegExpSource(dot);
7356
+ const [re, _37, _hasMagic, uflag] = p.toRegExpSource(dot);
7448
7357
  this.#uflag = this.#uflag || uflag;
7449
7358
  return re;
7450
7359
  }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
@@ -7689,7 +7598,7 @@ var Minimatch = class {
7689
7598
  }
7690
7599
  return false;
7691
7600
  }
7692
- debug(..._36) {
7601
+ debug(..._37) {
7693
7602
  }
7694
7603
  make() {
7695
7604
  const pattern = this.pattern;
@@ -7711,7 +7620,7 @@ var Minimatch = class {
7711
7620
  const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
7712
7621
  this.globParts = this.preprocess(rawGlobParts);
7713
7622
  this.debug(this.pattern, this.globParts);
7714
- let set = this.globParts.map((s, _36, __) => {
7623
+ let set = this.globParts.map((s, _37, __) => {
7715
7624
  if (this.isWindows && this.windowsNoMagicRoot) {
7716
7625
  const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
7717
7626
  const isDrive = /^[a-z]:/i.test(s[0]);
@@ -8484,7 +8393,7 @@ function createMdxSectionsSplit2Loader() {
8484
8393
  const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
8485
8394
  const result = {
8486
8395
  frontmatter: data.frontmatter,
8487
- codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _324 => _324.codePlaceholders]) || {},
8396
+ codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _337 => _337.codePlaceholders]) || {},
8488
8397
  content
8489
8398
  };
8490
8399
  return result;
@@ -8749,7 +8658,7 @@ function createTxtLoader() {
8749
8658
  const sortedEntries = Object.entries(payload).sort(
8750
8659
  ([a], [b]) => parseInt(a) - parseInt(b)
8751
8660
  );
8752
- return sortedEntries.map(([_36, value]) => value).join("\n");
8661
+ return sortedEntries.map(([_37, value]) => value).join("\n");
8753
8662
  }
8754
8663
  });
8755
8664
  }
@@ -9040,9 +8949,8 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
9040
8949
  createPlutilJsonTextLoader(),
9041
8950
  createLockedPatternsLoader(lockedPatterns),
9042
8951
  createJsonLoader(),
9043
- createXcodeXcstringsLoader(options.defaultLocale),
9044
8952
  createXcodeXcstringsV2Loader(options.defaultLocale),
9045
- createFlatLoader({ shouldPreserveObject: isICUPluralObject }),
8953
+ createFlatLoader(),
9046
8954
  createEnsureKeyOrderLoader(),
9047
8955
  createLockedKeysLoader(lockedKeys || []),
9048
8956
  createIgnoredKeysLoader(ignoredKeys || []),
@@ -9585,7 +9493,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
9585
9493
  ]
9586
9494
  });
9587
9495
  const result = JSON.parse(response.text);
9588
- return _optionalChain([result, 'optionalAccess', _325 => _325.data]) || {};
9496
+ return _optionalChain([result, 'optionalAccess', _338 => _338.data]) || {};
9589
9497
  }
9590
9498
  }
9591
9499
  function extractPayloadChunks(payload) {
@@ -9668,7 +9576,7 @@ function getPureModelProvider(provider) {
9668
9576
 
9669
9577
  ${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
9670
9578
  `;
9671
- switch (_optionalChain([provider, 'optionalAccess', _326 => _326.id])) {
9579
+ switch (_optionalChain([provider, 'optionalAccess', _339 => _339.id])) {
9672
9580
  case "openai": {
9673
9581
  if (!process.env.OPENAI_API_KEY) {
9674
9582
  throw new Error(
@@ -9726,7 +9634,7 @@ function getPureModelProvider(provider) {
9726
9634
  })(provider.model);
9727
9635
  }
9728
9636
  default: {
9729
- throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _327 => _327.id])));
9637
+ throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _340 => _340.id])));
9730
9638
  }
9731
9639
  }
9732
9640
  }
@@ -10012,7 +9920,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10012
9920
  validateParams(i18nConfig, flags);
10013
9921
  ora.succeed("Localization configuration is valid");
10014
9922
  ora.start("Connecting to Lingo.dev Localization Engine...");
10015
- const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _328 => _328.provider]);
9923
+ const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _341 => _341.provider]);
10016
9924
  if (isByokMode) {
10017
9925
  authId = null;
10018
9926
  ora.succeed("Using external provider (BYOK mode)");
@@ -10026,16 +9934,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10026
9934
  flags
10027
9935
  });
10028
9936
  let buckets = getBuckets(i18nConfig);
10029
- if (_optionalChain([flags, 'access', _329 => _329.bucket, 'optionalAccess', _330 => _330.length])) {
9937
+ if (_optionalChain([flags, 'access', _342 => _342.bucket, 'optionalAccess', _343 => _343.length])) {
10030
9938
  buckets = buckets.filter(
10031
9939
  (bucket) => flags.bucket.includes(bucket.type)
10032
9940
  );
10033
9941
  }
10034
9942
  ora.succeed("Buckets retrieved");
10035
- if (_optionalChain([flags, 'access', _331 => _331.file, 'optionalAccess', _332 => _332.length])) {
9943
+ if (_optionalChain([flags, 'access', _344 => _344.file, 'optionalAccess', _345 => _345.length])) {
10036
9944
  buckets = buckets.map((bucket) => {
10037
9945
  const paths = bucket.paths.filter(
10038
- (path19) => flags.file.find((file) => _optionalChain([path19, 'access', _333 => _333.pathPattern, 'optionalAccess', _334 => _334.includes, 'call', _335 => _335(file)]))
9946
+ (path19) => flags.file.find((file) => _optionalChain([path19, 'access', _346 => _346.pathPattern, 'optionalAccess', _347 => _347.includes, 'call', _348 => _348(file)]))
10039
9947
  );
10040
9948
  return { ...bucket, paths };
10041
9949
  }).filter((bucket) => bucket.paths.length > 0);
@@ -10056,7 +9964,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10056
9964
  });
10057
9965
  }
10058
9966
  }
10059
- const targetLocales = _optionalChain([flags, 'access', _336 => _336.locale, 'optionalAccess', _337 => _337.length]) ? flags.locale : i18nConfig.locale.targets;
9967
+ const targetLocales = _optionalChain([flags, 'access', _349 => _349.locale, 'optionalAccess', _350 => _350.length]) ? flags.locale : i18nConfig.locale.targets;
10060
9968
  ora.start("Setting up localization cache...");
10061
9969
  const checkLockfileProcessor = createDeltaProcessor("");
10062
9970
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -10233,7 +10141,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10233
10141
  if (flags.key) {
10234
10142
  processableData = _lodash2.default.pickBy(
10235
10143
  processableData,
10236
- (_36, key) => key === flags.key
10144
+ (_37, key) => key === flags.key
10237
10145
  );
10238
10146
  }
10239
10147
  if (flags.verbose) {
@@ -10298,11 +10206,8 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10298
10206
  }
10299
10207
  const finalDiffSize = _lodash2.default.chain(finalTargetData).omitBy((value, key) => {
10300
10208
  const targetValue = targetData[key];
10301
- if (isICUPluralObject(value) && isICUPluralObject(targetValue)) {
10302
- return _lodash2.default.isEqual(
10303
- { icu: value.icu, _meta: value._meta },
10304
- { icu: targetValue.icu, _meta: targetValue._meta }
10305
- );
10209
+ if (typeof value === "object" && value !== null) {
10210
+ return _lodash2.default.isEqual(value, targetValue);
10306
10211
  }
10307
10212
  return value === targetValue;
10308
10213
  }).size().value();
@@ -10344,7 +10249,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10344
10249
  }
10345
10250
  const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
10346
10251
  const checksums = await deltaProcessor.createChecksums(sourceData);
10347
- if (!_optionalChain([flags, 'access', _338 => _338.locale, 'optionalAccess', _339 => _339.length])) {
10252
+ if (!_optionalChain([flags, 'access', _351 => _351.locale, 'optionalAccess', _352 => _352.length])) {
10348
10253
  await deltaProcessor.saveChecksums(checksums);
10349
10254
  }
10350
10255
  }
@@ -10468,12 +10373,12 @@ function validateParams(i18nConfig, flags) {
10468
10373
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
10469
10374
  docUrl: "bucketNotFound"
10470
10375
  });
10471
- } else if (_optionalChain([flags, 'access', _340 => _340.locale, 'optionalAccess', _341 => _341.some, 'call', _342 => _342((locale) => !i18nConfig.locale.targets.includes(locale))])) {
10376
+ } else if (_optionalChain([flags, 'access', _353 => _353.locale, 'optionalAccess', _354 => _354.some, 'call', _355 => _355((locale) => !i18nConfig.locale.targets.includes(locale))])) {
10472
10377
  throw new ValidationError({
10473
10378
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
10474
10379
  docUrl: "localeTargetNotFound"
10475
10380
  });
10476
- } else if (_optionalChain([flags, 'access', _343 => _343.bucket, 'optionalAccess', _344 => _344.some, 'call', _345 => _345(
10381
+ } else if (_optionalChain([flags, 'access', _356 => _356.bucket, 'optionalAccess', _357 => _357.some, 'call', _358 => _358(
10477
10382
  (bucket) => !i18nConfig.buckets[bucket]
10478
10383
  )])) {
10479
10384
  throw new ValidationError({
@@ -10877,7 +10782,7 @@ var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
10877
10782
 
10878
10783
  var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description(
10879
10784
  "Start a Model Context Protocol (MCP) server for AI assistant integration"
10880
- ).helpOption("-h, --help", "Show help").action(async (_36, program) => {
10785
+ ).helpOption("-h, --help", "Show help").action(async (_37, program) => {
10881
10786
  const apiKey = program.args[0];
10882
10787
  const settings = getSettings(apiKey);
10883
10788
  if (!settings.auth.apiKey) {
@@ -11007,7 +10912,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
11007
10912
  const response = await engine.whoami();
11008
10913
  return {
11009
10914
  authenticated: !!response,
11010
- username: _optionalChain([response, 'optionalAccess', _346 => _346.email])
10915
+ username: _optionalChain([response, 'optionalAccess', _359 => _359.email])
11011
10916
  };
11012
10917
  } catch (error) {
11013
10918
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -11123,7 +11028,7 @@ function createExplicitLocalizer(provider) {
11123
11028
  }
11124
11029
  function createAiSdkLocalizer(params) {
11125
11030
  const skipAuth = params.skipAuth === true;
11126
- const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _347 => _347.apiKeyName]), () => ( ""))];
11031
+ const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _360 => _360.apiKeyName]), () => ( ""))];
11127
11032
  if (!skipAuth && !apiKey || !params.apiKeyName) {
11128
11033
  throw new Error(
11129
11034
  _dedent2.default`
@@ -11257,8 +11162,8 @@ async function setup(input2) {
11257
11162
  throw new Error(
11258
11163
  "No buckets found in i18n.json. Please add at least one bucket containing i18n content."
11259
11164
  );
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]])
11165
+ } else if (_optionalChain([ctx, 'access', _361 => _361.flags, 'access', _362 => _362.bucket, 'optionalAccess', _363 => _363.some, 'call', _364 => _364(
11166
+ (bucket) => !_optionalChain([ctx, 'access', _365 => _365.config, 'optionalAccess', _366 => _366.buckets, 'access', _367 => _367[bucket]])
11262
11167
  )])) {
11263
11168
  throw new Error(
11264
11169
  `One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
@@ -11271,7 +11176,7 @@ async function setup(input2) {
11271
11176
  title: "Selecting localization provider",
11272
11177
  task: async (ctx, task) => {
11273
11178
  ctx.localizer = createLocalizer(
11274
- _optionalChain([ctx, 'access', _355 => _355.config, 'optionalAccess', _356 => _356.provider]),
11179
+ _optionalChain([ctx, 'access', _368 => _368.config, 'optionalAccess', _369 => _369.provider]),
11275
11180
  ctx.flags.apiKey
11276
11181
  );
11277
11182
  if (!ctx.localizer) {
@@ -11284,7 +11189,7 @@ async function setup(input2) {
11284
11189
  },
11285
11190
  {
11286
11191
  title: "Checking authentication",
11287
- enabled: (ctx) => _optionalChain([ctx, 'access', _357 => _357.localizer, 'optionalAccess', _358 => _358.id]) === "Lingo.dev",
11192
+ enabled: (ctx) => _optionalChain([ctx, 'access', _370 => _370.localizer, 'optionalAccess', _371 => _371.id]) === "Lingo.dev",
11288
11193
  task: async (ctx, task) => {
11289
11194
  const authStatus = await ctx.localizer.checkAuth();
11290
11195
  if (!authStatus.authenticated) {
@@ -11297,7 +11202,7 @@ async function setup(input2) {
11297
11202
  },
11298
11203
  {
11299
11204
  title: "Validating configuration",
11300
- enabled: (ctx) => _optionalChain([ctx, 'access', _359 => _359.localizer, 'optionalAccess', _360 => _360.id]) !== "Lingo.dev",
11205
+ enabled: (ctx) => _optionalChain([ctx, 'access', _372 => _372.localizer, 'optionalAccess', _373 => _373.id]) !== "Lingo.dev",
11301
11206
  task: async (ctx, task) => {
11302
11207
  const validationStatus = await ctx.localizer.validateSettings();
11303
11208
  if (!validationStatus.valid) {
@@ -11515,7 +11420,7 @@ async function execute(input2) {
11515
11420
  const workerTasks = [];
11516
11421
  for (let i = 0; i < workersCount; i++) {
11517
11422
  const assignedTasks = ctx.tasks.filter(
11518
- (_36, idx) => idx % workersCount === i
11423
+ (_37, idx) => idx % workersCount === i
11519
11424
  );
11520
11425
  workerTasks.push(
11521
11426
  createWorkerTask({
@@ -11628,7 +11533,7 @@ function createWorkerTask(args) {
11628
11533
  const processableData = _lodash2.default.chain(sourceData).entries().filter(
11629
11534
  ([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
11630
11535
  ).filter(
11631
- ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _361 => _361.onlyKeys, 'optionalAccess', _362 => _362.some, 'call', _363 => _363(
11536
+ ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _374 => _374.onlyKeys, 'optionalAccess', _375 => _375.some, 'call', _376 => _376(
11632
11537
  (pattern) => minimatch(key, pattern)
11633
11538
  )])
11634
11539
  ).fromPairs().value();
@@ -11696,7 +11601,7 @@ function createWorkerTask(args) {
11696
11601
  finalRenamedTargetData
11697
11602
  );
11698
11603
  const checksums = await deltaProcessor.createChecksums(sourceData);
11699
- if (!_optionalChain([args, 'access', _364 => _364.ctx, 'access', _365 => _365.flags, 'access', _366 => _366.targetLocale, 'optionalAccess', _367 => _367.length])) {
11604
+ if (!_optionalChain([args, 'access', _377 => _377.ctx, 'access', _378 => _378.flags, 'access', _379 => _379.targetLocale, 'optionalAccess', _380 => _380.length])) {
11700
11605
  await deltaProcessor.saveChecksums(checksums);
11701
11606
  }
11702
11607
  });
@@ -11901,10 +11806,10 @@ var flagsSchema2 = _zod.z.object({
11901
11806
  async function frozen(input2) {
11902
11807
  console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
11903
11808
  let buckets = getBuckets(input2.config);
11904
- if (_optionalChain([input2, 'access', _368 => _368.flags, 'access', _369 => _369.bucket, 'optionalAccess', _370 => _370.length])) {
11809
+ if (_optionalChain([input2, 'access', _381 => _381.flags, 'access', _382 => _382.bucket, 'optionalAccess', _383 => _383.length])) {
11905
11810
  buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
11906
11811
  }
11907
- if (_optionalChain([input2, 'access', _371 => _371.flags, 'access', _372 => _372.file, 'optionalAccess', _373 => _373.length])) {
11812
+ if (_optionalChain([input2, 'access', _384 => _384.flags, 'access', _385 => _385.file, 'optionalAccess', _386 => _386.length])) {
11908
11813
  buckets = buckets.map((bucket) => {
11909
11814
  const paths = bucket.paths.filter(
11910
11815
  (p) => input2.flags.file.some(
@@ -12041,13 +11946,13 @@ async function frozen(input2) {
12041
11946
 
12042
11947
  // src/cli/cmd/run/_utils.ts
12043
11948
  async function determineAuthId(ctx) {
12044
- const isByokMode = !!_optionalChain([ctx, 'access', _374 => _374.config, 'optionalAccess', _375 => _375.provider]);
11949
+ const isByokMode = !!_optionalChain([ctx, 'access', _387 => _387.config, 'optionalAccess', _388 => _388.provider]);
12045
11950
  if (isByokMode) {
12046
11951
  return null;
12047
11952
  } else {
12048
11953
  try {
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;
11954
+ const authStatus = await _optionalChain([ctx, 'access', _389 => _389.localizer, 'optionalAccess', _390 => _390.checkAuth, 'call', _391 => _391()]);
11955
+ return _optionalChain([authStatus, 'optionalAccess', _392 => _392.username]) || null;
12051
11956
  } catch (e3) {
12052
11957
  return null;
12053
11958
  }
@@ -12245,7 +12150,7 @@ var InBranchFlow = class extends IntegrationFlow {
12245
12150
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
12246
12151
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
12247
12152
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
12248
- _optionalChain([this, 'access', _380 => _380.platformKit, 'optionalAccess', _381 => _381.gitConfig, 'call', _382 => _382()]);
12153
+ _optionalChain([this, 'access', _393 => _393.platformKit, 'optionalAccess', _394 => _394.gitConfig, 'call', _395 => _395()]);
12249
12154
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
12250
12155
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
12251
12156
  if (!processOwnCommits) {
@@ -12277,7 +12182,7 @@ var InBranchFlow = class extends IntegrationFlow {
12277
12182
  // src/cli/cmd/ci/flows/pull-request.ts
12278
12183
  var PullRequestFlow = class extends InBranchFlow {
12279
12184
  async preRun() {
12280
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _383 => _383()]);
12185
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _396 => _396()]);
12281
12186
  if (!canContinue) {
12282
12187
  return false;
12283
12188
  }
@@ -12544,10 +12449,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
12544
12449
  repo_slug: this.platformConfig.repositoryName,
12545
12450
  state: "OPEN"
12546
12451
  }).then(({ data: { values } }) => {
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
12452
+ return _optionalChain([values, 'optionalAccess', _397 => _397.find, 'call', _398 => _398(
12453
+ ({ source, destination }) => _optionalChain([source, 'optionalAccess', _399 => _399.branch, 'optionalAccess', _400 => _400.name]) === branch && _optionalChain([destination, 'optionalAccess', _401 => _401.branch, 'optionalAccess', _402 => _402.name]) === this.platformConfig.baseBranchName
12549
12454
  )]);
12550
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _390 => _390.id]));
12455
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _403 => _403.id]));
12551
12456
  }
12552
12457
  async closePullRequest({ pullRequestNumber }) {
12553
12458
  await this.bb.repositories.declinePullRequest({
@@ -12643,7 +12548,7 @@ var GitHubPlatformKit = class extends PlatformKit {
12643
12548
  repo: this.platformConfig.repositoryName,
12644
12549
  base: this.platformConfig.baseBranchName,
12645
12550
  state: "open"
12646
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _391 => _391.number]));
12551
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _404 => _404.number]));
12647
12552
  }
12648
12553
  async closePullRequest({ pullRequestNumber }) {
12649
12554
  await this.octokit.rest.pulls.update({
@@ -12770,7 +12675,7 @@ var GitlabPlatformKit = class extends PlatformKit {
12770
12675
  sourceBranch: branch,
12771
12676
  state: "opened"
12772
12677
  });
12773
- return _optionalChain([mergeRequests, 'access', _392 => _392[0], 'optionalAccess', _393 => _393.iid]);
12678
+ return _optionalChain([mergeRequests, 'access', _405 => _405[0], 'optionalAccess', _406 => _406.iid]);
12774
12679
  }
12775
12680
  async closePullRequest({
12776
12681
  pullRequestNumber
@@ -12882,7 +12787,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12882
12787
  }
12883
12788
  const env = {
12884
12789
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
12885
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _394 => _394.pullRequest, 'optionalAccess', _395 => _395.toString, 'call', _396 => _396()]) || "false",
12790
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _407 => _407.pullRequest, 'optionalAccess', _408 => _408.toString, 'call', _409 => _409()]) || "false",
12886
12791
  ...options.commitMessage && {
12887
12792
  LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
12888
12793
  },
@@ -12908,7 +12813,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12908
12813
  const { isPullRequestMode } = platformKit.config;
12909
12814
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
12910
12815
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
12911
- const canRun = await _optionalChain([flow, 'access', _397 => _397.preRun, 'optionalCall', _398 => _398()]);
12816
+ const canRun = await _optionalChain([flow, 'access', _410 => _410.preRun, 'optionalCall', _411 => _411()]);
12912
12817
  if (canRun === false) {
12913
12818
  return;
12914
12819
  }
@@ -12918,7 +12823,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12918
12823
  if (!hasChanges) {
12919
12824
  return;
12920
12825
  }
12921
- await _optionalChain([flow, 'access', _399 => _399.postRun, 'optionalCall', _400 => _400()]);
12826
+ await _optionalChain([flow, 'access', _412 => _412.postRun, 'optionalCall', _413 => _413()]);
12922
12827
  });
12923
12828
  function parseBooleanArg(val) {
12924
12829
  if (val === true) return true;
@@ -12955,8 +12860,8 @@ function exitGracefully(elapsedMs = 0) {
12955
12860
  }
12956
12861
  }
12957
12862
  function checkForPendingOperations() {
12958
- const activeHandles = _optionalChain([process, 'access', _401 => _401._getActiveHandles, 'optionalCall', _402 => _402()]) || [];
12959
- const activeRequests = _optionalChain([process, 'access', _403 => _403._getActiveRequests, 'optionalCall', _404 => _404()]) || [];
12863
+ const activeHandles = _optionalChain([process, 'access', _414 => _414._getActiveHandles, 'optionalCall', _415 => _415()]) || [];
12864
+ const activeRequests = _optionalChain([process, 'access', _416 => _416._getActiveRequests, 'optionalCall', _417 => _417()]) || [];
12960
12865
  const nonStandardHandles = activeHandles.filter((handle) => {
12961
12866
  if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
12962
12867
  return false;
@@ -13025,17 +12930,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
13025
12930
  flags
13026
12931
  });
13027
12932
  let buckets = getBuckets(i18nConfig);
13028
- if (_optionalChain([flags, 'access', _405 => _405.bucket, 'optionalAccess', _406 => _406.length])) {
12933
+ if (_optionalChain([flags, 'access', _418 => _418.bucket, 'optionalAccess', _419 => _419.length])) {
13029
12934
  buckets = buckets.filter(
13030
12935
  (bucket) => flags.bucket.includes(bucket.type)
13031
12936
  );
13032
12937
  }
13033
12938
  ora.succeed("Buckets retrieved");
13034
- if (_optionalChain([flags, 'access', _407 => _407.file, 'optionalAccess', _408 => _408.length])) {
12939
+ if (_optionalChain([flags, 'access', _420 => _420.file, 'optionalAccess', _421 => _421.length])) {
13035
12940
  buckets = buckets.map((bucket) => {
13036
12941
  const paths = bucket.paths.filter(
13037
12942
  (path19) => flags.file.find(
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)
12943
+ (file) => _optionalChain([path19, 'access', _422 => _422.pathPattern, 'optionalAccess', _423 => _423.includes, 'call', _424 => _424(file)]) || _optionalChain([path19, 'access', _425 => _425.pathPattern, 'optionalAccess', _426 => _426.match, 'call', _427 => _427(file)]) || minimatch(path19.pathPattern, file)
13039
12944
  )
13040
12945
  );
13041
12946
  return { ...bucket, paths };
@@ -13055,7 +12960,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
13055
12960
  });
13056
12961
  }
13057
12962
  }
13058
- const targetLocales = _optionalChain([flags, 'access', _415 => _415.locale, 'optionalAccess', _416 => _416.length]) ? flags.locale : i18nConfig.locale.targets;
12963
+ const targetLocales = _optionalChain([flags, 'access', _428 => _428.locale, 'optionalAccess', _429 => _429.length]) ? flags.locale : i18nConfig.locale.targets;
13059
12964
  let totalSourceKeyCount = 0;
13060
12965
  let uniqueKeysToTranslate = 0;
13061
12966
  let totalExistingTranslations = 0;
@@ -13463,12 +13368,12 @@ function validateParams2(i18nConfig, flags) {
13463
13368
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
13464
13369
  docUrl: "bucketNotFound"
13465
13370
  });
13466
- } else if (_optionalChain([flags, 'access', _417 => _417.locale, 'optionalAccess', _418 => _418.some, 'call', _419 => _419((locale) => !i18nConfig.locale.targets.includes(locale))])) {
13371
+ } else if (_optionalChain([flags, 'access', _430 => _430.locale, 'optionalAccess', _431 => _431.some, 'call', _432 => _432((locale) => !i18nConfig.locale.targets.includes(locale))])) {
13467
13372
  throw new CLIError({
13468
13373
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
13469
13374
  docUrl: "localeTargetNotFound"
13470
13375
  });
13471
- } else if (_optionalChain([flags, 'access', _420 => _420.bucket, 'optionalAccess', _421 => _421.some, 'call', _422 => _422(
13376
+ } else if (_optionalChain([flags, 'access', _433 => _433.bucket, 'optionalAccess', _434 => _434.some, 'call', _435 => _435(
13472
13377
  (bucket) => !i18nConfig.buckets[bucket]
13473
13378
  )])) {
13474
13379
  throw new CLIError({
@@ -13560,7 +13465,7 @@ async function renderHero2() {
13560
13465
  // package.json
13561
13466
  var package_default = {
13562
13467
  name: "lingo.dev",
13563
- version: "0.116.2",
13468
+ version: "0.116.4",
13564
13469
  description: "Lingo.dev CLI",
13565
13470
  private: false,
13566
13471
  publishConfig: {
@@ -13852,7 +13757,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
13852
13757
  if (options.file && options.file.length) {
13853
13758
  buckets = buckets.map((bucket) => {
13854
13759
  const paths = bucket.paths.filter(
13855
- (bucketPath) => _optionalChain([options, 'access', _423 => _423.file, 'optionalAccess', _424 => _424.some, 'call', _425 => _425((f) => bucketPath.pathPattern.includes(f))])
13760
+ (bucketPath) => _optionalChain([options, 'access', _436 => _436.file, 'optionalAccess', _437 => _437.some, 'call', _438 => _438((f) => bucketPath.pathPattern.includes(f))])
13856
13761
  );
13857
13762
  return { ...bucket, paths };
13858
13763
  }).filter((bucket) => bucket.paths.length > 0);