i18next-cli 1.70.2 → 1.70.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/dist/cjs/cli.js CHANGED
@@ -37,7 +37,7 @@ const program = new commander.Command();
37
37
  program
38
38
  .name('i18next-cli')
39
39
  .description('A unified, high-performance i18next CLI.')
40
- .version('1.70.2'); // This string is replaced with the actual version at build time by rollup
40
+ .version('1.70.4'); // This string is replaced with the actual version at build time by rollup
41
41
  // new: global config override option
42
42
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
43
43
  program
@@ -59,6 +59,9 @@ class ASTVisitors {
59
59
  resolvePossibleContextStringValues: hooks?.resolvePossibleContextStringValues
60
60
  };
61
61
  this.scopeManager = new scopeManager.ScopeManager(config);
62
+ // `useTranslation(ns)` where `ns` is a param typed `'a' | 'b'` → first member
63
+ // (same rule as `TFunction<'a' | 'b'>`).
64
+ this.scopeManager.identifierFallback = (name) => this.expressionResolver.getVariableValues(name)?.[0];
62
65
  // use shared resolver when provided so captured enums/objects are visible across files
63
66
  this.expressionResolver = expressionResolver$1 ?? new expressionResolver.ExpressionResolver(this.hooks);
64
67
  this.callExpressionHandler = new callExpressionHandler.CallExpressionHandler(config, pluginContext, logger, this.expressionResolver, () => this.getCurrentFile(), () => this.getCurrentCode(), (name) => this.scopeManager.resolveSimpleStringIdentifier(name));
