@angular/core 17.1.0-next.0 → 17.1.0-next.1

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.
@@ -609,6 +609,9 @@ var _SerializerVisitor = class {
609
609
  visitIcuPlaceholder(ph, context) {
610
610
  return `<ph icu name="${ph.name}">${ph.value.visit(this)}</ph>`;
611
611
  }
612
+ visitBlockPlaceholder(ph, context) {
613
+ return `<ph block name="${ph.startName}">${ph.children.map((child) => child.visit(this)).join(", ")}</ph name="${ph.closeName}">`;
614
+ }
612
615
  };
613
616
  var serializerVisitor = new _SerializerVisitor();
614
617
  function serializeNodes(nodes) {
@@ -3654,43 +3657,47 @@ var BlockNode = class {
3654
3657
  }
3655
3658
  };
3656
3659
  var DeferredBlockPlaceholder = class extends BlockNode {
3657
- constructor(children, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
3660
+ constructor(children, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
3658
3661
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3659
3662
  this.children = children;
3660
3663
  this.minimumTime = minimumTime;
3664
+ this.i18n = i18n2;
3661
3665
  }
3662
3666
  visit(visitor) {
3663
3667
  return visitor.visitDeferredBlockPlaceholder(this);
3664
3668
  }
3665
3669
  };
3666
3670
  var DeferredBlockLoading = class extends BlockNode {
3667
- constructor(children, afterTime, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
3671
+ constructor(children, afterTime, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
3668
3672
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3669
3673
  this.children = children;
3670
3674
  this.afterTime = afterTime;
3671
3675
  this.minimumTime = minimumTime;
3676
+ this.i18n = i18n2;
3672
3677
  }
3673
3678
  visit(visitor) {
3674
3679
  return visitor.visitDeferredBlockLoading(this);
3675
3680
  }
3676
3681
  };
3677
3682
  var DeferredBlockError = class extends BlockNode {
3678
- constructor(children, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
3683
+ constructor(children, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
3679
3684
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3680
3685
  this.children = children;
3686
+ this.i18n = i18n2;
3681
3687
  }
3682
3688
  visit(visitor) {
3683
3689
  return visitor.visitDeferredBlockError(this);
3684
3690
  }
3685
3691
  };
3686
3692
  var DeferredBlock = class extends BlockNode {
3687
- constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, nameSpan, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan) {
3693
+ constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, nameSpan, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, i18n2) {
3688
3694
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3689
3695
  this.children = children;
3690
3696
  this.placeholder = placeholder;
3691
3697
  this.loading = loading;
3692
3698
  this.error = error2;
3693
3699
  this.mainBlockSpan = mainBlockSpan;
3700
+ this.i18n = i18n2;
3694
3701
  this.triggers = triggers;
3695
3702
  this.prefetchTriggers = prefetchTriggers;
3696
3703
  this.definedTriggers = Object.keys(triggers);
@@ -3722,17 +3729,18 @@ var SwitchBlock = class extends BlockNode {
3722
3729
  }
3723
3730
  };
3724
3731
  var SwitchBlockCase = class extends BlockNode {
3725
- constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
3732
+ constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
3726
3733
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3727
3734
  this.expression = expression;
3728
3735
  this.children = children;
3736
+ this.i18n = i18n2;
3729
3737
  }
3730
3738
  visit(visitor) {
3731
3739
  return visitor.visitSwitchBlockCase(this);
3732
3740
  }
3733
3741
  };
3734
3742
  var ForLoopBlock = class extends BlockNode {
3735
- constructor(item, expression, trackBy, trackKeywordSpan, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, nameSpan) {
3743
+ constructor(item, expression, trackBy, trackKeywordSpan, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
3736
3744
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3737
3745
  this.item = item;
3738
3746
  this.expression = expression;
@@ -3742,15 +3750,17 @@ var ForLoopBlock = class extends BlockNode {
3742
3750
  this.children = children;
3743
3751
  this.empty = empty;
3744
3752
  this.mainBlockSpan = mainBlockSpan;
3753
+ this.i18n = i18n2;
3745
3754
  }
3746
3755
  visit(visitor) {
3747
3756
  return visitor.visitForLoopBlock(this);
3748
3757
  }
3749
3758
  };
3750
3759
  var ForLoopBlockEmpty = class extends BlockNode {
3751
- constructor(children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
3760
+ constructor(children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
3752
3761
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3753
3762
  this.children = children;
3763
+ this.i18n = i18n2;
3754
3764
  }
3755
3765
  visit(visitor) {
3756
3766
  return visitor.visitForLoopBlockEmpty(this);
@@ -3766,11 +3776,12 @@ var IfBlock = class extends BlockNode {
3766
3776
  }
3767
3777
  };
3768
3778
  var IfBlockBranch = class extends BlockNode {
3769
- constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
3779
+ constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
3770
3780
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3771
3781
  this.expression = expression;
3772
3782
  this.children = children;
3773
3783
  this.expressionAlias = expressionAlias;
3784
+ this.i18n = i18n2;
3774
3785
  }
3775
3786
  visit(visitor) {
3776
3787
  return visitor.visitIfBlockBranch(this);
@@ -3960,6 +3971,21 @@ var IcuPlaceholder = class {
3960
3971
  return visitor.visitIcuPlaceholder(this, context);
3961
3972
  }
3962
3973
  };
3974
+ var BlockPlaceholder = class {
3975
+ constructor(name, parameters, startName, closeName, children, sourceSpan, startSourceSpan, endSourceSpan) {
3976
+ this.name = name;
3977
+ this.parameters = parameters;
3978
+ this.startName = startName;
3979
+ this.closeName = closeName;
3980
+ this.children = children;
3981
+ this.sourceSpan = sourceSpan;
3982
+ this.startSourceSpan = startSourceSpan;
3983
+ this.endSourceSpan = endSourceSpan;
3984
+ }
3985
+ visit(visitor, context) {
3986
+ return visitor.visitBlockPlaceholder(this, context);
3987
+ }
3988
+ };
3963
3989
  var RecurseVisitor = class {
3964
3990
  visitText(text2, context) {
3965
3991
  }
@@ -3978,6 +4004,9 @@ var RecurseVisitor = class {
3978
4004
  }
3979
4005
  visitIcuPlaceholder(ph, context) {
3980
4006
  }
4007
+ visitBlockPlaceholder(ph, context) {
4008
+ ph.children.forEach((child) => child.visit(this));
4009
+ }
3981
4010
  };
3982
4011
  function serializeMessage(messageNodes) {
3983
4012
  const visitor = new LocalizeMessageStringVisitor();
@@ -4005,6 +4034,10 @@ var LocalizeMessageStringVisitor = class {
4005
4034
  visitIcuPlaceholder(ph) {
4006
4035
  return `{$${ph.name}}`;
4007
4036
  }
4037
+ visitBlockPlaceholder(ph) {
4038
+ const children = ph.children.map((child) => child.visit(this)).join("");
4039
+ return `{$${ph.startName}}${children}{$${ph.closeName}}`;
4040
+ }
4008
4041
  };
4009
4042
 
4010
4043
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/serializers/xml_helper.mjs
@@ -4472,7 +4505,7 @@ function assertInterpolationSymbols(identifier, value) {
4472
4505
  }
4473
4506
  }
4474
4507
 
4475
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/interpolation_config.mjs
4508
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/defaults.mjs
4476
4509
  var InterpolationConfig = class {
4477
4510
  static fromArray(markers) {
4478
4511
  if (!markers) {
@@ -4487,6 +4520,7 @@ var InterpolationConfig = class {
4487
4520
  }
4488
4521
  };
4489
4522
  var DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig("{{", "}}");
4523
+ var DEFAULT_CONTAINER_BLOCKS = /* @__PURE__ */ new Set(["switch"]);
4490
4524
 
4491
4525
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/chars.mjs
4492
4526
  var $EOF = 0;
@@ -7298,13 +7332,13 @@ function createConditionalOp(target, targetSlot, test, conditions, sourceSpan) {
7298
7332
  }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
7299
7333
  }
7300
7334
  function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
7301
- return __spreadValues({
7335
+ return __spreadValues(__spreadValues({
7302
7336
  kind: OpKind.Repeater,
7303
7337
  target: repeaterCreate2,
7304
7338
  targetSlot,
7305
7339
  collection,
7306
7340
  sourceSpan
7307
- }, NEW_OP);
7341
+ }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
7308
7342
  }
7309
7343
  function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
7310
7344
  return __spreadValues(__spreadValues({
@@ -9979,6 +10013,9 @@ var IcuSerializerVisitor = class {
9979
10013
  visitPlaceholder(ph) {
9980
10014
  return this.formatPh(ph.name);
9981
10015
  }
10016
+ visitBlockPlaceholder(ph) {
10017
+ return `${this.formatPh(ph.startName)}${ph.children.map((child) => child.visit(this)).join("")}${this.formatPh(ph.closeName)}`;
10018
+ }
9982
10019
  visitIcuPlaceholder(ph, context) {
9983
10020
  return this.formatPh(ph.name);
9984
10021
  }
@@ -11322,12 +11359,12 @@ var Comment2 = class {
11322
11359
  return visitor.visitComment(this, context);
11323
11360
  }
11324
11361
  };
11325
- var Block = class {
11326
- constructor(name, parameters, children, sourceSpan, nameSpan, startSourceSpan, endSourceSpan = null) {
11362
+ var Block = class extends NodeWithI18n {
11363
+ constructor(name, parameters, children, sourceSpan, nameSpan, startSourceSpan, endSourceSpan = null, i18n2) {
11364
+ super(sourceSpan, i18n2);
11327
11365
  this.name = name;
11328
11366
  this.parameters = parameters;
11329
11367
  this.children = children;
11330
- this.sourceSpan = sourceSpan;
11331
11368
  this.nameSpan = nameSpan;
11332
11369
  this.startSourceSpan = startSourceSpan;
11333
11370
  this.endSourceSpan = endSourceSpan;
@@ -11946,6 +11983,24 @@ var PlaceholderRegistry = class {
11946
11983
  getUniquePlaceholder(name) {
11947
11984
  return this._generateUniqueName(name.toUpperCase());
11948
11985
  }
11986
+ getStartBlockPlaceholderName(name, parameters) {
11987
+ const signature = this._hashBlock(name, parameters);
11988
+ if (this._signatureToName[signature]) {
11989
+ return this._signatureToName[signature];
11990
+ }
11991
+ const placeholder = this._generateUniqueName(`START_BLOCK_${this._toSnakeCase(name)}`);
11992
+ this._signatureToName[signature] = placeholder;
11993
+ return placeholder;
11994
+ }
11995
+ getCloseBlockPlaceholderName(name) {
11996
+ const signature = this._hashClosingBlock(name);
11997
+ if (this._signatureToName[signature]) {
11998
+ return this._signatureToName[signature];
11999
+ }
12000
+ const placeholder = this._generateUniqueName(`CLOSE_BLOCK_${this._toSnakeCase(name)}`);
12001
+ this._signatureToName[signature] = placeholder;
12002
+ return placeholder;
12003
+ }
11949
12004
  _hashTag(tag, attrs, isVoid) {
11950
12005
  const start = `<${tag}`;
11951
12006
  const strAttrs = Object.keys(attrs).sort().map((name) => ` ${name}=${attrs[name]}`).join("");
@@ -11955,6 +12010,16 @@ var PlaceholderRegistry = class {
11955
12010
  _hashClosingTag(tag) {
11956
12011
  return this._hashTag(`/${tag}`, {}, false);
11957
12012
  }
12013
+ _hashBlock(name, parameters) {
12014
+ const params = parameters.length === 0 ? "" : ` (${parameters.sort().join("; ")})`;
12015
+ return `@${name}${params} {}`;
12016
+ }
12017
+ _hashClosingBlock(name) {
12018
+ return this._hashBlock(`close_${name}`, []);
12019
+ }
12020
+ _toSnakeCase(name) {
12021
+ return name.toUpperCase().replace(/[^A-Z0-9]/g, "_");
12022
+ }
11958
12023
  _generateUniqueName(base) {
11959
12024
  const seen = this._placeHolderNameCounts.hasOwnProperty(base);
11960
12025
  if (!seen) {
@@ -11969,17 +12034,18 @@ var PlaceholderRegistry = class {
11969
12034
 
11970
12035
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/i18n_parser.mjs
11971
12036
  var _expParser = new Parser(new Lexer());
11972
- function createI18nMessageFactory(interpolationConfig) {
11973
- const visitor = new _I18nVisitor(_expParser, interpolationConfig);
12037
+ function createI18nMessageFactory(interpolationConfig, containerBlocks) {
12038
+ const visitor = new _I18nVisitor(_expParser, interpolationConfig, containerBlocks);
11974
12039
  return (nodes, meaning, description, customId, visitNodeFn) => visitor.toI18nMessage(nodes, meaning, description, customId, visitNodeFn);
11975
12040
  }
11976
12041
  function noopVisitNodeFn(_html, i18n2) {
11977
12042
  return i18n2;
11978
12043
  }
11979
12044
  var _I18nVisitor = class {
11980
- constructor(_expressionParser, _interpolationConfig) {
12045
+ constructor(_expressionParser, _interpolationConfig, _containerBlocks) {
11981
12046
  this._expressionParser = _expressionParser;
11982
12047
  this._interpolationConfig = _interpolationConfig;
12048
+ this._containerBlocks = _containerBlocks;
11983
12049
  }
11984
12050
  toI18nMessage(nodes, meaning = "", description = "", customId = "", visitNodeFn) {
11985
12051
  const context = {
@@ -12054,11 +12120,27 @@ var _I18nVisitor = class {
12054
12120
  throw new Error("Unreachable code");
12055
12121
  }
12056
12122
  visitBlock(block, context) {
12123
+ var _a2;
12057
12124
  const children = visitAll2(this, block.children, context);
12058
- const node = new Container(children, block.sourceSpan);
12125
+ if (this._containerBlocks.has(block.name)) {
12126
+ return new Container(children, block.sourceSpan);
12127
+ }
12128
+ const parameters = block.parameters.map((param) => param.expression);
12129
+ const startPhName = context.placeholderRegistry.getStartBlockPlaceholderName(block.name, parameters);
12130
+ const closePhName = context.placeholderRegistry.getCloseBlockPlaceholderName(block.name);
12131
+ context.placeholderToContent[startPhName] = {
12132
+ text: block.startSourceSpan.toString(),
12133
+ sourceSpan: block.startSourceSpan
12134
+ };
12135
+ context.placeholderToContent[closePhName] = {
12136
+ text: block.endSourceSpan ? block.endSourceSpan.toString() : "}",
12137
+ sourceSpan: (_a2 = block.endSourceSpan) != null ? _a2 : block.sourceSpan
12138
+ };
12139
+ const node = new BlockPlaceholder(block.name, parameters, startPhName, closePhName, children, block.sourceSpan, block.startSourceSpan, block.endSourceSpan);
12059
12140
  return context.visitNodeFn(block, node);
12060
12141
  }
12061
12142
  visitBlockParameter(_parameter, _context) {
12143
+ throw new Error("Unreachable code");
12062
12144
  }
12063
12145
  _visitTextWithInterpolation(tokens, sourceSpan, context, previousI18n) {
12064
12146
  const nodes = [];
@@ -15598,16 +15680,17 @@ var setI18nRefs = (htmlNode, i18nNode) => {
15598
15680
  return i18nNode;
15599
15681
  };
15600
15682
  var I18nMetaVisitor = class {
15601
- constructor(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG, keepI18nAttrs = false, enableI18nLegacyMessageIdFormat = false) {
15683
+ constructor(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG, keepI18nAttrs = false, enableI18nLegacyMessageIdFormat = false, containerBlocks = DEFAULT_CONTAINER_BLOCKS) {
15602
15684
  this.interpolationConfig = interpolationConfig;
15603
15685
  this.keepI18nAttrs = keepI18nAttrs;
15604
15686
  this.enableI18nLegacyMessageIdFormat = enableI18nLegacyMessageIdFormat;
15687
+ this.containerBlocks = containerBlocks;
15605
15688
  this.hasI18nMeta = false;
15606
15689
  this._errors = [];
15607
15690
  }
15608
15691
  _generateI18nMessage(nodes, meta = "", visitNodeFn) {
15609
15692
  const { meaning, description, customId } = this._parseMetadata(meta);
15610
- const createI18nMessage2 = createI18nMessageFactory(this.interpolationConfig);
15693
+ const createI18nMessage2 = createI18nMessageFactory(this.interpolationConfig, this.containerBlocks);
15611
15694
  const message = createI18nMessage2(nodes, meaning, description, customId, visitNodeFn);
15612
15695
  this._setMessageId(message, meta);
15613
15696
  this._setLegacyIds(message, meta);
@@ -15782,6 +15865,9 @@ var GetMsgSerializerVisitor = class {
15782
15865
  visitPlaceholder(ph) {
15783
15866
  return this.formatPh(ph.name);
15784
15867
  }
15868
+ visitBlockPlaceholder(ph) {
15869
+ return `${this.formatPh(ph.startName)}${ph.children.map((child) => child.visit(this)).join("")}${this.formatPh(ph.closeName)}`;
15870
+ }
15785
15871
  visitIcuPlaceholder(ph, context) {
15786
15872
  return this.formatPh(ph.name);
15787
15873
  }
@@ -15830,6 +15916,12 @@ var LocalizeSerializerVisitor = class {
15830
15916
  visitPlaceholder(ph) {
15831
15917
  this.pieces.push(this.createPlaceholderPiece(ph.name, ph.sourceSpan));
15832
15918
  }
15919
+ visitBlockPlaceholder(ph) {
15920
+ var _a2, _b2;
15921
+ this.pieces.push(this.createPlaceholderPiece(ph.startName, (_a2 = ph.startSourceSpan) != null ? _a2 : ph.sourceSpan));
15922
+ ph.children.forEach((child) => child.visit(this));
15923
+ this.pieces.push(this.createPlaceholderPiece(ph.closeName, (_b2 = ph.endSourceSpan) != null ? _b2 : ph.sourceSpan));
15924
+ }
15833
15925
  visitIcuPlaceholder(ph) {
15834
15926
  this.pieces.push(this.createPlaceholderPiece(ph.name, ph.sourceSpan, this.placeholderToMessage[ph.name]));
15835
15927
  }
@@ -16911,8 +17003,8 @@ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByF
16911
17003
  }
16912
17004
  return call(Identifiers.repeaterCreate, args, sourceSpan);
16913
17005
  }
16914
- function repeater(metadataSlot, collection, sourceSpan) {
16915
- return call(Identifiers.repeater, [literal(metadataSlot), collection], sourceSpan);
17006
+ function repeater(collection, sourceSpan) {
17007
+ return call(Identifiers.repeater, [collection], sourceSpan);
16916
17008
  }
16917
17009
  function deferWhen(prefetch, expr, sourceSpan) {
16918
17010
  return call(prefetch ? Identifiers.deferPrefetchWhen : Identifiers.deferWhen, [expr], sourceSpan);
@@ -17470,7 +17562,7 @@ function reifyUpdateOperations(_unit, ops) {
17470
17562
  OpList.replace(op, conditional(op.targetSlot.slot, op.processed, op.contextValue, op.sourceSpan));
17471
17563
  break;
17472
17564
  case OpKind.Repeater:
17473
- OpList.replace(op, repeater(op.targetSlot.slot, op.collection, op.sourceSpan));
17565
+ OpList.replace(op, repeater(op.collection, op.sourceSpan));
17474
17566
  break;
17475
17567
  case OpKind.DeferWhen:
17476
17568
  OpList.replace(op, deferWhen(op.prefetch, op.expr, op.sourceSpan));
@@ -17836,9 +17928,8 @@ var ResolveIcuPlaceholdersVisitor = class extends RecurseVisitor {
17836
17928
  super();
17837
17929
  this.params = params;
17838
17930
  }
17839
- visitTagPlaceholder(placeholder) {
17931
+ visitContainerPlaceholder(placeholder) {
17840
17932
  var _a2, _b2;
17841
- super.visitTagPlaceholder(placeholder);
17842
17933
  if (placeholder.startName && placeholder.startSourceSpan && !this.params.has(placeholder.startName)) {
17843
17934
  this.params.set(placeholder.startName, [{
17844
17935
  value: (_a2 = placeholder.startSourceSpan) == null ? void 0 : _a2.toString(),
@@ -17854,6 +17945,14 @@ var ResolveIcuPlaceholdersVisitor = class extends RecurseVisitor {
17854
17945
  }]);
17855
17946
  }
17856
17947
  }
17948
+ visitTagPlaceholder(placeholder) {
17949
+ super.visitTagPlaceholder(placeholder);
17950
+ this.visitContainerPlaceholder(placeholder);
17951
+ }
17952
+ visitBlockPlaceholder(placeholder) {
17953
+ super.visitBlockPlaceholder(placeholder);
17954
+ this.visitContainerPlaceholder(placeholder);
17955
+ }
17857
17956
  };
17858
17957
 
17859
17958
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
@@ -20173,18 +20272,18 @@ function createIfBlock(ast, connectedBlocks, visitor, bindingParser) {
20173
20272
  const branches = [];
20174
20273
  const mainBlockParams = parseConditionalBlockParameters(ast, errors, bindingParser);
20175
20274
  if (mainBlockParams !== null) {
20176
- branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll2(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan));
20275
+ branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll2(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan, ast.i18n));
20177
20276
  }
20178
20277
  for (const block of connectedBlocks) {
20179
20278
  if (ELSE_IF_PATTERN.test(block.name)) {
20180
20279
  const params = parseConditionalBlockParameters(block, errors, bindingParser);
20181
20280
  if (params !== null) {
20182
20281
  const children = visitAll2(visitor, block.children, block.children);
20183
- branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan));
20282
+ branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan, block.i18n));
20184
20283
  }
20185
20284
  } else if (block.name === "else") {
20186
20285
  const children = visitAll2(visitor, block.children, block.children);
20187
- branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan));
20286
+ branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan, block.i18n));
20188
20287
  }
20189
20288
  }
20190
20289
  const ifBlockStartSourceSpan = branches.length > 0 ? branches[0].startSourceSpan : ast.startSourceSpan;
@@ -20212,7 +20311,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
20212
20311
  } else if (block.parameters.length > 0) {
20213
20312
  errors.push(new ParseError(block.sourceSpan, "@empty block cannot have parameters"));
20214
20313
  } else {
20215
- empty = new ForLoopBlockEmpty(visitAll2(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan);
20314
+ empty = new ForLoopBlockEmpty(visitAll2(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan, block.i18n);
20216
20315
  }
20217
20316
  } else {
20218
20317
  errors.push(new ParseError(block.sourceSpan, `Unrecognized @for loop block "${block.name}"`));
@@ -20224,7 +20323,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
20224
20323
  } else {
20225
20324
  const endSpan = (_a2 = empty == null ? void 0 : empty.endSourceSpan) != null ? _a2 : ast.endSourceSpan;
20226
20325
  const sourceSpan = new ParseSourceSpan(ast.sourceSpan.start, (_b2 = endSpan == null ? void 0 : endSpan.end) != null ? _b2 : ast.sourceSpan.end);
20227
- 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);
20326
+ 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);
20228
20327
  }
20229
20328
  }
20230
20329
  return { node, errors };
@@ -20244,7 +20343,7 @@ function createSwitchBlock(ast, visitor, bindingParser) {
20244
20343
  continue;
20245
20344
  }
20246
20345
  const expression = node.name === "case" ? parseBlockParameterToBinding(node.parameters[0], bindingParser) : null;
20247
- const ast2 = new SwitchBlockCase(expression, visitAll2(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan);
20346
+ const ast2 = new SwitchBlockCase(expression, visitAll2(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan, node.i18n);
20248
20347
  if (expression === null) {
20249
20348
  defaultCase = ast2;
20250
20349
  } else {
@@ -20732,7 +20831,7 @@ function createDeferredBlock(ast, connectedBlocks, visitor, bindingParser) {
20732
20831
  endOfLastSourceSpan = lastConnectedBlock.sourceSpan.end;
20733
20832
  }
20734
20833
  const sourceSpanWithConnectedBlocks = new ParseSourceSpan(ast.sourceSpan.start, endOfLastSourceSpan);
20735
- const node = new DeferredBlock(visitAll2(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error2, ast.nameSpan, sourceSpanWithConnectedBlocks, ast.sourceSpan, ast.startSourceSpan, lastEndSourceSpan);
20834
+ 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);
20736
20835
  return { node, errors };
20737
20836
  }
20738
20837
  function parseConnectedBlocks(connectedBlocks, errors, visitor) {
@@ -20790,7 +20889,7 @@ function parsePlaceholderBlock(ast, visitor) {
20790
20889
  throw new Error(`Unrecognized parameter in @placeholder block: "${param.expression}"`);
20791
20890
  }
20792
20891
  }
20793
- return new DeferredBlockPlaceholder(visitAll2(visitor, ast.children, ast.children), minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
20892
+ return new DeferredBlockPlaceholder(visitAll2(visitor, ast.children, ast.children), minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.i18n);
20794
20893
  }
20795
20894
  function parseLoadingBlock(ast, visitor) {
20796
20895
  let afterTime = null;
@@ -20818,13 +20917,13 @@ function parseLoadingBlock(ast, visitor) {
20818
20917
  throw new Error(`Unrecognized parameter in @loading block: "${param.expression}"`);
20819
20918
  }
20820
20919
  }
20821
- return new DeferredBlockLoading(visitAll2(visitor, ast.children, ast.children), afterTime, minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
20920
+ return new DeferredBlockLoading(visitAll2(visitor, ast.children, ast.children), afterTime, minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.i18n);
20822
20921
  }
20823
20922
  function parseErrorBlock(ast, visitor) {
20824
20923
  if (ast.parameters.length > 0) {
20825
20924
  throw new Error(`@error block cannot have parameters`);
20826
20925
  }
20827
- return new DeferredBlockError(visitAll2(visitor, ast.children, ast.children), ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
20926
+ return new DeferredBlockError(visitAll2(visitor, ast.children, ast.children), ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.i18n);
20828
20927
  }
20829
20928
  function parsePrimaryTriggers(params, bindingParser, errors, placeholder) {
20830
20929
  const triggers = {};
@@ -21308,6 +21407,11 @@ var I18nContext = class {
21308
21407
  const content = { type, index, ctx: this.id, isVoid: node.isVoid, closed };
21309
21408
  updatePlaceholderMap(this.placeholders, ph, content);
21310
21409
  }
21410
+ appendBlockPart(node, index, closed) {
21411
+ const ph = closed ? node.closeName : node.startName;
21412
+ const content = { type: TagType.TEMPLATE, index, ctx: this.id, closed };
21413
+ updatePlaceholderMap(this.placeholders, ph, content);
21414
+ }
21311
21415
  get icus() {
21312
21416
  return this._registry.icus;
21313
21417
  }
@@ -21337,6 +21441,11 @@ var I18nContext = class {
21337
21441
  this.appendTag(TagType.TEMPLATE, node, index, true);
21338
21442
  this._unresolvedCtxCount++;
21339
21443
  }
21444
+ appendBlock(node, index) {
21445
+ this.appendBlockPart(node, index, false);
21446
+ this.appendBlockPart(node, index, true);
21447
+ this._unresolvedCtxCount++;
21448
+ }
21340
21449
  appendElement(node, index, closed) {
21341
21450
  this.appendTag(TagType.ELEMENT, node, index, closed);
21342
21451
  }
@@ -21532,12 +21641,18 @@ var TemplateDefinitionBuilder = class {
21532
21641
  this.creationInstruction(null, Identifiers.pipe, [literal(slot), literal(name)]);
21533
21642
  });
21534
21643
  }
21535
- buildTemplateFunction(nodes, variables, ngContentSelectorsOffset = 0, i18n2) {
21644
+ buildTemplateFunction(nodes, variables, ngContentSelectorsOffset = 0, i18n2, variableAliases) {
21536
21645
  this._ngContentSelectorsOffset = ngContentSelectorsOffset;
21537
21646
  if (this._namespace !== Identifiers.namespaceHTML) {
21538
21647
  this.creationInstruction(null, this._namespace);
21539
21648
  }
21540
- variables.forEach((v) => this.registerContextVariables(v));
21649
+ variables.forEach((v) => {
21650
+ const alias = variableAliases == null ? void 0 : variableAliases[v.name];
21651
+ this.registerContextVariables(v.name, v.value);
21652
+ if (alias) {
21653
+ this.registerContextVariables(alias, v.value);
21654
+ }
21655
+ });
21541
21656
  const initI18nContext = this.i18nContext || isI18nRootNode(i18n2) && !isSingleI18nIcu(i18n2) && !(isSingleElementTemplate(nodes) && nodes[0].i18n === i18n2);
21542
21657
  const selfClosingI18nInstruction = hasTextChildrenOnly(nodes);
21543
21658
  if (initI18nContext) {
@@ -21592,12 +21707,12 @@ var TemplateDefinitionBuilder = class {
21592
21707
  this._constants.prepareStatements.push(...statements);
21593
21708
  return _ref;
21594
21709
  }
21595
- registerContextVariables(variable2) {
21710
+ registerContextVariables(name, value) {
21596
21711
  const scopedName = this._bindingScope.freshReferenceName();
21597
21712
  const retrievalLevel = this.level;
21598
- const isDirect = variable2.value === DIRECT_CONTEXT_REFERENCE;
21599
- const lhs = variable(variable2.name + scopedName);
21600
- this._bindingScope.set(retrievalLevel, variable2.name, (scope) => {
21713
+ const isDirect = value === DIRECT_CONTEXT_REFERENCE;
21714
+ const lhs = variable(name + scopedName);
21715
+ this._bindingScope.set(retrievalLevel, name, (scope) => {
21601
21716
  return isDirect && scope.bindingLevel === retrievalLevel && !scope.isListenerScope() ? variable(CONTEXT_NAME) : lhs;
21602
21717
  }, 1, (scope, relativeLevel) => {
21603
21718
  let rhs;
@@ -21615,7 +21730,7 @@ var TemplateDefinitionBuilder = class {
21615
21730
  rhs = sharedCtxVar ? sharedCtxVar : generateNextContextExpr(relativeLevel);
21616
21731
  }
21617
21732
  return [
21618
- lhs.set(isDirect ? rhs : rhs.prop(variable2.value || IMPLICIT_REFERENCE)).toConstDecl()
21733
+ lhs.set(isDirect ? rhs : rhs.prop(value || IMPLICIT_REFERENCE)).toConstDecl()
21619
21734
  ];
21620
21735
  });
21621
21736
  }
@@ -21954,16 +22069,20 @@ var TemplateDefinitionBuilder = class {
21954
22069
  this.creationInstruction(span, isNgContainer2 ? Identifiers.elementContainerEnd : Identifiers.elementEnd);
21955
22070
  }
21956
22071
  }
21957
- prepareEmbeddedTemplateFn(children, contextNameSuffix, variables = [], i18n2) {
22072
+ prepareEmbeddedTemplateFn(children, contextNameSuffix, variables = [], i18nMeta, variableAliases) {
21958
22073
  const index = this.allocateDataSlot();
21959
- if (this.i18n && i18n2) {
21960
- this.i18n.appendTemplate(i18n2, index);
22074
+ if (this.i18n && i18nMeta) {
22075
+ if (i18nMeta instanceof BlockPlaceholder) {
22076
+ this.i18n.appendBlock(i18nMeta, index);
22077
+ } else {
22078
+ this.i18n.appendTemplate(i18nMeta, index);
22079
+ }
21961
22080
  }
21962
22081
  const contextName = `${this.contextName}${contextNameSuffix}_${index}`;
21963
22082
  const name = `${contextName}_Template`;
21964
22083
  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);
21965
22084
  this._nestedTemplateFns.push(() => {
21966
- const templateFunctionExpr = visitor.buildTemplateFunction(children, variables, this._ngContentReservedSlots.length + this._ngContentSelectorsOffset, i18n2);
22085
+ const templateFunctionExpr = visitor.buildTemplateFunction(children, variables, this._ngContentReservedSlots.length + this._ngContentSelectorsOffset, i18nMeta, variableAliases);
21967
22086
  this.constantPool.statements.push(templateFunctionExpr.toDeclStmt(name));
21968
22087
  if (visitor._ngContentReservedSlots.length) {
21969
22088
  this._ngContentReservedSlots.push(...visitor._ngContentReservedSlots);
@@ -22073,7 +22192,7 @@ var TemplateDefinitionBuilder = class {
22073
22192
  tagName = inferredData.tagName;
22074
22193
  attrsExprs = inferredData.attrsExprs;
22075
22194
  }
22076
- const templateIndex = this.createEmbeddedTemplateFn(tagName, children, "_Conditional", sourceSpan, variables, attrsExprs);
22195
+ const templateIndex = this.createEmbeddedTemplateFn(tagName, children, "_Conditional", sourceSpan, variables, attrsExprs, void 0, branch.i18n);
22077
22196
  const processedExpression = expression === null ? null : expression.visit(this._valueConverter);
22078
22197
  return { index: templateIndex, expression: processedExpression, alias: expressionAlias };
22079
22198
  });
@@ -22107,7 +22226,7 @@ var TemplateDefinitionBuilder = class {
22107
22226
  }
22108
22227
  visitSwitchBlock(block) {
22109
22228
  const caseData = block.cases.map((currentCase) => {
22110
- const index = this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan);
22229
+ const index = this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan, void 0, void 0, void 0, currentCase.i18n);
22111
22230
  const expression = currentCase.expression === null ? null : currentCase.expression.visit(this._valueConverter);
22112
22231
  return { index, expression };
22113
22232
  });
@@ -22135,12 +22254,12 @@ var TemplateDefinitionBuilder = class {
22135
22254
  if (!metadata) {
22136
22255
  throw new Error("Could not resolve `defer` block metadata. Block may need to be analyzed.");
22137
22256
  }
22138
- const primaryTemplateIndex = this.createEmbeddedTemplateFn(null, deferred.children, "_Defer", deferred.sourceSpan);
22139
- const loadingIndex = loading ? this.createEmbeddedTemplateFn(null, loading.children, "_DeferLoading", loading.sourceSpan) : null;
22257
+ const primaryTemplateIndex = this.createEmbeddedTemplateFn(null, deferred.children, "_Defer", deferred.sourceSpan, void 0, void 0, void 0, deferred.i18n);
22258
+ const loadingIndex = loading ? this.createEmbeddedTemplateFn(null, loading.children, "_DeferLoading", loading.sourceSpan, void 0, void 0, void 0, loading.i18n) : null;
22140
22259
  const loadingConsts = loading ? trimTrailingNulls([literal(loading.minimumTime), literal(loading.afterTime)]) : null;
22141
- const placeholderIndex = placeholder ? this.createEmbeddedTemplateFn(null, placeholder.children, "_DeferPlaceholder", placeholder.sourceSpan) : null;
22260
+ const placeholderIndex = placeholder ? this.createEmbeddedTemplateFn(null, placeholder.children, "_DeferPlaceholder", placeholder.sourceSpan, void 0, void 0, void 0, placeholder.i18n) : null;
22142
22261
  const placeholderConsts = placeholder && placeholder.minimumTime !== null ? literalArr([literal(placeholder.minimumTime)]) : null;
22143
- const errorIndex = error2 ? this.createEmbeddedTemplateFn(null, error2.children, "_DeferError", error2.sourceSpan) : null;
22262
+ const errorIndex = error2 ? this.createEmbeddedTemplateFn(null, error2.children, "_DeferError", error2.sourceSpan, void 0, void 0, void 0, error2.i18n) : null;
22144
22263
  const deferredIndex = this.allocateDataSlot();
22145
22264
  const depsFnName = `${this.contextName}_Defer_${deferredIndex}_DepsFn`;
22146
22265
  this.creationInstruction(deferred.sourceSpan, Identifiers.defer, trimTrailingNulls([
@@ -22249,11 +22368,14 @@ var TemplateDefinitionBuilder = class {
22249
22368
  visitForLoopBlock(block) {
22250
22369
  const blockIndex = this.allocateDataSlot();
22251
22370
  const { tagName, attrsExprs } = this.inferProjectionDataFromInsertionPoint(block);
22252
- const primaryData = this.prepareEmbeddedTemplateFn(block.children, "_For", [block.item, block.contextVariables.$index, block.contextVariables.$count]);
22371
+ const primaryData = this.prepareEmbeddedTemplateFn(block.children, "_For", [block.item, block.contextVariables.$index, block.contextVariables.$count], block.i18n, {
22372
+ [block.contextVariables.$index.name]: this.getLevelSpecificVariableName("$index", this.level + 1),
22373
+ [block.contextVariables.$count.name]: this.getLevelSpecificVariableName("$count", this.level + 1)
22374
+ });
22253
22375
  const { expression: trackByExpression, usesComponentInstance: trackByUsesComponentInstance } = this.createTrackByFunction(block);
22254
22376
  let emptyData = null;
22255
22377
  if (block.empty !== null) {
22256
- emptyData = this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty");
22378
+ emptyData = this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty", void 0, block.empty.i18n);
22257
22379
  this.allocateBindingSlots(null);
22258
22380
  }
22259
22381
  this.registerComputedLoopVariables(block, primaryData.scope);
@@ -22275,16 +22397,31 @@ var TemplateDefinitionBuilder = class {
22275
22397
  return params;
22276
22398
  });
22277
22399
  const value = block.expression.visit(this._valueConverter);
22278
- this.updateInstruction(block.sourceSpan, Identifiers.repeater, () => [literal(blockIndex), this.convertPropertyBinding(value)]);
22400
+ this.updateInstructionWithAdvance(blockIndex, block.sourceSpan, Identifiers.repeater, () => [this.convertPropertyBinding(value)]);
22279
22401
  }
22280
22402
  registerComputedLoopVariables(block, bindingScope) {
22281
- const indexLocalName = block.contextVariables.$index.name;
22282
- const countLocalName = block.contextVariables.$count.name;
22283
22403
  const level = bindingScope.bindingLevel;
22284
- bindingScope.set(level, block.contextVariables.$odd.name, (scope) => scope.get(indexLocalName).modulo(literal(2)).notIdentical(literal(0)));
22285
- bindingScope.set(level, block.contextVariables.$even.name, (scope) => scope.get(indexLocalName).modulo(literal(2)).identical(literal(0)));
22286
- bindingScope.set(level, block.contextVariables.$first.name, (scope) => scope.get(indexLocalName).identical(literal(0)));
22287
- bindingScope.set(level, block.contextVariables.$last.name, (scope) => scope.get(indexLocalName).identical(scope.get(countLocalName).minus(literal(1))));
22404
+ bindingScope.set(level, block.contextVariables.$odd.name, (scope, retrievalLevel) => {
22405
+ return this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index").modulo(literal(2)).notIdentical(literal(0));
22406
+ });
22407
+ bindingScope.set(level, block.contextVariables.$even.name, (scope, retrievalLevel) => {
22408
+ return this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index").modulo(literal(2)).identical(literal(0));
22409
+ });
22410
+ bindingScope.set(level, block.contextVariables.$first.name, (scope, retrievalLevel) => {
22411
+ return this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index").identical(literal(0));
22412
+ });
22413
+ bindingScope.set(level, block.contextVariables.$last.name, (scope, retrievalLevel) => {
22414
+ const index = this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index");
22415
+ const count = this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$count");
22416
+ return index.identical(count.minus(literal(1)));
22417
+ });
22418
+ }
22419
+ getLevelSpecificVariableName(name, level) {
22420
+ return `\u0275${name}_${level}`;
22421
+ }
22422
+ getLevelSpecificForLoopVariable(block, scope, retrievalLevel, name) {
22423
+ const scopeName = scope.bindingLevel === retrievalLevel ? block.contextVariables[name].name : this.getLevelSpecificVariableName(name, retrievalLevel);
22424
+ return scope.get(scopeName);
22288
22425
  }
22289
22426
  optimizeTrackByFunction(block) {
22290
22427
  const indexLocalName = block.contextVariables.$index.name;
@@ -22694,7 +22831,7 @@ var BindingScope = class {
22694
22831
  if (value.declareLocalCallback && !value.declare) {
22695
22832
  value.declare = true;
22696
22833
  }
22697
- return typeof value.lhs === "function" ? value.lhs(this) : value.lhs;
22834
+ return typeof value.lhs === "function" ? value.lhs(this, value.retrievalLevel) : value.lhs;
22698
22835
  }
22699
22836
  current = current.parent;
22700
22837
  }
@@ -22770,7 +22907,7 @@ var BindingScope = class {
22770
22907
  const componentValue = this.map.get(SHARED_CONTEXT_KEY + 0);
22771
22908
  componentValue.declare = true;
22772
22909
  this.maybeRestoreView();
22773
- const lhs = typeof componentValue.lhs === "function" ? componentValue.lhs(this) : componentValue.lhs;
22910
+ const lhs = typeof componentValue.lhs === "function" ? componentValue.lhs(this, componentValue.retrievalLevel) : componentValue.lhs;
22774
22911
  return name === DIRECT_CONTEXT_REFERENCE ? lhs : lhs.prop(name);
22775
22912
  }
22776
22913
  maybeRestoreView() {
@@ -24839,7 +24976,7 @@ function publishFacade(global) {
24839
24976
  }
24840
24977
 
24841
24978
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/version.mjs
24842
- var VERSION2 = new Version("17.1.0-next.0");
24979
+ var VERSION2 = new Version("17.1.0-next.1");
24843
24980
 
24844
24981
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
24845
24982
  var _VisitorMode;