@angular/core 17.0.1 → 17.0.3

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.
Files changed (43) hide show
  1. package/esm2022/src/core_private_export.mjs +2 -2
  2. package/esm2022/src/core_render3_private_export.mjs +3 -3
  3. package/esm2022/src/defer/instructions.mjs +3 -3
  4. package/esm2022/src/hydration/api.mjs +3 -3
  5. package/esm2022/src/image_performance_warning.mjs +4 -4
  6. package/esm2022/src/linker/component_factory.mjs +1 -3
  7. package/esm2022/src/render3/after_render_hooks.mjs +4 -4
  8. package/esm2022/src/render3/features/standalone_feature.mjs +3 -6
  9. package/esm2022/src/render3/index.mjs +2 -2
  10. package/esm2022/src/render3/instructions/change_detection.mjs +9 -19
  11. package/esm2022/src/render3/instructions/control_flow.mjs +4 -7
  12. package/esm2022/src/render3/instructions/shared.mjs +4 -5
  13. package/esm2022/src/render3/interfaces/container.mjs +22 -17
  14. package/esm2022/src/render3/interfaces/view.mjs +2 -2
  15. package/esm2022/src/render3/list_reconciliation.mjs +5 -4
  16. package/esm2022/src/render3/metadata.mjs +20 -20
  17. package/esm2022/src/render3/node_manipulation.mjs +3 -3
  18. package/esm2022/src/render3/util/change_detection_utils.mjs +13 -2
  19. package/esm2022/src/render3/util/injector_discovery_utils.mjs +10 -13
  20. package/esm2022/src/render3/util/view_utils.mjs +4 -4
  21. package/esm2022/src/render3/view_ref.mjs +3 -3
  22. package/esm2022/src/util/performance.mjs +9 -4
  23. package/esm2022/src/version.mjs +1 -1
  24. package/esm2022/testing/src/logger.mjs +3 -3
  25. package/esm2022/testing/src/test_bed.mjs +3 -3
  26. package/esm2022/testing/src/test_bed_compiler.mjs +10 -7
  27. package/fesm2022/core.mjs +100 -99
  28. package/fesm2022/core.mjs.map +1 -1
  29. package/fesm2022/primitives/signals.mjs +1 -1
  30. package/fesm2022/rxjs-interop.mjs +1 -1
  31. package/fesm2022/testing.mjs +11 -8
  32. package/fesm2022/testing.mjs.map +1 -1
  33. package/index.d.ts +35 -45
  34. package/package.json +1 -1
  35. package/primitives/signals/index.d.ts +1 -1
  36. package/rxjs-interop/index.d.ts +1 -1
  37. package/schematics/migrations/block-template-entities/bundle.js +187 -98
  38. package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
  39. package/schematics/ng-generate/control-flow-migration/bundle.js +518 -232
  40. package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
  41. package/schematics/ng-generate/standalone-migration/bundle.js +253 -129
  42. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  43. package/testing/index.d.ts +1 -1
@@ -3960,6 +3960,25 @@ var IcuPlaceholder = class {
3960
3960
  return visitor.visitIcuPlaceholder(this, context);
3961
3961
  }
3962
3962
  };
3963
+ var RecurseVisitor = class {
3964
+ visitText(text2, context) {
3965
+ }
3966
+ visitContainer(container, context) {
3967
+ container.children.forEach((child) => child.visit(this));
3968
+ }
3969
+ visitIcu(icu, context) {
3970
+ Object.keys(icu.cases).forEach((k) => {
3971
+ icu.cases[k].visit(this);
3972
+ });
3973
+ }
3974
+ visitTagPlaceholder(ph, context) {
3975
+ ph.children.forEach((child) => child.visit(this));
3976
+ }
3977
+ visitPlaceholder(ph, context) {
3978
+ }
3979
+ visitIcuPlaceholder(ph, context) {
3980
+ }
3981
+ };
3963
3982
  function serializeMessage(messageNodes) {
3964
3983
  const visitor = new LocalizeMessageStringVisitor();
3965
3984
  const str = messageNodes.map((n) => n.visit(visitor)).join("");
@@ -7003,8 +7022,8 @@ var OpKind;
7003
7022
  OpKind2[OpKind2["I18nEnd"] = 38] = "I18nEnd";
7004
7023
  OpKind2[OpKind2["I18nExpression"] = 39] = "I18nExpression";
7005
7024
  OpKind2[OpKind2["I18nApply"] = 40] = "I18nApply";
7006
- OpKind2[OpKind2["Icu"] = 41] = "Icu";
7007
- OpKind2[OpKind2["IcuUpdate"] = 42] = "IcuUpdate";
7025
+ OpKind2[OpKind2["IcuStart"] = 41] = "IcuStart";
7026
+ OpKind2[OpKind2["IcuEnd"] = 42] = "IcuEnd";
7008
7027
  OpKind2[OpKind2["I18nContext"] = 43] = "I18nContext";
7009
7028
  })(OpKind || (OpKind = {}));
