lingo.dev 0.113.6 → 0.113.7

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
@@ -3637,39 +3637,320 @@ function parsePropertyLine(line) {
3637
3637
  };
3638
3638
  }
3639
3639
 
3640
+ // src/cli/loaders/xcode-strings/tokenizer.ts
3641
+ var Tokenizer = class {
3642
+
3643
+
3644
+
3645
+
3646
+ constructor(input2) {
3647
+ this.input = input2;
3648
+ this.pos = 0;
3649
+ this.line = 1;
3650
+ this.column = 1;
3651
+ }
3652
+ tokenize() {
3653
+ const tokens = [];
3654
+ while (this.pos < this.input.length) {
3655
+ const char = this.current();
3656
+ if (this.isWhitespace(char)) {
3657
+ this.advance();
3658
+ continue;
3659
+ }
3660
+ if (char === "/" && this.peek() === "/") {
3661
+ tokens.push(this.scanSingleLineComment());
3662
+ continue;
3663
+ }
3664
+ if (char === "/" && this.peek() === "*") {
3665
+ tokens.push(this.scanMultiLineComment());
3666
+ continue;
3667
+ }
3668
+ if (char === '"') {
3669
+ tokens.push(this.scanString());
3670
+ continue;
3671
+ }
3672
+ if (char === "=") {
3673
+ tokens.push(this.makeToken("EQUALS" /* EQUALS */, "="));
3674
+ this.advance();
3675
+ continue;
3676
+ }
3677
+ if (char === ";") {
3678
+ tokens.push(this.makeToken("SEMICOLON" /* SEMICOLON */, ";"));
3679
+ this.advance();
3680
+ continue;
3681
+ }
3682
+ this.advance();
3683
+ }
3684
+ tokens.push(this.makeToken("EOF" /* EOF */, ""));
3685
+ return tokens;
3686
+ }
3687
+ scanString() {
3688
+ const start = this.getPosition();
3689
+ let value = "";
3690
+ this.advance();
3691
+ while (this.pos < this.input.length) {
3692
+ const char = this.current();
3693
+ if (char === "\\") {
3694
+ this.advance();
3695
+ if (this.pos < this.input.length) {
3696
+ const nextChar = this.current();
3697
+ value += "\\" + nextChar;
3698
+ this.advance();
3699
+ }
3700
+ continue;
3701
+ }
3702
+ if (char === '"') {
3703
+ this.advance();
3704
+ return {
3705
+ type: "STRING" /* STRING */,
3706
+ value,
3707
+ ...start
3708
+ };
3709
+ }
3710
+ value += char;
3711
+ this.advance();
3712
+ }
3713
+ return {
3714
+ type: "STRING" /* STRING */,
3715
+ value,
3716
+ ...start
3717
+ };
3718
+ }
3719
+ scanSingleLineComment() {
3720
+ const start = this.getPosition();
3721
+ let value = "";
3722
+ this.advance();
3723
+ this.advance();
3724
+ while (this.pos < this.input.length && this.current() !== "\n") {
3725
+ value += this.current();
3726
+ this.advance();
3727
+ }
3728
+ return {
3729
+ type: "COMMENT_SINGLE" /* COMMENT_SINGLE */,
3730
+ value,
3731
+ ...start
3732
+ };
3733
+ }
3734
+ scanMultiLineComment() {
3735
+ const start = this.getPosition();
3736
+ let value = "";
3737
+ this.advance();
3738
+ this.advance();
3739
+ while (this.pos < this.input.length) {
3740
+ if (this.current() === "*" && this.peek() === "/") {
3741
+ this.advance();
3742
+ this.advance();
3743
+ return {
3744
+ type: "COMMENT_MULTI" /* COMMENT_MULTI */,
3745
+ value,
3746
+ ...start
3747
+ };
3748
+ }
3749
+ value += this.current();
3750
+ this.advance();
3751
+ }
3752
+ return {
3753
+ type: "COMMENT_MULTI" /* COMMENT_MULTI */,
3754
+ value,
3755
+ ...start
3756
+ };
3757
+ }
3758
+ current() {
3759
+ return this.input[this.pos];
3760
+ }
3761
+ peek() {
3762
+ if (this.pos + 1 < this.input.length) {
3763
+ return this.input[this.pos + 1];
3764
+ }
3765
+ return null;
3766
+ }
3767
+ advance() {
3768
+ if (this.pos < this.input.length) {
3769
+ if (this.current() === "\n") {
3770
+ this.line++;
3771
+ this.column = 1;
3772
+ } else {
3773
+ this.column++;
3774
+ }
3775
+ this.pos++;
3776
+ }
3777
+ }
3778
+ isWhitespace(char) {
3779
+ return char === " " || char === " " || char === "\n" || char === "\r";
3780
+ }
3781
+ getPosition() {
3782
+ return {
3783
+ line: this.line,
3784
+ column: this.column
3785
+ };
3786
+ }
3787
+ makeToken(type, value) {
3788
+ return {
3789
+ type,
3790
+ value,
3791
+ ...this.getPosition()
3792
+ };
3793
+ }
3794
+ };
3795
+
3796
+ // src/cli/loaders/xcode-strings/escape.ts
3797
+ function unescapeString(raw) {
3798
+ let result = "";
3799
+ let i = 0;
3800
+ while (i < raw.length) {
3801
+ if (raw[i] === "\\" && i + 1 < raw.length) {
3802
+ const nextChar = raw[i + 1];
3803
+ switch (nextChar) {
3804
+ case '"':
3805
+ result += '"';
3806
+ i += 2;
3807
+ break;
3808
+ case "\\":
3809
+ result += "\\";
3810
+ i += 2;
3811
+ break;
3812
+ case "n":
3813
+ result += "\n";
3814
+ i += 2;
3815
+ break;
3816
+ case "t":
3817
+ result += " ";
3818
+ i += 2;
3819
+ break;
3820
+ case "r":
3821
+ result += "\r";
3822
+ i += 2;
3823
+ break;
3824
+ default:
3825
+ result += raw[i];
3826
+ i++;
3827
+ break;
3828
+ }
3829
+ } else {
3830
+ result += raw[i];
3831
+ i++;
3832
+ }
3833
+ }
3834
+ return result;
3835
+ }
3836
+ function escapeString(str) {
3837
+ if (str == null) {
3838
+ return "";
3839
+ }
3840
+ let result = "";
3841
+ for (let i = 0; i < str.length; i++) {
3842
+ const char = str[i];
3843
+ switch (char) {
3844
+ case "\\":
3845
+ result += "\\\\";
3846
+ break;
3847
+ case '"':
3848
+ result += '\\"';
3849
+ break;
3850
+ case "\n":
3851
+ result += "\\n";
3852
+ break;
3853
+ case "\r":
3854
+ result += "\\r";
3855
+ break;
3856
+ case " ":
3857
+ result += "\\t";
3858
+ break;
3859
+ default:
3860
+ result += char;
3861
+ break;
3862
+ }
3863
+ }
3864
+ return result;
3865
+ }
3866
+
3867
+ // src/cli/loaders/xcode-strings/parser.ts
3868
+ var Parser = class {
3869
+
3870
+
3871
+ constructor(tokens) {
3872
+ this.tokens = tokens;
3873
+ this.pos = 0;
3874
+ }
3875
+ parse() {
3876
+ const result = {};
3877
+ while (this.pos < this.tokens.length) {
3878
+ const token = this.current();
3879
+ if (token.type === "COMMENT_SINGLE" /* COMMENT_SINGLE */ || token.type === "COMMENT_MULTI" /* COMMENT_MULTI */) {
3880
+ this.advance();
3881
+ continue;
3882
+ }
3883
+ if (token.type === "EOF" /* EOF */) {
3884
+ break;
3885
+ }
3886
+ if (token.type === "STRING" /* STRING */) {
3887
+ const entry = this.parseEntry();
3888
+ if (entry) {
3889
+ result[entry.key] = entry.value;
3890
+ }
3891
+ continue;
3892
+ }
3893
+ this.advance();
3894
+ }
3895
+ return result;
3896
+ }
3897
+ parseEntry() {
3898
+ const keyToken = this.current();
3899
+ if (keyToken.type !== "STRING" /* STRING */) {
3900
+ return null;
3901
+ }
3902
+ const key = keyToken.value;
3903
+ this.advance();
3904
+ if (!this.expect("EQUALS" /* EQUALS */)) {
3905
+ return null;
3906
+ }
3907
+ const valueToken = this.current();
3908
+ if (valueToken.type !== "STRING" /* STRING */) {
3909
+ return null;
3910
+ }
3911
+ const rawValue = valueToken.value;
3912
+ this.advance();
3913
+ if (!this.expect("SEMICOLON" /* SEMICOLON */)) {
3914
+ }
3915
+ const value = unescapeString(rawValue);
3916
+ return { key, value };
3917
+ }
3918
+ current() {
3919
+ return this.tokens[this.pos];
3920
+ }
3921
+ advance() {
3922
+ if (this.pos < this.tokens.length) {
3923
+ this.pos++;
3924
+ }
3925
+ }
3926
+ expect(type) {
3927
+ if (_optionalChain([this, 'access', _167 => _167.current, 'call', _168 => _168(), 'optionalAccess', _169 => _169.type]) === type) {
3928
+ this.advance();
3929
+ return true;
3930
+ }
3931
+ return false;
3932
+ }
3933
+ };
3934
+
3640
3935
  // src/cli/loaders/xcode-strings.ts
