@angular/core 16.2.0-next.1 → 16.2.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/esm2022/rxjs-interop/src/take_until_destroyed.mjs +3 -3
  2. package/esm2022/rxjs-interop/src/to_observable.mjs +1 -1
  3. package/esm2022/rxjs-interop/src/to_signal.mjs +1 -1
  4. package/esm2022/src/di/contextual.mjs +10 -7
  5. package/esm2022/src/di/injection_token.mjs +2 -2
  6. package/esm2022/src/di/injector_compatibility.mjs +4 -3
  7. package/esm2022/src/di/interface/defs.mjs +3 -2
  8. package/esm2022/src/di/interface/injector.mjs +2 -2
  9. package/esm2022/src/di/provider_collection.mjs +2 -2
  10. package/esm2022/src/di/r3_injector.mjs +1 -1
  11. package/esm2022/src/errors.mjs +1 -1
  12. package/esm2022/src/linker/template_ref.mjs +1 -1
  13. package/esm2022/src/render3/assert.mjs +8 -3
  14. package/esm2022/src/render3/deps_tracker/api.mjs +1 -1
  15. package/esm2022/src/render3/deps_tracker/deps_tracker.mjs +216 -12
  16. package/esm2022/src/render3/features/standalone_feature.mjs +4 -4
  17. package/esm2022/src/render3/jit/directive.mjs +2 -2
  18. package/esm2022/src/render3/jit/util.mjs +11 -2
  19. package/esm2022/src/render3/pipe.mjs +26 -2
  20. package/esm2022/src/render3/reactivity/effect.mjs +1 -1
  21. package/esm2022/src/signals/src/graph.mjs +7 -3
  22. package/esm2022/src/util/global.mjs +2 -10
  23. package/esm2022/src/util/raf.mjs +20 -5
  24. package/esm2022/src/version.mjs +1 -1
  25. package/esm2022/src/zone/ng_zone.mjs +10 -1
  26. package/esm2022/testing/src/logger.mjs +3 -3
  27. package/esm2022/testing/src/test_hooks.mjs +3 -8
  28. package/fesm2022/core.mjs +97 -34
  29. package/fesm2022/core.mjs.map +1 -1
  30. package/fesm2022/rxjs-interop.mjs +10 -14
  31. package/fesm2022/rxjs-interop.mjs.map +1 -1
  32. package/fesm2022/testing.mjs +85 -51
  33. package/fesm2022/testing.mjs.map +1 -1
  34. package/index.d.ts +35 -19
  35. package/package.json +1 -1
  36. package/rxjs-interop/index.d.ts +15 -12
  37. package/schematics/ng-generate/standalone-migration/bundle.js +1861 -410
  38. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  39. package/testing/index.d.ts +1 -1
@@ -418,9 +418,9 @@ var CssSelector = class {
418
418
  current.setElement(tag);
419
419
  }
420
420
  }