7010
7029
  var ExpressionKind;
@@ -7089,6 +7108,7 @@ var I18nParamValueFlags;
7089
7108
  I18nParamValueFlags2[I18nParamValueFlags2["TemplateTag"] = 2] = "TemplateTag";
7090
7109
  I18nParamValueFlags2[I18nParamValueFlags2["OpenTag"] = 4] = "OpenTag";
7091
7110
  I18nParamValueFlags2[I18nParamValueFlags2["CloseTag"] = 8] = "CloseTag";
7111
+ I18nParamValueFlags2[I18nParamValueFlags2["ExpressionIndex"] = 16] = "ExpressionIndex";
7092
7112
  })(I18nParamValueFlags || (I18nParamValueFlags = {}));
7093
7113
  var Namespace;
7094
7114
  (function(Namespace2) {
@@ -7315,13 +7335,6 @@ function createI18nApplyOp(target, handle, sourceSpan) {
7315
7335
  sourceSpan
7316
7336
  }, NEW_OP);
7317
7337
  }
7318
- function createIcuUpdateOp(xref, sourceSpan) {
7319
- return __spreadValues({
7320
- kind: OpKind.IcuUpdate,
7321
- xref,
7322
- sourceSpan
7323
- }, NEW_OP);
7324
- }
7325
7338
 
7326
7339
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/expression.mjs
7327
7340
  var _a;
@@ -8085,8 +8098,8 @@ function transformExpressionsInOp(op, transform2, flags) {
8085
8098
  case OpKind.I18nContext:
8086
8099
  case OpKind.I18nEnd:
8087
8100
  case OpKind.I18nStart:
8088
- case OpKind.Icu:
8089
- case OpKind.IcuUpdate:
8101
+ case OpKind.IcuEnd:
8102
+ case OpKind.IcuStart:
8090
8103
  case OpKind.Namespace:
8091
8104
  case OpKind.Pipe:
8092
8105
  case OpKind.Projection:
@@ -8588,17 +8601,22 @@ function createI18nEndOp(xref) {
8588
8601
  xref
8589
8602
  }, NEW_OP);
8590
8603
  }
