@angular/core 17.0.2 → 17.0.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.
Files changed (36) hide show
  1. package/esm2022/src/core_render3_private_export.mjs +2 -2
  2. package/esm2022/src/defer/instructions.mjs +3 -2
  3. package/esm2022/src/defer/utils.mjs +2 -2
  4. package/esm2022/src/image_performance_warning.mjs +14 -3
  5. package/esm2022/src/render3/index.mjs +2 -2
  6. package/esm2022/src/render3/instructions/change_detection.mjs +10 -20
  7. package/esm2022/src/render3/instructions/control_flow.mjs +9 -11
  8. package/esm2022/src/render3/instructions/shared.mjs +4 -5
  9. package/esm2022/src/render3/interfaces/container.mjs +22 -17
  10. package/esm2022/src/render3/interfaces/view.mjs +2 -2
  11. package/esm2022/src/render3/node_manipulation.mjs +3 -3
  12. package/esm2022/src/render3/util/change_detection_utils.mjs +13 -2
  13. package/esm2022/src/render3/util/injector_discovery_utils.mjs +10 -13
  14. package/esm2022/src/render3/util/view_utils.mjs +4 -4
  15. package/esm2022/src/render3/view_ref.mjs +3 -3
  16. package/esm2022/src/version.mjs +1 -1
  17. package/esm2022/testing/src/logger.mjs +3 -3
  18. package/esm2022/testing/src/test_bed_compiler.mjs +4 -1
  19. package/fesm2022/core.mjs +83 -70
  20. package/fesm2022/core.mjs.map +1 -1
  21. package/fesm2022/primitives/signals.mjs +1 -1
  22. package/fesm2022/rxjs-interop.mjs +1 -1
  23. package/fesm2022/testing.mjs +4 -1
  24. package/fesm2022/testing.mjs.map +1 -1
  25. package/index.d.ts +28 -40
  26. package/package.json +1 -1
  27. package/primitives/signals/index.d.ts +1 -1
  28. package/rxjs-interop/index.d.ts +1 -1
  29. package/schematics/migrations/block-template-entities/bundle.js +385 -159
  30. package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
  31. package/schematics/ng-generate/control-flow-migration/bundle.js +867 -371
  32. package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
  33. package/schematics/ng-generate/control-flow-migration/schema.json +6 -0
  34. package/schematics/ng-generate/standalone-migration/bundle.js +422 -168
  35. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  36. package/testing/index.d.ts +1 -1
@@ -868,6 +868,9 @@ var _SerializerVisitor = class {
868
868
  visitIcuPlaceholder(ph, context) {
869
869
  return `<ph icu name="${ph.name}">${ph.value.visit(this)}</ph>`;
870
870
  }
871
+ visitBlockPlaceholder(ph, context) {
872
+ return `<ph block name="${ph.startName}">${ph.children.map((child) => child.visit(this)).join(", ")}</ph name="${ph.closeName}">`;
873
+ }
871
874
  };
872
875
  var serializerVisitor = new _SerializerVisitor();
873
876
  function serializeNodes(nodes) {
@@ -4152,43 +4155,47 @@ var BlockNode = class {
4152
4155
  }
4153
4156
  };
