@angular-eslint/bundled-angular-compiler 22.1.1-alpha.1 → 22.1.1-alpha.2

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 (2) hide show
  1. package/dist/index.js +1018 -554
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -182,6 +182,7 @@ __export(index_exports, {
182
182
  TmplAstBoundText: () => BoundText,
183
183
  TmplAstComponent: () => Component$1,
184
184
  TmplAstContent: () => Content,
185
+ TmplAstContentBlock: () => ContentBlock,
185
186
  TmplAstDeferredBlock: () => DeferredBlock,
186
187
  TmplAstDeferredBlockError: () => DeferredBlockError,
187
188
  TmplAstDeferredBlockLoading: () => DeferredBlockLoading,
@@ -306,7 +307,7 @@ __export(index_exports, {
306
307
  });
307
308
  module.exports = __toCommonJS(index_exports);
308
309
 
309
- // ../../node_modules/.pnpm/@angular+compiler@22.0.5/node_modules/@angular/compiler/fesm2022/compiler.mjs
310
+ // ../../node_modules/.pnpm/@angular+compiler@22.1.2/node_modules/@angular/compiler/fesm2022/compiler.mjs
310
311
  var _SELECTOR_REGEXP = new RegExp(`(\\:not\\()|(([\\.\\#]?)[-\\w]+)|(?:\\[([-.\\w*\\\\$]+)(?:=(["']?)([^\\]"']*)\\5)?\\])|(\\))|(\\s*,\\s*)`, "g");
311
312
  var CssSelector = class _CssSelector {
312
313
  static {
@@ -2749,10 +2750,8 @@ var ConstantPool = class {
2749
2750
  isClosureCompilerEnabled;
2750
2751
  statements = [];
2751
2752
  literals = /* @__PURE__ */ new Map();
2752
- literalFactories = /* @__PURE__ */ new Map();
2753
2753
  sharedConstants = /* @__PURE__ */ new Map();
2754
2754
  _claimedNames = /* @__PURE__ */ new Map();
2755
- nextNameIndex = 0;
2756
2755
  constructor(isClosureCompilerEnabled = false) {
2757
2756
  this.isClosureCompilerEnabled = isClosureCompilerEnabled;
2758
2757
  }
@@ -2899,6 +2898,18 @@ var Identifiers = class {
2899
2898
  name: "\u0275\u0275elementEnd",
2900
2899
  moduleName: CORE
2901
2900
  };
2901
+ static foreignComponent = {
2902
+ name: "\u0275\u0275foreignComponent",
2903
+ moduleName: CORE
2904
+ };
2905
+ static foreignContent = {
2906
+ name: "\u0275\u0275foreignContent",
2907
+ moduleName: CORE
2908
+ };
2909
+ static foreignContentFn = {
2910
+ name: "\u0275\u0275foreignContentFn",
2911
+ moduleName: CORE
2912
+ };
2902
2913
  static domElement = {
2903
2914
  name: "\u0275\u0275domElement",
2904
2915
  moduleName: CORE
@@ -3828,6 +3839,14 @@ function getJitStandaloneDefaultForVersion(version) {
3828
3839
  return true;
3829
3840
  }
3830
3841
  __name(getJitStandaloneDefaultForVersion, "getJitStandaloneDefaultForVersion");
3842
+ function namespaceCssVariable(varName) {
3843
+ if (varName.startsWith("--global--")) {
3844
+ return "--" + varName.substring("--global--".length);
3845
+ } else {
3846
+ return "--%NS%" + varName.substring("--".length);
3847
+ }
3848
+ }
3849
+ __name(namespaceCssVariable, "namespaceCssVariable");
3831
3850
  var VERSION$1 = 3;
3832
3851
  var JS_B64_PREFIX = "# sourceMappingURL=data:application/json;base64,";
3833
3852
  var SourceMapGenerator = class {
@@ -4526,6 +4545,8 @@ function escapeIdentifier(input, alwaysQuote = true) {
4526
4545
  }
4527
4546
  __name(escapeIdentifier, "escapeIdentifier");
4528
4547
  var UNSAFE_OBJECT_KEY_NAME_REGEXP = /[-.]/;
4548
+ var IDENTIFIER_PATTERN = /^[$A-Z_][0-9A-Z_$]*$/i;
4549
+ var LET_PATTERN = /^let\s+([\S\s]*)/;
4529
4550
  function typeWithParameters(type, numParams) {
4530
4551
  if (numParams === 0) {
4531
4552
  return expressionType(type);
@@ -5896,6 +5917,25 @@ var DeferredBlockError = class extends BlockNode {
5896
5917
  return visitor.visitDeferredBlockError(this);
5897
5918
  }
5898
5919
  };
5920
+ var ContentBlock = class extends BlockNode {
5921
+ static {
5922
+ __name(this, "ContentBlock");
5923
+ }
5924
+ name;
5925
+ variables;
5926
+ children;
5927
+ i18n;
5928
+ constructor(name, variables, children, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
5929
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
5930
+ this.name = name;
5931
+ this.variables = variables;
5932
+ this.children = children;
5933
+ this.i18n = i18n2;
5934
+ }
5935
+ visit(visitor) {
5936
+ return visitor.visitContentBlock(this);
5937
+ }
5938
+ };
5899
5939
  var DeferredBlock = class extends BlockNode {
5900
5940
  static {
5901
5941
  __name(this, "DeferredBlock");
@@ -6424,6 +6464,9 @@ var RecursiveVisitor$1 = class RecursiveVisitor {
6424
6464
  }
6425
6465
  visitLetDeclaration(decl) {
6426
6466
  }
6467
+ visitContentBlock(block) {
6468
+ visitAll$1(this, block.children);
6469
+ }
6427
6470
  };
6428
6471
  function visitAll$1(visitor, nodes) {
6429
6472
  const result = [];
@@ -8397,6 +8440,16 @@ var COLON_IN_PLACEHOLDER = "%COLON_IN_PLACEHOLDER%";
8397
8440
  var _cssCommaInPlaceholderReGlobal = new RegExp(COMMA_IN_PLACEHOLDER, "g");
8398
8441
  var _cssSemiInPlaceholderReGlobal = new RegExp(SEMI_IN_PLACEHOLDER, "g");
8399
8442
  var _cssColonInPlaceholderReGlobal = new RegExp(COLON_IN_PLACEHOLDER, "g");
8443
+ var _cssVariableRe = /(var\(\s*)?(--(?:[a-zA-Z0-9_-]|[^\x00-\x7F])+)(\s*:)?/g;
8444
+ function namespaceCssVariables(cssText) {
8445
+ return cssText.replace(_cssVariableRe, (match, leadingVar, varName, trailingColon) => {
8446
+ if (!leadingVar && !trailingColon) {
8447
+ return match;
8448
+ }
8449
+ return (leadingVar ?? "") + namespaceCssVariable(varName) + (trailingColon ?? "");
8450
+ });
8451
+ }
8452
+ __name(namespaceCssVariables, "namespaceCssVariables");
8400
8453
  var CssRule = class {
8401
8454
  static {
8402
8455
  __name(this, "CssRule");
@@ -8558,61 +8611,63 @@ var OpKind;
8558
8611
  OpKind2[OpKind2["Variable"] = 2] = "Variable";
8559
8612
  OpKind2[OpKind2["ElementStart"] = 3] = "ElementStart";
8560
8613
  OpKind2[OpKind2["Element"] = 4] = "Element";
8561
- OpKind2[OpKind2["Template"] = 5] = "Template";
8562
- OpKind2[OpKind2["ElementEnd"] = 6] = "ElementEnd";
8563
- OpKind2[OpKind2["ContainerStart"] = 7] = "ContainerStart";
8564
- OpKind2[OpKind2["Container"] = 8] = "Container";
8565
- OpKind2[OpKind2["ContainerEnd"] = 9] = "ContainerEnd";
8566
- OpKind2[OpKind2["DisableBindings"] = 10] = "DisableBindings";
8567
- OpKind2[OpKind2["ConditionalCreate"] = 11] = "ConditionalCreate";
8568
- OpKind2[OpKind2["ConditionalBranchCreate"] = 12] = "ConditionalBranchCreate";
8569
- OpKind2[OpKind2["Conditional"] = 13] = "Conditional";
8570
- OpKind2[OpKind2["EnableBindings"] = 14] = "EnableBindings";
8571
- OpKind2[OpKind2["Text"] = 15] = "Text";
8572
- OpKind2[OpKind2["Listener"] = 16] = "Listener";
8573
- OpKind2[OpKind2["InterpolateText"] = 17] = "InterpolateText";
8574
- OpKind2[OpKind2["Binding"] = 18] = "Binding";
8575
- OpKind2[OpKind2["Property"] = 19] = "Property";
8576
- OpKind2[OpKind2["StyleProp"] = 20] = "StyleProp";
8577
- OpKind2[OpKind2["ClassProp"] = 21] = "ClassProp";
8578
- OpKind2[OpKind2["StyleMap"] = 22] = "StyleMap";
8579
- OpKind2[OpKind2["ClassMap"] = 23] = "ClassMap";
8580
- OpKind2[OpKind2["Advance"] = 24] = "Advance";
8581
- OpKind2[OpKind2["Pipe"] = 25] = "Pipe";
8582
- OpKind2[OpKind2["Attribute"] = 26] = "Attribute";
8583
- OpKind2[OpKind2["ExtractedAttribute"] = 27] = "ExtractedAttribute";
8584
- OpKind2[OpKind2["Defer"] = 28] = "Defer";
8585
- OpKind2[OpKind2["DeferOn"] = 29] = "DeferOn";
8586
- OpKind2[OpKind2["DeferWhen"] = 30] = "DeferWhen";
8587
- OpKind2[OpKind2["I18nMessage"] = 31] = "I18nMessage";
8588
- OpKind2[OpKind2["DomProperty"] = 32] = "DomProperty";
8589
- OpKind2[OpKind2["Namespace"] = 33] = "Namespace";
8590
- OpKind2[OpKind2["ProjectionDef"] = 34] = "ProjectionDef";
8591
- OpKind2[OpKind2["EnableIncrementalHydrationRuntime"] = 35] = "EnableIncrementalHydrationRuntime";
8592
- OpKind2[OpKind2["Projection"] = 36] = "Projection";
8593
- OpKind2[OpKind2["RepeaterCreate"] = 37] = "RepeaterCreate";
8594
- OpKind2[OpKind2["Repeater"] = 38] = "Repeater";
8595
- OpKind2[OpKind2["TwoWayProperty"] = 39] = "TwoWayProperty";
8596
- OpKind2[OpKind2["TwoWayListener"] = 40] = "TwoWayListener";
8597
- OpKind2[OpKind2["DeclareLet"] = 41] = "DeclareLet";
8598
- OpKind2[OpKind2["StoreLet"] = 42] = "StoreLet";
8599
- OpKind2[OpKind2["I18nStart"] = 43] = "I18nStart";
8600
- OpKind2[OpKind2["I18n"] = 44] = "I18n";
8601
- OpKind2[OpKind2["I18nEnd"] = 45] = "I18nEnd";
8602
- OpKind2[OpKind2["I18nExpression"] = 46] = "I18nExpression";
8603
- OpKind2[OpKind2["I18nApply"] = 47] = "I18nApply";
8604
- OpKind2[OpKind2["IcuStart"] = 48] = "IcuStart";
8605
- OpKind2[OpKind2["IcuEnd"] = 49] = "IcuEnd";
8606
- OpKind2[OpKind2["IcuPlaceholder"] = 50] = "IcuPlaceholder";
8607
- OpKind2[OpKind2["I18nContext"] = 51] = "I18nContext";
8608
- OpKind2[OpKind2["I18nAttributes"] = 52] = "I18nAttributes";
8609
- OpKind2[OpKind2["SourceLocation"] = 53] = "SourceLocation";
8610
- OpKind2[OpKind2["Animation"] = 54] = "Animation";
8611
- OpKind2[OpKind2["AnimationString"] = 55] = "AnimationString";
8612
- OpKind2[OpKind2["AnimationBinding"] = 56] = "AnimationBinding";
8613
- OpKind2[OpKind2["AnimationListener"] = 57] = "AnimationListener";
8614
- OpKind2[OpKind2["Control"] = 58] = "Control";
8615
- OpKind2[OpKind2["ControlCreate"] = 59] = "ControlCreate";
8614
+ OpKind2[OpKind2["ForeignComponent"] = 5] = "ForeignComponent";
8615
+ OpKind2[OpKind2["Template"] = 6] = "Template";
8616
+ OpKind2[OpKind2["ElementEnd"] = 7] = "ElementEnd";
8617
+ OpKind2[OpKind2["ContainerStart"] = 8] = "ContainerStart";
8618
+ OpKind2[OpKind2["Container"] = 9] = "Container";
8619
+ OpKind2[OpKind2["ContainerEnd"] = 10] = "ContainerEnd";
8620
+ OpKind2[OpKind2["DisableBindings"] = 11] = "DisableBindings";
8621
+ OpKind2[OpKind2["ConditionalCreate"] = 12] = "ConditionalCreate";
8622
+ OpKind2[OpKind2["ConditionalBranchCreate"] = 13] = "ConditionalBranchCreate";
8623
+ OpKind2[OpKind2["Conditional"] = 14] = "Conditional";
8624
+ OpKind2[OpKind2["EnableBindings"] = 15] = "EnableBindings";
8625
+ OpKind2[OpKind2["Text"] = 16] = "Text";
8626
+ OpKind2[OpKind2["Listener"] = 17] = "Listener";
8627
+ OpKind2[OpKind2["InterpolateText"] = 18] = "InterpolateText";
8628
+ OpKind2[OpKind2["Binding"] = 19] = "Binding";
8629
+ OpKind2[OpKind2["Property"] = 20] = "Property";
8630
+ OpKind2[OpKind2["StyleProp"] = 21] = "StyleProp";
8631
+ OpKind2[OpKind2["ClassProp"] = 22] = "ClassProp";
8632
+ OpKind2[OpKind2["StyleMap"] = 23] = "StyleMap";
8633
+ OpKind2[OpKind2["ClassMap"] = 24] = "ClassMap";
8634
+ OpKind2[OpKind2["Advance"] = 25] = "Advance";
8635
+ OpKind2[OpKind2["Pipe"] = 26] = "Pipe";
8636
+ OpKind2[OpKind2["Attribute"] = 27] = "Attribute";
8637
+ OpKind2[OpKind2["ExtractedAttribute"] = 28] = "ExtractedAttribute";
8638
+ OpKind2[OpKind2["Defer"] = 29] = "Defer";
8639
+ OpKind2[OpKind2["DeferOn"] = 30] = "DeferOn";
8640
+ OpKind2[OpKind2["DeferWhen"] = 31] = "DeferWhen";
8641
+ OpKind2[OpKind2["I18nMessage"] = 32] = "I18nMessage";
8642
+ OpKind2[OpKind2["DomProperty"] = 33] = "DomProperty";
8643
+ OpKind2[OpKind2["Namespace"] = 34] = "Namespace";
8644
+ OpKind2[OpKind2["ProjectionDef"] = 35] = "ProjectionDef";
8645
+ OpKind2[OpKind2["EnableIncrementalHydrationRuntime"] = 36] = "EnableIncrementalHydrationRuntime";
8646
+ OpKind2[OpKind2["Projection"] = 37] = "Projection";
8647
+ OpKind2[OpKind2["Content"] = 38] = "Content";
8648
+ OpKind2[OpKind2["RepeaterCreate"] = 39] = "RepeaterCreate";
8649
+ OpKind2[OpKind2["Repeater"] = 40] = "Repeater";
8650
+ OpKind2[OpKind2["TwoWayProperty"] = 41] = "TwoWayProperty";
8651
+ OpKind2[OpKind2["TwoWayListener"] = 42] = "TwoWayListener";
8652
+ OpKind2[OpKind2["DeclareLet"] = 43] = "DeclareLet";
8653
+ OpKind2[OpKind2["StoreLet"] = 44] = "StoreLet";
8654
+ OpKind2[OpKind2["I18nStart"] = 45] = "I18nStart";
8655
+ OpKind2[OpKind2["I18n"] = 46] = "I18n";
8656
+ OpKind2[OpKind2["I18nEnd"] = 47] = "I18nEnd";
8657
+ OpKind2[OpKind2["I18nExpression"] = 48] = "I18nExpression";
8658
+ OpKind2[OpKind2["I18nApply"] = 49] = "I18nApply";
8659
+ OpKind2[OpKind2["IcuStart"] = 50] = "IcuStart";
8660
+ OpKind2[OpKind2["IcuEnd"] = 51] = "IcuEnd";
8661
+ OpKind2[OpKind2["IcuPlaceholder"] = 52] = "IcuPlaceholder";
8662
+ OpKind2[OpKind2["I18nContext"] = 53] = "I18nContext";
8663
+ OpKind2[OpKind2["I18nAttributes"] = 54] = "I18nAttributes";
8664
+ OpKind2[OpKind2["SourceLocation"] = 55] = "SourceLocation";
8665
+ OpKind2[OpKind2["Animation"] = 56] = "Animation";
8666
+ OpKind2[OpKind2["AnimationString"] = 57] = "AnimationString";
8667
+ OpKind2[OpKind2["AnimationBinding"] = 58] = "AnimationBinding";
8668
+ OpKind2[OpKind2["AnimationListener"] = 59] = "AnimationListener";
8669
+ OpKind2[OpKind2["Control"] = 60] = "Control";
8670
+ OpKind2[OpKind2["ControlCreate"] = 61] = "ControlCreate";
8616
8671
  })(OpKind || (OpKind = {}));
8617
8672
  var ExpressionKind;
8618
8673
  (function(ExpressionKind2) {
@@ -8642,7 +8697,8 @@ var ExpressionKind;
8642
8697
  ExpressionKind2[ExpressionKind2["ConditionalCase"] = 23] = "ConditionalCase";
8643
8698
  ExpressionKind2[ExpressionKind2["ConstCollected"] = 24] = "ConstCollected";
8644
8699
  ExpressionKind2[ExpressionKind2["TwoWayBindingSet"] = 25] = "TwoWayBindingSet";
8645
- ExpressionKind2[ExpressionKind2["ArrowFunction"] = 26] = "ArrowFunction";
8700
+ ExpressionKind2[ExpressionKind2["ForeignContent"] = 26] = "ForeignContent";
8701
+ ExpressionKind2[ExpressionKind2["ArrowFunction"] = 27] = "ArrowFunction";
8646
8702
  })(ExpressionKind || (ExpressionKind = {}));
8647
8703
  var VariableFlags;
8648
8704
  (function(VariableFlags2) {
@@ -9301,6 +9357,34 @@ var ReferenceExpr = class _ReferenceExpr extends ExpressionBase {
9301
9357
  return new _ReferenceExpr(this.target, this.targetSlot, this.offset);
9302
9358
  }
9303
9359
  };
9360
+ var ForeignContentExpr = class _ForeignContentExpr extends ExpressionBase {
9361
+ static {
9362
+ __name(this, "ForeignContentExpr");
9363
+ }
9364
+ childrenViewXref;
9365
+ childrenViewHandle;
9366
+ foreignComponentConstIndex;
9367
+ kind = ExpressionKind.ForeignContent;
9368
+ constructor(childrenViewXref, childrenViewHandle, foreignComponentConstIndex) {
9369
+ super();
9370
+ this.childrenViewXref = childrenViewXref;
9371
+ this.childrenViewHandle = childrenViewHandle;
9372
+ this.foreignComponentConstIndex = foreignComponentConstIndex;
9373
+ }
9374
+ visitExpression() {
9375
+ }
9376
+ isEquivalent(e) {
9377
+ return e instanceof _ForeignContentExpr && e.childrenViewXref === this.childrenViewXref && e.foreignComponentConstIndex === this.foreignComponentConstIndex;
9378
+ }
9379
+ isConstant() {
9380
+ return false;
9381
+ }
9382
+ transformInternalExpressions() {
9383
+ }
9384
+ clone() {
9385
+ return new _ForeignContentExpr(this.childrenViewXref, this.childrenViewHandle, this.foreignComponentConstIndex);
9386
+ }
9387
+ };
9304
9388
  var StoreLetExpr = class _StoreLetExpr extends ExpressionBase {
9305
9389
  static {
9306
9390
  __name(this, "StoreLetExpr");
@@ -10177,6 +10261,11 @@ function transformExpressionsInOp(op, transform2, flags) {
10177
10261
  case OpKind.StoreLet:
10178
10262
  op.value = transformExpressionsInExpression(op.value, transform2, flags);
10179
10263
  break;
10264
+ case OpKind.ForeignComponent:
10265
+ for (const [key, expr] of op.props) {
10266
+ op.props.set(key, transformExpressionsInExpression(expr, transform2, flags));
10267
+ }
10268
+ break;
10180
10269
  case OpKind.Advance:
10181
10270
  case OpKind.Container:
10182
10271
  case OpKind.ContainerEnd:
@@ -10200,6 +10289,7 @@ function transformExpressionsInOp(op, transform2, flags) {
10200
10289
  case OpKind.ProjectionDef:
10201
10290
  case OpKind.EnableIncrementalHydrationRuntime:
10202
10291
  case OpKind.Template:
10292
+ case OpKind.Content:
10203
10293
  case OpKind.Text:
10204
10294
  case OpKind.I18nAttributes:
10205
10295
  case OpKind.IcuPlaceholder:
@@ -10343,6 +10433,31 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, startSource
10343
10433
  };
10344
10434
  }
10345
10435
  __name(createElementStartOp, "createElementStartOp");
10436
+ function createForeignComponentOp(xref, constIndex, props, sourceSpan) {
10437
+ return {
10438
+ kind: OpKind.ForeignComponent,
10439
+ xref,
10440
+ handle: new SlotHandle(),
10441
+ constIndex,
10442
+ props,
10443
+ sourceSpan,
10444
+ ...TRAIT_CONSUMES_SLOT,
10445
+ ...NEW_OP
10446
+ };
10447
+ }
10448
+ __name(createForeignComponentOp, "createForeignComponentOp");
10449
+ function createContentOp(target, view, propertyName, startSourceSpan, sourceSpan) {
10450
+ return {
10451
+ kind: OpKind.Content,
10452
+ target,
10453
+ propertyName,
10454
+ view,
10455
+ startSourceSpan,
10456
+ sourceSpan,
10457
+ ...NEW_OP
10458
+ };
10459
+ }
10460
+ __name(createContentOp, "createContentOp");
10346
10461
  function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
10347
10462
  return {
10348
10463
  kind: OpKind.Template,
@@ -10864,7 +10979,9 @@ var ComponentCompilationJob = class extends CompilationJob {
10864
10979
  allDeferrableDepsFn;
10865
10980
  relativeTemplatePath;
10866
10981
  enableDebugLocations;
10867
- constructor(componentName, pool, mode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations, legacyOptionalChaining) {
10982
+ foreignImports;
10983
+ foreignMatcher;
10984
+ constructor(componentName, pool, mode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations, legacyOptionalChaining, foreignImports) {
10868
10985
  super(componentName, pool, mode, legacyOptionalChaining);
10869
10986
  this.relativeContextFilePath = relativeContextFilePath;
10870
10987
  this.i18nUseExternalIds = i18nUseExternalIds;
@@ -10872,8 +10989,25 @@ var ComponentCompilationJob = class extends CompilationJob {
10872
10989
  this.allDeferrableDepsFn = allDeferrableDepsFn;
10873
10990
  this.relativeTemplatePath = relativeTemplatePath;
10874
10991
  this.enableDebugLocations = enableDebugLocations;
10992
+ this.foreignImports = foreignImports;
10875
10993
  this.root = new ViewCompilationUnit(this, this.allocateXrefId(), null);
10876
10994
  this.views.set(this.root.xref, this.root);
10995
+ if (foreignImports && foreignImports.length > 0) {
10996
+ const registry = /* @__PURE__ */ new Map();
10997
+ for (const meta of foreignImports) {
10998
+ registry.set(meta.name, [meta]);
10999
+ }
11000
+ this.foreignMatcher = new SelectorlessMatcher(registry);
11001
+ } else {
11002
+ this.foreignMatcher = null;
11003
+ }
11004
+ }
11005
+ getForeignComponent(element2) {
11006
+ if (this.foreignMatcher === null) {
11007
+ return null;
11008
+ }
11009
+ const matches = this.foreignMatcher.match(element2.name);
11010
+ return matches.length > 0 ? matches[0] : null;
10877
11011
  }
10878
11012
  kind = CompilationJobKind.Tmpl;
10879
11013
  fnSuffix = "Template";
@@ -11842,7 +11976,8 @@ function resolveDeferTargetNames(job) {
11842
11976
  }
11843
11977
  __name(getScopeForView2, "getScopeForView");
11844
11978
  function resolveTrigger(deferOwnerView, op, placeholderView) {
11845
- switch (op.trigger.kind) {
11979
+ const triggerKind = op.trigger.kind;
11980
+ switch (triggerKind) {
11846
11981
  case DeferTriggerKind.Idle:
11847
11982
  case DeferTriggerKind.Never:
11848
11983
  case DeferTriggerKind.Immediate:
@@ -11889,8 +12024,10 @@ function resolveDeferTargetNames(job) {
11889
12024
  step++;
11890
12025
  }
11891
12026
  break;
11892
- default:
11893
- throw new Error(`Trigger kind ${op.trigger.kind} not handled`);
12027
+ default: {
12028
+ const unhandledTriggerKind = triggerKind;
12029
+ throw new Error(`Trigger kind ${unhandledTriggerKind} not handled`);
12030
+ }
11894
12031
  }
11895
12032
  }
11896
12033
  __name(resolveTrigger, "resolveTrigger");
@@ -12386,6 +12523,7 @@ function recursivelyProcessView(view, parentScope) {
12386
12523
  break;
12387
12524
  }
12388
12525
  }
12526
+ view.create.prepend(generateVariablesInScopeForView(view, scope, false));
12389
12527
  view.update.prepend(generateVariablesInScopeForView(view, scope, false));
12390
12528
  for (const expr of view.functions) {
12391
12529
  expr.ops.prepend(generateVariablesInScopeForView(view, getScopeForView(view, parentScope), true));
@@ -12463,7 +12601,14 @@ function generateVariablesInScopeForView(view, scope, isCallback) {
12463
12601
  const scopeView = view.job.views.get(scope.view);
12464
12602
  for (const [name, value] of scopeView.contextVariables) {
12465
12603
  const context = new ContextExpr(scope.view);
12466
- const variable2 = value === CTX_REF ? context : new ReadPropExpr(context, value);
12604
+ let variable2;
12605
+ if (value === CTX_REF) {
12606
+ variable2 = context;
12607
+ } else if (typeof value === "number") {
12608
+ variable2 = new ReadKeyExpr(context, literal(value));
12609
+ } else {
12610
+ variable2 = new ReadPropExpr(context, value);
12611
+ }
12467
12612
  newOps.push(createVariableOp(view.job.allocateXrefId(), scope.contextVariables.get(name), variable2, VariableFlags.None));
12468
12613
  }
12469
12614
  for (const alias of scopeView.aliases) {
@@ -12514,6 +12659,8 @@ function parseHostStyleProperties(job) {
12514
12659
  op.name = op.name.substring(STYLE_DOT.length);
12515
12660
  if (!isCssCustomProperty(op.name)) {
12516
12661
  op.name = hyphenate$1(op.name);
12662
+ } else {
12663
+ op.name = namespaceCssVariable(op.name);
12517
12664
  }
12518
12665
  const {
12519
12666
  property: property2,
@@ -15100,11 +15247,13 @@ var CharacterReferenceType;
15100
15247
  CharacterReferenceType2["HEX"] = "hexadecimal";
15101
15248
  CharacterReferenceType2["DEC"] = "decimal";
15102
15249
  })(CharacterReferenceType || (CharacterReferenceType = {}));
15103
- var SUPPORTED_BLOCKS = ["@if", "@else", "@for", "@switch", "@case", "@default", "@empty", "@defer", "@placeholder", "@loading", "@error"];
15250
+ var SUPPORTED_BLOCKS = ["@if", "@else", "@for", "@switch", "@case", "@default", "@empty", "@defer", "@placeholder", "@loading", "@error", "@content"];
15104
15251
  var INTERPOLATION = {
15105
15252
  start: "{{",
15106
15253
  end: "}}"
15107
15254
  };
15255
+ var DEFAULT_NEVER_PATTERN = /^default[^\S\r\n]+never/;
15256
+ var ELSE_IF_PATTERN = /^else[^\S\r\n]+if/;
15108
15257
  var _Tokenizer = class {
15109
15258
  static {
15110
15259
  __name(this, "_Tokenizer");
@@ -15169,6 +15318,8 @@ var _Tokenizer = class {
15169
15318
  }
15170
15319
  } else if (this._attemptCharCode($SLASH)) {
15171
15320
  this._consumeTagClose(start);
15321
+ } else if (this._attemptCharCode($QUESTION)) {
15322
+ this._consumeProcessingInstruction(start);
15172
15323
  } else {
15173
15324
  this._consumeTagOpen(start);
15174
15325
  }
@@ -15185,7 +15336,7 @@ var _Tokenizer = class {
15185
15336
  this.handleError(e);
15186
15337
  }
15187
15338
  }
15188
- this._beginToken(42);
15339
+ this._beginToken(43);
15189
15340
  this._endToken([]);
15190
15341
  }
15191
15342
  _getBlockName() {
@@ -15201,7 +15352,13 @@ var _Tokenizer = class {
15201
15352
  }
15202
15353
  return true;
15203
15354
  });
15204
- return this._cursor.getChars(nameCursor).trim();
15355
+ let result = this._cursor.getChars(nameCursor).trim();
15356
+ if (ELSE_IF_PATTERN.test(result)) {
15357
+ result = "else if";
15358
+ } else if (DEFAULT_NEVER_PATTERN.test(result)) {
15359
+ result = "default never";
15360
+ }
15361
+ return result;
15205
15362
  }
15206
15363
  _consumeBlockStart(start) {
15207
15364
  this._requireCharCode($AT);
@@ -15314,23 +15471,7 @@ var _Tokenizer = class {
15314
15471
  _consumeLetDeclarationValue() {
15315
15472
  const start = this._cursor.clone();
15316
15473
  this._beginToken(31, start);
15317
- while (this._cursor.peek() !== $EOF) {
15318
- const char = this._cursor.peek();
15319
- if (char === $SEMICOLON) {
15320
- break;
15321
- }
15322
- if (isQuote(char)) {
15323
- this._cursor.advance();
15324
- this._attemptCharCodeUntilFn((inner) => {
15325
- if (inner === $BACKSLASH) {
15326
- this._cursor.advance();
15327
- return false;
15328
- }
15329
- return inner === char;
15330
- });
15331
- }
15332
- this._cursor.advance();
15333
- }
15474
+ this._attemptUntilIgnoreQuotes((char) => char === $SEMICOLON);
15334
15475
  this._endToken([this._cursor.getChars(start)]);
15335
15476
  }
15336
15477
  _tokenizeExpansionForm() {
@@ -15459,6 +15600,25 @@ var _Tokenizer = class {
15459
15600
  this._cursor.advance();
15460
15601
  }
15461
15602
  }
15603
+ _attemptUntilIgnoreQuotes(predicate) {
15604
+ while (this._cursor.peek() !== $EOF) {
15605
+ const char = this._cursor.peek();
15606
+ if (predicate(char)) {
15607
+ break;
15608
+ }
15609
+ if (isQuote(char)) {
15610
+ this._cursor.advance();
15611
+ this._attemptCharCodeUntilFn((inner) => {
15612
+ if (inner === $BACKSLASH) {
15613
+ this._cursor.advance();
15614
+ return false;
15615
+ }
15616
+ return inner === char;
15617
+ });
15618
+ }
15619
+ this._cursor.advance();
15620
+ }
15621
+ }
15462
15622
  _readChar() {
15463
15623
  const char = String.fromCodePoint(this._cursor.peek());
15464
15624
  this._cursor.advance();
@@ -15570,6 +15730,18 @@ var _Tokenizer = class {
15570
15730
  this._cursor.advance();
15571
15731
  this._endToken([content]);
15572
15732
  }
15733
+ _consumeProcessingInstruction(start) {
15734
+ this._beginToken(42, start);
15735
+ const contentStart = this._cursor.clone();
15736
+ this._attemptUntilIgnoreQuotes((char) => char === $QUESTION || char === $GT);
15737
+ const endChar = this._cursor.peek();
15738
+ const content = this._cursor.getChars(contentStart);
15739
+ this._cursor.advance();
15740
+ if (endChar === $QUESTION) {
15741
+ this._requireCharCode($GT);
15742
+ }
15743
+ this._endToken([content]);
15744
+ }
15573
15745
  _consumePrefixAndName(endPredicate) {
15574
15746
  const nameOrPrefixStart = this._cursor.clone();
15575
15747
  let prefix = "";
@@ -15996,7 +16168,7 @@ var _Tokenizer = class {
15996
16168
  const tmp = this._cursor.clone();
15997
16169
  tmp.advance();
15998
16170
  const code = tmp.peek();
15999
- if ($a <= code && code <= $z || $A <= code && code <= $Z || code === $SLASH || code === $BANG) {
16171
+ if ($a <= code && code <= $z || $A <= code && code <= $Z || code === $SLASH || code === $BANG || code === $QUESTION) {
16000
16172
  return true;
16001
16173
  }
16002
16174
  }
@@ -16370,7 +16542,7 @@ var _TreeBuilder = class __TreeBuilder {
16370
16542
  this._advance();
16371
16543
  }
16372
16544
  build() {
16373
- while (this._peek.type !== 42) {
16545
+ while (this._peek.type !== 43) {
16374
16546
  if (this._peek.type === 0 || this._peek.type === 4) {
16375
16547
  this._consumeElementStartTag(this._advance());
16376
16548
  } else if (this._peek.type === 3) {
@@ -16468,7 +16640,7 @@ var _TreeBuilder = class __TreeBuilder {
16468
16640
  if (!exp) return null;
16469
16641
  const end = this._advance();
16470
16642
  exp.push({
16471
- type: 42,
16643
+ type: 43,
16472
16644
  parts: [],
16473
16645
  sourceSpan: end.sourceSpan
16474
16646
  });
@@ -16506,7 +16678,7 @@ var _TreeBuilder = class __TreeBuilder {
16506
16678
  return null;
16507
16679
  }
16508
16680
  }
16509
- if (this._peek.type === 42) {
16681
+ if (this._peek.type === 43) {
16510
16682
  this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));
16511
16683
  return null;
16512
16684
  }
@@ -18693,9 +18865,8 @@ var _ParseAST = class {
18693
18865
  const expression = this.parsePipe();
18694
18866
  if (expression instanceof EmptyExpr$1) {
18695
18867
  this.error("Template literal interpolation cannot be empty");
18696
- } else {
18697
- expressions.push(expression);
18698
18868
  }
18869
+ expressions.push(expression);
18699
18870
  this.rbracesExpected--;
18700
18871
  } else {
18701
18872
  this.advance();
@@ -20768,6 +20939,7 @@ function mergeNextContextExpressions(job) {
20768
20939
  mergeNextContextsInOps(op.handlerOps);
20769
20940
  }
20770
20941
  }
20942
+ mergeNextContextsInOps(unit.create);
20771
20943
  mergeNextContextsInOps(unit.update);
20772
20944
  }
20773
20945
  }
@@ -21009,7 +21181,7 @@ function processPipeBindingsInView(unit) {
21009
21181
  if (slotHandle == void 0) {
21010
21182
  throw new Error(`AssertionError: expected slot handle to be assigned for pipe creation`);
21011
21183
  }
21012
- addPipeToCreationBlock(unit, updateOp.target, expr);
21184
+ addPipeToCreationBlock(unit, slotHandle, expr);
21013
21185
  });
21014
21186
  }
21015
21187
  }
@@ -21262,6 +21434,18 @@ function elementStart(slot, tag, constIndex, localRefIndex, sourceSpan) {
21262
21434
  return elementOrContainerBase(Identifiers.elementStart, slot, tag, constIndex, localRefIndex, sourceSpan);
21263
21435
  }
21264
21436
  __name(elementStart, "elementStart");
21437
+ function foreignComponent(slot, foreignComponentRef, props, sourceSpan) {
21438
+ const args = [literal(slot), foreignComponentRef];
21439
+ if (props !== null) {
21440
+ args.push(props);
21441
+ }
21442
+ return call(Identifiers.foreignComponent, args, sourceSpan);
21443
+ }
21444
+ __name(foreignComponent, "foreignComponent");
21445
+ function foreignContent(slot, foreignComponentIndex, parameterized) {
21446
+ return importExpr(parameterized ? Identifiers.foreignContentFn : Identifiers.foreignContent).callFn([literal(slot), literal(foreignComponentIndex)]);
21447
+ }
21448
+ __name(foreignContent, "foreignContent");
21265
21449
  function elementOrContainerBase(instruction, slot, tag, constIndex, localRefIndex, sourceSpan) {
21266
21450
  const args = [literal(slot)];
21267
21451
  if (tag !== null) {
@@ -21829,6 +22013,14 @@ function reifyCreateOperations(unit, ops) {
21829
22013
  case OpKind.Element:
21830
22014
  OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly ? domElement(op.handle.slot, op.tag, op.attributes, op.localRefs, op.wholeSourceSpan) : element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.wholeSourceSpan));
21831
22015
  break;
22016
+ case OpKind.ForeignComponent:
22017
+ const propsExpr = op.props.size > 0 ? literalMap(Array.from(op.props.entries()).map(([key, value]) => ({
22018
+ key,
22019
+ value,
22020
+ quoted: isUnsafeObjectKey(key)
22021
+ }))) : null;
22022
+ OpList.replace(op, foreignComponent(op.handle.slot, literal(op.constIndex), propsExpr, op.sourceSpan));
22023
+ break;
21832
22024
  case OpKind.ElementEnd:
21833
22025
  OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly ? domElementEnd(op.sourceSpan) : elementEnd(op.sourceSpan));
21834
22026
  break;
@@ -21925,7 +22117,8 @@ function reifyCreateOperations(unit, ops) {
21925
22117
  break;
21926
22118
  case OpKind.DeferOn:
21927
22119
  let args = [];
21928
- switch (op.trigger.kind) {
22120
+ const triggerKind = op.trigger.kind;
22121
+ switch (triggerKind) {
21929
22122
  case DeferTriggerKind.Never:
21930
22123
  case DeferTriggerKind.Immediate:
21931
22124
  break;
@@ -21963,8 +22156,10 @@ function reifyCreateOperations(unit, ops) {
21963
22156
  }
21964
22157
  }
21965
22158
  break;
21966
- default:
21967
- throw new Error(`AssertionError: Unsupported reification of defer trigger kind ${op.trigger.kind}`);
22159
+ default: {
22160
+ const unhandledTriggerKind = triggerKind;
22161
+ throw new Error(`AssertionError: Unsupported reification of defer trigger kind ${unhandledTriggerKind}`);
22162
+ }
21968
22163
  }
21969
22164
  OpList.replace(op, deferOn(op.trigger.kind, args, op.modifier, op.sourceSpan));
21970
22165
  break;
@@ -22171,6 +22366,12 @@ function reifyIrExpression(unit, expr) {
22171
22366
  return nextContext(expr.steps);
22172
22367
  case ExpressionKind.Reference:
22173
22368
  return reference(expr.targetSlot.slot + 1 + expr.offset);
22369
+ case ExpressionKind.ForeignContent:
22370
+ if (!(unit instanceof ViewCompilationUnit)) {
22371
+ throw new Error(`AssertionError: must be compiling a component`);
22372
+ }
22373
+ const parameterized = unit.job.views.get(expr.childrenViewXref).contextVariables.size > 0;
22374
+ return foreignContent(expr.childrenViewHandle.slot, expr.foreignComponentConstIndex, parameterized);
22174
22375
  case ExpressionKind.LexicalRead:
22175
22376
  throw new Error(`AssertionError: unresolved LexicalRead of ${expr.name}`);
22176
22377
  case ExpressionKind.TwoWayBindingSet:
@@ -22446,6 +22647,31 @@ function transformDollarEvent(ops) {
22446
22647
  }
22447
22648
  }
22448
22649
  __name(transformDollarEvent, "transformDollarEvent");
22650
+ function resolveForeignContent(job) {
22651
+ for (const unit of job.units) {
22652
+ const foreignComponents = /* @__PURE__ */ new Map();
22653
+ for (const op of unit.create) {
22654
+ if (op.kind === OpKind.ForeignComponent) {
22655
+ foreignComponents.set(op.xref, op);
22656
+ }
22657
+ }
22658
+ for (const op of unit.create) {
22659
+ if (op.kind !== OpKind.Content) {
22660
+ continue;
22661
+ }
22662
+ const target = foreignComponents.get(op.target);
22663
+ if (target === void 0) {
22664
+ throw new Error(`AssertionError: ContentOp target not found`);
22665
+ }
22666
+ const templateName = op.propertyName.charAt(0).toUpperCase() + op.propertyName.slice(1);
22667
+ const templateOp = createTemplateOp(op.view, TemplateKind.NgTemplate, null, templateName, Namespace.HTML, void 0, op.startSourceSpan, op.sourceSpan);
22668
+ OpList.replace(op, templateOp);
22669
+ const foreignContent2 = new ForeignContentExpr(templateOp.xref, templateOp.handle, target.constIndex);
22670
+ target.props.set(op.propertyName, foreignContent2);
22671
+ }
22672
+ }
22673
+ }
22674
+ __name(resolveForeignContent, "resolveForeignContent");
22449
22675
  function resolveI18nElementPlaceholders(job) {
22450
22676
  const i18nContexts = /* @__PURE__ */ new Map();
22451
22677
  const elements = /* @__PURE__ */ new Map();
@@ -22877,7 +23103,7 @@ function resolveSanitizers(job) {
22877
23103
  case OpKind.DomProperty:
22878
23104
  case OpKind.TwoWayProperty:
22879
23105
  let sanitizerFn = null;
22880
- if (Array.isArray(op.securityContext) && op.securityContext.length === 2 && op.securityContext.includes(SecurityContext.URL) && op.securityContext.includes(SecurityContext.RESOURCE_URL)) {
23106
+ if (Array.isArray(op.securityContext) && hasCompositeUrlSecurityContext(op.securityContext)) {
22881
23107
  sanitizerFn = Identifiers.sanitizeUrlOrResourceUrl;
22882
23108
  } else {
22883
23109
  sanitizerFn = sanitizerFns.get(getOnlySecurityContext(op.securityContext)) ?? null;
@@ -22889,14 +23115,40 @@ function resolveSanitizers(job) {
22889
23115
  }
22890
23116
  }
22891
23117
  __name(resolveSanitizers, "resolveSanitizers");
22892
- function getOnlySecurityContext(securityContext) {
22893
- if (Array.isArray(securityContext)) {
22894
- if (securityContext.length > 1) {
22895
- throw Error(`AssertionError: Ambiguous security context`);
23118
+ function hasCompositeUrlSecurityContext(securityContext) {
23119
+ let hasUrlContext = false;
23120
+ let hasResourceUrlContext = false;
23121
+ let hasNoneContext = false;
23122
+ for (const context of securityContext) {
23123
+ switch (context) {
23124
+ case SecurityContext.URL:
23125
+ hasUrlContext = true;
23126
+ break;
23127
+ case SecurityContext.RESOURCE_URL:
23128
+ hasResourceUrlContext = true;
23129
+ break;
23130
+ case SecurityContext.NONE:
23131
+ hasNoneContext = true;
23132
+ break;
23133
+ default:
23134
+ return false;
22896
23135
  }
22897
- return securityContext[0] || SecurityContext.NONE;
22898
23136
  }
22899
- return securityContext;
23137
+ return (hasUrlContext || hasResourceUrlContext) && hasNoneContext || hasUrlContext && hasResourceUrlContext;
23138
+ }
23139
+ __name(hasCompositeUrlSecurityContext, "hasCompositeUrlSecurityContext");
23140
+ function getOnlySecurityContext(securityContext) {
23141
+ if (!Array.isArray(securityContext)) {
23142
+ return securityContext;
23143
+ }
23144
+ if (securityContext.length < 2) {
23145
+ return securityContext[0] ?? SecurityContext.NONE;
23146
+ }
23147
+ const nonNoneSecurityContexts = securityContext.filter((context) => context !== SecurityContext.NONE);
23148
+ if (nonNoneSecurityContexts.length > 1) {
23149
+ throw Error(`AssertionError: Ambiguous security context`);
23150
+ }
23151
+ return nonNoneSecurityContexts[0] ?? SecurityContext.NONE;
22900
23152
  }
22901
23153
  __name(getOnlySecurityContext, "getOnlySecurityContext");
22902
23154
  function removeSafeNavigationMigration(job) {
@@ -23585,7 +23837,7 @@ function collectOpInfo(op, predicate) {
23585
23837
  }
23586
23838
  if (expr.kind === ExpressionKind.ReadVariable) {
23587
23839
  variablesUsed.add(expr.xref);
23588
- } else {
23840
+ } else if (!(flags & VisitorContextFlag.InChildOperation)) {
23589
23841
  fences |= fencesForIrExpression(expr);
23590
23842
  }
23591
23843
  });
@@ -23727,6 +23979,9 @@ function wrapI18nIcus(job) {
23727
23979
  }
23728
23980
  __name(wrapI18nIcus, "wrapI18nIcus");
23729
23981
  var phases = [{
23982
+ kind: CompilationJobKind.Tmpl,
23983
+ fn: resolveForeignContent
23984
+ }, {
23730
23985
  kind: CompilationJobKind.Tmpl,
23731
23986
  fn: removeContentSelectors
23732
23987
  }, {
@@ -24021,9 +24276,420 @@ function emitHostBindingFunction(job) {
24021
24276
  return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, DYNAMIC_TYPE)], [...createCond, ...updateCond], void 0, void 0, job.root.fnName);
24022
24277
  }
24023
24278
  __name(emitHostBindingFunction, "emitHostBindingFunction");
24279
+ var PROPERTY_PARTS_SEPARATOR = ".";
24280
+ var ATTRIBUTE_PREFIX = "attr";
24281
+ var ANIMATE_PREFIX$1 = "animate";
24282
+ var CLASS_PREFIX = "class";
24283
+ var STYLE_PREFIX = "style";
24284
+ var TEMPLATE_ATTR_PREFIX$1 = "*";
24285
+ var LEGACY_ANIMATE_PROP_PREFIX = "animate-";
24286
+ var BindingParser = class {
24287
+ static {
24288
+ __name(this, "BindingParser");
24289
+ }
24290
+ _exprParser;
24291
+ _schemaRegistry;
24292
+ errors;
24293
+ constructor(_exprParser, _schemaRegistry, errors) {
24294
+ this._exprParser = _exprParser;
24295
+ this._schemaRegistry = _schemaRegistry;
24296
+ this.errors = errors;
24297
+ }
24298
+ createBoundHostProperties(properties, sourceSpan) {
24299
+ const boundProps = [];
24300
+ for (const propName of Object.keys(properties)) {
24301
+ const expression = properties[propName];
24302
+ if (typeof expression === "string") {
24303
+ this.parsePropertyBinding(propName, expression, true, false, sourceSpan, sourceSpan.start.offset, void 0, [], boundProps, sourceSpan);
24304
+ } else {
24305
+ this._reportError(`Value of the host property binding "${propName}" needs to be a string representing an expression but got "${expression}" (${typeof expression})`, sourceSpan);
24306
+ }
24307
+ }
24308
+ return boundProps;
24309
+ }
24310
+ createDirectiveHostEventAsts(hostListeners, sourceSpan) {
24311
+ const targetEvents = [];
24312
+ for (const propName of Object.keys(hostListeners)) {
24313
+ const expression = hostListeners[propName];
24314
+ if (typeof expression === "string") {
24315
+ this.parseEvent(propName, expression, false, sourceSpan, sourceSpan, [], targetEvents, sourceSpan);
24316
+ } else {
24317
+ this._reportError(`Value of the host listener "${propName}" needs to be a string representing an expression but got "${expression}" (${typeof expression})`, sourceSpan);
24318
+ }
24319
+ }
24320
+ return targetEvents;
24321
+ }
24322
+ parseInterpolation(value, sourceSpan, interpolatedTokens) {
24323
+ const absoluteOffset = sourceSpan.fullStart.offset;
24324
+ try {
24325
+ const ast = this._exprParser.parseInterpolation(value, sourceSpan, absoluteOffset, interpolatedTokens);
24326
+ if (ast) {
24327
+ this.errors.push(...ast.errors);
24328
+ }
24329
+ return ast;
24330
+ } catch (e) {
24331
+ this._reportError(`${e}`, sourceSpan);
24332
+ return this._exprParser.wrapLiteralPrimitive("ERROR", sourceSpan, absoluteOffset);
24333
+ }
24334
+ }
24335
+ parseInterpolationExpression(expression, sourceSpan) {
24336
+ const absoluteOffset = sourceSpan.start.offset;
24337
+ try {
24338
+ const ast = this._exprParser.parseInterpolationExpression(expression, sourceSpan, absoluteOffset);
24339
+ if (ast) {
24340
+ this.errors.push(...ast.errors);
24341
+ }
24342
+ return ast;
24343
+ } catch (e) {
24344
+ this._reportError(`${e}`, sourceSpan);
24345
+ return this._exprParser.wrapLiteralPrimitive("ERROR", sourceSpan, absoluteOffset);
24346
+ }
24347
+ }
24348
+ parseInlineTemplateBinding(tplKey, tplValue, sourceSpan, absoluteValueOffset, targetMatchableAttrs, targetProps, targetVars, isIvyAst) {
24349
+ const absoluteKeyOffset = sourceSpan.start.offset + TEMPLATE_ATTR_PREFIX$1.length;
24350
+ const bindings = this._parseTemplateBindings(tplKey, tplValue, sourceSpan, absoluteKeyOffset, absoluteValueOffset);
24351
+ for (const binding of bindings) {
24352
+ const bindingSpan = moveParseSourceSpan(sourceSpan, binding.sourceSpan);
24353
+ const key = binding.key.source;
24354
+ const keySpan = moveParseSourceSpan(sourceSpan, binding.key.span);
24355
+ if (binding instanceof VariableBinding) {
24356
+ const value = binding.value ? binding.value.source : "$implicit";
24357
+ const valueSpan = binding.value ? moveParseSourceSpan(sourceSpan, binding.value.span) : void 0;
24358
+ targetVars.push(new ParsedVariable(key, value, bindingSpan, keySpan, valueSpan));
24359
+ } else if (binding.value) {
24360
+ const srcSpan = isIvyAst ? bindingSpan : sourceSpan;
24361
+ const valueSpan = moveParseSourceSpan(sourceSpan, binding.value.ast.sourceSpan);
24362
+ this._parsePropertyAst(key, binding.value, false, srcSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
24363
+ } else {
24364
+ targetMatchableAttrs.push([key, ""]);
24365
+ this.parseLiteralAttr(key, null, keySpan, absoluteValueOffset, void 0, targetMatchableAttrs, targetProps, keySpan);
24366
+ }
24367
+ }
24368
+ }
24369
+ _parseTemplateBindings(tplKey, tplValue, sourceSpan, absoluteKeyOffset, absoluteValueOffset) {
24370
+ try {
24371
+ const bindingsResult = this._exprParser.parseTemplateBindings(tplKey, tplValue, sourceSpan, absoluteKeyOffset, absoluteValueOffset);
24372
+ bindingsResult.errors.forEach((e) => this.errors.push(e));
24373
+ bindingsResult.warnings.forEach((warning) => {
24374
+ this._reportError(warning, sourceSpan, ParseErrorLevel.WARNING);
24375
+ });
24376
+ return bindingsResult.templateBindings;
24377
+ } catch (e) {
24378
+ this._reportError(`${e}`, sourceSpan);
24379
+ return [];
24380
+ }
24381
+ }
24382
+ parseLiteralAttr(name, value, sourceSpan, absoluteOffset, valueSpan, targetMatchableAttrs, targetProps, keySpan) {
24383
+ if (isLegacyAnimationLabel(name)) {
24384
+ name = name.substring(1);
24385
+ if (keySpan !== void 0) {
24386
+ keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
24387
+ }
24388
+ if (value) {
24389
+ this._reportError(`Assigning animation triggers via @prop="exp" attributes with an expression is invalid. Use property bindings (e.g. [@prop]="exp") or use an attribute without a value (e.g. @prop) instead.`, sourceSpan, ParseErrorLevel.ERROR);
24390
+ }
24391
+ this._parseLegacyAnimation(name, value, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
24392
+ } else {
24393
+ targetProps.push(new ParsedProperty(name, this._exprParser.wrapLiteralPrimitive(value, "", absoluteOffset), ParsedPropertyType.LITERAL_ATTR, sourceSpan, keySpan, valueSpan));
24394
+ }
24395
+ }
24396
+ parsePropertyBinding(name, expression, isHost, isPartOfAssignmentBinding, sourceSpan, absoluteOffset, valueSpan, targetMatchableAttrs, targetProps, keySpan) {
24397
+ if (name.length === 0) {
24398
+ this._reportError(`Property name is missing in binding`, sourceSpan);
24399
+ }
24400
+ let isLegacyAnimationProp = false;
24401
+ if (name.startsWith(LEGACY_ANIMATE_PROP_PREFIX)) {
24402
+ isLegacyAnimationProp = true;
24403
+ name = name.substring(LEGACY_ANIMATE_PROP_PREFIX.length);
24404
+ if (keySpan !== void 0) {
24405
+ keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + LEGACY_ANIMATE_PROP_PREFIX.length, keySpan.end.offset));
24406
+ }
24407
+ } else if (isLegacyAnimationLabel(name)) {
24408
+ isLegacyAnimationProp = true;
24409
+ name = name.substring(1);
24410
+ if (keySpan !== void 0) {
24411
+ keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
24412
+ }
24413
+ }
24414
+ if (isLegacyAnimationProp) {
24415
+ this._parseLegacyAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
24416
+ } else if (name.startsWith(`${ANIMATE_PREFIX$1}${PROPERTY_PARTS_SEPARATOR}`)) {
24417
+ this._parseAnimation(name, this.parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
24418
+ } else {
24419
+ this._parsePropertyAst(name, this.parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), isPartOfAssignmentBinding, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
24420
+ }
24421
+ }
24422
+ parsePropertyInterpolation(name, value, sourceSpan, valueSpan, targetMatchableAttrs, targetProps, keySpan, interpolatedTokens) {
24423
+ const expr = this.parseInterpolation(value, valueSpan || sourceSpan, interpolatedTokens);
24424
+ if (expr) {
24425
+ this._parsePropertyAst(name, expr, false, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
24426
+ return true;
24427
+ }
24428
+ return false;
24429
+ }
24430
+ _parsePropertyAst(name, ast, isPartOfAssignmentBinding, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps) {
24431
+ targetMatchableAttrs.push([name, ast.source]);
24432
+ targetProps.push(new ParsedProperty(name, ast, isPartOfAssignmentBinding ? ParsedPropertyType.TWO_WAY : ParsedPropertyType.DEFAULT, sourceSpan, keySpan, valueSpan));
24433
+ }
24434
+ _parseAnimation(name, ast, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps) {
24435
+ targetMatchableAttrs.push([name, ast.source]);
24436
+ targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.ANIMATION, sourceSpan, keySpan, valueSpan));
24437
+ }
24438
+ _parseLegacyAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps) {
24439
+ if (name.length === 0) {
24440
+ this._reportError("Animation trigger is missing", sourceSpan);
24441
+ }
24442
+ const ast = this.parseBinding(expression || "undefined", false, valueSpan || sourceSpan, absoluteOffset);
24443
+ targetMatchableAttrs.push([name, ast.source]);
24444
+ targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.LEGACY_ANIMATION, sourceSpan, keySpan, valueSpan));
24445
+ }
24446
+ parseBinding(value, isHostBinding2, sourceSpan, absoluteOffset) {
24447
+ try {
24448
+ const ast = isHostBinding2 ? this._exprParser.parseSimpleBinding(value, sourceSpan, absoluteOffset) : this._exprParser.parseBinding(value, sourceSpan, absoluteOffset);
24449
+ if (ast) {
24450
+ this.errors.push(...ast.errors);
24451
+ }
24452
+ return ast;
24453
+ } catch (e) {
24454
+ this._reportError(`${e}`, sourceSpan);
24455
+ return this._exprParser.wrapLiteralPrimitive("ERROR", sourceSpan, absoluteOffset);
24456
+ }
24457
+ }
24458
+ createBoundElementProperty(elementSelector, boundProp, skipValidation = false, mapPropertyName = true) {
24459
+ if (boundProp.isLegacyAnimation) {
24460
+ return new BoundElementProperty(boundProp.name, BindingType.LegacyAnimation, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
24461
+ }
24462
+ let unit = null;
24463
+ let bindingType = void 0;
24464
+ let boundPropertyName = null;
24465
+ const parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR);
24466
+ let securityContexts = void 0;
24467
+ if (parts.length > 1) {
24468
+ if (parts[0] == ATTRIBUTE_PREFIX) {
24469
+ boundPropertyName = parts.slice(1).join(PROPERTY_PARTS_SEPARATOR);
24470
+ if (!skipValidation) {
24471
+ this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true);
24472
+ }
24473
+ securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, true);
24474
+ const nsSeparatorIdx = boundPropertyName.indexOf(":");
24475
+ if (nsSeparatorIdx > -1) {
24476
+ const ns = boundPropertyName.substring(0, nsSeparatorIdx);
24477
+ const name = boundPropertyName.substring(nsSeparatorIdx + 1);
24478
+ boundPropertyName = mergeNsAndName(ns, name);
24479
+ }
24480
+ bindingType = BindingType.Attribute;
24481
+ } else if (parts[0] == CLASS_PREFIX) {
24482
+ boundPropertyName = parts[1];
24483
+ bindingType = BindingType.Class;
24484
+ securityContexts = [SecurityContext.NONE];
24485
+ } else if (parts[0] == STYLE_PREFIX) {
24486
+ unit = parts.length > 2 ? parts[2] : null;
24487
+ const boundName = parts[1];
24488
+ if (!boundName.startsWith("--")) {
24489
+ boundPropertyName = boundName;
24490
+ } else {
24491
+ try {
24492
+ boundPropertyName = namespaceCssVariable(boundName);
24493
+ } catch (e) {
24494
+ this._reportError(e.message, boundProp.sourceSpan);
24495
+ }
24496
+ }
24497
+ bindingType = BindingType.Style;
24498
+ securityContexts = [SecurityContext.STYLE];
24499
+ } else if (parts[0] == ANIMATE_PREFIX$1) {
24500
+ boundPropertyName = boundProp.name;
24501
+ bindingType = BindingType.Animation;
24502
+ securityContexts = [SecurityContext.NONE];
24503
+ }
24504
+ }
24505
+ if (boundPropertyName === null) {
24506
+ const mappedPropName = this._schemaRegistry.getMappedPropName(boundProp.name);
24507
+ boundPropertyName = mapPropertyName ? mappedPropName : boundProp.name;
24508
+ securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, mappedPropName, false);
24509
+ bindingType = boundProp.type === ParsedPropertyType.TWO_WAY ? BindingType.TwoWay : BindingType.Property;
24510
+ if (!skipValidation) {
24511
+ this._validatePropertyOrAttributeName(mappedPropName, boundProp.sourceSpan, false);
24512
+ }
24513
+ }
24514
+ return new BoundElementProperty(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
24515
+ }
24516
+ parseEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
24517
+ if (name.length === 0) {
24518
+ this._reportError(`Event name is missing in binding`, sourceSpan);
24519
+ }
24520
+ if (isLegacyAnimationLabel(name)) {
24521
+ name = name.slice(1);
24522
+ if (keySpan !== void 0) {
24523
+ keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
24524
+ }
24525
+ this._parseLegacyAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan);
24526
+ } else {
24527
+ this._parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan);
24528
+ }
24529
+ }
24530
+ calcPossibleSecurityContexts(selector, propName, isAttribute) {
24531
+ const prop = this._schemaRegistry.getMappedPropName(propName);
24532
+ return calcPossibleSecurityContexts(this._schemaRegistry, selector, prop, isAttribute);
24533
+ }
24534
+ parseEventListenerName(rawName) {
24535
+ const [target, eventName] = splitAtColon(rawName, [null, rawName]);
24536
+ return {
24537
+ eventName,
24538
+ target
24539
+ };
24540
+ }
24541
+ parseLegacyAnimationEventName(rawName) {
24542
+ const matches = splitAtPeriod(rawName, [rawName, null]);
24543
+ return {
24544
+ eventName: matches[0],
24545
+ phase: matches[1] === null ? null : matches[1].toLowerCase()
24546
+ };
24547
+ }
24548
+ _parseLegacyAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan) {
24549
+ const {
24550
+ eventName,
24551
+ phase
24552
+ } = this.parseLegacyAnimationEventName(name);
24553
+ const ast = this._parseAction(expression, handlerSpan);
24554
+ targetEvents.push(new ParsedEvent(eventName, phase, ParsedEventType.LegacyAnimation, ast, sourceSpan, handlerSpan, keySpan));
24555
+ if (eventName.length === 0) {
24556
+ this._reportError(`Animation event name is missing in binding`, sourceSpan);
24557
+ }
24558
+ if (phase) {
24559
+ if (phase !== "start" && phase !== "done") {
24560
+ this._reportError(`The provided animation output phase value "${phase}" for "@${eventName}" is not supported (use start or done)`, sourceSpan);
24561
+ }
24562
+ } else {
24563
+ this._reportError(`The animation trigger output event (@${eventName}) is missing its phase value name (start or done are currently supported)`, sourceSpan);
24564
+ }
24565
+ }
24566
+ _parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
24567
+ const {
24568
+ eventName,
24569
+ target
24570
+ } = this.parseEventListenerName(name);
24571
+ const prevErrorCount = this.errors.length;
24572
+ const ast = this._parseAction(expression, handlerSpan);
24573
+ const isValid = this.errors.length === prevErrorCount;
24574
+ targetMatchableAttrs.push([name, ast.source]);
24575
+ if (isAssignmentEvent && isValid && !this._isAllowedAssignmentEvent(ast)) {
24576
+ this._reportError("Unsupported expression in a two-way binding", sourceSpan);
24577
+ }
24578
+ let eventType = ParsedEventType.Regular;
24579
+ if (isAssignmentEvent) {
24580
+ eventType = ParsedEventType.TwoWay;
24581
+ }
24582
+ if (name.startsWith(`${ANIMATE_PREFIX$1}${PROPERTY_PARTS_SEPARATOR}`)) {
24583
+ eventType = ParsedEventType.Animation;
24584
+ }
24585
+ targetEvents.push(new ParsedEvent(eventName, target, eventType, ast, sourceSpan, handlerSpan, keySpan));
24586
+ }
24587
+ _parseAction(value, sourceSpan) {
24588
+ const absoluteOffset = sourceSpan && sourceSpan.start ? sourceSpan.start.offset : 0;
24589
+ try {
24590
+ const ast = this._exprParser.parseAction(value, sourceSpan, absoluteOffset);
24591
+ if (ast) {
24592
+ this.errors.push(...ast.errors);
24593
+ }
24594
+ if (!ast || ast.ast instanceof EmptyExpr$1) {
24595
+ this._reportError(`Empty expressions are not allowed`, sourceSpan);
24596
+ return this._exprParser.wrapLiteralPrimitive("ERROR", sourceSpan, absoluteOffset);
24597
+ }
24598
+ return ast;
24599
+ } catch (e) {
24600
+ this._reportError(`${e}`, sourceSpan);
24601
+ return this._exprParser.wrapLiteralPrimitive("ERROR", sourceSpan, absoluteOffset);
24602
+ }
24603
+ }
24604
+ _reportError(message, sourceSpan, level = ParseErrorLevel.ERROR) {
24605
+ this.errors.push(new ParseError(sourceSpan, message, level));
24606
+ }
24607
+ _validatePropertyOrAttributeName(propName, sourceSpan, isAttr) {
24608
+ const report = isAttr ? this._schemaRegistry.validateAttribute(propName) : this._schemaRegistry.validateProperty(propName);
24609
+ if (report.error) {
24610
+ this._reportError(report.msg, sourceSpan, ParseErrorLevel.ERROR);
24611
+ }
24612
+ }
24613
+ _isAllowedAssignmentEvent(ast) {
24614
+ if (ast instanceof ASTWithSource) {
24615
+ return this._isAllowedAssignmentEvent(ast.ast);
24616
+ }
24617
+ if (ast instanceof NonNullAssert) {
24618
+ return this._isAllowedAssignmentEvent(ast.expression);
24619
+ }
24620
+ if (ast instanceof Call && ast.args.length === 1 && ast.receiver instanceof PropertyRead && ast.receiver.name === "$any" && ast.receiver.receiver instanceof ImplicitReceiver) {
24621
+ return this._isAllowedAssignmentEvent(ast.args[0]);
24622
+ }
24623
+ if (ast instanceof PropertyRead || ast instanceof KeyedRead) {
24624
+ if (!hasRecursiveSafeReceiver(ast)) {
24625
+ return true;
24626
+ }
24627
+ }
24628
+ return false;
24629
+ }
24630
+ };
24631
+ function hasRecursiveSafeReceiver(ast) {
24632
+ if (ast instanceof SafePropertyRead || ast instanceof SafeKeyedRead) {
24633
+ return true;
24634
+ }
24635
+ if (ast instanceof ParenthesizedExpression) {
24636
+ return hasRecursiveSafeReceiver(ast.expression);
24637
+ }
24638
+ if (ast instanceof PropertyRead || ast instanceof KeyedRead || ast instanceof Call) {
24639
+ return hasRecursiveSafeReceiver(ast.receiver);
24640
+ }
24641
+ return false;
24642
+ }
24643
+ __name(hasRecursiveSafeReceiver, "hasRecursiveSafeReceiver");
24644
+ function isLegacyAnimationLabel(name) {
24645
+ return name[0] == "@";
24646
+ }
24647
+ __name(isLegacyAnimationLabel, "isLegacyAnimationLabel");
24648
+ function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) {
24649
+ let ctxs;
24650
+ const [namespaceKey, baseSelector] = selector ? splitNsName(selector, false) : [null, selector];
24651
+ const nameToContext = /* @__PURE__ */ __name((elName) => {
24652
+ const [nsStr, name] = splitNsName(elName, false);
24653
+ const ns = nsStr ?? namespaceKey;
24654
+ const fullName = ns ? `:${ns}:${name}` : name;
24655
+ return registry.securityContext(fullName, propName, isAttribute);
24656
+ }, "nameToContext");
24657
+ const allKnownElements = registry.allKnownElementNames();
24658
+ if (baseSelector === null) {
24659
+ ctxs = allKnownElements.map(nameToContext);
24660
+ } else {
24661
+ ctxs = [];
24662
+ CssSelector.parse(baseSelector).forEach((selector2) => {
24663
+ let elementNames = selector2.element ? [selector2.element] : allKnownElements;
24664
+ if (selector2.element && !registry.hasElement(selector2.element, [])) {
24665
+ const svgElement = `:${SVG_NAMESPACE}:${selector2.element}`;
24666
+ const mathElement = `:${MATH_ML_NAMESPACE}:${selector2.element}`;
24667
+ if (registry.hasElement(svgElement, [])) {
24668
+ elementNames = [svgElement];
24669
+ } else if (registry.hasElement(mathElement, [])) {
24670
+ elementNames = [mathElement];
24671
+ }
24672
+ }
24673
+ const notElementNames = new Set(selector2.notSelectors.filter((selector3) => selector3.isElementSelector()).map((selector3) => selector3.element?.toLowerCase()));
24674
+ const possibleElementNames = elementNames.filter((elName) => {
24675
+ const elNameLowerCase = elName.toLowerCase();
24676
+ return !notElementNames.has(elNameLowerCase) && !notElementNames.has(splitNsName(elNameLowerCase)[1]);
24677
+ });
24678
+ ctxs.push(...possibleElementNames.map(nameToContext));
24679
+ });
24680
+ }
24681
+ return ctxs.length === 0 ? [SecurityContext.NONE] : Array.from(new Set(ctxs)).sort();
24682
+ }
24683
+ __name(calcPossibleSecurityContexts, "calcPossibleSecurityContexts");
24684
+ function moveParseSourceSpan(sourceSpan, absoluteSpan) {
24685
+ const startDiff = absoluteSpan.start - sourceSpan.start.offset;
24686
+ const endDiff = absoluteSpan.end - sourceSpan.end.offset;
24687
+ return new ParseSourceSpan(sourceSpan.start.moveBy(startDiff), sourceSpan.end.moveBy(endDiff), sourceSpan.fullStart.moveBy(startDiff), sourceSpan.details);
24688
+ }
24689
+ __name(moveParseSourceSpan, "moveParseSourceSpan");
24024
24690
  var domSchema = new DomElementSchemaRegistry();
24025
24691
  var NG_TEMPLATE_TAG_NAME = "ng-template";
24026
- var ANIMATE_PREFIX$1 = "animate.";
24692
+ var ANIMATE_PREFIX = "animate.";
24027
24693
  function isI18nRootNode(meta) {
24028
24694
  return meta instanceof Message;
24029
24695
  }
@@ -24032,8 +24698,8 @@ function isSingleI18nIcu(meta) {
24032
24698
  return isI18nRootNode(meta) && meta.nodes.length === 1 && meta.nodes[0] instanceof Icu2;
24033
24699
  }
24034
24700
  __name(isSingleI18nIcu, "isSingleI18nIcu");
24035
- function ingestComponent(componentName, template2, constantPool, compilationMode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations, legacyOptionalChaining) {
24036
- const job = new ComponentCompilationJob(componentName, constantPool, compilationMode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations, legacyOptionalChaining);
24701
+ function ingestComponent(componentName, template2, constantPool, compilationMode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations, legacyOptionalChaining, foreignImports) {
24702
+ const job = new ComponentCompilationJob(componentName, constantPool, compilationMode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations, legacyOptionalChaining, foreignImports);
24037
24703
  ingestNodes(job.root, template2);
24038
24704
  return job;
24039
24705
  }
@@ -24052,11 +24718,11 @@ function ingestHostBinding(input, bindingParser, constantPool) {
24052
24718
  if (property2.isAnimation) {
24053
24719
  bindingKind = BindingKind.Animation;
24054
24720
  }
24055
- const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, property2.name, bindingKind === BindingKind.Attribute).filter((context) => context !== SecurityContext.NONE);
24721
+ const securityContexts = calcHostBindingSecurityContexts(bindingParser, input.componentSelector, property2.name, bindingKind === BindingKind.Attribute);
24056
24722
  ingestDomProperty(job, property2, bindingKind, securityContexts);
24057
24723
  }
24058
24724
  for (const [name, expr] of Object.entries(input.attributes) ?? []) {
24059
- const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, name, true).filter((context) => context !== SecurityContext.NONE);
24725
+ const securityContexts = calcHostBindingSecurityContexts(bindingParser, input.componentSelector, name, true);
24060
24726
  ingestHostAttribute(job, name, expr, securityContexts);
24061
24727
  }
24062
24728
  for (const event of input.events ?? []) {
@@ -24065,6 +24731,21 @@ function ingestHostBinding(input, bindingParser, constantPool) {
24065
24731
  return job;
24066
24732
  }
24067
24733
  __name(ingestHostBinding, "ingestHostBinding");
24734
+ function calcHostBindingSecurityContexts(bindingParser, selector, name, isAttribute) {
24735
+ const declaringSelectorContexts = bindingParser.calcPossibleSecurityContexts(selector, name, isAttribute);
24736
+ const concreteHostContexts = calcPossibleSecurityContexts(domSchema, null, domSchema.getMappedPropName(name), isAttribute);
24737
+ const concreteHostNonNoneContexts = concreteHostContexts.filter((context) => context !== SecurityContext.NONE);
24738
+ const concreteHostNonNoneCount = concreteHostNonNoneContexts.length;
24739
+ const hasConcreteHostNoneContext = concreteHostNonNoneCount !== concreteHostContexts.length;
24740
+ if (hasConcreteHostNoneContext && concreteHostNonNoneCount > 0) {
24741
+ return concreteHostContexts;
24742
+ }
24743
+ if (concreteHostNonNoneContexts.some((context) => !declaringSelectorContexts.includes(context))) {
24744
+ return concreteHostContexts;
24745
+ }
24746
+ return declaringSelectorContexts.filter((context) => context !== SecurityContext.NONE);
24747
+ }
24748
+ __name(calcHostBindingSecurityContexts, "calcHostBindingSecurityContexts");
24068
24749
  function ingestDomProperty(job, property2, bindingKind, securityContexts) {
24069
24750
  let expression;
24070
24751
  const ast = property2.expression.ast;
@@ -24128,6 +24809,11 @@ function ingestElement(unit, element2) {
24128
24809
  throw Error(`Unhandled i18n metadata type for element: ${element2.i18n.constructor.name}`);
24129
24810
  }
24130
24811
  const id = unit.job.allocateXrefId();
24812
+ const foreignComp = unit.job.getForeignComponent(element2);
24813
+ if (foreignComp) {
24814
+ ingestForeignComponent(unit, id, element2, foreignComp);
24815
+ return;
24816
+ }
24131
24817
  const [namespaceKey, elementName] = splitNsName(element2.name);
24132
24818
  const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan, element2.sourceSpan);
24133
24819
  unit.create.push(startOp);
@@ -24146,6 +24832,40 @@ function ingestElement(unit, element2) {
24146
24832
  }
24147
24833
  }
24148
24834
  __name(ingestElement, "ingestElement");
24835
+ function ingestForeignComponent(unit, id, element2, foreignComp) {
24836
+ const props = /* @__PURE__ */ new Map();
24837
+ for (const attr of element2.attributes) {
24838
+ props.set(attr.name, literal(attr.value));
24839
+ }
24840
+ for (const input of element2.inputs) {
24841
+ props.set(input.name, convertAst(input.value, unit.job, input.sourceSpan));
24842
+ }
24843
+ const contentBlocks = [];
24844
+ const childNodes = [];
24845
+ for (const child of element2.children) {
24846
+ if (child instanceof ContentBlock) {
24847
+ contentBlocks.push(child);
24848
+ } else {
24849
+ childNodes.push(child);
24850
+ }
24851
+ }
24852
+ for (const block of contentBlocks) {
24853
+ const blockView = unit.job.allocateView(unit.xref);
24854
+ for (let i = 0; i < block.variables.length; i++) {
24855
+ blockView.contextVariables.set(block.variables[i].name, i);
24856
+ }
24857
+ ingestNodes(blockView, block.children);
24858
+ unit.create.push(createContentOp(id, blockView.xref, block.name, block.startSourceSpan, block.sourceSpan));
24859
+ }
24860
+ if (childNodes.length > 0) {
24861
+ const childView = unit.job.allocateView(unit.xref);
24862
+ ingestNodes(childView, childNodes);
24863
+ unit.create.push(createContentOp(id, childView.xref, "children", element2.startSourceSpan, element2.sourceSpan));
24864
+ }
24865
+ const constIndex = unit.job.addConst(foreignComp.component);
24866
+ unit.create.push(createForeignComponentOp(id, constIndex, props, element2.startSourceSpan));
24867
+ }
24868
+ __name(ingestForeignComponent, "ingestForeignComponent");
24149
24869
  function ingestTemplate(unit, tmpl) {
24150
24870
  if (tmpl.i18n !== void 0 && !(tmpl.i18n instanceof Message || tmpl.i18n instanceof TagPlaceholder)) {
24151
24871
  throw Error(`Unhandled i18n metadata type for template: ${tmpl.i18n.constructor.name}`);
@@ -24819,7 +25539,7 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
24819
25539
  if (root !== null) {
24820
25540
  return null;
24821
25541
  }
24822
- if (child instanceof Element$1 || child instanceof Template && child.tagName !== null) {
25542
+ if (child instanceof Element$1 && unit.job.getForeignComponent(child) === null || child instanceof Template && child.tagName !== null) {
24823
25543
  root = child;
24824
25544
  } else {
24825
25545
  return null;
@@ -24827,7 +25547,7 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
24827
25547
  }
24828
25548
  if (root !== null) {
24829
25549
  for (const attr of root.attributes) {
24830
- if (!attr.name.startsWith(ANIMATE_PREFIX$1)) {
25550
+ if (!attr.name.startsWith(ANIMATE_PREFIX)) {
24831
25551
  const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
24832
25552
  unit.update.push(createBindingOp(xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
24833
25553
  }
@@ -25013,408 +25733,6 @@ var HtmlParser = class extends Parser$1 {
25013
25733
  return super.parse(source, url, options);
25014
25734
  }
25015
25735
  };
25016
- var PROPERTY_PARTS_SEPARATOR = ".";
25017
- var ATTRIBUTE_PREFIX = "attr";
25018
- var ANIMATE_PREFIX = "animate";
25019
- var CLASS_PREFIX = "class";
25020
- var STYLE_PREFIX = "style";
25021
- var TEMPLATE_ATTR_PREFIX$1 = "*";
25022
- var LEGACY_ANIMATE_PROP_PREFIX = "animate-";
25023
- var BindingParser = class {
25024
- static {
25025
- __name(this, "BindingParser");
25026
- }
25027
- _exprParser;
25028
- _schemaRegistry;
25029
- errors;
25030
- constructor(_exprParser, _schemaRegistry, errors) {
25031
- this._exprParser = _exprParser;
25032
- this._schemaRegistry = _schemaRegistry;
25033
- this.errors = errors;
25034
- }
25035
- createBoundHostProperties(properties, sourceSpan) {
25036
- const boundProps = [];
25037
- for (const propName of Object.keys(properties)) {
25038
- const expression = properties[propName];
25039
- if (typeof expression === "string") {
25040
- this.parsePropertyBinding(propName, expression, true, false, sourceSpan, sourceSpan.start.offset, void 0, [], boundProps, sourceSpan);
25041
- } else {
25042
- this._reportError(`Value of the host property binding "${propName}" needs to be a string representing an expression but got "${expression}" (${typeof expression})`, sourceSpan);
25043
- }
25044
- }
25045
- return boundProps;
25046
- }
25047
- createDirectiveHostEventAsts(hostListeners, sourceSpan) {
25048
- const targetEvents = [];
25049
- for (const propName of Object.keys(hostListeners)) {
25050
- const expression = hostListeners[propName];
25051
- if (typeof expression === "string") {
25052
- this.parseEvent(propName, expression, false, sourceSpan, sourceSpan, [], targetEvents, sourceSpan);
25053
- } else {
25054
- this._reportError(`Value of the host listener "${propName}" needs to be a string representing an expression but got "${expression}" (${typeof expression})`, sourceSpan);
25055
- }
25056
- }
25057
- return targetEvents;
25058
- }
25059
- parseInterpolation(value, sourceSpan, interpolatedTokens) {
25060
- const absoluteOffset = sourceSpan.fullStart.offset;
25061
- try {
25062
- const ast = this._exprParser.parseInterpolation(value, sourceSpan, absoluteOffset, interpolatedTokens);
25063
- if (ast) {
25064
- this.errors.push(...ast.errors);
25065
- }
25066
- return ast;
25067
- } catch (e) {
25068
- this._reportError(`${e}`, sourceSpan);
25069
- return this._exprParser.wrapLiteralPrimitive("ERROR", sourceSpan, absoluteOffset);
25070
- }
25071
- }
25072
- parseInterpolationExpression(expression, sourceSpan) {
25073
- const absoluteOffset = sourceSpan.start.offset;
25074
- try {
25075
- const ast = this._exprParser.parseInterpolationExpression(expression, sourceSpan, absoluteOffset);
25076
- if (ast) {
25077
- this.errors.push(...ast.errors);
25078
- }
25079
- return ast;
25080
- } catch (e) {
25081
- this._reportError(`${e}`, sourceSpan);
25082
- return this._exprParser.wrapLiteralPrimitive("ERROR", sourceSpan, absoluteOffset);
25083
- }
25084
- }
25085
- parseInlineTemplateBinding(tplKey, tplValue, sourceSpan, absoluteValueOffset, targetMatchableAttrs, targetProps, targetVars, isIvyAst) {
25086
- const absoluteKeyOffset = sourceSpan.start.offset + TEMPLATE_ATTR_PREFIX$1.length;
25087
- const bindings = this._parseTemplateBindings(tplKey, tplValue, sourceSpan, absoluteKeyOffset, absoluteValueOffset);
25088
- for (const binding of bindings) {
25089
- const bindingSpan = moveParseSourceSpan(sourceSpan, binding.sourceSpan);
25090
- const key = binding.key.source;
25091
- const keySpan = moveParseSourceSpan(sourceSpan, binding.key.span);
25092
- if (binding instanceof VariableBinding) {
25093
- const value = binding.value ? binding.value.source : "$implicit";
25094
- const valueSpan = binding.value ? moveParseSourceSpan(sourceSpan, binding.value.span) : void 0;
25095
- targetVars.push(new ParsedVariable(key, value, bindingSpan, keySpan, valueSpan));
25096
- } else if (binding.value) {
25097
- const srcSpan = isIvyAst ? bindingSpan : sourceSpan;
25098
- const valueSpan = moveParseSourceSpan(sourceSpan, binding.value.ast.sourceSpan);
25099
- this._parsePropertyAst(key, binding.value, false, srcSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
25100
- } else {
25101
- targetMatchableAttrs.push([key, ""]);
25102
- this.parseLiteralAttr(key, null, keySpan, absoluteValueOffset, void 0, targetMatchableAttrs, targetProps, keySpan);
25103
- }
25104
- }
25105
- }
25106
- _parseTemplateBindings(tplKey, tplValue, sourceSpan, absoluteKeyOffset, absoluteValueOffset) {
25107
- try {
25108
- const bindingsResult = this._exprParser.parseTemplateBindings(tplKey, tplValue, sourceSpan, absoluteKeyOffset, absoluteValueOffset);
25109
- bindingsResult.errors.forEach((e) => this.errors.push(e));
25110
- bindingsResult.warnings.forEach((warning) => {
25111
- this._reportError(warning, sourceSpan, ParseErrorLevel.WARNING);
25112
- });
25113
- return bindingsResult.templateBindings;
25114
- } catch (e) {
25115
- this._reportError(`${e}`, sourceSpan);
25116
- return [];
25117
- }
25118
- }
25119
- parseLiteralAttr(name, value, sourceSpan, absoluteOffset, valueSpan, targetMatchableAttrs, targetProps, keySpan) {
25120
- if (isLegacyAnimationLabel(name)) {
25121
- name = name.substring(1);
25122
- if (keySpan !== void 0) {
25123
- keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
25124
- }
25125
- if (value) {
25126
- this._reportError(`Assigning animation triggers via @prop="exp" attributes with an expression is invalid. Use property bindings (e.g. [@prop]="exp") or use an attribute without a value (e.g. @prop) instead.`, sourceSpan, ParseErrorLevel.ERROR);
25127
- }
25128
- this._parseLegacyAnimation(name, value, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
25129
- } else {
25130
- targetProps.push(new ParsedProperty(name, this._exprParser.wrapLiteralPrimitive(value, "", absoluteOffset), ParsedPropertyType.LITERAL_ATTR, sourceSpan, keySpan, valueSpan));
25131
- }
25132
- }
25133
- parsePropertyBinding(name, expression, isHost, isPartOfAssignmentBinding, sourceSpan, absoluteOffset, valueSpan, targetMatchableAttrs, targetProps, keySpan) {
25134
- if (name.length === 0) {
25135
- this._reportError(`Property name is missing in binding`, sourceSpan);
25136
- }
25137
- let isLegacyAnimationProp = false;
25138
- if (name.startsWith(LEGACY_ANIMATE_PROP_PREFIX)) {
25139
- isLegacyAnimationProp = true;
25140
- name = name.substring(LEGACY_ANIMATE_PROP_PREFIX.length);
25141
- if (keySpan !== void 0) {
25142
- keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + LEGACY_ANIMATE_PROP_PREFIX.length, keySpan.end.offset));
25143
- }
25144
- } else if (isLegacyAnimationLabel(name)) {
25145
- isLegacyAnimationProp = true;
25146
- name = name.substring(1);
25147
- if (keySpan !== void 0) {
25148
- keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
25149
- }
25150
- }
25151
- if (isLegacyAnimationProp) {
25152
- this._parseLegacyAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
25153
- } else if (name.startsWith(`${ANIMATE_PREFIX}${PROPERTY_PARTS_SEPARATOR}`)) {
25154
- this._parseAnimation(name, this.parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
25155
- } else {
25156
- this._parsePropertyAst(name, this.parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), isPartOfAssignmentBinding, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
25157
- }
25158
- }
25159
- parsePropertyInterpolation(name, value, sourceSpan, valueSpan, targetMatchableAttrs, targetProps, keySpan, interpolatedTokens) {
25160
- const expr = this.parseInterpolation(value, valueSpan || sourceSpan, interpolatedTokens);
25161
- if (expr) {
25162
- this._parsePropertyAst(name, expr, false, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
25163
- return true;
25164
- }
25165
- return false;
25166
- }
25167
- _parsePropertyAst(name, ast, isPartOfAssignmentBinding, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps) {
25168
- targetMatchableAttrs.push([name, ast.source]);
25169
- targetProps.push(new ParsedProperty(name, ast, isPartOfAssignmentBinding ? ParsedPropertyType.TWO_WAY : ParsedPropertyType.DEFAULT, sourceSpan, keySpan, valueSpan));
25170
- }
25171
- _parseAnimation(name, ast, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps) {
25172
- targetMatchableAttrs.push([name, ast.source]);
25173
- targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.ANIMATION, sourceSpan, keySpan, valueSpan));
25174
- }
25175
- _parseLegacyAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps) {
25176
- if (name.length === 0) {
25177
- this._reportError("Animation trigger is missing", sourceSpan);
25178
- }
25179
- const ast = this.parseBinding(expression || "undefined", false, valueSpan || sourceSpan, absoluteOffset);
25180
- targetMatchableAttrs.push([name, ast.source]);
25181
- targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.LEGACY_ANIMATION, sourceSpan, keySpan, valueSpan));
25182
- }
25183
- parseBinding(value, isHostBinding2, sourceSpan, absoluteOffset) {
25184
- try {
25185
- const ast = isHostBinding2 ? this._exprParser.parseSimpleBinding(value, sourceSpan, absoluteOffset) : this._exprParser.parseBinding(value, sourceSpan, absoluteOffset);
25186
- if (ast) {
25187
- this.errors.push(...ast.errors);
25188
- }
25189
- return ast;
25190
- } catch (e) {
25191
- this._reportError(`${e}`, sourceSpan);
25192
- return this._exprParser.wrapLiteralPrimitive("ERROR", sourceSpan, absoluteOffset);
25193
- }
25194
- }
25195
- createBoundElementProperty(elementSelector, boundProp, skipValidation = false, mapPropertyName = true) {
25196
- if (boundProp.isLegacyAnimation) {
25197
- return new BoundElementProperty(boundProp.name, BindingType.LegacyAnimation, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
25198
- }
25199
- let unit = null;
25200
- let bindingType = void 0;
25201
- let boundPropertyName = null;
25202
- const parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR);
25203
- let securityContexts = void 0;
25204
- if (parts.length > 1) {
25205
- if (parts[0] == ATTRIBUTE_PREFIX) {
25206
- boundPropertyName = parts.slice(1).join(PROPERTY_PARTS_SEPARATOR);
25207
- if (!skipValidation) {
25208
- this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true);
25209
- }
25210
- securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, true);
25211
- const nsSeparatorIdx = boundPropertyName.indexOf(":");
25212
- if (nsSeparatorIdx > -1) {
25213
- const ns = boundPropertyName.substring(0, nsSeparatorIdx);
25214
- const name = boundPropertyName.substring(nsSeparatorIdx + 1);
25215
- boundPropertyName = mergeNsAndName(ns, name);
25216
- }
25217
- bindingType = BindingType.Attribute;
25218
- } else if (parts[0] == CLASS_PREFIX) {
25219
- boundPropertyName = parts[1];
25220
- bindingType = BindingType.Class;
25221
- securityContexts = [SecurityContext.NONE];
25222
- } else if (parts[0] == STYLE_PREFIX) {
25223
- unit = parts.length > 2 ? parts[2] : null;
25224
- boundPropertyName = parts[1];
25225
- bindingType = BindingType.Style;
25226
- securityContexts = [SecurityContext.STYLE];
25227
- } else if (parts[0] == ANIMATE_PREFIX) {
25228
- boundPropertyName = boundProp.name;
25229
- bindingType = BindingType.Animation;
25230
- securityContexts = [SecurityContext.NONE];
25231
- }
25232
- }
25233
- if (boundPropertyName === null) {
25234
- const mappedPropName = this._schemaRegistry.getMappedPropName(boundProp.name);
25235
- boundPropertyName = mapPropertyName ? mappedPropName : boundProp.name;
25236
- securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, mappedPropName, false);
25237
- bindingType = boundProp.type === ParsedPropertyType.TWO_WAY ? BindingType.TwoWay : BindingType.Property;
25238
- if (!skipValidation) {
25239
- this._validatePropertyOrAttributeName(mappedPropName, boundProp.sourceSpan, false);
25240
- }
25241
- }
25242
- return new BoundElementProperty(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
25243
- }
25244
- parseEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
25245
- if (name.length === 0) {
25246
- this._reportError(`Event name is missing in binding`, sourceSpan);
25247
- }
25248
- if (isLegacyAnimationLabel(name)) {
25249
- name = name.slice(1);
25250
- if (keySpan !== void 0) {
25251
- keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
25252
- }
25253
- this._parseLegacyAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan);
25254
- } else {
25255
- this._parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan);
25256
- }
25257
- }
25258
- calcPossibleSecurityContexts(selector, propName, isAttribute) {
25259
- const prop = this._schemaRegistry.getMappedPropName(propName);
25260
- return calcPossibleSecurityContexts(this._schemaRegistry, selector, prop, isAttribute);
25261
- }
25262
- parseEventListenerName(rawName) {
25263
- const [target, eventName] = splitAtColon(rawName, [null, rawName]);
25264
- return {
25265
- eventName,
25266
- target
25267
- };
25268
- }
25269
- parseLegacyAnimationEventName(rawName) {
25270
- const matches = splitAtPeriod(rawName, [rawName, null]);
25271
- return {
25272
- eventName: matches[0],
25273
- phase: matches[1] === null ? null : matches[1].toLowerCase()
25274
- };
25275
- }
25276
- _parseLegacyAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan) {
25277
- const {
25278
- eventName,
25279
- phase
25280
- } = this.parseLegacyAnimationEventName(name);
25281
- const ast = this._parseAction(expression, handlerSpan);
25282
- targetEvents.push(new ParsedEvent(eventName, phase, ParsedEventType.LegacyAnimation, ast, sourceSpan, handlerSpan, keySpan));
25283
- if (eventName.length === 0) {
25284
- this._reportError(`Animation event name is missing in binding`, sourceSpan);
25285
- }
25286
- if (phase) {
25287
- if (phase !== "start" && phase !== "done") {
25288
- this._reportError(`The provided animation output phase value "${phase}" for "@${eventName}" is not supported (use start or done)`, sourceSpan);
25289
- }
25290
- } else {
25291
- this._reportError(`The animation trigger output event (@${eventName}) is missing its phase value name (start or done are currently supported)`, sourceSpan);
25292
- }
25293
- }
25294
- _parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
25295
- const {
25296
- eventName,
25297
- target
25298
- } = this.parseEventListenerName(name);
25299
- const prevErrorCount = this.errors.length;
25300
- const ast = this._parseAction(expression, handlerSpan);
25301
- const isValid = this.errors.length === prevErrorCount;
25302
- targetMatchableAttrs.push([name, ast.source]);
25303
- if (isAssignmentEvent && isValid && !this._isAllowedAssignmentEvent(ast)) {
25304
- this._reportError("Unsupported expression in a two-way binding", sourceSpan);
25305
- }
25306
- let eventType = ParsedEventType.Regular;
25307
- if (isAssignmentEvent) {
25308
- eventType = ParsedEventType.TwoWay;
25309
- }
25310
- if (name.startsWith(`${ANIMATE_PREFIX}${PROPERTY_PARTS_SEPARATOR}`)) {
25311
- eventType = ParsedEventType.Animation;
25312
- }
25313
- targetEvents.push(new ParsedEvent(eventName, target, eventType, ast, sourceSpan, handlerSpan, keySpan));
25314
- }
25315
- _parseAction(value, sourceSpan) {
25316
- const absoluteOffset = sourceSpan && sourceSpan.start ? sourceSpan.start.offset : 0;
25317
- try {
25318
- const ast = this._exprParser.parseAction(value, sourceSpan, absoluteOffset);
25319
- if (ast) {
25320
- this.errors.push(...ast.errors);
25321
- }
25322
- if (!ast || ast.ast instanceof EmptyExpr$1) {
25323
- this._reportError(`Empty expressions are not allowed`, sourceSpan);
25324
- return this._exprParser.wrapLiteralPrimitive("ERROR", sourceSpan, absoluteOffset);
25325
- }
25326
- return ast;
25327
- } catch (e) {
25328
- this._reportError(`${e}`, sourceSpan);
25329
- return this._exprParser.wrapLiteralPrimitive("ERROR", sourceSpan, absoluteOffset);
25330
- }
25331
- }
25332
- _reportError(message, sourceSpan, level = ParseErrorLevel.ERROR) {
25333
- this.errors.push(new ParseError(sourceSpan, message, level));
25334
- }
25335
- _validatePropertyOrAttributeName(propName, sourceSpan, isAttr) {
25336
- const report = isAttr ? this._schemaRegistry.validateAttribute(propName) : this._schemaRegistry.validateProperty(propName);
25337
- if (report.error) {
25338
- this._reportError(report.msg, sourceSpan, ParseErrorLevel.ERROR);
25339
- }
25340
- }
25341
- _isAllowedAssignmentEvent(ast) {
25342
- if (ast instanceof ASTWithSource) {
25343
- return this._isAllowedAssignmentEvent(ast.ast);
25344
- }
25345
- if (ast instanceof NonNullAssert) {
25346
- return this._isAllowedAssignmentEvent(ast.expression);
25347
- }
25348
- if (ast instanceof Call && ast.args.length === 1 && ast.receiver instanceof PropertyRead && ast.receiver.name === "$any" && ast.receiver.receiver instanceof ImplicitReceiver) {
25349
- return this._isAllowedAssignmentEvent(ast.args[0]);
25350
- }
25351
- if (ast instanceof PropertyRead || ast instanceof KeyedRead) {
25352
- if (!hasRecursiveSafeReceiver(ast)) {
25353
- return true;
25354
- }
25355
- }
25356
- return false;
25357
- }
25358
- };
25359
- function hasRecursiveSafeReceiver(ast) {
25360
- if (ast instanceof SafePropertyRead || ast instanceof SafeKeyedRead) {
25361
- return true;
25362
- }
25363
- if (ast instanceof ParenthesizedExpression) {
25364
- return hasRecursiveSafeReceiver(ast.expression);
25365
- }
25366
- if (ast instanceof PropertyRead || ast instanceof KeyedRead || ast instanceof Call) {
25367
- return hasRecursiveSafeReceiver(ast.receiver);
25368
- }
25369
- return false;
25370
- }
25371
- __name(hasRecursiveSafeReceiver, "hasRecursiveSafeReceiver");
25372
- function isLegacyAnimationLabel(name) {
25373
- return name[0] == "@";
25374
- }
25375
- __name(isLegacyAnimationLabel, "isLegacyAnimationLabel");
25376
- function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) {
25377
- let ctxs;
25378
- const [namespaceKey, baseSelector] = selector ? splitNsName(selector, false) : [null, selector];
25379
- const nameToContext = /* @__PURE__ */ __name((elName) => {
25380
- const [nsStr, name] = splitNsName(elName, false);
25381
- const ns = nsStr ?? namespaceKey;
25382
- const fullName = ns ? `:${ns}:${name}` : name;
25383
- return registry.securityContext(fullName, propName, isAttribute);
25384
- }, "nameToContext");
25385
- const allKnownElements = registry.allKnownElementNames();
25386
- if (baseSelector === null) {
25387
- ctxs = allKnownElements.map(nameToContext);
25388
- } else {
25389
- ctxs = [];
25390
- CssSelector.parse(baseSelector).forEach((selector2) => {
25391
- let elementNames = selector2.element ? [selector2.element] : allKnownElements;
25392
- if (selector2.element && !registry.hasElement(selector2.element, [])) {
25393
- const svgElement = `:${SVG_NAMESPACE}:${selector2.element}`;
25394
- const mathElement = `:${MATH_ML_NAMESPACE}:${selector2.element}`;
25395
- if (registry.hasElement(svgElement, [])) {
25396
- elementNames = [svgElement];
25397
- } else if (registry.hasElement(mathElement, [])) {
25398
- elementNames = [mathElement];
25399
- }
25400
- }
25401
- const notElementNames = new Set(selector2.notSelectors.filter((selector3) => selector3.isElementSelector()).map((selector3) => selector3.element?.toLowerCase()));
25402
- const possibleElementNames = elementNames.filter((elName) => {
25403
- const elNameLowerCase = elName.toLowerCase();
25404
- return !notElementNames.has(elNameLowerCase) && !notElementNames.has(splitNsName(elNameLowerCase)[1]);
25405
- });
25406
- ctxs.push(...possibleElementNames.map(nameToContext));
25407
- });
25408
- }
25409
- return ctxs.length === 0 ? [SecurityContext.NONE] : Array.from(new Set(ctxs)).sort();
25410
- }
25411
- __name(calcPossibleSecurityContexts, "calcPossibleSecurityContexts");
25412
- function moveParseSourceSpan(sourceSpan, absoluteSpan) {
25413
- const startDiff = absoluteSpan.start - sourceSpan.start.offset;
25414
- const endDiff = absoluteSpan.end - sourceSpan.end.offset;
25415
- return new ParseSourceSpan(sourceSpan.start.moveBy(startDiff), sourceSpan.end.moveBy(endDiff), sourceSpan.fullStart.moveBy(startDiff), sourceSpan.details);
25416
- }
25417
- __name(moveParseSourceSpan, "moveParseSourceSpan");
25418
25736
  function isStyleUrlResolvable(url) {
25419
25737
  if (url == null || url.length === 0 || url[0] == "/") return false;
25420
25738
  const schemeMatch = url.match(URL_WITH_SCHEMA_REGEXP);
@@ -25428,7 +25746,7 @@ var LINK_STYLE_REL_ATTR = "rel";
25428
25746
  var LINK_STYLE_HREF_ATTR = "href";
25429
25747
  var LINK_STYLE_REL_VALUE = "stylesheet";
25430
25748
  var STYLE_ELEMENT = "style";
25431
- var SCRIPT_ELEMENTS = /* @__PURE__ */ new Set([":svg:script", "script"]);
25749
+ var SCRIPT_ELEMENTS = /* @__PURE__ */ new Set([":math:script", ":svg:script", "script"]);
25432
25750
  var NG_NON_BINDABLE_ATTR = "ngNonBindable";
25433
25751
  var NG_PROJECT_AS = "ngProjectAs";
25434
25752
  function preparseElement(ast) {
@@ -25493,12 +25811,99 @@ var PreparsedElement = class {
25493
25811
  this.projectAs = projectAs;
25494
25812
  }
25495
25813
  };
25814
+ function createContentBlock(ast, visitor) {
25815
+ const errors = [];
25816
+ if (ast.parameters.length < 1 || ast.parameters.length > 2) {
25817
+ errors.push(new ParseError(ast.startSourceSpan, '@content block must have one or two parameters, e.g. "@content(header)" or "@content(items; let item, index)"'));
25818
+ return {
25819
+ node: null,
25820
+ errors
25821
+ };
25822
+ }
25823
+ const nameParam = ast.parameters[0];
25824
+ const name = nameParam.expression.trim();
25825
+ if (name.includes(",")) {
25826
+ errors.push(new ParseError(ast.startSourceSpan, "@content block must have exactly one name parameter"));
25827
+ return {
25828
+ node: null,
25829
+ errors
25830
+ };
25831
+ }
25832
+ if (!IDENTIFIER_PATTERN.test(name)) {
25833
+ errors.push(new ParseError(nameParam.sourceSpan, "@content name must be a valid JavaScript identifier"));
25834
+ return {
25835
+ node: null,
25836
+ errors
25837
+ };
25838
+ }
25839
+ const variables = parseContentBlockVariables(ast, errors);
25840
+ if (variables === null) {
25841
+ return {
25842
+ node: null,
25843
+ errors
25844
+ };
25845
+ }
25846
+ const node = new ContentBlock(name, variables, visitAll(visitor, ast.children, ast.children), ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.i18n);
25847
+ return {
25848
+ node,
25849
+ errors
25850
+ };
25851
+ }
25852
+ __name(createContentBlock, "createContentBlock");
25853
+ function parseContentBlockVariables(ast, errors) {
25854
+ const variables = [];
25855
+ if (ast.parameters.length < 2) {
25856
+ return variables;
25857
+ }
25858
+ const varsParam = ast.parameters[1];
25859
+ const varsExpr = varsParam.expression.trim();
25860
+ const letMatch = varsExpr.match(LET_PATTERN);
25861
+ if (!letMatch) {
25862
+ errors.push(new ParseError(varsParam.sourceSpan, '@content block variables must start with "let", e.g. "let item, index"'));
25863
+ return null;
25864
+ }
25865
+ const varNames = letMatch[1].split(",").map((v) => v.trim());
25866
+ const variablesRawString = letMatch[1];
25867
+ const variablesStartOffset = varsParam.expression.indexOf(variablesRawString);
25868
+ const variablesStartLocation = varsParam.sourceSpan.start.moveBy(variablesStartOffset);
25869
+ let searchIndex = 0;
25870
+ for (let varName of varNames) {
25871
+ if (varName === "") {
25872
+ errors.push(new ParseError(varsParam.sourceSpan, "Invalid variable name in @content block"));
25873
+ continue;
25874
+ }
25875
+ let varSpan;
25876
+ const index = variablesRawString.indexOf(varName, searchIndex);
25877
+ const varStart = variablesStartLocation.moveBy(index);
25878
+ if (varName.includes("=")) {
25879
+ const eqIndex = varName.indexOf("=");
25880
+ const namePart = varName.substring(0, eqIndex).trim();
25881
+ const fullVarSpan = new ParseSourceSpan(varStart, varStart.moveBy(varName.length));
25882
+ errors.push(new ParseError(fullVarSpan, `@content block variables cannot be assigned a value`));
25883
+ varName = namePart;
25884
+ varSpan = new ParseSourceSpan(varStart, varStart.moveBy(varName.length));
25885
+ } else {
25886
+ varSpan = new ParseSourceSpan(varStart, varStart.moveBy(varName.length));
25887
+ }
25888
+ if (!IDENTIFIER_PATTERN.test(varName)) {
25889
+ errors.push(new ParseError(varSpan, `Variable name "${varName}" must be a valid JavaScript identifier`));
25890
+ searchIndex = index + varName.length;
25891
+ continue;
25892
+ }
25893
+ if (variables.some((v) => v.name === varName)) {
25894
+ errors.push(new ParseError(varSpan, `Duplicate variable name "${varName}" in @content block`));
25895
+ searchIndex = index + varName.length;
25896
+ continue;
25897
+ }
25898
+ variables.push(new Variable(varName, "", varSpan, varSpan));
25899
+ searchIndex = index + varName.length;
25900
+ }
25901
+ return variables;
25902
+ }
25903
+ __name(parseContentBlockVariables, "parseContentBlockVariables");
25496
25904
  var FOR_LOOP_EXPRESSION_PATTERN = /^\s*([0-9A-Za-z_$]*)\s+of\s+([\S\s]*)/;
25497
25905
  var FOR_LOOP_TRACK_PATTERN = /^track\s+([\S\s]*)/;
25498
25906
  var CONDITIONAL_ALIAS_PATTERN = /^(as\s+)(.*)/;
25499
- var ELSE_IF_PATTERN = /^else[^\S\r\n]+if/;
25500
- var FOR_LOOP_LET_PATTERN = /^let\s+([\S\s]*)/;
25501
- var IDENTIFIER_PATTERN = /^[$A-Z_][0-9A-Z_$]*$/i;
25502
25907
  var CHARACTERS_IN_SURROUNDING_WHITESPACE_PATTERN = /(\s*)(\S+)(\s*)/;
25503
25908
  var ALLOWED_FOR_LOOP_LET_VARIABLES = /* @__PURE__ */ new Set(["$index", "$first", "$last", "$even", "$odd", "$count"]);
25504
25909
  function isConnectedForLoopBlock(name) {
@@ -25506,7 +25911,7 @@ function isConnectedForLoopBlock(name) {
25506
25911
  }
25507
25912
  __name(isConnectedForLoopBlock, "isConnectedForLoopBlock");
25508
25913
  function isConnectedIfLoopBlock(name) {
25509
- return name === "else" || ELSE_IF_PATTERN.test(name);
25914
+ return name === "else" || name === "else if";
25510
25915
  }
25511
25916
  __name(isConnectedIfLoopBlock, "isConnectedIfLoopBlock");
25512
25917
  function createIfBlock(ast, connectedBlocks, visitor, bindingParser) {
@@ -25517,7 +25922,7 @@ function createIfBlock(ast, connectedBlocks, visitor, bindingParser) {
25517
25922
  branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan, ast.i18n));
25518
25923
  }
25519
25924
  for (const block of connectedBlocks) {
25520
- if (ELSE_IF_PATTERN.test(block.name)) {
25925
+ if (block.name === "else if") {
25521
25926
  const params = parseConditionalBlockParameters(block, errors, bindingParser);
25522
25927
  if (params !== null) {
25523
25928
  const children = visitAll(visitor, block.children, block.children);
@@ -25670,7 +26075,7 @@ function parseForLoopParameters(block, errors, bindingParser) {
25670
26075
  })
25671
26076
  };
25672
26077
  for (const param of secondaryParams) {
25673
- const letMatch = param.expression.match(FOR_LOOP_LET_PATTERN);
26078
+ const letMatch = param.expression.match(LET_PATTERN);
25674
26079
  if (letMatch !== null) {
25675
26080
  const variablesSpan = new ParseSourceSpan(param.sourceSpan.start.moveBy(letMatch[0].length - letMatch[1].length), param.sourceSpan.end);
25676
26081
  parseLetParameter(param.sourceSpan, letMatch[1], variablesSpan, itemName, result.context, errors);
@@ -25750,7 +26155,7 @@ function validateIfConnectedBlocks(connectedBlocks) {
25750
26155
  errors.push(new ParseError(block.startSourceSpan, "@else block cannot have parameters"));
25751
26156
  }
25752
26157
  hasElse = true;
25753
- } else if (!ELSE_IF_PATTERN.test(block.name)) {
26158
+ } else if (block.name !== "else if") {
25754
26159
  errors.push(new ParseError(block.startSourceSpan, `Unrecognized conditional block @${block.name}`));
25755
26160
  }
25756
26161
  }
@@ -25816,7 +26221,7 @@ function parseConditionalBlockParameters(block, errors, bindingParser) {
25816
26221
  const aliasMatch = param.expression.match(CONDITIONAL_ALIAS_PATTERN);
25817
26222
  if (aliasMatch === null) {
25818
26223
  errors.push(new ParseError(param.sourceSpan, `Unrecognized conditional parameter "${param.expression}"`));
25819
- } else if (block.name !== "if" && !ELSE_IF_PATTERN.test(block.name)) {
26224
+ } else if (block.name !== "if" && block.name !== "else if") {
25820
26225
  errors.push(new ParseError(param.sourceSpan, '"as" expression is only allowed on `@if` and `@else if` blocks'));
25821
26226
  } else if (expressionAlias !== null) {
25822
26227
  errors.push(new ParseError(param.sourceSpan, 'Conditional can only have one "as" expression'));
@@ -26703,6 +27108,9 @@ var HtmlAstToIvyAst = class {
26703
27108
  case "switch":
26704
27109
  result = createSwitchBlock(block, this, this.bindingParser);
26705
27110
  break;
27111
+ case "content":
27112
+ result = createContentBlock(block, this);
27113
+ break;
26706
27114
  case "for":
26707
27115
  result = createForLoop(block, this.findConnectedBlocks(index, context, isConnectedForLoopBlock), this, this.bindingParser);
26708
27116
  break;
@@ -27248,7 +27656,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
27248
27656
  allDeferrableDepsFn = variable(fnName);
27249
27657
  }
27250
27658
  const compilationMode = meta.isStandalone && !meta.hasDirectiveDependencies ? TemplateCompilationMode.DomOnly : TemplateCompilationMode.Full;
27251
- const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, compilationMode, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.defer, allDeferrableDepsFn, meta.relativeTemplatePath, getTemplateSourceLocationsEnabled(), meta.legacyOptionalChaining);
27659
+ const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, compilationMode, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.defer, allDeferrableDepsFn, meta.relativeTemplatePath, getTemplateSourceLocationsEnabled(), meta.legacyOptionalChaining, meta.foreignImports);
27252
27660
  transform(tpl, CompilationJobKind.Tmpl);
27253
27661
  const templateFn = emitTemplateFn(tpl, constantPool);
27254
27662
  if (tpl.contentSelectors !== null) {
@@ -27278,7 +27686,8 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
27278
27686
  }
27279
27687
  let hasStyles = !!meta.externalStyles?.length;
27280
27688
  if (meta.styles && meta.styles.length) {
27281
- const styleValues = meta.encapsulation == ViewEncapsulation$1.Emulated ? compileStyles(meta.styles, CONTENT_ATTR, HOST_ATTR) : meta.styles;
27689
+ const namespacedStyles = meta.styles.map((s) => namespaceCssVariables(s));
27690
+ const styleValues = meta.encapsulation == ViewEncapsulation$1.Emulated ? compileStyles(namespacedStyles, CONTENT_ATTR, HOST_ATTR) : namespacedStyles;
27282
27691
  const styleNodes = styleValues.reduce((result, style) => {
27283
27692
  if (style.trim().length > 0) {
27284
27693
  result.push(constantPool.getConstLiteral(literal(style)));
@@ -27648,6 +28057,9 @@ var CombinedRecursiveAstVisitor = class extends RecursiveAstVisitor2 {
27648
28057
  visitContent(content) {
27649
28058
  this.visitAllTemplateNodes(content.children);
27650
28059
  }
28060
+ visitContentBlock(block) {
28061
+ this.visitAllTemplateNodes(block.children);
28062
+ }
27651
28063
  visitBoundAttribute(attribute2) {
27652
28064
  this.visit(attribute2.value);
27653
28065
  }
@@ -27884,14 +28296,17 @@ var R3TargetBinder = class {
27884
28296
  __name(this, "R3TargetBinder");
27885
28297
  }
27886
28298
  directiveMatcher;
27887
- constructor(directiveMatcher) {
28299
+ foreignComponentMatcher;
28300
+ constructor(directiveMatcher, foreignComponentMatcher = null) {
27888
28301
  this.directiveMatcher = directiveMatcher;
28302
+ this.foreignComponentMatcher = foreignComponentMatcher;
27889
28303
  }
27890
28304
  bind(target) {
27891
28305
  if (!target.template && !target.host) {
27892
28306
  throw new Error("Empty bound targets are not supported");
27893
28307
  }
27894
28308
  const directives = /* @__PURE__ */ new Map();
28309
+ const foreignComponents = /* @__PURE__ */ new Map();
27895
28310
  const eagerDirectives = [];
27896
28311
  const missingDirectives = /* @__PURE__ */ new Set();
27897
28312
  const bindings = /* @__PURE__ */ new Map();
@@ -27907,14 +28322,14 @@ var R3TargetBinder = class {
27907
28322
  if (target.template) {
27908
28323
  const scope = Scope$1.apply(target.template);
27909
28324
  extractScopedNodeEntities(scope, scopedNodeEntities);
27910
- DirectiveBinder.apply(target.template, this.directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references, conflictingHostDirectiveBindings);
28325
+ DirectiveBinder.apply(target.template, this.directiveMatcher, this.foreignComponentMatcher, directives, foreignComponents, eagerDirectives, missingDirectives, bindings, references, conflictingHostDirectiveBindings);
27911
28326
  TemplateBinder.applyWithScope(target.template, scope, expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
27912
28327
  }
27913
28328
  if (target.host) {
27914
28329
  directives.set(target.host.node, target.host.directives);
27915
28330
  TemplateBinder.applyWithScope(target.host.node, Scope$1.apply(target.host.node), expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
27916
28331
  }
27917
- return new R3BoundTarget(target, directives, eagerDirectives, missingDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks, conflictingHostDirectiveBindings);
28332
+ return new R3BoundTarget(target, directives, foreignComponents, eagerDirectives, missingDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks, conflictingHostDirectiveBindings);
27918
28333
  }
27919
28334
  };
27920
28335
  var Scope$1 = class Scope2 {
@@ -27953,7 +28368,7 @@ var Scope$1 = class Scope2 {
27953
28368
  this.visitVariable(nodeOrNodes.item);
27954
28369
  nodeOrNodes.contextVariables.forEach((v) => this.visitVariable(v));
27955
28370
  nodeOrNodes.children.forEach((node) => node.visit(this));
27956
- } else if (nodeOrNodes instanceof SwitchBlockCaseGroup || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlock || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
28371
+ } else if (nodeOrNodes instanceof SwitchBlockCaseGroup || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlock || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof ContentBlock || nodeOrNodes instanceof Content) {
27957
28372
  nodeOrNodes.children.forEach((node) => node.visit(this));
27958
28373
  } else if (!(nodeOrNodes instanceof HostElement)) {
27959
28374
  nodeOrNodes.forEach((node) => node.visit(this));
@@ -28014,6 +28429,9 @@ var Scope$1 = class Scope2 {
28014
28429
  visitContent(content) {
28015
28430
  this.ingestScopedNode(content);
28016
28431
  }
28432
+ visitContentBlock(block) {
28433
+ this.ingestScopedNode(block);
28434
+ }
28017
28435
  visitLetDeclaration(decl) {
28018
28436
  this.maybeDeclare(decl);
28019
28437
  }
@@ -28077,24 +28495,28 @@ var DirectiveBinder = class _DirectiveBinder {
28077
28495
  __name(this, "DirectiveBinder");
28078
28496
  }
28079
28497
  directiveMatcher;
28498
+ foreignMatcher;
28080
28499
  directives;
28500
+ foreignComponents;
28081
28501
  eagerDirectives;
28082
28502
  missingDirectives;
28083
28503
  bindings;
28084
28504
  references;
28085
28505
  conflictingHostDirectiveBindings;
28086
28506
  isInDeferBlock = false;
28087
- constructor(directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references, conflictingHostDirectiveBindings) {
28507
+ constructor(directiveMatcher, foreignMatcher, directives, foreignComponents, eagerDirectives, missingDirectives, bindings, references, conflictingHostDirectiveBindings) {
28088
28508
  this.directiveMatcher = directiveMatcher;
28509
+ this.foreignMatcher = foreignMatcher;
28089
28510
  this.directives = directives;
28511
+ this.foreignComponents = foreignComponents;
28090
28512
  this.eagerDirectives = eagerDirectives;
28091
28513
  this.missingDirectives = missingDirectives;
28092
28514
  this.bindings = bindings;
28093
28515
  this.references = references;
28094
28516
  this.conflictingHostDirectiveBindings = conflictingHostDirectiveBindings;
28095
28517
  }
28096
- static apply(template2, directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references, conflictingHostDirectiveBindings) {
28097
- const matcher = new _DirectiveBinder(directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references, conflictingHostDirectiveBindings);
28518
+ static apply(template2, directiveMatcher, foreignMatcher, directives, foreignComponents, eagerDirectives, missingDirectives, bindings, references, conflictingHostDirectiveBindings) {
28519
+ const matcher = new _DirectiveBinder(directiveMatcher, foreignMatcher, directives, foreignComponents, eagerDirectives, missingDirectives, bindings, references, conflictingHostDirectiveBindings);
28098
28520
  matcher.ingest(template2);
28099
28521
  }
28100
28522
  ingest(template2) {
@@ -28153,6 +28575,9 @@ var DirectiveBinder = class _DirectiveBinder {
28153
28575
  visitContent(content) {
28154
28576
  content.children.forEach((child) => child.visit(this));
28155
28577
  }
28578
+ visitContentBlock(block) {
28579
+ block.children.forEach((child) => child.visit(this));
28580
+ }
28156
28581
  visitComponent(node) {
28157
28582
  if (this.directiveMatcher instanceof SelectorlessMatcher) {
28158
28583
  const componentMatches = this.directiveMatcher.match(node.componentName);
@@ -28176,11 +28601,11 @@ var DirectiveBinder = class _DirectiveBinder {
28176
28601
  }
28177
28602
  }
28178
28603
  visitElementOrTemplate(node) {
28604
+ const matchedDirectives = [];
28179
28605
  if (this.directiveMatcher instanceof SelectorMatcher) {
28180
- const directives = [];
28181
28606
  const cssSelector = createCssSelectorFromNode(node);
28182
- this.directiveMatcher.match(cssSelector, (_, results) => directives.push(...results));
28183
- this.trackSelectorBasedBindingsAndDirectives(node, directives);
28607
+ this.directiveMatcher.match(cssSelector, (_, results) => matchedDirectives.push(...results));
28608
+ this.trackSelectorBasedBindingsAndDirectives(node, matchedDirectives);
28184
28609
  } else {
28185
28610
  node.references.forEach((ref) => {
28186
28611
  if (ref.value.trim() === "") {
@@ -28188,6 +28613,15 @@ var DirectiveBinder = class _DirectiveBinder {
28188
28613
  }
28189
28614
  });
28190
28615
  }
28616
+ if (this.foreignMatcher && node instanceof Element$1) {
28617
+ const foreignMatches = this.foreignMatcher.match(node.name);
28618
+ if (foreignMatches.length > 0) {
28619
+ if (matchedDirectives.length > 0) {
28620
+ throw new Error(`Conflict: Element '${node.name}' matches both an Angular directive and a foreign component.`);
28621
+ }
28622
+ this.foreignComponents.set(node, foreignMatches[0]);
28623
+ }
28624
+ }
28191
28625
  node.directives.forEach((directive) => directive.visit(this));
28192
28626
  node.children.forEach((child) => child.visit(this));
28193
28627
  }
@@ -28407,7 +28841,7 @@ var TemplateBinder = class _TemplateBinder extends CombinedRecursiveAstVisitor {
28407
28841
  this.deferBlocks.push([nodeOrNodes, this.scope]);
28408
28842
  nodeOrNodes.children.forEach((node) => node.visit(this));
28409
28843
  this.nestingLevel.set(nodeOrNodes, this.level);
28410
- } else if (nodeOrNodes instanceof SwitchBlockCaseGroup || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
28844
+ } else if (nodeOrNodes instanceof SwitchBlockCaseGroup || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof ContentBlock || nodeOrNodes instanceof Content) {
28411
28845
  nodeOrNodes.children.forEach((node) => node.visit(this));
28412
28846
  this.nestingLevel.set(nodeOrNodes, this.level);
28413
28847
  } else if (nodeOrNodes instanceof HostElement) {
@@ -28478,6 +28912,9 @@ var TemplateBinder = class _TemplateBinder extends CombinedRecursiveAstVisitor {
28478
28912
  visitContent(content) {
28479
28913
  this.ingestScopedNode(content);
28480
28914
  }
28915
+ visitContentBlock(block) {
28916
+ this.ingestScopedNode(block);
28917
+ }
28481
28918
  visitLetDeclaration(decl) {
28482
28919
  super.visitLetDeclaration(decl);
28483
28920
  if (this.rootNode !== null) {
@@ -28520,6 +28957,7 @@ var R3BoundTarget = class {
28520
28957
  }
28521
28958
  target;
28522
28959
  directives;
28960
+ foreignComponents;
28523
28961
  eagerDirectives;
28524
28962
  missingDirectives;
28525
28963
  bindings;
@@ -28533,9 +28971,10 @@ var R3BoundTarget = class {
28533
28971
  conflictingHostDirectiveBindings;
28534
28972
  deferredBlocks;
28535
28973
  deferredScopes;
28536
- constructor(target, directives, eagerDirectives, missingDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, rawDeferred, conflictingHostDirectiveBindings) {
28974
+ constructor(target, directives, foreignComponents, eagerDirectives, missingDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, rawDeferred, conflictingHostDirectiveBindings) {
28537
28975
  this.target = target;
28538
28976
  this.directives = directives;
28977
+ this.foreignComponents = foreignComponents;
28539
28978
  this.eagerDirectives = eagerDirectives;
28540
28979
  this.missingDirectives = missingDirectives;
28541
28980
  this.bindings = bindings;
@@ -28556,6 +28995,9 @@ var R3BoundTarget = class {
28556
28995
  getDirectivesOfNode(node) {
28557
28996
  return this.directives.get(node) || null;
28558
28997
  }
28998
+ getForeignComponent(element2) {
28999
+ return this.foreignComponents.get(element2) || null;
29000
+ }
28559
29001
  getReferenceTarget(ref) {
28560
29002
  return this.references.get(ref) || null;
28561
29003
  }
@@ -28875,7 +29317,8 @@ var CompilerFacadeImpl = class {
28875
29317
  viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) : null,
28876
29318
  relativeContextFilePath: "",
28877
29319
  i18nUseExternalIds: true,
28878
- relativeTemplatePath: null
29320
+ relativeTemplatePath: null,
29321
+ foreignImports: null
28879
29322
  };
28880
29323
  const jitExpressionSourceMap = `ng:///${facade.name}.js`;
28881
29324
  return this.compileComponentFromMeta(angularCoreEnv, jitExpressionSourceMap, meta);
@@ -29114,7 +29557,8 @@ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMap
29114
29557
  i18nUseExternalIds: true,
29115
29558
  relativeTemplatePath: null,
29116
29559
  hasDirectiveDependencies,
29117
- legacyOptionalChaining: decl.legacyOptionalChaining ?? LEGACY_OPTIONAL_CHAINING_DEFAULT
29560
+ legacyOptionalChaining: decl.legacyOptionalChaining ?? LEGACY_OPTIONAL_CHAINING_DEFAULT,
29561
+ foreignImports: null
29118
29562
  };
29119
29563
  }
29120
29564
  __name(convertDeclareComponentFacadeToMetadata, "convertDeclareComponentFacadeToMetadata");
@@ -29515,7 +29959,7 @@ var _Visitor3 = class {
29515
29959
  if (!this._inI18nNode && !this._inIcu) {
29516
29960
  if (!this._inI18nBlock) {
29517
29961
  if (isOpening) {
29518
- if (!i18nCommentsWarned && console && console.warn) {
29962
+ if (!i18nCommentsWarned && typeof console?.warn === "function") {
29519
29963
  i18nCommentsWarned = true;
29520
29964
  const details = comment.sourceSpan.details ? `, ${comment.sourceSpan.details}` : "";
29521
29965
  console.warn(`I18n comments are deprecated, use an <ng-container> element instead (${comment.sourceSpan.start}${details})`);
@@ -31075,7 +31519,7 @@ var MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = "18.0.0";
31075
31519
  function compileDeclareClassMetadata(metadata) {
31076
31520
  const definitionMap = new DefinitionMap();
31077
31521
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
31078
- definitionMap.set("version", literal("22.0.5"));
31522
+ definitionMap.set("version", literal("22.1.2"));
31079
31523
  definitionMap.set("ngImport", importExpr(Identifiers.core));
31080
31524
  definitionMap.set("type", metadata.type);
31081
31525
  definitionMap.set("decorators", metadata.decorators);
@@ -31094,7 +31538,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
31094
31538
  callbackReturnDefinitionMap.set("ctorParameters", metadata.ctorParameters ?? literal(null));
31095
31539
  callbackReturnDefinitionMap.set("propDecorators", metadata.propDecorators ?? literal(null));
31096
31540
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
31097
- definitionMap.set("version", literal("22.0.5"));
31541
+ definitionMap.set("version", literal("22.1.2"));
31098
31542
  definitionMap.set("ngImport", importExpr(Identifiers.core));
31099
31543
  definitionMap.set("type", metadata.type);
31100
31544
  definitionMap.set("resolveDeferredDeps", compileComponentMetadataAsyncResolver(dependencies));
@@ -31171,7 +31615,7 @@ function createDirectiveDefinitionMap(meta) {
31171
31615
  const definitionMap = new DefinitionMap();
31172
31616
  const minVersion = getMinimumVersionForPartialOutput(meta);
31173
31617
  definitionMap.set("minVersion", literal(minVersion));
31174
- definitionMap.set("version", literal("22.0.5"));
31618
+ definitionMap.set("version", literal("22.1.2"));
31175
31619
  definitionMap.set("type", meta.type.value);
31176
31620
  if (meta.isStandalone !== void 0) {
31177
31621
  definitionMap.set("isStandalone", literal(meta.isStandalone));
@@ -31527,7 +31971,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION$5 = "12.0.0";
31527
31971
  function compileDeclareFactoryFunction(meta) {
31528
31972
  const definitionMap = new DefinitionMap();
31529
31973
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
31530
- definitionMap.set("version", literal("22.0.5"));
31974
+ definitionMap.set("version", literal("22.1.2"));
31531
31975
  definitionMap.set("ngImport", importExpr(Identifiers.core));
31532
31976
  definitionMap.set("type", meta.type.value);
31533
31977
  definitionMap.set("deps", compileDependencies(meta.deps));
@@ -31554,7 +31998,7 @@ __name(compileDeclareInjectableFromMetadata, "compileDeclareInjectableFromMetada
31554
31998
  function createInjectableDefinitionMap(meta) {
31555
31999
  const definitionMap = new DefinitionMap();
31556
32000
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
31557
- definitionMap.set("version", literal("22.0.5"));
32001
+ definitionMap.set("version", literal("22.1.2"));
31558
32002
  definitionMap.set("ngImport", importExpr(Identifiers.core));
31559
32003
  definitionMap.set("type", meta.type.value);
31560
32004
  if (meta.providedIn !== void 0) {
@@ -31596,7 +32040,7 @@ __name(compileDeclareServiceFromMetadata, "compileDeclareServiceFromMetadata");
31596
32040
  function createServiceDefinitionMap(meta) {
31597
32041
  const definitionMap = new DefinitionMap();
31598
32042
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
31599
- definitionMap.set("version", literal("22.0.5"));
32043
+ definitionMap.set("version", literal("22.1.2"));
31600
32044
  definitionMap.set("ngImport", importExpr(Identifiers.core));
31601
32045
  definitionMap.set("type", meta.type.value);
31602
32046
  if (meta.autoProvided === false) {
@@ -31623,7 +32067,7 @@ __name(compileDeclareInjectorFromMetadata, "compileDeclareInjectorFromMetadata")
31623
32067
  function createInjectorDefinitionMap(meta) {
31624
32068
  const definitionMap = new DefinitionMap();
31625
32069
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
31626
- definitionMap.set("version", literal("22.0.5"));
32070
+ definitionMap.set("version", literal("22.1.2"));
31627
32071
  definitionMap.set("ngImport", importExpr(Identifiers.core));
31628
32072
  definitionMap.set("type", meta.type.value);
31629
32073
  definitionMap.set("providers", meta.providers);
@@ -31654,7 +32098,7 @@ function createNgModuleDefinitionMap(meta) {
31654
32098
  throw new Error("Invalid path! Isolated compilation mode should not get into the partial compilation path");
31655
32099
  }
31656
32100
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
31657
- definitionMap.set("version", literal("22.0.5"));
32101
+ definitionMap.set("version", literal("22.1.2"));
31658
32102
  definitionMap.set("ngImport", importExpr(Identifiers.core));
31659
32103
  definitionMap.set("type", meta.type.value);
31660
32104
  if (meta.bootstrap.length > 0) {
@@ -31693,7 +32137,7 @@ __name(compileDeclarePipeFromMetadata, "compileDeclarePipeFromMetadata");
31693
32137
  function createPipeDefinitionMap(meta) {
31694
32138
  const definitionMap = new DefinitionMap();
31695
32139
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
31696
- definitionMap.set("version", literal("22.0.5"));
32140
+ definitionMap.set("version", literal("22.1.2"));
31697
32141
  definitionMap.set("ngImport", importExpr(Identifiers.core));
31698
32142
  definitionMap.set("type", meta.type.value);
31699
32143
  if (meta.isStandalone !== void 0) {
@@ -31768,7 +32212,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
31768
32212
  return new DeclareFunctionStmt(`${meta.className}_UpdateMetadata`, params, body, null, StmtModifier.Final);
31769
32213
  }
31770
32214
  __name(compileHmrUpdateCallback, "compileHmrUpdateCallback");
31771
- var VERSION = new Version("22.0.5");
32215
+ var VERSION = new Version("22.1.2");
31772
32216
  var HOST_BINDING_GUARD_COMMENT_TEXT = "hostBindingsBlockGuard";
31773
32217
  function createHostElement(type, selector, nameSpan, hostObjectLiteralBindings, hostBindingDecorators, hostListenerDecorators) {
31774
32218
  const bindings = [];
@@ -32186,7 +32630,10 @@ var TcbExprTranslator = class {
32186
32630
  return new TcbExpr(`"" + ${exprs.join(" + ")}`);
32187
32631
  }
32188
32632
  visitKeyedRead(ast) {
32189
- const receiver = this.translate(ast.receiver).wrapForTypeChecker();
32633
+ const receiver = this.translate(ast.receiver);
32634
+ if (!this.isStrictSafeNavigationChain(ast.receiver)) {
32635
+ receiver.wrapForTypeChecker();
32636
+ }
32190
32637
  const key = this.translate(ast.key);
32191
32638
  return new TcbExpr(`${receiver.print()}[${key.print()}]`).addParseSpanInfo(ast.sourceSpan);
32192
32639
  }
@@ -32261,7 +32708,10 @@ var TcbExprTranslator = class {
32261
32708
  return new TcbExpr(`void ${expression.print()}`).addParseSpanInfo(ast.sourceSpan);
32262
32709
  }
32263
32710
  visitPropertyRead(ast) {
32264
- const receiver = this.translate(ast.receiver).wrapForTypeChecker();
32711
+ const receiver = this.translate(ast.receiver);
32712
+ if (!this.isStrictSafeNavigationChain(ast.receiver)) {
32713
+ receiver.wrapForTypeChecker();
32714
+ }
32265
32715
  return new TcbExpr(`${receiver.print()}.${ast.name}`).addParseSpanInfo(ast.nameSpan).wrapForTypeChecker().addParseSpanInfo(ast.sourceSpan);
32266
32716
  }
32267
32717
  visitSafePropertyRead(ast) {
@@ -32300,7 +32750,10 @@ var TcbExprTranslator = class {
32300
32750
  if (resolved !== null) {
32301
32751
  expr = resolved;
32302
32752
  } else {
32303
- const propertyReceiver = this.translate(receiver.receiver).wrapForTypeChecker();
32753
+ const propertyReceiver = this.translate(receiver.receiver);
32754
+ if (!this.isStrictSafeNavigationChain(receiver.receiver)) {
32755
+ propertyReceiver.wrapForTypeChecker();
32756
+ }
32304
32757
  expr = new TcbExpr(`${propertyReceiver.print()}.${receiver.name}`).addParseSpanInfo(receiver.nameSpan);
32305
32758
  }
32306
32759
  } else {
@@ -32382,7 +32835,7 @@ var TcbExprTranslator = class {
32382
32835
  const expr = exprNode.print();
32383
32836
  const args = argNodes.map((node) => node.print()).join(", ");
32384
32837
  if (this.config.strictSafeNavigationTypes) {
32385
- return new TcbExpr(`(0 as any ? ${expr}!(${args}) : undefined)`);
32838
+ return new TcbExpr(`(${expr}?.(${args}))`);
32386
32839
  }
32387
32840
  if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
32388
32841
  return new TcbExpr(`(${expr} as any)(${args})`);
@@ -32392,6 +32845,9 @@ var TcbExprTranslator = class {
32392
32845
  escapeTemplateLiteral(value) {
32393
32846
  return value.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\${/g, "$\\{");
32394
32847
  }
32848
+ isStrictSafeNavigationChain(ast) {
32849
+ return this.config.strictSafeNavigationTypes && (ast instanceof SafePropertyRead || ast instanceof SafeKeyedRead || ast instanceof SafeCall);
32850
+ }
32395
32851
  };
32396
32852
  var VeSafeLhsInferenceBugDetector = class _VeSafeLhsInferenceBugDetector {
32397
32853
  static {
@@ -34463,7 +34919,11 @@ var Scope3 = class _Scope {
34463
34919
  const directives = this.tcb.boundTarget.getDirectivesOfNode(node);
34464
34920
  if (directives === null || directives.length === 0) {
34465
34921
  if (node instanceof Element$1) {
34466
- this.opQueue.push(new TcbUnclaimedInputsOp(this.tcb, this, node.inputs, node, claimedInputs), new TcbDomSchemaCheckerOp(this.tcb, node, true, claimedInputs));
34922
+ this.opQueue.push(new TcbUnclaimedInputsOp(this.tcb, this, node.inputs, node, claimedInputs));
34923
+ const isForeign = this.tcb.boundTarget.getForeignComponent(node) !== null;
34924
+ if (!isForeign) {
34925
+ this.opQueue.push(new TcbDomSchemaCheckerOp(this.tcb, node, true, claimedInputs));
34926
+ }
34467
34927
  }
34468
34928
  return;
34469
34929
  }
@@ -34632,7 +35092,10 @@ var Scope3 = class _Scope {
34632
35092
  }
34633
35093
  }
34634
35094
  }
34635
- this.opQueue.push(new TcbDomSchemaCheckerOp(this.tcb, node, !hasDirectives, claimedInputs));
35095
+ const isForeign = this.tcb.boundTarget.getForeignComponent(node) !== null;
35096
+ if (!isForeign) {
35097
+ this.opQueue.push(new TcbDomSchemaCheckerOp(this.tcb, node, !hasDirectives, claimedInputs));
35098
+ }
34636
35099
  }
34637
35100
  this.appendDeepSchemaChecks(node.children);
34638
35101
  }
@@ -34966,6 +35429,7 @@ publishFacade(_global);
34966
35429
  TmplAstBoundText,
34967
35430
  TmplAstComponent,
34968
35431
  TmplAstContent,
35432
+ TmplAstContentBlock,
34969
35433
  TmplAstDeferredBlock,
34970
35434
  TmplAstDeferredBlockError,
34971
35435
  TmplAstDeferredBlockLoading,
@@ -35092,7 +35556,7 @@ publishFacade(_global);
35092
35556
 
35093
35557
  @angular/compiler/fesm2022/compiler.mjs:
35094
35558
  (**
35095
- * @license Angular v22.0.5
35559
+ * @license Angular v22.1.2
35096
35560
  * (c) 2010-2026 Google LLC. https://angular.dev/
35097
35561
  * License: MIT
35098
35562
  *)