3641
3936
  function createXcodeStringsLoader() {
3642
3937
  return createLoader({
3643
3938
  async pull(locale, input2) {
3644
- const lines = input2.split("\n");
3645
- const result = {};
3646
- for (const line of lines) {
3647
- const trimmedLine = line.trim();
3648
- if (trimmedLine && !trimmedLine.startsWith("//")) {
3649
- const match2 = trimmedLine.match(/^"(.+)"\s*=\s*"(.+)";$/);
3650
- if (match2) {
3651
- const [, key, value] = match2;
3652
- result[key] = unescapeXcodeString(value);
3653
- }
3654
- }
3655
- }
3939
+ const tokenizer = new Tokenizer(input2);
3940
+ const tokens = tokenizer.tokenize();
3941
+ const parser = new Parser(tokens);
3942
+ const result = parser.parse();
3656
3943
  return result;
3657
3944
  },
3658
3945
  async push(locale, payload) {
3659
- const lines = Object.entries(payload).map(([key, value]) => {
3660
- const escapedValue = escapeXcodeString(value);
3946
+ const lines = Object.entries(payload).filter(([_36, value]) => value != null).map(([key, value]) => {
3947
+ const escapedValue = escapeString(value);
3661
3948
  return `"${key}" = "${escapedValue}";`;
3662
3949
  });
3663
3950
  return lines.join("\n");
3664
3951
  }
3665
3952
  });
3666
3953
  }
3667
- function unescapeXcodeString(str) {
3668
- return str.replace(/\\"/g, '"').replace(/\\n/g, "\n").replace(/\\\\/g, "\\");
3669
- }
3670
- function escapeXcodeString(str) {
3671
- return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n");
3672
- }
3673
3954
 
3674
3955
  // src/cli/loaders/xcode-stringsdict.ts
3675
3956
  var _plist = require('plist'); var _plist2 = _interopRequireDefault(_plist);
@@ -3720,7 +4001,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
3720
4001
  if (rootTranslationEntity.shouldTranslate === false) {
3721
4002
  continue;
3722
4003
  }
3723
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _167 => _167.localizations, 'optionalAccess', _168 => _168[locale]]);
4004
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _170 => _170.localizations, 'optionalAccess', _171 => _171[locale]]);
3724
4005
  if (langTranslationEntity) {
3725
4006
  if ("stringUnit" in langTranslationEntity) {
3726
4007
  resultData[translationKey] = langTranslationEntity.stringUnit.value;
@@ -3729,7 +4010,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
3729
4010
  resultData[translationKey] = {};
3730
4011
  const pluralForms = langTranslationEntity.variations.plural;
3731
4012
  for (const form in pluralForms) {
3732
- if (_optionalChain([pluralForms, 'access', _169 => _169[form], 'optionalAccess', _170 => _170.stringUnit, 'optionalAccess', _171 => _171.value])) {
4013
+ if (_optionalChain([pluralForms, 'access', _172 => _172[form], 'optionalAccess', _173 => _173.stringUnit, 'optionalAccess', _174 => _174.value])) {
3733
4014
  resultData[translationKey][form] = pluralForms[form].stringUnit.value;
3734
4015
  }
3735
4016
  }
@@ -3755,7 +4036,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
3755
4036
  const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
3756
4037
  if (typeof value === "string") {
3757
4038
  langDataToMerge.strings[key] = {
3758
- extractionState: _optionalChain([originalInput, 'optionalAccess', _172 => _172.strings, 'optionalAccess', _173 => _173[key], 'optionalAccess', _174 => _174.extractionState]),
4039
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _175 => _175.strings, 'optionalAccess', _176 => _176[key], 'optionalAccess', _177 => _177.extractionState]),
3759
4040
  localizations: {
3760
4041
  [locale]: {
3761
4042
  stringUnit: {
@@ -3813,7 +4094,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
3813
4094
  for (const [locale, localization] of Object.entries(
3814
4095
  entity.localizations
3815
4096
  )) {
3816
- if (_optionalChain([localization, 'access', _175 => _175.variations, 'optionalAccess', _176 => _176.plural])) {
4097
+ if (_optionalChain([localization, 'access', _178 => _178.variations, 'optionalAccess', _179 => _179.plural])) {
3817
4098
  const pluralForms = localization.variations.plural;
3818
4099
  for (const form in pluralForms) {
3819
4100
  const pluralKey = `${translationKey}/${form}`;
@@ -3833,7 +4114,7 @@ function _removeLocale(input2, locale) {
3833
4114
  const { strings } = input2;
3834
4115
  const newStrings = _lodash2.default.cloneDeep(strings);
3835
4116
  for (const [key, value] of Object.entries(newStrings)) {
3836
- if (_optionalChain([value, 'access', _177 => _177.localizations, 'optionalAccess', _178 => _178[locale]])) {
4117
+ if (_optionalChain([value, 'access', _180 => _180.localizations, 'optionalAccess', _181 => _181[locale]])) {
3837
4118
  delete value.localizations[locale];
3838
4119
  }
3839
4120
  }
@@ -4025,14 +4306,14 @@ function pluralWithMetaToXcstrings(data) {
4025
4306
  if (element.type === "literal") {
4026
4307
  text += element.value;
4027
4308
  } else if (element.type === "pound") {
4028
- const pluralVar = Object.entries(_optionalChain([data, 'access', _179 => _179._meta, 'optionalAccess', _180 => _180.variables]) || {}).find(
4309
+ const pluralVar = Object.entries(_optionalChain([data, 'access', _182 => _182._meta, 'optionalAccess', _183 => _183.variables]) || {}).find(
4029
4310
  ([_36, meta]) => meta.role === "plural"
4030
4311
  );
4031
- text += _optionalChain([pluralVar, 'optionalAccess', _181 => _181[1], 'access', _182 => _182.format]) || "%lld";
4312
+ text += _optionalChain([pluralVar, 'optionalAccess', _184 => _184[1], 'access', _185 => _185.format]) || "%lld";
4032
4313
  } else if (element.type === "argument") {
4033
4314
  const varName = element.value;
4034
- const varMeta = _optionalChain([data, 'access', _183 => _183._meta, 'optionalAccess', _184 => _184.variables, 'optionalAccess', _185 => _185[varName]]);
4035
- text += _optionalChain([varMeta, 'optionalAccess', _186 => _186.format]) || "%@";
4315
+ const varMeta = _optionalChain([data, 'access', _186 => _186._meta, 'optionalAccess', _187 => _187.variables, 'optionalAccess', _188 => _188[varName]]);
4316
+ text += _optionalChain([varMeta, 'optionalAccess', _189 => _189.format]) || "%@";
4036
4317
  }
4037
4318
  }
4038
4319
  let xcstringsFormName = form;
@@ -4410,8 +4691,8 @@ async function formatDataWithBiome(data, filePath, options) {
4410
4691
  });
4411
4692
  return formatted.content;
4412
4693
  } catch (error) {
4413
- const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _187 => _187.stackTrace, 'optionalAccess', _188 => _188.toString, 'call', _189 => _189(), 'access', _190 => _190.split, 'call', _191 => _191("\n"), 'access', _192 => _192[0]]) : "";
4414
- if (_optionalChain([errorMessage, 'optionalAccess', _193 => _193.includes, 'call', _194 => _194("does not exist in the workspace")])) {
4694
+ const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _190 => _190.stackTrace, 'optionalAccess', _191 => _191.toString, 'call', _192 => _192(), 'access', _193 => _193.split, 'call', _194 => _194("\n"), 'access', _195 => _195[0]]) : "";
4695
+ if (_optionalChain([errorMessage, 'optionalAccess', _196 => _196.includes, 'call', _197 => _197("does not exist in the workspace")])) {
4415
4696
  } else {
4416
4697
  console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
4417
4698
  if (errorMessage) {
@@ -4458,7 +4739,7 @@ function createPoDataLoader(params) {
4458
4739
  Object.entries(entries).forEach(([msgid, entry]) => {
4459
4740
  if (msgid && entry.msgid) {
4460
4741
  const context = entry.msgctxt || "";
4461
- const fullEntry = _optionalChain([parsedPo, 'access', _195 => _195.translations, 'access', _196 => _196[context], 'optionalAccess', _197 => _197[msgid]]);
4742
+ const fullEntry = _optionalChain([parsedPo, 'access', _198 => _198.translations, 'access', _199 => _199[context], 'optionalAccess', _200 => _200[msgid]]);
4462
4743
  if (fullEntry) {
4463
4744
  result[msgid] = fullEntry;
4464
4745
  }
@@ -4468,8 +4749,8 @@ function createPoDataLoader(params) {
4468
4749
  return result;
4469
4750
  },
4470
4751
  async push(locale, data, originalInput, originalLocale, pullInput) {
4471
- const currentSections = _optionalChain([pullInput, 'optionalAccess', _198 => _198.split, 'call', _199 => _199("\n\n"), 'access', _200 => _200.filter, 'call', _201 => _201(Boolean)]) || [];
4472
- const originalSections = _optionalChain([originalInput, 'optionalAccess', _202 => _202.split, 'call', _203 => _203("\n\n"), 'access', _204 => _204.filter, 'call', _205 => _205(Boolean)]) || [];
4752
+ const currentSections = _optionalChain([pullInput, 'optionalAccess', _201 => _201.split, 'call', _202 => _202("\n\n"), 'access', _203 => _203.filter, 'call', _204 => _204(Boolean)]) || [];
4753
+ const originalSections = _optionalChain([originalInput, 'optionalAccess', _205 => _205.split, 'call', _206 => _206("\n\n"), 'access', _207 => _207.filter, 'call', _208 => _208(Boolean)]) || [];
4473
4754
  const result = originalSections.map((section) => {
4474
4755
  const sectionPo = _gettextparser2.default.po.parse(section);
4475
4756
  if (Object.keys(sectionPo.translations).length === 0) {
@@ -4538,8 +4819,8 @@ function createPoContentLoader() {
4538
4819
  {
4539
4820
  ...entry,
4540
4821
  msgstr: [
4541
- _optionalChain([data, 'access', _206 => _206[entry.msgid], 'optionalAccess', _207 => _207.singular]),
4542
- _optionalChain([data, 'access', _208 => _208[entry.msgid], 'optionalAccess', _209 => _209.plural]) || null
4822
+ _optionalChain([data, 'access', _209 => _209[entry.msgid], 'optionalAccess', _210 => _210.singular]),
4823
+ _optionalChain([data, 'access', _211 => _211[entry.msgid], 'optionalAccess', _212 => _212.plural]) || null
4543
4824
  ].filter(Boolean)
4544
4825
  }
4545
4826
  ]).fromPairs().value();
@@ -4661,7 +4942,7 @@ function pullV1(xliffElement, locale, originalLocale) {
4661
4942
  let key = getTransUnitKey(unit);
4662
4943
  if (!key) return;
4663
4944
  if (seenKeys.has(key)) {
4664
- const id = _optionalChain([unit, 'access', _210 => _210.getAttribute, 'call', _211 => _211("id"), 'optionalAccess', _212 => _212.trim, 'call', _213 => _213()]);
4945
+ const id = _optionalChain([unit, 'access', _213 => _213.getAttribute, 'call', _214 => _214("id"), 'optionalAccess', _215 => _215.trim, 'call', _216 => _216()]);
4665
4946
  if (id) {
4666
4947
  key = `${key}#${id}`;
4667
4948
  } else {
@@ -4709,7 +4990,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
4709
4990
  let key = getTransUnitKey(unit);
4710
4991
  if (!key) return;
4711
4992
  if (seenKeys.has(key)) {
4712
- const id = _optionalChain([unit, 'access', _214 => _214.getAttribute, 'call', _215 => _215("id"), 'optionalAccess', _216 => _216.trim, 'call', _217 => _217()]);
4993
+ const id = _optionalChain([unit, 'access', _217 => _217.getAttribute, 'call', _218 => _218("id"), 'optionalAccess', _219 => _219.trim, 'call', _220 => _220()]);
4713
4994
  if (id) {
4714
4995
  key = `${key}#${id}`;
4715
4996
  } else {
@@ -4751,7 +5032,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
4751
5032
  const translationKeys = new Set(Object.keys(translations));
4752
5033
  existingUnits.forEach((unit, key) => {
4753
5034
  if (!translationKeys.has(key)) {
4754
- _optionalChain([unit, 'access', _218 => _218.parentNode, 'optionalAccess', _219 => _219.removeChild, 'call', _220 => _220(unit)]);
5035
+ _optionalChain([unit, 'access', _221 => _221.parentNode, 'optionalAccess', _222 => _222.removeChild, 'call', _223 => _223(unit)]);
4755
5036
  }
4756
5037
  });
4757
5038
  return serializeWithDeclaration(
@@ -4794,18 +5075,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
4794
5075
  Array.from(container.children).forEach((child) => {
4795
5076
  const tagName = child.tagName;
4796
5077
  if (tagName === "unit") {
4797
- const unitId = _optionalChain([child, 'access', _221 => _221.getAttribute, 'call', _222 => _222("id"), 'optionalAccess', _223 => _223.trim, 'call', _224 => _224()]);
5078
+ const unitId = _optionalChain([child, 'access', _224 => _224.getAttribute, 'call', _225 => _225("id"), 'optionalAccess', _226 => _226.trim, 'call', _227 => _227()]);
4798
5079
  if (!unitId) return;
4799
5080
  const key = `resources/${fileId}/${currentPath}${unitId}/source`;
4800
5081
  const segment = child.querySelector("segment");
4801
- const source = _optionalChain([segment, 'optionalAccess', _225 => _225.querySelector, 'call', _226 => _226("source")]);
5082
+ const source = _optionalChain([segment, 'optionalAccess', _228 => _228.querySelector, 'call', _229 => _229("source")]);
4802
5083
  if (source) {
4803
5084
  result[key] = extractTextContent(source);
4804
5085
  } else {
4805
5086
  result[key] = unitId;
4806
5087
  }
4807
5088
  } else if (tagName === "group") {
4808
- const groupId = _optionalChain([child, 'access', _227 => _227.getAttribute, 'call', _228 => _228("id"), 'optionalAccess', _229 => _229.trim, 'call', _230 => _230()]);
5089
+ const groupId = _optionalChain([child, 'access', _230 => _230.getAttribute, 'call', _231 => _231("id"), 'optionalAccess', _232 => _232.trim, 'call', _233 => _233()]);
4809
5090
  const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
4810
5091
  traverseUnitsV2(child, fileId, newPath, result);
4811
5092
  }
@@ -4841,12 +5122,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
4841
5122
  Array.from(container.children).forEach((child) => {
4842
5123
  const tagName = child.tagName;
4843
5124
  if (tagName === "unit") {
4844
- const unitId = _optionalChain([child, 'access', _231 => _231.getAttribute, 'call', _232 => _232("id"), 'optionalAccess', _233 => _233.trim, 'call', _234 => _234()]);
5125
+ const unitId = _optionalChain([child, 'access', _234 => _234.getAttribute, 'call', _235 => _235("id"), 'optionalAccess', _236 => _236.trim, 'call', _237 => _237()]);
4845
5126
  if (!unitId) return;
4846
5127
  const key = `resources/${fileId}/${currentPath}${unitId}/source`;
4847
5128
  index.set(key, child);
4848
5129
  } else if (tagName === "group") {
4849
- const groupId = _optionalChain([child, 'access', _235 => _235.getAttribute, 'call', _236 => _236("id"), 'optionalAccess', _237 => _237.trim, 'call', _238 => _238()]);
5130
+ const groupId = _optionalChain([child, 'access', _238 => _238.getAttribute, 'call', _239 => _239("id"), 'optionalAccess', _240 => _240.trim, 'call', _241 => _241()]);
4850
5131
  const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
4851
5132
  indexUnitsV2(child, fileId, newPath, index);
4852
5133
  }
@@ -4867,9 +5148,9 @@ function updateUnitV2(unit, value) {
4867
5148
  setTextContent(source, value);
4868
5149
  }
4869
5150
  function getTransUnitKey(transUnit) {
4870
- const resname = _optionalChain([transUnit, 'access', _239 => _239.getAttribute, 'call', _240 => _240("resname"), 'optionalAccess', _241 => _241.trim, 'call', _242 => _242()]);
5151
+ const resname = _optionalChain([transUnit, 'access', _242 => _242.getAttribute, 'call', _243 => _243("resname"), 'optionalAccess', _244 => _244.trim, 'call', _245 => _245()]);
4871
5152
  if (resname) return resname;
4872
- const id = _optionalChain([transUnit, 'access', _243 => _243.getAttribute, 'call', _244 => _244("id"), 'optionalAccess', _245 => _245.trim, 'call', _246 => _246()]);
5153
+ const id = _optionalChain([transUnit, 'access', _246 => _246.getAttribute, 'call', _247 => _247("id"), 'optionalAccess', _248 => _248.trim, 'call', _249 => _249()]);
4873
5154
  if (id) return id;
4874
5155
  const sourceElement = transUnit.querySelector("source");
4875
5156
  if (sourceElement) {
@@ -4926,7 +5207,7 @@ function formatXml(xml) {
4926
5207
  if (cdataNode) {
4927
5208
  return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
4928
5209
  }
4929
- const textContent = _optionalChain([element, 'access', _247 => _247.textContent, 'optionalAccess', _248 => _248.trim, 'call', _249 => _249()]) || "";
5210
+ const textContent = _optionalChain([element, 'access', _250 => _250.textContent, 'optionalAccess', _251 => _251.trim, 'call', _252 => _252()]) || "";
4930
5211
  const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
4931
5212
  if (hasOnlyText && textContent) {
4932
5213
  return `${indent2}${openTag}${textContent}</${tagName}>`;
@@ -5219,7 +5500,7 @@ function createDatoClient(params) {
5219
5500
  ids: !records.length ? void 0 : records.join(",")
5220
5501
  }
5221
5502
  }).catch(
5222
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _250 => _250.response, 'optionalAccess', _251 => _251.body, 'optionalAccess', _252 => _252.data, 'optionalAccess', _253 => _253[0]]) || error)
5503
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _253 => _253.response, 'optionalAccess', _254 => _254.body, 'optionalAccess', _255 => _255.data, 'optionalAccess', _256 => _256[0]]) || error)
5223
5504
  );
5224
5505
  },
5225
5506
  findRecordsForModel: async (modelId, records) => {
@@ -5230,10 +5511,10 @@ function createDatoClient(params) {
5230
5511
  filter: {
5231
5512
  type: modelId,
5232
5513
  only_valid: "true",
5233
- ids: !_optionalChain([records, 'optionalAccess', _254 => _254.length]) ? void 0 : records.join(",")
5514
+ ids: !_optionalChain([records, 'optionalAccess', _257 => _257.length]) ? void 0 : records.join(",")
5234
5515
  }
5235
5516
  }).catch(
5236
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _255 => _255.response, 'optionalAccess', _256 => _256.body, 'optionalAccess', _257 => _257.data, 'optionalAccess', _258 => _258[0]]) || error)
5517
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _258 => _258.response, 'optionalAccess', _259 => _259.body, 'optionalAccess', _260 => _260.data, 'optionalAccess', _261 => _261[0]]) || error)
5237
5518
  );
5238
5519
  return result;
5239
5520
  } catch (_error) {
@@ -5249,10 +5530,10 @@ function createDatoClient(params) {
5249
5530
  updateRecord: async (id, payload) => {
5250
5531
  try {
5251
5532
  await dato.items.update(id, payload).catch(
5252
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _259 => _259.response, 'optionalAccess', _260 => _260.body, 'optionalAccess', _261 => _261.data, 'optionalAccess', _262 => _262[0]]) || error)
5533
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _262 => _262.response, 'optionalAccess', _263 => _263.body, 'optionalAccess', _264 => _264.data, 'optionalAccess', _265 => _265[0]]) || error)
5253
5534
  );
5254
5535
  } catch (_error) {
5255
- if (_optionalChain([_error, 'optionalAccess', _263 => _263.attributes, 'optionalAccess', _264 => _264.details, 'optionalAccess', _265 => _265.message])) {
5536
+ if (_optionalChain([_error, 'optionalAccess', _266 => _266.attributes, 'optionalAccess', _267 => _267.details, 'optionalAccess', _268 => _268.message])) {
5256
5537
  throw new Error(
5257
5538
  [
5258
5539
  `${_error.attributes.details.message}`,
@@ -5274,10 +5555,10 @@ function createDatoClient(params) {
5274
5555
  enableFieldLocalization: async (args) => {
5275
5556
  try {
5276
5557
  await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
5277
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _266 => _266.response, 'optionalAccess', _267 => _267.body, 'optionalAccess', _268 => _268.data, 'optionalAccess', _269 => _269[0]]) || error)
5558
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _269 => _269.response, 'optionalAccess', _270 => _270.body, 'optionalAccess', _271 => _271.data, 'optionalAccess', _272 => _272[0]]) || error)
5278
5559
  );
5279
5560
  } catch (_error) {
5280
- if (_optionalChain([_error, 'optionalAccess', _270 => _270.attributes, 'optionalAccess', _271 => _271.code]) === "NOT_FOUND") {
5561
+ if (_optionalChain([_error, 'optionalAccess', _273 => _273.attributes, 'optionalAccess', _274 => _274.code]) === "NOT_FOUND") {
5281
5562
  throw new Error(
5282
5563
  [
5283
5564
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -5285,7 +5566,7 @@ function createDatoClient(params) {
5285
5566
  ].join("\n\n")
5286
5567
  );
5287
5568
  }
5288
- if (_optionalChain([_error, 'optionalAccess', _272 => _272.attributes, 'optionalAccess', _273 => _273.details, 'optionalAccess', _274 => _274.message])) {
5569
+ if (_optionalChain([_error, 'optionalAccess', _275 => _275.attributes, 'optionalAccess', _276 => _276.details, 'optionalAccess', _277 => _277.message])) {
5289
5570
  throw new Error(
5290
5571
  [
5291
5572
  `${_error.attributes.details.message}`,
@@ -5363,7 +5644,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
5363
5644
  const records = await dato.findRecordsForModel(modelId);
5364
5645
  const recordChoices = createRecordChoices(
5365
5646
  records,
5366
- _optionalChain([config, 'access', _275 => _275.models, 'access', _276 => _276[modelId], 'optionalAccess', _277 => _277.records]) || [],
5647
+ _optionalChain([config, 'access', _278 => _278.models, 'access', _279 => _279[modelId], 'optionalAccess', _280 => _280.records]) || [],
5367
5648
  project
5368
5649
  );
5369
5650
  const selectedRecords = await promptRecordSelection(
@@ -5382,14 +5663,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
5382
5663
  },
5383
5664
  async pull(locale, input2, initCtx) {
5384
5665
  const result = {};
5385
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _278 => _278.models]) || {})) {
5386
- let records = _optionalChain([initCtx, 'optionalAccess', _279 => _279.models, 'access', _280 => _280[modelId], 'access', _281 => _281.records]) || [];
5666
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _281 => _281.models]) || {})) {
5667
+ let records = _optionalChain([initCtx, 'optionalAccess', _282 => _282.models, 'access', _283 => _283[modelId], 'access', _284 => _284.records]) || [];
5387
5668
  const recordIds = records.map((record) => record.id);
5388
5669
  records = await dato.findRecords(recordIds);
5389
5670
  console.log(`Fetched ${records.length} records for model ${modelId}`);
5390
5671
  if (records.length > 0) {
5391
5672
  result[modelId] = {
5392
- fields: _optionalChain([initCtx, 'optionalAccess', _282 => _282.models, 'optionalAccess', _283 => _283[modelId], 'optionalAccess', _284 => _284.fields]) || [],
5673
+ fields: _optionalChain([initCtx, 'optionalAccess', _285 => _285.models, 'optionalAccess', _286 => _286[modelId], 'optionalAccess', _287 => _287.fields]) || [],
5393
5674
  records
5394
5675
  };
5395
5676
  }
@@ -5452,7 +5733,7 @@ function createRecordChoices(records, selectedIds = [], project) {
5452
5733
  return records.map((record) => ({
5453
5734
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
5454
5735
  value: record.id,
5455
- checked: _optionalChain([selectedIds, 'optionalAccess', _285 => _285.includes, 'call', _286 => _286(record.id)])
5736
+ checked: _optionalChain([selectedIds, 'optionalAccess', _288 => _288.includes, 'call', _289 => _289(record.id)])
5456
5737
  }));
5457
5738
  }
5458
5739
  async function promptRecordSelection(modelName, choices) {
@@ -5771,7 +6052,7 @@ function createVttLoader() {
5771
6052
  if (!input2) {
5772
6053
  return "";
5773
6054
  }
5774
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _287 => _287.parse, 'call', _288 => _288(input2), 'optionalAccess', _289 => _289.cues]);
6055
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _290 => _290.parse, 'call', _291 => _291(input2), 'optionalAccess', _292 => _292.cues]);
5775
6056
  if (Object.keys(vtt).length === 0) {
5776
6057
  return {};
5777
6058
  } else {
@@ -5834,7 +6115,7 @@ function variableExtractLoader(params) {
5834
6115
  for (let i = 0; i < matches.length; i++) {
5835
6116
  const match2 = matches[i];
5836
6117
  const currentValue = result[key].value;
5837
- const newValue = _optionalChain([currentValue, 'optionalAccess', _290 => _290.replace, 'call', _291 => _291(match2, `{variable:${i}}`)]);
6118
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _293 => _293.replace, 'call', _294 => _294(match2, `{variable:${i}}`)]);
5838
6119
  result[key].value = newValue;
5839
6120
  result[key].variables[i] = match2;
5840
6121
  }
@@ -5847,7 +6128,7 @@ function variableExtractLoader(params) {
5847
6128
  result[key] = valueObj.value;
5848
6129
  const resultValue = result[key];
5849
6130
  if (isICUPluralObject(resultValue)) {
5850
- const originalValue = _optionalChain([originalInput, 'optionalAccess', _292 => _292[key]]);
6131
+ const originalValue = _optionalChain([originalInput, 'optionalAccess', _295 => _295[key]]);
5851
6132
  if (isICUPluralObject(originalValue) && originalValue._meta) {
5852
6133
  resultValue._meta = originalValue._meta;
5853
6134
  resultValue[Symbol.for("@lingo.dev/icu-plural-object")] = true;
@@ -5857,7 +6138,7 @@ function variableExtractLoader(params) {
5857
6138
  const variable = valueObj.variables[i];
5858
6139
  const currentValue = result[key];
5859
6140
  if (typeof currentValue === "string") {
5860
- const newValue = _optionalChain([currentValue, 'optionalAccess', _293 => _293.replace, 'call', _294 => _294(`{variable:${i}}`, variable)]);
6141
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _296 => _296.replace, 'call', _297 => _297(`{variable:${i}}`, variable)]);
5861
6142
  result[key] = newValue;
5862
6143
  }
5863
6144
  }
@@ -6058,7 +6339,7 @@ function createVueJsonLoader() {
6058
6339
  return createLoader({
6059
6340
  pull: async (locale, input2, ctx) => {
6060
6341
  const parsed = parseVueFile(input2);
6061
- return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _295 => _295.i18n, 'optionalAccess', _296 => _296[locale]]), () => ( {}));
6342
+ return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _298 => _298.i18n, 'optionalAccess', _299 => _299[locale]]), () => ( {}));
6062
6343
  },
6063
6344
  push: async (locale, data, originalInput) => {
6064
6345
  const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
@@ -6243,7 +6524,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
6243
6524
  objectExpression.properties.forEach((prop) => {
6244
6525
  if (!t.isObjectProperty(prop)) return;
6245
6526
  const key = getPropertyKey(prop);
6246
- const incomingVal = _optionalChain([data, 'optionalAccess', _297 => _297[key]]);
6527
+ const incomingVal = _optionalChain([data, 'optionalAccess', _300 => _300[key]]);
6247
6528
  if (incomingVal === void 0) {
6248
6529
  return;
6249
6530
  }
@@ -6279,7 +6560,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
6279
6560
  let modified = false;
6280
6561
  arrayExpression.elements.forEach((element, index) => {
6281
6562
  if (!element) return;
6282
- const incomingVal = _optionalChain([incoming, 'optionalAccess', _298 => _298[index]]);
6563
+ const incomingVal = _optionalChain([incoming, 'optionalAccess', _301 => _301[index]]);
6283
6564
  if (incomingVal === void 0) return;
6284
6565
  if (t.isStringLiteral(element) && typeof incomingVal === "string") {
6285
6566
  if (element.value !== incomingVal) {
@@ -6770,7 +7051,7 @@ var AST = class _AST {
6770
7051
  const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
6771
7052
  if (this.isStart() && !this.type)
6772
7053
  ret.unshift([]);
6773
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _299 => _299.#parent, 'optionalAccess', _300 => _300.type]) === "!")) {
7054
+ if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _302 => _302.#parent, 'optionalAccess', _303 => _303.type]) === "!")) {
6774
7055
  ret.push({});
6775
7056
  }
6776
7057
  return ret;
@@ -6778,7 +7059,7 @@ var AST = class _AST {
6778
7059
  isStart() {
6779
7060
  if (this.#root === this)
6780
7061
  return true;
6781
- if (!_optionalChain([this, 'access', _301 => _301.#parent, 'optionalAccess', _302 => _302.isStart, 'call', _303 => _303()]))
7062
+ if (!_optionalChain([this, 'access', _304 => _304.#parent, 'optionalAccess', _305 => _305.isStart, 'call', _306 => _306()]))
6782
7063
  return false;
6783
7064
  if (this.#parentIndex === 0)
6784
7065
  return true;
@@ -6794,12 +7075,12 @@ var AST = class _AST {
6794
7075
  isEnd() {
6795
7076
  if (this.#root === this)
6796
7077
  return true;
6797
- if (_optionalChain([this, 'access', _304 => _304.#parent, 'optionalAccess', _305 => _305.type]) === "!")
7078
+ if (_optionalChain([this, 'access', _307 => _307.#parent, 'optionalAccess', _308 => _308.type]) === "!")
6798
7079
  return true;
6799
- if (!_optionalChain([this, 'access', _306 => _306.#parent, 'optionalAccess', _307 => _307.isEnd, 'call', _308 => _308()]))
7080
+ if (!_optionalChain([this, 'access', _309 => _309.#parent, 'optionalAccess', _310 => _310.isEnd, 'call', _311 => _311()]))
6800
7081
  return false;
6801
7082
  if (!this.type)
6802
- return _optionalChain([this, 'access', _309 => _309.#parent, 'optionalAccess', _310 => _310.isEnd, 'call', _311 => _311()]);
7083
+ return _optionalChain([this, 'access', _312 => _312.#parent, 'optionalAccess', _313 => _313.isEnd, 'call', _314 => _314()]);
6803
7084
  const pl = this.#parent ? this.#parent.#parts.length : 0;
6804
7085
  return this.#parentIndex === pl - 1;
6805
7086
  }
@@ -7044,7 +7325,7 @@ var AST = class _AST {
7044
7325
  }
7045
7326
  }
7046
7327
  let end = "";
7047
- if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _312 => _312.#parent, 'optionalAccess', _313 => _313.type]) === "!") {
7328
+ if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _315 => _315.#parent, 'optionalAccess', _316 => _316.type]) === "!") {
7048
7329
  end = "(?:$|\\/)";
7049
7330
  }
7050
7331
  const final2 = start2 + src + end;
@@ -8134,7 +8415,7 @@ function createMdxSectionsSplit2Loader() {
8134
8415
  const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
8135
8416
  const result = {
8136
8417
  frontmatter: data.frontmatter,
8137
- codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _314 => _314.codePlaceholders]) || {},
8418
+ codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _317 => _317.codePlaceholders]) || {},
8138
8419
  content
8139
8420
  };
8140
8421
  return result;
@@ -9167,7 +9448,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
9167
9448
  ]
9168
9449
  });
9169
9450
  const result = JSON.parse(response.text);
9170
- return _optionalChain([result, 'optionalAccess', _315 => _315.data]) || {};
9451
+ return _optionalChain([result, 'optionalAccess', _318 => _318.data]) || {};
9171
9452
  }
9172
9453
  }
9173
9454
  function extractPayloadChunks(payload) {
@@ -9250,7 +9531,7 @@ function getPureModelProvider(provider) {
9250
9531
 
9251
9532
  ${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
9252
9533
  `;
9253
- switch (_optionalChain([provider, 'optionalAccess', _316 => _316.id])) {
9534
+ switch (_optionalChain([provider, 'optionalAccess', _319 => _319.id])) {
9254
9535
  case "openai": {
9255
9536
  if (!process.env.OPENAI_API_KEY) {
9256
9537
  throw new Error(
@@ -9308,7 +9589,7 @@ function getPureModelProvider(provider) {
9308
9589
  })(provider.model);
9309
9590
  }
9310
9591
  default: {
9311
- throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _317 => _317.id])));
9592
+ throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _320 => _320.id])));
9312
9593
  }
9313
9594
  }
9314
9595
  }
@@ -9593,7 +9874,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
9593
9874
  validateParams(i18nConfig, flags);
9594
9875
  ora.succeed("Localization configuration is valid");
9595
9876
  ora.start("Connecting to Lingo.dev Localization Engine...");
9596
- const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _318 => _318.provider]);
9877
+ const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _321 => _321.provider]);
9597
9878
  if (isByokMode) {
9598
9879
  authId = null;
9599
9880
  ora.succeed("Using external provider (BYOK mode)");
@@ -9607,16 +9888,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
9607
9888
  flags
9608
9889
  });
9609
9890
  let buckets = getBuckets(i18nConfig);
9610
- if (_optionalChain([flags, 'access', _319 => _319.bucket, 'optionalAccess', _320 => _320.length])) {
9891
+ if (_optionalChain([flags, 'access', _322 => _322.bucket, 'optionalAccess', _323 => _323.length])) {
9611
9892
  buckets = buckets.filter(
9612
9893
  (bucket) => flags.bucket.includes(bucket.type)
9613
9894
  );
9614
9895
  }
9615
9896
  ora.succeed("Buckets retrieved");
9616
- if (_optionalChain([flags, 'access', _321 => _321.file, 'optionalAccess', _322 => _322.length])) {
9897
+ if (_optionalChain([flags, 'access', _324 => _324.file, 'optionalAccess', _325 => _325.length])) {
9617
9898
  buckets = buckets.map((bucket) => {
9618
9899
  const paths = bucket.paths.filter(
9619
- (path19) => flags.file.find((file) => _optionalChain([path19, 'access', _323 => _323.pathPattern, 'optionalAccess', _324 => _324.includes, 'call', _325 => _325(file)]))
9900
+ (path19) => flags.file.find((file) => _optionalChain([path19, 'access', _326 => _326.pathPattern, 'optionalAccess', _327 => _327.includes, 'call', _328 => _328(file)]))
9620
9901
  );
9621
9902
  return { ...bucket, paths };
9622
9903
  }).filter((bucket) => bucket.paths.length > 0);
@@ -9637,7 +9918,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
9637
9918
  });
9638
9919
  }
9639
9920
  }
9640
- const targetLocales = _optionalChain([flags, 'access', _326 => _326.locale, 'optionalAccess', _327 => _327.length]) ? flags.locale : i18nConfig.locale.targets;
9921
+ const targetLocales = _optionalChain([flags, 'access', _329 => _329.locale, 'optionalAccess', _330 => _330.length]) ? flags.locale : i18nConfig.locale.targets;
9641
9922
  ora.start("Setting up localization cache...");
9642
9923
  const checkLockfileProcessor = createDeltaProcessor("");
9643
9924
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -9923,7 +10204,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
9923
10204
  }
9924
10205
  const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
9925
10206
  const checksums = await deltaProcessor.createChecksums(sourceData);
9926
- if (!_optionalChain([flags, 'access', _328 => _328.locale, 'optionalAccess', _329 => _329.length])) {
10207
+ if (!_optionalChain([flags, 'access', _331 => _331.locale, 'optionalAccess', _332 => _332.length])) {
9927
10208
  await deltaProcessor.saveChecksums(checksums);
9928
10209
  }
9929
10210
  }
@@ -10047,12 +10328,12 @@ function validateParams(i18nConfig, flags) {
10047
10328
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
10048
10329
  docUrl: "bucketNotFound"
10049
10330
  });
10050
- } else if (_optionalChain([flags, 'access', _330 => _330.locale, 'optionalAccess', _331 => _331.some, 'call', _332 => _332((locale) => !i18nConfig.locale.targets.includes(locale))])) {
10331
+ } else if (_optionalChain([flags, 'access', _333 => _333.locale, 'optionalAccess', _334 => _334.some, 'call', _335 => _335((locale) => !i18nConfig.locale.targets.includes(locale))])) {
10051
10332
  throw new ValidationError({
10052
10333
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
10053
10334
  docUrl: "localeTargetNotFound"
10054
10335
  });
10055
- } else if (_optionalChain([flags, 'access', _333 => _333.bucket, 'optionalAccess', _334 => _334.some, 'call', _335 => _335(
10336
+ } else if (_optionalChain([flags, 'access', _336 => _336.bucket, 'optionalAccess', _337 => _337.some, 'call', _338 => _338(
10056
10337
  (bucket) => !i18nConfig.buckets[bucket]
10057
10338
  )])) {
10058
10339
  throw new ValidationError({
@@ -10578,7 +10859,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
10578
10859
  const response = await engine.whoami();
10579
10860
  return {
10580
10861
  authenticated: !!response,
10581
- username: _optionalChain([response, 'optionalAccess', _336 => _336.email])
10862
+ username: _optionalChain([response, 'optionalAccess', _339 => _339.email])
10582
10863
  };
10583
10864
  } catch (error) {
10584
10865
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -10694,7 +10975,7 @@ function createExplicitLocalizer(provider) {
10694
10975
  }
10695
10976
  function createAiSdkLocalizer(params) {
10696
10977
  const skipAuth = params.skipAuth === true;
10697
- const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _337 => _337.apiKeyName]), () => ( ""))];
10978
+ const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _340 => _340.apiKeyName]), () => ( ""))];
10698
10979
  if (!skipAuth && !apiKey || !params.apiKeyName) {
10699
10980
  throw new Error(
10700
10981
  _dedent2.default`
@@ -10828,8 +11109,8 @@ async function setup(input2) {
10828
11109
  throw new Error(
10829
11110
  "No buckets found in i18n.json. Please add at least one bucket containing i18n content."
10830
11111
  );
10831
- } else if (_optionalChain([ctx, 'access', _338 => _338.flags, 'access', _339 => _339.bucket, 'optionalAccess', _340 => _340.some, 'call', _341 => _341(
10832
- (bucket) => !_optionalChain([ctx, 'access', _342 => _342.config, 'optionalAccess', _343 => _343.buckets, 'access', _344 => _344[bucket]])
11112
+ } else if (_optionalChain([ctx, 'access', _341 => _341.flags, 'access', _342 => _342.bucket, 'optionalAccess', _343 => _343.some, 'call', _344 => _344(
11113
+ (bucket) => !_optionalChain([ctx, 'access', _345 => _345.config, 'optionalAccess', _346 => _346.buckets, 'access', _347 => _347[bucket]])
10833
11114
  )])) {
10834
11115
  throw new Error(
10835
11116
  `One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
@@ -10842,7 +11123,7 @@ async function setup(input2) {
10842
11123
  title: "Selecting localization provider",
10843
11124
  task: async (ctx, task) => {
10844
11125
  ctx.localizer = createLocalizer(
10845
- _optionalChain([ctx, 'access', _345 => _345.config, 'optionalAccess', _346 => _346.provider]),
11126
+ _optionalChain([ctx, 'access', _348 => _348.config, 'optionalAccess', _349 => _349.provider]),
10846
11127
  ctx.flags.apiKey
10847
11128
  );
10848
11129
  if (!ctx.localizer) {
@@ -10855,7 +11136,7 @@ async function setup(input2) {
10855
11136
  },
10856
11137
  {
10857
11138
  title: "Checking authentication",
10858
- enabled: (ctx) => _optionalChain([ctx, 'access', _347 => _347.localizer, 'optionalAccess', _348 => _348.id]) === "Lingo.dev",
11139
+ enabled: (ctx) => _optionalChain([ctx, 'access', _350 => _350.localizer, 'optionalAccess', _351 => _351.id]) === "Lingo.dev",
10859
11140
  task: async (ctx, task) => {
10860
11141
  const authStatus = await ctx.localizer.checkAuth();
10861
11142
  if (!authStatus.authenticated) {
@@ -10868,7 +11149,7 @@ async function setup(input2) {
10868
11149
  },
10869
11150
  {
10870
11151
  title: "Validating configuration",
10871
- enabled: (ctx) => _optionalChain([ctx, 'access', _349 => _349.localizer, 'optionalAccess', _350 => _350.id]) !== "Lingo.dev",
11152
+ enabled: (ctx) => _optionalChain([ctx, 'access', _352 => _352.localizer, 'optionalAccess', _353 => _353.id]) !== "Lingo.dev",
10872
11153
  task: async (ctx, task) => {
10873
11154
  const validationStatus = await ctx.localizer.validateSettings();
10874
11155
  if (!validationStatus.valid) {
@@ -11185,7 +11466,7 @@ function createWorkerTask(args) {
11185
11466
  const processableData = _lodash2.default.chain(sourceData).entries().filter(
11186
11467
  ([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
11187
11468
  ).filter(
11188
- ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _351 => _351.onlyKeys, 'optionalAccess', _352 => _352.some, 'call', _353 => _353(
11469
+ ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _354 => _354.onlyKeys, 'optionalAccess', _355 => _355.some, 'call', _356 => _356(
11189
11470
  (pattern) => minimatch(key, pattern)
11190
11471
  )])
11191
11472
  ).fromPairs().value();
@@ -11253,7 +11534,7 @@ function createWorkerTask(args) {
11253
11534
  finalRenamedTargetData
11254
11535
  );
11255
11536
  const checksums = await deltaProcessor.createChecksums(sourceData);
11256
- if (!_optionalChain([args, 'access', _354 => _354.ctx, 'access', _355 => _355.flags, 'access', _356 => _356.targetLocale, 'optionalAccess', _357 => _357.length])) {
11537
+ if (!_optionalChain([args, 'access', _357 => _357.ctx, 'access', _358 => _358.flags, 'access', _359 => _359.targetLocale, 'optionalAccess', _360 => _360.length])) {
11257
11538
  await deltaProcessor.saveChecksums(checksums);
11258
11539
  }
11259
11540
  });
@@ -11458,10 +11739,10 @@ var flagsSchema2 = _zod.z.object({
11458
11739
  async function frozen(input2) {
11459
11740
  console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
11460
11741
  let buckets = getBuckets(input2.config);
11461
- if (_optionalChain([input2, 'access', _358 => _358.flags, 'access', _359 => _359.bucket, 'optionalAccess', _360 => _360.length])) {
11742
+ if (_optionalChain([input2, 'access', _361 => _361.flags, 'access', _362 => _362.bucket, 'optionalAccess', _363 => _363.length])) {
11462
11743
  buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
11463
11744
  }
11464
- if (_optionalChain([input2, 'access', _361 => _361.flags, 'access', _362 => _362.file, 'optionalAccess', _363 => _363.length])) {
11745
+ if (_optionalChain([input2, 'access', _364 => _364.flags, 'access', _365 => _365.file, 'optionalAccess', _366 => _366.length])) {
11465
11746
  buckets = buckets.map((bucket) => {
11466
11747
  const paths = bucket.paths.filter(
11467
11748
  (p) => input2.flags.file.some(
@@ -11598,13 +11879,13 @@ async function frozen(input2) {
11598
11879
 
11599
11880
  // src/cli/cmd/run/_utils.ts
11600
11881
  async function determineAuthId(ctx) {
11601
- const isByokMode = !!_optionalChain([ctx, 'access', _364 => _364.config, 'optionalAccess', _365 => _365.provider]);
11882
+ const isByokMode = !!_optionalChain([ctx, 'access', _367 => _367.config, 'optionalAccess', _368 => _368.provider]);
11602
11883
  if (isByokMode) {
11603
11884
  return null;
11604
11885
  } else {
11605
11886
  try {
11606
- const authStatus = await _optionalChain([ctx, 'access', _366 => _366.localizer, 'optionalAccess', _367 => _367.checkAuth, 'call', _368 => _368()]);
11607
- return _optionalChain([authStatus, 'optionalAccess', _369 => _369.username]) || null;
11887
+ const authStatus = await _optionalChain([ctx, 'access', _369 => _369.localizer, 'optionalAccess', _370 => _370.checkAuth, 'call', _371 => _371()]);
11888
+ return _optionalChain([authStatus, 'optionalAccess', _372 => _372.username]) || null;
11608
11889
  } catch (e3) {
11609
11890
  return null;
11610
11891
  }
@@ -11801,7 +12082,7 @@ var InBranchFlow = class extends IntegrationFlow {
11801
12082
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
11802
12083
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
11803
12084
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
11804
- _optionalChain([this, 'access', _370 => _370.platformKit, 'optionalAccess', _371 => _371.gitConfig, 'call', _372 => _372()]);
12085
+ _optionalChain([this, 'access', _373 => _373.platformKit, 'optionalAccess', _374 => _374.gitConfig, 'call', _375 => _375()]);
11805
12086
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
11806
12087
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
11807
12088
  if (!processOwnCommits) {
@@ -11833,7 +12114,7 @@ var InBranchFlow = class extends IntegrationFlow {
11833
12114
  // src/cli/cmd/ci/flows/pull-request.ts
11834
12115
  var PullRequestFlow = class extends InBranchFlow {
11835
12116
  async preRun() {
11836
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _373 => _373()]);
12117
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _376 => _376()]);
11837
12118
  if (!canContinue) {
11838
12119
  return false;
11839
12120
  }
@@ -12096,10 +12377,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
12096
12377
  repo_slug: this.platformConfig.repositoryName,
12097
12378
  state: "OPEN"
12098
12379
  }).then(({ data: { values } }) => {
12099
- return _optionalChain([values, 'optionalAccess', _374 => _374.find, 'call', _375 => _375(
12100
- ({ source, destination }) => _optionalChain([source, 'optionalAccess', _376 => _376.branch, 'optionalAccess', _377 => _377.name]) === branch && _optionalChain([destination, 'optionalAccess', _378 => _378.branch, 'optionalAccess', _379 => _379.name]) === this.platformConfig.baseBranchName
12380
+ return _optionalChain([values, 'optionalAccess', _377 => _377.find, 'call', _378 => _378(
12381
+ ({ source, destination }) => _optionalChain([source, 'optionalAccess', _379 => _379.branch, 'optionalAccess', _380 => _380.name]) === branch && _optionalChain([destination, 'optionalAccess', _381 => _381.branch, 'optionalAccess', _382 => _382.name]) === this.platformConfig.baseBranchName
12101
12382
  )]);
12102
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _380 => _380.id]));
12383
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _383 => _383.id]));
12103
12384
  }
12104
12385
  async closePullRequest({ pullRequestNumber }) {
12105
12386
  await this.bb.repositories.declinePullRequest({
@@ -12195,7 +12476,7 @@ var GitHubPlatformKit = class extends PlatformKit {
12195
12476
  repo: this.platformConfig.repositoryName,
12196
12477
  base: this.platformConfig.baseBranchName,
12197
12478
  state: "open"
12198
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _381 => _381.number]));
12479
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _384 => _384.number]));
12199
12480
  }
12200
12481
  async closePullRequest({ pullRequestNumber }) {
12201
12482
  await this.octokit.rest.pulls.update({
@@ -12322,7 +12603,7 @@ var GitlabPlatformKit = class extends PlatformKit {
12322
12603
  sourceBranch: branch,
12323
12604
  state: "opened"
12324
12605
  });
12325
- return _optionalChain([mergeRequests, 'access', _382 => _382[0], 'optionalAccess', _383 => _383.iid]);
12606
+ return _optionalChain([mergeRequests, 'access', _385 => _385[0], 'optionalAccess', _386 => _386.iid]);
12326
12607
  }
12327
12608
  async closePullRequest({
12328
12609
  pullRequestNumber
@@ -12428,7 +12709,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12428
12709
  }
12429
12710
  const env = {
12430
12711
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
12431
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _384 => _384.pullRequest, 'optionalAccess', _385 => _385.toString, 'call', _386 => _386()]) || "false",
12712
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _387 => _387.pullRequest, 'optionalAccess', _388 => _388.toString, 'call', _389 => _389()]) || "false",
12432
12713
  ...options.commitMessage && {
12433
12714
  LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
12434
12715
  },
@@ -12448,7 +12729,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12448
12729
  const { isPullRequestMode } = platformKit.config;
12449
12730
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
12450
12731
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
12451
- const canRun = await _optionalChain([flow, 'access', _387 => _387.preRun, 'optionalCall', _388 => _388()]);
12732
+ const canRun = await _optionalChain([flow, 'access', _390 => _390.preRun, 'optionalCall', _391 => _391()]);
12452
12733
  if (canRun === false) {
12453
12734
  return;
12454
12735
  }
@@ -12458,7 +12739,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12458
12739
  if (!hasChanges) {
12459
12740
  return;
12460
12741
  }
12461
- await _optionalChain([flow, 'access', _389 => _389.postRun, 'optionalCall', _390 => _390()]);
12742
+ await _optionalChain([flow, 'access', _392 => _392.postRun, 'optionalCall', _393 => _393()]);
12462
12743
  });
12463
12744
  function parseBooleanArg(val) {
12464
12745
  if (val === true) return true;
@@ -12495,8 +12776,8 @@ function exitGracefully(elapsedMs = 0) {
12495
12776
  }
12496
12777
  }
12497
12778
  function checkForPendingOperations() {
12498
- const activeHandles = _optionalChain([process, 'access', _391 => _391._getActiveHandles, 'optionalCall', _392 => _392()]) || [];
12499
- const activeRequests = _optionalChain([process, 'access', _393 => _393._getActiveRequests, 'optionalCall', _394 => _394()]) || [];
12779
+ const activeHandles = _optionalChain([process, 'access', _394 => _394._getActiveHandles, 'optionalCall', _395 => _395()]) || [];
12780
+ const activeRequests = _optionalChain([process, 'access', _396 => _396._getActiveRequests, 'optionalCall', _397 => _397()]) || [];
12500
12781
  const nonStandardHandles = activeHandles.filter((handle) => {
12501
12782
  if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
12502
12783
  return false;
@@ -12565,17 +12846,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
12565
12846
  flags
12566
12847
  });
12567
12848
  let buckets = getBuckets(i18nConfig);
12568
- if (_optionalChain([flags, 'access', _395 => _395.bucket, 'optionalAccess', _396 => _396.length])) {
12849
+ if (_optionalChain([flags, 'access', _398 => _398.bucket, 'optionalAccess', _399 => _399.length])) {
12569
12850
  buckets = buckets.filter(
12570
12851
  (bucket) => flags.bucket.includes(bucket.type)
12571
12852
  );
12572
12853
  }
12573
12854
  ora.succeed("Buckets retrieved");
12574
- if (_optionalChain([flags, 'access', _397 => _397.file, 'optionalAccess', _398 => _398.length])) {
12855
+ if (_optionalChain([flags, 'access', _400 => _400.file, 'optionalAccess', _401 => _401.length])) {
12575
12856
  buckets = buckets.map((bucket) => {
12576
12857
  const paths = bucket.paths.filter(
12577
12858
  (path19) => flags.file.find(
12578
- (file) => _optionalChain([path19, 'access', _399 => _399.pathPattern, 'optionalAccess', _400 => _400.includes, 'call', _401 => _401(file)]) || _optionalChain([path19, 'access', _402 => _402.pathPattern, 'optionalAccess', _403 => _403.match, 'call', _404 => _404(file)]) || minimatch(path19.pathPattern, file)
12859
+ (file) => _optionalChain([path19, 'access', _402 => _402.pathPattern, 'optionalAccess', _403 => _403.includes, 'call', _404 => _404(file)]) || _optionalChain([path19, 'access', _405 => _405.pathPattern, 'optionalAccess', _406 => _406.match, 'call', _407 => _407(file)]) || minimatch(path19.pathPattern, file)
12579
12860
  )
12580
12861
  );
12581
12862
  return { ...bucket, paths };
@@ -12595,7 +12876,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
12595
12876
  });
12596
12877
  }
12597
12878
  }
12598
- const targetLocales = _optionalChain([flags, 'access', _405 => _405.locale, 'optionalAccess', _406 => _406.length]) ? flags.locale : i18nConfig.locale.targets;
12879
+ const targetLocales = _optionalChain([flags, 'access', _408 => _408.locale, 'optionalAccess', _409 => _409.length]) ? flags.locale : i18nConfig.locale.targets;
12599
12880
  let totalSourceKeyCount = 0;
12600
12881
  let uniqueKeysToTranslate = 0;
12601
12882
  let totalExistingTranslations = 0;
@@ -13001,12 +13282,12 @@ function validateParams2(i18nConfig, flags) {
13001
13282
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
13002
13283
  docUrl: "bucketNotFound"
13003
13284
  });
13004
- } else if (_optionalChain([flags, 'access', _407 => _407.locale, 'optionalAccess', _408 => _408.some, 'call', _409 => _409((locale) => !i18nConfig.locale.targets.includes(locale))])) {
13285
+ } else if (_optionalChain([flags, 'access', _410 => _410.locale, 'optionalAccess', _411 => _411.some, 'call', _412 => _412((locale) => !i18nConfig.locale.targets.includes(locale))])) {
13005
13286
  throw new CLIError({
13006
13287
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
13007
13288
  docUrl: "localeTargetNotFound"
13008
13289
  });
13009
- } else if (_optionalChain([flags, 'access', _410 => _410.bucket, 'optionalAccess', _411 => _411.some, 'call', _412 => _412(
13290
+ } else if (_optionalChain([flags, 'access', _413 => _413.bucket, 'optionalAccess', _414 => _414.some, 'call', _415 => _415(
13010
13291
  (bucket) => !i18nConfig.buckets[bucket]
13011
13292
  )])) {
13012
13293
  throw new CLIError({
@@ -13098,7 +13379,7 @@ async function renderHero2() {
13098
13379
  // package.json
13099
13380
  var package_default = {
13100
13381
  name: "lingo.dev",
13101
- version: "0.113.6",
13382
+ version: "0.113.7",
13102
13383
  description: "Lingo.dev CLI",
13103
13384
  private: false,
13104
13385
  publishConfig: {
@@ -13389,7 +13670,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
13389
13670
  if (options.file && options.file.length) {
13390
13671
  buckets = buckets.map((bucket) => {
13391
13672
  const paths = bucket.paths.filter(
13392
- (bucketPath) => _optionalChain([options, 'access', _413 => _413.file, 'optionalAccess', _414 => _414.some, 'call', _415 => _415((f) => bucketPath.pathPattern.includes(f))])
13673
+ (bucketPath) => _optionalChain([options, 'access', _416 => _416.file, 'optionalAccess', _417 => _417.some, 'call', _418 => _418((f) => bucketPath.pathPattern.includes(f))])
13393
13674
  );
13394
13675
  return { ...bucket, paths };
13395
13676
  }).filter((bucket) => bucket.paths.length > 0);