4154
4157
  var DeferredBlockPlaceholder = class extends BlockNode {
4155
- constructor(children, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
4158
+ constructor(children, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
4156
4159
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
4157
4160
  this.children = children;
4158
4161
  this.minimumTime = minimumTime;
4162
+ this.i18n = i18n2;
4159
4163
  }
4160
4164
  visit(visitor) {
4161
4165
  return visitor.visitDeferredBlockPlaceholder(this);
4162
4166
  }
4163
4167
  };
4164
4168
  var DeferredBlockLoading = class extends BlockNode {
4165
- constructor(children, afterTime, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
4169
+ constructor(children, afterTime, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
4166
4170
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
4167
4171
  this.children = children;
4168
4172
  this.afterTime = afterTime;
4169
4173
  this.minimumTime = minimumTime;
4174
+ this.i18n = i18n2;
4170
4175
  }
4171
4176
  visit(visitor) {
4172
4177
  return visitor.visitDeferredBlockLoading(this);
4173
4178
  }
4174
4179
  };
4175
4180
  var DeferredBlockError = class extends BlockNode {
4176
- constructor(children, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
4181
+ constructor(children, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
4177
4182
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
4178
4183
  this.children = children;
4184
+ this.i18n = i18n2;
4179
4185
  }
4180
4186
  visit(visitor) {
4181
4187
  return visitor.visitDeferredBlockError(this);
4182
4188
  }
4183
4189
  };
4184
4190
  var DeferredBlock = class extends BlockNode {
4185
- constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, nameSpan, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan) {
4191
+ constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, nameSpan, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, i18n2) {
4186
4192
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
4187
4193
  this.children = children;
4188
4194
  this.placeholder = placeholder;
4189
4195
  this.loading = loading;
4190
4196
  this.error = error2;
4191
4197
  this.mainBlockSpan = mainBlockSpan;
4198
+ this.i18n = i18n2;
4192
4199
  this.triggers = triggers;
4193
4200
  this.prefetchTriggers = prefetchTriggers;
4194
4201
  this.definedTriggers = Object.keys(triggers);
@@ -4220,17 +4227,18 @@ var SwitchBlock = class extends BlockNode {
4220
4227
  }
4221
4228
  };
4222
4229
  var SwitchBlockCase = class extends BlockNode {
4223
- constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
4230
+ constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
4224
4231
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
4225
4232
  this.expression = expression;
4226
4233
  this.children = children;
4234
+ this.i18n = i18n2;
4227
4235
  }
4228
4236
  visit(visitor) {
4229
4237
  return visitor.visitSwitchBlockCase(this);
4230
4238
  }
4231
4239
  };
4232
4240
  var ForLoopBlock = class extends BlockNode {
4233
- constructor(item, expression, trackBy, trackKeywordSpan, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, nameSpan) {
4241
+ constructor(item, expression, trackBy, trackKeywordSpan, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
4234
4242
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
4235
4243
  this.item = item;
4236
4244
  this.expression = expression;
@@ -4240,15 +4248,17 @@ var ForLoopBlock = class extends BlockNode {
4240
4248
  this.children = children;
4241
4249
  this.empty = empty;
4242
4250
  this.mainBlockSpan = mainBlockSpan;
4251
+ this.i18n = i18n2;
4243
4252
  }
4244
4253
  visit(visitor) {
4245
4254
  return visitor.visitForLoopBlock(this);
4246
4255
  }
4247
4256
  };
4248
4257
  var ForLoopBlockEmpty = class extends BlockNode {
4249
- constructor(children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
4258
+ constructor(children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
4250
4259
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
4251
4260
  this.children = children;
4261
+ this.i18n = i18n2;
4252
4262
  }
4253
4263
  visit(visitor) {
4254
4264
  return visitor.visitForLoopBlockEmpty(this);
@@ -4264,11 +4274,12 @@ var IfBlock = class extends BlockNode {
4264
4274
  }
4265
4275
  };
4266
4276
  var IfBlockBranch = class extends BlockNode {
4267
- constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
4277
+ constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
4268
4278
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
4269
4279
  this.expression = expression;
4270
4280
  this.children = children;
4271
4281
  this.expressionAlias = expressionAlias;
4282
+ this.i18n = i18n2;
4272
4283
  }
4273
4284
  visit(visitor) {
4274
4285
  return visitor.visitIfBlockBranch(this);
@@ -4531,6 +4542,21 @@ var IcuPlaceholder = class {
4531
4542
  return visitor.visitIcuPlaceholder(this, context);
4532
4543
  }
4533
4544
  };
4545
+ var BlockPlaceholder = class {
4546
+ constructor(name, parameters, startName, closeName, children, sourceSpan, startSourceSpan, endSourceSpan) {
4547
+ this.name = name;
4548
+ this.parameters = parameters;
4549
+ this.startName = startName;
4550
+ this.closeName = closeName;
4551
+ this.children = children;
4552
+ this.sourceSpan = sourceSpan;
4553
+ this.startSourceSpan = startSourceSpan;
4554
+ this.endSourceSpan = endSourceSpan;
4555
+ }
4556
+ visit(visitor, context) {
4557
+ return visitor.visitBlockPlaceholder(this, context);
4558
+ }
4559
+ };
4534
4560
  var CloneVisitor = class {
4535
4561
  visitText(text2, context) {
4536
4562
  return new Text2(text2.value, text2.sourceSpan);
@@ -4555,6 +4581,10 @@ var CloneVisitor = class {
4555
4581
  visitIcuPlaceholder(ph, context) {
4556
4582
  return new IcuPlaceholder(ph.value, ph.name, ph.sourceSpan);
4557
4583
  }
4584
+ visitBlockPlaceholder(ph, context) {
4585
+ const children = ph.children.map((n) => n.visit(this, context));
4586
+ return new BlockPlaceholder(ph.name, ph.parameters, ph.startName, ph.closeName, children, ph.sourceSpan, ph.startSourceSpan, ph.endSourceSpan);
4587
+ }
4558
4588
  };
4559
4589
  var RecurseVisitor = class {
4560
4590
  visitText(text2, context) {
@@ -4574,6 +4604,9 @@ var RecurseVisitor = class {
4574
4604
  }
4575
4605
  visitIcuPlaceholder(ph, context) {
4576
4606
  }
4607
+ visitBlockPlaceholder(ph, context) {
4608
+ ph.children.forEach((child) => child.visit(this));
4609
+ }
4577
4610
  };
4578
4611
  function serializeMessage(messageNodes) {
4579
4612
  const visitor = new LocalizeMessageStringVisitor();
@@ -4601,6 +4634,10 @@ var LocalizeMessageStringVisitor = class {
4601
4634
  visitIcuPlaceholder(ph) {
4602
4635
  return `{$${ph.name}}`;
4603
4636
  }
4637
+ visitBlockPlaceholder(ph) {
4638
+ const children = ph.children.map((child) => child.visit(this)).join("");
4639
+ return `{$${ph.startName}}${children}{$${ph.closeName}}`;
4640
+ }
4604
4641
  };
4605
4642
 
4606
4643
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/serializers/serializer.mjs
@@ -4635,6 +4672,11 @@ var SimplePlaceholderMapper = class extends RecurseVisitor {
4635
4672
  visitPlaceholder(ph, context) {
4636
4673
  this.visitPlaceholderName(ph.name);
4637
4674
  }
4675
+ visitBlockPlaceholder(ph, context) {
4676
+ this.visitPlaceholderName(ph.startName);
4677
+ super.visitBlockPlaceholder(ph, context);
4678
+ this.visitPlaceholderName(ph.closeName);
4679
+ }
4638
4680
  visitIcuPlaceholder(ph, context) {
4639
4681
  this.visitPlaceholderName(ph.name);
4640
4682
  }
@@ -4843,6 +4885,15 @@ var _Visitor2 = class {
4843
4885
  new Tag(_PLACEHOLDER_TAG, { name: ph.name }, [exTag, interpolationAsText])
4844
4886
  ];
4845
4887
  }
4888
+ visitBlockPlaceholder(ph, context) {
4889
+ const startAsText = new Text3(`@${ph.name}`);
4890
+ const startEx = new Tag(_EXAMPLE_TAG, {}, [startAsText]);
4891
+ const startTagPh = new Tag(_PLACEHOLDER_TAG, { name: ph.startName }, [startEx, startAsText]);
4892
+ const closeAsText = new Text3(`}`);
4893
+ const closeEx = new Tag(_EXAMPLE_TAG, {}, [closeAsText]);
4894
+ const closeTagPh = new Tag(_PLACEHOLDER_TAG, { name: ph.closeName }, [closeEx, closeAsText]);
4895
+ return [startTagPh, ...this.serialize(ph.children), closeTagPh];
4896
+ }
4846
4897
  visitIcuPlaceholder(ph, context) {
4847
4898
  const icuExpression = ph.value.expression;
4848
4899
  const icuType = ph.value.type;
@@ -5318,7 +5369,7 @@ function assertInterpolationSymbols(identifier, value) {
5318
5369
  }
5319
5370
  }
5320
5371
 
5321
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/interpolation_config.mjs
5372
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/defaults.mjs
5322
5373
  var InterpolationConfig = class {
5323
5374
  static fromArray(markers) {
5324
5375
  if (!markers) {
@@ -5333,6 +5384,7 @@ var InterpolationConfig = class {
5333
5384
  }
5334
5385
  };
5335
5386
  var DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig("{{", "}}");
5387
+ var DEFAULT_CONTAINER_BLOCKS = /* @__PURE__ */ new Set(["switch"]);
5336
5388
 
5337
5389
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/chars.mjs
5338
5390
  var $EOF = 0;
@@ -7868,8 +7920,8 @@ var OpKind;
7868
7920
  OpKind2[OpKind2["I18nEnd"] = 38] = "I18nEnd";
7869
7921
  OpKind2[OpKind2["I18nExpression"] = 39] = "I18nExpression";
7870
7922
  OpKind2[OpKind2["I18nApply"] = 40] = "I18nApply";
7871
- OpKind2[OpKind2["Icu"] = 41] = "Icu";
7872
- OpKind2[OpKind2["IcuUpdate"] = 42] = "IcuUpdate";
7923
+ OpKind2[OpKind2["IcuStart"] = 41] = "IcuStart";
7924
+ OpKind2[OpKind2["IcuEnd"] = 42] = "IcuEnd";
7873
7925
  OpKind2[OpKind2["I18nContext"] = 43] = "I18nContext";
7874
7926
  })(OpKind || (OpKind = {}));
7875
7927
  var ExpressionKind;
@@ -7954,6 +8006,7 @@ var I18nParamValueFlags;
7954
8006
  I18nParamValueFlags2[I18nParamValueFlags2["TemplateTag"] = 2] = "TemplateTag";
7955
8007
  I18nParamValueFlags2[I18nParamValueFlags2["OpenTag"] = 4] = "OpenTag";
7956
8008
  I18nParamValueFlags2[I18nParamValueFlags2["CloseTag"] = 8] = "CloseTag";
8009
+ I18nParamValueFlags2[I18nParamValueFlags2["ExpressionIndex"] = 16] = "ExpressionIndex";
7957
8010
  })(I18nParamValueFlags || (I18nParamValueFlags = {}));
7958
8011
  var Namespace;
7959
8012
  (function(Namespace2) {
@@ -8143,13 +8196,13 @@ function createConditionalOp(target, targetSlot, test, conditions, sourceSpan) {
8143
8196
  }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
8144
8197
  }
8145
8198
  function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
8146
- return __spreadValues({
8199
+ return __spreadValues(__spreadValues({
8147
8200
  kind: OpKind.Repeater,
8148
8201
  target: repeaterCreate2,
8149
8202
  targetSlot,
8150
8203
  collection,
8151
8204
  sourceSpan
8152
- }, NEW_OP);
8205
+ }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
8153
8206
  }
8154
8207
  function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
8155
8208
  return __spreadValues(__spreadValues({
@@ -8180,13 +8233,6 @@ function createI18nApplyOp(target, handle, sourceSpan) {
8180
8233
  sourceSpan
8181
8234
  }, NEW_OP);
8182
8235
  }
8183
- function createIcuUpdateOp(xref, sourceSpan) {
8184
- return __spreadValues({
8185
- kind: OpKind.IcuUpdate,
8186
- xref,
8187
- sourceSpan
8188
- }, NEW_OP);
8189
- }
8190
8236
 
8191
8237
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/expression.mjs
8192
8238
  var _a;
@@ -8950,8 +8996,8 @@ function transformExpressionsInOp(op, transform2, flags) {
8950
8996
  case OpKind.I18nContext:
8951
8997
  case OpKind.I18nEnd:
8952
8998
  case OpKind.I18nStart:
8953
- case OpKind.Icu:
8954
- case OpKind.IcuUpdate:
8999
+ case OpKind.IcuEnd:
9000
+ case OpKind.IcuStart:
8955
9001
  case OpKind.Namespace:
8956
9002
  case OpKind.Pipe:
8957
9003
  case OpKind.Projection:
@@ -9453,17 +9499,22 @@ function createI18nEndOp(xref) {
9453
9499
  xref
9454
9500
  }, NEW_OP);
9455
9501
  }
9456
- function createIcuOp(xref, message, icu, messagePlaceholder, sourceSpan) {
9502
+ function createIcuStartOp(xref, message, messagePlaceholder, sourceSpan) {
9457
9503
  return __spreadValues({
9458
- kind: OpKind.Icu,
9504
+ kind: OpKind.IcuStart,
9459
9505
  xref,
9460
9506
  message,
9461
- icu,
9462
9507
  messagePlaceholder,
9463
9508
  context: null,
9464
9509
  sourceSpan
9465
9510
  }, NEW_OP);
9466
9511
  }
9512
+ function createIcuEndOp(xref) {
9513
+ return __spreadValues({
9514
+ kind: OpKind.IcuEnd,
9515
+ xref
9516
+ }, NEW_OP);
9517
+ }
9467
9518
  function createI18nContextOp(xref, i18nBlock, message, sourceSpan) {
9468
9519
  return __spreadValues({
9469
9520
  kind: OpKind.I18nContext,
@@ -9617,20 +9668,30 @@ function removeAnys(e) {
9617
9668
 
9618
9669
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/apply_i18n_expressions.mjs
9619
9670
  function applyI18nExpressions(job) {
9671
+ const i18nContexts = /* @__PURE__ */ new Map();
9672
+ for (const unit of job.units) {
9673
+ for (const op of unit.create) {
9674
+ if (op.kind === OpKind.I18nContext) {
9675
+ i18nContexts.set(op.xref, op);
9676
+ }
9677
+ }
9678
+ }
9620
9679
  for (const unit of job.units) {
9621
9680
  for (const op of unit.update) {
9622
- if (op.kind === OpKind.I18nExpression && needsApplication(op)) {
9681
+ if (op.kind === OpKind.I18nExpression && needsApplication(i18nContexts, op)) {
9623
9682
  OpList.insertAfter(createI18nApplyOp(op.target, op.handle, null), op);
9624
9683
  }
9625
9684
  }
9626
9685
  }
9627
9686
  }
9628
- function needsApplication(op) {
9687
+ function needsApplication(i18nContexts, op) {
9629
9688
  var _a2;
9630
9689
  if (((_a2 = op.next) == null ? void 0 : _a2.kind) !== OpKind.I18nExpression) {
9631
9690
  return true;
9632
9691
  }
9633
- if (op.next.context !== op.context) {
9692
+ const context = i18nContexts.get(op.context);
9693
+ const nextContext2 = i18nContexts.get(op.next.context);
9694
+ if (context.i18nBlock !== nextContext2.i18nBlock) {
9634
9695
  return true;
9635
9696
  }
9636
9697
  return false;
@@ -10174,7 +10235,7 @@ function createI18nContexts(job) {
10174
10235
  case OpKind.I18nEnd:
10175
10236
  currentI18nOp = null;
10176
10237
  break;
10177
- case OpKind.Icu:
10238
+ case OpKind.IcuStart:
10178
10239
  if (currentI18nOp === null) {
10179
10240
  throw Error("Unexpected ICU outside of an i18n block.");
10180
10241
  }
@@ -10191,52 +10252,6 @@ function createI18nContexts(job) {
10191
10252
  }
10192
10253
  }
10193
10254
 
10194
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_icu_expressions.mjs
10195
- function createI18nIcuExpressions(job) {
10196
- const icus = /* @__PURE__ */ new Map();
10197
- const i18nContexts = /* @__PURE__ */ new Map();
10198
- const i18nBlocks = /* @__PURE__ */ new Map();
10199
- for (const unit of job.units) {
10200
- for (const op of unit.create) {
10201
- switch (op.kind) {
10202
- case OpKind.Icu:
10203
- icus.set(op.xref, op);
10204
- break;
10205
- case OpKind.I18nContext:
10206
- i18nContexts.set(op.xref, op);
10207
- break;
10208
- case OpKind.I18nStart:
10209
- i18nBlocks.set(op.xref, op);
10210
- break;
10211
- }
10212
- }
10213
- for (const op of unit.update) {
10214
- switch (op.kind) {
10215
- case OpKind.IcuUpdate:
10216
- const icuOp = icus.get(op.xref);
10217
- if ((icuOp == null ? void 0 : icuOp.icu.expressionPlaceholder) === void 0) {
10218
- throw Error("ICU should have an i18n placeholder");
10219
- }
10220
- if (icuOp.context === null) {
10221
- throw Error("ICU should have its i18n context set");
10222
- }
10223
- const i18nContext = i18nContexts.get(icuOp.context);
10224
- const i18nBlock = i18nBlocks.get(i18nContext.i18nBlock);
10225
- OpList.replace(op, createI18nExpressionOp(
10226
- i18nContext.xref,
10227
- i18nBlock.xref,
10228
- i18nBlock.handle,
10229
- new LexicalReadExpr(icuOp.icu.expression),
10230
- icuOp.icu.expressionPlaceholder,
10231
- I18nParamResolutionTime.Postproccessing,
10232
- null
10233
- ));
10234
- break;
10235
- }
10236
- }
10237
- }
10238
- }
10239
-
10240
10255
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_configs.mjs
10241
10256
  function configureDeferInstructions(job) {
10242
10257
  for (const unit of job.units) {
@@ -10550,18 +10565,23 @@ function extractI18nMessages(job) {
10550
10565
  }
10551
10566
  for (const unit of job.units) {
10552
10567
  for (const op of unit.create) {
10553
- if (op.kind === OpKind.Icu) {
10554
- if (!op.context) {
10555
- throw Error("ICU op should have its context set.");
10556
- }
10557
- if (!i18nBlockContexts.has(op.context)) {
10558
- const i18nContext = i18nContexts.get(op.context);
10559
- const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
10560
- unit.create.push(subMessage);
10561
- const parentMessage = i18nBlockMessages.get(i18nContext.i18nBlock);
10562
- parentMessage == null ? void 0 : parentMessage.subMessages.push(subMessage.xref);
10563
- }
10564
- OpList.remove(op);
10568
+ switch (op.kind) {
10569
+ case OpKind.IcuStart:
10570
+ if (!op.context) {
10571
+ throw Error("ICU op should have its context set.");
10572
+ }
10573
+ if (!i18nBlockContexts.has(op.context)) {
10574
+ const i18nContext = i18nContexts.get(op.context);
10575
+ const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
10576
+ unit.create.push(subMessage);
10577
+ const parentMessage = i18nBlockMessages.get(i18nContext.i18nBlock);
10578
+ parentMessage == null ? void 0 : parentMessage.subMessages.push(subMessage.xref);
10579
+ }
10580
+ OpList.remove(op);
10581
+ break;
10582
+ case OpKind.IcuEnd:
10583
+ OpList.remove(op);
10584
+ break;
10565
10585
  }
10566
10586
  }
10567
10587
  }
@@ -10577,7 +10597,7 @@ function createI18nMessage(job, context, messagePlaceholder) {
10577
10597
  }
10578
10598
  function formatParams(params) {
10579
10599
  const result = /* @__PURE__ */ new Map();
10580
- for (const [placeholder, placeholderValues] of [...params].sort()) {
10600
+ for (const [placeholder, placeholderValues] of params) {
10581
10601
  const serializedValues = formatParamValues(placeholderValues);
10582
10602
  if (serializedValues !== null) {
10583
10603
  result.set(placeholder, literal(formatParamValues(placeholderValues)));
@@ -10593,6 +10613,9 @@ function formatParamValues(values) {
10593
10613
  return serializedValues.length === 1 ? serializedValues[0] : `${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`;
10594
10614
  }
10595
10615
  function formatValue(value) {
10616
+ if (value.flags === I18nParamValueFlags.None) {
10617
+ return `${value.value}`;
10618
+ }
10596
10619
  let tagMarker = "";
10597
10620
  let closeMarker = "";
10598
10621
  if (value.flags & I18nParamValueFlags.ElementTag) {
@@ -10854,6 +10877,9 @@ var IcuSerializerVisitor = class {
10854
10877
  visitPlaceholder(ph) {
10855
10878
  return this.formatPh(ph.name);
10856
10879
  }
10880
+ visitBlockPlaceholder(ph) {
10881
+ return `${this.formatPh(ph.startName)}${ph.children.map((child) => child.visit(this)).join("")}${this.formatPh(ph.closeName)}`;
10882
+ }
10857
10883
  visitIcuPlaceholder(ph, context) {
10858
10884
  return this.formatPh(ph.name);
10859
10885
  }
@@ -12197,12 +12223,12 @@ var Comment2 = class {
12197
12223
  return visitor.visitComment(this, context);
12198
12224
  }
12199
12225
  };
12200
- var Block = class {
12201
- constructor(name, parameters, children, sourceSpan, nameSpan, startSourceSpan, endSourceSpan = null) {
12226
+ var Block = class extends NodeWithI18n {
12227
+ constructor(name, parameters, children, sourceSpan, nameSpan, startSourceSpan, endSourceSpan = null, i18n2) {
12228
+ super(sourceSpan, i18n2);
12202
12229
  this.name = name;
12203
12230
  this.parameters = parameters;
12204
12231
  this.children = children;
12205
- this.sourceSpan = sourceSpan;
12206
12232
  this.nameSpan = nameSpan;
12207
12233
  this.startSourceSpan = startSourceSpan;
12208
12234
  this.endSourceSpan = endSourceSpan;
@@ -12780,6 +12806,24 @@ var PlaceholderRegistry = class {
12780
12806
  getUniquePlaceholder(name) {
12781
12807
  return this._generateUniqueName(name.toUpperCase());
12782
12808
  }
12809
+ getStartBlockPlaceholderName(name, parameters) {
12810
+ const signature = this._hashBlock(name, parameters);
12811
+ if (this._signatureToName[signature]) {
12812
+ return this._signatureToName[signature];
12813
+ }
12814
+ const placeholder = this._generateUniqueName(`START_BLOCK_${this._toSnakeCase(name)}`);
12815
+ this._signatureToName[signature] = placeholder;
12816
+ return placeholder;
12817
+ }
12818
+ getCloseBlockPlaceholderName(name) {
12819
+ const signature = this._hashClosingBlock(name);
12820
+ if (this._signatureToName[signature]) {
12821
+ return this._signatureToName[signature];
12822
+ }
12823
+ const placeholder = this._generateUniqueName(`CLOSE_BLOCK_${this._toSnakeCase(name)}`);
12824
+ this._signatureToName[signature] = placeholder;
12825
+ return placeholder;
12826
+ }
12783
12827
  _hashTag(tag, attrs, isVoid) {
12784
12828
  const start = `<${tag}`;
12785
12829
  const strAttrs = Object.keys(attrs).sort().map((name) => ` ${name}=${attrs[name]}`).join("");
@@ -12789,6 +12833,16 @@ var PlaceholderRegistry = class {
12789
12833
  _hashClosingTag(tag) {
12790
12834
  return this._hashTag(`/${tag}`, {}, false);
12791
12835
  }
12836
+ _hashBlock(name, parameters) {
12837
+ const params = parameters.length === 0 ? "" : ` (${parameters.sort().join("; ")})`;
12838
+ return `@${name}${params} {}`;
12839
+ }
12840
+ _hashClosingBlock(name) {
12841
+ return this._hashBlock(`close_${name}`, []);
12842
+ }
12843
+ _toSnakeCase(name) {
12844
+ return name.toUpperCase().replace(/[^A-Z0-9]/g, "_");
12845
+ }
12792
12846
  _generateUniqueName(base) {
12793
12847
  const seen = this._placeHolderNameCounts.hasOwnProperty(base);
12794
12848
  if (!seen) {
@@ -12803,17 +12857,18 @@ var PlaceholderRegistry = class {
12803
12857
 
12804
12858
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/i18n_parser.mjs
12805
12859
  var _expParser = new Parser(new Lexer());
12806
- function createI18nMessageFactory(interpolationConfig) {
12807
- const visitor = new _I18nVisitor(_expParser, interpolationConfig);
12860
+ function createI18nMessageFactory(interpolationConfig, containerBlocks) {
12861
+ const visitor = new _I18nVisitor(_expParser, interpolationConfig, containerBlocks);
12808
12862
  return (nodes, meaning, description, customId, visitNodeFn) => visitor.toI18nMessage(nodes, meaning, description, customId, visitNodeFn);
12809
12863
  }
12810
12864
  function noopVisitNodeFn(_html, i18n2) {
12811
12865
  return i18n2;
12812
12866
  }
12813
12867
  var _I18nVisitor = class {
12814
- constructor(_expressionParser, _interpolationConfig) {
12868
+ constructor(_expressionParser, _interpolationConfig, _containerBlocks) {
12815
12869
  this._expressionParser = _expressionParser;
12816
12870
  this._interpolationConfig = _interpolationConfig;
12871
+ this._containerBlocks = _containerBlocks;
12817
12872
  }
12818
12873
  toI18nMessage(nodes, meaning = "", description = "", customId = "", visitNodeFn) {
12819
12874
  const context = {
@@ -12888,11 +12943,27 @@ var _I18nVisitor = class {
12888
12943
  throw new Error("Unreachable code");
12889
12944
  }
12890
12945
  visitBlock(block, context) {
12946
+ var _a2;
12891
12947
  const children = visitAll2(this, block.children, context);
12892
- const node = new Container(children, block.sourceSpan);
12948
+ if (this._containerBlocks.has(block.name)) {
12949
+ return new Container(children, block.sourceSpan);
12950
+ }
12951
+ const parameters = block.parameters.map((param) => param.expression);
12952
+ const startPhName = context.placeholderRegistry.getStartBlockPlaceholderName(block.name, parameters);
12953
+ const closePhName = context.placeholderRegistry.getCloseBlockPlaceholderName(block.name);
12954
+ context.placeholderToContent[startPhName] = {
12955
+ text: block.startSourceSpan.toString(),
12956
+ sourceSpan: block.startSourceSpan
12957
+ };
12958
+ context.placeholderToContent[closePhName] = {
12959
+ text: block.endSourceSpan ? block.endSourceSpan.toString() : "}",
12960
+ sourceSpan: (_a2 = block.endSourceSpan) != null ? _a2 : block.sourceSpan
12961
+ };
12962
+ const node = new BlockPlaceholder(block.name, parameters, startPhName, closePhName, children, block.sourceSpan, block.startSourceSpan, block.endSourceSpan);
12893
12963
  return context.visitNodeFn(block, node);
12894
12964
  }
12895
12965
  visitBlockParameter(_parameter, _context) {
12966
+ throw new Error("Unreachable code");
12896
12967
  }
12897
12968
  _visitTextWithInterpolation(tokens, sourceSpan, context, previousI18n) {
12898
12969
  const nodes = [];
@@ -16432,16 +16503,17 @@ var setI18nRefs = (htmlNode, i18nNode) => {
16432
16503
  return i18nNode;
16433
16504
  };
16434
16505
  var I18nMetaVisitor = class {
16435
- constructor(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG, keepI18nAttrs = false, enableI18nLegacyMessageIdFormat = false) {
16506
+ constructor(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG, keepI18nAttrs = false, enableI18nLegacyMessageIdFormat = false, containerBlocks = DEFAULT_CONTAINER_BLOCKS) {
16436
16507
  this.interpolationConfig = interpolationConfig;
16437
16508
  this.keepI18nAttrs = keepI18nAttrs;
16438
16509
  this.enableI18nLegacyMessageIdFormat = enableI18nLegacyMessageIdFormat;
16510
+ this.containerBlocks = containerBlocks;
16439
16511
  this.hasI18nMeta = false;
16440
16512
  this._errors = [];
16441
16513
  }
16442
16514
  _generateI18nMessage(nodes, meta = "", visitNodeFn) {
16443
16515
  const { meaning, description, customId } = this._parseMetadata(meta);
16444
- const createI18nMessage2 = createI18nMessageFactory(this.interpolationConfig);
16516
+ const createI18nMessage2 = createI18nMessageFactory(this.interpolationConfig, this.containerBlocks);
16445
16517
  const message = createI18nMessage2(nodes, meaning, description, customId, visitNodeFn);
16446
16518
  this._setMessageId(message, meta);
16447
16519
  this._setLegacyIds(message, meta);
@@ -16616,6 +16688,9 @@ var GetMsgSerializerVisitor = class {
16616
16688
  visitPlaceholder(ph) {
16617
16689
  return this.formatPh(ph.name);
16618
16690
  }
16691
+ visitBlockPlaceholder(ph) {
16692
+ return `${this.formatPh(ph.startName)}${ph.children.map((child) => child.visit(this)).join("")}${this.formatPh(ph.closeName)}`;
16693
+ }
16619
16694
  visitIcuPlaceholder(ph, context) {
16620
16695
  return this.formatPh(ph.name);
16621
16696
  }
@@ -16664,6 +16739,12 @@ var LocalizeSerializerVisitor = class {
16664
16739
  visitPlaceholder(ph) {
16665
16740
  this.pieces.push(this.createPlaceholderPiece(ph.name, ph.sourceSpan));
16666
16741
  }
16742
+ visitBlockPlaceholder(ph) {
16743
+ var _a2, _b2;
16744
+ this.pieces.push(this.createPlaceholderPiece(ph.startName, (_a2 = ph.startSourceSpan) != null ? _a2 : ph.sourceSpan));
16745
+ ph.children.forEach((child) => child.visit(this));
16746
+ this.pieces.push(this.createPlaceholderPiece(ph.closeName, (_b2 = ph.endSourceSpan) != null ? _b2 : ph.sourceSpan));
16747
+ }
16667
16748
  visitIcuPlaceholder(ph) {
16668
16749
  this.pieces.push(this.createPlaceholderPiece(ph.name, ph.sourceSpan, this.placeholderToMessage[ph.name]));
16669
16750
  }
@@ -16745,11 +16826,13 @@ function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
16745
16826
  statements.push(...subMessageStatements);
16746
16827
  messageOp.params.set(subMessage.messagePlaceholder, subMessageVar);
16747
16828
  }
16829
+ messageOp.params = new Map([...messageOp.params.entries()].sort());
16748
16830
  assertAllParamsResolved(messageOp);
16749
16831
  const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
16750
16832
  const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
16751
16833
  let transformFn = void 0;
16752
16834
  if (messageOp.needsPostprocessing) {
16835
+ messageOp.postprocessingParams = new Map([...messageOp.postprocessingParams.entries()].sort());
16753
16836
  const extraTransformFnParams = [];
16754
16837
  if (messageOp.postprocessingParams.size > 0) {
16755
16838
  extraTransformFnParams.push(literalMap([...messageOp.postprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
@@ -16787,12 +16870,14 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
16787
16870
  return variable(name);
16788
16871
  }
16789
16872
  function assertAllParamsResolved(op) {
16790
- for (const placeholder in op.message.placeholders) {
16873
+ for (let placeholder in op.message.placeholders) {
16874
+ placeholder = placeholder.trimEnd();
16791
16875
  if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
16792
16876
  throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
16793
16877
  }
16794
16878
  }
16795
- for (const placeholder in op.message.placeholderToMessage) {
16879
+ for (let placeholder in op.message.placeholderToMessage) {
16880
+ placeholder = placeholder.trimEnd();
16796
16881
  if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
16797
16882
  throw Error(`Failed to resolve i18n message placeholder: ${placeholder}`);
16798
16883
  }
@@ -16804,7 +16889,9 @@ function extractI18nText(job) {
16804
16889
  var _a2;
16805
16890
  for (const unit of job.units) {
16806
16891
  let currentI18n = null;
16892
+ let currentIcu = null;
16807
16893
  const textNodeI18nBlocks = /* @__PURE__ */ new Map();
16894
+ const textNodeIcus = /* @__PURE__ */ new Map();
16808
16895
  for (const op of unit.create) {
16809
16896
  switch (op.kind) {
16810
16897
  case OpKind.I18nStart:
@@ -16816,9 +16903,19 @@ function extractI18nText(job) {
16816
16903
  case OpKind.I18nEnd:
16817
16904
  currentI18n = null;
16818
16905
  break;
16906
+ case OpKind.IcuStart:
16907
+ if (op.context === null) {
16908
+ throw Error("Icu op should have its context set.");
16909
+ }
16910
+ currentIcu = op;
16911
+ break;
16912
+ case OpKind.IcuEnd:
16913
+ currentIcu = null;
16914
+ break;
16819
16915
  case OpKind.Text:
16820
16916
  if (currentI18n !== null) {
16821
16917
  textNodeI18nBlocks.set(op.xref, currentI18n);
16918
+ textNodeIcus.set(op.xref, currentIcu);
16822
16919
  OpList.remove(op);
16823
16920
  }
16824
16921
  break;
@@ -16831,11 +16928,13 @@ function extractI18nText(job) {
16831
16928
  continue;
16832
16929
  }
16833
16930
  const i18nOp = textNodeI18nBlocks.get(op.target);
16931
+ const icuOp = textNodeIcus.get(op.target);
16932
+ const contextId = icuOp ? icuOp.context : i18nOp.context;
16933
+ const resolutionTime = icuOp ? I18nParamResolutionTime.Postproccessing : I18nParamResolutionTime.Creation;
16834
16934
  const ops = [];
16835
16935
  for (let i = 0; i < op.interpolation.expressions.length; i++) {
16836
16936
  const expr = op.interpolation.expressions[i];
16837
- const placeholder = op.i18nPlaceholders[i];
16838
- ops.push(createI18nExpressionOp(i18nOp.context, i18nOp.xref, i18nOp.handle, expr, placeholder.name, I18nParamResolutionTime.Creation, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
16937
+ ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.handle, expr, op.i18nPlaceholders[i], resolutionTime, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
16839
16938
  }
16840
16939
  OpList.replaceWithMany(op, ops);
16841
16940
  break;
@@ -17727,8 +17826,8 @@ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByF
17727
17826
  }
17728
17827
  return call(Identifiers.repeaterCreate, args, sourceSpan);
17729
17828
  }
17730
- function repeater(metadataSlot, collection, sourceSpan) {
17731
- return call(Identifiers.repeater, [literal(metadataSlot), collection], sourceSpan);
17829
+ function repeater(collection, sourceSpan) {
17830
+ return call(Identifiers.repeater, [collection], sourceSpan);
17732
17831
  }
17733
17832
  function deferWhen(prefetch, expr, sourceSpan) {
17734
17833
  return call(prefetch ? Identifiers.deferPrefetchWhen : Identifiers.deferWhen, [expr], sourceSpan);
@@ -18286,7 +18385,7 @@ function reifyUpdateOperations(_unit, ops) {
18286
18385
  OpList.replace(op, conditional(op.targetSlot.slot, op.processed, op.contextValue, op.sourceSpan));
18287
18386
  break;
18288
18387
  case OpKind.Repeater:
18289
- OpList.replace(op, repeater(op.targetSlot.slot, op.collection, op.sourceSpan));
18388
+ OpList.replace(op, repeater(op.collection, op.sourceSpan));
18290
18389
  break;
18291
18390
  case OpKind.DeferWhen:
18292
18391
  OpList.replace(op, deferWhen(op.prefetch, op.expr, op.sourceSpan));
@@ -18575,7 +18674,7 @@ function getSubTemplateIndexForTemplateTag(job, i18nOp, op) {
18575
18674
  }
18576
18675
  return i18nOp.subTemplateIndex;
18577
18676
  }
18578
- function addParam(params, placeholder, value, subTemplateIndex, flags = I18nParamValueFlags.None) {
18677
+ function addParam(params, placeholder, value, subTemplateIndex, flags) {
18579
18678
  var _a2;
18580
18679
  const values = (_a2 = params.get(placeholder)) != null ? _a2 : [];
18581
18680
  values.push({ value, subTemplateIndex, flags });
@@ -18602,19 +18701,83 @@ function resolveI18nExpressionPlaceholders(job) {
18602
18701
  for (const unit of job.units) {
18603
18702
  for (const op of unit.update) {
18604
18703
  if (op.kind === OpKind.I18nExpression) {
18605
- const index = expressionIndices.get(op.context) || 0;
18606
18704
  const i18nContext = i18nContexts.get(op.context);
18705
+ const index = expressionIndices.get(i18nContext.i18nBlock) || 0;
18607
18706
  const subTemplateIndex = subTemplateIndicies.get(i18nContext.i18nBlock);
18608
18707
  const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
18609
18708
  const values = params.get(op.i18nPlaceholder) || [];
18610
- values.push({ value: index, subTemplateIndex, flags: I18nParamValueFlags.None });
18709
+ values.push({
18710
+ value: index,
18711
+ subTemplateIndex,
18712
+ flags: I18nParamValueFlags.ExpressionIndex
18713
+ });
18611
18714
  params.set(op.i18nPlaceholder, values);
18612
- expressionIndices.set(op.context, index + 1);
18715
+ expressionIndices.set(i18nContext.i18nBlock, index + 1);
18613
18716
  }
18614
18717
  }
18615
18718
  }
18616
18719
  }
18617
18720
 
18721
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_icu_placeholders.mjs
18722
+ function resolveI18nIcuPlaceholders(job) {
18723
+ const contextOps = /* @__PURE__ */ new Map();
18724
+ for (const unit of job.units) {
18725
+ for (const op of unit.create) {
18726
+ switch (op.kind) {
18727
+ case OpKind.I18nContext:
18728
+ contextOps.set(op.xref, op);
18729
+ break;
18730
+ }
18731
+ }
18732
+ }
18733
+ for (const unit of job.units) {
18734
+ for (const op of unit.create) {
18735
+ switch (op.kind) {
18736
+ case OpKind.IcuStart:
18737
+ if (op.context === null) {
18738
+ throw Error("Icu should have its i18n context set.");
18739
+ }
18740
+ const i18nContext = contextOps.get(op.context);
18741
+ for (const node of op.message.nodes) {
18742
+ node.visit(new ResolveIcuPlaceholdersVisitor(i18nContext.postprocessingParams));
18743
+ }
18744
+ break;
18745
+ }
18746
+ }
18747
+ }
18748
+ }
18749
+ var ResolveIcuPlaceholdersVisitor = class extends RecurseVisitor {
18750
+ constructor(params) {
18751
+ super();
18752
+ this.params = params;
18753
+ }
18754
+ visitContainerPlaceholder(placeholder) {
18755
+ var _a2, _b2;
18756
+ if (placeholder.startName && placeholder.startSourceSpan && !this.params.has(placeholder.startName)) {
18757
+ this.params.set(placeholder.startName, [{
18758
+ value: (_a2 = placeholder.startSourceSpan) == null ? void 0 : _a2.toString(),
18759
+ subTemplateIndex: null,
18760
+ flags: I18nParamValueFlags.None
18761
+ }]);
18762
+ }
18763
+ if (placeholder.closeName && placeholder.endSourceSpan && !this.params.has(placeholder.closeName)) {
18764
+ this.params.set(placeholder.closeName, [{
18765
+ value: (_b2 = placeholder.endSourceSpan) == null ? void 0 : _b2.toString(),
18766
+ subTemplateIndex: null,
18767
+ flags: I18nParamValueFlags.None
18768
+ }]);
18769
+ }
18770
+ }
18771
+ visitTagPlaceholder(placeholder) {
18772
+ super.visitTagPlaceholder(placeholder);
18773
+ this.visitContainerPlaceholder(placeholder);
18774
+ }
18775
+ visitBlockPlaceholder(placeholder) {
18776
+ super.visitBlockPlaceholder(placeholder);
18777
+ this.visitContainerPlaceholder(placeholder);
18778
+ }
18779
+ };
18780
+
18618
18781
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
18619
18782
  function resolveNames(job) {
18620
18783
  for (const unit of job.units) {
@@ -19331,6 +19494,7 @@ function allowConservativeInlining(decl, target) {
19331
19494
  function wrapI18nIcus(job) {
19332
19495
  for (const unit of job.units) {
19333
19496
  let currentI18nOp = null;
19497
+ let addedI18nId = null;
19334
19498
  for (const op of unit.create) {
19335
19499
  switch (op.kind) {
19336
19500
  case OpKind.I18nStart:
@@ -19339,11 +19503,16 @@ function wrapI18nIcus(job) {
19339
19503
  case OpKind.I18nEnd:
19340
19504
  currentI18nOp = null;
19341
19505
  break;
19342
- case OpKind.Icu:
19506
+ case OpKind.IcuStart:
19343
19507
  if (currentI18nOp === null) {
19344
- const id = job.allocateXrefId();
19345
- OpList.insertBefore(createI18nStartOp(id, op.message), op);
19346
- OpList.insertAfter(createI18nEndOp(id), op);
19508
+ addedI18nId = job.allocateXrefId();
19509
+ OpList.insertBefore(createI18nStartOp(addedI18nId, op.message), op);
19510
+ }
19511
+ break;
19512
+ case OpKind.IcuEnd:
19513
+ if (addedI18nId !== null) {
19514
+ OpList.insertAfter(createI18nEndOp(addedI18nId), op);
19515
+ addedI18nId = null;
19347
19516
  }
19348
19517
  break;
19349
19518
  }
@@ -19370,7 +19539,6 @@ var phases = [
19370
19539
  { kind: CompilationJobKind.Tmpl, fn: createPipes },
19371
19540
  { kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
19372
19541
  { kind: CompilationJobKind.Tmpl, fn: extractI18nText },
19373
- { kind: CompilationJobKind.Tmpl, fn: createI18nIcuExpressions },
19374
19542
  { kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
19375
19543
  { kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
19376
19544
  { kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
@@ -19394,6 +19562,7 @@ var phases = [
19394
19562
  { kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
19395
19563
  { kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
19396
19564
  { kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
19565
+ { kind: CompilationJobKind.Tmpl, fn: resolveI18nIcuPlaceholders },
19397
19566
  { kind: CompilationJobKind.Tmpl, fn: mergeI18nContexts },
19398
19567
  { kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
19399
19568
  { kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
@@ -19658,7 +19827,7 @@ function ingestContent(unit, content) {
19658
19827
  function ingestText(unit, text2) {
19659
19828
  unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, text2.sourceSpan));
19660
19829
  }
19661
- function ingestBoundText(unit, text2) {
19830
+ function ingestBoundText(unit, text2, i18nPlaceholders) {
19662
19831
  var _a2;
19663
19832
  let value = text2.value;
19664
19833
  if (value instanceof ASTWithSource) {
@@ -19670,7 +19839,12 @@ function ingestBoundText(unit, text2) {
19670
19839
  if (text2.i18n !== void 0 && !(text2.i18n instanceof Container)) {
19671
19840
  throw Error(`Unhandled i18n metadata type for text interpolation: ${(_a2 = text2.i18n) == null ? void 0 : _a2.constructor.name}`);
19672
19841
  }
19673
- const i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder) : [];
19842
+ if (i18nPlaceholders === void 0) {
19843
+ i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
19844
+ }
19845
+ if (i18nPlaceholders.length > 0 && i18nPlaceholders.length !== value.expressions.length) {
19846
+ throw Error(`Unexpected number of i18n placeholders (${value.expressions.length}) for BoundText with ${value.expressions.length} expressions`);
19847
+ }
19674
19848
  const textXref = unit.job.allocateXrefId();
19675
19849
  unit.create.push(createTextOp(textXref, "", text2.sourceSpan));
19676
19850
  const baseSourceSpan = unit.job.compatibility ? null : text2.sourceSpan;
@@ -19816,13 +19990,26 @@ function ingestDeferBlock(unit, deferBlock) {
19816
19990
  unit.update.push(deferWhenOps);
19817
19991
  }
19818
19992
  function ingestIcu(unit, icu) {
19819
- var _a2;
19993
+ var _a2, _b2;
19820
19994
  if (icu.i18n instanceof Message && isSingleI18nIcu(icu.i18n)) {
19821
19995
  const xref = unit.job.allocateXrefId();
19822
- unit.create.push(createIcuOp(xref, icu.i18n, icu.i18n.nodes[0], icuFromI18nMessage(icu.i18n).name, null));
19823
- unit.update.push(createIcuUpdateOp(xref, null));
19996
+ const icuNode = icu.i18n.nodes[0];
19997
+ unit.create.push(createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null));
19998
+ const expressionPlaceholder = (_a2 = icuNode.expressionPlaceholder) == null ? void 0 : _a2.trimEnd();
19999
+ if (expressionPlaceholder === void 0 || icu.vars[expressionPlaceholder] === void 0) {
20000
+ throw Error("ICU should have a text binding");
20001
+ }
20002
+ ingestBoundText(unit, icu.vars[expressionPlaceholder], [expressionPlaceholder]);
20003
+ for (const [placeholder, text2] of Object.entries(icu.placeholders)) {
20004
+ if (text2 instanceof BoundText) {
20005
+ ingestBoundText(unit, text2, [placeholder]);
20006
+ } else {
20007
+ ingestText(unit, text2);
20008
+ }
20009
+ }
20010
+ unit.create.push(createIcuEndOp(xref));
19824
20011
  } else {
19825
- throw Error(`Unhandled i18n metadata type for ICU: ${(_a2 = icu.i18n) == null ? void 0 : _a2.constructor.name}`);
20012
+ throw Error(`Unhandled i18n metadata type for ICU: ${(_b2 = icu.i18n) == null ? void 0 : _b2.constructor.name}`);
19826
20013
  }
19827
20014
  }
19828
20015
  function ingestForBlock(unit, forBlock) {
@@ -20908,18 +21095,18 @@ function createIfBlock(ast, connectedBlocks, visitor, bindingParser) {
20908
21095
  const branches = [];
20909
21096
  const mainBlockParams = parseConditionalBlockParameters(ast, errors, bindingParser);
20910
21097
  if (mainBlockParams !== null) {
20911
- branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll2(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan));
21098
+ branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll2(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan, ast.i18n));
20912
21099
  }
20913
21100
  for (const block of connectedBlocks) {
20914
21101
  if (ELSE_IF_PATTERN.test(block.name)) {
20915
21102
  const params = parseConditionalBlockParameters(block, errors, bindingParser);
20916
21103
  if (params !== null) {
20917
21104
  const children = visitAll2(visitor, block.children, block.children);
20918
- branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan));
21105
+ branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan, block.i18n));
20919
21106
  }
20920
21107
  } else if (block.name === "else") {
20921
21108
  const children = visitAll2(visitor, block.children, block.children);
20922
- branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan));
21109
+ branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan, block.i18n));
20923
21110
  }
20924
21111
  }
20925
21112
  const ifBlockStartSourceSpan = branches.length > 0 ? branches[0].startSourceSpan : ast.startSourceSpan;
@@ -20947,7 +21134,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
20947
21134
  } else if (block.parameters.length > 0) {
20948
21135
  errors.push(new ParseError(block.sourceSpan, "@empty block cannot have parameters"));
20949
21136
  } else {
20950
- empty = new ForLoopBlockEmpty(visitAll2(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan);
21137
+ empty = new ForLoopBlockEmpty(visitAll2(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan, block.i18n);
20951
21138
  }
20952
21139
  } else {
20953
21140
  errors.push(new ParseError(block.sourceSpan, `Unrecognized @for loop block "${block.name}"`));
@@ -20959,7 +21146,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
20959
21146
  } else {
20960
21147
  const endSpan = (_a2 = empty == null ? void 0 : empty.endSourceSpan) != null ? _a2 : ast.endSourceSpan;
20961
21148
  const sourceSpan = new ParseSourceSpan(ast.sourceSpan.start, (_b2 = endSpan == null ? void 0 : endSpan.end) != null ? _b2 : ast.sourceSpan.end);
20962
- node = new ForLoopBlock(params.itemName, params.expression, params.trackBy.expression, params.trackBy.keywordSpan, params.context, visitAll2(visitor, ast.children, ast.children), empty, sourceSpan, ast.sourceSpan, ast.startSourceSpan, endSpan, ast.nameSpan);
21149
+ node = new ForLoopBlock(params.itemName, params.expression, params.trackBy.expression, params.trackBy.keywordSpan, params.context, visitAll2(visitor, ast.children, ast.children), empty, sourceSpan, ast.sourceSpan, ast.startSourceSpan, endSpan, ast.nameSpan, ast.i18n);
20963
21150
  }
20964
21151
  }
20965
21152
  return { node, errors };
@@ -20979,7 +21166,7 @@ function createSwitchBlock(ast, visitor, bindingParser) {
20979
21166
  continue;
20980
21167
  }
20981
21168
  const expression = node.name === "case" ? parseBlockParameterToBinding(node.parameters[0], bindingParser) : null;
20982
- const ast2 = new SwitchBlockCase(expression, visitAll2(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan);
21169
+ const ast2 = new SwitchBlockCase(expression, visitAll2(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan, node.i18n);
20983
21170
  if (expression === null) {
20984
21171
  defaultCase = ast2;
20985
21172
  } else {
@@ -21467,7 +21654,7 @@ function createDeferredBlock(ast, connectedBlocks, visitor, bindingParser) {
21467
21654
  endOfLastSourceSpan = lastConnectedBlock.sourceSpan.end;
21468
21655
  }
21469
21656
  const sourceSpanWithConnectedBlocks = new ParseSourceSpan(ast.sourceSpan.start, endOfLastSourceSpan);
21470
- const node = new DeferredBlock(visitAll2(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error2, ast.nameSpan, sourceSpanWithConnectedBlocks, ast.sourceSpan, ast.startSourceSpan, lastEndSourceSpan);
21657
+ const node = new DeferredBlock(visitAll2(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error2, ast.nameSpan, sourceSpanWithConnectedBlocks, ast.sourceSpan, ast.startSourceSpan, lastEndSourceSpan, ast.i18n);
21471
21658
  return { node, errors };
21472
21659
  }
21473
21660
  function parseConnectedBlocks(connectedBlocks, errors, visitor) {
@@ -21525,7 +21712,7 @@ function parsePlaceholderBlock(ast, visitor) {
21525
21712
  throw new Error(`Unrecognized parameter in @placeholder block: "${param.expression}"`);
21526
21713
  }
21527
21714
  }
21528
- return new DeferredBlockPlaceholder(visitAll2(visitor, ast.children, ast.children), minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
21715
+ return new DeferredBlockPlaceholder(visitAll2(visitor, ast.children, ast.children), minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.i18n);
21529
21716
  }
21530
21717
  function parseLoadingBlock(ast, visitor) {
21531
21718
  let afterTime = null;
@@ -21553,13 +21740,13 @@ function parseLoadingBlock(ast, visitor) {
21553
21740
  throw new Error(`Unrecognized parameter in @loading block: "${param.expression}"`);
21554
21741
  }
21555
21742
  }
21556
- return new DeferredBlockLoading(visitAll2(visitor, ast.children, ast.children), afterTime, minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
21743
+ return new DeferredBlockLoading(visitAll2(visitor, ast.children, ast.children), afterTime, minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.i18n);
21557
21744
  }
21558
21745
  function parseErrorBlock(ast, visitor) {
21559
21746
  if (ast.parameters.length > 0) {
21560
21747
  throw new Error(`@error block cannot have parameters`);
21561
21748
  }
21562
- return new DeferredBlockError(visitAll2(visitor, ast.children, ast.children), ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
21749
+ return new DeferredBlockError(visitAll2(visitor, ast.children, ast.children), ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.i18n);
21563
21750
  }
21564
21751
  function parsePrimaryTriggers(params, bindingParser, errors, placeholder) {
21565
21752
  const triggers = {};
@@ -22043,6 +22230,11 @@ var I18nContext = class {
22043
22230
  const content = { type, index, ctx: this.id, isVoid: node.isVoid, closed };
22044
22231
  updatePlaceholderMap(this.placeholders, ph, content);
22045
22232
  }
22233
+ appendBlockPart(node, index, closed) {
22234
+ const ph = closed ? node.closeName : node.startName;
22235
+ const content = { type: TagType.TEMPLATE, index, ctx: this.id, closed };
22236
+ updatePlaceholderMap(this.placeholders, ph, content);
22237
+ }
22046
22238
  get icus() {
22047
22239
  return this._registry.icus;
22048
22240
  }
@@ -22072,6 +22264,11 @@ var I18nContext = class {
22072
22264
  this.appendTag(TagType.TEMPLATE, node, index, true);
22073
22265
  this._unresolvedCtxCount++;
22074
22266
  }
22267
+ appendBlock(node, index) {
22268
+ this.appendBlockPart(node, index, false);
22269
+ this.appendBlockPart(node, index, true);
22270
+ this._unresolvedCtxCount++;
22271
+ }
22075
22272
  appendElement(node, index, closed) {
22076
22273
  this.appendTag(TagType.ELEMENT, node, index, closed);
22077
22274
  }
@@ -22267,12 +22464,18 @@ var TemplateDefinitionBuilder = class {
22267
22464
  this.creationInstruction(null, Identifiers.pipe, [literal(slot), literal(name)]);
22268
22465
  });
22269
22466
  }
22270
- buildTemplateFunction(nodes, variables, ngContentSelectorsOffset = 0, i18n2) {
22467
+ buildTemplateFunction(nodes, variables, ngContentSelectorsOffset = 0, i18n2, variableAliases) {
22271
22468
  this._ngContentSelectorsOffset = ngContentSelectorsOffset;
22272
22469
  if (this._namespace !== Identifiers.namespaceHTML) {
22273
22470
  this.creationInstruction(null, this._namespace);
22274
22471
  }
22275
- variables.forEach((v) => this.registerContextVariables(v));
22472
+ variables.forEach((v) => {
22473
+ const alias = variableAliases == null ? void 0 : variableAliases[v.name];
22474
+ this.registerContextVariables(v.name, v.value);
22475
+ if (alias) {
22476
+ this.registerContextVariables(alias, v.value);
22477
+ }
22478
+ });
22276
22479
  const initI18nContext = this.i18nContext || isI18nRootNode(i18n2) && !isSingleI18nIcu(i18n2) && !(isSingleElementTemplate(nodes) && nodes[0].i18n === i18n2);
22277
22480
  const selfClosingI18nInstruction = hasTextChildrenOnly(nodes);
22278
22481
  if (initI18nContext) {
@@ -22327,12 +22530,12 @@ var TemplateDefinitionBuilder = class {
22327
22530
  this._constants.prepareStatements.push(...statements);
22328
22531
  return _ref;
22329
22532
  }
22330
- registerContextVariables(variable2) {
22533
+ registerContextVariables(name, value) {
22331
22534
  const scopedName = this._bindingScope.freshReferenceName();
22332
22535
  const retrievalLevel = this.level;
22333
- const isDirect = variable2.value === DIRECT_CONTEXT_REFERENCE;
22334
- const lhs = variable(variable2.name + scopedName);
22335
- this._bindingScope.set(retrievalLevel, variable2.name, (scope) => {
22536
+ const isDirect = value === DIRECT_CONTEXT_REFERENCE;
22537
+ const lhs = variable(name + scopedName);
22538
+ this._bindingScope.set(retrievalLevel, name, (scope) => {
22336
22539
  return isDirect && scope.bindingLevel === retrievalLevel && !scope.isListenerScope() ? variable(CONTEXT_NAME) : lhs;
22337
22540
  }, 1, (scope, relativeLevel) => {
22338
22541
  let rhs;
@@ -22350,7 +22553,7 @@ var TemplateDefinitionBuilder = class {
22350
22553
  rhs = sharedCtxVar ? sharedCtxVar : generateNextContextExpr(relativeLevel);
22351
22554
  }
22352
22555
  return [
22353
- lhs.set(isDirect ? rhs : rhs.prop(variable2.value || IMPLICIT_REFERENCE)).toConstDecl()
22556
+ lhs.set(isDirect ? rhs : rhs.prop(value || IMPLICIT_REFERENCE)).toConstDecl()
22354
22557
  ];
22355
22558
  });
22356
22559
  }
@@ -22689,16 +22892,20 @@ var TemplateDefinitionBuilder = class {
22689
22892
  this.creationInstruction(span, isNgContainer2 ? Identifiers.elementContainerEnd : Identifiers.elementEnd);
22690
22893
  }
22691
22894
  }
22692
- prepareEmbeddedTemplateFn(children, contextNameSuffix, variables = [], i18n2) {
22895
+ prepareEmbeddedTemplateFn(children, contextNameSuffix, variables = [], i18nMeta, variableAliases) {
22693
22896
  const index = this.allocateDataSlot();
22694
- if (this.i18n && i18n2) {
22695
- this.i18n.appendTemplate(i18n2, index);
22897
+ if (this.i18n && i18nMeta) {
22898
+ if (i18nMeta instanceof BlockPlaceholder) {
22899
+ this.i18n.appendBlock(i18nMeta, index);
22900
+ } else {
22901
+ this.i18n.appendTemplate(i18nMeta, index);
22902
+ }
22696
22903
  }
22697
22904
  const contextName = `${this.contextName}${contextNameSuffix}_${index}`;
22698
22905
  const name = `${contextName}_Template`;
22699
22906
  const visitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, index, name, this._namespace, this.fileBasedI18nSuffix, this.i18nUseExternalIds, this.deferBlocks, this.elementLocations, this._constants);
22700
22907
  this._nestedTemplateFns.push(() => {
22701
- const templateFunctionExpr = visitor.buildTemplateFunction(children, variables, this._ngContentReservedSlots.length + this._ngContentSelectorsOffset, i18n2);
22908
+ const templateFunctionExpr = visitor.buildTemplateFunction(children, variables, this._ngContentReservedSlots.length + this._ngContentSelectorsOffset, i18nMeta, variableAliases);
22702
22909
  this.constantPool.statements.push(templateFunctionExpr.toDeclStmt(name));
22703
22910
  if (visitor._ngContentReservedSlots.length) {
22704
22911
  this._ngContentReservedSlots.push(...visitor._ngContentReservedSlots);
@@ -22781,7 +22988,7 @@ var TemplateDefinitionBuilder = class {
22781
22988
  const placeholders = this.i18nBindProps(icu.placeholders);
22782
22989
  const message = icu.i18n;
22783
22990
  const transformFn = (raw) => {
22784
- const params = __spreadValues(__spreadValues({}, vars), placeholders);
22991
+ const params = Object.fromEntries(Object.entries(__spreadValues(__spreadValues({}, vars), placeholders)).sort());
22785
22992
  const formatted = formatI18nPlaceholderNamesInMap(params, false);
22786
22993
  return invokeInstruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
22787
22994
  };
@@ -22808,7 +23015,7 @@ var TemplateDefinitionBuilder = class {
22808
23015
  tagName = inferredData.tagName;
22809
23016
  attrsExprs = inferredData.attrsExprs;
22810
23017
  }
22811
- const templateIndex = this.createEmbeddedTemplateFn(tagName, children, "_Conditional", sourceSpan, variables, attrsExprs);
23018
+ const templateIndex = this.createEmbeddedTemplateFn(tagName, children, "_Conditional", sourceSpan, variables, attrsExprs, void 0, branch.i18n);
22812
23019
  const processedExpression = expression === null ? null : expression.visit(this._valueConverter);
22813
23020
  return { index: templateIndex, expression: processedExpression, alias: expressionAlias };
22814
23021
  });
@@ -22842,7 +23049,7 @@ var TemplateDefinitionBuilder = class {
22842
23049
  }
22843
23050
  visitSwitchBlock(block) {
22844
23051
  const caseData = block.cases.map((currentCase) => {
22845
- const index = this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan);
23052
+ const index = this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan, void 0, void 0, void 0, currentCase.i18n);
22846
23053
  const expression = currentCase.expression === null ? null : currentCase.expression.visit(this._valueConverter);
22847
23054
  return { index, expression };
22848
23055
  });
@@ -22870,12 +23077,12 @@ var TemplateDefinitionBuilder = class {
22870
23077
  if (!metadata) {
22871
23078
  throw new Error("Could not resolve `defer` block metadata. Block may need to be analyzed.");
22872
23079
  }
22873
- const primaryTemplateIndex = this.createEmbeddedTemplateFn(null, deferred.children, "_Defer", deferred.sourceSpan);
22874
- const loadingIndex = loading ? this.createEmbeddedTemplateFn(null, loading.children, "_DeferLoading", loading.sourceSpan) : null;
23080
+ const primaryTemplateIndex = this.createEmbeddedTemplateFn(null, deferred.children, "_Defer", deferred.sourceSpan, void 0, void 0, void 0, deferred.i18n);
23081
+ const loadingIndex = loading ? this.createEmbeddedTemplateFn(null, loading.children, "_DeferLoading", loading.sourceSpan, void 0, void 0, void 0, loading.i18n) : null;
22875
23082
  const loadingConsts = loading ? trimTrailingNulls([literal(loading.minimumTime), literal(loading.afterTime)]) : null;
22876
- const placeholderIndex = placeholder ? this.createEmbeddedTemplateFn(null, placeholder.children, "_DeferPlaceholder", placeholder.sourceSpan) : null;
23083
+ const placeholderIndex = placeholder ? this.createEmbeddedTemplateFn(null, placeholder.children, "_DeferPlaceholder", placeholder.sourceSpan, void 0, void 0, void 0, placeholder.i18n) : null;
22877
23084
  const placeholderConsts = placeholder && placeholder.minimumTime !== null ? literalArr([literal(placeholder.minimumTime)]) : null;
22878
- const errorIndex = error2 ? this.createEmbeddedTemplateFn(null, error2.children, "_DeferError", error2.sourceSpan) : null;
23085
+ const errorIndex = error2 ? this.createEmbeddedTemplateFn(null, error2.children, "_DeferError", error2.sourceSpan, void 0, void 0, void 0, error2.i18n) : null;
22879
23086
  const deferredIndex = this.allocateDataSlot();
22880
23087
  const depsFnName = `${this.contextName}_Defer_${deferredIndex}_DepsFn`;
22881
23088
  this.creationInstruction(deferred.sourceSpan, Identifiers.defer, trimTrailingNulls([
@@ -22984,11 +23191,14 @@ var TemplateDefinitionBuilder = class {
22984
23191
  visitForLoopBlock(block) {
22985
23192
  const blockIndex = this.allocateDataSlot();
22986
23193
  const { tagName, attrsExprs } = this.inferProjectionDataFromInsertionPoint(block);
22987
- const primaryData = this.prepareEmbeddedTemplateFn(block.children, "_For", [block.item, block.contextVariables.$index, block.contextVariables.$count]);
23194
+ const primaryData = this.prepareEmbeddedTemplateFn(block.children, "_For", [block.item, block.contextVariables.$index, block.contextVariables.$count], block.i18n, {
23195
+ [block.contextVariables.$index.name]: this.getLevelSpecificVariableName("$index", this.level + 1),
23196
+ [block.contextVariables.$count.name]: this.getLevelSpecificVariableName("$count", this.level + 1)
23197
+ });
22988
23198
  const { expression: trackByExpression, usesComponentInstance: trackByUsesComponentInstance } = this.createTrackByFunction(block);
22989
23199
  let emptyData = null;
22990
23200
  if (block.empty !== null) {
22991
- emptyData = this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty");
23201
+ emptyData = this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty", void 0, block.empty.i18n);
22992
23202
  this.allocateBindingSlots(null);
22993
23203
  }
22994
23204
  this.registerComputedLoopVariables(block, primaryData.scope);
@@ -23010,16 +23220,31 @@ var TemplateDefinitionBuilder = class {
23010
23220
  return params;
23011
23221
  });
23012
23222
  const value = block.expression.visit(this._valueConverter);
23013
- this.updateInstruction(block.sourceSpan, Identifiers.repeater, () => [literal(blockIndex), this.convertPropertyBinding(value)]);
23223
+ this.updateInstructionWithAdvance(blockIndex, block.sourceSpan, Identifiers.repeater, () => [this.convertPropertyBinding(value)]);
23014
23224
  }
23015
23225
  registerComputedLoopVariables(block, bindingScope) {
23016
- const indexLocalName = block.contextVariables.$index.name;
23017
- const countLocalName = block.contextVariables.$count.name;
23018
23226
  const level = bindingScope.bindingLevel;
23019
- bindingScope.set(level, block.contextVariables.$odd.name, (scope) => scope.get(indexLocalName).modulo(literal(2)).notIdentical(literal(0)));
23020
- bindingScope.set(level, block.contextVariables.$even.name, (scope) => scope.get(indexLocalName).modulo(literal(2)).identical(literal(0)));
23021
- bindingScope.set(level, block.contextVariables.$first.name, (scope) => scope.get(indexLocalName).identical(literal(0)));
23022
- bindingScope.set(level, block.contextVariables.$last.name, (scope) => scope.get(indexLocalName).identical(scope.get(countLocalName).minus(literal(1))));
23227
+ bindingScope.set(level, block.contextVariables.$odd.name, (scope, retrievalLevel) => {
23228
+ return this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index").modulo(literal(2)).notIdentical(literal(0));
23229
+ });
23230
+ bindingScope.set(level, block.contextVariables.$even.name, (scope, retrievalLevel) => {
23231
+ return this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index").modulo(literal(2)).identical(literal(0));
23232
+ });
23233
+ bindingScope.set(level, block.contextVariables.$first.name, (scope, retrievalLevel) => {
23234
+ return this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index").identical(literal(0));
23235
+ });
23236
+ bindingScope.set(level, block.contextVariables.$last.name, (scope, retrievalLevel) => {
23237
+ const index = this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index");
23238
+ const count = this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$count");
23239
+ return index.identical(count.minus(literal(1)));
23240
+ });
23241
+ }
23242
+ getLevelSpecificVariableName(name, level) {
23243
+ return `\u0275${name}_${level}`;
23244
+ }
23245
+ getLevelSpecificForLoopVariable(block, scope, retrievalLevel, name) {
23246
+ const scopeName = scope.bindingLevel === retrievalLevel ? block.contextVariables[name].name : this.getLevelSpecificVariableName(name, retrievalLevel);
23247
+ return scope.get(scopeName);
23023
23248
  }
23024
23249
  optimizeTrackByFunction(block) {
23025
23250
  const indexLocalName = block.contextVariables.$index.name;
@@ -23429,7 +23654,7 @@ var BindingScope = class {
23429
23654
  if (value.declareLocalCallback && !value.declare) {
23430
23655
  value.declare = true;
23431
23656
  }
23432
- return typeof value.lhs === "function" ? value.lhs(this) : value.lhs;
23657
+ return typeof value.lhs === "function" ? value.lhs(this, value.retrievalLevel) : value.lhs;
23433
23658
  }
23434
23659
  current = current.parent;
23435
23660
  }
@@ -23505,7 +23730,7 @@ var BindingScope = class {
23505
23730
  const componentValue = this.map.get(SHARED_CONTEXT_KEY + 0);
23506
23731
  componentValue.declare = true;
23507
23732
  this.maybeRestoreView();
23508
- const lhs = typeof componentValue.lhs === "function" ? componentValue.lhs(this) : componentValue.lhs;
23733
+ const lhs = typeof componentValue.lhs === "function" ? componentValue.lhs(this, componentValue.retrievalLevel) : componentValue.lhs;
23509
23734
  return name === DIRECT_CONTEXT_REFERENCE ? lhs : lhs.prop(name);
23510
23735
  }
23511
23736
  maybeRestoreView() {
@@ -25574,7 +25799,7 @@ function publishFacade(global) {
25574
25799
  }
25575
25800
 
25576
25801
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/version.mjs
25577
- var VERSION2 = new Version("17.0.2");
25802
+ var VERSION2 = new Version("17.0.4");
25578
25803
 
25579
25804
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
25580
25805
  var _I18N_ATTR = "i18n";
@@ -25761,7 +25986,7 @@ var _Visitor3 = class {
25761
25986
  this._errors = [];
25762
25987
  this._messages = [];
25763
25988
  this._inImplicitNode = false;
25764
- this._createI18nMessage = createI18nMessageFactory(interpolationConfig);
25989
+ this._createI18nMessage = createI18nMessageFactory(interpolationConfig, DEFAULT_CONTAINER_BLOCKS);
25765
25990
  }
25766
25991
  _visitAttributesOf(el) {
25767
25992
  const explicitAttrNameToValue = {};
@@ -26019,6 +26244,12 @@ var _WriteVisitor = class {
26019
26244
  visitPlaceholder(ph, context) {
26020
26245
  return [new Tag(_PLACEHOLDER_TAG2, { id: ph.name, "equiv-text": `{{${ph.value}}}` })];
26021
26246
  }
26247
+ visitBlockPlaceholder(ph, context) {
26248
+ const ctype = `x-${ph.name.toLowerCase().replace(/[^a-z0-9]/g, "-")}`;
26249
+ const startTagPh = new Tag(_PLACEHOLDER_TAG2, { id: ph.startName, ctype, "equiv-text": `@${ph.name}` });
26250
+ const closeTagPh = new Tag(_PLACEHOLDER_TAG2, { id: ph.closeName, ctype, "equiv-text": `}` });
26251
+ return [startTagPh, ...this.serialize(ph.children), closeTagPh];
26252
+ }
26022
26253
  visitIcuPlaceholder(ph, context) {
26023
26254
  const equivText = `{${ph.value.expression}, ${ph.value.type}, ${Object.keys(ph.value.cases).map((value) => value + " {...}").join(" ")}}`;
26024
26255
  return [new Tag(_PLACEHOLDER_TAG2, { id: ph.name, "equiv-text": equivText })];
@@ -26290,6 +26521,23 @@ var _WriteVisitor2 = class {
26290
26521
  disp: `{{${ph.value}}}`
26291
26522
  })];
26292
26523
  }
26524
+ visitBlockPlaceholder(ph, context) {
26525
+ const tagPc = new Tag(_PLACEHOLDER_SPANNING_TAG, {
26526
+ id: (this._nextPlaceholderId++).toString(),
26527
+ equivStart: ph.startName,
26528
+ equivEnd: ph.closeName,
26529
+ type: "other",
26530
+ dispStart: `@${ph.name}`,
26531
+ dispEnd: `}`
26532
+ });
26533
+ const nodes = [].concat(...ph.children.map((node) => node.visit(this)));
26534
+ if (nodes.length) {
26535
+ nodes.forEach((node) => tagPc.children.push(node));
26536
+ } else {
26537
+ tagPc.children.push(new Text3(""));
26538
+ }
26539
+ return [tagPc];
26540
+ }
26293
26541
  visitIcuPlaceholder(ph, context) {
26294
26542
  const cases = Object.keys(ph.value.cases).map((value) => value + " {...}").join(" ");
26295
26543
  const idStr = (this._nextPlaceholderId++).toString();
@@ -26526,6 +26774,12 @@ var MapPlaceholderNames = class extends CloneVisitor {
26526
26774
  const children = ph.children.map((n) => n.visit(this, mapper));
26527
26775
  return new TagPlaceholder(ph.tag, ph.attrs, startName, closeName, children, ph.isVoid, ph.sourceSpan, ph.startSourceSpan, ph.endSourceSpan);
26528
26776
  }
26777
+ visitBlockPlaceholder(ph, mapper) {
26778
+ const startName = mapper.toPublicName(ph.startName);
26779
+ const closeName = ph.closeName ? mapper.toPublicName(ph.closeName) : ph.closeName;
26780
+ const children = ph.children.map((n) => n.visit(this, mapper));
26781
+ return new BlockPlaceholder(ph.name, ph.parameters, startName, closeName, children, ph.sourceSpan, ph.startSourceSpan, ph.endSourceSpan);
26782
+ }
26529
26783
  visitPlaceholder(ph, mapper) {
26530
26784
  return new Placeholder(ph.value, mapper.toPublicName(ph.name), ph.sourceSpan);
26531
26785
  }
@@ -26611,7 +26865,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
26611
26865
  function compileDeclareClassMetadata(metadata) {
26612
26866
  const definitionMap = new DefinitionMap();
26613
26867
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
26614
- definitionMap.set("version", literal("17.0.2"));
26868
+ definitionMap.set("version", literal("17.0.4"));
26615
26869
  definitionMap.set("ngImport", importExpr(Identifiers.core));
26616
26870
  definitionMap.set("type", metadata.type);
26617
26871
  definitionMap.set("decorators", metadata.decorators);
@@ -26682,7 +26936,7 @@ function createDirectiveDefinitionMap(meta) {
26682
26936
  const hasTransformFunctions = Object.values(meta.inputs).some((input) => input.transformFunction !== null);
26683
26937
  const minVersion = hasTransformFunctions ? MINIMUM_PARTIAL_LINKER_VERSION2 : "14.0.0";
26684
26938
  definitionMap.set("minVersion", literal(minVersion));
26685
- definitionMap.set("version", literal("17.0.2"));
26939
+ definitionMap.set("version", literal("17.0.4"));
26686
26940
  definitionMap.set("type", meta.type.value);
26687
26941
  if (meta.isStandalone) {
26688
26942
  definitionMap.set("isStandalone", literal(meta.isStandalone));
@@ -26914,7 +27168,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION3 = "12.0.0";
26914
27168
  function compileDeclareFactoryFunction(meta) {
26915
27169
  const definitionMap = new DefinitionMap();
26916
27170
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
26917
- definitionMap.set("version", literal("17.0.2"));
27171
+ definitionMap.set("version", literal("17.0.4"));
26918
27172
  definitionMap.set("ngImport", importExpr(Identifiers.core));
26919
27173
  definitionMap.set("type", meta.type.value);
26920
27174
  definitionMap.set("deps", compileDependencies(meta.deps));
@@ -26937,7 +27191,7 @@ function compileDeclareInjectableFromMetadata(meta) {
26937
27191
  function createInjectableDefinitionMap(meta) {
26938
27192
  const definitionMap = new DefinitionMap();
26939
27193
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
26940
- definitionMap.set("version", literal("17.0.2"));
27194
+ definitionMap.set("version", literal("17.0.4"));
26941
27195
  definitionMap.set("ngImport", importExpr(Identifiers.core));
26942
27196
  definitionMap.set("type", meta.type.value);
26943
27197
  if (meta.providedIn !== void 0) {
@@ -26975,7 +27229,7 @@ function compileDeclareInjectorFromMetadata(meta) {
26975
27229
  function createInjectorDefinitionMap(meta) {
26976
27230
  const definitionMap = new DefinitionMap();
26977
27231
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
26978
- definitionMap.set("version", literal("17.0.2"));
27232
+ definitionMap.set("version", literal("17.0.4"));
26979
27233
  definitionMap.set("ngImport", importExpr(Identifiers.core));
26980
27234
  definitionMap.set("type", meta.type.value);
26981
27235
  definitionMap.set("providers", meta.providers);
@@ -26999,7 +27253,7 @@ function createNgModuleDefinitionMap(meta) {
26999
27253
  throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
27000
27254
  }
27001
27255
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
27002
- definitionMap.set("version", literal("17.0.2"));
27256
+ definitionMap.set("version", literal("17.0.4"));
27003
27257
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27004
27258
  definitionMap.set("type", meta.type.value);
27005
27259
  if (meta.bootstrap.length > 0) {
@@ -27034,7 +27288,7 @@ function compileDeclarePipeFromMetadata(meta) {
27034
27288
  function createPipeDefinitionMap(meta) {
27035
27289
  const definitionMap = new DefinitionMap();
27036
27290
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION7));
27037
- definitionMap.set("version", literal("17.0.2"));
27291
+ definitionMap.set("version", literal("17.0.4"));
27038
27292
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27039
27293
  definitionMap.set("type", meta.type.value);
27040
27294
  if (meta.isStandalone) {
@@ -27051,7 +27305,7 @@ function createPipeDefinitionMap(meta) {
27051
27305
  publishFacade(_global);
27052
27306
 
27053
27307
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/version.mjs
27054
- var VERSION3 = new Version("17.0.2");
27308
+ var VERSION3 = new Version("17.0.4");
27055
27309
 
27056
27310
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
27057
27311
  var EmitFlags;