8591
- function createIcuOp(xref, message, icu, messagePlaceholder, sourceSpan) {
8604
+ function createIcuStartOp(xref, message, messagePlaceholder, sourceSpan) {
8592
8605
  return __spreadValues({
8593
- kind: OpKind.Icu,
8606
+ kind: OpKind.IcuStart,
8594
8607
  xref,
8595
8608
  message,
8596
- icu,
8597
8609
  messagePlaceholder,
8598
8610
  context: null,
8599
8611
  sourceSpan
8600
8612
  }, NEW_OP);
8601
8613
  }
8614
+ function createIcuEndOp(xref) {
8615
+ return __spreadValues({
8616
+ kind: OpKind.IcuEnd,
8617
+ xref
8618
+ }, NEW_OP);
8619
+ }
8602
8620
  function createI18nContextOp(xref, i18nBlock, message, sourceSpan) {
8603
8621
  return __spreadValues({
8604
8622
  kind: OpKind.I18nContext,
@@ -8752,20 +8770,30 @@ function removeAnys(e) {
8752
8770
 
8753
8771
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/apply_i18n_expressions.mjs
8754
8772
  function applyI18nExpressions(job) {
8773
+ const i18nContexts = /* @__PURE__ */ new Map();
8774
+ for (const unit of job.units) {
8775
+ for (const op of unit.create) {
8776
+ if (op.kind === OpKind.I18nContext) {
8777
+ i18nContexts.set(op.xref, op);
8778
+ }
8779
+ }
8780
+ }
8755
8781
  for (const unit of job.units) {
8756
8782
  for (const op of unit.update) {
8757
- if (op.kind === OpKind.I18nExpression && needsApplication(op)) {
8783
+ if (op.kind === OpKind.I18nExpression && needsApplication(i18nContexts, op)) {
8758
8784
  OpList.insertAfter(createI18nApplyOp(op.target, op.handle, null), op);
8759
8785
  }
8760
8786
  }
8761
8787
  }
8762
8788
  }
8763
- function needsApplication(op) {
8789
+ function needsApplication(i18nContexts, op) {
8764
8790
  var _a2;
8765
8791
  if (((_a2 = op.next) == null ? void 0 : _a2.kind) !== OpKind.I18nExpression) {
8766
8792
  return true;
8767
8793
  }
8768
- if (op.next.context !== op.context) {
8794
+ const context = i18nContexts.get(op.context);
8795
+ const nextContext2 = i18nContexts.get(op.next.context);
8796
+ if (context.i18nBlock !== nextContext2.i18nBlock) {
8769
8797
  return true;
8770
8798
  }
8771
8799
  return false;
@@ -9309,7 +9337,7 @@ function createI18nContexts(job) {
9309
9337
  case OpKind.I18nEnd:
9310
9338
  currentI18nOp = null;
9311
9339
  break;
9312
- case OpKind.Icu:
9340
+ case OpKind.IcuStart:
9313
9341
  if (currentI18nOp === null) {
9314
9342
  throw Error("Unexpected ICU outside of an i18n block.");
9315
9343
  }
@@ -9326,52 +9354,6 @@ function createI18nContexts(job) {
9326
9354
  }
9327
9355
  }
9328
9356
 
9329
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_icu_expressions.mjs
9330
- function createI18nIcuExpressions(job) {
9331
- const icus = /* @__PURE__ */ new Map();
9332
- const i18nContexts = /* @__PURE__ */ new Map();
9333
- const i18nBlocks = /* @__PURE__ */ new Map();
9334
- for (const unit of job.units) {
9335
- for (const op of unit.create) {
9336
- switch (op.kind) {
9337
- case OpKind.Icu:
9338
- icus.set(op.xref, op);
9339
- break;
9340
- case OpKind.I18nContext:
9341
- i18nContexts.set(op.xref, op);
9342
- break;
9343
- case OpKind.I18nStart:
9344
- i18nBlocks.set(op.xref, op);
9345
- break;
9346
- }
9347
- }
9348
- for (const op of unit.update) {
9349
- switch (op.kind) {
9350
- case OpKind.IcuUpdate:
9351
- const icuOp = icus.get(op.xref);
9352
- if ((icuOp == null ? void 0 : icuOp.icu.expressionPlaceholder) === void 0) {
9353
- throw Error("ICU should have an i18n placeholder");
9354
- }
9355
- if (icuOp.context === null) {
9356
- throw Error("ICU should have its i18n context set");
9357
- }
9358
- const i18nContext = i18nContexts.get(icuOp.context);
9359
- const i18nBlock = i18nBlocks.get(i18nContext.i18nBlock);
9360
- OpList.replace(op, createI18nExpressionOp(
9361
- i18nContext.xref,
9362
- i18nBlock.xref,
9363
- i18nBlock.handle,
9364
- new LexicalReadExpr(icuOp.icu.expression),
9365
- icuOp.icu.expressionPlaceholder,
9366
- I18nParamResolutionTime.Postproccessing,
9367
- null
9368
- ));
9369
- break;
9370
- }
9371
- }
9372
- }
9373
- }
9374
-
9375
9357
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_configs.mjs
9376
9358
  function configureDeferInstructions(job) {
9377
9359
  for (const unit of job.units) {
@@ -9685,18 +9667,23 @@ function extractI18nMessages(job) {
9685
9667
  }
9686
9668
  for (const unit of job.units) {
9687
9669
  for (const op of unit.create) {
9688
- if (op.kind === OpKind.Icu) {
9689
- if (!op.context) {
9690
- throw Error("ICU op should have its context set.");
9691
- }
9692
- if (!i18nBlockContexts.has(op.context)) {
9693
- const i18nContext = i18nContexts.get(op.context);
9694
- const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
9695
- unit.create.push(subMessage);
9696
- const parentMessage = i18nBlockMessages.get(i18nContext.i18nBlock);
9697
- parentMessage == null ? void 0 : parentMessage.subMessages.push(subMessage.xref);
9698
- }
9699
- OpList.remove(op);
9670
+ switch (op.kind) {
9671
+ case OpKind.IcuStart:
9672
+ if (!op.context) {
9673
+ throw Error("ICU op should have its context set.");
9674
+ }
9675
+ if (!i18nBlockContexts.has(op.context)) {
9676
+ const i18nContext = i18nContexts.get(op.context);
9677
+ const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
9678
+ unit.create.push(subMessage);
9679
+ const parentMessage = i18nBlockMessages.get(i18nContext.i18nBlock);
9680
+ parentMessage == null ? void 0 : parentMessage.subMessages.push(subMessage.xref);
9681
+ }
9682
+ OpList.remove(op);
9683
+ break;
9684
+ case OpKind.IcuEnd:
9685
+ OpList.remove(op);
9686
+ break;
9700
9687
  }
9701
9688
  }
9702
9689
  }
@@ -9712,7 +9699,7 @@ function createI18nMessage(job, context, messagePlaceholder) {
9712
9699
  }
9713
9700
  function formatParams(params) {
9714
9701
  const result = /* @__PURE__ */ new Map();
9715
- for (const [placeholder, placeholderValues] of [...params].sort()) {
9702
+ for (const [placeholder, placeholderValues] of params) {
9716
9703
  const serializedValues = formatParamValues(placeholderValues);
9717
9704
  if (serializedValues !== null) {
9718
9705
  result.set(placeholder, literal(formatParamValues(placeholderValues)));
@@ -9728,6 +9715,9 @@ function formatParamValues(values) {
9728
9715
  return serializedValues.length === 1 ? serializedValues[0] : `${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`;
9729
9716
  }
9730
9717
  function formatValue(value) {
9718
+ if (value.flags === I18nParamValueFlags.None) {
9719
+ return `${value.value}`;
9720
+ }
9731
9721
  let tagMarker = "";
9732
9722
  let closeMarker = "";
9733
9723
  if (value.flags & I18nParamValueFlags.ElementTag) {
@@ -15921,11 +15911,13 @@ function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
15921
15911
  statements.push(...subMessageStatements);
15922
15912
  messageOp.params.set(subMessage.messagePlaceholder, subMessageVar);
15923
15913
  }
15914
+ messageOp.params = new Map([...messageOp.params.entries()].sort());
15924
15915
  assertAllParamsResolved(messageOp);
15925
15916
  const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
15926
15917
  const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
15927
15918
  let transformFn = void 0;
15928
15919
  if (messageOp.needsPostprocessing) {
15920
+ messageOp.postprocessingParams = new Map([...messageOp.postprocessingParams.entries()].sort());
15929
15921
  const extraTransformFnParams = [];
15930
15922
  if (messageOp.postprocessingParams.size > 0) {
15931
15923
  extraTransformFnParams.push(literalMap([...messageOp.postprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
@@ -15963,12 +15955,14 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
15963
15955
  return variable(name);
15964
15956
  }
15965
15957
  function assertAllParamsResolved(op) {
15966
- for (const placeholder in op.message.placeholders) {
15958
+ for (let placeholder in op.message.placeholders) {
15959
+ placeholder = placeholder.trimEnd();
15967
15960
  if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
15968
15961
  throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
15969
15962
  }
15970
15963
  }
15971
- for (const placeholder in op.message.placeholderToMessage) {
15964
+ for (let placeholder in op.message.placeholderToMessage) {
15965
+ placeholder = placeholder.trimEnd();
15972
15966
  if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
15973
15967
  throw Error(`Failed to resolve i18n message placeholder: ${placeholder}`);
15974
15968
  }
@@ -15980,7 +15974,9 @@ function extractI18nText(job) {
15980
15974
  var _a2;
15981
15975
  for (const unit of job.units) {
15982
15976
  let currentI18n = null;
15977
+ let currentIcu = null;
15983
15978
  const textNodeI18nBlocks = /* @__PURE__ */ new Map();
15979
+ const textNodeIcus = /* @__PURE__ */ new Map();
15984
15980
  for (const op of unit.create) {
15985
15981
  switch (op.kind) {
15986
15982
  case OpKind.I18nStart:
@@ -15992,9 +15988,19 @@ function extractI18nText(job) {
15992
15988
  case OpKind.I18nEnd:
15993
15989
  currentI18n = null;
15994
15990
  break;
15991
+ case OpKind.IcuStart:
15992
+ if (op.context === null) {
15993
+ throw Error("Icu op should have its context set.");
15994
+ }
15995
+ currentIcu = op;
15996
+ break;
15997
+ case OpKind.IcuEnd:
15998
+ currentIcu = null;
15999
+ break;
15995
16000
  case OpKind.Text:
15996
16001
  if (currentI18n !== null) {
15997
16002
  textNodeI18nBlocks.set(op.xref, currentI18n);
16003
+ textNodeIcus.set(op.xref, currentIcu);
15998
16004
  OpList.remove(op);
15999
16005
  }
16000
16006
  break;
@@ -16007,11 +16013,13 @@ function extractI18nText(job) {
16007
16013
  continue;
16008
16014
  }
16009
16015
  const i18nOp = textNodeI18nBlocks.get(op.target);
16016
+ const icuOp = textNodeIcus.get(op.target);
16017
+ const contextId = icuOp ? icuOp.context : i18nOp.context;
16018
+ const resolutionTime = icuOp ? I18nParamResolutionTime.Postproccessing : I18nParamResolutionTime.Creation;
16010
16019
  const ops = [];
16011
16020
  for (let i = 0; i < op.interpolation.expressions.length; i++) {
16012
16021
  const expr = op.interpolation.expressions[i];
16013
- const placeholder = op.i18nPlaceholders[i];
16014
- ops.push(createI18nExpressionOp(i18nOp.context, i18nOp.xref, i18nOp.handle, expr, placeholder.name, I18nParamResolutionTime.Creation, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
16022
+ ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.handle, expr, op.i18nPlaceholders[i], resolutionTime, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
16015
16023
  }
16016
16024
  OpList.replaceWithMany(op, ops);
16017
16025
  break;
@@ -17751,7 +17759,7 @@ function getSubTemplateIndexForTemplateTag(job, i18nOp, op) {
17751
17759
  }
17752
17760
  return i18nOp.subTemplateIndex;
17753
17761
  }
17754
- function addParam(params, placeholder, value, subTemplateIndex, flags = I18nParamValueFlags.None) {
17762
+ function addParam(params, placeholder, value, subTemplateIndex, flags) {
17755
17763
  var _a2;
17756
17764
  const values = (_a2 = params.get(placeholder)) != null ? _a2 : [];
17757
17765
  values.push({ value, subTemplateIndex, flags });
@@ -17778,19 +17786,76 @@ function resolveI18nExpressionPlaceholders(job) {
17778
17786
  for (const unit of job.units) {
17779
17787
  for (const op of unit.update) {
17780
17788
  if (op.kind === OpKind.I18nExpression) {
17781
- const index = expressionIndices.get(op.context) || 0;
17782
17789
  const i18nContext = i18nContexts.get(op.context);
17790
+ const index = expressionIndices.get(i18nContext.i18nBlock) || 0;
17783
17791
  const subTemplateIndex = subTemplateIndicies.get(i18nContext.i18nBlock);
17784
17792
  const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
17785
17793
  const values = params.get(op.i18nPlaceholder) || [];
17786
- values.push({ value: index, subTemplateIndex, flags: I18nParamValueFlags.None });
17794
+ values.push({
17795
+ value: index,
17796
+ subTemplateIndex,
17797
+ flags: I18nParamValueFlags.ExpressionIndex
17798
+ });
17787
17799
  params.set(op.i18nPlaceholder, values);
17788
- expressionIndices.set(op.context, index + 1);
17800
+ expressionIndices.set(i18nContext.i18nBlock, index + 1);
17789
17801
  }
17790
17802
  }
17791
17803
  }
17792
17804
  }
17793
17805
 
17806
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_icu_placeholders.mjs
17807
+ function resolveI18nIcuPlaceholders(job) {
17808
+ const contextOps = /* @__PURE__ */ new Map();
17809
+ for (const unit of job.units) {
17810
+ for (const op of unit.create) {
17811
+ switch (op.kind) {
17812
+ case OpKind.I18nContext:
17813
+ contextOps.set(op.xref, op);
17814
+ break;
17815
+ }
17816
+ }
17817
+ }
17818
+ for (const unit of job.units) {
17819
+ for (const op of unit.create) {
17820
+ switch (op.kind) {
17821
+ case OpKind.IcuStart:
17822
+ if (op.context === null) {
17823
+ throw Error("Icu should have its i18n context set.");
17824
+ }
17825
+ const i18nContext = contextOps.get(op.context);
17826
+ for (const node of op.message.nodes) {
17827
+ node.visit(new ResolveIcuPlaceholdersVisitor(i18nContext.postprocessingParams));
17828
+ }
17829
+ break;
17830
+ }
17831
+ }
17832
+ }
17833
+ }
17834
+ var ResolveIcuPlaceholdersVisitor = class extends RecurseVisitor {
17835
+ constructor(params) {
17836
+ super();
17837
+ this.params = params;
17838
+ }
17839
+ visitTagPlaceholder(placeholder) {
17840
+ var _a2, _b2;
17841
+ super.visitTagPlaceholder(placeholder);
17842
+ if (placeholder.startName && placeholder.startSourceSpan && !this.params.has(placeholder.startName)) {
17843
+ this.params.set(placeholder.startName, [{
17844
+ value: (_a2 = placeholder.startSourceSpan) == null ? void 0 : _a2.toString(),
17845
+ subTemplateIndex: null,
17846
+ flags: I18nParamValueFlags.None
17847
+ }]);
17848
+ }
17849
+ if (placeholder.closeName && placeholder.endSourceSpan && !this.params.has(placeholder.closeName)) {
17850
+ this.params.set(placeholder.closeName, [{
17851
+ value: (_b2 = placeholder.endSourceSpan) == null ? void 0 : _b2.toString(),
17852
+ subTemplateIndex: null,
17853
+ flags: I18nParamValueFlags.None
17854
+ }]);
17855
+ }
17856
+ }
17857
+ };
17858
+
17794
17859
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
17795
17860
  function resolveNames(job) {
17796
17861
  for (const unit of job.units) {
@@ -18507,6 +18572,7 @@ function allowConservativeInlining(decl, target) {
18507
18572
  function wrapI18nIcus(job) {
18508
18573
  for (const unit of job.units) {
18509
18574
  let currentI18nOp = null;
18575
+ let addedI18nId = null;
18510
18576
  for (const op of unit.create) {
18511
18577
  switch (op.kind) {
18512
18578
  case OpKind.I18nStart:
@@ -18515,11 +18581,16 @@ function wrapI18nIcus(job) {
18515
18581
  case OpKind.I18nEnd:
18516
18582
  currentI18nOp = null;
18517
18583
  break;
18518
- case OpKind.Icu:
18584
+ case OpKind.IcuStart:
18519
18585
  if (currentI18nOp === null) {
18520
- const id = job.allocateXrefId();
18521
- OpList.insertBefore(createI18nStartOp(id, op.message), op);
18522
- OpList.insertAfter(createI18nEndOp(id), op);
18586
+ addedI18nId = job.allocateXrefId();
18587
+ OpList.insertBefore(createI18nStartOp(addedI18nId, op.message), op);
18588
+ }
18589
+ break;
18590
+ case OpKind.IcuEnd:
18591
+ if (addedI18nId !== null) {
18592
+ OpList.insertAfter(createI18nEndOp(addedI18nId), op);
18593
+ addedI18nId = null;
18523
18594
  }
18524
18595
  break;
18525
18596
  }
@@ -18546,7 +18617,6 @@ var phases = [
18546
18617
  { kind: CompilationJobKind.Tmpl, fn: createPipes },
18547
18618
  { kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
18548
18619
  { kind: CompilationJobKind.Tmpl, fn: extractI18nText },
18549
- { kind: CompilationJobKind.Tmpl, fn: createI18nIcuExpressions },
18550
18620
  { kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
18551
18621
  { kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
18552
18622
  { kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
@@ -18570,6 +18640,7 @@ var phases = [
18570
18640
  { kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
18571
18641
  { kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
18572
18642
  { kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
18643
+ { kind: CompilationJobKind.Tmpl, fn: resolveI18nIcuPlaceholders },
18573
18644
  { kind: CompilationJobKind.Tmpl, fn: mergeI18nContexts },
18574
18645
  { kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
18575
18646
  { kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
@@ -18834,7 +18905,7 @@ function ingestContent(unit, content) {
18834
18905
  function ingestText(unit, text2) {
18835
18906
  unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, text2.sourceSpan));
18836
18907
  }
18837
- function ingestBoundText(unit, text2) {
18908
+ function ingestBoundText(unit, text2, i18nPlaceholders) {
18838
18909
  var _a2;
18839
18910
  let value = text2.value;
18840
18911
  if (value instanceof ASTWithSource) {
@@ -18846,7 +18917,12 @@ function ingestBoundText(unit, text2) {
18846
18917
  if (text2.i18n !== void 0 && !(text2.i18n instanceof Container)) {
18847
18918
  throw Error(`Unhandled i18n metadata type for text interpolation: ${(_a2 = text2.i18n) == null ? void 0 : _a2.constructor.name}`);
18848
18919
  }
18849
- const i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder) : [];
18920
+ if (i18nPlaceholders === void 0) {
18921
+ i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
18922
+ }
18923
+ if (i18nPlaceholders.length > 0 && i18nPlaceholders.length !== value.expressions.length) {
18924
+ throw Error(`Unexpected number of i18n placeholders (${value.expressions.length}) for BoundText with ${value.expressions.length} expressions`);
18925
+ }
18850
18926
  const textXref = unit.job.allocateXrefId();
18851
18927
  unit.create.push(createTextOp(textXref, "", text2.sourceSpan));
18852
18928
  const baseSourceSpan = unit.job.compatibility ? null : text2.sourceSpan;
@@ -18992,13 +19068,26 @@ function ingestDeferBlock(unit, deferBlock) {
18992
19068
  unit.update.push(deferWhenOps);
18993
19069
  }
18994
19070
  function ingestIcu(unit, icu) {
18995
- var _a2;
19071
+ var _a2, _b2;
18996
19072
  if (icu.i18n instanceof Message && isSingleI18nIcu(icu.i18n)) {
18997
19073
  const xref = unit.job.allocateXrefId();
18998
- unit.create.push(createIcuOp(xref, icu.i18n, icu.i18n.nodes[0], icuFromI18nMessage(icu.i18n).name, null));
18999
- unit.update.push(createIcuUpdateOp(xref, null));
19074
+ const icuNode = icu.i18n.nodes[0];
19075
+ unit.create.push(createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null));
19076
+ const expressionPlaceholder = (_a2 = icuNode.expressionPlaceholder) == null ? void 0 : _a2.trimEnd();
19077
+ if (expressionPlaceholder === void 0 || icu.vars[expressionPlaceholder] === void 0) {
19078
+ throw Error("ICU should have a text binding");
19079
+ }
19080
+ ingestBoundText(unit, icu.vars[expressionPlaceholder], [expressionPlaceholder]);
19081
+ for (const [placeholder, text2] of Object.entries(icu.placeholders)) {
19082
+ if (text2 instanceof BoundText) {
19083
+ ingestBoundText(unit, text2, [placeholder]);
19084
+ } else {
19085
+ ingestText(unit, text2);
19086
+ }
19087
+ }
19088
+ unit.create.push(createIcuEndOp(xref));
19000
19089
  } else {
19001
- throw Error(`Unhandled i18n metadata type for ICU: ${(_a2 = icu.i18n) == null ? void 0 : _a2.constructor.name}`);
19090
+ throw Error(`Unhandled i18n metadata type for ICU: ${(_b2 = icu.i18n) == null ? void 0 : _b2.constructor.name}`);
19002
19091
  }
19003
19092
  }
19004
19093
  function ingestForBlock(unit, forBlock) {
@@ -21957,7 +22046,7 @@ var TemplateDefinitionBuilder = class {
21957
22046
  const placeholders = this.i18nBindProps(icu.placeholders);
21958
22047
  const message = icu.i18n;
21959
22048
  const transformFn = (raw) => {
21960
- const params = __spreadValues(__spreadValues({}, vars), placeholders);
22049
+ const params = Object.fromEntries(Object.entries(__spreadValues(__spreadValues({}, vars), placeholders)).sort());
21961
22050
  const formatted = formatI18nPlaceholderNamesInMap(params, false);
21962
22051
  return invokeInstruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
21963
22052
  };
@@ -24750,7 +24839,7 @@ function publishFacade(global) {
24750
24839
  }
24751
24840
 
24752
24841
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/version.mjs
24753
- var VERSION2 = new Version("17.0.1");
24842
+ var VERSION2 = new Version("17.0.3");
24754
24843
 
24755
24844
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
24756
24845
  var _VisitorMode;