421
- const attribute = match[4];
422
- if (attribute) {
423
- current.addAttribute(current.unescapeAttribute(attribute), match[6]);
421
+ const attribute2 = match[4];
422
+ if (attribute2) {
423
+ current.addAttribute(current.unescapeAttribute(attribute2), match[6]);
424
424
  }
425
425
  if (match[7]) {
426
426
  inNot = false;
@@ -758,6 +758,7 @@ __export(output_ast_exports, {
758
758
  DYNAMIC_TYPE: () => DYNAMIC_TYPE,
759
759
  DeclareFunctionStmt: () => DeclareFunctionStmt,
760
760
  DeclareVarStmt: () => DeclareVarStmt,
761
+ DynamicImportExpr: () => DynamicImportExpr,
761
762
  Expression: () => Expression,
762
763
  ExpressionStatement: () => ExpressionStatement,
763
764
  ExpressionType: () => ExpressionType,
@@ -1516,6 +1517,9 @@ var InvokeFunctionExpr = class extends Expression {
1516
1517
  this.args = args;
1517
1518
  this.pure = pure;
1518
1519
  }
1520
+ get receiver() {
1521
+ return this.fn;
1522
+ }
1519
1523
  isEquivalent(e) {
1520
1524
  return e instanceof InvokeFunctionExpr && this.fn.isEquivalent(e.fn) && areAllEquivalent(this.args, e.args) && this.pure === e.pure;
1521
1525
  }
@@ -1741,6 +1745,24 @@ var ConditionalExpr = class extends Expression {
1741
1745
  return new ConditionalExpr(this.condition.clone(), this.trueCase.clone(), (_a2 = this.falseCase) == null ? void 0 : _a2.clone(), this.type, this.sourceSpan);
1742
1746
  }
1743
1747
  };
1748
+ var DynamicImportExpr = class extends Expression {
1749
+ constructor(url, sourceSpan) {
1750
+ super(null, sourceSpan);
1751
+ this.url = url;
1752
+ }
1753
+ isEquivalent(e) {
1754
+ return e instanceof DynamicImportExpr && this.url === e.url;
1755
+ }
1756
+ isConstant() {
1757
+ return false;
1758
+ }
1759
+ visitExpression(visitor, context) {
1760
+ return visitor.visitDynamicImportExpr(this, context);
1761
+ }
1762
+ clone() {
1763
+ return new DynamicImportExpr(this.url, this.sourceSpan);
1764
+ }
1765
+ };
1744
1766
  var NotExpr = class extends Expression {
1745
1767
  constructor(condition, sourceSpan) {
1746
1768
  super(BOOL_TYPE, sourceSpan);
@@ -1841,6 +1863,9 @@ var ReadPropExpr = class extends Expression {
1841
1863
  this.receiver = receiver;
1842
1864
  this.name = name;
1843
1865
  }
1866
+ get index() {
1867
+ return this.name;
1868
+ }
1844
1869
  isEquivalent(e) {
1845
1870
  return e instanceof ReadPropExpr && this.receiver.isEquivalent(e.receiver) && this.name === e.name;
1846
1871
  }
@@ -2115,6 +2140,9 @@ var RecursiveAstVisitor = class {
2115
2140
  ast.value.visitExpression(this, context);
2116
2141
  return this.visitExpression(ast, context);
2117
2142
  }
2143
+ visitDynamicImportExpr(ast, context) {
2144
+ return this.visitExpression(ast, context);
2145
+ }
2118
2146
  visitInvokeFunctionExpr(ast, context) {
2119
2147
  ast.fn.visitExpression(this, context);
2120
2148
  this.visitAllExpressions(ast.args, context);
@@ -3110,7 +3138,7 @@ var Version = class {
3110
3138
  this.patch = splits.slice(2).join(".");
3111
3139
  }
3112
3140
  };
3113
- var _global = /* @__PURE__ */ (() => typeof global !== "undefined" && global || typeof window !== "undefined" && window || typeof self !== "undefined" && typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope && self)();
3141
+ var _global = globalThis;
3114
3142
  function partitionArray(arr, conditionFn) {
3115
3143
  const truthy = [];
3116
3144
  const falsy = [];
@@ -3544,6 +3572,9 @@ var AbstractEmitterVisitor = class {
3544
3572
  ctx.print(ast, `)`);
3545
3573
  return null;
3546
3574
  }
3575
+ visitDynamicImportExpr(ast, ctx) {
3576
+ ctx.print(ast, `import(${ast.url})`);
3577
+ }
3547
3578
  visitNotExpr(ast, ctx) {
3548
3579
  ctx.print(ast, "!");
3549
3580
  ast.condition.visitExpression(this, ctx);
@@ -4041,6 +4072,96 @@ var Element = class {
4041
4072
  return visitor.visitElement(this);
4042
4073
  }
4043
4074
  };
4075
+ var DeferredTrigger = class {
4076
+ constructor(sourceSpan) {
4077
+ this.sourceSpan = sourceSpan;
4078
+ }
4079
+ visit(visitor) {
4080
+ return visitor.visitDeferredTrigger(this);
4081
+ }
4082
+ };
4083
+ var BoundDeferredTrigger = class extends DeferredTrigger {
4084
+ constructor(value, sourceSpan) {
4085
+ super(sourceSpan);
4086
+ this.value = value;
4087
+ }
4088
+ };
4089
+ var IdleDeferredTrigger = class extends DeferredTrigger {
4090
+ };
4091
+ var ImmediateDeferredTrigger = class extends DeferredTrigger {
4092
+ };
4093
+ var HoverDeferredTrigger = class extends DeferredTrigger {
4094
+ };
4095
+ var TimerDeferredTrigger = class extends DeferredTrigger {
4096
+ constructor(delay, sourceSpan) {
4097
+ super(sourceSpan);
4098
+ this.delay = delay;
4099
+ }
4100
+ };
4101
+ var InteractionDeferredTrigger = class extends DeferredTrigger {
4102
+ constructor(reference2, sourceSpan) {
4103
+ super(sourceSpan);
4104
+ this.reference = reference2;
4105
+ }
4106
+ };
4107
+ var ViewportDeferredTrigger = class extends DeferredTrigger {
4108
+ constructor(reference2, sourceSpan) {
4109
+ super(sourceSpan);
4110
+ this.reference = reference2;
4111
+ }
4112
+ };
4113
+ var DeferredBlockPlaceholder = class {
4114
+ constructor(children, minimumTime, sourceSpan, startSourceSpan, endSourceSpan) {
4115
+ this.children = children;
4116
+ this.minimumTime = minimumTime;
4117
+ this.sourceSpan = sourceSpan;
4118
+ this.startSourceSpan = startSourceSpan;
4119
+ this.endSourceSpan = endSourceSpan;
4120
+ }
4121
+ visit(visitor) {
4122
+ return visitor.visitDeferredBlockPlaceholder(this);
4123
+ }
4124
+ };
4125
+ var DeferredBlockLoading = class {
4126
+ constructor(children, afterTime, minimumTime, sourceSpan, startSourceSpan, endSourceSpan) {
4127
+ this.children = children;
4128
+ this.afterTime = afterTime;
4129
+ this.minimumTime = minimumTime;
4130
+ this.sourceSpan = sourceSpan;
4131
+ this.startSourceSpan = startSourceSpan;
4132
+ this.endSourceSpan = endSourceSpan;
4133
+ }
4134
+ visit(visitor) {
4135
+ return visitor.visitDeferredBlockLoading(this);
4136
+ }
4137
+ };
4138
+ var DeferredBlockError = class {
4139
+ constructor(children, sourceSpan, startSourceSpan, endSourceSpan) {
4140
+ this.children = children;
4141
+ this.sourceSpan = sourceSpan;
4142
+ this.startSourceSpan = startSourceSpan;
4143
+ this.endSourceSpan = endSourceSpan;
4144
+ }
4145
+ visit(visitor) {
4146
+ return visitor.visitDeferredBlockError(this);
4147
+ }
4148
+ };
4149
+ var DeferredBlock = class {
4150
+ constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, sourceSpan, startSourceSpan, endSourceSpan) {
4151
+ this.children = children;
4152
+ this.triggers = triggers;
4153
+ this.prefetchTriggers = prefetchTriggers;
4154
+ this.placeholder = placeholder;
4155
+ this.loading = loading;
4156
+ this.error = error2;
4157
+ this.sourceSpan = sourceSpan;
4158
+ this.startSourceSpan = startSourceSpan;
4159
+ this.endSourceSpan = endSourceSpan;
4160
+ }
4161
+ visit(visitor) {
4162
+ return visitor.visitDeferredBlock(this);
4163
+ }
4164
+ };
4044
4165
  var Template = class {
4045
4166
  constructor(tagName, attributes, inputs, outputs, templateAttrs, children, references, variables, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
4046
4167
  this.tagName = tagName;
@@ -4123,17 +4244,35 @@ var RecursiveVisitor = class {
4123
4244
  visitAll(this, template2.references);
4124
4245
  visitAll(this, template2.variables);
4125
4246
  }
4247
+ visitDeferredBlock(deferred) {
4248
+ var _a2, _b2, _c2;
4249
+ visitAll(this, deferred.triggers);
4250
+ visitAll(this, deferred.prefetchTriggers);
4251
+ visitAll(this, deferred.children);
4252
+ (_a2 = deferred.placeholder) == null ? void 0 : _a2.visit(this);
4253
+ (_b2 = deferred.loading) == null ? void 0 : _b2.visit(this);
4254
+ (_c2 = deferred.error) == null ? void 0 : _c2.visit(this);
4255
+ }
4256
+ visitDeferredBlockPlaceholder(block) {
4257
+ visitAll(this, block.children);
4258
+ }
4259
+ visitDeferredBlockError(block) {
4260
+ visitAll(this, block.children);
4261
+ }
4262
+ visitDeferredBlockLoading(block) {
4263
+ visitAll(this, block.children);
4264
+ }
4126
4265
  visitContent(content) {
4127
4266
  }
4128
4267
  visitVariable(variable2) {
4129
4268
  }
4130
4269
  visitReference(reference2) {
4131
4270
  }
4132
- visitTextAttribute(attribute) {
4271
+ visitTextAttribute(attribute2) {
4133
4272
  }
4134
- visitBoundAttribute(attribute) {
4273
+ visitBoundAttribute(attribute2) {
4135
4274
  }
4136
- visitBoundEvent(attribute) {
4275
+ visitBoundEvent(attribute2) {
4137
4276
  }
4138
4277
  visitText(text2) {
4139
4278
  }
@@ -4141,6 +4280,8 @@ var RecursiveVisitor = class {
4141
4280
  }
4142
4281
  visitIcu(icu) {
4143
4282
  }
4283
+ visitDeferredTrigger(trigger) {
4284
+ }
4144
4285
  };
4145
4286
  function visitAll(visitor, nodes) {
4146
4287
  const result = [];
@@ -5516,37 +5657,47 @@ var R3SelectorScopeMode;
5516
5657
  R3SelectorScopeMode2[R3SelectorScopeMode2["SideEffect"] = 1] = "SideEffect";
5517
5658
  R3SelectorScopeMode2[R3SelectorScopeMode2["Omit"] = 2] = "Omit";
5518
5659
  })(R3SelectorScopeMode || (R3SelectorScopeMode = {}));
5660
+ var R3NgModuleMetadataKind;
5661
+ (function(R3NgModuleMetadataKind2) {
5662
+ R3NgModuleMetadataKind2[R3NgModuleMetadataKind2["Global"] = 0] = "Global";
5663
+ R3NgModuleMetadataKind2[R3NgModuleMetadataKind2["Local"] = 1] = "Local";
5664
+ })(R3NgModuleMetadataKind || (R3NgModuleMetadataKind = {}));
5519
5665
  function compileNgModule(meta) {
5520
- const { type: moduleType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls, selectorScopeMode, id } = meta;
5521
5666
  const statements = [];
5522
5667
  const definitionMap = new DefinitionMap();
5523
- definitionMap.set("type", moduleType.value);
5524
- if (bootstrap.length > 0) {
5525
- definitionMap.set("bootstrap", refsToArray(bootstrap, containsForwardDecls));
5668
+ definitionMap.set("type", meta.type.value);
5669
+ if (meta.kind === R3NgModuleMetadataKind.Global) {
5670
+ if (meta.bootstrap.length > 0) {
5671
+ definitionMap.set("bootstrap", refsToArray(meta.bootstrap, meta.containsForwardDecls));
5672
+ }
5673
+ } else {
5674
+ if (meta.bootstrapExpression) {
5675
+ definitionMap.set("bootstrap", meta.bootstrapExpression);
5676
+ }
5526
5677
  }
5527
- if (selectorScopeMode === R3SelectorScopeMode.Inline) {
5528
- if (declarations.length > 0) {
5529
- definitionMap.set("declarations", refsToArray(declarations, containsForwardDecls));
5678
+ if (meta.selectorScopeMode === R3SelectorScopeMode.Inline) {
5679
+ if (meta.declarations.length > 0) {
5680
+ definitionMap.set("declarations", refsToArray(meta.declarations, meta.containsForwardDecls));
5530
5681
  }
5531
- if (imports.length > 0) {
5532
- definitionMap.set("imports", refsToArray(imports, containsForwardDecls));
5682
+ if (meta.imports.length > 0) {
5683
+ definitionMap.set("imports", refsToArray(meta.imports, meta.containsForwardDecls));
5533
5684
  }
5534
- if (exports.length > 0) {
5535
- definitionMap.set("exports", refsToArray(exports, containsForwardDecls));
5685
+ if (meta.exports.length > 0) {
5686
+ definitionMap.set("exports", refsToArray(meta.exports, meta.containsForwardDecls));
5536
5687
  }
5537
- } else if (selectorScopeMode === R3SelectorScopeMode.SideEffect) {
5688
+ } else if (meta.selectorScopeMode === R3SelectorScopeMode.SideEffect) {
5538
5689
  const setNgModuleScopeCall = generateSetNgModuleScopeCall(meta);
5539
5690
  if (setNgModuleScopeCall !== null) {
5540
5691
  statements.push(setNgModuleScopeCall);
5541
5692
  }
5542
5693
  } else {
5543
5694
  }
5544
- if (schemas !== null && schemas.length > 0) {
5545
- definitionMap.set("schemas", literalArr(schemas.map((ref) => ref.value)));
5695
+ if (meta.schemas !== null && meta.schemas.length > 0) {
5696
+ definitionMap.set("schemas", literalArr(meta.schemas.map((ref) => ref.value)));
5546
5697
  }
5547
- if (id !== null) {
5548
- definitionMap.set("id", id);
5549
- statements.push(importExpr(Identifiers.registerNgModuleType).callFn([moduleType.value, id]).toStmt());
5698
+ if (meta.id !== null) {
5699
+ definitionMap.set("id", meta.id);
5700
+ statements.push(importExpr(Identifiers.registerNgModuleType).callFn([meta.type.value, meta.id]).toStmt());
5550
5701
  }
5551
5702
  const expression = importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()], void 0, true);
5552
5703
  const type = createNgModuleType(meta);
@@ -5575,7 +5726,11 @@ function compileNgModuleDeclarationExpression(meta) {
5575
5726
  }
5576
5727
  return importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()]);
5577
5728
  }
5578
- function createNgModuleType({ type: moduleType, declarations, exports, imports, includeImportTypes, publicDeclarationTypes }) {
5729
+ function createNgModuleType(meta) {
5730
+ if (meta.kind === R3NgModuleMetadataKind.Local) {
5731
+ return new ExpressionType(meta.type.value);
5732
+ }
5733
+ const { type: moduleType, declarations, exports, imports, includeImportTypes, publicDeclarationTypes } = meta;
5579
5734
  return new ExpressionType(importExpr(Identifiers.NgModuleDeclaration, [
5580
5735
  new ExpressionType(moduleType.type),
5581
5736
  publicDeclarationTypes === null ? tupleTypeOf(declarations) : tupleOfTypes(publicDeclarationTypes),
@@ -5584,23 +5739,40 @@ function createNgModuleType({ type: moduleType, declarations, exports, imports,
5584
5739
  ]));
5585
5740
  }
5586
5741
  function generateSetNgModuleScopeCall(meta) {
5587
- const { type: moduleType, declarations, imports, exports, containsForwardDecls } = meta;
5588
5742
  const scopeMap = new DefinitionMap();
5589
- if (declarations.length > 0) {
5590
- scopeMap.set("declarations", refsToArray(declarations, containsForwardDecls));
5743
+ if (meta.kind === R3NgModuleMetadataKind.Global) {
5744
+ if (meta.declarations.length > 0) {
5745
+ scopeMap.set("declarations", refsToArray(meta.declarations, meta.containsForwardDecls));
5746
+ }
5747
+ } else {
5748
+ if (meta.declarationsExpression) {
5749
+ scopeMap.set("declarations", meta.declarationsExpression);
5750
+ }
5591
5751
  }
5592
- if (imports.length > 0) {
5593
- scopeMap.set("imports", refsToArray(imports, containsForwardDecls));
5752
+ if (meta.kind === R3NgModuleMetadataKind.Global) {
5753
+ if (meta.imports.length > 0) {
5754
+ scopeMap.set("imports", refsToArray(meta.imports, meta.containsForwardDecls));
5755
+ }
5756
+ } else {
5757
+ if (meta.importsExpression) {
5758
+ scopeMap.set("imports", meta.importsExpression);
5759
+ }
5594
5760
  }
5595
- if (exports.length > 0) {
5596
- scopeMap.set("exports", refsToArray(exports, containsForwardDecls));
5761
+ if (meta.kind === R3NgModuleMetadataKind.Global) {
5762
+ if (meta.exports.length > 0) {
5763
+ scopeMap.set("exports", refsToArray(meta.exports, meta.containsForwardDecls));
5764
+ }
5765
+ } else {
5766
+ if (meta.exportsExpression) {
5767
+ scopeMap.set("exports", meta.exportsExpression);
5768
+ }
5597
5769
  }
5598
5770
  if (Object.keys(scopeMap.values).length === 0) {
5599
5771
  return null;
5600
5772
  }
5601
5773
  const fnCall = new InvokeFunctionExpr(
5602
5774
  importExpr(Identifiers.setNgModuleScope),
5603
- [moduleType.value, scopeMap.toLiteralMap()]
5775
+ [meta.type.value, scopeMap.toLiteralMap()]
5604
5776
  );
5605
5777
  const guardedCall = jitOnlyGuardedExpression(fnCall);
5606
5778
  const iife = new FunctionExpr(
@@ -7161,7 +7333,7 @@ var ShadowCss = class {
7161
7333
  let content = rule.content;
7162
7334
  if (rule.selector[0] !== "@") {
7163
7335
  selector = this._scopeSelector(rule.selector, scopeSelector, hostSelector);
7164
- } else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@document") || rule.selector.startsWith("@layer") || rule.selector.startsWith("@container")) {
7336
+ } else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@document") || rule.selector.startsWith("@layer") || rule.selector.startsWith("@container") || rule.selector.startsWith("@scope")) {
7165
7337
  content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
7166
7338
  } else if (rule.selector.startsWith("@font-face") || rule.selector.startsWith("@page")) {
7167
7339
  content = this._stripScopingSelectors(rule.content);
@@ -7595,13 +7767,17 @@ var OpKind;
7595
7767
  OpKind2[OpKind2["InterpolateText"] = 12] = "InterpolateText";
7596
7768
  OpKind2[OpKind2["Property"] = 13] = "Property";
7597
7769
  OpKind2[OpKind2["StyleProp"] = 14] = "StyleProp";
7598
- OpKind2[OpKind2["StyleMap"] = 15] = "StyleMap";
7599
- OpKind2[OpKind2["InterpolateProperty"] = 16] = "InterpolateProperty";
7600
- OpKind2[OpKind2["InterpolateStyleProp"] = 17] = "InterpolateStyleProp";
7601
- OpKind2[OpKind2["InterpolateStyleMap"] = 18] = "InterpolateStyleMap";
7602
- OpKind2[OpKind2["Advance"] = 19] = "Advance";
7603
- OpKind2[OpKind2["Pipe"] = 20] = "Pipe";
7604
- OpKind2[OpKind2["Attribute"] = 21] = "Attribute";
7770
+ OpKind2[OpKind2["ClassProp"] = 15] = "ClassProp";
7771
+ OpKind2[OpKind2["StyleMap"] = 16] = "StyleMap";
7772
+ OpKind2[OpKind2["ClassMap"] = 17] = "ClassMap";
7773
+ OpKind2[OpKind2["InterpolateProperty"] = 18] = "InterpolateProperty";
7774
+ OpKind2[OpKind2["InterpolateStyleProp"] = 19] = "InterpolateStyleProp";
7775
+ OpKind2[OpKind2["InterpolateStyleMap"] = 20] = "InterpolateStyleMap";
7776
+ OpKind2[OpKind2["InterpolateClassMap"] = 21] = "InterpolateClassMap";
7777
+ OpKind2[OpKind2["Advance"] = 22] = "Advance";
7778
+ OpKind2[OpKind2["Pipe"] = 23] = "Pipe";
7779
+ OpKind2[OpKind2["Attribute"] = 24] = "Attribute";
7780
+ OpKind2[OpKind2["InterpolateAttribute"] = 25] = "InterpolateAttribute";
7605
7781
  })(OpKind || (OpKind = {}));
7606
7782
  var ExpressionKind;
7607
7783
  (function(ExpressionKind2) {
@@ -7622,6 +7798,8 @@ var ExpressionKind;
7622
7798
  ExpressionKind2[ExpressionKind2["SafeInvokeFunction"] = 14] = "SafeInvokeFunction";
7623
7799
  ExpressionKind2[ExpressionKind2["SafeTernaryExpr"] = 15] = "SafeTernaryExpr";
7624
7800
  ExpressionKind2[ExpressionKind2["EmptyExpr"] = 16] = "EmptyExpr";
7801
+ ExpressionKind2[ExpressionKind2["AssignTemporaryExpr"] = 17] = "AssignTemporaryExpr";
7802
+ ExpressionKind2[ExpressionKind2["ReadTemporaryExpr"] = 18] = "ReadTemporaryExpr";
7625
7803
  })(ExpressionKind || (ExpressionKind = {}));
7626
7804
  var SemanticVariableKind;
7627
7805
  (function(SemanticVariableKind2) {
@@ -8030,7 +8208,11 @@ var SafePropertyReadExpr = class extends ExpressionBase {
8030
8208
  this.name = name;
8031
8209
  this.kind = ExpressionKind.SafePropertyRead;
8032
8210
  }
8211
+ get index() {
8212
+ return this.name;
8213
+ }
8033
8214
  visitExpression(visitor, context) {
8215
+ this.receiver.visitExpression(visitor, context);
8034
8216
  }
8035
8217
  isEquivalent() {
8036
8218
  return false;
@@ -8053,6 +8235,8 @@ var SafeKeyedReadExpr = class extends ExpressionBase {
8053
8235
  this.kind = ExpressionKind.SafeKeyedRead;
8054
8236
  }
8055
8237
  visitExpression(visitor, context) {
8238
+ this.receiver.visitExpression(visitor, context);
8239
+ this.index.visitExpression(visitor, context);
8056
8240
  }
8057
8241
  isEquivalent() {
8058
8242
  return false;
@@ -8076,6 +8260,10 @@ var SafeInvokeFunctionExpr = class extends ExpressionBase {
8076
8260
  this.kind = ExpressionKind.SafeInvokeFunction;
8077
8261
  }
8078
8262
  visitExpression(visitor, context) {
8263
+ this.receiver.visitExpression(visitor, context);
8264
+ for (const a of this.args) {
8265
+ a.visitExpression(visitor, context);
8266
+ }
8079
8267
  }
8080
8268
  isEquivalent() {
8081
8269
  return false;
@@ -8101,6 +8289,8 @@ var SafeTernaryExpr = class extends ExpressionBase {
8101
8289
  this.kind = ExpressionKind.SafeTernaryExpr;
8102
8290
  }
8103
8291
  visitExpression(visitor, context) {
8292
+ this.guard.visitExpression(visitor, context);
8293
+ this.expr.visitExpression(visitor, context);
8104
8294
  }
8105
8295
  isEquivalent() {
8106
8296
  return false;
@@ -8135,6 +8325,55 @@ var EmptyExpr2 = class extends ExpressionBase {
8135
8325
  transformInternalExpressions() {
8136
8326
  }
8137
8327
  };
8328
+ var AssignTemporaryExpr = class extends ExpressionBase {
8329
+ constructor(expr, xref) {
8330
+ super();
8331
+ this.expr = expr;
8332
+ this.xref = xref;
8333
+ this.kind = ExpressionKind.AssignTemporaryExpr;
8334
+ this.name = null;
8335
+ }
8336
+ visitExpression(visitor, context) {
8337
+ this.expr.visitExpression(visitor, context);
8338
+ }
8339
+ isEquivalent() {
8340
+ return false;
8341
+ }
8342
+ isConstant() {
8343
+ return false;
8344
+ }
8345
+ transformInternalExpressions(transform, flags) {
8346
+ this.expr = transformExpressionsInExpression(this.expr, transform, flags);
8347
+ }
8348
+ clone() {
8349
+ const a = new AssignTemporaryExpr(this.expr, this.xref);
8350
+ a.name = this.name;
8351
+ return a;
8352
+ }
8353
+ };
8354
+ var ReadTemporaryExpr = class extends ExpressionBase {
8355
+ constructor(xref) {
8356
+ super();
8357
+ this.xref = xref;
8358
+ this.kind = ExpressionKind.ReadTemporaryExpr;
8359
+ this.name = null;
8360
+ }
8361
+ visitExpression(visitor, context) {
8362
+ }
8363
+ isEquivalent() {
8364
+ return this.xref === this.xref;
8365
+ }
8366
+ isConstant() {
8367
+ return false;
8368
+ }
8369
+ transformInternalExpressions(transform, flags) {
8370
+ }
8371
+ clone() {
8372
+ const r = new ReadTemporaryExpr(this.xref);
8373
+ r.name = this.name;
8374
+ return r;
8375
+ }
8376
+ };
8138
8377
  function visitExpressionsInOp(op, visitor) {
8139
8378
  transformExpressionsInOp(op, (expr, flags) => {
8140
8379
  visitor(expr, flags);
@@ -8151,11 +8390,14 @@ function transformExpressionsInOp(op, transform, flags) {
8151
8390
  case OpKind.Property:
8152
8391
  case OpKind.StyleProp:
8153
8392
  case OpKind.StyleMap:
8393
+ case OpKind.ClassProp:
8394
+ case OpKind.ClassMap:
8154
8395
  op.expression = transformExpressionsInExpression(op.expression, transform, flags);
8155
8396
  break;
8156
8397
  case OpKind.InterpolateProperty:
8157
8398
  case OpKind.InterpolateStyleProp:
8158
8399
  case OpKind.InterpolateStyleMap:
8400
+ case OpKind.InterpolateClassMap:
8159
8401
  case OpKind.InterpolateText:
8160
8402
  for (let i = 0; i < op.expressions.length; i++) {
8161
8403
  op.expressions[i] = transformExpressionsInExpression(op.expressions[i], transform, flags);
@@ -8166,7 +8408,12 @@ function transformExpressionsInOp(op, transform, flags) {
8166
8408
  break;
8167
8409
  case OpKind.Attribute:
8168
8410
  if (op.value) {
8169
- transformExpressionsInExpression(op.value, transform, flags);
8411
+ op.value = transformExpressionsInExpression(op.value, transform, flags);
8412
+ }
8413
+ break;
8414
+ case OpKind.InterpolateAttribute:
8415
+ for (let i = 0; i < op.expressions.length; i++) {
8416
+ op.expressions[i] = transformExpressionsInExpression(op.expressions[i], transform, flags);
8170
8417
  }
8171
8418
  break;
8172
8419
  case OpKind.Variable:
@@ -8240,6 +8487,10 @@ function transformExpressionsInStatement(stmt, transform, flags) {
8240
8487
  stmt.expr = transformExpressionsInExpression(stmt.expr, transform, flags);
8241
8488
  } else if (stmt instanceof ReturnStatement) {
8242
8489
  stmt.value = transformExpressionsInExpression(stmt.value, transform, flags);
8490
+ } else if (stmt instanceof DeclareVarStmt) {
8491
+ if (stmt.value !== void 0) {
8492
+ stmt.value = transformExpressionsInExpression(stmt.value, transform, flags);
8493
+ }
8243
8494
  } else {
8244
8495
  throw new Error(`Unhandled statement kind: ${stmt.constructor.name}`);
8245
8496
  }
@@ -8521,6 +8772,14 @@ function createStylePropOp(xref, name, expression, unit) {
8521
8772
  unit
8522
8773
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
8523
8774
  }
8775
+ function createClassPropOp(xref, name, expression) {
8776
+ return __spreadValues(__spreadValues(__spreadValues({
8777
+ kind: OpKind.ClassProp,
8778
+ target: xref,
8779
+ name,
8780
+ expression
8781
+ }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
8782
+ }
8524
8783
  function createStyleMapOp(xref, expression) {
8525
8784
  return __spreadValues(__spreadValues(__spreadValues({
8526
8785
  kind: OpKind.StyleMap,
@@ -8528,14 +8787,21 @@ function createStyleMapOp(xref, expression) {
8528
8787
  expression
8529
8788
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
8530
8789
  }
8790
+ function createClassMapOp(xref, expression) {
8791
+ return __spreadValues(__spreadValues(__spreadValues({
8792
+ kind: OpKind.ClassMap,
8793
+ target: xref,
8794
+ expression
8795
+ }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
8796
+ }
8531
8797
  function createAttributeOp(target, attributeKind, name, value) {
8532
- return __spreadValues({
8798
+ return __spreadValues(__spreadValues(__spreadValues({
8533
8799
  kind: OpKind.Attribute,
8534
8800
  target,
8535
8801
  attributeKind,
8536
8802
  name,
8537
8803
  value
8538
- }, NEW_OP);
8804
+ }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
8539
8805
  }
8540
8806
  function createInterpolatePropertyOp(xref, bindingKind, name, strings, expressions) {
8541
8807
  return __spreadValues(__spreadValues(__spreadValues({
@@ -8547,6 +8813,16 @@ function createInterpolatePropertyOp(xref, bindingKind, name, strings, expressio
8547
8813
  expressions
8548
8814
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
8549
8815
  }
8816
+ function createInterpolateAttributeOp(target, attributeKind, name, strings, expressions) {
8817
+ return __spreadValues(__spreadValues(__spreadValues({
8818
+ kind: OpKind.InterpolateAttribute,
8819
+ target,
8820
+ attributeKind,
8821
+ name,
8822
+ strings,
8823
+ expressions
8824
+ }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
8825
+ }
8550
8826
  function createInterpolateStylePropOp(xref, name, strings, expressions, unit) {
8551
8827
  return __spreadValues(__spreadValues(__spreadValues({
8552
8828
  kind: OpKind.InterpolateStyleProp,
@@ -8565,6 +8841,14 @@ function createInterpolateStyleMapOp(xref, strings, expressions) {
8565
8841
  expressions
8566
8842
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
8567
8843
  }
8844
+ function createInterpolateClassMapOp(xref, strings, expressions) {
8845
+ return __spreadValues(__spreadValues(__spreadValues({
8846
+ kind: OpKind.InterpolateClassMap,
8847
+ target: xref,
8848
+ strings,
8849
+ expressions
8850
+ }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
8851
+ }
8568
8852
  function createAdvanceOp(delta) {
8569
8853
  return __spreadValues({
8570
8854
  kind: OpKind.Advance,
@@ -8607,15 +8891,23 @@ function phaseVarCounting(cpl) {
8607
8891
  function varsUsedByOp(op) {
8608
8892
  switch (op.kind) {
8609
8893
  case OpKind.Property:
8894
+ case OpKind.Attribute:
8895
+ return 1;
8610
8896
  case OpKind.StyleProp:
8897
+ case OpKind.ClassProp:
8611
8898
  case OpKind.StyleMap:
8612
- return 1;
8899
+ case OpKind.ClassMap:
8900
+ return 2;
8613
8901
  case OpKind.InterpolateText:
8614
8902
  return op.expressions.length;
8615
8903
  case OpKind.InterpolateProperty:
8904
+ return 1 + op.expressions.length;
8905
+ case OpKind.InterpolateAttribute:
8906
+ return 1 + op.expressions.length;
8616
8907
  case OpKind.InterpolateStyleProp:
8617
8908
  case OpKind.InterpolateStyleMap:
8618
- return 1 + op.expressions.length;
8909
+ case OpKind.InterpolateClassMap:
8910
+ return 2 + op.expressions.length;
8619
8911
  default:
8620
8912
  throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
8621
8913
  }
@@ -8706,6 +8998,7 @@ function populateElementAttributes(view, compatibility) {
8706
8998
  ownerOp.attributes.add(op.bindingKind, op.name, null);
8707
8999
  break;
8708
9000
  case OpKind.StyleProp:
9001
+ case OpKind.ClassProp:
8709
9002
  ownerOp = lookupElement(elements, op.target);
8710
9003
  assertIsElementAttributes(ownerOp.attributes);
8711
9004
  if (removeIfExpressionIsEmpty(op, op.expression) && compatibility) {
@@ -8730,6 +9023,17 @@ var CHAINABLE = /* @__PURE__ */ new Set([
8730
9023
  Identifiers.elementEnd,
8731
9024
  Identifiers.property,
8732
9025
  Identifiers.styleProp,
9026
+ Identifiers.attribute,
9027
+ Identifiers.stylePropInterpolate1,
9028
+ Identifiers.stylePropInterpolate2,
9029
+ Identifiers.stylePropInterpolate3,
9030
+ Identifiers.stylePropInterpolate4,
9031
+ Identifiers.stylePropInterpolate5,
9032
+ Identifiers.stylePropInterpolate6,
9033
+ Identifiers.stylePropInterpolate7,
9034
+ Identifiers.stylePropInterpolate8,
9035
+ Identifiers.stylePropInterpolateV,
9036
+ Identifiers.classProp,
8733
9037
  Identifiers.elementContainerStart,
8734
9038
  Identifiers.elementContainerEnd,
8735
9039
  Identifiers.elementContainer
@@ -8833,6 +9137,138 @@ function phaseEmptyElements(cpl) {
8833
9137
  }
8834
9138
  }
8835
9139
 
9140
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/expand_safe_reads.mjs
9141
+ function phaseExpandSafeReads(cpl, compatibility) {
9142
+ for (const [_, view] of cpl.views) {
9143
+ for (const op of view.ops()) {
9144
+ transformExpressionsInOp(op, (e) => safeTransform(e, { cpl, compatibility }), VisitorContextFlag.None);
9145
+ transformExpressionsInOp(op, ternaryTransform, VisitorContextFlag.None);
9146
+ }
9147
+ }
9148
+ }
9149
+ var requiresTemporary = [
9150
+ InvokeFunctionExpr,
9151
+ LiteralArrayExpr,
9152
+ LiteralMapExpr,
9153
+ SafeInvokeFunctionExpr,
9154
+ PipeBindingExpr
9155
+ ].map((e) => e.constructor.name);
9156
+ function needsTemporaryInSafeAccess(e) {
9157
+ if (e instanceof UnaryOperatorExpr) {
9158
+ return needsTemporaryInSafeAccess(e.expr);
9159
+ } else if (e instanceof BinaryOperatorExpr) {
9160
+ return needsTemporaryInSafeAccess(e.lhs) || needsTemporaryInSafeAccess(e.rhs);
9161
+ } else if (e instanceof ConditionalExpr) {
9162
+ if (e.falseCase && needsTemporaryInSafeAccess(e.falseCase))
9163
+ return true;
9164
+ return needsTemporaryInSafeAccess(e.condition) || needsTemporaryInSafeAccess(e.trueCase);
9165
+ } else if (e instanceof NotExpr) {
9166
+ return needsTemporaryInSafeAccess(e.condition);
9167
+ } else if (e instanceof AssignTemporaryExpr) {
9168
+ return needsTemporaryInSafeAccess(e.expr);
9169
+ } else if (e instanceof ReadPropExpr) {
9170
+ return needsTemporaryInSafeAccess(e.receiver);
9171
+ } else if (e instanceof ReadKeyExpr) {
9172
+ return needsTemporaryInSafeAccess(e.receiver) || needsTemporaryInSafeAccess(e.index);
9173
+ }
9174
+ return e instanceof InvokeFunctionExpr || e instanceof LiteralArrayExpr || e instanceof LiteralMapExpr || e instanceof SafeInvokeFunctionExpr || e instanceof PipeBindingExpr;
9175
+ }
9176
+ function temporariesIn(e) {
9177
+ const temporaries = /* @__PURE__ */ new Set();
9178
+ transformExpressionsInExpression(e, (e2) => {
9179
+ if (e2 instanceof AssignTemporaryExpr) {
9180
+ temporaries.add(e2.xref);
9181
+ }
9182
+ return e2;
9183
+ }, VisitorContextFlag.None);
9184
+ return temporaries;
9185
+ }
9186
+ function eliminateTemporaryAssignments(e, tmps, ctx) {
9187
+ transformExpressionsInExpression(e, (e2) => {
9188
+ if (e2 instanceof AssignTemporaryExpr && tmps.has(e2.xref)) {
9189
+ const read = new ReadTemporaryExpr(e2.xref);
9190
+ return ctx.compatibility ? new AssignTemporaryExpr(read, read.xref) : read;
9191
+ }
9192
+ return e2;
9193
+ }, VisitorContextFlag.None);
9194
+ return e;
9195
+ }
9196
+ function safeTernaryWithTemporary(guard, body, ctx) {
9197
+ let result;
9198
+ if (needsTemporaryInSafeAccess(guard)) {
9199
+ const xref = ctx.cpl.allocateXrefId();
9200
+ result = [new AssignTemporaryExpr(guard, xref), new ReadTemporaryExpr(xref)];
9201
+ } else {
9202
+ result = [guard, guard.clone()];
9203
+ eliminateTemporaryAssignments(result[1], temporariesIn(result[0]), ctx);
9204
+ }
9205
+ return new SafeTernaryExpr(result[0], body(result[1]));
9206
+ }
9207
+ function isSafeAccessExpression(e) {
9208
+ return e instanceof SafePropertyReadExpr || e instanceof SafeKeyedReadExpr;
9209
+ }
9210
+ function isUnsafeAccessExpression(e) {
9211
+ return e instanceof ReadPropExpr || e instanceof ReadKeyExpr || e instanceof InvokeFunctionExpr;
9212
+ }
9213
+ function isAccessExpression(e) {
9214
+ return isSafeAccessExpression(e) || isUnsafeAccessExpression(e);
9215
+ }
9216
+ function deepestSafeTernary(e) {
9217
+ if (isAccessExpression(e) && e.receiver instanceof SafeTernaryExpr) {
9218
+ let st = e.receiver;
9219
+ while (st.expr instanceof SafeTernaryExpr) {
9220
+ st = st.expr;
9221
+ }
9222
+ return st;
9223
+ }
9224
+ return null;
9225
+ }
9226
+ function safeTransform(e, ctx) {
9227
+ if (e instanceof SafeInvokeFunctionExpr) {
9228
+ return new InvokeFunctionExpr(e.receiver, e.args);
9229
+ }
9230
+ if (!isAccessExpression(e)) {
9231
+ return e;
9232
+ }
9233
+ const dst = deepestSafeTernary(e);
9234
+ if (dst) {
9235
+ if (e instanceof InvokeFunctionExpr) {
9236
+ dst.expr = dst.expr.callFn(e.args);
9237
+ return e.receiver;
9238
+ }
9239
+ if (e instanceof ReadPropExpr) {
9240
+ dst.expr = dst.expr.prop(e.name);
9241
+ return e.receiver;
9242
+ }
9243
+ if (e instanceof ReadKeyExpr) {
9244
+ dst.expr = dst.expr.key(e.index);
9245
+ return e.receiver;
9246
+ }
9247
+ if (e instanceof SafePropertyReadExpr) {
9248
+ dst.expr = safeTernaryWithTemporary(dst.expr, (r) => r.prop(e.name), ctx);
9249
+ return e.receiver;
9250
+ }
9251
+ if (e instanceof SafeKeyedReadExpr) {
9252
+ dst.expr = safeTernaryWithTemporary(dst.expr, (r) => r.key(e.index), ctx);
9253
+ return e.receiver;
9254
+ }
9255
+ } else {
9256
+ if (e instanceof SafePropertyReadExpr) {
9257
+ return safeTernaryWithTemporary(e.receiver, (r) => r.prop(e.name), ctx);
9258
+ }
9259
+ if (e instanceof SafeKeyedReadExpr) {
9260
+ return safeTernaryWithTemporary(e.receiver, (r) => r.key(e.index), ctx);
9261
+ }
9262
+ }
9263
+ return e;
9264
+ }
9265
+ function ternaryTransform(e) {
9266
+ if (!(e instanceof SafeTernaryExpr)) {
9267
+ return e;
9268
+ }
9269
+ return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
9270
+ }
9271
+
8836
9272
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_advance.mjs
8837
9273
  function phaseGenerateAdvance(cpl) {
8838
9274
  for (const [_, view] of cpl.views) {
@@ -8865,28 +9301,12 @@ function phaseGenerateAdvance(cpl) {
8865
9301
  }
8866
9302
  }
8867
9303
 
8868
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nullish_coalescing.mjs
8869
- function phaseNullishCoalescing(cpl) {
8870
- for (const view of cpl.views.values()) {
8871
- for (const op of view.ops()) {
8872
- transformExpressionsInOp(op, (expr) => {
8873
- if (!(expr instanceof BinaryOperatorExpr) || expr.operator !== BinaryOperator.NullishCoalesce) {
8874
- return expr;
8875
- }
8876
- return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.And, new BinaryOperatorExpr(BinaryOperator.NotIdentical, expr.lhs, NULL_EXPR), new BinaryOperatorExpr(BinaryOperator.NotIdentical, expr.lhs, new LiteralExpr(void 0))), expr.lhs, expr.rhs);
8877
- }, VisitorContextFlag.None);
8878
- }
8879
- }
8880
- }
8881
-
8882
9304
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_variables.mjs
8883
9305
  function phaseGenerateVariables(cpl) {
8884
9306
  recursivelyProcessView(cpl.root, null);
8885
9307
  }
8886
9308
  function recursivelyProcessView(view, parentScope) {
8887
9309
  const scope = getScopeForView(view, parentScope);
8888
- if (view.parent !== null) {
8889
- }
8890
9310
  for (const op of view.create) {
8891
9311
  switch (op.kind) {
8892
9312
  case OpKind.Template:
@@ -8992,13 +9412,74 @@ function serializeLocalRefs(refs) {
8992
9412
  return literalArr(constRefs);
8993
9413
  }
8994
9414
 
9415
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/style_parser.mjs
9416
+ function parse(value) {
9417
+ const styles = [];
9418
+ let i = 0;
9419
+ let parenDepth = 0;
9420
+ let quote = 0;
9421
+ let valueStart = 0;
9422
+ let propStart = 0;
9423
+ let currentProp = null;
9424
+ while (i < value.length) {
9425
+ const token = value.charCodeAt(i++);
9426
+ switch (token) {
9427
+ case 40:
9428
+ parenDepth++;
9429
+ break;
9430
+ case 41:
9431
+ parenDepth--;
9432
+ break;
9433
+ case 39:
9434
+ if (quote === 0) {
9435
+ quote = 39;
9436
+ } else if (quote === 39 && value.charCodeAt(i - 1) !== 92) {
9437
+ quote = 0;
9438
+ }
9439
+ break;
9440
+ case 34:
9441
+ if (quote === 0) {
9442
+ quote = 34;
9443
+ } else if (quote === 34 && value.charCodeAt(i - 1) !== 92) {
9444
+ quote = 0;
9445
+ }
9446
+ break;
9447
+ case 58:
9448
+ if (!currentProp && parenDepth === 0 && quote === 0) {
9449
+ currentProp = hyphenate(value.substring(propStart, i - 1).trim());
9450
+ valueStart = i;
9451
+ }
9452
+ break;
9453
+ case 59:
9454
+ if (currentProp && valueStart > 0 && parenDepth === 0 && quote === 0) {
9455
+ const styleVal = value.substring(valueStart, i - 1).trim();
9456
+ styles.push(currentProp, styleVal);
9457
+ propStart = i;
9458
+ valueStart = 0;
9459
+ currentProp = null;
9460
+ }
9461
+ break;
9462
+ }
9463
+ }
9464
+ if (currentProp && valueStart) {
9465
+ const styleVal = value.slice(valueStart).trim();
9466
+ styles.push(currentProp, styleVal);
9467
+ }
9468
+ return styles;
9469
+ }
9470
+ function hyphenate(value) {
9471
+ return value.replace(/[a-z][A-Z]/g, (v) => {
9472
+ return v.charAt(0) + "-" + v.charAt(1);
9473
+ }).toLowerCase();
9474
+ }
9475
+
8995
9476
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/naming.mjs
8996
- function phaseNaming(cpl) {
8997
- addNamesToView(cpl.root, cpl.componentName, { index: 0 });
9477
+ function phaseNaming(cpl, compatibility) {
9478
+ addNamesToView(cpl.root, cpl.componentName, { index: 0 }, compatibility);
8998
9479
  }
8999
- function addNamesToView(view, baseName, state) {
9480
+ function addNamesToView(view, baseName, state, compatibility) {
9000
9481
  if (view.fnName === null) {
9001
- view.fnName = `${baseName}_Template`;
9482
+ view.fnName = sanitizeIdentifier(`${baseName}_Template`);
9002
9483
  }
9003
9484
  const varNames = /* @__PURE__ */ new Map();
9004
9485
  for (const op of view.ops()) {
@@ -9008,7 +9489,7 @@ function addNamesToView(view, baseName, state) {
9008
9489
  if (op.slot === null) {
9009
9490
  throw new Error(`Expected a slot to be assigned`);
9010
9491
  }
9011
- op.handlerFnName = `${view.fnName}_${op.tag}_${op.name}_${op.slot}_listener`;
9492
+ op.handlerFnName = sanitizeIdentifier(`${view.fnName}_${op.tag}_${op.name}_${op.slot}_listener`);
9012
9493
  }
9013
9494
  break;
9014
9495
  case OpKind.Variable:
@@ -9019,8 +9500,19 @@ function addNamesToView(view, baseName, state) {
9019
9500
  if (op.slot === null) {
9020
9501
  throw new Error(`Expected slot to be assigned`);
9021
9502
  }
9022
- const safeTagName = op.tag.replace("-", "_");
9023
- addNamesToView(childView, `${baseName}_${safeTagName}_${op.slot}`, state);
9503
+ addNamesToView(childView, `${baseName}_${op.tag}_${op.slot}`, state, compatibility);
9504
+ break;
9505
+ case OpKind.StyleProp:
9506
+ case OpKind.InterpolateStyleProp:
9507
+ op.name = normalizeStylePropName(op.name);
9508
+ if (compatibility) {
9509
+ op.name = stripImportant(op.name);
9510
+ }
9511
+ break;
9512
+ case OpKind.ClassProp:
9513
+ if (compatibility) {
9514
+ op.name = stripImportant(op.name);
9515
+ }
9024
9516
  break;
9025
9517
  }
9026
9518
  }
@@ -9049,6 +9541,16 @@ function getVariableName(variable2, state) {
9049
9541
  }
9050
9542
  return variable2.name;
9051
9543
  }
9544
+ function normalizeStylePropName(name) {
9545
+ return name.startsWith("--") ? name : hyphenate(name);
9546
+ }
9547
+ function stripImportant(name) {
9548
+ const importantIndex = name.indexOf("!important");
9549
+ if (importantIndex > -1) {
9550
+ return name.substring(0, importantIndex);
9551
+ }
9552
+ return name;
9553
+ }
9052
9554
 
9053
9555
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/next_context_merging.mjs
9054
9556
  function phaseMergeNextContext(cpl) {
@@ -9112,6 +9614,22 @@ function phaseNgContainer(cpl) {
9112
9614
  }
9113
9615
  }
9114
9616
 
9617
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nullish_coalescing.mjs
9618
+ function phaseNullishCoalescing(cpl) {
9619
+ for (const view of cpl.views.values()) {
9620
+ for (const op of view.ops()) {
9621
+ transformExpressionsInOp(op, (expr) => {
9622
+ if (!(expr instanceof BinaryOperatorExpr) || expr.operator !== BinaryOperator.NullishCoalesce) {
9623
+ return expr;
9624
+ }
9625
+ const assignment = new AssignTemporaryExpr(expr.lhs.clone(), cpl.allocateXrefId());
9626
+ const read = new ReadTemporaryExpr(assignment.xref);
9627
+ return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.And, new BinaryOperatorExpr(BinaryOperator.NotIdentical, assignment, NULL_EXPR), new BinaryOperatorExpr(BinaryOperator.NotIdentical, read, new LiteralExpr(void 0))), read.clone(), expr.rhs);
9628
+ }, VisitorContextFlag.None);
9629
+ }
9630
+ }
9631
+ }
9632
+
9115
9633
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_creation.mjs
9116
9634
  function phasePipeCreation(cpl) {
9117
9635
  for (const view of cpl.views.values()) {
@@ -9172,6 +9690,51 @@ function phasePipeVariadic(cpl) {
9172
9690
  }
9173
9691
  }
9174
9692
 
9693
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/property_ordering.mjs
9694
+ var ORDERING = [
9695
+ { kinds: /* @__PURE__ */ new Set([OpKind.StyleMap, OpKind.InterpolateStyleMap]), transform: keepLast },
9696
+ { kinds: /* @__PURE__ */ new Set([OpKind.ClassMap, OpKind.InterpolateClassMap]), transform: keepLast },
9697
+ { kinds: /* @__PURE__ */ new Set([OpKind.StyleProp, OpKind.InterpolateStyleProp]) },
9698
+ { kinds: /* @__PURE__ */ new Set([OpKind.ClassProp]) },
9699
+ { kinds: /* @__PURE__ */ new Set([OpKind.InterpolateProperty]) },
9700
+ { kinds: /* @__PURE__ */ new Set([OpKind.Property]) },
9701
+ { kinds: /* @__PURE__ */ new Set([OpKind.Attribute, OpKind.InterpolateAttribute]) }
9702
+ ];
9703
+ var handledOpKinds = new Set(ORDERING.flatMap((group) => [...group.kinds]));
9704
+ function phasePropertyOrdering(cpl) {
9705
+ for (const [_, view] of cpl.views) {
9706
+ let opsToOrder = [];
9707
+ for (const op of view.update) {
9708
+ if (handledOpKinds.has(op.kind)) {
9709
+ opsToOrder.push(op);
9710
+ OpList.remove(op);
9711
+ } else {
9712
+ for (const orderedOp of reorder(opsToOrder)) {
9713
+ OpList.insertBefore(orderedOp, op);
9714
+ }
9715
+ opsToOrder = [];
9716
+ }
9717
+ }
9718
+ for (const orderedOp of reorder(opsToOrder)) {
9719
+ view.update.push(orderedOp);
9720
+ }
9721
+ }
9722
+ }
9723
+ function reorder(ops) {
9724
+ const groups = Array.from(ORDERING, () => new Array());
9725
+ for (const op of ops) {
9726
+ const groupIndex = ORDERING.findIndex((o) => o.kinds.has(op.kind));
9727
+ groups[groupIndex].push(op);
9728
+ }
9729
+ return groups.flatMap((group, i) => {
9730
+ const transform = ORDERING[i].transform;
9731
+ return transform ? transform(group) : group;
9732
+ });
9733
+ }
9734
+ function keepLast(ops) {
9735
+ return ops.slice(ops.length - 1);
9736
+ }
9737
+
9175
9738
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_function_extraction.mjs
9176
9739
  function phasePureFunctionExtraction(cpl) {
9177
9740
  for (const view of cpl.views.values()) {
@@ -9356,6 +9919,9 @@ function property(name, expression) {
9356
9919
  expression
9357
9920
  ]);
9358
9921
  }
9922
+ function attribute(name, expression) {
9923
+ return call(Identifiers.attribute, [literal(name), expression]);
9924
+ }
9359
9925
  function styleProp(name, expression, unit) {
9360
9926
  const args = [literal(name), expression];
9361
9927
  if (unit !== null) {
@@ -9363,9 +9929,15 @@ function styleProp(name, expression, unit) {
9363
9929
  }
9364
9930
  return call(Identifiers.styleProp, args);
9365
9931
  }
9932
+ function classProp(name, expression) {
9933
+ return call(Identifiers.classProp, [literal(name), expression]);
9934
+ }
9366
9935
  function styleMap(expression) {
9367
9936
  return call(Identifiers.styleMap, [expression]);
9368
9937
  }
9938
+ function classMap(expression) {
9939
+ return call(Identifiers.classMap, [expression]);
9940
+ }
9369
9941
  var PIPE_BINDINGS = [
9370
9942
  Identifiers.pipeBind1,
9371
9943
  Identifiers.pipeBind2,
@@ -9410,6 +9982,10 @@ function propertyInterpolate(name, strings, expressions) {
9410
9982
  const interpolationArgs = collateInterpolationArgs(strings, expressions);
9411
9983
  return callVariadicInstruction(PROPERTY_INTERPOLATE_CONFIG, [literal(name)], interpolationArgs);
9412
9984
  }
9985
+ function attributeInterpolate(name, strings, expressions) {
9986
+ const interpolationArgs = collateInterpolationArgs(strings, expressions);
9987
+ return callVariadicInstruction(ATTRIBUTE_INTERPOLATE_CONFIG, [literal(name)], interpolationArgs);
9988
+ }
9413
9989
  function stylePropInterpolate(name, strings, expressions, unit) {
9414
9990
  const interpolationArgs = collateInterpolationArgs(strings, expressions);
9415
9991
  const extraArgs = [];
@@ -9422,6 +9998,10 @@ function styleMapInterpolate(strings, expressions) {
9422
9998
  const interpolationArgs = collateInterpolationArgs(strings, expressions);
9423
9999
  return callVariadicInstruction(STYLE_MAP_INTERPOLATE_CONFIG, [], interpolationArgs);
9424
10000
  }
10001
+ function classMapInterpolate(strings, expressions) {
10002
+ const interpolationArgs = collateInterpolationArgs(strings, expressions);
10003
+ return callVariadicInstruction(CLASS_MAP_INTERPOLATE_CONFIG, [], interpolationArgs);
10004
+ }
9425
10005
  function pureFunction(varOffset, fn2, args) {
9426
10006
  return callVariadicInstructionExpr(PURE_FUNCTION_CONFIG, [
9427
10007
  literal(varOffset),
@@ -9489,7 +10069,7 @@ var PROPERTY_INTERPOLATE_CONFIG = {
9489
10069
  };
9490
10070
  var STYLE_PROP_INTERPOLATE_CONFIG = {
9491
10071
  constant: [
9492
- null,
10072
+ Identifiers.styleProp,
9493
10073
  Identifiers.stylePropInterpolate1,
9494
10074
  Identifiers.stylePropInterpolate2,
9495
10075
  Identifiers.stylePropInterpolate3,
@@ -9504,15 +10084,32 @@ var STYLE_PROP_INTERPOLATE_CONFIG = {
9504
10084
  if (n % 2 === 0) {
9505
10085
  throw new Error(`Expected odd number of arguments`);
9506
10086
  }
9507
- if (n < 3) {
9508
- throw new Error(`Expected at least 3 arguments`);
10087
+ return (n - 1) / 2;
10088
+ }
10089
+ };
10090
+ var ATTRIBUTE_INTERPOLATE_CONFIG = {
10091
+ constant: [
10092
+ Identifiers.attribute,
10093
+ Identifiers.attributeInterpolate1,
10094
+ Identifiers.attributeInterpolate2,
10095
+ Identifiers.attributeInterpolate3,
10096
+ Identifiers.attributeInterpolate4,
10097
+ Identifiers.attributeInterpolate5,
10098
+ Identifiers.attributeInterpolate6,
10099
+ Identifiers.attributeInterpolate7,
10100
+ Identifiers.attributeInterpolate8
10101
+ ],
10102
+ variable: Identifiers.attributeInterpolateV,
10103
+ mapping: (n) => {
10104
+ if (n % 2 === 0) {
10105
+ throw new Error(`Expected odd number of arguments`);
9509
10106
  }
9510
10107
  return (n - 1) / 2;
9511
10108
  }
9512
10109
  };
9513
10110
  var STYLE_MAP_INTERPOLATE_CONFIG = {
9514
10111
  constant: [
9515
- null,
10112
+ Identifiers.styleMap,
9516
10113
  Identifiers.styleMapInterpolate1,
9517
10114
  Identifiers.styleMapInterpolate2,
9518
10115
  Identifiers.styleMapInterpolate3,
@@ -9527,8 +10124,25 @@ var STYLE_MAP_INTERPOLATE_CONFIG = {
9527
10124
  if (n % 2 === 0) {
9528
10125
  throw new Error(`Expected odd number of arguments`);
9529
10126
  }
9530
- if (n < 3) {
9531
- throw new Error(`Expected at least 3 arguments`);
10127
+ return (n - 1) / 2;
10128
+ }
10129
+ };
10130
+ var CLASS_MAP_INTERPOLATE_CONFIG = {
10131
+ constant: [
10132
+ Identifiers.classMap,
10133
+ Identifiers.classMapInterpolate1,
10134
+ Identifiers.classMapInterpolate2,
10135
+ Identifiers.classMapInterpolate3,
10136
+ Identifiers.classMapInterpolate4,
10137
+ Identifiers.classMapInterpolate5,
10138
+ Identifiers.classMapInterpolate6,
10139
+ Identifiers.classMapInterpolate7,
10140
+ Identifiers.classMapInterpolate8
10141
+ ],
10142
+ variable: Identifiers.classMapInterpolateV,
10143
+ mapping: (n) => {
10144
+ if (n % 2 === 0) {
10145
+ throw new Error(`Expected odd number of arguments`);
9532
10146
  }
9533
10147
  return (n - 1) / 2;
9534
10148
  }
@@ -9639,9 +10253,15 @@ function reifyUpdateOperations(_view, ops) {
9639
10253
  case OpKind.StyleProp:
9640
10254
  OpList.replace(op, styleProp(op.name, op.expression, op.unit));
9641
10255
  break;
10256
+ case OpKind.ClassProp:
10257
+ OpList.replace(op, classProp(op.name, op.expression));
10258
+ break;
9642
10259
  case OpKind.StyleMap:
9643
10260
  OpList.replace(op, styleMap(op.expression));
9644
10261
  break;
10262
+ case OpKind.ClassMap:
10263
+ OpList.replace(op, classMap(op.expression));
10264
+ break;
9645
10265
  case OpKind.InterpolateProperty:
9646
10266
  OpList.replace(op, propertyInterpolate(op.name, op.strings, op.expressions));
9647
10267
  break;
@@ -9651,9 +10271,18 @@ function reifyUpdateOperations(_view, ops) {
9651
10271
  case OpKind.InterpolateStyleMap:
9652
10272
  OpList.replace(op, styleMapInterpolate(op.strings, op.expressions));
9653
10273
  break;
10274
+ case OpKind.InterpolateClassMap:
10275
+ OpList.replace(op, classMapInterpolate(op.strings, op.expressions));
10276
+ break;
9654
10277
  case OpKind.InterpolateText:
9655
10278
  OpList.replace(op, textInterpolate(op.strings, op.expressions));
9656
10279
  break;
10280
+ case OpKind.Attribute:
10281
+ OpList.replace(op, attribute(op.name, op.value));
10282
+ break;
10283
+ case OpKind.InterpolateAttribute:
10284
+ OpList.replace(op, attributeInterpolate(op.name, op.strings, op.expressions));
10285
+ break;
9657
10286
  case OpKind.Variable:
9658
10287
  if (op.variable.name === null) {
9659
10288
  throw new Error(`AssertionError: unnamed variable ${op.xref}`);
@@ -9692,6 +10321,16 @@ function reifyIrExpression(expr) {
9692
10321
  throw new Error(`Read of unnamed variable ${expr.xref}`);
9693
10322
  }
9694
10323
  return variable(expr.name);
10324
+ case ExpressionKind.ReadTemporaryExpr:
10325
+ if (expr.name === null) {
10326
+ throw new Error(`Read of unnamed temporary ${expr.xref}`);
10327
+ }
10328
+ return variable(expr.name);
10329
+ case ExpressionKind.AssignTemporaryExpr:
10330
+ if (expr.name === null) {
10331
+ throw new Error(`Assign of unnamed temporary ${expr.xref}`);
10332
+ }
10333
+ return variable(expr.name).set(expr.expr);
9695
10334
  case ExpressionKind.PureFunctionExpr:
9696
10335
  if (expr.fn === null) {
9697
10336
  throw new Error(`AssertionError: expected PureFunctions to have been extracted`);
@@ -9825,14 +10464,18 @@ function processLexicalScope2(view, ops, savedView) {
9825
10464
  }
9826
10465
  }, VisitorContextFlag.None);
9827
10466
  }
10467
+ for (const op of ops) {
10468
+ visitExpressionsInOp(op, (expr) => {
10469
+ if (expr instanceof LexicalReadExpr) {
10470
+ throw new Error(`AssertionError: no lexical reads should remain, but found read of ${expr.name}`);
10471
+ }
10472
+ });
10473
+ }
9828
10474
  }
9829
10475
 
9830
10476
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
9831
10477
  function phaseSaveRestoreView(cpl) {
9832
10478
  for (const view of cpl.views.values()) {
9833
- if (view === cpl.root) {
9834
- continue;
9835
- }
9836
10479
  view.create.prepend([
9837
10480
  createVariableOp(view.tpl.allocateXrefId(), {
9838
10481
  kind: SemanticVariableKind.SavedView,
@@ -9844,18 +10487,33 @@ function phaseSaveRestoreView(cpl) {
9844
10487
  if (op.kind !== OpKind.Listener) {
9845
10488
  continue;
9846
10489
  }
9847
- op.handlerOps.prepend([
9848
- createVariableOp(view.tpl.allocateXrefId(), {
9849
- kind: SemanticVariableKind.Context,
9850
- name: null,
9851
- view: view.xref
9852
- }, new RestoreViewExpr(view.xref))
9853
- ]);
9854
- for (const handlerOp of op.handlerOps) {
9855
- if (handlerOp.kind === OpKind.Statement && handlerOp.statement instanceof ReturnStatement) {
9856
- handlerOp.statement.value = new ResetViewExpr(handlerOp.statement.value);
10490
+ let needsRestoreView = view !== cpl.root;
10491
+ if (!needsRestoreView) {
10492
+ for (const handlerOp of op.handlerOps) {
10493
+ visitExpressionsInOp(handlerOp, (expr) => {
10494
+ if (expr instanceof ReferenceExpr) {
10495
+ needsRestoreView = true;
10496
+ }
10497
+ });
9857
10498
  }
9858
10499
  }
10500
+ if (needsRestoreView) {
10501
+ addSaveRestoreViewOperationToListener(view, op);
10502
+ }
10503
+ }
10504
+ }
10505
+ }
10506
+ function addSaveRestoreViewOperationToListener(view, op) {
10507
+ op.handlerOps.prepend([
10508
+ createVariableOp(view.tpl.allocateXrefId(), {
10509
+ kind: SemanticVariableKind.Context,
10510
+ name: null,
10511
+ view: view.xref
10512
+ }, new RestoreViewExpr(view.xref))
10513
+ ]);
10514
+ for (const handlerOp of op.handlerOps) {
10515
+ if (handlerOp.kind === OpKind.Statement && handlerOp.statement instanceof ReturnStatement) {
10516
+ handlerOp.statement.value = new ResetViewExpr(handlerOp.statement.value);
9859
10517
  }
9860
10518
  }
9861
10519
  }
@@ -9903,6 +10561,39 @@ function phaseSlotAllocation(cpl) {
9903
10561
  }
9904
10562
  }
9905
10563
 
10564
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/temporary_variables.mjs
10565
+ function phaseTemporaryVariables(cpl) {
10566
+ for (const view of cpl.views.values()) {
10567
+ let opCount = 0;
10568
+ let generatedStatements = [];
10569
+ for (const op of view.ops()) {
10570
+ let count = 0;
10571
+ let xrefs = /* @__PURE__ */ new Set();
10572
+ let defs = /* @__PURE__ */ new Map();
10573
+ visitExpressionsInOp(op, (expr) => {
10574
+ if (expr instanceof ReadTemporaryExpr || expr instanceof AssignTemporaryExpr) {
10575
+ xrefs.add(expr.xref);
10576
+ }
10577
+ });
10578
+ for (const xref of xrefs) {
10579
+ defs.set(xref, `tmp_${opCount}_${count++}`);
10580
+ }
10581
+ visitExpressionsInOp(op, (expr) => {
10582
+ if (expr instanceof ReadTemporaryExpr || expr instanceof AssignTemporaryExpr) {
10583
+ const name = defs.get(expr.xref);
10584
+ if (name === void 0) {
10585
+ throw new Error("Found xref with unassigned name");
10586
+ }
10587
+ expr.name = name;
10588
+ }
10589
+ });
10590
+ generatedStatements.push(...Array.from(defs.values()).map((name) => createStatementOp(new DeclareVarStmt(name))));
10591
+ opCount++;
10592
+ }
10593
+ view.update.prepend(generatedStatements);
10594
+ }
10595
+ }
10596
+
9906
10597
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/variable_optimization.mjs
9907
10598
  function phaseVariableOptimization(cpl, options) {
9908
10599
  for (const [_, view] of cpl.views) {
@@ -10113,76 +10804,6 @@ function allowConservativeInlining(decl, target) {
10113
10804
  }
10114
10805
  }
10115
10806
 
10116
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/expand_safe_reads.mjs
10117
- function phaseExpandSafeReads(cpl) {
10118
- for (const [_, view] of cpl.views) {
10119
- for (const op of view.ops()) {
10120
- transformExpressionsInOp(op, safeTransform, VisitorContextFlag.None);
10121
- transformExpressionsInOp(op, ternaryTransform, VisitorContextFlag.None);
10122
- }
10123
- }
10124
- }
10125
- function isSafeAccessExpression(e) {
10126
- return e instanceof SafePropertyReadExpr || e instanceof SafeKeyedReadExpr;
10127
- }
10128
- function isUnsafeAccessExpression(e) {
10129
- return e instanceof ReadPropExpr || e instanceof ReadKeyExpr;
10130
- }
10131
- function isAccessExpression(e) {
10132
- return isSafeAccessExpression(e) || isUnsafeAccessExpression(e);
10133
- }
10134
- function deepestSafeTernary(e) {
10135
- if (isAccessExpression(e) && e.receiver instanceof SafeTernaryExpr) {
10136
- let st = e.receiver;
10137
- while (st.expr instanceof SafeTernaryExpr) {
10138
- st = st.expr;
10139
- }
10140
- return st;
10141
- }
10142
- return null;
10143
- }
10144
- function safeTransform(e) {
10145
- if (e instanceof SafeInvokeFunctionExpr) {
10146
- return new InvokeFunctionExpr(e.receiver, e.args);
10147
- }
10148
- if (!isAccessExpression(e)) {
10149
- return e;
10150
- }
10151
- const dst = deepestSafeTernary(e);
10152
- if (dst) {
10153
- if (e instanceof ReadPropExpr) {
10154
- dst.expr = dst.expr.prop(e.name);
10155
- return e.receiver;
10156
- }
10157
- if (e instanceof ReadKeyExpr) {
10158
- dst.expr = dst.expr.key(e.index);
10159
- return e.receiver;
10160
- }
10161
- if (e instanceof SafePropertyReadExpr) {
10162
- dst.expr = new SafeTernaryExpr(dst.expr.clone(), dst.expr.prop(e.name));
10163
- return e.receiver;
10164
- }
10165
- if (e instanceof SafeKeyedReadExpr) {
10166
- dst.expr = new SafeTernaryExpr(dst.expr.clone(), dst.expr.key(e.index));
10167
- return e.receiver;
10168
- }
10169
- } else {
10170
- if (e instanceof SafePropertyReadExpr) {
10171
- return new SafeTernaryExpr(e.receiver.clone(), e.receiver.prop(e.name));
10172
- }
10173
- if (e instanceof SafeKeyedReadExpr) {
10174
- return new SafeTernaryExpr(e.receiver.clone(), e.receiver.key(e.index));
10175
- }
10176
- }
10177
- return e;
10178
- }
10179
- function ternaryTransform(e) {
10180
- if (!(e instanceof SafeTernaryExpr)) {
10181
- return e;
10182
- }
10183
- return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
10184
- }
10185
-
10186
10807
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/emit.mjs
10187
10808
  function transformTemplate(cpl) {
10188
10809
  phaseAttributeExtraction(cpl, true);
@@ -10196,17 +10817,19 @@ function transformTemplate(cpl) {
10196
10817
  phaseLocalRefs(cpl);
10197
10818
  phaseConstCollection(cpl);
10198
10819
  phaseNullishCoalescing(cpl);
10199
- phaseExpandSafeReads(cpl);
10820
+ phaseExpandSafeReads(cpl, true);
10821
+ phaseTemporaryVariables(cpl);
10200
10822
  phaseSlotAllocation(cpl);
10201
10823
  phaseVarCounting(cpl);
10202
10824
  phaseGenerateAdvance(cpl);
10203
- phaseNaming(cpl);
10825
+ phaseNaming(cpl, true);
10204
10826
  phaseVariableOptimization(cpl, { conservative: true });
10205
10827
  phaseMergeNextContext(cpl);
10206
10828
  phaseNgContainer(cpl);
10207
10829
  phaseEmptyElements(cpl);
10208
10830
  phasePureFunctionExtraction(cpl);
10209
10831
  phaseAlignPipeVariadicVarOffset(cpl);
10832
+ phasePropertyOrdering(cpl);
10210
10833
  phaseReify(cpl);
10211
10834
  phaseChaining(cpl);
10212
10835
  }
@@ -10523,6 +11146,11 @@ function ingestPropertyBinding(view, xref, bindingKind, { name, value, type, uni
10523
11146
  throw Error("Unexpected style binding on ng-template");
10524
11147
  }
10525
11148
  view.update.push(createInterpolateStyleMapOp(xref, value.strings, value.expressions.map((expr) => convertAst(expr, view.tpl))));
11149
+ } else if (name === "class") {
11150
+ if (bindingKind !== ElementAttributeKind.Binding) {
11151
+ throw Error("Unexpected class binding on ng-template");
11152
+ }
11153
+ view.update.push(createInterpolateClassMapOp(xref, value.strings, value.expressions.map((expr) => convertAst(expr, view.tpl))));
10526
11154
  } else {
10527
11155
  view.update.push(createInterpolatePropertyOp(xref, bindingKind, name, value.strings, value.expressions.map((expr) => convertAst(expr, view.tpl))));
10528
11156
  }
@@ -10533,6 +11161,16 @@ function ingestPropertyBinding(view, xref, bindingKind, { name, value, type, uni
10533
11161
  }
10534
11162
  view.update.push(createInterpolateStylePropOp(xref, name, value.strings, value.expressions.map((expr) => convertAst(expr, view.tpl)), unit));
10535
11163
  break;
11164
+ case 1:
11165
+ if (bindingKind !== ElementAttributeKind.Binding) {
11166
+ throw new Error("Attribute bindings on templates are not expected to be valid");
11167
+ }
11168
+ const attributeInterpolate2 = createInterpolateAttributeOp(xref, bindingKind, name, value.strings, value.expressions.map((expr) => convertAst(expr, view.tpl)));
11169
+ view.update.push(attributeInterpolate2);
11170
+ break;
11171
+ case 2:
11172
+ throw Error("Unexpected interpolation in class property binding");
11173
+ case 4:
10536
11174
  default:
10537
11175
  throw Error(`Interpolated property binding type not handled: ${type}`);
10538
11176
  }
@@ -10544,6 +11182,11 @@ function ingestPropertyBinding(view, xref, bindingKind, { name, value, type, uni
10544
11182
  throw Error("Unexpected style binding on ng-template");
10545
11183
  }
10546
11184
  view.update.push(createStyleMapOp(xref, convertAst(value, view.tpl)));
11185
+ } else if (name === "class") {
11186
+ if (bindingKind !== ElementAttributeKind.Binding) {
11187
+ throw Error("Unexpected class binding on ng-template");
11188
+ }
11189
+ view.update.push(createClassMapOp(xref, convertAst(value, view.tpl)));
10547
11190
  } else {
10548
11191
  view.update.push(createPropertyOp(xref, bindingKind, name, convertAst(value, view.tpl)));
10549
11192
  }
@@ -10554,6 +11197,20 @@ function ingestPropertyBinding(view, xref, bindingKind, { name, value, type, uni
10554
11197
  }
10555
11198
  view.update.push(createStylePropOp(xref, name, convertAst(value, view.tpl), unit));
10556
11199
  break;
11200
+ case 1:
11201
+ if (bindingKind !== ElementAttributeKind.Binding) {
11202
+ throw new Error("Attribute bindings on templates are not expected to be valid");
11203
+ }
11204
+ const attrOp = createAttributeOp(xref, bindingKind, name, convertAst(value, view.tpl));
11205
+ view.update.push(attrOp);
11206
+ break;
11207
+ case 2:
11208
+ if (bindingKind !== ElementAttributeKind.Binding) {
11209
+ throw Error("Unexpected class binding on ng-template");
11210
+ }
11211
+ view.update.push(createClassPropOp(xref, name, convertAst(value, view.tpl)));
11212
+ break;
11213
+ case 4:
10557
11214
  default:
10558
11215
  throw Error(`Property binding type not handled: ${type}`);
10559
11216
  }
@@ -10577,67 +11234,6 @@ function assertIsArray(value) {
10577
11234
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/switch/index.mjs
10578
11235
  var USE_TEMPLATE_PIPELINE = false;
10579
11236
 
10580
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/style_parser.mjs
10581
- function parse(value) {
10582
- const styles = [];
10583
- let i = 0;
10584
- let parenDepth = 0;
10585
- let quote = 0;
10586
- let valueStart = 0;
10587
- let propStart = 0;
10588
- let currentProp = null;
10589
- while (i < value.length) {
10590
- const token = value.charCodeAt(i++);
10591
- switch (token) {
10592
- case 40:
10593
- parenDepth++;
10594
- break;
10595
- case 41:
10596
- parenDepth--;
10597
- break;
10598
- case 39:
10599
- if (quote === 0) {
10600
- quote = 39;
10601
- } else if (quote === 39 && value.charCodeAt(i - 1) !== 92) {
10602
- quote = 0;
10603
- }
10604
- break;
10605
- case 34:
10606
- if (quote === 0) {
10607
- quote = 34;
10608
- } else if (quote === 34 && value.charCodeAt(i - 1) !== 92) {
10609
- quote = 0;
10610
- }
10611
- break;
10612
- case 58:
10613
- if (!currentProp && parenDepth === 0 && quote === 0) {
10614
- currentProp = hyphenate(value.substring(propStart, i - 1).trim());
10615
- valueStart = i;
10616
- }
10617
- break;
10618
- case 59:
10619
- if (currentProp && valueStart > 0 && parenDepth === 0 && quote === 0) {
10620
- const styleVal = value.substring(valueStart, i - 1).trim();
10621
- styles.push(currentProp, styleVal);
10622
- propStart = i;
10623
- valueStart = 0;
10624
- currentProp = null;
10625
- }
10626
- break;
10627
- }
10628
- }
10629
- if (currentProp && valueStart) {
10630
- const styleVal = value.slice(valueStart).trim();
10631
- styles.push(currentProp, styleVal);
10632
- }
10633
- return styles;
10634
- }
10635
- function hyphenate(value) {
10636
- return value.replace(/[a-z][A-Z]/g, (v) => {
10637
- return v.charAt(0) + "-" + v.charAt(1);
10638
- }).toLowerCase();
10639
- }
10640
-
10641
11237
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/styling_builder.mjs
10642
11238
  var IMPORTANT_FLAG = "!important";
10643
11239
  var MIN_STYLING_BINDING_SLOTS_REQUIRED = 2;
@@ -12302,6 +12898,39 @@ var Comment2 = class {
12302
12898
  return visitor.visitComment(this, context);
12303
12899
  }
12304
12900
  };
12901
+ var BlockGroup = class {
12902
+ constructor(blocks, sourceSpan, startSourceSpan, endSourceSpan = null) {
12903
+ this.blocks = blocks;
12904
+ this.sourceSpan = sourceSpan;
12905
+ this.startSourceSpan = startSourceSpan;
12906
+ this.endSourceSpan = endSourceSpan;
12907
+ }
12908
+ visit(visitor, context) {
12909
+ return visitor.visitBlockGroup(this, context);
12910
+ }
12911
+ };
12912
+ var Block = class {
12913
+ constructor(name, parameters, children, sourceSpan, startSourceSpan, endSourceSpan = null) {
12914
+ this.name = name;
12915
+ this.parameters = parameters;
12916
+ this.children = children;
12917
+ this.sourceSpan = sourceSpan;
12918
+ this.startSourceSpan = startSourceSpan;
12919
+ this.endSourceSpan = endSourceSpan;
12920
+ }
12921
+ visit(visitor, context) {
12922
+ return visitor.visitBlock(this, context);
12923
+ }
12924
+ };
12925
+ var BlockParameter = class {
12926
+ constructor(expression, sourceSpan) {
12927
+ this.expression = expression;
12928
+ this.sourceSpan = sourceSpan;
12929
+ }
12930
+ visit(visitor, context) {
12931
+ return visitor.visitBlockParameter(this, context);
12932
+ }
12933
+ };
12305
12934
  function visitAll2(visitor, nodes, context = null) {
12306
12935
  const result = [];
12307
12936
  const visit2 = visitor.visit ? (ast) => visitor.visit(ast, context) || ast.visit(visitor, context) : (ast) => ast.visit(visitor, context);
@@ -14976,8 +15605,8 @@ var _Tokenizer = class {
14976
15605
  const range = options.range || { endPos: _file.content.length, startPos: 0, startLine: 0, startCol: 0 };
14977
15606
  this._cursor = options.escapedString ? new EscapedCharacterCursor(_file, range) : new PlainCharacterCursor(_file, range);
14978
15607
  this._preserveLineEndings = options.preserveLineEndings || false;
14979
- this._escapedString = options.escapedString || false;
14980
15608
  this._i18nNormalizeLineEndingsInICUs = options.i18nNormalizeLineEndingsInICUs || false;
15609
+ this._tokenizeBlocks = options.tokenizeBlocks || false;
14981
15610
  try {
14982
15611
  this._cursor.init();
14983
15612
  } catch (e) {
@@ -15008,6 +15637,12 @@ var _Tokenizer = class {
15008
15637
  } else {
15009
15638
  this._consumeTagOpen(start);
15010
15639
  }
15640
+ } else if (this._tokenizeBlocks && this._attemptStr("{#")) {
15641
+ this._consumeBlockGroupOpen(start);
15642
+ } else if (this._tokenizeBlocks && this._attemptStr("{/")) {
15643
+ this._consumeBlockGroupClose(start);
15644
+ } else if (this._tokenizeBlocks && this._attemptStr("{:")) {
15645
+ this._consumeBlock(start);
15011
15646
  } else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) {
15012
15647
  this._consumeWithInterpolation(5, 8, () => this._isTextEnd(), () => this._isTagStart());
15013
15648
  }
@@ -15018,6 +15653,55 @@ var _Tokenizer = class {
15018
15653
  this._beginToken(24);
15019
15654
  this._endToken([]);
15020
15655
  }
15656
+ _consumeBlockGroupOpen(start) {
15657
+ this._beginToken(25, start);
15658
+ const nameCursor = this._cursor.clone();
15659
+ this._attemptCharCodeUntilFn((code) => !isBlockNameChar(code));
15660
+ this._endToken([this._cursor.getChars(nameCursor)]);
15661
+ this._consumeBlockParameters();
15662
+ this._beginToken(26);
15663
+ this._requireCharCode($RBRACE);
15664
+ this._endToken([]);
15665
+ }
15666
+ _consumeBlockGroupClose(start) {
15667
+ this._beginToken(27, start);
15668
+ const nameCursor = this._cursor.clone();
15669
+ this._attemptCharCodeUntilFn((code) => !isBlockNameChar(code));
15670
+ const name = this._cursor.getChars(nameCursor);
15671
+ this._requireCharCode($RBRACE);
15672
+ this._endToken([name]);
15673
+ }
15674
+ _consumeBlock(start) {
15675
+ this._beginToken(29, start);
15676
+ const nameCursor = this._cursor.clone();
15677
+ this._attemptCharCodeUntilFn((code) => !isBlockNameChar(code));
15678
+ this._endToken([this._cursor.getChars(nameCursor)]);
15679
+ this._consumeBlockParameters();
15680
+ this._beginToken(30);
15681
+ this._requireCharCode($RBRACE);
15682
+ this._endToken([]);
15683
+ }
15684
+ _consumeBlockParameters() {
15685
+ this._attemptCharCodeUntilFn(isBlockParameterChar);
15686
+ while (this._cursor.peek() !== $RBRACE && this._cursor.peek() !== $EOF) {
15687
+ this._beginToken(28);
15688
+ const start = this._cursor.clone();
15689
+ let inQuote = null;
15690
+ while (this._cursor.peek() !== $SEMICOLON && this._cursor.peek() !== $RBRACE && this._cursor.peek() !== $EOF || inQuote !== null) {
15691
+ const char = this._cursor.peek();
15692
+ if (char === $BACKSLASH) {
15693
+ this._cursor.advance();
15694
+ } else if (char === inQuote) {
15695
+ inQuote = null;
15696
+ } else if (inQuote === null && isQuote(char)) {
15697
+ inQuote = char;
15698
+ }
15699
+ this._cursor.advance();
15700
+ }
15701
+ this._endToken([this._cursor.getChars(start)]);
15702
+ this._attemptCharCodeUntilFn(isBlockParameterChar);
15703
+ }
15704
+ }
15021
15705
  _tokenizeExpansionForm() {
15022
15706
  if (this.isExpansionFormStart()) {
15023
15707
  this._consumeExpansionFormStart();
@@ -15326,7 +16010,6 @@ var _Tokenizer = class {
15326
16010
  this._endToken(prefixAndName);
15327
16011
  }
15328
16012
  _consumeAttributeValue() {
15329
- let value;
15330
16013
  if (this._cursor.peek() === $SQ || this._cursor.peek() === $DQ) {
15331
16014
  const quoteChar = this._cursor.peek();
15332
16015
  this._consumeQuote(quoteChar);
@@ -15469,7 +16152,7 @@ var _Tokenizer = class {
15469
16152
  return this._processCarriageReturns(end.getChars(start));
15470
16153
  }
15471
16154
  _isTextEnd() {
15472
- if (this._isTagStart() || this._cursor.peek() === $EOF) {
16155
+ if (this._isTagStart() || this._isBlockStart() || this._cursor.peek() === $EOF) {
15473
16156
  return true;
15474
16157
  }
15475
16158
  if (this._tokenizeIcu && !this._inInterpolation) {
@@ -15493,6 +16176,21 @@ var _Tokenizer = class {
15493
16176
  }
15494
16177
  return false;
15495
16178
  }
16179
+ _isBlockStart() {
16180
+ if (this._tokenizeBlocks && this._cursor.peek() === $LBRACE) {
16181
+ const tmp = this._cursor.clone();
16182
+ tmp.advance();
16183
+ const next = tmp.peek();
16184
+ if (next !== $BANG && next !== $SLASH && next !== $COLON) {
16185
+ return false;
16186
+ }
16187
+ tmp.advance();
16188
+ if (isBlockNameChar(tmp.peek())) {
16189
+ return true;
16190
+ }
16191
+ }
16192
+ return false;
16193
+ }
15496
16194
  _readUntil(char) {
15497
16195
  const start = this._cursor.clone();
15498
16196
  this._attemptUntilChar(char);
@@ -15541,6 +16239,12 @@ function compareCharCodeCaseInsensitive(code1, code2) {
15541
16239
  function toUpperCaseCharCode(code) {
15542
16240
  return code >= $a && code <= $z ? code - $a + $A : code;
15543
16241
  }
16242
+ function isBlockNameChar(code) {
16243
+ return isAsciiLetter(code) || isDigit(code) || code === $_;
16244
+ }
16245
+ function isBlockParameterChar(code) {
16246
+ return code !== $SEMICOLON && isNotWhitespace(code);
16247
+ }
15544
16248
  function mergeTextTokens(srcTokens) {
15545
16249
  const dstTokens = [];
15546
16250
  let lastDstToken = void 0;
@@ -15787,7 +16491,7 @@ var _TreeBuilder = class {
15787
16491
  this.tokens = tokens;
15788
16492
  this.getTagDefinition = getTagDefinition;
15789
16493
  this._index = -1;
15790
- this._elementStack = [];
16494
+ this._containerStack = [];
15791
16495
  this.rootNodes = [];
15792
16496
  this.errors = [];
15793
16497
  this._advance();
@@ -15809,6 +16513,15 @@ var _TreeBuilder = class {
15809
16513
  this._consumeText(this._advance());
15810
16514
  } else if (this._peek.type === 19) {
15811
16515
  this._consumeExpansion(this._advance());
16516
+ } else if (this._peek.type === 25) {
16517
+ this._closeVoidElement();
16518
+ this._consumeBlockGroupOpen(this._advance());
16519
+ } else if (this._peek.type === 29) {
16520
+ this._closeVoidElement();
16521
+ this._consumeBlock(this._advance(), 30);
16522
+ } else if (this._peek.type === 27) {
16523
+ this._closeVoidElement();
16524
+ this._consumeBlockGroupClose(this._advance());
15812
16525
  } else {
15813
16526
  this._advance();
15814
16527
  }
@@ -15915,7 +16628,11 @@ var _TreeBuilder = class {
15915
16628
  const startSpan = token.sourceSpan;
15916
16629
  let text2 = token.parts[0];
15917
16630
  if (text2.length > 0 && text2[0] === "\n") {
15918
- const parent = this._getParentElement();
16631
+ const parent = this._getContainer();
16632
+ if (parent instanceof BlockGroup) {
16633
+ this.errors.push(TreeError.create(null, startSpan, "Text cannot be placed directly inside of a block group."));
16634
+ return null;
16635
+ }
15919
16636
  if (parent != null && parent.children.length === 0 && this.getTagDefinition(parent.name).ignoreFirstLf) {
15920
16637
  text2 = text2.substring(1);
15921
16638
  tokens[0] = { type: token.type, sourceSpan: token.sourceSpan, parts: [text2] };
@@ -15938,9 +16655,9 @@ var _TreeBuilder = class {
15938
16655
  }
15939
16656
  }
15940
16657
  _closeVoidElement() {
15941
- const el = this._getParentElement();
15942
- if (el && this.getTagDefinition(el.name).isVoid) {
15943
- this._elementStack.pop();
16658
+ const el = this._getContainer();
16659
+ if (el instanceof Element2 && this.getTagDefinition(el.name).isVoid) {
16660
+ this._containerStack.pop();
15944
16661
  }
15945
16662
  }
15946
16663
  _consumeStartTag(startTagToken) {
@@ -15949,7 +16666,7 @@ var _TreeBuilder = class {
15949
16666
  while (this._peek.type === 14) {
15950
16667
  attrs.push(this._consumeAttr(this._advance()));
15951
16668
  }
15952
- const fullName = this._getElementFullName(prefix, name, this._getParentElement());
16669
+ const fullName = this._getElementFullName(prefix, name, this._getClosestParentElement());
15953
16670
  let selfClosing = false;
15954
16671
  if (this._peek.type === 2) {
15955
16672
  this._advance();
@@ -15966,42 +16683,44 @@ var _TreeBuilder = class {
15966
16683
  const span = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
15967
16684
  const startSpan = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
15968
16685
  const el = new Element2(fullName, attrs, [], span, startSpan, void 0);
15969
- this._pushElement(el);
16686
+ const parentEl = this._getContainer();
16687
+ this._pushContainer(el, parentEl instanceof Element2 && this.getTagDefinition(parentEl.name).isClosedByChild(el.name));
15970
16688
  if (selfClosing) {
15971
- this._popElement(fullName, span);
16689
+ this._popContainer(fullName, Element2, span);
15972
16690
  } else if (startTagToken.type === 4) {
15973
- this._popElement(fullName, null);
16691
+ this._popContainer(fullName, Element2, null);
15974
16692
  this.errors.push(TreeError.create(fullName, span, `Opening tag "${fullName}" not terminated.`));
15975
16693
  }
15976
16694
  }
15977
- _pushElement(el) {
15978
- const parentEl = this._getParentElement();
15979
- if (parentEl && this.getTagDefinition(parentEl.name).isClosedByChild(el.name)) {
15980
- this._elementStack.pop();
16695
+ _pushContainer(node, isClosedByChild) {
16696
+ if (isClosedByChild) {
16697
+ this._containerStack.pop();
15981
16698
  }
15982
- this._addToParent(el);
15983
- this._elementStack.push(el);
16699
+ this._addToParent(node);
16700
+ this._containerStack.push(node);
15984
16701
  }
15985
16702
  _consumeEndTag(endTagToken) {
15986
- const fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getParentElement());
16703
+ const fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getClosestParentElement());
15987
16704
  if (this.getTagDefinition(fullName).isVoid) {
15988
16705
  this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, `Void elements do not have end tags "${endTagToken.parts[1]}"`));
15989
- } else if (!this._popElement(fullName, endTagToken.sourceSpan)) {
16706
+ } else if (!this._popContainer(fullName, Element2, endTagToken.sourceSpan)) {
15990
16707
  const errMsg = `Unexpected closing tag "${fullName}". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags`;
15991
16708
  this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, errMsg));
15992
16709
  }
15993
16710
  }
15994
- _popElement(fullName, endSourceSpan) {
16711
+ _popContainer(fullName, expectedType, endSourceSpan) {
16712
+ var _a2;
15995
16713
  let unexpectedCloseTagDetected = false;
15996
- for (let stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) {
15997
- const el = this._elementStack[stackIndex];
15998
- if (el.name === fullName) {
15999
- el.endSourceSpan = endSourceSpan;
16000
- el.sourceSpan.end = endSourceSpan !== null ? endSourceSpan.end : el.sourceSpan.end;
16001
- this._elementStack.splice(stackIndex, this._elementStack.length - stackIndex);
16714
+ for (let stackIndex = this._containerStack.length - 1; stackIndex >= 0; stackIndex--) {
16715
+ const node = this._containerStack[stackIndex];
16716
+ const name = node instanceof BlockGroup ? (_a2 = node.blocks[0]) == null ? void 0 : _a2.name : node.name;
16717
+ if (name === fullName && node instanceof expectedType) {
16718
+ node.endSourceSpan = endSourceSpan;
16719
+ node.sourceSpan.end = endSourceSpan !== null ? endSourceSpan.end : node.sourceSpan.end;
16720
+ this._containerStack.splice(stackIndex, this._containerStack.length - stackIndex);
16002
16721
  return !unexpectedCloseTagDetected;
16003
16722
  }
16004
- if (!this.getTagDefinition(el.name).closedByParent) {
16723
+ if (node instanceof BlockGroup || node instanceof Element2 && !this.getTagDefinition(node.name).closedByParent) {
16005
16724
  unexpectedCloseTagDetected = true;
16006
16725
  }
16007
16726
  }
@@ -16041,15 +16760,74 @@ var _TreeBuilder = class {
16041
16760
  const valueSpan = valueStartSpan && valueEnd && new ParseSourceSpan(valueStartSpan.start, valueEnd, valueStartSpan.fullStart);
16042
16761
  return new Attribute(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, attrEnd, attrName.sourceSpan.fullStart), attrName.sourceSpan, valueSpan, valueTokens.length > 0 ? valueTokens : void 0, void 0);
16043
16762
  }
16044
- _getParentElement() {
16045
- return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null;
16763
+ _consumeBlockGroupOpen(token) {
16764
+ const end = this._peek.sourceSpan.fullStart;
16765
+ const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
16766
+ const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
16767
+ const blockGroup = new BlockGroup([], span, startSpan, null);
16768
+ this._pushContainer(blockGroup, false);
16769
+ const implicitBlock = this._consumeBlock(token, 26);
16770
+ startSpan.end = implicitBlock.startSourceSpan.end;
16771
+ }
16772
+ _consumeBlock(token, closeToken) {
16773
+ this._conditionallyClosePreviousBlock();
16774
+ const parameters = [];
16775
+ while (this._peek.type === 28) {
16776
+ const paramToken = this._advance();
16777
+ parameters.push(new BlockParameter(paramToken.parts[0], paramToken.sourceSpan));
16778
+ }
16779
+ if (this._peek.type === closeToken) {
16780
+ this._advance();
16781
+ }
16782
+ const end = this._peek.sourceSpan.fullStart;
16783
+ const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
16784
+ const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
16785
+ const block = new Block(token.parts[0], parameters, [], span, startSpan);
16786
+ const parent = this._getContainer();
16787
+ if (!(parent instanceof BlockGroup)) {
16788
+ this.errors.push(TreeError.create(block.name, block.sourceSpan, "Blocks can only be placed inside of block groups."));
16789
+ } else {
16790
+ parent.blocks.push(block);
16791
+ this._containerStack.push(block);
16792
+ }
16793
+ return block;
16794
+ }
16795
+ _consumeBlockGroupClose(token) {
16796
+ const name = token.parts[0];
16797
+ const previousContainer = this._getContainer();
16798
+ this._conditionallyClosePreviousBlock();
16799
+ if (!this._popContainer(name, BlockGroup, token.sourceSpan)) {
16800
+ const context = previousContainer instanceof Element2 ? `There is an unclosed "${previousContainer.name}" HTML tag named that may have to be closed first.` : `The block may have been closed earlier.`;
16801
+ this.errors.push(TreeError.create(name, token.sourceSpan, `Unexpected closing block "${name}". ${context}`));
16802
+ }
16803
+ }
16804
+ _conditionallyClosePreviousBlock() {
16805
+ const container = this._getContainer();
16806
+ if (container instanceof Block) {
16807
+ const lastChild = container.children.length ? container.children[container.children.length - 1] : null;
16808
+ const endSpan = lastChild === null ? null : new ParseSourceSpan(lastChild.sourceSpan.end, lastChild.sourceSpan.end);
16809
+ this._popContainer(container.name, Block, endSpan);
16810
+ }
16811
+ }
16812
+ _getContainer() {
16813
+ return this._containerStack.length > 0 ? this._containerStack[this._containerStack.length - 1] : null;
16814
+ }
16815
+ _getClosestParentElement() {
16816
+ for (let i = this._containerStack.length - 1; i > -1; i--) {
16817
+ if (this._containerStack[i] instanceof Element2) {
16818
+ return this._containerStack[i];
16819
+ }
16820
+ }
16821
+ return null;
16046
16822
  }
16047
16823
  _addToParent(node) {
16048
- const parent = this._getParentElement();
16049
- if (parent != null) {
16050
- parent.children.push(node);
16051
- } else {
16824
+ const parent = this._getContainer();
16825
+ if (parent === null) {
16052
16826
  this.rootNodes.push(node);
16827
+ } else if (parent instanceof BlockGroup) {
16828
+ this.errors.push(TreeError.create(null, node.sourceSpan, "Block groups can only contain blocks."));
16829
+ } else {
16830
+ parent.children.push(node);
16053
16831
  }
16054
16832
  }
16055
16833
  _getElementFullName(prefix, localName, parentElement) {
@@ -16111,8 +16889,8 @@ var WhitespaceVisitor = class {
16111
16889
  }
16112
16890
  return new Element2(element2.name, element2.attrs, visitAllWithSiblings(this, element2.children), element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
16113
16891
  }
16114
- visitAttribute(attribute, context) {
16115
- return attribute.name !== PRESERVE_WS_ATTR_NAME ? attribute : null;
16892
+ visitAttribute(attribute2, context) {
16893
+ return attribute2.name !== PRESERVE_WS_ATTR_NAME ? attribute2 : null;
16116
16894
  }
16117
16895
  visitText(text2, context) {
16118
16896
  const isNotBlank = text2.value.match(NO_WS_REGEXP);
@@ -16133,6 +16911,15 @@ var WhitespaceVisitor = class {
16133
16911
  visitExpansionCase(expansionCase, context) {
16134
16912
  return expansionCase;
16135
16913
  }
16914
+ visitBlockGroup(group, context) {
16915
+ return new BlockGroup(visitAllWithSiblings(this, group.blocks), group.sourceSpan, group.startSourceSpan, group.endSourceSpan);
16916
+ }
16917
+ visitBlock(block, context) {
16918
+ return new Block(block.name, block.parameters, visitAllWithSiblings(this, block.children), block.sourceSpan, block.startSourceSpan);
16919
+ }
16920
+ visitBlockParameter(parameter, context) {
16921
+ return parameter;
16922
+ }
16136
16923
  };
16137
16924
  function createWhitespaceProcessedTextToken({ type, parts, sourceSpan }) {
16138
16925
  return { type, parts: [processWhitespace(parts[0])], sourceSpan };
@@ -16323,7 +17110,7 @@ var BindingParser = class {
16323
17110
  if (isAnimationProp) {
16324
17111
  this._parseAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
16325
17112
  } else {
16326
- this._parsePropertyAst(name, this._parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
17113
+ this._parsePropertyAst(name, this.parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
16327
17114
  }
16328
17115
  }
16329
17116
  parsePropertyInterpolation(name, value, sourceSpan, valueSpan, targetMatchableAttrs, targetProps, keySpan, interpolatedTokens) {
@@ -16342,11 +17129,11 @@ var BindingParser = class {
16342
17129
  if (name.length === 0) {
16343
17130
  this._reportError("Animation trigger is missing", sourceSpan);
16344
17131
  }
16345
- const ast = this._parseBinding(expression || "undefined", false, valueSpan || sourceSpan, absoluteOffset);
17132
+ const ast = this.parseBinding(expression || "undefined", false, valueSpan || sourceSpan, absoluteOffset);
16346
17133
  targetMatchableAttrs.push([name, ast.source]);
16347
17134
  targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.ANIMATION, sourceSpan, keySpan, valueSpan));
16348
17135
  }
16349
- _parseBinding(value, isHostBinding2, sourceSpan, absoluteOffset) {
17136
+ parseBinding(value, isHostBinding2, sourceSpan, absoluteOffset) {
16350
17137
  const sourceInfo = (sourceSpan && sourceSpan.start || "(unknown)").toString();
16351
17138
  try {
16352
17139
  const ast = isHostBinding2 ? this._exprParser.parseSimpleBinding(value, sourceInfo, absoluteOffset, this._interpolationConfig) : this._exprParser.parseBinding(value, sourceInfo, absoluteOffset, this._interpolationConfig);
@@ -16575,6 +17362,360 @@ function normalizeNgContentSelect(selectAttr) {
16575
17362
  return selectAttr;
16576
17363
  }
16577
17364
 
17365
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/r3_deferred_triggers.mjs
17366
+ var TIME_PATTERN = /^\d+(ms|s)?$/;
17367
+ var SEPARATOR_PATTERN = /^\s$/;
17368
+ var COMMA_DELIMITED_SYNTAX = /* @__PURE__ */ new Map([
17369
+ [$LBRACE, $RBRACE],
17370
+ [$LBRACKET, $RBRACKET],
17371
+ [$LPAREN, $RPAREN]
17372
+ ]);
17373
+ var OnTriggerType;
17374
+ (function(OnTriggerType2) {
17375
+ OnTriggerType2["IDLE"] = "idle";
17376
+ OnTriggerType2["TIMER"] = "timer";
17377
+ OnTriggerType2["INTERACTION"] = "interaction";
17378
+ OnTriggerType2["IMMEDIATE"] = "immediate";
17379
+ OnTriggerType2["HOVER"] = "hover";
17380
+ OnTriggerType2["VIEWPORT"] = "viewport";
17381
+ })(OnTriggerType || (OnTriggerType = {}));
17382
+ function parseWhenTrigger({ expression, sourceSpan }, bindingParser, errors) {
17383
+ const whenIndex = expression.indexOf("when");
17384
+ if (whenIndex === -1) {
17385
+ errors.push(new ParseError(sourceSpan, `Could not find "when" keyword in expression`));
17386
+ return null;
17387
+ }
17388
+ const start = getTriggerParametersStart(expression, whenIndex + 1);
17389
+ const parsed = bindingParser.parseBinding(expression.slice(start), false, sourceSpan, sourceSpan.start.offset + start);
17390
+ return new BoundDeferredTrigger(parsed, sourceSpan);
17391
+ }
17392
+ function parseOnTrigger({ expression, sourceSpan }, errors) {
17393
+ const onIndex = expression.indexOf("on");
17394
+ if (onIndex === -1) {
17395
+ errors.push(new ParseError(sourceSpan, `Could not find "on" keyword in expression`));
17396
+ return [];
17397
+ }
17398
+ const start = getTriggerParametersStart(expression, onIndex + 1);
17399
+ return new OnTriggerParser(expression, start, sourceSpan, errors).parse();
17400
+ }
17401
+ var OnTriggerParser = class {
17402
+ constructor(expression, start, span, errors) {
17403
+ this.expression = expression;
17404
+ this.start = start;
17405
+ this.span = span;
17406
+ this.errors = errors;
17407
+ this.index = 0;
17408
+ this.triggers = [];
17409
+ this.tokens = new Lexer().tokenize(expression.slice(start));
17410
+ }
17411
+ parse() {
17412
+ while (this.tokens.length > 0 && this.index < this.tokens.length) {
17413
+ const token = this.token();
17414
+ if (!token.isIdentifier()) {
17415
+ this.unexpectedToken(token);
17416
+ break;
17417
+ }
17418
+ if (this.isFollowedByOrLast($COMMA)) {
17419
+ this.consumeTrigger(token, []);
17420
+ this.advance();
17421
+ } else if (this.isFollowedByOrLast($LPAREN)) {
17422
+ this.advance();
17423
+ const prevErrors = this.errors.length;
17424
+ const parameters = this.consumeParameters();
17425
+ if (this.errors.length !== prevErrors) {
17426
+ break;
17427
+ }
17428
+ this.consumeTrigger(token, parameters);
17429
+ this.advance();
17430
+ } else if (this.index < this.tokens.length - 1) {
17431
+ this.unexpectedToken(this.tokens[this.index + 1]);
17432
+ }
17433
+ this.advance();
17434
+ }
17435
+ return this.triggers;
17436
+ }
17437
+ advance() {
17438
+ this.index++;
17439
+ }
17440
+ isFollowedByOrLast(char) {
17441
+ if (this.index === this.tokens.length - 1) {
17442
+ return true;
17443
+ }
17444
+ return this.tokens[this.index + 1].isCharacter(char);
17445
+ }
17446
+ token() {
17447
+ return this.tokens[Math.min(this.index, this.tokens.length - 1)];
17448
+ }
17449
+ consumeTrigger(identifier, parameters) {
17450
+ const startSpan = this.span.start.moveBy(this.start + identifier.index - this.tokens[0].index);
17451
+ const endSpan = startSpan.moveBy(this.token().end - identifier.index);
17452
+ const sourceSpan = new ParseSourceSpan(startSpan, endSpan);
17453
+ try {
17454
+ switch (identifier.toString()) {
17455
+ case OnTriggerType.IDLE:
17456
+ this.triggers.push(createIdleTrigger(parameters, sourceSpan));
17457
+ break;
17458
+ case OnTriggerType.TIMER:
17459
+ this.triggers.push(createTimerTrigger(parameters, sourceSpan));
17460
+ break;
17461
+ case OnTriggerType.INTERACTION:
17462
+ this.triggers.push(createInteractionTrigger(parameters, sourceSpan));
17463
+ break;
17464
+ case OnTriggerType.IMMEDIATE:
17465
+ this.triggers.push(createImmediateTrigger(parameters, sourceSpan));
17466
+ break;
17467
+ case OnTriggerType.HOVER:
17468
+ this.triggers.push(createHoverTrigger(parameters, sourceSpan));
17469
+ break;
17470
+ case OnTriggerType.VIEWPORT:
17471
+ this.triggers.push(createViewportTrigger(parameters, sourceSpan));
17472
+ break;
17473
+ default:
17474
+ throw new Error(`Unrecognized trigger type "${identifier}"`);
17475
+ }
17476
+ } catch (e) {
17477
+ this.error(identifier, e.message);
17478
+ }
17479
+ }
17480
+ consumeParameters() {
17481
+ const parameters = [];
17482
+ if (!this.token().isCharacter($LPAREN)) {
17483
+ this.unexpectedToken(this.token());
17484
+ return parameters;
17485
+ }
17486
+ this.advance();
17487
+ const commaDelimStack = [];
17488
+ let current = "";
17489
+ while (this.index < this.tokens.length) {
17490
+ const token = this.token();
17491
+ if (token.isCharacter($RPAREN) && commaDelimStack.length === 0) {
17492
+ if (current.length) {
17493
+ parameters.push(current);
17494
+ }
17495
+ break;
17496
+ }
17497
+ if (token.type === TokenType.Character && COMMA_DELIMITED_SYNTAX.has(token.numValue)) {
17498
+ commaDelimStack.push(COMMA_DELIMITED_SYNTAX.get(token.numValue));
17499
+ }
17500
+ if (commaDelimStack.length > 0 && token.isCharacter(commaDelimStack[commaDelimStack.length - 1])) {
17501
+ commaDelimStack.pop();
17502
+ }
17503
+ if (commaDelimStack.length === 0 && token.isCharacter($COMMA) && current.length > 0) {
17504
+ parameters.push(current);
17505
+ current = "";
17506
+ this.advance();
17507
+ continue;
17508
+ }
17509
+ current += this.tokenText();
17510
+ this.advance();
17511
+ }
17512
+ if (!this.token().isCharacter($RPAREN) || commaDelimStack.length > 0) {
17513
+ this.error(this.token(), "Unexpected end of expression");
17514
+ }
17515
+ if (this.index < this.tokens.length - 1 && !this.tokens[this.index + 1].isCharacter($COMMA)) {
17516
+ this.unexpectedToken(this.tokens[this.index + 1]);
17517
+ }
17518
+ return parameters;
17519
+ }
17520
+ tokenText() {
17521
+ return this.expression.slice(this.start + this.token().index, this.start + this.token().end);
17522
+ }
17523
+ error(token, message) {
17524
+ const newStart = this.span.start.moveBy(this.start + token.index);
17525
+ const newEnd = newStart.moveBy(token.end - token.index);
17526
+ this.errors.push(new ParseError(new ParseSourceSpan(newStart, newEnd), message));
17527
+ }
17528
+ unexpectedToken(token) {
17529
+ this.error(token, `Unexpected token "${token}"`);
17530
+ }
17531
+ };
17532
+ function createIdleTrigger(parameters, sourceSpan) {
17533
+ if (parameters.length > 0) {
17534
+ throw new Error(`"${OnTriggerType.IDLE}" trigger cannot have parameters`);
17535
+ }
17536
+ return new IdleDeferredTrigger(sourceSpan);
17537
+ }
17538
+ function createTimerTrigger(parameters, sourceSpan) {
17539
+ if (parameters.length !== 1) {
17540
+ throw new Error(`"${OnTriggerType.TIMER}" trigger must have exactly one parameter`);
17541
+ }
17542
+ const delay = parseDeferredTime(parameters[0]);
17543
+ if (delay === null) {
17544
+ throw new Error(`Could not parse time value of trigger "${OnTriggerType.TIMER}"`);
17545
+ }
17546
+ return new TimerDeferredTrigger(delay, sourceSpan);
17547
+ }
17548
+ function createInteractionTrigger(parameters, sourceSpan) {
17549
+ var _a2;
17550
+ if (parameters.length > 1) {
17551
+ throw new Error(`"${OnTriggerType.INTERACTION}" trigger can only have zero or one parameters`);
17552
+ }
17553
+ return new InteractionDeferredTrigger((_a2 = parameters[0]) != null ? _a2 : null, sourceSpan);
17554
+ }
17555
+ function createImmediateTrigger(parameters, sourceSpan) {
17556
+ if (parameters.length > 0) {
17557
+ throw new Error(`"${OnTriggerType.IMMEDIATE}" trigger cannot have parameters`);
17558
+ }
17559
+ return new ImmediateDeferredTrigger(sourceSpan);
17560
+ }
17561
+ function createHoverTrigger(parameters, sourceSpan) {
17562
+ if (parameters.length > 0) {
17563
+ throw new Error(`"${OnTriggerType.HOVER}" trigger cannot have parameters`);
17564
+ }
17565
+ return new HoverDeferredTrigger(sourceSpan);
17566
+ }
17567
+ function createViewportTrigger(parameters, sourceSpan) {
17568
+ var _a2;
17569
+ if (parameters.length > 1) {
17570
+ throw new Error(`"${OnTriggerType.VIEWPORT}" trigger can only have zero or one parameters`);
17571
+ }
17572
+ return new ViewportDeferredTrigger((_a2 = parameters[0]) != null ? _a2 : null, sourceSpan);
17573
+ }
17574
+ function getTriggerParametersStart(value, startPosition = 0) {
17575
+ let hasFoundSeparator = false;
17576
+ for (let i = startPosition; i < value.length; i++) {
17577
+ if (SEPARATOR_PATTERN.test(value[i])) {
17578
+ hasFoundSeparator = true;
17579
+ } else if (hasFoundSeparator) {
17580
+ return i;
17581
+ }
17582
+ }
17583
+ return -1;
17584
+ }
17585
+ function parseDeferredTime(value) {
17586
+ const match = value.match(TIME_PATTERN);
17587
+ if (!match) {
17588
+ return null;
17589
+ }
17590
+ const [time, units] = match;
17591
+ return parseInt(time) * (units === "s" ? 1e3 : 1);
17592
+ }
17593
+
17594
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/r3_deferred_blocks.mjs
17595
+ var PREFETCH_WHEN_PATTERN = /^prefetch\s+when\s/;
17596
+ var PREFETCH_ON_PATTERN = /^prefetch\s+on\s/;
17597
+ var MINIMUM_PARAMETER_PATTERN = /^minimum\s/;
17598
+ var AFTER_PARAMETER_PATTERN = /^after\s/;
17599
+ var WHEN_PARAMETER_PATTERN = /^when\s/;
17600
+ var ON_PARAMETER_PATTERN = /^on\s/;
17601
+ var SecondaryDeferredBlockType;
17602
+ (function(SecondaryDeferredBlockType2) {
17603
+ SecondaryDeferredBlockType2["PLACEHOLDER"] = "placeholder";
17604
+ SecondaryDeferredBlockType2["LOADING"] = "loading";
17605
+ SecondaryDeferredBlockType2["ERROR"] = "error";
17606
+ })(SecondaryDeferredBlockType || (SecondaryDeferredBlockType = {}));
17607
+ function createDeferredBlock(ast, visitor, bindingParser) {
17608
+ const errors = [];
17609
+ const [primaryBlock, ...secondaryBlocks] = ast.blocks;
17610
+ const { triggers, prefetchTriggers } = parsePrimaryTriggers(primaryBlock.parameters, bindingParser, errors);
17611
+ const { placeholder, loading, error: error2 } = parseSecondaryBlocks(secondaryBlocks, errors, visitor);
17612
+ return {
17613
+ node: new DeferredBlock(visitAll2(visitor, primaryBlock.children), triggers, prefetchTriggers, placeholder, loading, error2, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan),
17614
+ errors
17615
+ };
17616
+ }
17617
+ function parseSecondaryBlocks(blocks, errors, visitor) {
17618
+ let placeholder = null;
17619
+ let loading = null;
17620
+ let error2 = null;
17621
+ for (const block of blocks) {
17622
+ try {
17623
+ switch (block.name) {
17624
+ case SecondaryDeferredBlockType.PLACEHOLDER:
17625
+ if (placeholder !== null) {
17626
+ errors.push(new ParseError(block.startSourceSpan, `"defer" block can only have one "${SecondaryDeferredBlockType.PLACEHOLDER}" block`));
17627
+ } else {
17628
+ placeholder = parsePlaceholderBlock(block, visitor);
17629
+ }
17630
+ break;
17631
+ case SecondaryDeferredBlockType.LOADING:
17632
+ if (loading !== null) {
17633
+ errors.push(new ParseError(block.startSourceSpan, `"defer" block can only have one "${SecondaryDeferredBlockType.LOADING}" block`));
17634
+ } else {
17635
+ loading = parseLoadingBlock(block, visitor);
17636
+ }
17637
+ break;
17638
+ case SecondaryDeferredBlockType.ERROR:
17639
+ if (error2 !== null) {
17640
+ errors.push(new ParseError(block.startSourceSpan, `"defer" block can only have one "${SecondaryDeferredBlockType.ERROR}" block`));
17641
+ } else {
17642
+ error2 = parseErrorBlock(block, visitor);
17643
+ }
17644
+ break;
17645
+ default:
17646
+ errors.push(new ParseError(block.startSourceSpan, `Unrecognized block "${block.name}"`));
17647
+ break;
17648
+ }
17649
+ } catch (e) {
17650
+ errors.push(new ParseError(block.startSourceSpan, e.message));
17651
+ }
17652
+ }
17653
+ return { placeholder, loading, error: error2 };
17654
+ }
17655
+ function parsePlaceholderBlock(ast, visitor) {
17656
+ let minimumTime = null;
17657
+ for (const param of ast.parameters) {
17658
+ if (MINIMUM_PARAMETER_PATTERN.test(param.expression)) {
17659
+ const parsedTime = parseDeferredTime(param.expression.slice(getTriggerParametersStart(param.expression)));
17660
+ if (parsedTime === null) {
17661
+ throw new Error(`Could not parse time value of parameter "minimum"`);
17662
+ }
17663
+ minimumTime = parsedTime;
17664
+ } else {
17665
+ throw new Error(`Unrecognized parameter in "${SecondaryDeferredBlockType.PLACEHOLDER}" block: "${param.expression}"`);
17666
+ }
17667
+ }
17668
+ return new DeferredBlockPlaceholder(visitAll2(visitor, ast.children), minimumTime, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
17669
+ }
17670
+ function parseLoadingBlock(ast, visitor) {
17671
+ let afterTime = null;
17672
+ let minimumTime = null;
17673
+ for (const param of ast.parameters) {
17674
+ if (AFTER_PARAMETER_PATTERN.test(param.expression)) {
17675
+ const parsedTime = parseDeferredTime(param.expression.slice(getTriggerParametersStart(param.expression)));
17676
+ if (parsedTime === null) {
17677
+ throw new Error(`Could not parse time value of parameter "after"`);
17678
+ }
17679
+ afterTime = parsedTime;
17680
+ } else if (MINIMUM_PARAMETER_PATTERN.test(param.expression)) {
17681
+ const parsedTime = parseDeferredTime(param.expression.slice(getTriggerParametersStart(param.expression)));
17682
+ if (parsedTime === null) {
17683
+ throw new Error(`Could not parse time value of parameter "minimum"`);
17684
+ }
17685
+ minimumTime = parsedTime;
17686
+ } else {
17687
+ throw new Error(`Unrecognized parameter in "${SecondaryDeferredBlockType.LOADING}" block: "${param.expression}"`);
17688
+ }
17689
+ }
17690
+ return new DeferredBlockLoading(visitAll2(visitor, ast.children), afterTime, minimumTime, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
17691
+ }
17692
+ function parseErrorBlock(ast, visitor) {
17693
+ if (ast.parameters.length > 0) {
17694
+ throw new Error(`"${SecondaryDeferredBlockType.ERROR}" block cannot have parameters`);
17695
+ }
17696
+ return new DeferredBlockError(visitAll2(visitor, ast.children), ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
17697
+ }
17698
+ function parsePrimaryTriggers(params, bindingParser, errors) {
17699
+ const triggers = [];
17700
+ const prefetchTriggers = [];
17701
+ for (const param of params) {
17702
+ if (WHEN_PARAMETER_PATTERN.test(param.expression)) {
17703
+ const result = parseWhenTrigger(param, bindingParser, errors);
17704
+ result !== null && triggers.push(result);
17705
+ } else if (ON_PARAMETER_PATTERN.test(param.expression)) {
17706
+ triggers.push(...parseOnTrigger(param, errors));
17707
+ } else if (PREFETCH_WHEN_PATTERN.test(param.expression)) {
17708
+ const result = parseWhenTrigger(param, bindingParser, errors);
17709
+ result !== null && prefetchTriggers.push(result);
17710
+ } else if (PREFETCH_ON_PATTERN.test(param.expression)) {
17711
+ prefetchTriggers.push(...parseOnTrigger(param, errors));
17712
+ } else {
17713
+ errors.push(new ParseError(param.sourceSpan, "Unrecognized trigger"));
17714
+ }
17715
+ }
17716
+ return { triggers, prefetchTriggers };
17717
+ }
17718
+
16578
17719
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/r3_template_transform.mjs
16579
17720
  var BIND_NAME_REGEXP = /^(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.*)$/;
16580
17721
  var KW_BIND_IDX = 1;
@@ -16648,33 +17789,38 @@ var HtmlAstToIvyAst = class {
16648
17789
  const templateParsedProperties = [];
16649
17790
  const templateVariables = [];
16650
17791
  let elementHasInlineTemplate = false;
16651
- for (const attribute of element2.attrs) {
17792
+ for (const attribute2 of element2.attrs) {
16652
17793
  let hasBinding = false;
16653
- const normalizedName = normalizeAttributeName(attribute.name);
17794
+ const normalizedName = normalizeAttributeName(attribute2.name);
16654
17795
  let isTemplateBinding = false;
16655
- if (attribute.i18n) {
16656
- i18nAttrsMeta[attribute.name] = attribute.i18n;
17796
+ if (attribute2.i18n) {
17797
+ i18nAttrsMeta[attribute2.name] = attribute2.i18n;
16657
17798
  }
16658
17799
  if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX2)) {
16659
17800
  if (elementHasInlineTemplate) {
16660
- this.reportError(`Can't have multiple template bindings on one element. Use only one attribute prefixed with *`, attribute.sourceSpan);
17801
+ this.reportError(`Can't have multiple template bindings on one element. Use only one attribute prefixed with *`, attribute2.sourceSpan);
16661
17802
  }
16662
17803
  isTemplateBinding = true;
16663
17804
  elementHasInlineTemplate = true;
16664
- const templateValue = attribute.value;
17805
+ const templateValue = attribute2.value;
16665
17806
  const templateKey = normalizedName.substring(TEMPLATE_ATTR_PREFIX2.length);
16666
17807
  const parsedVariables = [];
16667
- const absoluteValueOffset = attribute.valueSpan ? attribute.valueSpan.start.offset : attribute.sourceSpan.start.offset + attribute.name.length;
16668
- this.bindingParser.parseInlineTemplateBinding(templateKey, templateValue, attribute.sourceSpan, absoluteValueOffset, [], templateParsedProperties, parsedVariables, true);
17808
+ const absoluteValueOffset = attribute2.valueSpan ? attribute2.valueSpan.start.offset : attribute2.sourceSpan.start.offset + attribute2.name.length;
17809
+ this.bindingParser.parseInlineTemplateBinding(templateKey, templateValue, attribute2.sourceSpan, absoluteValueOffset, [], templateParsedProperties, parsedVariables, true);
16669
17810
  templateVariables.push(...parsedVariables.map((v) => new Variable(v.name, v.value, v.sourceSpan, v.keySpan, v.valueSpan)));
16670
17811
  } else {
16671
- hasBinding = this.parseAttribute(isTemplateElement, attribute, [], parsedProperties, boundEvents, variables, references);
17812
+ hasBinding = this.parseAttribute(isTemplateElement, attribute2, [], parsedProperties, boundEvents, variables, references);
16672
17813
  }
16673
17814
  if (!hasBinding && !isTemplateBinding) {
16674
- attributes.push(this.visitAttribute(attribute));
17815
+ attributes.push(this.visitAttribute(attribute2));
16675
17816
  }
16676
17817
  }
16677
- const children = visitAll2(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element2.children);
17818
+ let children;
17819
+ if (preparsedElement.nonBindable) {
17820
+ children = visitAll2(NON_BINDABLE_VISITOR, element2.children).flat(Infinity);
17821
+ } else {
17822
+ children = visitAll2(this, element2.children);
17823
+ }
16678
17824
  let parsedElement;
16679
17825
  if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
16680
17826
  if (element2.children && !element2.children.every((node) => isEmptyTextNode(node) || isCommentNode(node))) {
@@ -16710,8 +17856,8 @@ var HtmlAstToIvyAst = class {
16710
17856
  }
16711
17857
  return parsedElement;
16712
17858
  }
16713
- visitAttribute(attribute) {
16714
- return new TextAttribute(attribute.name, attribute.value, attribute.sourceSpan, attribute.keySpan, attribute.valueSpan, attribute.i18n);
17859
+ visitAttribute(attribute2) {
17860
+ return new TextAttribute(attribute2.name, attribute2.value, attribute2.sourceSpan, attribute2.keySpan, attribute2.valueSpan, attribute2.i18n);
16715
17861
  }
16716
17862
  visitText(text2) {
16717
17863
  return this._visitTextWithInterpolation(text2.value, text2.sourceSpan, text2.tokens, text2.i18n);
@@ -16747,6 +17893,24 @@ var HtmlAstToIvyAst = class {
16747
17893
  }
16748
17894
  return null;
16749
17895
  }
17896
+ visitBlockGroup(group, context) {
17897
+ const primaryBlock = group.blocks[0];
17898
+ if (!primaryBlock) {
17899
+ this.reportError("Block group must have at least one block.", group.sourceSpan);
17900
+ return null;
17901
+ }
17902
+ if (primaryBlock.name === "defer" && this.options.enabledBlockTypes.has(primaryBlock.name)) {
17903
+ const { node, errors } = createDeferredBlock(group, this, this.bindingParser);
17904
+ this.errors.push(...errors);
17905
+ return node;
17906
+ }
17907
+ this.reportError(`Unrecognized block "${primaryBlock.name}".`, primaryBlock.sourceSpan);
17908
+ return null;
17909
+ }
17910
+ visitBlock(block, context) {
17911
+ }
17912
+ visitBlockParameter(parameter, context) {
17913
+ }
16750
17914
  extractAttributes(elementName, properties, i18nPropsMeta) {
16751
17915
  const bound = [];
16752
17916
  const literal3 = [];
@@ -16761,14 +17925,14 @@ var HtmlAstToIvyAst = class {
16761
17925
  });
16762
17926
  return { bound, literal: literal3 };
16763
17927
  }
16764
- parseAttribute(isTemplateElement, attribute, matchableAttributes, parsedProperties, boundEvents, variables, references) {
17928
+ parseAttribute(isTemplateElement, attribute2, matchableAttributes, parsedProperties, boundEvents, variables, references) {
16765
17929
  var _a2;
16766
- const name = normalizeAttributeName(attribute.name);
16767
- const value = attribute.value;
16768
- const srcSpan = attribute.sourceSpan;
16769
- const absoluteOffset = attribute.valueSpan ? attribute.valueSpan.start.offset : srcSpan.start.offset;
17930
+ const name = normalizeAttributeName(attribute2.name);
17931
+ const value = attribute2.value;
17932
+ const srcSpan = attribute2.sourceSpan;
17933
+ const absoluteOffset = attribute2.valueSpan ? attribute2.valueSpan.start.offset : srcSpan.start.offset;
16770
17934
  function createKeySpan(srcSpan2, prefix, identifier) {
16771
- const normalizationAdjustment = attribute.name.length - name.length;
17935
+ const normalizationAdjustment = attribute2.name.length - name.length;
16772
17936
  const keySpanStart = srcSpan2.start.moveBy(prefix.length + normalizationAdjustment);
16773
17937
  const keySpanEnd = keySpanStart.moveBy(identifier.length);
16774
17938
  return new ParseSourceSpan(keySpanStart, keySpanEnd, keySpanStart, identifier);
@@ -16778,33 +17942,33 @@ var HtmlAstToIvyAst = class {
16778
17942
  if (bindParts[KW_BIND_IDX] != null) {
16779
17943
  const identifier = bindParts[IDENT_KW_IDX];
16780
17944
  const keySpan2 = createKeySpan(srcSpan, bindParts[KW_BIND_IDX], identifier);
16781
- this.bindingParser.parsePropertyBinding(identifier, value, false, srcSpan, absoluteOffset, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan2);
17945
+ this.bindingParser.parsePropertyBinding(identifier, value, false, srcSpan, absoluteOffset, attribute2.valueSpan, matchableAttributes, parsedProperties, keySpan2);
16782
17946
  } else if (bindParts[KW_LET_IDX]) {
16783
17947
  if (isTemplateElement) {
16784
17948
  const identifier = bindParts[IDENT_KW_IDX];
16785
17949
  const keySpan2 = createKeySpan(srcSpan, bindParts[KW_LET_IDX], identifier);
16786
- this.parseVariable(identifier, value, srcSpan, keySpan2, attribute.valueSpan, variables);
17950
+ this.parseVariable(identifier, value, srcSpan, keySpan2, attribute2.valueSpan, variables);
16787
17951
  } else {
16788
17952
  this.reportError(`"let-" is only supported on ng-template elements.`, srcSpan);
16789
17953
  }
16790
17954
  } else if (bindParts[KW_REF_IDX]) {
16791
17955
  const identifier = bindParts[IDENT_KW_IDX];
16792
17956
  const keySpan2 = createKeySpan(srcSpan, bindParts[KW_REF_IDX], identifier);
16793
- this.parseReference(identifier, value, srcSpan, keySpan2, attribute.valueSpan, references);
17957
+ this.parseReference(identifier, value, srcSpan, keySpan2, attribute2.valueSpan, references);
16794
17958
  } else if (bindParts[KW_ON_IDX]) {
16795
17959
  const events = [];
16796
17960
  const identifier = bindParts[IDENT_KW_IDX];
16797
17961
  const keySpan2 = createKeySpan(srcSpan, bindParts[KW_ON_IDX], identifier);
16798
- this.bindingParser.parseEvent(identifier, value, false, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan2);
17962
+ this.bindingParser.parseEvent(identifier, value, false, srcSpan, attribute2.valueSpan || srcSpan, matchableAttributes, events, keySpan2);
16799
17963
  addEvents(events, boundEvents);
16800
17964
  } else if (bindParts[KW_BINDON_IDX]) {
16801
17965
  const identifier = bindParts[IDENT_KW_IDX];
16802
17966
  const keySpan2 = createKeySpan(srcSpan, bindParts[KW_BINDON_IDX], identifier);
16803
- this.bindingParser.parsePropertyBinding(identifier, value, false, srcSpan, absoluteOffset, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan2);
16804
- this.parseAssignmentEvent(identifier, value, srcSpan, attribute.valueSpan, matchableAttributes, boundEvents, keySpan2);
17967
+ this.bindingParser.parsePropertyBinding(identifier, value, false, srcSpan, absoluteOffset, attribute2.valueSpan, matchableAttributes, parsedProperties, keySpan2);
17968
+ this.parseAssignmentEvent(identifier, value, srcSpan, attribute2.valueSpan, matchableAttributes, boundEvents, keySpan2);
16805
17969
  } else if (bindParts[KW_AT_IDX]) {
16806
17970
  const keySpan2 = createKeySpan(srcSpan, "", name);
16807
- this.bindingParser.parseLiteralAttr(name, value, srcSpan, absoluteOffset, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan2);
17971
+ this.bindingParser.parseLiteralAttr(name, value, srcSpan, absoluteOffset, attribute2.valueSpan, matchableAttributes, parsedProperties, keySpan2);
16808
17972
  }
16809
17973
  return true;
16810
17974
  }
@@ -16820,19 +17984,19 @@ var HtmlAstToIvyAst = class {
16820
17984
  const identifier = name.substring(delims.start.length, name.length - delims.end.length);
16821
17985
  const keySpan2 = createKeySpan(srcSpan, delims.start, identifier);
16822
17986
  if (delims.start === BINDING_DELIMS.BANANA_BOX.start) {
16823
- this.bindingParser.parsePropertyBinding(identifier, value, false, srcSpan, absoluteOffset, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan2);
16824
- this.parseAssignmentEvent(identifier, value, srcSpan, attribute.valueSpan, matchableAttributes, boundEvents, keySpan2);
17987
+ this.bindingParser.parsePropertyBinding(identifier, value, false, srcSpan, absoluteOffset, attribute2.valueSpan, matchableAttributes, parsedProperties, keySpan2);
17988
+ this.parseAssignmentEvent(identifier, value, srcSpan, attribute2.valueSpan, matchableAttributes, boundEvents, keySpan2);
16825
17989
  } else if (delims.start === BINDING_DELIMS.PROPERTY.start) {
16826
- this.bindingParser.parsePropertyBinding(identifier, value, false, srcSpan, absoluteOffset, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan2);
17990
+ this.bindingParser.parsePropertyBinding(identifier, value, false, srcSpan, absoluteOffset, attribute2.valueSpan, matchableAttributes, parsedProperties, keySpan2);
16827
17991
  } else {
16828
17992
  const events = [];
16829
- this.bindingParser.parseEvent(identifier, value, false, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan2);
17993
+ this.bindingParser.parseEvent(identifier, value, false, srcSpan, attribute2.valueSpan || srcSpan, matchableAttributes, events, keySpan2);
16830
17994
  addEvents(events, boundEvents);
16831
17995
  }
16832
17996
  return true;
16833
17997
  }
16834
17998
  const keySpan = createKeySpan(srcSpan, "", name);
16835
- const hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan, (_a2 = attribute.valueTokens) != null ? _a2 : null);
17999
+ const hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute2.valueSpan, matchableAttributes, parsedProperties, keySpan, (_a2 = attribute2.valueTokens) != null ? _a2 : null);
16836
18000
  return hasBinding;
16837
18001
  }
16838
18002
  _visitTextWithInterpolation(value, sourceSpan, interpolatedTokens, i18n) {
@@ -16889,8 +18053,8 @@ var NonBindableVisitor = class {
16889
18053
  visitComment(comment) {
16890
18054
  return null;
16891
18055
  }
16892
- visitAttribute(attribute) {
16893
- return new TextAttribute(attribute.name, attribute.value, attribute.sourceSpan, attribute.keySpan, attribute.valueSpan, attribute.i18n);
18056
+ visitAttribute(attribute2) {
18057
+ return new TextAttribute(attribute2.name, attribute2.value, attribute2.sourceSpan, attribute2.keySpan, attribute2.valueSpan, attribute2.i18n);
16894
18058
  }
16895
18059
  visitText(text2) {
16896
18060
  return new Text(text2.value, text2.sourceSpan);
@@ -16901,6 +18065,22 @@ var NonBindableVisitor = class {
16901
18065
  visitExpansionCase(expansionCase) {
16902
18066
  return null;
16903
18067
  }
18068
+ visitBlockGroup(group, context) {
18069
+ const nodes = visitAll2(this, group.blocks);
18070
+ if (group.endSourceSpan !== null) {
18071
+ nodes.push(new Text(group.endSourceSpan.toString(), group.endSourceSpan));
18072
+ }
18073
+ return nodes;
18074
+ }
18075
+ visitBlock(block, context) {
18076
+ return [
18077
+ new Text(block.startSourceSpan.toString(), block.startSourceSpan),
18078
+ ...visitAll2(this, block.children)
18079
+ ];
18080
+ }
18081
+ visitBlockParameter(parameter, context) {
18082
+ return null;
18083
+ }
16904
18084
  };
16905
18085
  var NON_BINDABLE_VISITOR = new NonBindableVisitor();
16906
18086
  function normalizeAttributeName(attrName) {
@@ -17233,9 +18413,9 @@ var _I18nVisitor = class {
17233
18413
  const node = new TagPlaceholder(el.name, attrs, startPhName, closePhName, children, isVoid, el.sourceSpan, el.startSourceSpan, el.endSourceSpan);
17234
18414
  return context.visitNodeFn(el, node);
17235
18415
  }
17236
- visitAttribute(attribute, context) {
17237
- const node = attribute.valueTokens === void 0 || attribute.valueTokens.length === 1 ? new Text2(attribute.value, attribute.valueSpan || attribute.sourceSpan) : this._visitTextWithInterpolation(attribute.valueTokens, attribute.valueSpan || attribute.sourceSpan, context, attribute.i18n);
17238
- return context.visitNodeFn(attribute, node);
18416
+ visitAttribute(attribute2, context) {
18417
+ const node = attribute2.valueTokens === void 0 || attribute2.valueTokens.length === 1 ? new Text2(attribute2.value, attribute2.valueSpan || attribute2.sourceSpan) : this._visitTextWithInterpolation(attribute2.valueTokens, attribute2.valueSpan || attribute2.sourceSpan, context, attribute2.i18n);
18418
+ return context.visitNodeFn(attribute2, node);
17239
18419
  }
17240
18420
  visitText(text2, context) {
17241
18421
  const node = text2.tokens.length === 1 ? new Text2(text2.value, text2.sourceSpan) : this._visitTextWithInterpolation(text2.tokens, text2.sourceSpan, context, text2.i18n);
@@ -17269,6 +18449,18 @@ var _I18nVisitor = class {
17269
18449
  visitExpansionCase(_icuCase, _context) {
17270
18450
  throw new Error("Unreachable code");
17271
18451
  }
18452
+ visitBlockGroup(group, context) {
18453
+ const children = visitAll2(this, group.blocks, context);
18454
+ const node = new Container(children, group.sourceSpan);
18455
+ return context.visitNodeFn(group, node);
18456
+ }
18457
+ visitBlock(block, context) {
18458
+ const children = visitAll2(this, block.children, context);
18459
+ const node = new Container(children, block.sourceSpan);
18460
+ return context.visitNodeFn(block, node);
18461
+ }
18462
+ visitBlockParameter(_parameter, _context) {
18463
+ }
17272
18464
  _visitTextWithInterpolation(tokens, sourceSpan, context, previousI18n) {
17273
18465
  const nodes = [];
17274
18466
  let hasInterpolation = false;
@@ -17436,8 +18628,8 @@ var I18nMetaVisitor = class {
17436
18628
  visitText(text2) {
17437
18629
  return text2;
17438
18630
  }
17439
- visitAttribute(attribute) {
17440
- return attribute;
18631
+ visitAttribute(attribute2) {
18632
+ return attribute2;
17441
18633
  }
17442
18634
  visitComment(comment) {
17443
18635
  return comment;
@@ -17445,6 +18637,17 @@ var I18nMetaVisitor = class {
17445
18637
  visitExpansionCase(expansionCase) {
17446
18638
  return expansionCase;
17447
18639
  }
18640
+ visitBlockGroup(group, context) {
18641
+ visitAll2(this, group.blocks, context);
18642
+ return group;
18643
+ }
18644
+ visitBlock(block, context) {
18645
+ visitAll2(this, block.children, context);
18646
+ return block;
18647
+ }
18648
+ visitBlockParameter(parameter, context) {
18649
+ return parameter;
18650
+ }
17448
18651
  _parseMetadata(meta) {
17449
18652
  return typeof meta === "string" ? parseI18nMeta(meta) : meta instanceof Message ? meta : {};
17450
18653
  }
@@ -18233,6 +19436,16 @@ var TemplateDefinitionBuilder = class {
18233
19436
  }
18234
19437
  return null;
18235
19438
  }
19439
+ visitDeferredBlock(deferred) {
19440
+ }
19441
+ visitDeferredTrigger(trigger) {
19442
+ }
19443
+ visitDeferredBlockPlaceholder(block) {
19444
+ }
19445
+ visitDeferredBlockError(block) {
19446
+ }
19447
+ visitDeferredBlockLoading(block) {
19448
+ }
18236
19449
  allocateDataSlot() {
18237
19450
  return this._dataIndex++;
18238
19451
  }
@@ -18717,8 +19930,8 @@ function createCssSelector(elementName, attributes) {
18717
19930
  });
18718
19931
  return cssSelector;
18719
19932
  }
18720
- function getNgProjectAsLiteral(attribute) {
18721
- const parsedR3Selector = parseSelectorToR3Selector(attribute.value)[0];
19933
+ function getNgProjectAsLiteral(attribute2) {
19934
+ const parsedR3Selector = parseSelectorToR3Selector(attribute2.value)[0];
18722
19935
  return [literal(5), asLiteral(parsedR3Selector)];
18723
19936
  }
18724
19937
  function getPropertyInterpolationExpression(interpolation) {
@@ -18795,7 +20008,12 @@ function parseTemplate(template2, templateUrl, options = {}) {
18795
20008
  const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat } = options;
18796
20009
  const bindingParser = makeBindingParser(interpolationConfig);
18797
20010
  const htmlParser = new HtmlParser();
18798
- const parseResult = htmlParser.parse(template2, templateUrl, __spreadProps(__spreadValues({ leadingTriviaChars: LEADING_TRIVIA_CHARS }, options), { tokenizeExpansionForms: true }));
20011
+ const parseResult = htmlParser.parse(template2, templateUrl, __spreadProps(__spreadValues({
20012
+ leadingTriviaChars: LEADING_TRIVIA_CHARS
20013
+ }, options), {
20014
+ tokenizeExpansionForms: true,
20015
+ tokenizeBlocks: options.enabledBlockTypes != null && options.enabledBlockTypes.size > 0
20016
+ }));
18799
20017
  if (!options.alwaysAttemptHtmlToR3AstConversion && parseResult.errors && parseResult.errors.length > 0) {
18800
20018
  const parsedTemplate2 = {
18801
20019
  interpolationConfig,
@@ -18836,7 +20054,10 @@ function parseTemplate(template2, templateUrl, options = {}) {
18836
20054
  rootNodes = visitAll2(new I18nMetaVisitor(interpolationConfig, false), rootNodes);
18837
20055
  }
18838
20056
  }
18839
- const { nodes, errors, styleUrls, styles, ngContentSelectors, commentNodes } = htmlAstToRender3Ast(rootNodes, bindingParser, { collectCommentNodes: !!options.collectCommentNodes });
20057
+ const { nodes, errors, styleUrls, styles, ngContentSelectors, commentNodes } = htmlAstToRender3Ast(rootNodes, bindingParser, {
20058
+ collectCommentNodes: !!options.collectCommentNodes,
20059
+ enabledBlockTypes: options.enabledBlockTypes || /* @__PURE__ */ new Set()
20060
+ });
18840
20061
  errors.push(...parseResult.errors, ...i18nMetaResult.errors);
18841
20062
  const parsedTemplate = {
18842
20063
  interpolationConfig,
@@ -19570,6 +20791,7 @@ var CompilerFacadeImpl = class {
19570
20791
  }
19571
20792
  compileNgModule(angularCoreEnv, sourceMapUrl, facade) {
19572
20793
  const meta = {
20794
+ kind: R3NgModuleMetadataKind.Global,
19573
20795
  type: wrapReference(facade.type),
19574
20796
  bootstrap: facade.bootstrap.map(wrapReference),
19575
20797
  declarations: facade.declarations.map(wrapReference),
@@ -19861,7 +21083,11 @@ function convertPipeDeclarationToMetadata(pipe2) {
19861
21083
  }
19862
21084
  function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
19863
21085
  const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
19864
- const parsed = parseTemplate(template2, sourceMapUrl, { preserveWhitespaces, interpolationConfig });
21086
+ const parsed = parseTemplate(template2, sourceMapUrl, {
21087
+ preserveWhitespaces,
21088
+ interpolationConfig,
21089
+ enabledBlockTypes: /* @__PURE__ */ new Set()
21090
+ });
19865
21091
  if (parsed.errors !== null) {
19866
21092
  const errors = parsed.errors.map((err) => err.toString()).join(", ");
19867
21093
  throw new Error(`Errors during JIT compilation of template for ${typeName}: ${errors}`);
@@ -19901,9 +21127,9 @@ function convertR3DeclareDependencyMetadata(facade) {
19901
21127
  const token = facade.token === null ? null : new WrappedNodeExpr(facade.token);
19902
21128
  return createR3DependencyMetadata(token, isAttributeDep, (_b2 = facade.host) != null ? _b2 : false, (_c2 = facade.optional) != null ? _c2 : false, (_d2 = facade.self) != null ? _d2 : false, (_e2 = facade.skipSelf) != null ? _e2 : false);
19903
21129
  }
19904
- function createR3DependencyMetadata(token, isAttributeDep, host, optional, self2, skipSelf) {
21130
+ function createR3DependencyMetadata(token, isAttributeDep, host, optional, self, skipSelf) {
19905
21131
  const attributeNameType = isAttributeDep ? literal("unknown") : null;
19906
- return { token, attributeNameType, host, optional, self: self2, skipSelf };
21132
+ return { token, attributeNameType, host, optional, self, skipSelf };
19907
21133
  }
19908
21134
  function extractHostBindings(propMetadata, sourceSpan, host) {
19909
21135
  const bindings = parseHostBindings(host || {});
@@ -20009,13 +21235,13 @@ function convertDeclareInjectorFacadeToMetadata(declaration) {
20009
21235
  imports: declaration.imports !== void 0 ? declaration.imports.map((i) => new WrappedNodeExpr(i)) : []
20010
21236
  };
20011
21237
  }
20012
- function publishFacade(global2) {
20013
- const ng = global2.ng || (global2.ng = {});
21238
+ function publishFacade(global) {
21239
+ const ng = global.ng || (global.ng = {});
20014
21240
  ng.\u0275compilerFacade = new CompilerFacadeImpl();
20015
21241
  }
20016
21242
 
20017
21243
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/version.mjs
20018
- var VERSION2 = new Version("16.2.0-next.1");
21244
+ var VERSION2 = new Version("16.2.0-next.3");
20019
21245
 
20020
21246
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
20021
21247
  var _I18N_ATTR = "i18n";
@@ -20184,9 +21410,17 @@ var _Visitor3 = class {
20184
21410
  }
20185
21411
  return null;
20186
21412
  }
20187
- visitAttribute(attribute, context) {
21413
+ visitAttribute(attribute2, context) {
20188
21414
  throw new Error("unreachable code");
20189
21415
  }
21416
+ visitBlockGroup(group, context) {
21417
+ visitAll2(this, group.blocks, context);
21418
+ }
21419
+ visitBlock(block, context) {
21420
+ visitAll2(this, block.children, context);
21421
+ }
21422
+ visitBlockParameter(parameter, context) {
21423
+ }
20190
21424
  _init(mode, interpolationConfig) {
20191
21425
  this._mode = mode;
20192
21426
  this._inI18nBlock = false;
@@ -20351,8 +21585,8 @@ var XmlParser = class extends Parser2 {
20351
21585
  constructor() {
20352
21586
  super(getXmlTagDefinition);
20353
21587
  }
20354
- parse(source, url, options) {
20355
- return super.parse(source, url, options);
21588
+ parse(source, url, options = {}) {
21589
+ return super.parse(source, url, __spreadProps(__spreadValues({}, options), { tokenizeBlocks: false }));
20356
21590
  }
20357
21591
  };
20358
21592
 
@@ -20522,7 +21756,7 @@ var XliffParser = class {
20522
21756
  visitAll2(this, element2.children, null);
20523
21757
  }
20524
21758
  }
20525
- visitAttribute(attribute, context) {
21759
+ visitAttribute(attribute2, context) {
20526
21760
  }
20527
21761
  visitText(text2, context) {
20528
21762
  }
@@ -20532,6 +21766,12 @@ var XliffParser = class {
20532
21766
  }
20533
21767
  visitExpansionCase(expansionCase, context) {
20534
21768
  }
21769
+ visitBlockGroup(group, context) {
21770
+ }
21771
+ visitBlock(block, context) {
21772
+ }
21773
+ visitBlockParameter(parameter, context) {
21774
+ }
20535
21775
  _addError(node, message) {
20536
21776
  this._errors.push(new I18nError(node.sourceSpan, message));
20537
21777
  }
@@ -20579,7 +21819,13 @@ var XmlToI18n = class {
20579
21819
  }
20580
21820
  visitComment(comment, context) {
20581
21821
  }
20582
- visitAttribute(attribute, context) {
21822
+ visitAttribute(attribute2, context) {
21823
+ }
21824
+ visitBlockGroup(group, context) {
21825
+ }
21826
+ visitBlock(block, context) {
21827
+ }
21828
+ visitBlockParameter(parameter, context) {
20583
21829
  }
20584
21830
  _addError(node, message) {
20585
21831
  this._errors.push(new I18nError(node.sourceSpan, message));
@@ -20793,7 +22039,7 @@ var Xliff2Parser = class {
20793
22039
  visitAll2(this, element2.children, null);
20794
22040
  }
20795
22041
  }
20796
- visitAttribute(attribute, context) {
22042
+ visitAttribute(attribute2, context) {
20797
22043
  }
20798
22044
  visitText(text2, context) {
20799
22045
  }
@@ -20803,6 +22049,12 @@ var Xliff2Parser = class {
20803
22049
  }
20804
22050
  visitExpansionCase(expansionCase, context) {
20805
22051
  }
22052
+ visitBlockGroup(group, context) {
22053
+ }
22054
+ visitBlock(block, context) {
22055
+ }
22056
+ visitBlockParameter(parameter, context) {
22057
+ }
20806
22058
  _addError(node, message) {
20807
22059
  this._errors.push(new I18nError(node.sourceSpan, message));
20808
22060
  }
@@ -20865,7 +22117,13 @@ var XmlToI18n2 = class {
20865
22117
  }
20866
22118
  visitComment(comment, context) {
20867
22119
  }
20868
- visitAttribute(attribute, context) {
22120
+ visitAttribute(attribute2, context) {
22121
+ }
22122
+ visitBlockGroup(group, context) {
22123
+ }
22124
+ visitBlock(block, context) {
22125
+ }
22126
+ visitBlockParameter(parameter, context) {
20869
22127
  }
20870
22128
  _addError(node, message) {
20871
22129
  this._errors.push(new I18nError(node.sourceSpan, message));
@@ -21019,6 +22277,22 @@ var Scope = class {
21019
22277
  visitReference(reference2) {
21020
22278
  this.maybeDeclare(reference2);
21021
22279
  }
22280
+ visitDeferredBlock(deferred) {
22281
+ var _a2, _b2, _c2;
22282
+ deferred.children.forEach((node) => node.visit(this));
22283
+ (_a2 = deferred.placeholder) == null ? void 0 : _a2.visit(this);
22284
+ (_b2 = deferred.loading) == null ? void 0 : _b2.visit(this);
22285
+ (_c2 = deferred.error) == null ? void 0 : _c2.visit(this);
22286
+ }
22287
+ visitDeferredBlockPlaceholder(block) {
22288
+ block.children.forEach((node) => node.visit(this));
22289
+ }
22290
+ visitDeferredBlockError(block) {
22291
+ block.children.forEach((node) => node.visit(this));
22292
+ }
22293
+ visitDeferredBlockLoading(block) {
22294
+ block.children.forEach((node) => node.visit(this));
22295
+ }
21022
22296
  visitContent(content) {
21023
22297
  }
21024
22298
  visitBoundAttribute(attr) {
@@ -21033,6 +22307,8 @@ var Scope = class {
21033
22307
  }
21034
22308
  visitIcu(icu) {
21035
22309
  }
22310
+ visitDeferredTrigger(trigger) {
22311
+ }
21036
22312
  maybeDeclare(thing) {
21037
22313
  if (!this.namedEntities.has(thing.name)) {
21038
22314
  this.namedEntities.set(thing.name, thing);
@@ -21102,10 +22378,10 @@ var DirectiveBinder = class {
21102
22378
  this.references.set(ref, node);
21103
22379
  }
21104
22380
  });
21105
- const setAttributeBinding = (attribute, ioType) => {
21106
- const dir = directives.find((dir2) => dir2[ioType].hasBindingPropertyName(attribute.name));
22381
+ const setAttributeBinding = (attribute2, ioType) => {
22382
+ const dir = directives.find((dir2) => dir2[ioType].hasBindingPropertyName(attribute2.name));
21107
22383
  const binding = dir !== void 0 ? dir : node;
21108
- this.bindings.set(attribute, binding);
22384
+ this.bindings.set(attribute2, binding);
21109
22385
  };
21110
22386
  node.inputs.forEach((input) => setAttributeBinding(input, "inputs"));
21111
22387
  node.attributes.forEach((attr) => setAttributeBinding(attr, "inputs"));
@@ -21115,17 +22391,33 @@ var DirectiveBinder = class {
21115
22391
  node.outputs.forEach((output) => setAttributeBinding(output, "outputs"));
21116
22392
  node.children.forEach((child) => child.visit(this));
21117
22393
  }
22394
+ visitDeferredBlock(deferred) {
22395
+ var _a2, _b2, _c2;
22396
+ deferred.children.forEach((child) => child.visit(this));
22397
+ (_a2 = deferred.placeholder) == null ? void 0 : _a2.visit(this);
22398
+ (_b2 = deferred.loading) == null ? void 0 : _b2.visit(this);
22399
+ (_c2 = deferred.error) == null ? void 0 : _c2.visit(this);
22400
+ }
22401
+ visitDeferredBlockPlaceholder(block) {
22402
+ block.children.forEach((child) => child.visit(this));
22403
+ }
22404
+ visitDeferredBlockError(block) {
22405
+ block.children.forEach((child) => child.visit(this));
22406
+ }
22407
+ visitDeferredBlockLoading(block) {
22408
+ block.children.forEach((child) => child.visit(this));
22409
+ }
21118
22410
  visitContent(content) {
21119
22411
  }
21120
22412
  visitVariable(variable2) {
21121
22413
  }
21122
22414
  visitReference(reference2) {
21123
22415
  }
21124
- visitTextAttribute(attribute) {
22416
+ visitTextAttribute(attribute2) {
21125
22417
  }
21126
- visitBoundAttribute(attribute) {
22418
+ visitBoundAttribute(attribute2) {
21127
22419
  }
21128
- visitBoundEvent(attribute) {
22420
+ visitBoundEvent(attribute2) {
21129
22421
  }
21130
22422
  visitBoundAttributeOrEvent(node) {
21131
22423
  }
@@ -21135,6 +22427,8 @@ var DirectiveBinder = class {
21135
22427
  }
21136
22428
  visitIcu(icu) {
21137
22429
  }
22430
+ visitDeferredTrigger(trigger) {
22431
+ }
21138
22432
  };
21139
22433
  var TemplateBinder = class extends RecursiveAstVisitor2 {
21140
22434
  constructor(bindings, symbols, usedPipes, nestingLevel, scope, template2, level) {
@@ -21155,13 +22449,14 @@ var TemplateBinder = class extends RecursiveAstVisitor2 {
21155
22449
  node.visit(this);
21156
22450
  }
21157
22451
  }
21158
- static applyWithScope(template2, scope) {
22452
+ static applyWithScope(nodes, scope) {
21159
22453
  const expressions = /* @__PURE__ */ new Map();
21160
22454
  const symbols = /* @__PURE__ */ new Map();
21161
22455
  const nestingLevel = /* @__PURE__ */ new Map();
21162
22456
  const usedPipes = /* @__PURE__ */ new Set();
21163
- const binder = new TemplateBinder(expressions, symbols, usedPipes, nestingLevel, scope, template2 instanceof Template ? template2 : null, 0);
21164
- binder.ingest(template2);
22457
+ const template2 = nodes instanceof Template ? nodes : null;
22458
+ const binder = new TemplateBinder(expressions, symbols, usedPipes, nestingLevel, scope, template2, 0);
22459
+ binder.ingest(nodes);
21165
22460
  return { expressions, symbols, nestingLevel, usedPipes };
21166
22461
  }
21167
22462
  ingest(template2) {
@@ -21201,18 +22496,40 @@ var TemplateBinder = class extends RecursiveAstVisitor2 {
21201
22496
  }
21202
22497
  visitContent(content) {
21203
22498
  }
21204
- visitTextAttribute(attribute) {
22499
+ visitTextAttribute(attribute2) {
21205
22500
  }
21206
22501
  visitIcu(icu) {
21207
22502
  Object.keys(icu.vars).forEach((key) => icu.vars[key].visit(this));
21208
22503
  Object.keys(icu.placeholders).forEach((key) => icu.placeholders[key].visit(this));
21209
22504
  }
21210
- visitBoundAttribute(attribute) {
21211
- attribute.value.visit(this);
22505
+ visitBoundAttribute(attribute2) {
22506
+ attribute2.value.visit(this);
21212
22507
  }
21213
22508
  visitBoundEvent(event) {
21214
22509
  event.handler.visit(this);
21215
22510
  }
22511
+ visitDeferredBlock(deferred) {
22512
+ deferred.triggers.forEach(this.visitNode);
22513
+ deferred.prefetchTriggers.forEach(this.visitNode);
22514
+ deferred.children.forEach(this.visitNode);
22515
+ deferred.placeholder && this.visitNode(deferred.placeholder);
22516
+ deferred.loading && this.visitNode(deferred.loading);
22517
+ deferred.error && this.visitNode(deferred.error);
22518
+ }
22519
+ visitDeferredTrigger(trigger) {
22520
+ if (trigger instanceof BoundDeferredTrigger) {
22521
+ trigger.value.visit(this);
22522
+ }
22523
+ }
22524
+ visitDeferredBlockPlaceholder(block) {
22525
+ block.children.forEach(this.visitNode);
22526
+ }
22527
+ visitDeferredBlockError(block) {
22528
+ block.children.forEach(this.visitNode);
22529
+ }
22530
+ visitDeferredBlockLoading(block) {
22531
+ block.children.forEach(this.visitNode);
22532
+ }
21216
22533
  visitBoundText(text2) {
21217
22534
  text2.value.visit(this);
21218
22535
  }
@@ -21334,7 +22651,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
21334
22651
  function compileDeclareClassMetadata(metadata) {
21335
22652
  const definitionMap = new DefinitionMap();
21336
22653
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
21337
- definitionMap.set("version", literal("16.2.0-next.1"));
22654
+ definitionMap.set("version", literal("16.2.0-next.3"));
21338
22655
  definitionMap.set("ngImport", importExpr(Identifiers.core));
21339
22656
  definitionMap.set("type", metadata.type);
21340
22657
  definitionMap.set("decorators", metadata.decorators);
@@ -21403,7 +22720,7 @@ function createDirectiveDefinitionMap(meta) {
21403
22720
  var _a2;
21404
22721
  const definitionMap = new DefinitionMap();
21405
22722
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION2));
21406
- definitionMap.set("version", literal("16.2.0-next.1"));
22723
+ definitionMap.set("version", literal("16.2.0-next.3"));
21407
22724
  definitionMap.set("type", meta.type.value);
21408
22725
  if (meta.isStandalone) {
21409
22726
  definitionMap.set("isStandalone", literal(meta.isStandalone));
@@ -21588,7 +22905,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION3 = "12.0.0";
21588
22905
  function compileDeclareFactoryFunction(meta) {
21589
22906
  const definitionMap = new DefinitionMap();
21590
22907
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
21591
- definitionMap.set("version", literal("16.2.0-next.1"));
22908
+ definitionMap.set("version", literal("16.2.0-next.3"));
21592
22909
  definitionMap.set("ngImport", importExpr(Identifiers.core));
21593
22910
  definitionMap.set("type", meta.type.value);
21594
22911
  definitionMap.set("deps", compileDependencies(meta.deps));
@@ -21611,7 +22928,7 @@ function compileDeclareInjectableFromMetadata(meta) {
21611
22928
  function createInjectableDefinitionMap(meta) {
21612
22929
  const definitionMap = new DefinitionMap();
21613
22930
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
21614
- definitionMap.set("version", literal("16.2.0-next.1"));
22931
+ definitionMap.set("version", literal("16.2.0-next.3"));
21615
22932
  definitionMap.set("ngImport", importExpr(Identifiers.core));
21616
22933
  definitionMap.set("type", meta.type.value);
21617
22934
  if (meta.providedIn !== void 0) {
@@ -21649,7 +22966,7 @@ function compileDeclareInjectorFromMetadata(meta) {
21649
22966
  function createInjectorDefinitionMap(meta) {
21650
22967
  const definitionMap = new DefinitionMap();
21651
22968
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
21652
- definitionMap.set("version", literal("16.2.0-next.1"));
22969
+ definitionMap.set("version", literal("16.2.0-next.3"));
21653
22970
  definitionMap.set("ngImport", importExpr(Identifiers.core));
21654
22971
  definitionMap.set("type", meta.type.value);
21655
22972
  definitionMap.set("providers", meta.providers);
@@ -21669,8 +22986,11 @@ function compileDeclareNgModuleFromMetadata(meta) {
21669
22986
  }
21670
22987
  function createNgModuleDefinitionMap(meta) {
21671
22988
  const definitionMap = new DefinitionMap();
22989
+ if (meta.kind === R3NgModuleMetadataKind.Local) {
22990
+ throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
22991
+ }
21672
22992
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
21673
- definitionMap.set("version", literal("16.2.0-next.1"));
22993
+ definitionMap.set("version", literal("16.2.0-next.3"));
21674
22994
  definitionMap.set("ngImport", importExpr(Identifiers.core));
21675
22995
  definitionMap.set("type", meta.type.value);
21676
22996
  if (meta.bootstrap.length > 0) {
@@ -21705,7 +23025,7 @@ function compileDeclarePipeFromMetadata(meta) {
21705
23025
  function createPipeDefinitionMap(meta) {
21706
23026
  const definitionMap = new DefinitionMap();
21707
23027
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION7));
21708
- definitionMap.set("version", literal("16.2.0-next.1"));
23028
+ definitionMap.set("version", literal("16.2.0-next.3"));
21709
23029
  definitionMap.set("ngImport", importExpr(Identifiers.core));
21710
23030
  definitionMap.set("type", meta.type.value);
21711
23031
  if (meta.isStandalone) {
@@ -21722,7 +23042,7 @@ function createPipeDefinitionMap(meta) {
21722
23042
  publishFacade(_global);
21723
23043
 
21724
23044
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/version.mjs
21725
- var VERSION3 = new Version("16.2.0-next.1");
23045
+ var VERSION3 = new Version("16.2.0-next.3");
21726
23046
 
21727
23047
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
21728
23048
  var EmitFlags;
@@ -22902,7 +24222,7 @@ function getConstructorDependencies(clazz, reflector, isCore) {
22902
24222
  ctorParams.forEach((param, idx) => {
22903
24223
  let token = valueReferenceToExpression(param.typeValueReference);
22904
24224
  let attributeNameType = null;
22905
- let optional = false, self2 = false, skipSelf = false, host = false;
24225
+ let optional = false, self = false, skipSelf = false, host = false;
22906
24226
  (param.decorators || []).filter((dec) => isCore || isAngularCore(dec)).forEach((dec) => {
22907
24227
  const name = isCore || dec.import === null ? dec.name : dec.import.name;
22908
24228
  if (name === "Inject") {
@@ -22915,7 +24235,7 @@ function getConstructorDependencies(clazz, reflector, isCore) {
22915
24235
  } else if (name === "SkipSelf") {
22916
24236
  skipSelf = true;
22917
24237
  } else if (name === "Self") {
22918
- self2 = true;
24238
+ self = true;
22919
24239
  } else if (name === "Host") {
22920
24240
  host = true;
22921
24241
  } else if (name === "Attribute") {
@@ -22943,7 +24263,7 @@ function getConstructorDependencies(clazz, reflector, isCore) {
22943
24263
  reason: param.typeValueReference.reason
22944
24264
  });
22945
24265
  } else {
22946
- deps.push({ token, attributeNameType, optional, self: self2, skipSelf, host });
24266
+ deps.push({ token, attributeNameType, optional, self, skipSelf, host });
22947
24267
  }
22948
24268
  });
22949
24269
  if (errors.length === 0) {
@@ -26795,7 +28115,7 @@ var TraitCompiler = class {
26795
28115
  return void 0;
26796
28116
  }
26797
28117
  const promises = [];
26798
- const priorWork = this.incrementalBuild.priorAnalysisFor(sf);
28118
+ const priorWork = this.compilationMode !== CompilationMode.LOCAL ? this.incrementalBuild.priorAnalysisFor(sf) : null;
26799
28119
  if (priorWork !== null) {
26800
28120
  this.perf.eventCount(PerfEvent.SourceFileReuseAnalysis);
26801
28121
  if (priorWork.length > 0) {
@@ -26991,13 +28311,16 @@ var TraitCompiler = class {
26991
28311
  }
26992
28312
  }
26993
28313
  const symbol = this.makeSymbolForTrait(trait.handler, clazz, (_a2 = result.analysis) != null ? _a2 : null);
26994
- if (result.analysis !== void 0 && trait.handler.register !== void 0) {
28314
+ if (this.compilationMode !== CompilationMode.LOCAL && result.analysis !== void 0 && trait.handler.register !== void 0) {
26995
28315
  trait.handler.register(clazz, result.analysis);
26996
28316
  }
26997
28317
  trait = trait.toAnalyzed((_b2 = result.analysis) != null ? _b2 : null, (_c2 = result.diagnostics) != null ? _c2 : null, symbol);
26998
28318
  }
26999
28319
  resolve() {
27000
28320
  var _a2, _b2;
28321
+ if (this.compilationMode === CompilationMode.LOCAL) {
28322
+ return;
28323
+ }
27001
28324
  const classes = this.classes.keys();
27002
28325
  for (const clazz of classes) {
27003
28326
  const record = this.classes.get(clazz);
@@ -27062,6 +28385,9 @@ var TraitCompiler = class {
27062
28385
  }
27063
28386
  }
27064
28387
  extendedTemplateCheck(sf, extendedTemplateChecker) {
28388
+ if (this.compilationMode === CompilationMode.LOCAL) {
28389
+ return [];
28390
+ }
27065
28391
  const classes = this.fileToClasses.get(sf);
27066
28392
  if (classes === void 0) {
27067
28393
  return [];
@@ -27112,7 +28438,7 @@ var TraitCompiler = class {
27112
28438
  }
27113
28439
  }
27114
28440
  updateResources(clazz) {
27115
- if (!this.reflector.isClass(clazz) || !this.classes.has(clazz)) {
28441
+ if (this.compilationMode === CompilationMode.LOCAL || !this.reflector.isClass(clazz) || !this.classes.has(clazz)) {
27116
28442
  return;
27117
28443
  }
27118
28444
  const record = this.classes.get(clazz);
@@ -27131,14 +28457,21 @@ var TraitCompiler = class {
27131
28457
  const record = this.classes.get(original);
27132
28458
  let res = [];
27133
28459
  for (const trait of record.traits) {
27134
- if (trait.state !== TraitState.Resolved || containsErrors(trait.analysisDiagnostics) || containsErrors(trait.resolveDiagnostics)) {
27135
- continue;
27136
- }
27137
28460
  let compileRes;
27138
- if (this.compilationMode === CompilationMode.PARTIAL && trait.handler.compilePartial !== void 0) {
27139
- compileRes = trait.handler.compilePartial(clazz, trait.analysis, trait.resolution);
28461
+ if (this.compilationMode === CompilationMode.LOCAL) {
28462
+ if (trait.state !== TraitState.Analyzed || trait.analysis === null || containsErrors(trait.analysisDiagnostics)) {
28463
+ continue;
28464
+ }
28465
+ compileRes = trait.handler.compileLocal(clazz, trait.analysis, constantPool);
27140
28466
  } else {
27141
- compileRes = trait.handler.compileFull(clazz, trait.analysis, trait.resolution, constantPool);
28467
+ if (trait.state !== TraitState.Resolved || containsErrors(trait.analysisDiagnostics) || containsErrors(trait.resolveDiagnostics)) {
28468
+ continue;
28469
+ }
28470
+ if (this.compilationMode === CompilationMode.PARTIAL && trait.handler.compilePartial !== void 0) {
28471
+ compileRes = trait.handler.compilePartial(clazz, trait.analysis, trait.resolution);
28472
+ } else {
28473
+ compileRes = trait.handler.compileFull(clazz, trait.analysis, trait.resolution, constantPool);
28474
+ }
27142
28475
  }
27143
28476
  const compileMatchRes = compileRes;
27144
28477
  if (Array.isArray(compileMatchRes)) {
@@ -27162,7 +28495,7 @@ var TraitCompiler = class {
27162
28495
  const record = this.classes.get(original);
27163
28496
  const decorators = [];
27164
28497
  for (const trait of record.traits) {
27165
- if (trait.state !== TraitState.Resolved) {
28498
+ if (this.compilationMode !== CompilationMode.LOCAL && trait.state !== TraitState.Resolved) {
27166
28499
  continue;
27167
28500
  }
27168
28501
  if (trait.detected.trigger !== null && import_typescript37.default.isDecorator(trait.detected.trigger)) {
@@ -27400,6 +28733,9 @@ var ExpressionTranslatorVisitor = class {
27400
28733
  }
27401
28734
  return this.factory.createConditional(cond, ast.trueCase.visitExpression(this, context), ast.falseCase.visitExpression(this, context));
27402
28735
  }
28736
+ visitDynamicImportExpr(ast, context) {
28737
+ return this.factory.createDynamicImport(ast.url);
28738
+ }
27403
28739
  visitNotExpr(ast, context) {
27404
28740
  return this.factory.createUnaryExpression("!", ast.condition.visitExpression(this, context));
27405
28741
  }
@@ -27591,6 +28927,9 @@ var TypeTranslatorVisitor = class {
27591
28927
  visitConditionalExpr(ast, context) {
27592
28928
  throw new Error("Method not implemented.");
27593
28929
  }
28930
+ visitDynamicImportExpr(ast, context) {
28931
+ throw new Error("Method not implemented.");
28932
+ }
27594
28933
  visitNotExpr(ast, context) {
27595
28934
  throw new Error("Method not implemented.");
27596
28935
  }
@@ -27771,6 +29110,13 @@ var TypeScriptAstFactory = class {
27771
29110
  createConditional(condition, whenTrue, whenFalse) {
27772
29111
  return import_typescript41.default.factory.createConditionalExpression(condition, void 0, whenTrue, void 0, whenFalse);
27773
29112
  }
29113
+ createDynamicImport(url) {
29114
+ return import_typescript41.default.factory.createCallExpression(
29115
+ import_typescript41.default.factory.createToken(import_typescript41.default.SyntaxKind.ImportKeyword),
29116
+ void 0,
29117
+ [import_typescript41.default.factory.createStringLiteral(url)]
29118
+ );
29119
+ }
27774
29120
  createFunctionDeclaration(functionName, parameters, body) {
27775
29121
  if (!import_typescript41.default.isBlock(body)) {
27776
29122
  throw new Error(`Invalid syntax, expected a block, but got ${import_typescript41.default.SyntaxKind[body.kind]}.`);
@@ -29140,6 +30486,13 @@ var DirectiveDecoratorHandler = class {
29140
30486
  const classMetadata = analysis.classMetadata !== null ? compileDeclareClassMetadata(analysis.classMetadata).toStmt() : null;
29141
30487
  return compileResults(fac, def, classMetadata, "\u0275dir", inputTransformFields);
29142
30488
  }
30489
+ compileLocal(node, analysis, pool) {
30490
+ const fac = compileNgFactoryDefField(toFactoryMetadata(analysis.meta, FactoryTarget.Directive));
30491
+ const def = compileDirectiveFromMetadata(analysis.meta, pool, makeBindingParser());
30492
+ const inputTransformFields = compileInputTransformFields(analysis.inputs);
30493
+ const classMetadata = analysis.classMetadata !== null ? compileClassMetadata(analysis.classMetadata).toStmt() : null;
30494
+ return compileResults(fac, def, classMetadata, "\u0275dir", inputTransformFields);
30495
+ }
29143
30496
  findClassFieldWithAngularFeatures(node) {
29144
30497
  return this.reflector.getMembersOfClass(node).find((member) => {
29145
30498
  if (!member.isStatic && member.kind === ClassMemberKind.Method && LIFECYCLE_HOOKS.has(member.name)) {
@@ -29290,7 +30643,7 @@ var NgModuleSymbol = class extends SemanticSymbol {
29290
30643
  }
29291
30644
  };
29292
30645
  var NgModuleDecoratorHandler = class {
29293
- constructor(reflector, evaluator, metaReader, metaRegistry, scopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, annotateForClosureCompiler, onlyPublishPublicTypings, injectableRegistry, perf, includeClassMetadata) {
30646
+ constructor(reflector, evaluator, metaReader, metaRegistry, scopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, annotateForClosureCompiler, onlyPublishPublicTypings, injectableRegistry, perf, includeClassMetadata, includeSelectorScope, compilationMode) {
29294
30647
  this.reflector = reflector;
29295
30648
  this.evaluator = evaluator;
29296
30649
  this.metaReader = metaReader;
@@ -29306,6 +30659,8 @@ var NgModuleDecoratorHandler = class {
29306
30659
  this.injectableRegistry = injectableRegistry;
29307
30660
  this.perf = perf;
29308
30661
  this.includeClassMetadata = includeClassMetadata;
30662
+ this.includeSelectorScope = includeSelectorScope;
30663
+ this.compilationMode = compilationMode;
29309
30664
  this.precedence = HandlerPrecedence.PRIMARY;
29310
30665
  this.name = "NgModuleDecoratorHandler";
29311
30666
  }
@@ -29325,7 +30680,7 @@ var NgModuleDecoratorHandler = class {
29325
30680
  }
29326
30681
  }
29327
30682
  analyze(node, decorator) {
29328
- var _a2;
30683
+ var _a2, _b2, _c2, _d2, _e2;
29329
30684
  this.perf.eventCount(PerfEvent.AnalyzeNgModule);
29330
30685
  const name = node.name.text;
29331
30686
  if (decorator.args === null || decorator.args.length > 1) {
@@ -29345,9 +30700,8 @@ var NgModuleDecoratorHandler = class {
29345
30700
  ]);
29346
30701
  const diagnostics = [];
29347
30702
  let declarationRefs = [];
29348
- let rawDeclarations = null;
29349
- if (ngModule.has("declarations")) {
29350
- rawDeclarations = ngModule.get("declarations");
30703
+ const rawDeclarations = (_a2 = ngModule.get("declarations")) != null ? _a2 : null;
30704
+ if (this.compilationMode !== CompilationMode.LOCAL && rawDeclarations !== null) {
29351
30705
  const declarationMeta = this.evaluator.evaluate(rawDeclarations, forwardRefResolver);
29352
30706
  declarationRefs = this.resolveTypeList(rawDeclarations, declarationMeta, name, "declarations", 0).references;
29353
30707
  for (const ref of declarationRefs) {
@@ -29361,33 +30715,31 @@ var NgModuleDecoratorHandler = class {
29361
30715
  return { diagnostics };
29362
30716
  }
29363
30717
  let importRefs = [];
29364
- let rawImports = null;
29365
- if (ngModule.has("imports")) {
29366
- rawImports = ngModule.get("imports");
30718
+ let rawImports = (_b2 = ngModule.get("imports")) != null ? _b2 : null;
30719
+ if (this.compilationMode !== CompilationMode.LOCAL && rawImports !== null) {
29367
30720
  const importsMeta = this.evaluator.evaluate(rawImports, moduleResolvers);
29368
30721
  importRefs = this.resolveTypeList(rawImports, importsMeta, name, "imports", 0).references;
29369
30722
  }
29370
30723
  let exportRefs = [];
29371
- let rawExports = null;
29372
- if (ngModule.has("exports")) {
29373
- rawExports = ngModule.get("exports");
30724
+ const rawExports = (_c2 = ngModule.get("exports")) != null ? _c2 : null;
30725
+ if (this.compilationMode !== CompilationMode.LOCAL && rawExports !== null) {
29374
30726
  const exportsMeta = this.evaluator.evaluate(rawExports, moduleResolvers);
29375
30727
  exportRefs = this.resolveTypeList(rawExports, exportsMeta, name, "exports", 0).references;
29376
30728
  this.referencesRegistry.add(node, ...exportRefs);
29377
30729
  }
29378
30730
  let bootstrapRefs = [];
29379
- if (ngModule.has("bootstrap")) {
29380
- const expr = ngModule.get("bootstrap");
29381
- const bootstrapMeta = this.evaluator.evaluate(expr, forwardRefResolver);
29382
- bootstrapRefs = this.resolveTypeList(expr, bootstrapMeta, name, "bootstrap", 0).references;
30731
+ const rawBootstrap = (_d2 = ngModule.get("bootstrap")) != null ? _d2 : null;
30732
+ if (this.compilationMode !== CompilationMode.LOCAL && rawBootstrap !== null) {
30733
+ const bootstrapMeta = this.evaluator.evaluate(rawBootstrap, forwardRefResolver);
30734
+ bootstrapRefs = this.resolveTypeList(rawBootstrap, bootstrapMeta, name, "bootstrap", 0).references;
29383
30735
  for (const ref of bootstrapRefs) {
29384
30736
  const dirMeta = this.metaReader.getDirectiveMetadata(ref);
29385
30737
  if (dirMeta == null ? void 0 : dirMeta.isStandalone) {
29386
- diagnostics.push(makeStandaloneBootstrapDiagnostic(node, ref, expr));
30738
+ diagnostics.push(makeStandaloneBootstrapDiagnostic(node, ref, rawBootstrap));
29387
30739
  }
29388
30740
  }
29389
30741
  }
29390
- const schemas = ngModule.has("schemas") ? extractSchemas(ngModule.get("schemas"), this.evaluator, "NgModule") : [];
30742
+ const schemas = this.compilationMode !== CompilationMode.LOCAL && ngModule.has("schemas") ? extractSchemas(ngModule.get("schemas"), this.evaluator, "NgModule") : [];
29391
30743
  let id = null;
29392
30744
  if (ngModule.has("id")) {
29393
30745
  const idExpr = ngModule.get("id");
@@ -29416,26 +30768,42 @@ var NgModuleDecoratorHandler = class {
29416
30768
  const isForwardReference = (ref) => isExpressionForwardReference(ref.value, node.name, valueContext);
29417
30769
  const containsForwardDecls = bootstrap.some(isForwardReference) || declarations.some(isForwardReference) || imports.some(isForwardReference) || exports.some(isForwardReference);
29418
30770
  const type = wrapTypeReference(this.reflector, node);
29419
- const ngModuleMetadata = {
29420
- type,
29421
- bootstrap,
29422
- declarations,
29423
- publicDeclarationTypes: this.onlyPublishPublicTypings ? exportedDeclarations : null,
29424
- exports,
29425
- imports,
29426
- includeImportTypes: !this.onlyPublishPublicTypings,
29427
- containsForwardDecls,
29428
- id,
29429
- selectorScopeMode: R3SelectorScopeMode.SideEffect,
29430
- schemas: []
29431
- };
30771
+ let ngModuleMetadata;
30772
+ if (this.compilationMode === CompilationMode.LOCAL) {
30773
+ ngModuleMetadata = {
30774
+ kind: R3NgModuleMetadataKind.Local,
30775
+ type,
30776
+ bootstrapExpression: rawBootstrap ? new WrappedNodeExpr(rawBootstrap) : null,
30777
+ declarationsExpression: rawDeclarations ? new WrappedNodeExpr(rawDeclarations) : null,
30778
+ exportsExpression: rawExports ? new WrappedNodeExpr(rawExports) : null,
30779
+ importsExpression: rawImports ? new WrappedNodeExpr(rawImports) : null,
30780
+ id,
30781
+ selectorScopeMode: R3SelectorScopeMode.SideEffect,
30782
+ schemas: []
30783
+ };
30784
+ } else {
30785
+ ngModuleMetadata = {
30786
+ kind: R3NgModuleMetadataKind.Global,
30787
+ type,
30788
+ bootstrap,
30789
+ declarations,
30790
+ publicDeclarationTypes: this.onlyPublishPublicTypings ? exportedDeclarations : null,
30791
+ exports,
30792
+ imports,
30793
+ includeImportTypes: !this.onlyPublishPublicTypings,
30794
+ containsForwardDecls,
30795
+ id,
30796
+ selectorScopeMode: this.includeSelectorScope ? R3SelectorScopeMode.SideEffect : R3SelectorScopeMode.Omit,
30797
+ schemas: []
30798
+ };
30799
+ }
29432
30800
  const rawProviders = ngModule.has("providers") ? ngModule.get("providers") : null;
29433
30801
  let wrappedProviders = null;
29434
30802
  if (rawProviders !== null && (!import_typescript48.default.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
29435
30803
  wrappedProviders = new WrappedNodeExpr(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders);
29436
30804
  }
29437
30805
  const topLevelImports = [];
29438
- if (ngModule.has("imports")) {
30806
+ if (this.compilationMode !== CompilationMode.LOCAL && ngModule.has("imports")) {
29439
30807
  const rawImports2 = unwrapExpression(ngModule.get("imports"));
29440
30808
  let topLevelExpressions = [];
29441
30809
  if (import_typescript48.default.isArrayLiteralExpression(rawImports2)) {
@@ -29494,7 +30862,7 @@ var NgModuleDecoratorHandler = class {
29494
30862
  classMetadata: this.includeClassMetadata ? extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler) : null,
29495
30863
  factorySymbolName: node.name.text,
29496
30864
  remoteScopesMayRequireCycleProtection,
29497
- decorator: (_a2 = decorator == null ? void 0 : decorator.node) != null ? _a2 : null
30865
+ decorator: (_e2 = decorator == null ? void 0 : decorator.node) != null ? _e2 : null
29498
30866
  }
29499
30867
  };
29500
30868
  }
@@ -29633,6 +31001,18 @@ var NgModuleDecoratorHandler = class {
29633
31001
  this.insertMetadataStatement(ngModuleDef.statements, metadata);
29634
31002
  return this.compileNgModule(factoryFn, injectorDef, ngModuleDef);
29635
31003
  }
31004
+ compileLocal(node, { inj, mod, fac, classMetadata, declarations, remoteScopesMayRequireCycleProtection }) {
31005
+ const factoryFn = compileNgFactoryDefField(fac);
31006
+ const ngInjectorDef = compileInjector(__spreadProps(__spreadValues({}, inj), {
31007
+ imports: []
31008
+ }));
31009
+ const ngModuleDef = compileNgModule(mod);
31010
+ const statements = ngModuleDef.statements;
31011
+ const metadata = classMetadata !== null ? compileClassMetadata(classMetadata) : null;
31012
+ this.insertMetadataStatement(statements, metadata);
31013
+ this.appendRemoteScopingStatements(statements, node, declarations, remoteScopesMayRequireCycleProtection);
31014
+ return this.compileNgModule(factoryFn, ngInjectorDef, ngModuleDef);
31015
+ }
29636
31016
  insertMetadataStatement(ngModuleStatements, metadata) {
29637
31017
  if (metadata !== null) {
29638
31018
  ngModuleStatements.unshift(metadata.toStmt());
@@ -29846,7 +31226,8 @@ function parseExtractedTemplate(template2, sourceStr, sourceParseRange, escapedS
29846
31226
  escapedString,
29847
31227
  enableI18nLegacyMessageIdFormat: options.enableI18nLegacyMessageIdFormat,
29848
31228
  i18nNormalizeLineEndingsInICUs,
29849
- alwaysAttemptHtmlToR3AstConversion: options.usePoisonedData
31229
+ alwaysAttemptHtmlToR3AstConversion: options.usePoisonedData,
31230
+ enabledBlockTypes: options.enabledBlockTypes
29850
31231
  });
29851
31232
  const { nodes: diagNodes } = parseTemplate(sourceStr, sourceMapUrl != null ? sourceMapUrl : "", {
29852
31233
  preserveWhitespaces: true,
@@ -30193,7 +31574,7 @@ function isLikelyModuleWithProviders(value) {
30193
31574
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
30194
31575
  var EMPTY_ARRAY2 = [];
30195
31576
  var ComponentDecoratorHandler = class {
30196
- constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf, hostDirectivesResolver, includeClassMetadata) {
31577
+ constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, enabledBlockTypes, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf, hostDirectivesResolver, includeClassMetadata, compilationMode) {
30197
31578
  this.reflector = reflector;
30198
31579
  this.evaluator = evaluator;
30199
31580
  this.metaRegistry = metaRegistry;
@@ -30212,6 +31593,7 @@ var ComponentDecoratorHandler = class {
30212
31593
  this.enableI18nLegacyMessageIdFormat = enableI18nLegacyMessageIdFormat;
30213
31594
  this.usePoisonedData = usePoisonedData;
30214
31595
  this.i18nNormalizeLineEndingsInICUs = i18nNormalizeLineEndingsInICUs;
31596
+ this.enabledBlockTypes = enabledBlockTypes;
30215
31597
  this.moduleResolver = moduleResolver;
30216
31598
  this.cycleAnalyzer = cycleAnalyzer;
30217
31599
  this.cycleHandlingStrategy = cycleHandlingStrategy;
@@ -30224,6 +31606,7 @@ var ComponentDecoratorHandler = class {
30224
31606
  this.perf = perf;
30225
31607
  this.hostDirectivesResolver = hostDirectivesResolver;
30226
31608
  this.includeClassMetadata = includeClassMetadata;
31609
+ this.compilationMode = compilationMode;
30227
31610
  this.literalCache = /* @__PURE__ */ new Map();
30228
31611
  this.elementSchemaRegistry = new DomElementSchemaRegistry();
30229
31612
  this.preanalyzeTemplateCache = /* @__PURE__ */ new Map();
@@ -30233,7 +31616,8 @@ var ComponentDecoratorHandler = class {
30233
31616
  this.extractTemplateOptions = {
30234
31617
  enableI18nLegacyMessageIdFormat: this.enableI18nLegacyMessageIdFormat,
30235
31618
  i18nNormalizeLineEndingsInICUs: this.i18nNormalizeLineEndingsInICUs,
30236
- usePoisonedData: this.usePoisonedData
31619
+ usePoisonedData: this.usePoisonedData,
31620
+ enabledBlockTypes: this.enabledBlockTypes
30237
31621
  };
30238
31622
  }
30239
31623
  detect(node, decorators) {
@@ -30293,7 +31677,7 @@ var ComponentDecoratorHandler = class {
30293
31677
  ]).then(() => void 0);
30294
31678
  }
30295
31679
  analyze(node, decorator) {
30296
- var _a2, _b2, _c2;
31680
+ var _a2, _b2, _c2, _d2;
30297
31681
  this.perf.eventCount(PerfEvent.AnalyzeComponent);
30298
31682
  const containingFile = node.getSourceFile().fileName;
30299
31683
  this.literalCache.delete(decorator);
@@ -30335,15 +31719,15 @@ var ComponentDecoratorHandler = class {
30335
31719
  providersRequiringFactory = resolveProvidersRequiringFactory(component.get("providers"), this.reflector, this.evaluator);
30336
31720
  }
30337
31721
  let resolvedImports = null;
30338
- let rawImports = null;
30339
- if (component.has("imports") && !metadata.isStandalone) {
31722
+ let rawImports = (_b2 = component.get("imports")) != null ? _b2 : null;
31723
+ if (rawImports && !metadata.isStandalone) {
30340
31724
  if (diagnostics === void 0) {
30341
31725
  diagnostics = [];
30342
31726
  }
30343
31727
  diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_NOT_STANDALONE, component.get("imports"), `'imports' is only valid on a component that is standalone.`, [makeRelatedInformation(node.name, `Did you forget to add 'standalone: true' to this @Component?`)]));
30344
31728
  isPoisoned = true;
30345
- } else if (component.has("imports")) {
30346
- const expr = component.get("imports");
31729
+ } else if (this.compilationMode !== CompilationMode.LOCAL && rawImports) {
31730
+ const expr = rawImports;
30347
31731
  const importResolvers = combineResolvers([
30348
31732
  createModuleWithProvidersResolver(this.reflector, this.isCore),
30349
31733
  forwardRefResolver
@@ -30366,7 +31750,7 @@ var ComponentDecoratorHandler = class {
30366
31750
  diagnostics = [];
30367
31751
  }
30368
31752
  diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_NOT_STANDALONE, component.get("schemas"), `'schemas' is only valid on a component that is standalone.`));
30369
- } else if (component.has("schemas")) {
31753
+ } else if (this.compilationMode !== CompilationMode.LOCAL && component.has("schemas")) {
30370
31754
  schemas = extractSchemas(component.get("schemas"), this.evaluator, "Component");
30371
31755
  } else if (metadata.isStandalone) {
30372
31756
  schemas = [];
@@ -30381,7 +31765,8 @@ var ComponentDecoratorHandler = class {
30381
31765
  template2 = extractTemplate(node, templateDecl, this.evaluator, this.depTracker, this.resourceLoader, {
30382
31766
  enableI18nLegacyMessageIdFormat: this.enableI18nLegacyMessageIdFormat,
30383
31767
  i18nNormalizeLineEndingsInICUs: this.i18nNormalizeLineEndingsInICUs,
30384
- usePoisonedData: this.usePoisonedData
31768
+ usePoisonedData: this.usePoisonedData,
31769
+ enabledBlockTypes: this.enabledBlockTypes
30385
31770
  });
30386
31771
  }
30387
31772
  const templateResource = template2.declaration.isInline ? { path: null, expression: component.get("template") } : {
@@ -30457,7 +31842,7 @@ var ComponentDecoratorHandler = class {
30457
31842
  ngContentSelectors: template2.ngContentSelectors
30458
31843
  },
30459
31844
  encapsulation,
30460
- interpolation: (_b2 = template2.interpolationConfig) != null ? _b2 : DEFAULT_INTERPOLATION_CONFIG,
31845
+ interpolation: (_c2 = template2.interpolationConfig) != null ? _c2 : DEFAULT_INTERPOLATION_CONFIG,
30461
31846
  styles,
30462
31847
  animations,
30463
31848
  viewProviders: wrappedViewProviders,
@@ -30480,7 +31865,7 @@ var ComponentDecoratorHandler = class {
30480
31865
  rawImports,
30481
31866
  resolvedImports,
30482
31867
  schemas,
30483
- decorator: (_c2 = decorator == null ? void 0 : decorator.node) != null ? _c2 : null
31868
+ decorator: (_d2 = decorator == null ? void 0 : decorator.node) != null ? _d2 : null
30484
31869
  },
30485
31870
  diagnostics
30486
31871
  };
@@ -30801,6 +32186,20 @@ var ComponentDecoratorHandler = class {
30801
32186
  const classMetadata = analysis.classMetadata !== null ? compileDeclareClassMetadata(analysis.classMetadata).toStmt() : null;
30802
32187
  return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields);
30803
32188
  }
32189
+ compileLocal(node, analysis, pool) {
32190
+ if (analysis.template.errors !== null && analysis.template.errors.length > 0) {
32191
+ return [];
32192
+ }
32193
+ const meta = __spreadProps(__spreadValues({}, analysis.meta), {
32194
+ declarationListEmitMode: 0,
32195
+ declarations: []
32196
+ });
32197
+ const fac = compileNgFactoryDefField(toFactoryMetadata(meta, FactoryTarget.Component));
32198
+ const def = compileComponentFromMetadata(meta, pool, makeBindingParser());
32199
+ const inputTransformFields = compileInputTransformFields(analysis.inputs);
32200
+ const classMetadata = analysis.classMetadata !== null ? compileClassMetadata(analysis.classMetadata).toStmt() : null;
32201
+ return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields);
32202
+ }
30804
32203
  _checkForCyclicImport(importedFile, expr, origin) {
30805
32204
  const imported = resolveImportedFile(this.moduleResolver, importedFile, expr, origin);
30806
32205
  if (imported === null) {
@@ -30910,6 +32309,9 @@ var InjectableDecoratorHandler = class {
30910
32309
  compilePartial(node, analysis) {
30911
32310
  return this.compile(compileDeclareFactory, compileDeclareInjectableFromMetadata, compileDeclareClassMetadata, node, analysis);
30912
32311
  }
32312
+ compileLocal(node, analysis) {
32313
+ return this.compile(compileNgFactoryDefField, (meta) => compileInjectable(meta, false), compileClassMetadata, node, analysis);
32314
+ }
30913
32315
  compile(compileFactoryFn, compileInjectableFn, compileClassMetadataFn, node, analysis) {
30914
32316
  const results = [];
30915
32317
  if (analysis.needsFactory) {
@@ -31199,6 +32601,12 @@ var PipeDecoratorHandler = class {
31199
32601
  const classMetadata = analysis.classMetadata !== null ? compileDeclareClassMetadata(analysis.classMetadata).toStmt() : null;
31200
32602
  return compileResults(fac, def, classMetadata, "\u0275pipe", null);
31201
32603
  }
32604
+ compileLocal(node, analysis) {
32605
+ const fac = compileNgFactoryDefField(toFactoryMetadata(analysis.meta, FactoryTarget.Pipe));
32606
+ const def = compilePipeFromMetadata(analysis.meta);
32607
+ const classMetadata = analysis.classMetadata !== null ? compileClassMetadata(analysis.classMetadata).toStmt() : null;
32608
+ return compileResults(fac, def, classMetadata, "\u0275pipe", null);
32609
+ }
31202
32610
  };
31203
32611
 
31204
32612
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
@@ -32275,16 +33683,16 @@ var TemplateVisitor = class extends RecursiveVisitor {
32275
33683
  this.visitAll(template2.children);
32276
33684
  this.visitAll(template2.references);
32277
33685
  }
32278
- visitBoundAttribute(attribute) {
32279
- if (attribute.valueSpan === void 0) {
33686
+ visitBoundAttribute(attribute2) {
33687
+ if (attribute2.valueSpan === void 0) {
32280
33688
  return;
32281
33689
  }
32282
- const { identifiers, errors } = ExpressionVisitor.getIdentifiers(attribute.value, attribute.valueSpan.toString(), attribute.valueSpan.start.offset, this.boundTemplate, this.targetToIdentifier.bind(this));
33690
+ const { identifiers, errors } = ExpressionVisitor.getIdentifiers(attribute2.value, attribute2.valueSpan.toString(), attribute2.valueSpan.start.offset, this.boundTemplate, this.targetToIdentifier.bind(this));
32283
33691
  identifiers.forEach((id) => this.identifiers.add(id));
32284
33692
  this.errors.push(...errors);
32285
33693
  }
32286
- visitBoundEvent(attribute) {
32287
- this.visitExpression(attribute.handler);
33694
+ visitBoundEvent(attribute2) {
33695
+ this.visitExpression(attribute2.handler);
32288
33696
  }
32289
33697
  visitBoundText(text2) {
32290
33698
  this.visitExpression(text2.value);
@@ -32303,6 +33711,22 @@ var TemplateVisitor = class extends RecursiveVisitor {
32303
33711
  }
32304
33712
  this.identifiers.add(variableIdentifier);
32305
33713
  }
33714
+ visitDeferredBlock(deferred) {
33715
+ var _a2, _b2, _c2;
33716
+ this.visitAll(deferred.children);
33717
+ (_a2 = deferred.placeholder) == null ? void 0 : _a2.visit(this);
33718
+ (_b2 = deferred.loading) == null ? void 0 : _b2.visit(this);
33719
+ (_c2 = deferred.error) == null ? void 0 : _c2.visit(this);
33720
+ }
33721
+ visitDeferredBlockPlaceholder(block) {
33722
+ this.visitAll(block.children);
33723
+ }
33724
+ visitDeferredBlockError(block) {
33725
+ this.visitAll(block.children);
33726
+ }
33727
+ visitDeferredBlockLoading(block) {
33728
+ this.visitAll(block.children);
33729
+ }
32306
33730
  elementOrTemplateToIdentifier(node) {
32307
33731
  var _a2;
32308
33732
  if (this.elementAndTemplateIdentifierCache.has(node)) {
@@ -36778,9 +38202,9 @@ var TemplateTypeCheckerImpl = class {
36778
38202
  }
36779
38203
  getPotentialDomBindings(tagName) {
36780
38204
  const attributes = REGISTRY2.allKnownAttributesOfElement(tagName);
36781
- return attributes.map((attribute) => ({
36782
- attribute,
36783
- property: REGISTRY2.getMappedPropName(attribute)
38205
+ return attributes.map((attribute2) => ({
38206
+ attribute: attribute2,
38207
+ property: REGISTRY2.getMappedPropName(attribute2)
36784
38208
  }));
36785
38209
  }
36786
38210
  getPotentialDomEvents(tagName) {
@@ -37081,13 +38505,13 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor2 {
37081
38505
  }
37082
38506
  visitReference(reference2) {
37083
38507
  }
37084
- visitTextAttribute(attribute) {
38508
+ visitTextAttribute(attribute2) {
37085
38509
  }
37086
- visitBoundAttribute(attribute) {
37087
- this.visitAst(attribute.value);
38510
+ visitBoundAttribute(attribute2) {
38511
+ this.visitAst(attribute2.value);
37088
38512
  }
37089
- visitBoundEvent(attribute) {
37090
- this.visitAst(attribute.handler);
38513
+ visitBoundEvent(attribute2) {
38514
+ this.visitAst(attribute2.handler);
37091
38515
  }
37092
38516
  visitText(text2) {
37093
38517
  }
@@ -37096,6 +38520,28 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor2 {
37096
38520
  }
37097
38521
  visitIcu(icu) {
37098
38522
  }
38523
+ visitDeferredBlock(deferred) {
38524
+ this.visitAllNodes(deferred.children);
38525
+ this.visitAllNodes(deferred.triggers);
38526
+ this.visitAllNodes(deferred.prefetchTriggers);
38527
+ deferred.placeholder && this.visit(deferred.placeholder);
38528
+ deferred.loading && this.visit(deferred.loading);
38529
+ deferred.error && this.visit(deferred.error);
38530
+ }
38531
+ visitDeferredTrigger(trigger) {
38532
+ if (trigger instanceof BoundDeferredTrigger) {
38533
+ this.visitAst(trigger.value);
38534
+ }
38535
+ }
38536
+ visitDeferredBlockPlaceholder(block) {
38537
+ this.visitAllNodes(block.children);
38538
+ }
38539
+ visitDeferredBlockError(block) {
38540
+ this.visitAllNodes(block.children);
38541
+ }
38542
+ visitDeferredBlockLoading(block) {
38543
+ this.visitAllNodes(block.children);
38544
+ }
37099
38545
  getDiagnostics(template2) {
37100
38546
  this.diagnostics = [];
37101
38547
  this.visitAllNodes(template2);
@@ -37483,7 +38929,7 @@ var NgCompiler = class {
37483
38929
  }
37484
38930
  }
37485
38931
  constructor(adapter, options, inputProgram, programDriver, incrementalStrategy, incrementalCompilation, enableTemplateTypeChecker, usePoisonedData, livePerfRecorder) {
37486
- var _a2;
38932
+ var _a2, _b2;
37487
38933
  this.adapter = adapter;
37488
38934
  this.options = options;
37489
38935
  this.inputProgram = inputProgram;
@@ -37497,6 +38943,7 @@ var NgCompiler = class {
37497
38943
  this.nonTemplateDiagnostics = null;
37498
38944
  this.delegatingPerfRecorder = new DelegatingPerfRecorder(this.perfRecorder);
37499
38945
  this.enableTemplateTypeChecker = enableTemplateTypeChecker || ((_a2 = options._enableTemplateTypeChecker) != null ? _a2 : false);
38946
+ this.enabledBlockTypes = new Set((_b2 = options._enabledBlockTypes) != null ? _b2 : []);
37500
38947
  this.constructionDiagnostics.push(...this.adapter.constructionDiagnostics, ...verifyCompatibleTypeCheckOptions(this.options));
37501
38948
  this.currentProgram = inputProgram;
37502
38949
  this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
@@ -37884,7 +39331,7 @@ var NgCompiler = class {
37884
39331
  return diagnostics;
37885
39332
  }
37886
39333
  makeCompilation() {
37887
- var _a2, _b2;
39334
+ var _a2, _b2, _c2;
37888
39335
  const checker = this.inputProgram.getTypeChecker();
37889
39336
  const reflector = new TypeScriptReflectionHost(checker);
37890
39337
  let refEmitter;
@@ -37955,16 +39402,20 @@ var NgCompiler = class {
37955
39402
  }
37956
39403
  const cycleHandlingStrategy = compilationMode === CompilationMode.FULL ? 0 : 1;
37957
39404
  const strictCtorDeps = this.options.strictInjectionParameters || false;
37958
- const supportTestBed = (_a2 = this.options.supportTestBed) != null ? _a2 : true;
39405
+ const supportJitMode = (_a2 = this.options.supportJitMode) != null ? _a2 : true;
39406
+ const supportTestBed = (_b2 = this.options.supportTestBed) != null ? _b2 : true;
37959
39407
  if (supportTestBed === false && compilationMode === CompilationMode.PARTIAL) {
37960
39408
  throw new Error('TestBed support ("supportTestBed" option) cannot be disabled in partial compilation mode.');
37961
39409
  }
39410
+ if (supportJitMode === false && compilationMode === CompilationMode.PARTIAL) {
39411
+ throw new Error('JIT mode support ("supportJitMode" option) cannot be disabled in partial compilation mode.');
39412
+ }
37962
39413
  const handlers = [
37963
- new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, depScopeReader, ngModuleScopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, this.resourceManager, this.adapter.rootDirs, this.options.preserveWhitespaces || false, this.options.i18nUseExternalIds !== false, this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs === true, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, this.incrementalCompilation.depGraph, injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, hostDirectivesResolver, supportTestBed),
39414
+ new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, depScopeReader, ngModuleScopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, this.resourceManager, this.adapter.rootDirs, this.options.preserveWhitespaces || false, this.options.i18nUseExternalIds !== false, this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs === true, this.enabledBlockTypes, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, this.incrementalCompilation.depGraph, injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, hostDirectivesResolver, supportTestBed, compilationMode),
37964
39415
  new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, supportTestBed),
37965
39416
  new PipeDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, injectableRegistry, isCore, this.delegatingPerfRecorder, supportTestBed),
37966
39417
  new InjectableDecoratorHandler(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, this.delegatingPerfRecorder, supportTestBed),
37967
- new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, this.closureCompilerEnabled, (_b2 = this.options.onlyPublishPublicTypingsForNgModules) != null ? _b2 : false, injectableRegistry, this.delegatingPerfRecorder, supportTestBed)
39418
+ new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, this.closureCompilerEnabled, (_c2 = this.options.onlyPublishPublicTypingsForNgModules) != null ? _c2 : false, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, supportJitMode, compilationMode)
37968
39419
  ];
37969
39420
  const traitCompiler = new TraitCompiler(handlers, reflector, this.delegatingPerfRecorder, this.incrementalCompilation, this.options.compileNonExportedClasses !== false, compilationMode, dtsTransforms, semanticDepGraphUpdater, this.adapter);
37970
39421
  const notifyingDriver = new NotifyingProgramDriverWrapper(this.programDriver, (program) => {