@@ -174,6 +177,7 @@ class ASTVisitors {
174
177
  let isNewScope = false;
175
178
  let isNewClassScope = false;
176
179
  let paramTemporaries;
180
+ let paramDefaults;
177
181
  let paramObjectTemporaries;
178
182
  let paramArrayTemporaries;
179
183
  // ENTER CLASS SCOPE for class declarations / expressions and pre-register
@@ -247,6 +251,16 @@ class ASTVisitors {
247
251
  const localName = localNode?.type === 'Identifier' ? localNode.value : undefined;
248
252
  if (!memberName || !localName)
249
253
  continue;
254
+ // `({ ns = 'x' })` → `useTranslation(ns)` resolves to the default
255
+ const defaultNode = prop?.type === 'AssignmentPatternProperty'
256
+ ? prop.value
257
+ : (prop?.value?.type === 'AssignmentPattern' ? prop.value.right : undefined);
258
+ if (defaultNode?.type === 'StringLiteral') {
259
+ this.scopeManager.setParamDefault(localName, defaultNode.value);
260
+ if (!paramDefaults)
261
+ paramDefaults = [];
262
+ paramDefaults.push(localName);
263
+ }
250
264
  // `({ t }: { t: TFunction<'ns'> })` → bind `t` to that namespace
251
265
  this.bindTFunctionParam(localName, this.getMemberTypeNode(patType, memberName), typeParamConstraints);
252
266
  if (!members?.[memberName])
@@ -274,6 +288,9 @@ class ASTVisitors {
274
288
  ident = p.pattern;
275
289
  else if (p.pat && p.pat.type === 'Identifier')
276
290
  ident = p.pat;
291
+ // function f(ns = 'x') → Param { pat: AssignmentPattern }
292
+ else if (p.pat?.type === 'AssignmentPattern' && p.pat.left?.type === 'Identifier')
293
+ ident = p.pat.left;
277
294
  else if (p.pattern && p.pattern.type === 'Identifier')
278
295
  ident = p.pattern;
279
296
  // some parsers expose .param or .left.param shapes
@@ -286,6 +303,14 @@ class ASTVisitors {
286
303
  const paramKey = (ident.value ?? ident.name);
287
304
  if (!paramKey)
288
305
  continue;
306
+ // `(ns = 'x') =>` → `useTranslation(ns)` resolves to the default
307
+ const assign = p.type === 'AssignmentPattern' ? p : (p.pat?.type === 'AssignmentPattern' ? p.pat : undefined);
308
+ if (assign?.right?.type === 'StringLiteral') {
309
+ this.scopeManager.setParamDefault(paramKey, assign.right.value);
310
+ if (!paramDefaults)
311
+ paramDefaults = [];
312
+ paramDefaults.push(paramKey);
313
+ }
289
314
  // Try to locate TypeScript type node carried on the identifier.
290
315
  const rawTypeAnn = (ident.typeAnnotation ?? p.typeAnnotation ?? (p.left && p.left.typeAnnotation));
291
316
  let typeAnn;
@@ -550,6 +575,10 @@ class ASTVisitors {
550
575
  this.expressionResolver.deleteTemporaryVariable(name);
551
576
  }
552
577
  }
578
+ if (paramDefaults) {
579
+ for (const name of paramDefaults)
580
+ this.scopeManager.deleteParamDefault(name);
581
+ }
553
582
  if (paramObjectTemporaries) {
554
583
  for (const name of paramObjectTemporaries) {
555
584
  this.expressionResolver.deleteTemporaryObjectVariable(name);
@@ -595,15 +624,14 @@ class ASTVisitors {
595
624
  const extractStringLiteralValue = (node) => {
596
625
  if (!node)
597
626
  return undefined;
598
- // Union (`'a' | 'b'`), local alias, or generic constrained to those: use the
599
- // first member. Mirrors i18next's type-level behaviour (first ns wins).
627
+ // Union (`'a' | 'b'`) or generic constrained to one (`<Ns extends 'a' | 'b'>`):
628
+ // use the first member, mirroring i18next's type-level behaviour (first ns wins).
629
+ // Named aliases (`TFunction<Namespace>`) are deliberately NOT resolved: an
630
+ // app-wide `Namespace` union would otherwise "win" with an arbitrary first entry.
600
631
  if (node.type === 'TsUnionType')
601
632
  return extractStringLiteralValue(node.types?.[0]);
602
633
  if (node.type === 'TsTypeReference' && node.typeName?.type === 'Identifier') {
603
- const constraint = typeParamConstraints[node.typeName.value];
604
- if (constraint)
605
- return extractStringLiteralValue(constraint);
606
- return this.expressionResolver.resolveTypeToStringValues(node)[0];
634
+ return extractStringLiteralValue(typeParamConstraints[node.typeName.value]);
607
635
  }
608
636
  // Handle: typeof SomeConst → TsTypeQuery { exprName: { value: 'SomeConst' } }
609
637
  if (node?.type === 'TsTypeQuery') {
@@ -709,6 +737,11 @@ class ASTVisitors {
709
737
  getObjectTypeMembers(tsType) {
710
738
  if (!tsType)
711
739
  return [];
740
+ // `A & { t: TFunction<'ns'> }` / `(A)` → union of the constituents' members
741
+ if (tsType.type === 'TsIntersectionType')
742
+ return (tsType.types ?? []).flatMap((t) => this.getObjectTypeMembers(t));
743
+ if (tsType.type === 'TsParenthesizedType')
744
+ return this.getObjectTypeMembers(tsType.typeAnnotation);
712
745
  let members;
713
746
  if (tsType.type === 'TsTypeLiteral')
714
747
  members = tsType.members;
@@ -17,6 +17,11 @@ class ScopeManager {
17
17
  simpleConstantObjects = new Map();
18
18
  // `const NS = ['a', 'b']` → used by resolveNsArg for `useTranslation(NS)`.
19
19
  simpleConstantArrays = new Map();
20
+ // `({ ns = 'x' }) =>` / `(ns = 'x') =>` param defaults, set/cleared per function by the visitor.
21
+ paramDefaults = new Map();
22
+ // Last-resort identifier resolution for `useTranslation(ns)` (e.g. first member of
23
+ // a param's union type), wired up by the visitor.
24
+ identifierFallback;
20
25
  // Shared (cross-file) tables so that exported constants from one file can be
21
26
  // resolved when imported in another. These are NOT cleared by reset().
22
27
  sharedConstants = new Map();
@@ -71,6 +76,7 @@ class ScopeManager {
71
76
  this.simpleConstants.clear();
72
77
  this.simpleConstantObjects.clear();
73
78
  this.simpleConstantArrays.clear();
79
+ this.paramDefaults.clear();
74
80
  this.thisFieldStack = [];
75
81
  }
76
82
  /**
@@ -189,6 +195,12 @@ class ScopeManager {
189
195
  /**
190
196
  * Resolve simple identifier declared in-file to its string literal value, if known.
191
197
  */
198
+ setParamDefault(name, value) {
199
+ this.paramDefaults.set(name, value);
200
+ }
201
+ deleteParamDefault(name) {
202
+ this.paramDefaults.delete(name);
203
+ }
192
204
  resolveSimpleStringIdentifier(name) {
193
205
  return this.simpleConstants.get(name) ?? this.sharedConstants.get(name);
194
206
  }
@@ -574,7 +586,11 @@ class ScopeManager {
574
586
  const arr = this.simpleConstantArrays.get(nsNode.value);
575
587
  if (arr)
576
588
  return { defaultNs: arr[0], namespaces: arr };
577
- return { defaultNs: this.resolveSimpleStringIdentifier(nsNode.value) };
589
+ return {
590
+ defaultNs: this.paramDefaults.get(nsNode.value) ??
591
+ this.resolveSimpleStringIdentifier(nsNode.value) ??
592
+ this.identifierFallback?.(nsNode.value)
593
+ };
578
594
  }
579
595
  if (nsNode.type === 'MemberExpression')
580
596
  return { defaultNs: this.resolveSimpleMemberExpression(nsNode) };
package/dist/esm/cli.js CHANGED
@@ -31,7 +31,7 @@ const program = new Command();
31
31
  program
32
32
  .name('i18next-cli')
33
33
  .description('A unified, high-performance i18next CLI.')
34
- .version('1.70.2'); // This string is replaced with the actual version at build time by rollup
34
+ .version('1.70.4'); // This string is replaced with the actual version at build time by rollup
35
35
  // new: global config override option
36
36
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
37
37
  program
@@ -57,6 +57,9 @@ class ASTVisitors {
57
57
  resolvePossibleContextStringValues: hooks?.resolvePossibleContextStringValues
58
58
  };
59
59
  this.scopeManager = new ScopeManager(config);
60
+ // `useTranslation(ns)` where `ns` is a param typed `'a' | 'b'` → first member
61
+ // (same rule as `TFunction<'a' | 'b'>`).
62
+ this.scopeManager.identifierFallback = (name) => this.expressionResolver.getVariableValues(name)?.[0];
60
63
  // use shared resolver when provided so captured enums/objects are visible across files
61
64
  this.expressionResolver = expressionResolver ?? new ExpressionResolver(this.hooks);
62
65
  this.callExpressionHandler = new CallExpressionHandler(config, pluginContext, logger, this.expressionResolver, () => this.getCurrentFile(), () => this.getCurrentCode(), (name) => this.scopeManager.resolveSimpleStringIdentifier(name));
@@ -172,6 +175,7 @@ class ASTVisitors {
172
175
  let isNewScope = false;
173
176
  let isNewClassScope = false;
174
177
  let paramTemporaries;
178
+ let paramDefaults;
175
179
  let paramObjectTemporaries;
176
180
  let paramArrayTemporaries;
177
181
  // ENTER CLASS SCOPE for class declarations / expressions and pre-register
@@ -245,6 +249,16 @@ class ASTVisitors {
245
249
  const localName = localNode?.type === 'Identifier' ? localNode.value : undefined;
246
250
  if (!memberName || !localName)
247
251
  continue;
252
+ // `({ ns = 'x' })` → `useTranslation(ns)` resolves to the default
253
+ const defaultNode = prop?.type === 'AssignmentPatternProperty'
254
+ ? prop.value
255
+ : (prop?.value?.type === 'AssignmentPattern' ? prop.value.right : undefined);
256
+ if (defaultNode?.type === 'StringLiteral') {
257
+ this.scopeManager.setParamDefault(localName, defaultNode.value);
258
+ if (!paramDefaults)
259
+ paramDefaults = [];
260
+ paramDefaults.push(localName);
261
+ }
248
262
  // `({ t }: { t: TFunction<'ns'> })` → bind `t` to that namespace
249
263
  this.bindTFunctionParam(localName, this.getMemberTypeNode(patType, memberName), typeParamConstraints);
250
264
  if (!members?.[memberName])
@@ -272,6 +286,9 @@ class ASTVisitors {
272
286
  ident = p.pattern;
273
287
  else if (p.pat && p.pat.type === 'Identifier')
274
288
  ident = p.pat;
289
+ // function f(ns = 'x') → Param { pat: AssignmentPattern }
290
+ else if (p.pat?.type === 'AssignmentPattern' && p.pat.left?.type === 'Identifier')
291
+ ident = p.pat.left;
275
292
  else if (p.pattern && p.pattern.type === 'Identifier')
276
293
  ident = p.pattern;
277
294
  // some parsers expose .param or .left.param shapes
@@ -284,6 +301,14 @@ class ASTVisitors {
284
301
  const paramKey = (ident.value ?? ident.name);
285
302
  if (!paramKey)
286
303
  continue;
304
+ // `(ns = 'x') =>` → `useTranslation(ns)` resolves to the default
305
+ const assign = p.type === 'AssignmentPattern' ? p : (p.pat?.type === 'AssignmentPattern' ? p.pat : undefined);
306
+ if (assign?.right?.type === 'StringLiteral') {
307
+ this.scopeManager.setParamDefault(paramKey, assign.right.value);
308
+ if (!paramDefaults)
309
+ paramDefaults = [];
310
+ paramDefaults.push(paramKey);
311
+ }
287
312
  // Try to locate TypeScript type node carried on the identifier.
288
313
  const rawTypeAnn = (ident.typeAnnotation ?? p.typeAnnotation ?? (p.left && p.left.typeAnnotation));
289
314
  let typeAnn;
@@ -548,6 +573,10 @@ class ASTVisitors {
548
573
  this.expressionResolver.deleteTemporaryVariable(name);
549
574
  }
550
575
  }
576
+ if (paramDefaults) {
577
+ for (const name of paramDefaults)
578
+ this.scopeManager.deleteParamDefault(name);
579
+ }
551
580
  if (paramObjectTemporaries) {
552
581
  for (const name of paramObjectTemporaries) {
553
582
  this.expressionResolver.deleteTemporaryObjectVariable(name);
@@ -593,15 +622,14 @@ class ASTVisitors {
593
622
  const extractStringLiteralValue = (node) => {
594
623
  if (!node)
595
624
  return undefined;
596
- // Union (`'a' | 'b'`), local alias, or generic constrained to those: use the
597
- // first member. Mirrors i18next's type-level behaviour (first ns wins).
625
+ // Union (`'a' | 'b'`) or generic constrained to one (`<Ns extends 'a' | 'b'>`):
626
+ // use the first member, mirroring i18next's type-level behaviour (first ns wins).
627
+ // Named aliases (`TFunction<Namespace>`) are deliberately NOT resolved: an
628
+ // app-wide `Namespace` union would otherwise "win" with an arbitrary first entry.
598
629
  if (node.type === 'TsUnionType')
599
630
  return extractStringLiteralValue(node.types?.[0]);
600
631
  if (node.type === 'TsTypeReference' && node.typeName?.type === 'Identifier') {
601
- const constraint = typeParamConstraints[node.typeName.value];
602
- if (constraint)
603
- return extractStringLiteralValue(constraint);
604
- return this.expressionResolver.resolveTypeToStringValues(node)[0];
632
+ return extractStringLiteralValue(typeParamConstraints[node.typeName.value]);
605
633
  }
606
634
  // Handle: typeof SomeConst → TsTypeQuery { exprName: { value: 'SomeConst' } }
607
635
  if (node?.type === 'TsTypeQuery') {
@@ -707,6 +735,11 @@ class ASTVisitors {
707
735
  getObjectTypeMembers(tsType) {
708
736
  if (!tsType)
709
737
  return [];
738
+ // `A & { t: TFunction<'ns'> }` / `(A)` → union of the constituents' members
739
+ if (tsType.type === 'TsIntersectionType')
740
+ return (tsType.types ?? []).flatMap((t) => this.getObjectTypeMembers(t));
741
+ if (tsType.type === 'TsParenthesizedType')
742
+ return this.getObjectTypeMembers(tsType.typeAnnotation);
710
743
  let members;
711
744
  if (tsType.type === 'TsTypeLiteral')
712
745
  members = tsType.members;
@@ -15,6 +15,11 @@ class ScopeManager {
15
15
  simpleConstantObjects = new Map();
16
16
  // `const NS = ['a', 'b']` → used by resolveNsArg for `useTranslation(NS)`.
17
17
  simpleConstantArrays = new Map();
18
+ // `({ ns = 'x' }) =>` / `(ns = 'x') =>` param defaults, set/cleared per function by the visitor.
19
+ paramDefaults = new Map();
20
+ // Last-resort identifier resolution for `useTranslation(ns)` (e.g. first member of
21
+ // a param's union type), wired up by the visitor.
22
+ identifierFallback;
18
23
  // Shared (cross-file) tables so that exported constants from one file can be
19
24
  // resolved when imported in another. These are NOT cleared by reset().
20
25
  sharedConstants = new Map();
@@ -69,6 +74,7 @@ class ScopeManager {
69
74
  this.simpleConstants.clear();
70
75
  this.simpleConstantObjects.clear();
71
76
  this.simpleConstantArrays.clear();
77
+ this.paramDefaults.clear();
72
78
  this.thisFieldStack = [];
73
79
  }
74
80
  /**
@@ -187,6 +193,12 @@ class ScopeManager {
187
193
  /**
188
194
  * Resolve simple identifier declared in-file to its string literal value, if known.
189
195
  */
196
+ setParamDefault(name, value) {
197
+ this.paramDefaults.set(name, value);
198
+ }
199
+ deleteParamDefault(name) {
200
+ this.paramDefaults.delete(name);
201
+ }
190
202
  resolveSimpleStringIdentifier(name) {
191
203
  return this.simpleConstants.get(name) ?? this.sharedConstants.get(name);
192
204
  }
@@ -572,7 +584,11 @@ class ScopeManager {
572
584
  const arr = this.simpleConstantArrays.get(nsNode.value);
573
585
  if (arr)
574
586
  return { defaultNs: arr[0], namespaces: arr };
575
- return { defaultNs: this.resolveSimpleStringIdentifier(nsNode.value) };
587
+ return {
588
+ defaultNs: this.paramDefaults.get(nsNode.value) ??
589
+ this.resolveSimpleStringIdentifier(nsNode.value) ??
590
+ this.identifierFallback?.(nsNode.value)
591
+ };
576
592
  }
577
593
  if (nsNode.type === 'MemberExpression')
578
594
  return { defaultNs: this.resolveSimpleMemberExpression(nsNode) };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-cli",
3
- "version": "1.70.2",
3
+ "version": "1.70.4",
4
4
  "description": "A unified, high-performance i18next CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +1 @@
1
- {"version":3,"file":"ast-visitors.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/ast-visitors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAQ,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC7G,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OA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AAE,eAAe,EACvB,kBAAkB,CAAC,EAAE,kBAAkB;IAoCzC;;;;;;;;;;;;;OAaG;IACI,mBAAmB,CAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAK/C;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAqDzB;;;;;OAKG;IACI,KAAK,CAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAUjC;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,IAAI;IAsaZ;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAiH1B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAIzB,mFAAmF;IACnF,OAAO,CAAC,oBAAoB;IAoB5B;;;;;;;;OAQG;IACH,OAAO,CAAC,gCAAgC;IAqDxC;;;;;;;;;OASG;IACH,OAAO,CAAC,0BAA0B;IA+ClC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAqB5B;;;;;;;;OAQG;IACI,eAAe,CAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI5D;;OAEG;IACI,cAAc,CAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxD;;;;;;OAMG;IACI,cAAc,IAAK,MAAM;IAIhC;;OAEG;IACI,cAAc,IAAK,MAAM;CAGjC"}
@@ -8,6 +8,8 @@ export declare class ScopeManager {
8
8
  private simpleConstants;
9
9
  private simpleConstantObjects;
10
10
  private simpleConstantArrays;
11
+ private paramDefaults;
12
+ identifierFallback?: (name: string) => string | undefined;
11
13
  private sharedConstants;
12
14
  private sharedConstantObjects;
13
15
  constructor(config: Omit<I18nextToolkitConfig, 'plugins'>);
@@ -86,6 +88,8 @@ export declare class ScopeManager {
86
88
  /**
87
89
  * Resolve simple identifier declared in-file to its string literal value, if known.
88
90
  */
91
+ setParamDefault(name: string, value: string): void;
92
+ deleteParamDefault(name: string): void;
89
93
  resolveSimpleStringIdentifier(name: string): string | undefined;
90
94
  /**
91
95
  * Resolve a MemberExpression node (e.g., `ns.custom`) to its string value
@@ -1 +1 @@
1
- {"version":3,"file":"scope-manager.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/scope-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAEV,kBAAkB,EAMnB,MAAM,WAAW,CAAA;AAClB,OAAO,KAAK,EAAE,SAAS,EAA4B,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAG/F,qBAAa,YAAY;IACvB,OAAO,CAAC,UAAU,CAAoC;IACtD,OAAO,CAAC,MAAM,CAAuC;IACrD,OAAO,CAAC,KAAK,CAAqE;IAMlF,OAAO,CAAC,cAAc,CAAoC;IAG1D,OAAO,CAAC,eAAe,CAAiC;IAGxD,OAAO,CAAC,qBAAqB,CAAiD;IAE9E,OAAO,CAAC,oBAAoB,CAAmC;IAI/D,OAAO,CAAC,eAAe,CAAiC;IACxD,OAAO,CAAC,qBAAqB,CAAiD;gBAEjE,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC;IAI1D;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAcjC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,+BAA+B;IAgB9C;;;;;;OAMG;IACI,KAAK,IAAK,IAAI;IASrB;;;;OAIG;IACH,eAAe,IAAK,IAAI;IAIxB;;;OAGG;IACH,cAAc,IAAK,IAAI;IAIvB;;;;;;;OAOG;IACH,YAAY,CAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI;IAMvD;;;;;OAKG;IACH,YAAY,CAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IASvD;;;OAGG;IACH,UAAU,IAAK,IAAI;IAInB;;;OAGG;IACH,SAAS,IAAK,IAAI;IAIlB;;;;;;OAMG;IACH,aAAa,CAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI;IAUnD;;;;;;OAMG;IACH,eAAe,CAAE,IAA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